static assert to check OSAL_QUEUE_DEF's queue_depth parameter < 256

enable HOST_HCD_XFER_INTERRUPT by default (previously only enabled with HID), as it is widely used
implement tusbh_cdc_is_busy
add compilation switch in usbh enumeration for hub
rewrite CDC serial application to address usb-serial race condition
This commit is contained in:
hathach 2013-10-27 19:34:36 +07:00
parent 0d9e1163df
commit 318a058d3c
11 changed files with 7286 additions and 8352 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,125 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>host_freertos</name> <name>host_freertos</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers> <triggers>clean,full,incremental,</triggers>
<arguments> <arguments>
<dictionary> <dictionary>
<key>?name?</key> <key>?name?</key>
<value></value> <value></value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key> <key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value> <value>true</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key> <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value> <value>all</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key> <key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value> <value></value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key> <key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value> <value>make</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key> <key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/host/Debug}</value> <value>${workspace_loc:/host/Debug}</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key> <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value> <value>clean</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.contents</key> <key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value> <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key> <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value> <value>false</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key> <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value> <value>true</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key> <key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value> <value>true</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key> <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value> <value>all</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key> <key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value> <value>true</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value> <value>true</value>
</dictionary> </dictionary>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers> <triggers>full,incremental,</triggers>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.cdt.core.cnature</nature> <nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures> </natures>
<linkedResources> <linkedResources>
<link> <link>
<name>bsp</name> <name>bsp</name>
<type>2</type> <type>2</type>
<locationURI>PARENT-2-PROJECT_LOC/bsp</locationURI> <locationURI>PARENT-2-PROJECT_LOC/bsp</locationURI>
</link> </link>
<link> <link>
<name>fatfs</name> <name>fatfs</name>
<type>2</type> <type>2</type>
<locationURI>PARENT-3-PROJECT_LOC/vendor/fatfs</locationURI> <locationURI>PARENT-3-PROJECT_LOC/vendor/fatfs</locationURI>
</link> </link>
<link> <link>
<name>freertos</name> <name>freertos</name>
<type>2</type> <type>2</type>
<locationURI>PARENT-3-PROJECT_LOC/vendor/freertos</locationURI> <locationURI>PARENT-3-PROJECT_LOC/vendor/freertos</locationURI>
</link> </link>
<link> <link>
<name>lwip</name> <name>lwip</name>
<type>2</type> <type>2</type>
<locationURI>PARENT-3-PROJECT_LOC/vendor/lwip</locationURI> <locationURI>PARENT-3-PROJECT_LOC/vendor/lwip</locationURI>
</link> </link>
<link> <link>
<name>src</name> <name>src</name>
<type>2</type> <type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/src</locationURI> <locationURI>PARENT-1-PROJECT_LOC/src</locationURI>
</link> </link>
<link> <link>
<name>tinyusb</name> <name>tinyusb</name>
<type>2</type> <type>2</type>
<locationURI>PARENT-3-PROJECT_LOC/tinyusb</locationURI> <locationURI>PARENT-3-PROJECT_LOC/tinyusb</locationURI>
</link> </link>
</linkedResources> </linkedResources>
<filteredResources> <filteredResources>
<filter> <filter>
<id>1366799906386</id> <id>1382869902141</id>
<name></name> <name></name>
<type>26</type> <type>26</type>
<matcher> <matcher>
<id>org.eclipse.ui.ide.multiFilter</id> <id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-startup_keil</arguments> <arguments>1.0-name-matches-false-false-startup_keil</arguments>
</matcher> </matcher>
</filter> </filter>
</filteredResources> <filter>
</projectDescription> <id>1382869902149</id>
<name></name>
<type>26</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-startup_iar</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

File diff suppressed because it is too large Load Diff

View File

@ -53,24 +53,22 @@ OSAL_TASK_DEF(cdc_serial_app_task, 128, CDC_SERIAL_APP_TASK_PRIO);
OSAL_QUEUE_DEF(queue_def, QUEUE_SERIAL_DEPTH, uint8_t); OSAL_QUEUE_DEF(queue_def, QUEUE_SERIAL_DEPTH, uint8_t);
static osal_queue_handle_t queue_hdl; static osal_queue_handle_t queue_hdl;
static uint8_t buffer_in[64] TUSB_CFG_ATTR_USBRAM;
static uint8_t serial_in_buffer[32] TUSB_CFG_ATTR_USBRAM;
static uint8_t serial_out_buffer[32] TUSB_CFG_ATTR_USBRAM;
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// tinyusb Callbacks // tinyusb Callbacks
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void tusbh_cdc_mounted_cb(uint8_t dev_addr) void tusbh_cdc_mounted_cb(uint8_t dev_addr)
{ { // application set-up
// application set-up
printf("\na CDC device is mounted\n"); printf("\na CDC device is mounted\n");
osal_queue_flush(queue_hdl); osal_queue_flush(queue_hdl);
tusbh_cdc_receive(dev_addr, buffer_in, sizeof(buffer_in), true); // first report
} }
void tusbh_cdc_unmounted_cb(uint8_t dev_addr) void tusbh_cdc_unmounted_cb(uint8_t dev_addr)
{ { // application tear-down
// application tear-down
printf("\na CDC device is unmounted\n"); printf("\na CDC device is unmounted\n");
} }
@ -83,27 +81,20 @@ void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_
case TUSB_EVENT_XFER_COMPLETE: case TUSB_EVENT_XFER_COMPLETE:
for(uint32_t i=0; i<xferred_bytes; i++) for(uint32_t i=0; i<xferred_bytes; i++)
{ {
osal_queue_send(queue_hdl, buffer_in+i); osal_queue_send(queue_hdl, serial_in_buffer+i);
} }
tusbh_cdc_receive(dev_addr, buffer_in, sizeof(buffer_in), true); break;
break;
case TUSB_EVENT_XFER_ERROR: case TUSB_EVENT_XFER_ERROR: break; // ignore
tusbh_cdc_receive(dev_addr, buffer_in, sizeof(buffer_in), true); // ignore & continue
break;
case TUSB_EVENT_XFER_STALLED: case TUSB_EVENT_XFER_STALLED:
default : default :
ASSERT(false, VOID_RETURN); // error ASSERT(false, VOID_RETURN);
break; break;
} }
}else if (pipe_id == CDC_PIPE_DATA_OUT)
{
}else if (pipe_id == CDC_PIPE_NOTIFICATION)
{
} }
else if (pipe_id == CDC_PIPE_DATA_OUT) { }
else if (pipe_id == CDC_PIPE_NOTIFICATION) { }
} }
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@ -111,7 +102,7 @@ void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void cdc_serial_app_init(void) void cdc_serial_app_init(void)
{ {
memclr_(buffer_in, sizeof(buffer_in)); memclr_(serial_in_buffer, sizeof(serial_in_buffer));
queue_hdl = osal_queue_create( OSAL_QUEUE_REF(queue_def) ); queue_hdl = osal_queue_create( OSAL_QUEUE_REF(queue_def) );
ASSERT_PTR( queue_hdl, VOID_RETURN); ASSERT_PTR( queue_hdl, VOID_RETURN);
@ -122,16 +113,39 @@ void cdc_serial_app_init(void)
//------------- main task -------------// //------------- main task -------------//
OSAL_TASK_FUNCTION( cdc_serial_app_task ) (void* p_task_para) OSAL_TASK_FUNCTION( cdc_serial_app_task ) (void* p_task_para)
{ {
tusb_error_t error;
uint8_t c = 0;
OSAL_TASK_LOOP_BEGIN OSAL_TASK_LOOP_BEGIN
osal_queue_receive(queue_hdl, &c, OSAL_TIMEOUT_WAIT_FOREVER, &error); for(uint8_t dev_addr=0; dev_addr< TUSB_CFG_HOST_DEVICE_MAX; dev_addr++)
if (c)
{ {
printf("%c", c); if ( tusbh_cdc_serial_is_mounted(dev_addr) )
{
//------------- send characters got from uart terminal -------------//
int ch_tx = getchar();
if ( ch_tx > 0 )
{ // USB is much faster than serial, here we assume usb is always complete. There could be some characters missing
serial_out_buffer[0] = (uint8_t) ch_tx;
if ( !tusbh_cdc_is_busy(dev_addr, CDC_PIPE_DATA_OUT) )
{
tusbh_cdc_send(dev_addr, serial_out_buffer, 1, false); // no need for interrupt on serial out pipe
}
}
//------------- print out received characters -------------//
tusb_error_t error;
do{
uint8_t ch_rx = 0;
osal_queue_receive(queue_hdl, &ch_rx, OSAL_TIMEOUT_NOTIMEOUT, &error); // instant return
if (error == TUSB_ERROR_NONE && ch_rx) printf("%c", ch_rx);
}while (error == TUSB_ERROR_NONE);
if ( !tusbh_cdc_is_busy(dev_addr, CDC_PIPE_DATA_IN) )
{
tusbh_cdc_receive(dev_addr, serial_in_buffer, sizeof(serial_in_buffer), true);
}
break; // demo app only communicate with the first CDC-capable device
}
} }
OSAL_TASK_LOOP_END OSAL_TASK_LOOP_END

View File

@ -170,7 +170,7 @@ void test_task_with_semaphore(void)
TEST_ASSERT_EQUAL(1, statements[3]); TEST_ASSERT_EQUAL(1, statements[3]);
// timeout // timeout
for(uint32_t i=0; i<(OSAL_TIMEOUT_NORMAL*TUSB_CFG_OS_TICKS_PER_SECOND)/1000 ; i++) // not enough time for(uint32_t i=0; i<(OSAL_TIMEOUT_NORMAL*TUSB_CFG_OS_TICKS_PER_SECOND)/1000 - 1 ; i++) // not enough time
osal_tick_tock(); osal_tick_tock();
sample_task_semaphore(); sample_task_semaphore();
TEST_ASSERT_EQUAL(0, statements[4]); TEST_ASSERT_EQUAL(0, statements[4]);
@ -241,7 +241,7 @@ void test_task_with_mutex(void)
TEST_ASSERT_EQUAL(0, statements[5]); TEST_ASSERT_EQUAL(0, statements[5]);
// timeout // timeout
for(uint32_t i=0; i<(OSAL_TIMEOUT_NORMAL*TUSB_CFG_OS_TICKS_PER_SECOND)/1000 ; i++){ // one tick less for(uint32_t i=0; i<(OSAL_TIMEOUT_NORMAL*TUSB_CFG_OS_TICKS_PER_SECOND)/1000 - 1 ; i++){ // one tick less
osal_tick_tock(); osal_tick_tock();
} }
mutex_sample_task2(); mutex_sample_task2();
@ -311,7 +311,7 @@ void test_task_with_queue(void)
TEST_ASSERT_EQUAL(1, statements[3]); TEST_ASSERT_EQUAL(1, statements[3]);
// timeout // timeout
for(uint32_t i=0; i<(OSAL_TIMEOUT_NORMAL*TUSB_CFG_OS_TICKS_PER_SECOND)/1000 ; i++) // not enough time for(uint32_t i=0; i<(OSAL_TIMEOUT_NORMAL*TUSB_CFG_OS_TICKS_PER_SECOND)/1000 - 1 ; i++) // not enough time
osal_tick_tock(); osal_tick_tock();
sample_task_with_queue(); sample_task_with_queue();
TEST_ASSERT_EQUAL(0, statements[4]); TEST_ASSERT_EQUAL(0, statements[4]);

View File

@ -58,6 +58,17 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
/*STATIC_*/ cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO to be static /*STATIC_*/ cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO to be static
static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl)
{
cdch_data_t const * p_cdc = &cdch_data[pipe_hdl.dev_addr-1];
return pipehandle_is_equal( pipe_hdl, p_cdc->pipe_notification ) ? CDC_PIPE_NOTIFICATION :
pipehandle_is_equal( pipe_hdl, p_cdc->pipe_in ) ? CDC_PIPE_DATA_IN :
pipehandle_is_equal( pipe_hdl, p_cdc->pipe_out ) ? CDC_PIPE_DATA_OUT : CDC_PIPE_ERROR;
}
STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr) STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr)
{ {
@ -70,16 +81,29 @@ STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr)
#endif #endif
} }
static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl) ATTR_PURE ATTR_ALWAYS_INLINE; bool tusbh_cdc_is_busy(uint8_t dev_addr, cdc_pipeid_t pipeid)
static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl)
{ {
cdch_data_t const * p_cdc = &cdch_data[pipe_hdl.dev_addr-1]; if ( !tusbh_cdc_is_mounted(dev_addr) ) return false;
return pipehandle_is_equal( pipe_hdl, p_cdc->pipe_notification ) ? CDC_PIPE_NOTIFICATION : cdch_data_t const * p_cdc = &cdch_data[dev_addr-1];
pipehandle_is_equal( pipe_hdl, p_cdc->pipe_in ) ? CDC_PIPE_DATA_IN :
pipehandle_is_equal( pipe_hdl, p_cdc->pipe_out ) ? CDC_PIPE_DATA_OUT : CDC_PIPE_ERROR; switch (pipeid)
{
case CDC_PIPE_NOTIFICATION:
return hcd_pipe_is_busy( p_cdc->pipe_notification );
case CDC_PIPE_DATA_IN:
return hcd_pipe_is_busy( p_cdc->pipe_in );
case CDC_PIPE_DATA_OUT:
return hcd_pipe_is_busy( p_cdc->pipe_out );
default:
return false;
}
} }
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// APPLICATION API (parameter validation needed) // APPLICATION API (parameter validation needed)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@ -64,6 +64,8 @@ typedef enum {
* @{ */ * @{ */
bool tusbh_cdc_serial_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT; bool tusbh_cdc_serial_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
bool tusbh_cdc_is_busy(uint8_t dev_addr, cdc_pipeid_t pipeid) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
tusb_error_t tusbh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t length, bool is_notify); tusb_error_t tusbh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t length, bool is_notify);
tusb_error_t tusbh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify); tusb_error_t tusbh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify);

View File

@ -69,6 +69,7 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// EHCI CONFIGURATION & CONSTANTS // EHCI CONFIGURATION & CONSTANTS
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define HOST_HCD_XFER_INTERRUPT // TODO interrupt is used widely, should always be enalbed
#define EHCI_PERIODIC_LIST (defined HOST_HCD_XFER_INTERRUPT || defined HOST_HCD_XFER_ISOCHRONOUS) #define EHCI_PERIODIC_LIST (defined HOST_HCD_XFER_INTERRUPT || defined HOST_HCD_XFER_ISOCHRONOUS)
// TODO allow user to configure // TODO allow user to configure

View File

@ -392,6 +392,7 @@ tusb_error_t enumeration_body_subtask(void)
SUBTASK_EXIT(TUSB_ERROR_NONE); // restart task SUBTASK_EXIT(TUSB_ERROR_NONE); // restart task
} }
} }
#if TUSB_CFG_HOST_HUB
else else
{ // connected/disconnected via hub { // connected/disconnected via hub
//------------- Get Port Status -------------// //------------- Get Port Status -------------//
@ -428,6 +429,7 @@ tusb_error_t enumeration_body_subtask(void)
OSAL_SUBTASK_INVOKED_AND_WAIT( hub_port_clear_feature_subtask(usbh_devices[0].hub_addr, usbh_devices[0].hub_port, HUB_FEATURE_PORT_RESET_CHANGE), error ); OSAL_SUBTASK_INVOKED_AND_WAIT( hub_port_clear_feature_subtask(usbh_devices[0].hub_addr, usbh_devices[0].hub_port, HUB_FEATURE_PORT_RESET_CHANGE), error );
} }
} }
#endif
SUBTASK_ASSERT_STATUS( usbh_pipe_control_open(0, 8) ); SUBTASK_ASSERT_STATUS( usbh_pipe_control_open(0, 8) );
usbh_devices[0].state = TUSB_DEVICE_STATE_ADDRESSED; usbh_devices[0].state = TUSB_DEVICE_STATE_ADDRESSED;
@ -446,7 +448,9 @@ tusb_error_t enumeration_body_subtask(void)
SUBTASK_ASSERT_STATUS(error); // TODO some slow device is observed to fail the very fist controller xfer, can try more times SUBTASK_ASSERT_STATUS(error); // TODO some slow device is observed to fail the very fist controller xfer, can try more times
hcd_port_reset( usbh_devices[0].core_id ); // reset port after 8 byte descriptor hcd_port_reset( usbh_devices[0].core_id ); // reset port after 8 byte descriptor
// osal_task_delay(50); // TODO reset is recommended to last 50 ms (NXP EHCI passes this) // osal_task_delay(50); // TODO reset is recommended to last 50 ms (NXP EHCI passes this)
}else }
#if TUSB_CFG_HOST_HUB
else
{ // connected via a hub { // connected via a hub
SUBTASK_ASSERT_STATUS_WITH_HANDLER(error, hub_status_pipe_queue( usbh_devices[0].hub_addr) ); // TODO hub refractor SUBTASK_ASSERT_STATUS_WITH_HANDLER(error, hub_status_pipe_queue( usbh_devices[0].hub_addr) ); // TODO hub refractor
OSAL_SUBTASK_INVOKED_AND_WAIT ( hub_port_reset_subtask(usbh_devices[0].hub_addr, usbh_devices[0].hub_port), error ); OSAL_SUBTASK_INVOKED_AND_WAIT ( hub_port_reset_subtask(usbh_devices[0].hub_addr, usbh_devices[0].hub_port), error );
@ -458,6 +462,7 @@ tusb_error_t enumeration_body_subtask(void)
(void) hub_status_pipe_queue( usbh_devices[0].hub_addr ); // done with hub, waiting for next data on status pipe (void) hub_status_pipe_queue( usbh_devices[0].hub_addr ); // done with hub, waiting for next data on status pipe
} }
#endif
//------------- Set new address -------------// //------------- Set new address -------------//
new_addr = get_new_address(); new_addr = get_new_address();

View File

@ -263,6 +263,7 @@ typedef osal_queue_t * osal_queue_handle_t;
// use to declare a queue, within the scope of tinyusb, should only use primitive type only // use to declare a queue, within the scope of tinyusb, should only use primitive type only
#define OSAL_QUEUE_DEF(name, queue_depth, type)\ #define OSAL_QUEUE_DEF(name, queue_depth, type)\
STATIC_ASSERT(queue_depth < 256, "OSAL Queue only support up to 255 depth");\
type name##_buffer[queue_depth];\ type name##_buffer[queue_depth];\
osal_queue_t name = {\ osal_queue_t name = {\
.buffer = (uint8_t*) name##_buffer,\ .buffer = (uint8_t*) name##_buffer,\

View File

@ -147,9 +147,9 @@
//------------- HID CLASS -------------// //------------- HID CLASS -------------//
#define HOST_CLASS_HID ( TUSB_CFG_HOST_HID_KEYBOARD + TUSB_CFG_HOST_HID_MOUSE + TUSB_CFG_HOST_HID_GENERIC ) #define HOST_CLASS_HID ( TUSB_CFG_HOST_HID_KEYBOARD + TUSB_CFG_HOST_HID_MOUSE + TUSB_CFG_HOST_HID_GENERIC )
#if HOST_CLASS_HID // #if HOST_CLASS_HID
#define HOST_HCD_XFER_INTERRUPT // #define HOST_HCD_XFER_INTERRUPT
#endif // #endif
#ifndef TUSB_CFG_HOST_ENUM_BUFFER_SIZE #ifndef TUSB_CFG_HOST_ENUM_BUFFER_SIZE
#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256 #define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256