mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 04:18:56 +00:00
rename usbd_dcd_bus_event_isr to hal_dcd_bus_event
This commit is contained in:
parent
394302c8cb
commit
185b240f03
@ -534,7 +534,7 @@ void dcd_isr(uint8_t coreid)
|
||||
if (int_status & INT_MASK_RESET)
|
||||
{
|
||||
bus_reset(coreid);
|
||||
usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESET);
|
||||
hal_dcd_bus_event(coreid, USBD_BUS_EVENT_RESET);
|
||||
}
|
||||
|
||||
if (int_status & INT_MASK_SUSPEND)
|
||||
@ -543,7 +543,7 @@ void dcd_isr(uint8_t coreid)
|
||||
{ // Note: Host may delay more than 3 ms before and/or after bus reset before doing enumeration.
|
||||
if ((lpc_usb->DEVICEADDR >> 25) & 0x0f)
|
||||
{
|
||||
usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_SUSPENDED);
|
||||
hal_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -553,7 +553,7 @@ void dcd_isr(uint8_t coreid)
|
||||
// {
|
||||
// if ( !(lpc_usb->PORTSC1_D & PORTSC_CURRENT_CONNECT_STATUS_MASK) )
|
||||
// {
|
||||
// usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_UNPLUGGED);
|
||||
// hal_dcd_bus_event(0, USBD_BUS_EVENT_UNPLUGGED);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
@ -49,6 +49,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
USBD_BUS_EVENT_RESET = 1,
|
||||
USBD_BUS_EVENT_UNPLUGGED,
|
||||
USBD_BUS_EVENT_SUSPENDED,
|
||||
USBD_BUS_EVENT_RESUME
|
||||
}usbd_bus_event_type_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t coreid;
|
||||
uint8_t reserved; // TODO redundant, cannot be control as control uses separated API
|
||||
@ -68,15 +76,19 @@ static inline bool endpointhandle_is_equal(endpoint_handle_t x, endpoint_handle_
|
||||
return (x.coreid == y.coreid) && (x.index == y.index) && (x.class_code == y.class_code);
|
||||
}
|
||||
|
||||
bool hal_dcd_init(uint8_t coreid);
|
||||
|
||||
void dcd_isr(uint8_t coreid);
|
||||
|
||||
//------------- Controller API -------------//
|
||||
void hal_dcd_connect (uint8_t coreid);
|
||||
void hal_dcd_disconnect (uint8_t coreid);
|
||||
void hal_dcd_set_address(uint8_t coreid, uint8_t dev_addr);
|
||||
void hal_dcd_set_config (uint8_t coreid, uint8_t config_num);
|
||||
bool hal_dcd_init (uint8_t coreid);
|
||||
void hal_dcd_connect (uint8_t coreid);
|
||||
void hal_dcd_disconnect (uint8_t coreid);
|
||||
void hal_dcd_set_address (uint8_t coreid, uint8_t dev_addr);
|
||||
void hal_dcd_set_config (uint8_t coreid, uint8_t config_num);
|
||||
|
||||
/*------------- Event function -------------*/
|
||||
void hal_dcd_setup_received(uint8_t coreid, uint8_t const* p_request);
|
||||
void hal_dcd_bus_event(uint8_t coreid, usbd_bus_event_type_t bus_event);
|
||||
|
||||
//------------- PIPE API -------------//
|
||||
bool dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete);
|
||||
|
@ -230,23 +230,23 @@ void dcd_isr(uint8_t coreid)
|
||||
if (dev_status_reg & SIE_DEV_STATUS_RESET_MASK)
|
||||
{
|
||||
bus_reset();
|
||||
usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESET);
|
||||
hal_dcd_bus_event(0, USBD_BUS_EVENT_RESET);
|
||||
}
|
||||
|
||||
if (dev_status_reg & SIE_DEV_STATUS_CONNECT_CHANGE_MASK)
|
||||
{ // device is disconnected, require using VBUS (P1_30)
|
||||
usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_UNPLUGGED);
|
||||
hal_dcd_bus_event(0, USBD_BUS_EVENT_UNPLUGGED);
|
||||
}
|
||||
|
||||
if (dev_status_reg & SIE_DEV_STATUS_SUSPEND_CHANGE_MASK)
|
||||
{
|
||||
if (dev_status_reg & SIE_DEV_STATUS_SUSPEND_MASK)
|
||||
{
|
||||
usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_SUSPENDED);
|
||||
hal_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESUME);
|
||||
// hal_dcd_bus_event(0, USBD_BUS_EVENT_RESUME);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -315,14 +315,14 @@ void dcd_isr(uint8_t coreid)
|
||||
if ( dev_cmd_stat & CMDSTAT_RESET_CHANGE_MASK) // bus reset
|
||||
{
|
||||
bus_reset();
|
||||
usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESET);
|
||||
hal_dcd_bus_event(0, USBD_BUS_EVENT_RESET);
|
||||
}
|
||||
|
||||
if (dev_cmd_stat & CMDSTAT_CONNECT_CHANGE_MASK)
|
||||
{ // device disconnect
|
||||
if (dev_cmd_stat & CMDSTAT_DEVICE_ADDR_MASK)
|
||||
{ // debouncing as this can be set when device is powering
|
||||
usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_UNPLUGGED);
|
||||
hal_dcd_bus_event(0, USBD_BUS_EVENT_UNPLUGGED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,13 +334,13 @@ void dcd_isr(uint8_t coreid)
|
||||
// Note: Host may delay more than 3 ms before and/or after bus reset before doing enumeration.
|
||||
if (dev_cmd_stat & CMDSTAT_DEVICE_ADDR_MASK)
|
||||
{
|
||||
usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_SUSPENDED);
|
||||
hal_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
|
||||
}
|
||||
}
|
||||
}
|
||||
// else
|
||||
// { // resume signal
|
||||
// usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESUME);
|
||||
// hal_dcd_bus_event(0, USBD_BUS_EVENT_RESUME);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -409,12 +409,11 @@ static tusb_error_t get_descriptor(uint8_t coreid, tusb_control_request_t const
|
||||
//--------------------------------------------------------------------+
|
||||
// USBD-DCD Callback API
|
||||
//--------------------------------------------------------------------+
|
||||
void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event)
|
||||
void hal_dcd_bus_event(uint8_t coreid, usbd_bus_event_type_t bus_event)
|
||||
{
|
||||
switch(bus_event)
|
||||
{
|
||||
case USBD_BUS_EVENT_RESET :
|
||||
case USBD_BUS_EVENT_UNPLUGGED :
|
||||
memclr_(&usbd_devices[coreid], sizeof(usbd_device_info_t));
|
||||
osal_queue_flush(usbd_queue_hdl);
|
||||
osal_semaphore_reset(usbd_control_xfer_sem_hdl);
|
||||
@ -424,6 +423,8 @@ void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event)
|
||||
}
|
||||
break;
|
||||
|
||||
case USBD_BUS_EVENT_UNPLUGGED : break;
|
||||
|
||||
case USBD_BUS_EVENT_SUSPENDED:
|
||||
usbd_devices[coreid].state = TUSB_DEVICE_STATE_SUSPENDED;
|
||||
break;
|
||||
|
@ -55,13 +55,7 @@ enum {
|
||||
USBD_INTERFACE_NUM_MAX = 16 // USB specs specify up to 16 endpoints per device
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
USBD_BUS_EVENT_RESET = 1,
|
||||
USBD_BUS_EVENT_UNPLUGGED,
|
||||
USBD_BUS_EVENT_SUSPENDED,
|
||||
USBD_BUS_EVENT_RESUME
|
||||
}usbd_bus_event_type_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
volatile uint8_t state;
|
||||
@ -74,9 +68,6 @@ extern usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER];
|
||||
//--------------------------------------------------------------------+
|
||||
// callback from DCD ISR
|
||||
//--------------------------------------------------------------------+
|
||||
void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event);
|
||||
void hal_dcd_setup_received(uint8_t coreid, uint8_t const* p_request);
|
||||
|
||||
void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user