Merge branch 'master' into refactor-irqhandler

This commit is contained in:
Ha Thach
2020-04-11 15:49:34 +07:00
committed by GitHub
49 changed files with 2527 additions and 104 deletions

View File

@@ -106,6 +106,12 @@ void dcd_set_config (uint8_t rhport, uint8_t config_num);
// Wake up host
void dcd_remote_wakeup(uint8_t rhport);
// Connect or disconnect D+/D- line pull-up resistor.
// Defined in dcd source if MCU has internal pull-up.
// Otherwise, may be defined in BSP.
void dcd_connect(uint8_t rhport) TU_ATTR_WEAK;
void dcd_disconnect(uint8_t rhport) TU_ATTR_WEAK;
//--------------------------------------------------------------------+
// Endpoint API
//--------------------------------------------------------------------+

View File

@@ -332,6 +332,7 @@ bool tud_init (void)
// Init device controller driver
dcd_init(TUD_OPT_RHPORT);
tud_connect();
dcd_int_enable(TUD_OPT_RHPORT);
return true;
@@ -421,7 +422,7 @@ void tud_task (void)
uint8_t const epnum = tu_edpt_number(ep_addr);
uint8_t const ep_dir = tu_edpt_dir(ep_addr);
TU_LOG2(" Endpoint: 0x%02X, Bytes: %ld\r\n", ep_addr, event.xfer_complete.len);
TU_LOG2(" Endpoint: 0x%02X, Bytes: %u\r\n", ep_addr, (unsigned int) event.xfer_complete.len);
_usbd_dev.ep_status[epnum][ep_dir].busy = false;

View File

@@ -65,6 +65,20 @@ static inline bool tud_ready(void)
// Remote wake up host, only if suspended and enabled by host
bool tud_remote_wakeup(void);
static inline bool tud_disconnect(void)
{
TU_VERIFY(dcd_disconnect);
dcd_disconnect(TUD_OPT_RHPORT);
return true;
}
static inline bool tud_connect(void)
{
TU_VERIFY(dcd_connect);
dcd_connect(TUD_OPT_RHPORT);
return true;
}
// Carry out Data and Status stage of control transfer
// - If len = 0, it is equivalent to sending status only
// - If len > wLength : it will be truncated