@@ -249,7 +249,7 @@ uint32_t board_millis(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void HardFault_Handler(void) {
|
void HardFault_Handler(void) {
|
||||||
asm("bkpt");
|
asm("bkpt 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required by __libc_init_array in startup code if we are compiling using
|
// Required by __libc_init_array in startup code if we are compiling using
|
||||||
|
@@ -2015,7 +2015,10 @@ static bool audiod_control_request(uint8_t rhport, tusb_control_request_t const
|
|||||||
case TUSB_REQ_SET_INTERFACE:
|
case TUSB_REQ_SET_INTERFACE:
|
||||||
return audiod_set_interface(rhport, p_request);
|
return audiod_set_interface(rhport, p_request);
|
||||||
|
|
||||||
// Unknown/Unsupported request
|
case TUSB_REQ_CLEAR_FEATURE:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Unknown/Unsupported request
|
||||||
default: TU_BREAKPOINT(); return false;
|
default: TU_BREAKPOINT(); return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7, M33. M55
|
// Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7, M33. M55
|
||||||
#if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8_1M_MAIN__)
|
#if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8_1M_MAIN__) || \
|
||||||
|
defined(__ARM7M__) || defined (__ARM7EM__) || defined(__ARM8M_MAINLINE__) || defined(__ARM8EM_MAINLINE__)
|
||||||
#define TU_BREAKPOINT() do \
|
#define TU_BREAKPOINT() do \
|
||||||
{ \
|
{ \
|
||||||
volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); /* Cortex M CoreDebug->DHCSR */ \
|
volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); /* Cortex M CoreDebug->DHCSR */ \
|
||||||
|
@@ -202,10 +202,10 @@ static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoin
|
|||||||
(xfer->max_size << DOEPCTL_MPSIZ_Pos);
|
(xfer->max_size << DOEPCTL_MPSIZ_Pos);
|
||||||
|
|
||||||
if (dir == TUSB_DIR_OUT) {
|
if (dir == TUSB_DIR_OUT) {
|
||||||
dwc2->epout[epnum].doepctl |= dxepctl;
|
dwc2->epout[epnum].doepctl = dxepctl;
|
||||||
dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum);
|
dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum);
|
||||||
} else {
|
} else {
|
||||||
dwc2->epin[epnum].diepctl |= dxepctl | (epnum << DIEPCTL_TXFNUM_Pos);
|
dwc2->epin[epnum].diepctl = dxepctl | (epnum << DIEPCTL_TXFNUM_Pos);
|
||||||
dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum));
|
dwc2->daintmsk |= (1 << (DAINTMSK_IEPM_Pos + epnum));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,10 +280,17 @@ static void bus_reset(uint8_t rhport) {
|
|||||||
dwc2->epout[n].doepctl |= DOEPCTL_SNAK;
|
dwc2->epout[n].doepctl |= DOEPCTL_SNAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2. Disable all IN endpoints
|
||||||
|
for (uint8_t n = 0; n < ep_count; n++) {
|
||||||
|
if (dwc2->epin[n].diepctl & DIEPCTL_EPENA) {
|
||||||
|
dwc2->epin[n].diepctl |= DIEPCTL_SNAK | DIEPCTL_EPDIS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fifo_flush_tx(dwc2, 0x10); // all tx fifo
|
fifo_flush_tx(dwc2, 0x10); // all tx fifo
|
||||||
fifo_flush_rx(dwc2);
|
fifo_flush_rx(dwc2);
|
||||||
|
|
||||||
// 2. Set up interrupt mask
|
// 3. Set up interrupt mask
|
||||||
dwc2->daintmsk = TU_BIT(DAINTMSK_OEPM_Pos) | TU_BIT(DAINTMSK_IEPM_Pos);
|
dwc2->daintmsk = TU_BIT(DAINTMSK_OEPM_Pos) | TU_BIT(DAINTMSK_IEPM_Pos);
|
||||||
dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM;
|
dwc2->doepmsk = DOEPMSK_STUPM | DOEPMSK_XFRCM;
|
||||||
dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM;
|
dwc2->diepmsk = DIEPMSK_TOM | DIEPMSK_XFRCM;
|
||||||
@@ -704,11 +711,15 @@ void dcd_edpt_close_all(uint8_t rhport) {
|
|||||||
|
|
||||||
for (uint8_t n = 1; n < ep_count; n++) {
|
for (uint8_t n = 1; n < ep_count; n++) {
|
||||||
// disable OUT endpoint
|
// disable OUT endpoint
|
||||||
dwc2->epout[n].doepctl = 0;
|
if (dwc2->epout[n].doepctl & DOEPCTL_EPENA) {
|
||||||
|
dwc2->epout[n].doepctl |= DOEPCTL_SNAK | DOEPCTL_EPDIS;
|
||||||
|
}
|
||||||
xfer_status[n][TUSB_DIR_OUT].max_size = 0;
|
xfer_status[n][TUSB_DIR_OUT].max_size = 0;
|
||||||
|
|
||||||
// disable IN endpoint
|
// disable IN endpoint
|
||||||
dwc2->epin[n].diepctl = 0;
|
if (dwc2->epin[n].diepctl & DIEPCTL_EPENA) {
|
||||||
|
dwc2->epin[n].diepctl |= DIEPCTL_SNAK | DIEPCTL_EPDIS;
|
||||||
|
}
|
||||||
xfer_status[n][TUSB_DIR_IN].max_size = 0;
|
xfer_status[n][TUSB_DIR_IN].max_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user