@@ -118,10 +118,6 @@ typedef struct {
118
118
// MACRO CONSTANT TYPEDEF
119
119
//--------------------------------------------------------------------+
120
120
121
- // Invalid driver ID in itf2drv[] ep2drv[][] mapping
122
- enum { DRVID_INVALID = 0xFFu };
123
- enum { CONTROLLER_INVALID = 0xFFu };
124
-
125
121
#if CFG_TUSB_DEBUG >= 2
126
122
#define DRIVER_NAME (_name ) .name = _name,
127
123
#else
@@ -199,7 +195,7 @@ enum { CONFIG_NUM = 1 }; // default to use configuration 1
199
195
// sum of end device + hub
200
196
#define TOTAL_DEVICES (CFG_TUH_DEVICE_MAX + CFG_TUH_HUB)
201
197
202
- static uint8_t _usbh_controller = CONTROLLER_INVALID ;
198
+ static uint8_t _usbh_controller = TU_INDEX_INVALID_8 ;
203
199
204
200
// Device with address = 0 for enumeration
205
201
static usbh_dev0_t _dev0 ;
@@ -307,13 +303,13 @@ tusb_speed_t tuh_speed_get (uint8_t dev_addr)
307
303
static void clear_device (usbh_device_t * dev )
308
304
{
309
305
tu_memclr (dev , sizeof (usbh_device_t ));
310
- memset (dev -> itf2drv , DRVID_INVALID , sizeof (dev -> itf2drv )); // invalid mapping
311
- memset (dev -> ep2drv , DRVID_INVALID , sizeof (dev -> ep2drv )); // invalid mapping
306
+ memset (dev -> itf2drv , TU_INDEX_INVALID_8 , sizeof (dev -> itf2drv )); // invalid mapping
307
+ memset (dev -> ep2drv , TU_INDEX_INVALID_8 , sizeof (dev -> ep2drv )); // invalid mapping
312
308
}
313
309
314
310
bool tuh_inited (void )
315
311
{
316
- return _usbh_controller != CONTROLLER_INVALID ;
312
+ return _usbh_controller != TU_INDEX_INVALID_8 ;
317
313
}
318
314
319
315
bool tuh_init (uint8_t controller_id )
@@ -402,11 +398,11 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr)
402
398
// one device before enumerating another one.
403
399
if ( _dev0 .enumerating )
404
400
{
405
- TU_LOG1 ("[%u:] USBH Defer Attach until current enumeration complete\r\n" , event .rhport );
401
+ TU_LOG_USBH ("[%u:] USBH Defer Attach until current enumeration complete\r\n" , event .rhport );
406
402
osal_queue_send (_usbh_q , & event , in_isr );
407
403
}else
408
404
{
409
- TU_LOG1 ("[%u:] USBH DEVICE ATTACH\r\n" , event .rhport );
405
+ TU_LOG_USBH ("[%u:] USBH DEVICE ATTACH\r\n" , event .rhport );
410
406
_dev0 .enumerating = 1 ;
411
407
enum_new_device (& event );
412
408
}
@@ -1362,11 +1358,11 @@ static void process_enumeration(tuh_xfer_t* xfer)
1362
1358
1363
1359
dev -> configured = 1 ;
1364
1360
1365
- // Start the Set Configuration process for interfaces (itf = DRVID_INVALID )
1361
+ // Start the Set Configuration process for interfaces (itf = TU_INDEX_INVALID_8 )
1366
1362
// Since driver can perform control transfer within its set_config, this is done asynchronously.
1367
1363
// The process continue with next interface when class driver complete its sequence with usbh_driver_set_config_complete()
1368
- // TODO use separated API instead of using DRVID_INVALID
1369
- usbh_driver_set_config_complete (daddr , DRVID_INVALID );
1364
+ // TODO use separated API instead of using TU_INDEX_INVALID_8
1365
+ usbh_driver_set_config_complete (daddr , TU_INDEX_INVALID_8 );
1370
1366
}
1371
1367
break ;
1372
1368
@@ -1566,7 +1562,7 @@ static bool _parse_configuration_descriptor(uint8_t dev_addr, tusb_desc_configur
1566
1562
uint8_t const itf_num = desc_itf -> bInterfaceNumber + i ;
1567
1563
1568
1564
// Interface number must not be used already
1569
- TU_ASSERT ( DRVID_INVALID == dev -> itf2drv [itf_num ] );
1565
+ TU_ASSERT ( TU_INDEX_INVALID_8 == dev -> itf2drv [itf_num ] );
1570
1566
dev -> itf2drv [itf_num ] = drv_id ;
1571
1567
}
1572
1568
@@ -1600,7 +1596,7 @@ void usbh_driver_set_config_complete(uint8_t dev_addr, uint8_t itf_num)
1600
1596
// IAD binding interface such as CDCs should return itf_num + 1 when complete
1601
1597
// with usbh_driver_set_config_complete()
1602
1598
uint8_t const drv_id = dev -> itf2drv [itf_num ];
1603
- if (drv_id != DRVID_INVALID )
1599
+ if (drv_id != TU_INDEX_INVALID_8 )
1604
1600
{
1605
1601
usbh_class_driver_t const * driver = & usbh_class_drivers [drv_id ];
1606
1602
TU_LOG_USBH ("%s set config: itf = %u\r\n" , driver -> name , itf_num );
0 commit comments