summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-05-20 02:47:20 -0700
committerKeith Packard <keithp@keithp.com>2011-05-20 02:47:20 -0700
commitf7e552a0f4b1382a076b0f3ffc50ef068bfa141f (patch)
treea782717c90401c61c604678e253ef4924722ba3e
parented494fe0f95e5c949d3ef826cab415f23ed9f33a (diff)
src-avr: Reduce control connection interrupts
Leave these disabled while processing stuff; otherwise we receive a steady stream of them. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src-avr/ao_usb_avr.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src-avr/ao_usb_avr.c b/src-avr/ao_usb_avr.c
index 47a1487f..74bdea23 100644
--- a/src-avr/ao_usb_avr.c
+++ b/src-avr/ao_usb_avr.c
@@ -48,6 +48,7 @@ static __xdata uint8_t *__xdata ao_usb_ep0_out_data;
static __xdata uint8_t ao_usb_in_flushed;
static __xdata uint8_t ao_usb_running;
static __xdata uint8_t ao_usb_configuration;
+static __xdata uint8_t ueienx_0;
void
ao_usb_set_address(uint8_t address)
@@ -84,8 +85,8 @@ ao_usb_set_ep0(void)
(0 << EPBK0) | /* Single bank */
(1 << ALLOC));
- UEIENX = ((1 << RXSTPE) | /* Enable SETUP interrupt */
- (1 << RXOUTE)); /* Enable OUT interrupt */
+ ueienx_0 = ((1 << RXSTPE) | /* Enable SETUP interrupt */
+ (1 << RXOUTE)); /* Enable OUT interrupt */
// ao_usb_dump_ep(0);
ao_usb_addr_pending = 0;
@@ -164,10 +165,8 @@ ao_usb_ep0_set_in_pending(uint8_t in_pending)
{
ao_usb_ep0_in_pending = in_pending;
- if (in_pending) {
- UENUM = 0;
- UEIENX = ((1 << RXSTPE) | (1 << RXOUTE) | (1 << TXINE)); /* Enable IN interrupt */
- }
+ if (in_pending)
+ ueienx_0 = ((1 << RXSTPE) | (1 << RXOUTE) | (1 << TXINE)); /* Enable IN interrupt */
}
/* Send an IN data packet */
@@ -389,10 +388,12 @@ ao_usb_ep0(void)
UDADDR |= (1 << ADDEN);
ao_usb_addr_pending = 0;
}
- UEIENX = ((1 << RXSTPE) | (1 << RXOUTE)); /* Disable IN interrupt */
+ ueienx_0 = ((1 << RXSTPE) | (1 << RXOUTE)); /* Disable IN interrupt */
}
}
// debug ("usb task sleeping...\n");
+ UENUM = 0;
+ UEIENX = ueienx_0;
ao_sleep(&ao_usb_task);
}
sei();
@@ -556,6 +557,8 @@ ISR(USB_COM_vect)
#endif
UEINT = 0;
if (i & (1 << 0)) {
+ UENUM = 0;
+ UEIENX = 0;
ao_wakeup(&ao_usb_task);
++control_count;
}