summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-09-07 12:38:18 +0700
committerhathach <[email protected]>2023-09-07 12:38:18 +0700
commit21ab40bab2e2fee28fa595f648a17944696c3d65 (patch)
treeb91f251872cb3e4cd928fba4e586d821f3aa7718 /src/portable
parent1b9108ea0dc237835e801d26cc7eef052acad987 (diff)
- wrap up hcd max3421, work well with nrf52840
- also add usbh_defer_func()
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/analog/max3421/hcd_max3421.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/portable/analog/max3421/hcd_max3421.c b/src/portable/analog/max3421/hcd_max3421.c
index c61389cb9..95cf5516e 100644
--- a/src/portable/analog/max3421/hcd_max3421.c
+++ b/src/portable/analog/max3421/hcd_max3421.c
@@ -194,7 +194,6 @@ typedef struct {
uint8_t hxfr;
atomic_flag busy; // busy transferring
- volatile uint8_t intr_disable_count;
volatile uint16_t frame_count;
max3421_ep_t ep[CFG_TUH_MAX3421_ENDPOINT_TOTAL]; // [0] is reserved for addr0
@@ -241,14 +240,6 @@ static void max3421_spi_unlock(uint8_t rhport, bool in_isr) {
if (!in_isr) {
tuh_max3421e_int_api(rhport, true);
(void) osal_mutex_unlock(_hcd_data.spi_mutex);
-
- // when re-enable interrupt, we may miss INTR edge (usually via GPIO detection interrupt).
- // It would be ok if we are operating since SOF will re-trigger interrupt.
- // However, for CONDET_IRQ i.e host not operating therefore we need to manually handle it here.
- if (_hcd_data.hirq & HIRQ_CONDET_IRQ) {
- handle_connect_irq(rhport, false);
- hirq_write(rhport, HIRQ_CONDET_IRQ, false);
- }
}
}
@@ -470,28 +461,13 @@ bool hcd_init(uint8_t rhport) {
// Enable USB interrupt
// Not actually enable GPIO interrupt, just set variable to prevent handler to process
void hcd_int_enable (uint8_t rhport) {
-// tuh_max3421e_int_api(rhport, true);
-
- (void) rhport;
- if (_hcd_data.intr_disable_count) {
- _hcd_data.intr_disable_count--;
- }
-
- // when re-enable interrupt, we may miss INTR edge (usually via GPIO detection interrupt).
- // It would be ok if we are operating since SOF will re-trigger interrupt.
- // However, for CONDET_IRQ i.e host not operating therefore we need to manually handle it here.
-// if (_hcd_data.hirq & HIRQ_CONDET_IRQ) {
-// handle_connect_irq(rhport, false);
-// hirq_write(rhport, HIRQ_CONDET_IRQ, false);
-// }
+ tuh_max3421e_int_api(rhport, true);
}
// Disable USB interrupt
// Not actually disable GPIO interrupt, just set variable to prevent handler to process
void hcd_int_disable(uint8_t rhport) {
- //tuh_max3421e_int_api(rhport, false);
- (void) rhport;
- _hcd_data.intr_disable_count++;
+ tuh_max3421e_int_api(rhport, false);
}
// Get frame number (1ms)
@@ -896,14 +872,6 @@ void hcd_int_handler(uint8_t rhport) {
_hcd_data.frame_count++;
}
- // interrupt is disabled by usbh task: only ack FRAME IRQ and skip the rest
- if (_hcd_data.intr_disable_count) {
- if (hirq & HIRQ_FRAME_IRQ) {
- hirq_write(rhport, HIRQ_FRAME_IRQ, true);
- }
- return;
- }
-
if (hirq & HIRQ_CONDET_IRQ) {
handle_connect_irq(rhport, true);
}