mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-07 05:54:11 +08:00
detect bus reset
This commit is contained in:
parent
302746d02c
commit
bc21714c7e
@ -45,12 +45,8 @@
|
|||||||
#define UART_TX_PIN GPIO(GPIO_PORTA, 28)
|
#define UART_TX_PIN GPIO(GPIO_PORTA, 28)
|
||||||
#define UART_RX_PIN GPIO(GPIO_PORTA, 27)
|
#define UART_RX_PIN GPIO(GPIO_PORTA, 27)
|
||||||
|
|
||||||
//struct usart_async_descriptor _edbg_com;
|
|
||||||
//static uint8_t _edbg_com_buf[64];
|
|
||||||
|
|
||||||
struct _usart_sync_device _edbg_com;
|
struct _usart_sync_device _edbg_com;
|
||||||
|
|
||||||
|
|
||||||
//------------- IMPLEMENTATION -------------//
|
//------------- IMPLEMENTATION -------------//
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
@ -81,7 +77,6 @@ void board_init(void)
|
|||||||
_usart_sync_set_mode(&_edbg_com, USART_MODE_ASYNCHRONOUS);
|
_usart_sync_set_mode(&_edbg_com, USART_MODE_ASYNCHRONOUS);
|
||||||
_usart_sync_enable(&_edbg_com);
|
_usart_sync_enable(&_edbg_com);
|
||||||
|
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
// 1ms tick timer (samd SystemCoreClock may not correct)
|
// 1ms tick timer (samd SystemCoreClock may not correct)
|
||||||
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
|
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
|
||||||
|
@ -41,10 +41,10 @@
|
|||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
|
||||||
// Set up endpoint 0, clear all other endpoints
|
// Set up endpoint 0, clear all other endpoints
|
||||||
//static void bus_reset(void)
|
static void bus_reset(void)
|
||||||
//{
|
{
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
|
|
||||||
// Initialize controller to device mode
|
// Initialize controller to device mode
|
||||||
void dcd_init (uint8_t rhport)
|
void dcd_init (uint8_t rhport)
|
||||||
@ -133,9 +133,18 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr)
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void dcd_isr(uint8_t rhport)
|
void dcd_isr(uint8_t rhport)
|
||||||
{
|
{
|
||||||
(void) rhport;
|
uint32_t const intr_mask = UDP->UDP_IMR;
|
||||||
|
uint32_t const intr_status = UDP->UDP_ISR & intr_mask;
|
||||||
|
|
||||||
|
// clear interrupt
|
||||||
|
UDP->UDP_ICR = intr_status;
|
||||||
|
|
||||||
|
// Bus reset
|
||||||
|
if (intr_status & UDP_ISR_ENDBUSRES)
|
||||||
|
{
|
||||||
|
bus_reset();
|
||||||
|
dcd_event_bus_signal(rhport, DCD_EVENT_BUS_RESET, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user