Merge pull request #1533 from hathach/hid-report-len-uint16

Hid report len uint16
This commit is contained in:
Ha Thach 2022-06-27 12:47:08 +07:00 committed by GitHub
commit bc0f5502e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 47 deletions

View File

@ -181,7 +181,7 @@ void tud_hid_set_protocol_cb(uint8_t instance, uint8_t protocol)
// Invoked when sent REPORT successfully to host // Invoked when sent REPORT successfully to host
// Application can use this to send the next report // Application can use this to send the next report
// Note: For composite reports, report[0] is report ID // Note: For composite reports, report[0] is report ID
void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len) void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len)
{ {
(void) instance; (void) instance;
(void) report; (void) report;

View File

@ -225,7 +225,7 @@ void hid_task(void)
// Invoked when sent REPORT successfully to host // Invoked when sent REPORT successfully to host
// Application can use this to send the next report // Application can use this to send the next report
// Note: For composite reports, report[0] is report ID // Note: For composite reports, report[0] is report ID
void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len) void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len)
{ {
(void) instance; (void) instance;
(void) len; (void) len;

View File

@ -294,7 +294,7 @@ void hid_task(void* param)
// Invoked when sent REPORT successfully to host // Invoked when sent REPORT successfully to host
// Application can use this to send the next report // Application can use this to send the next report
// Note: For composite reports, report[0] is report ID // Note: For composite reports, report[0] is report ID
void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len) void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len)
{ {
(void) instance; (void) instance;
(void) len; (void) len;

View File

@ -84,8 +84,8 @@ void tuh_mount_cb (uint8_t daddr)
{ {
printf("Device attached, address = %d\r\n", daddr); printf("Device attached, address = %d\r\n", daddr);
// Get Device Descriptor sync API // Get Device Descriptor
// TODO: invoking control trannsfer now has issue with mounting hub with multiple devices attached, fix later // TODO: invoking control transfer now has issue with mounting hub with multiple devices attached, fix later
tuh_descriptor_get_device(daddr, &desc_device, 18, print_device_descriptor, 0); tuh_descriptor_get_device(daddr, &desc_device, 18, print_device_descriptor, 0);
} }

View File

@ -81,7 +81,7 @@ bool tud_hid_n_ready(uint8_t instance)
return tud_ready() && (ep_in != 0) && !usbd_edpt_busy(rhport, ep_in); return tud_ready() && (ep_in != 0) && !usbd_edpt_busy(rhport, ep_in);
} }
bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, uint8_t len) bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, uint16_t len)
{ {
uint8_t const rhport = 0; uint8_t const rhport = 0;
hidd_interface_t * p_hid = &_hidd_itf[instance]; hidd_interface_t * p_hid = &_hidd_itf[instance];
@ -92,7 +92,7 @@ bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, u
// prepare data // prepare data
if (report_id) if (report_id)
{ {
len = tu_min8(len, CFG_TUD_HID_EP_BUFSIZE-1); len = tu_min16(len, CFG_TUD_HID_EP_BUFSIZE-1);
p_hid->epin_buf[0] = report_id; p_hid->epin_buf[0] = report_id;
memcpy(p_hid->epin_buf+1, report, len); memcpy(p_hid->epin_buf+1, report, len);
@ -100,7 +100,7 @@ bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, u
}else }else
{ {
// If report id = 0, skip ID field // If report id = 0, skip ID field
len = tu_min8(len, CFG_TUD_HID_EP_BUFSIZE); len = tu_min16(len, CFG_TUD_HID_EP_BUFSIZE);
memcpy(p_hid->epin_buf, report, len); memcpy(p_hid->epin_buf, report, len);
} }
@ -402,7 +402,7 @@ bool hidd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
{ {
if (tud_hid_report_complete_cb) if (tud_hid_report_complete_cb)
{ {
tud_hid_report_complete_cb(instance, p_hid->epin_buf, (uint8_t) xferred_bytes); tud_hid_report_complete_cb(instance, p_hid->epin_buf, (uint16_t) xferred_bytes);
} }
} }
// Received report // Received report

View File

@ -62,7 +62,7 @@ uint8_t tud_hid_n_interface_protocol(uint8_t instance);
uint8_t tud_hid_n_get_protocol(uint8_t instance); uint8_t tud_hid_n_get_protocol(uint8_t instance);
// Send report to host // Send report to host
bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, uint8_t len); bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, uint16_t len);
// KEYBOARD: convenient helper to send keyboard report if application // KEYBOARD: convenient helper to send keyboard report if application
// use template layout report as defined by hid_keyboard_report_t // use template layout report as defined by hid_keyboard_report_t
@ -82,7 +82,7 @@ bool tud_hid_n_gamepad_report(uint8_t instance, uint8_t report_id, int8_t x, int
static inline bool tud_hid_ready(void); static inline bool tud_hid_ready(void);
static inline uint8_t tud_hid_interface_protocol(void); static inline uint8_t tud_hid_interface_protocol(void);
static inline uint8_t tud_hid_get_protocol(void); static inline uint8_t tud_hid_get_protocol(void);
static inline bool tud_hid_report(uint8_t report_id, void const* report, uint8_t len); static inline bool tud_hid_report(uint8_t report_id, void const* report, uint16_t len);
static inline bool tud_hid_keyboard_report(uint8_t report_id, uint8_t modifier, uint8_t keycode[6]); static inline bool tud_hid_keyboard_report(uint8_t report_id, uint8_t modifier, uint8_t keycode[6]);
static inline bool tud_hid_mouse_report(uint8_t report_id, uint8_t buttons, int8_t x, int8_t y, int8_t vertical, int8_t horizontal); static inline bool tud_hid_mouse_report(uint8_t report_id, uint8_t buttons, int8_t x, int8_t y, int8_t vertical, int8_t horizontal);
static inline bool tud_hid_gamepad_report(uint8_t report_id, int8_t x, int8_t y, int8_t z, int8_t rz, int8_t rx, int8_t ry, uint8_t hat, uint32_t buttons); static inline bool tud_hid_gamepad_report(uint8_t report_id, int8_t x, int8_t y, int8_t z, int8_t rz, int8_t rx, int8_t ry, uint8_t hat, uint32_t buttons);
@ -116,7 +116,7 @@ TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t instance, uint8_t idle_rate);
// Invoked when sent REPORT successfully to host // Invoked when sent REPORT successfully to host
// Application can use this to send the next report // Application can use this to send the next report
// Note: For composite reports, report[0] is report ID // Note: For composite reports, report[0] is report ID
TU_ATTR_WEAK void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len); TU_ATTR_WEAK void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len);
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@ -137,7 +137,7 @@ static inline uint8_t tud_hid_get_protocol(void)
return tud_hid_n_get_protocol(0); return tud_hid_n_get_protocol(0);
} }
static inline bool tud_hid_report(uint8_t report_id, void const* report, uint8_t len) static inline bool tud_hid_report(uint8_t report_id, void const* report, uint16_t len)
{ {
return tud_hid_n_report(0, report_id, report, len); return tud_hid_n_report(0, report_id, report, len);
} }

View File

@ -318,7 +318,7 @@ void usbd_driver_print_control_complete_name(usbd_control_xfer_cb_t callback)
usbd_class_driver_t const * driver = get_driver(i); usbd_class_driver_t const * driver = get_driver(i);
if ( driver->control_xfer_cb == callback ) if ( driver->control_xfer_cb == callback )
{ {
TU_LOG2(" %s control complete\r\n", driver->name); TU_LOG(USBD_DBG, " %s control complete\r\n", driver->name);
return; return;
} }
} }
@ -384,8 +384,8 @@ bool tud_init (uint8_t rhport)
// skip if already initialized // skip if already initialized
if ( tud_inited() ) return true; if ( tud_inited() ) return true;
TU_LOG2("USBD init on controller %u\r\n", rhport); TU_LOG(USBD_DBG, "USBD init on controller %u\r\n", rhport);
TU_LOG2_INT(sizeof(usbd_device_t)); TU_LOG_INT(USBD_DBG, sizeof(usbd_device_t));
tu_varclr(&_usbd_dev); tu_varclr(&_usbd_dev);
@ -409,7 +409,7 @@ bool tud_init (uint8_t rhport)
for (uint8_t i = 0; i < TOTAL_DRIVER_COUNT; i++) for (uint8_t i = 0; i < TOTAL_DRIVER_COUNT; i++)
{ {
usbd_class_driver_t const * driver = get_driver(i); usbd_class_driver_t const * driver = get_driver(i);
TU_LOG2("%s init\r\n", driver->name); TU_LOG(USBD_DBG, "%s init\r\n", driver->name);
driver->init(); driver->init();
} }
@ -480,20 +480,20 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
if ( !osal_queue_receive(_usbd_q, &event, timeout_ms) ) return; if ( !osal_queue_receive(_usbd_q, &event, timeout_ms) ) return;
#if CFG_TUSB_DEBUG >= 2 #if CFG_TUSB_DEBUG >= 2
if (event.event_id == DCD_EVENT_SETUP_RECEIVED) TU_LOG2("\r\n"); // extra line for setup if (event.event_id == DCD_EVENT_SETUP_RECEIVED) TU_LOG(USBD_DBG, "\r\n"); // extra line for setup
TU_LOG2("USBD %s ", event.event_id < DCD_EVENT_COUNT ? _usbd_event_str[event.event_id] : "CORRUPTED"); TU_LOG(USBD_DBG, "USBD %s ", event.event_id < DCD_EVENT_COUNT ? _usbd_event_str[event.event_id] : "CORRUPTED");
#endif #endif
switch ( event.event_id ) switch ( event.event_id )
{ {
case DCD_EVENT_BUS_RESET: case DCD_EVENT_BUS_RESET:
TU_LOG2(": %s Speed\r\n", tu_str_speed[event.bus_reset.speed]); TU_LOG(USBD_DBG, ": %s Speed\r\n", tu_str_speed[event.bus_reset.speed]);
usbd_reset(event.rhport); usbd_reset(event.rhport);
_usbd_dev.speed = event.bus_reset.speed; _usbd_dev.speed = event.bus_reset.speed;
break; break;
case DCD_EVENT_UNPLUGGED: case DCD_EVENT_UNPLUGGED:
TU_LOG2("\r\n"); TU_LOG(USBD_DBG, "\r\n");
usbd_reset(event.rhport); usbd_reset(event.rhport);
// invoke callback // invoke callback
@ -501,8 +501,8 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
break; break;
case DCD_EVENT_SETUP_RECEIVED: case DCD_EVENT_SETUP_RECEIVED:
TU_LOG2_VAR(&event.setup_received); TU_LOG_VAR(USBD_DBG, &event.setup_received);
TU_LOG2("\r\n"); TU_LOG(USBD_DBG, "\r\n");
// Mark as connected after receiving 1st setup packet. // Mark as connected after receiving 1st setup packet.
// But it is easier to set it every time instead of wasting time to check then set // 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)
// Process control request // Process control request
if ( !process_control_request(event.rhport, &event.setup_received) ) if ( !process_control_request(event.rhport, &event.setup_received) )
{ {
TU_LOG2(" Stall EP0\r\n"); TU_LOG(USBD_DBG, " Stall EP0\r\n");
// Failed -> stall both control endpoint IN and OUT // Failed -> stall both control endpoint IN and OUT
dcd_edpt_stall(event.rhport, 0); dcd_edpt_stall(event.rhport, 0);
dcd_edpt_stall(event.rhport, 0 | TUSB_DIR_IN_MASK); 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)
uint8_t const epnum = tu_edpt_number(ep_addr); uint8_t const epnum = tu_edpt_number(ep_addr);
uint8_t const ep_dir = tu_edpt_dir(ep_addr); uint8_t const ep_dir = tu_edpt_dir(ep_addr);
TU_LOG2("on EP %02X with %u bytes\r\n", ep_addr, (unsigned int) event.xfer_complete.len); TU_LOG(USBD_DBG, "on EP %02X with %u bytes\r\n", ep_addr, (unsigned int) event.xfer_complete.len);
_usbd_dev.ep_status[epnum][ep_dir].busy = false; _usbd_dev.ep_status[epnum][ep_dir].busy = false;
_usbd_dev.ep_status[epnum][ep_dir].claimed = 0; _usbd_dev.ep_status[epnum][ep_dir].claimed = 0;
@ -545,7 +545,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
usbd_class_driver_t const * driver = get_driver( _usbd_dev.ep2drv[epnum][ep_dir] ); usbd_class_driver_t const * driver = get_driver( _usbd_dev.ep2drv[epnum][ep_dir] );
TU_ASSERT(driver, ); TU_ASSERT(driver, );
TU_LOG2(" %s xfer callback\r\n", driver->name); TU_LOG(USBD_DBG, " %s xfer callback\r\n", driver->name);
driver->xfer_cb(event.rhport, ep_addr, (xfer_result_t)event.xfer_complete.result, event.xfer_complete.len); driver->xfer_cb(event.rhport, ep_addr, (xfer_result_t)event.xfer_complete.result, event.xfer_complete.len);
} }
} }
@ -557,27 +557,27 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
// e.g suspend -> resume -> unplug/plug. Skip suspend/resume if not connected // e.g suspend -> resume -> unplug/plug. Skip suspend/resume if not connected
if ( _usbd_dev.connected ) if ( _usbd_dev.connected )
{ {
TU_LOG2(": Remote Wakeup = %u\r\n", _usbd_dev.remote_wakeup_en); TU_LOG(USBD_DBG, ": Remote Wakeup = %u\r\n", _usbd_dev.remote_wakeup_en);
if (tud_suspend_cb) tud_suspend_cb(_usbd_dev.remote_wakeup_en); if (tud_suspend_cb) tud_suspend_cb(_usbd_dev.remote_wakeup_en);
}else }else
{ {
TU_LOG2(" Skipped\r\n"); TU_LOG(USBD_DBG, " Skipped\r\n");
} }
break; break;
case DCD_EVENT_RESUME: case DCD_EVENT_RESUME:
if ( _usbd_dev.connected ) if ( _usbd_dev.connected )
{ {
TU_LOG2("\r\n"); TU_LOG(USBD_DBG, "\r\n");
if (tud_resume_cb) tud_resume_cb(); if (tud_resume_cb) tud_resume_cb();
}else }else
{ {
TU_LOG2(" Skipped\r\n"); TU_LOG(USBD_DBG, " Skipped\r\n");
} }
break; break;
case USBD_EVENT_FUNC_CALL: case USBD_EVENT_FUNC_CALL:
TU_LOG2("\r\n"); TU_LOG(USBD_DBG, "\r\n");
if ( event.func_call.func ) event.func_call.func(event.func_call.param); if ( event.func_call.func ) event.func_call.func(event.func_call.param);
break; break;
@ -602,7 +602,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
static bool invoke_class_control(uint8_t rhport, usbd_class_driver_t const * driver, tusb_control_request_t const * request) static bool invoke_class_control(uint8_t rhport, usbd_class_driver_t const * driver, tusb_control_request_t const * request)
{ {
usbd_control_set_complete_callback(driver->control_xfer_cb); usbd_control_set_complete_callback(driver->control_xfer_cb);
TU_LOG2(" %s control request\r\n", driver->name); TU_LOG(USBD_DBG, " %s control request\r\n", driver->name);
return driver->control_xfer_cb(rhport, CONTROL_STAGE_SETUP, request); return driver->control_xfer_cb(rhport, CONTROL_STAGE_SETUP, request);
} }
@ -626,8 +626,8 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
#if CFG_TUSB_DEBUG >= 2 #if CFG_TUSB_DEBUG >= 2
if (TUSB_REQ_TYPE_STANDARD == p_request->bmRequestType_bit.type && p_request->bRequest <= TUSB_REQ_SYNCH_FRAME) if (TUSB_REQ_TYPE_STANDARD == p_request->bmRequestType_bit.type && p_request->bRequest <= TUSB_REQ_SYNCH_FRAME)
{ {
TU_LOG2(" %s", tu_str_std_request[p_request->bRequest]); TU_LOG(USBD_DBG, " %s", tu_str_std_request[p_request->bRequest]);
if (TUSB_REQ_GET_DESCRIPTOR != p_request->bRequest) TU_LOG2("\r\n"); if (TUSB_REQ_GET_DESCRIPTOR != p_request->bRequest) TU_LOG(USBD_DBG, "\r\n");
} }
#endif #endif
@ -905,7 +905,7 @@ static bool process_set_config(uint8_t rhport, uint8_t cfg_num)
if ( (sizeof(tusb_desc_interface_t) <= drv_len) && (drv_len <= remaining_len) ) if ( (sizeof(tusb_desc_interface_t) <= drv_len) && (drv_len <= remaining_len) )
{ {
// Open successfully // Open successfully
TU_LOG2(" %s opened\r\n", driver->name); TU_LOG(USBD_DBG, " %s opened\r\n", driver->name);
// Some drivers use 2 or more interfaces but may not have IAD e.g MIDI (always) or // Some drivers use 2 or more interfaces but may not have IAD e.g MIDI (always) or
// BTH (even CDC) with class in device descriptor (single interface) // 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
{ {
case TUSB_DESC_DEVICE: case TUSB_DESC_DEVICE:
{ {
TU_LOG2(" Device\r\n"); TU_LOG(USBD_DBG, " Device\r\n");
void* desc_device = (void*) (uintptr_t) tud_descriptor_device_cb(); void* desc_device = (void*) (uintptr_t) tud_descriptor_device_cb();
@ -988,7 +988,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
case TUSB_DESC_BOS: case TUSB_DESC_BOS:
{ {
TU_LOG2(" BOS\r\n"); TU_LOG(USBD_DBG, " BOS\r\n");
// requested by host if USB > 2.0 ( i.e 2.1 or 3.x ) // requested by host if USB > 2.0 ( i.e 2.1 or 3.x )
if (!tud_descriptor_bos_cb) return false; if (!tud_descriptor_bos_cb) return false;
@ -1010,12 +1010,12 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
if ( desc_type == TUSB_DESC_CONFIGURATION ) if ( desc_type == TUSB_DESC_CONFIGURATION )
{ {
TU_LOG2(" Configuration[%u]\r\n", desc_index); TU_LOG(USBD_DBG, " Configuration[%u]\r\n", desc_index);
desc_config = (uintptr_t) tud_descriptor_configuration_cb(desc_index); desc_config = (uintptr_t) tud_descriptor_configuration_cb(desc_index);
}else }else
{ {
// Host only request this after getting Device Qualifier descriptor // Host only request this after getting Device Qualifier descriptor
TU_LOG2(" Other Speed Configuration\r\n"); TU_LOG(USBD_DBG, " Other Speed Configuration\r\n");
TU_VERIFY( tud_descriptor_other_speed_configuration_cb ); TU_VERIFY( tud_descriptor_other_speed_configuration_cb );
desc_config = (uintptr_t) tud_descriptor_other_speed_configuration_cb(desc_index); desc_config = (uintptr_t) tud_descriptor_other_speed_configuration_cb(desc_index);
} }
@ -1031,7 +1031,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
case TUSB_DESC_STRING: case TUSB_DESC_STRING:
{ {
TU_LOG2(" String[%u]\r\n", desc_index); TU_LOG(USBD_DBG, " String[%u]\r\n", desc_index);
// String Descriptor always uses the desc set from user // String Descriptor always uses the desc set from user
uint8_t const* desc_str = (uint8_t const*) tud_descriptor_string_cb(desc_index, tu_le16toh(p_request->wIndex)); 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
case TUSB_DESC_DEVICE_QUALIFIER: case TUSB_DESC_DEVICE_QUALIFIER:
{ {
TU_LOG2(" Device Qualifier\r\n"); TU_LOG(USBD_DBG, " Device Qualifier\r\n");
TU_VERIFY( tud_descriptor_device_qualifier_cb ); TU_VERIFY( tud_descriptor_device_qualifier_cb );
@ -1237,7 +1237,7 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
// TODO skip ready() check for now since enumeration also use this API // TODO skip ready() check for now since enumeration also use this API
// TU_VERIFY(tud_ready()); // TU_VERIFY(tud_ready());
TU_LOG2(" Queue EP %02X with %u bytes ...\r\n", ep_addr, total_bytes); TU_LOG(USBD_DBG, " Queue EP %02X with %u bytes ...\r\n", ep_addr, total_bytes);
// Attempt to transfer on a busy endpoint, sound like an race condition ! // Attempt to transfer on a busy endpoint, sound like an race condition !
TU_ASSERT(_usbd_dev.ep_status[epnum][dir].busy == 0); 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
// DCD error, mark endpoint as ready to allow next transfer // DCD error, mark endpoint as ready to allow next transfer
_usbd_dev.ep_status[epnum][dir].busy = false; _usbd_dev.ep_status[epnum][dir].busy = false;
_usbd_dev.ep_status[epnum][dir].claimed = 0; _usbd_dev.ep_status[epnum][dir].claimed = 0;
TU_LOG2("FAILED\r\n"); TU_LOG(USBD_DBG, "FAILED\r\n");
TU_BREAKPOINT(); TU_BREAKPOINT();
return false; return false;
} }
@ -1271,7 +1271,7 @@ bool usbd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16
uint8_t const epnum = tu_edpt_number(ep_addr); uint8_t const epnum = tu_edpt_number(ep_addr);
uint8_t const dir = tu_edpt_dir(ep_addr); uint8_t const dir = tu_edpt_dir(ep_addr);
TU_LOG2(" Queue ISO EP %02X with %u bytes ... ", ep_addr, total_bytes); TU_LOG(USBD_DBG, " Queue ISO EP %02X with %u bytes ... ", ep_addr, total_bytes);
// Attempt to transfer on a busy endpoint, sound like an race condition ! // Attempt to transfer on a busy endpoint, sound like an race condition !
TU_ASSERT(_usbd_dev.ep_status[epnum][dir].busy == 0); 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
if (dcd_edpt_xfer_fifo(rhport, ep_addr, ff, total_bytes)) if (dcd_edpt_xfer_fifo(rhport, ep_addr, ff, total_bytes))
{ {
TU_LOG2("OK\r\n"); TU_LOG(USBD_DBG, "OK\r\n");
return true; return true;
}else }else
{ {
// DCD error, mark endpoint as ready to allow next transfer // DCD error, mark endpoint as ready to allow next transfer
_usbd_dev.ep_status[epnum][dir].busy = false; _usbd_dev.ep_status[epnum][dir].busy = false;
_usbd_dev.ep_status[epnum][dir].claimed = 0; _usbd_dev.ep_status[epnum][dir].claimed = 0;
TU_LOG2("failed\r\n"); TU_LOG(USBD_DBG, "failed\r\n");
TU_BREAKPOINT(); TU_BREAKPOINT();
return false; return false;
} }
@ -1360,7 +1360,7 @@ void usbd_edpt_close(uint8_t rhport, uint8_t ep_addr)
rhport = _usbd_rhport; rhport = _usbd_rhport;
TU_ASSERT(dcd_edpt_close, /**/); TU_ASSERT(dcd_edpt_close, /**/);
TU_LOG2(" CLOSING Endpoint: 0x%02X\r\n", ep_addr); TU_LOG(USBD_DBG, " CLOSING Endpoint: 0x%02X\r\n", ep_addr);
uint8_t const epnum = tu_edpt_number(ep_addr); uint8_t const epnum = tu_edpt_number(ep_addr);
uint8_t const dir = tu_edpt_dir(ep_addr); uint8_t const dir = tu_edpt_dir(ep_addr);