@@ -318,7 +318,7 @@ void usbd_driver_print_control_complete_name(usbd_control_xfer_cb_t callback)
318
318
usbd_class_driver_t const * driver = get_driver (i );
319
319
if ( driver -> control_xfer_cb == callback )
320
320
{
321
- TU_LOG2 ( " %s control complete\r\n" , driver -> name );
321
+ TU_LOG ( USBD_DBG , " %s control complete\r\n" , driver -> name );
322
322
return ;
323
323
}
324
324
}
@@ -384,8 +384,8 @@ bool tud_init (uint8_t rhport)
384
384
// skip if already initialized
385
385
if ( tud_inited () ) return true;
386
386
387
- TU_LOG2 ( "USBD init on controller %u\r\n" , rhport );
388
- TU_LOG2_INT ( sizeof (usbd_device_t ));
387
+ TU_LOG ( USBD_DBG , "USBD init on controller %u\r\n" , rhport );
388
+ TU_LOG_INT ( USBD_DBG , sizeof (usbd_device_t ));
389
389
390
390
tu_varclr (& _usbd_dev );
391
391
@@ -409,7 +409,7 @@ bool tud_init (uint8_t rhport)
409
409
for (uint8_t i = 0 ; i < TOTAL_DRIVER_COUNT ; i ++ )
410
410
{
411
411
usbd_class_driver_t const * driver = get_driver (i );
412
- TU_LOG2 ( "%s init\r\n" , driver -> name );
412
+ TU_LOG ( USBD_DBG , "%s init\r\n" , driver -> name );
413
413
driver -> init ();
414
414
}
415
415
@@ -480,29 +480,29 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
480
480
if ( !osal_queue_receive (_usbd_q , & event , timeout_ms ) ) return ;
481
481
482
482
#if CFG_TUSB_DEBUG >= 2
483
- if (event .event_id == DCD_EVENT_SETUP_RECEIVED ) TU_LOG2 ( "\r\n" ); // extra line for setup
484
- TU_LOG2 ( "USBD %s " , event .event_id < DCD_EVENT_COUNT ? _usbd_event_str [event .event_id ] : "CORRUPTED" );
483
+ if (event .event_id == DCD_EVENT_SETUP_RECEIVED ) TU_LOG ( USBD_DBG , "\r\n" ); // extra line for setup
484
+ TU_LOG ( USBD_DBG , "USBD %s " , event .event_id < DCD_EVENT_COUNT ? _usbd_event_str [event .event_id ] : "CORRUPTED" );
485
485
#endif
486
486
487
487
switch ( event .event_id )
488
488
{
489
489
case DCD_EVENT_BUS_RESET :
490
- TU_LOG2 ( ": %s Speed\r\n" , tu_str_speed [event .bus_reset .speed ]);
490
+ TU_LOG ( USBD_DBG , ": %s Speed\r\n" , tu_str_speed [event .bus_reset .speed ]);
491
491
usbd_reset (event .rhport );
492
492
_usbd_dev .speed = event .bus_reset .speed ;
493
493
break ;
494
494
495
495
case DCD_EVENT_UNPLUGGED :
496
- TU_LOG2 ( "\r\n" );
496
+ TU_LOG ( USBD_DBG , "\r\n" );
497
497
usbd_reset (event .rhport );
498
498
499
499
// invoke callback
500
500
if (tud_umount_cb ) tud_umount_cb ();
501
501
break ;
502
502
503
503
case DCD_EVENT_SETUP_RECEIVED :
504
- TU_LOG2_VAR ( & event .setup_received );
505
- TU_LOG2 ( "\r\n" );
504
+ TU_LOG_VAR ( USBD_DBG , & event .setup_received );
505
+ TU_LOG ( USBD_DBG , "\r\n" );
506
506
507
507
// Mark as connected after receiving 1st setup packet.
508
508
// But it is easier to set it every time instead of wasting time to check then set
@@ -517,7 +517,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
517
517
// Process control request
518
518
if ( !process_control_request (event .rhport , & event .setup_received ) )
519
519
{
520
- TU_LOG2 ( " Stall EP0\r\n" );
520
+ TU_LOG ( USBD_DBG , " Stall EP0\r\n" );
521
521
// Failed -> stall both control endpoint IN and OUT
522
522
dcd_edpt_stall (event .rhport , 0 );
523
523
dcd_edpt_stall (event .rhport , 0 | TUSB_DIR_IN_MASK );
@@ -531,7 +531,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
531
531
uint8_t const epnum = tu_edpt_number (ep_addr );
532
532
uint8_t const ep_dir = tu_edpt_dir (ep_addr );
533
533
534
- TU_LOG2 ( "on EP %02X with %u bytes\r\n" , ep_addr , (unsigned int ) event .xfer_complete .len );
534
+ TU_LOG ( USBD_DBG , "on EP %02X with %u bytes\r\n" , ep_addr , (unsigned int ) event .xfer_complete .len );
535
535
536
536
_usbd_dev .ep_status [epnum ][ep_dir ].busy = false;
537
537
_usbd_dev .ep_status [epnum ][ep_dir ].claimed = 0 ;
@@ -545,7 +545,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
545
545
usbd_class_driver_t const * driver = get_driver ( _usbd_dev .ep2drv [epnum ][ep_dir ] );
546
546
TU_ASSERT (driver , );
547
547
548
- TU_LOG2 ( " %s xfer callback\r\n" , driver -> name );
548
+ TU_LOG ( USBD_DBG , " %s xfer callback\r\n" , driver -> name );
549
549
driver -> xfer_cb (event .rhport , ep_addr , (xfer_result_t )event .xfer_complete .result , event .xfer_complete .len );
550
550
}
551
551
}
@@ -557,27 +557,27 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
557
557
// e.g suspend -> resume -> unplug/plug. Skip suspend/resume if not connected
558
558
if ( _usbd_dev .connected )
559
559
{
560
- TU_LOG2 ( ": Remote Wakeup = %u\r\n" , _usbd_dev .remote_wakeup_en );
560
+ TU_LOG ( USBD_DBG , ": Remote Wakeup = %u\r\n" , _usbd_dev .remote_wakeup_en );
561
561
if (tud_suspend_cb ) tud_suspend_cb (_usbd_dev .remote_wakeup_en );
562
562
}else
563
563
{
564
- TU_LOG2 ( " Skipped\r\n" );
564
+ TU_LOG ( USBD_DBG , " Skipped\r\n" );
565
565
}
566
566
break ;
567
567
568
568
case DCD_EVENT_RESUME :
569
569
if ( _usbd_dev .connected )
570
570
{
571
- TU_LOG2 ( "\r\n" );
571
+ TU_LOG ( USBD_DBG , "\r\n" );
572
572
if (tud_resume_cb ) tud_resume_cb ();
573
573
}else
574
574
{
575
- TU_LOG2 ( " Skipped\r\n" );
575
+ TU_LOG ( USBD_DBG , " Skipped\r\n" );
576
576
}
577
577
break ;
578
578
579
579
case USBD_EVENT_FUNC_CALL :
580
- TU_LOG2 ( "\r\n" );
580
+ TU_LOG ( USBD_DBG , "\r\n" );
581
581
if ( event .func_call .func ) event .func_call .func (event .func_call .param );
582
582
break ;
583
583
@@ -602,7 +602,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
602
602
static bool invoke_class_control (uint8_t rhport , usbd_class_driver_t const * driver , tusb_control_request_t const * request )
603
603
{
604
604
usbd_control_set_complete_callback (driver -> control_xfer_cb );
605
- TU_LOG2 ( " %s control request\r\n" , driver -> name );
605
+ TU_LOG ( USBD_DBG , " %s control request\r\n" , driver -> name );
606
606
return driver -> control_xfer_cb (rhport , CONTROL_STAGE_SETUP , request );
607
607
}
608
608
@@ -626,8 +626,8 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
626
626
#if CFG_TUSB_DEBUG >= 2
627
627
if (TUSB_REQ_TYPE_STANDARD == p_request -> bmRequestType_bit .type && p_request -> bRequest <= TUSB_REQ_SYNCH_FRAME )
628
628
{
629
- TU_LOG2 ( " %s" , tu_str_std_request [p_request -> bRequest ]);
630
- if (TUSB_REQ_GET_DESCRIPTOR != p_request -> bRequest ) TU_LOG2 ( "\r\n" );
629
+ TU_LOG ( USBD_DBG , " %s" , tu_str_std_request [p_request -> bRequest ]);
630
+ if (TUSB_REQ_GET_DESCRIPTOR != p_request -> bRequest ) TU_LOG ( USBD_DBG , "\r\n" );
631
631
}
632
632
#endif
633
633
@@ -905,7 +905,7 @@ static bool process_set_config(uint8_t rhport, uint8_t cfg_num)
905
905
if ( (sizeof (tusb_desc_interface_t ) <= drv_len ) && (drv_len <= remaining_len ) )
906
906
{
907
907
// Open successfully
908
- TU_LOG2 ( " %s opened\r\n" , driver -> name );
908
+ TU_LOG ( USBD_DBG , " %s opened\r\n" , driver -> name );
909
909
910
910
// Some drivers use 2 or more interfaces but may not have IAD e.g MIDI (always) or
911
911
// BTH (even CDC) with class in device descriptor (single interface)
@@ -964,7 +964,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
964
964
{
965
965
case TUSB_DESC_DEVICE :
966
966
{
967
- TU_LOG2 ( " Device\r\n" );
967
+ TU_LOG ( USBD_DBG , " Device\r\n" );
968
968
969
969
void * desc_device = (void * ) (uintptr_t ) tud_descriptor_device_cb ();
970
970
@@ -988,7 +988,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
988
988
989
989
case TUSB_DESC_BOS :
990
990
{
991
- TU_LOG2 ( " BOS\r\n" );
991
+ TU_LOG ( USBD_DBG , " BOS\r\n" );
992
992
993
993
// requested by host if USB > 2.0 ( i.e 2.1 or 3.x )
994
994
if (!tud_descriptor_bos_cb ) return false;
@@ -1010,12 +1010,12 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
1010
1010
1011
1011
if ( desc_type == TUSB_DESC_CONFIGURATION )
1012
1012
{
1013
- TU_LOG2 ( " Configuration[%u]\r\n" , desc_index );
1013
+ TU_LOG ( USBD_DBG , " Configuration[%u]\r\n" , desc_index );
1014
1014
desc_config = (uintptr_t ) tud_descriptor_configuration_cb (desc_index );
1015
1015
}else
1016
1016
{
1017
1017
// Host only request this after getting Device Qualifier descriptor
1018
- TU_LOG2 ( " Other Speed Configuration\r\n" );
1018
+ TU_LOG ( USBD_DBG , " Other Speed Configuration\r\n" );
1019
1019
TU_VERIFY ( tud_descriptor_other_speed_configuration_cb );
1020
1020
desc_config = (uintptr_t ) tud_descriptor_other_speed_configuration_cb (desc_index );
1021
1021
}
@@ -1031,7 +1031,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
1031
1031
1032
1032
case TUSB_DESC_STRING :
1033
1033
{
1034
- TU_LOG2 ( " String[%u]\r\n" , desc_index );
1034
+ TU_LOG ( USBD_DBG , " String[%u]\r\n" , desc_index );
1035
1035
1036
1036
// String Descriptor always uses the desc set from user
1037
1037
uint8_t const * desc_str = (uint8_t const * ) tud_descriptor_string_cb (desc_index , tu_le16toh (p_request -> wIndex ));
@@ -1044,7 +1044,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
1044
1044
1045
1045
case TUSB_DESC_DEVICE_QUALIFIER :
1046
1046
{
1047
- TU_LOG2 ( " Device Qualifier\r\n" );
1047
+ TU_LOG ( USBD_DBG , " Device Qualifier\r\n" );
1048
1048
1049
1049
TU_VERIFY ( tud_descriptor_device_qualifier_cb );
1050
1050
@@ -1237,7 +1237,7 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
1237
1237
// TODO skip ready() check for now since enumeration also use this API
1238
1238
// TU_VERIFY(tud_ready());
1239
1239
1240
- TU_LOG2 ( " Queue EP %02X with %u bytes ...\r\n" , ep_addr , total_bytes );
1240
+ TU_LOG ( USBD_DBG , " Queue EP %02X with %u bytes ...\r\n" , ep_addr , total_bytes );
1241
1241
1242
1242
// Attempt to transfer on a busy endpoint, sound like an race condition !
1243
1243
TU_ASSERT (_usbd_dev .ep_status [epnum ][dir ].busy == 0 );
@@ -1254,7 +1254,7 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
1254
1254
// DCD error, mark endpoint as ready to allow next transfer
1255
1255
_usbd_dev .ep_status [epnum ][dir ].busy = false;
1256
1256
_usbd_dev .ep_status [epnum ][dir ].claimed = 0 ;
1257
- TU_LOG2 ( "FAILED\r\n" );
1257
+ TU_LOG ( USBD_DBG , "FAILED\r\n" );
1258
1258
TU_BREAKPOINT ();
1259
1259
return false;
1260
1260
}
@@ -1271,7 +1271,7 @@ bool usbd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16
1271
1271
uint8_t const epnum = tu_edpt_number (ep_addr );
1272
1272
uint8_t const dir = tu_edpt_dir (ep_addr );
1273
1273
1274
- TU_LOG2 ( " Queue ISO EP %02X with %u bytes ... " , ep_addr , total_bytes );
1274
+ TU_LOG ( USBD_DBG , " Queue ISO EP %02X with %u bytes ... " , ep_addr , total_bytes );
1275
1275
1276
1276
// Attempt to transfer on a busy endpoint, sound like an race condition !
1277
1277
TU_ASSERT (_usbd_dev .ep_status [epnum ][dir ].busy == 0 );
@@ -1282,14 +1282,14 @@ bool usbd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16
1282
1282
1283
1283
if (dcd_edpt_xfer_fifo (rhport , ep_addr , ff , total_bytes ))
1284
1284
{
1285
- TU_LOG2 ( "OK\r\n" );
1285
+ TU_LOG ( USBD_DBG , "OK\r\n" );
1286
1286
return true;
1287
1287
}else
1288
1288
{
1289
1289
// DCD error, mark endpoint as ready to allow next transfer
1290
1290
_usbd_dev .ep_status [epnum ][dir ].busy = false;
1291
1291
_usbd_dev .ep_status [epnum ][dir ].claimed = 0 ;
1292
- TU_LOG2 ( "failed\r\n" );
1292
+ TU_LOG ( USBD_DBG , "failed\r\n" );
1293
1293
TU_BREAKPOINT ();
1294
1294
return false;
1295
1295
}
@@ -1360,7 +1360,7 @@ void usbd_edpt_close(uint8_t rhport, uint8_t ep_addr)
1360
1360
rhport = _usbd_rhport ;
1361
1361
1362
1362
TU_ASSERT (dcd_edpt_close , /**/ );
1363
- TU_LOG2 ( " CLOSING Endpoint: 0x%02X\r\n" , ep_addr );
1363
+ TU_LOG ( USBD_DBG , " CLOSING Endpoint: 0x%02X\r\n" , ep_addr );
1364
1364
1365
1365
uint8_t const epnum = tu_edpt_number (ep_addr );
1366
1366
uint8_t const dir = tu_edpt_dir (ep_addr );
0 commit comments