diff options
Diffstat (limited to 'tinyusb/class')
| -rw-r--r-- | tinyusb/class/cdc/cdc_device.c | 48 | ||||
| -rw-r--r-- | tinyusb/class/cdc/cdc_device.h | 24 | ||||
| -rw-r--r-- | tinyusb/class/hid/hid_device.c | 36 | ||||
| -rw-r--r-- | tinyusb/class/hid/hid_device.h | 46 | ||||
| -rw-r--r-- | tinyusb/class/msc/msc_device.c | 18 | ||||
| -rw-r--r-- | tinyusb/class/msc/msc_device.h | 18 |
6 files changed, 95 insertions, 95 deletions
diff --git a/tinyusb/class/cdc/cdc_device.c b/tinyusb/class/cdc/cdc_device.c index 9ca71bddb..657bac860 100644 --- a/tinyusb/class/cdc/cdc_device.c +++ b/tinyusb/class/cdc/cdc_device.c @@ -78,33 +78,33 @@ STATIC_VAR cdcd_data_t cdcd_data[CONTROLLER_DEVICE_NUMBER]; //--------------------------------------------------------------------+
// APPLICATION API
//--------------------------------------------------------------------+
-bool tud_cdc_connected(uint8_t coreid)
+bool tud_cdc_connected(uint8_t port)
{
- return cdcd_data[coreid].connected;
+ return cdcd_data[port].connected;
}
-uint32_t tud_cdc_available(uint8_t coreid)
+uint32_t tud_cdc_available(uint8_t port)
{
return fifo_count(&_rx_ff);
}
-int tud_cdc_read_char(uint8_t coreid)
+int tud_cdc_read_char(uint8_t port)
{
uint8_t ch;
return fifo_read(&_rx_ff, &ch) ? ch : (-1);
}
-uint32_t tud_cdc_read(uint8_t coreid, void* buffer, uint32_t bufsize)
+uint32_t tud_cdc_read(uint8_t port, void* buffer, uint32_t bufsize)
{
return fifo_read_n(&_rx_ff, buffer, bufsize);
}
-uint32_t tud_cdc_write_char(uint8_t coreid, char ch)
+uint32_t tud_cdc_write_char(uint8_t port, char ch)
{
return fifo_write(&_tx_ff, &ch);
}
-uint32_t tud_cdc_write(uint8_t coreid, void const* buffer, uint32_t bufsize)
+uint32_t tud_cdc_write(uint8_t port, void const* buffer, uint32_t bufsize)
{
return fifo_write_n(&_tx_ff, buffer, bufsize);
}
@@ -128,7 +128,7 @@ void cdcd_init(void) }
}
-tusb_error_t cdcd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
+tusb_error_t cdcd_open(uint8_t port, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
{
if ( CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL != p_interface_desc->bInterfaceSubClass) return TUSB_ERROR_CDC_UNSUPPORTED_SUBCLASS;
@@ -139,7 +139,7 @@ tusb_error_t cdcd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int }
uint8_t const * p_desc = descriptor_next ( (uint8_t const *) p_interface_desc );
- cdcd_data_t * p_cdc = &cdcd_data[coreid];
+ cdcd_data_t * p_cdc = &cdcd_data[port];
//------------- Communication Interface -------------//
(*p_length) = sizeof(tusb_descriptor_interface_t);
@@ -157,7 +157,7 @@ tusb_error_t cdcd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int if ( TUSB_DESC_TYPE_ENDPOINT == p_desc[DESCRIPTOR_OFFSET_TYPE])
{ // notification endpoint if any
- VERIFY( hal_dcd_pipe_open(coreid, (tusb_descriptor_endpoint_t const *) p_desc, &p_cdc->edpt_hdl[CDC_PIPE_NOTIFICATION]), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
+ VERIFY( hal_dcd_pipe_open(port, (tusb_descriptor_endpoint_t const *) p_desc, &p_cdc->edpt_hdl[CDC_PIPE_NOTIFICATION]), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
p_desc = descriptor_next(p_desc);
@@ -180,7 +180,7 @@ tusb_error_t cdcd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int endpoint_handle_t * p_edpt_hdl = ( p_endpoint->bEndpointAddress & TUSB_DIR_DEV_TO_HOST_MASK ) ?
&p_cdc->edpt_hdl[CDC_PIPE_DATA_IN] : &p_cdc->edpt_hdl[CDC_PIPE_DATA_OUT] ;
- ASSERT_( hal_dcd_pipe_open(coreid, p_endpoint, p_edpt_hdl), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
+ ASSERT_( hal_dcd_pipe_open(port, p_endpoint, p_edpt_hdl), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
p_desc = descriptor_next( p_desc );
@@ -196,16 +196,16 @@ tusb_error_t cdcd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int return TUSB_ERROR_NONE;
}
-void cdcd_close(uint8_t coreid)
+void cdcd_close(uint8_t port)
{
// no need to close opened pipe, dcd bus reset will put controller's endpoints to default state
- memclr_(&cdcd_data[coreid], sizeof(cdcd_data_t));
+ memclr_(&cdcd_data[port], sizeof(cdcd_data_t));
fifo_clear(&_rx_ff);
fifo_clear(&_tx_ff);
}
-tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t const * p_request)
+tusb_error_t cdcd_control_request_subtask(uint8_t port, tusb_control_request_t const * p_request)
{
//------------- Class Specific Request -------------//
if (p_request->bmRequestType_bit.type != TUSB_REQUEST_TYPE_CLASS) return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
@@ -213,13 +213,13 @@ tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t switch(p_request->bRequest)
{
case CDC_REQUEST_GET_LINE_CODING:
- hal_dcd_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction,
- (uint8_t*) &cdcd_line_coding[coreid], min16_of(sizeof(cdc_line_coding_t), p_request->wLength), false );
+ hal_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction,
+ (uint8_t*) &cdcd_line_coding[port], min16_of(sizeof(cdc_line_coding_t), p_request->wLength), false );
break;
case CDC_REQUEST_SET_LINE_CODING:
- hal_dcd_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction,
- (uint8_t*) &cdcd_line_coding[coreid], min16_of(sizeof(cdc_line_coding_t), p_request->wLength), false );
+ hal_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction,
+ (uint8_t*) &cdcd_line_coding[port], min16_of(sizeof(cdc_line_coding_t), p_request->wLength), false );
// TODO notify application on xfer completea
break;
@@ -230,7 +230,7 @@ tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t ACTIVE_DTE_NOT_PRESENT = 0x0002
};
- cdcd_data_t * p_cdc = &cdcd_data[coreid];
+ cdcd_data_t * p_cdc = &cdcd_data[port];
if (p_request->wValue == ACTIVE_DTE_PRESENT)
{
@@ -257,7 +257,7 @@ tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t tusb_error_t cdcd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
{
- cdcd_data_t const * p_cdc = &cdcd_data[edpt_hdl.coreid];
+ cdcd_data_t const * p_cdc = &cdcd_data[edpt_hdl.port];
if ( edpt_equal(edpt_hdl, p_cdc->edpt_hdl[CDC_PIPE_DATA_OUT]) )
{
@@ -267,17 +267,17 @@ tusb_error_t cdcd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32 hal_dcd_pipe_xfer(p_cdc->edpt_hdl[CDC_PIPE_DATA_OUT], _tmp_rx_buf, sizeof(_tmp_rx_buf), true);
// fire callback
- tud_cdc_rx_cb(edpt_hdl.coreid);
+ tud_cdc_rx_cb(edpt_hdl.port);
}
return TUSB_ERROR_NONE;
}
-void cdcd_sof(uint8_t coreid)
+void cdcd_sof(uint8_t port)
{
- if ( !tud_cdc_connected(coreid) ) return;
+ if ( !tud_cdc_connected(port) ) return;
- endpoint_handle_t ep = cdcd_data[coreid].edpt_hdl[CDC_PIPE_DATA_IN];
+ endpoint_handle_t ep = cdcd_data[port].edpt_hdl[CDC_PIPE_DATA_IN];
if ( !dcd_pipe_is_busy( ep ) )
{
diff --git a/tinyusb/class/cdc/cdc_device.h b/tinyusb/class/cdc/cdc_device.h index 97b15e82b..942d447b7 100644 --- a/tinyusb/class/cdc/cdc_device.h +++ b/tinyusb/class/cdc/cdc_device.h @@ -55,21 +55,21 @@ //--------------------------------------------------------------------+
// APPLICATION API
//--------------------------------------------------------------------+
-bool tud_cdc_connected(uint8_t coreid);
-uint32_t tud_cdc_available(uint8_t coreid);
+bool tud_cdc_connected(uint8_t port);
+uint32_t tud_cdc_available(uint8_t port);
-int tud_cdc_read_char(uint8_t coreid);
-uint32_t tud_cdc_read(uint8_t coreid, void* buffer, uint32_t bufsize);
+int tud_cdc_read_char(uint8_t port);
+uint32_t tud_cdc_read(uint8_t port, void* buffer, uint32_t bufsize);
-uint32_t tud_cdc_write_char(uint8_t coreid, char ch);
-uint32_t tud_cdc_write(uint8_t coreid, void const* buffer, uint32_t bufsize);
+uint32_t tud_cdc_write_char(uint8_t port, char ch);
+uint32_t tud_cdc_write(uint8_t port, void const* buffer, uint32_t bufsize);
//--------------------------------------------------------------------+
// APPLICATION CALLBACK API
//--------------------------------------------------------------------+
-//void tud_cdc_line_coding_changed_cb(uint8_t coreid, cdc_line_coding_t* p_line_coding);
-void tud_cdc_rx_cb(uint8_t coreid);
+//void tud_cdc_line_coding_changed_cb(uint8_t port, cdc_line_coding_t* p_line_coding);
+void tud_cdc_rx_cb(uint8_t port);
//--------------------------------------------------------------------+
// USBD-CLASS DRIVER API
@@ -77,12 +77,12 @@ void tud_cdc_rx_cb(uint8_t coreid); #ifdef _TINY_USB_SOURCE_FILE_
void cdcd_init(void);
-tusb_error_t cdcd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
-tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t const * p_request);
+tusb_error_t cdcd_open(uint8_t port, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
+tusb_error_t cdcd_control_request_subtask(uint8_t port, tusb_control_request_t const * p_request);
tusb_error_t cdcd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
-void cdcd_close(uint8_t coreid);
+void cdcd_close(uint8_t port);
-void cdcd_sof(uint8_t coreid);
+void cdcd_sof(uint8_t port);
#endif
diff --git a/tinyusb/class/hid/hid_device.c b/tinyusb/class/hid/hid_device.c index 5ce98f80a..0fd4120ed 100644 --- a/tinyusb/class/hid/hid_device.c +++ b/tinyusb/class/hid/hid_device.c @@ -107,16 +107,16 @@ TUSB_CFG_ATTR_USBRAM STATIC_VAR uint8_t m_hid_buffer[ HIDD_BUFFER_SIZE ]; #if TUSB_CFG_DEVICE_HID_KEYBOARD
STATIC_VAR hidd_interface_t keyboardd_data;
-bool tud_hid_keyboard_busy(uint8_t coreid)
+bool tud_hid_keyboard_busy(uint8_t port)
{
return dcd_pipe_is_busy(keyboardd_data.ept_handle);
}
-tusb_error_t tud_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const *p_report)
+tusb_error_t tud_hid_keyboard_send(uint8_t port, hid_keyboard_report_t const *p_report)
{
- ASSERT(tud_mounted(coreid), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED);
+ ASSERT(tud_mounted(port), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED);
- hidd_interface_t * p_kbd = &keyboardd_data; // TODO &keyboardd_data[coreid];
+ hidd_interface_t * p_kbd = &keyboardd_data; // TODO &keyboardd_data[port];
ASSERT_STATUS( hal_dcd_pipe_xfer(p_kbd->ept_handle, (void*) p_report, sizeof(hid_keyboard_report_t), true) ) ;
@@ -130,16 +130,16 @@ tusb_error_t tud_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const * #if TUSB_CFG_DEVICE_HID_MOUSE
STATIC_VAR hidd_interface_t moused_data;
-bool tusbd_hid_mouse_is_busy(uint8_t coreid)
+bool tusbd_hid_mouse_is_busy(uint8_t port)
{
return dcd_pipe_is_busy(moused_data.ept_handle);
}
-tusb_error_t tusbd_hid_mouse_send(uint8_t coreid, hid_mouse_report_t const *p_report)
+tusb_error_t tusbd_hid_mouse_send(uint8_t port, hid_mouse_report_t const *p_report)
{
- ASSERT(tud_mounted(coreid), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED);
+ ASSERT(tud_mounted(port), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED);
- hidd_interface_t * p_mouse = &moused_data; // TODO &keyboardd_data[coreid];
+ hidd_interface_t * p_mouse = &moused_data; // TODO &keyboardd_data[port];
ASSERT_STATUS( hal_dcd_pipe_xfer(p_mouse->ept_handle, (void*) p_report, sizeof(hid_mouse_report_t), true) ) ;
@@ -167,7 +167,7 @@ void hidd_init(void) }
}
-void hidd_close(uint8_t coreid)
+void hidd_close(uint8_t port)
{
for(uint8_t i=0; i<HIDD_NUMBER_OF_SUBCLASS; i++)
{
@@ -175,7 +175,7 @@ void hidd_close(uint8_t coreid) }
}
-tusb_error_t hidd_control_request_subtask(uint8_t coreid, tusb_control_request_t const * p_request)
+tusb_error_t hidd_control_request_subtask(uint8_t port, tusb_control_request_t const * p_request)
{
uint8_t subclass_idx;
for(subclass_idx=0; subclass_idx<HIDD_NUMBER_OF_SUBCLASS; subclass_idx++)
@@ -202,7 +202,7 @@ tusb_error_t hidd_control_request_subtask(uint8_t coreid, tusb_control_request_t ASSERT ( p_hid->report_length <= HIDD_BUFFER_SIZE, TUSB_ERROR_NOT_ENOUGH_MEMORY);
memcpy(m_hid_buffer, p_hid->p_report_desc, p_hid->report_length); // to allow report descriptor not to be in USBRAM
- hal_dcd_control_xfer(coreid, TUSB_DIR_DEV_TO_HOST, m_hid_buffer, p_hid->report_length, false);
+ hal_dcd_control_xfer(port, TUSB_DIR_DEV_TO_HOST, m_hid_buffer, p_hid->report_length, false);
}
//------------- Class Specific Request -------------//
else if (p_request->bmRequestType_bit.type == TUSB_REQUEST_TYPE_CLASS)
@@ -214,11 +214,11 @@ tusb_error_t hidd_control_request_subtask(uint8_t coreid, tusb_control_request_t // wValue = Report Type | Report ID
void* p_buffer = NULL;
- uint16_t actual_length = p_driver->get_report_cb(coreid, (hid_request_report_type_t) u16_high_u8(p_request->wValue),
+ uint16_t actual_length = p_driver->get_report_cb(port, (hid_request_report_type_t) u16_high_u8(p_request->wValue),
&p_buffer, p_request->wLength);
SUBTASK_ASSERT( p_buffer != NULL && actual_length > 0 );
- hal_dcd_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, p_buffer, actual_length, false);
+ hal_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, p_buffer, actual_length, false);
}
else if ( (HID_REQUEST_CONTROL_SET_REPORT == p_request->bRequest) && (p_driver->set_report_cb != NULL) )
{
@@ -226,12 +226,12 @@ tusb_error_t hidd_control_request_subtask(uint8_t coreid, tusb_control_request_t // wValue = Report Type | Report ID
tusb_error_t error;
- hal_dcd_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, m_hid_buffer, p_request->wLength, true);
+ hal_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, m_hid_buffer, p_request->wLength, true);
osal_semaphore_wait(usbd_control_xfer_sem_hdl, OSAL_TIMEOUT_NORMAL, &error); // wait for control xfer complete
SUBTASK_ASSERT_STATUS(error);
- p_driver->set_report_cb(coreid, (hid_request_report_type_t) u16_high_u8(p_request->wValue),
+ p_driver->set_report_cb(port, (hid_request_report_type_t) u16_high_u8(p_request->wValue),
m_hid_buffer, p_request->wLength);
}
else if (HID_REQUEST_CONTROL_SET_IDLE == p_request->bRequest)
@@ -254,7 +254,7 @@ tusb_error_t hidd_control_request_subtask(uint8_t coreid, tusb_control_request_t return TUSB_ERROR_NONE;
}
-tusb_error_t hidd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
+tusb_error_t hidd_open(uint8_t port, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
{
uint8_t const *p_desc = (uint8_t const *) p_interface_desc;
@@ -280,7 +280,7 @@ tusb_error_t hidd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int VERIFY(p_hid, TUSB_ERROR_FAILED);
- VERIFY( hal_dcd_pipe_open(coreid, p_desc_endpoint, &p_hid->ept_handle), TUSB_ERROR_DCD_FAILED );
+ VERIFY( hal_dcd_pipe_open(port, p_desc_endpoint, &p_hid->ept_handle), TUSB_ERROR_DCD_FAILED );
p_hid->interface_number = p_interface_desc->bInterfaceNumber;
p_hid->p_report_desc = (p_interface_desc->bInterfaceProtocol == HID_PROTOCOL_KEYBOARD) ? tusbd_descriptor_pointers.p_hid_keyboard_report : tusbd_descriptor_pointers.p_hid_mouse_report;
@@ -310,7 +310,7 @@ tusb_error_t hidd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32 hidd_interface_t * const p_interface = hidd_class_driver[i].p_interface;
if ( (p_interface != NULL) && edpt_equal(edpt_hdl, p_interface->ept_handle) )
{
- hidd_class_driver[i].xfer_cb(edpt_hdl.coreid, event, xferred_bytes);
+ hidd_class_driver[i].xfer_cb(edpt_hdl.port, event, xferred_bytes);
}
}
diff --git a/tinyusb/class/hid/hid_device.h b/tinyusb/class/hid/hid_device.h index 5808dc214..088462c79 100644 --- a/tinyusb/class/hid/hid_device.h +++ b/tinyusb/class/hid/hid_device.h @@ -57,15 +57,15 @@ * @{ */
/** \brief Check if the interface is currently busy or not
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \retval true if the interface is busy meaning the stack is still transferring/waiting data from/to host
* \retval false if the interface is not busy meaning the stack successfully transferred data from/to host
* \note This function is primarily used for polling/waiting result after \ref tusbd_hid_keyboard_send.
*/
-bool tud_hid_keyboard_busy(uint8_t coreid);
+bool tud_hid_keyboard_busy(uint8_t port);
/** \brief Submit USB transfer
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in,out] p_report address that is used to store data from device. Must be accessible by usb controller (see \ref TUSB_CFG_ATTR_USBRAM)
* \returns \ref tusb_error_t type to indicate success or error condition.
* \retval TUSB_ERROR_NONE on success
@@ -75,7 +75,7 @@ bool tud_hid_keyboard_busy(uint8_t coreid); * \note This function is non-blocking and returns immediately. Data will be transferred when USB Host work with this interface.
* The result of usb transfer will be reported by the interface's callback function
*/
-tusb_error_t tud_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const *p_report);
+tusb_error_t tud_hid_keyboard_send(uint8_t port, hid_keyboard_report_t const *p_report);
//--------------------------------------------------------------------+
// APPLICATION CALLBACK API
@@ -83,18 +83,18 @@ tusb_error_t tud_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const * /** \brief Callback function that is invoked when an transferring event occurred
* after invoking \ref tusbd_hid_keyboard_send
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] event an value from \ref tusb_event_t
* \note event can be one of following
* - TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
* - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
* - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
*/
-void tud_hid_keyboard_cb(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes);
+void tud_hid_keyboard_cb(uint8_t port, tusb_event_t event, uint32_t xferred_bytes);
/** \brief Callback function that is invoked when USB host request \ref HID_REQUEST_CONTROL_GET_REPORT
* via control endpoint.
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] report_type specify which report (INPUT, OUTPUT, FEATURE) that host requests
* \param[out] pp_report pointer to buffer that application need to update, value must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
* \param[in] requested_length number of bytes that host requested
@@ -105,18 +105,18 @@ void tud_hid_keyboard_cb(uint8_t coreid, tusb_event_t event, uint32_t xferred_by * the completion of this control request will not be reported to application.
* For Keyboard, USB host often uses this to turn on/off the LED for CAPLOCKS, NUMLOCK (\ref hid_keyboard_led_bm_t)
*/
-uint16_t tud_hid_keyboard_get_report_cb(uint8_t coreid, hid_request_report_type_t report_type, void** pp_report, uint16_t requested_length);
+uint16_t tud_hid_keyboard_get_report_cb(uint8_t port, hid_request_report_type_t report_type, void** pp_report, uint16_t requested_length);
/** \brief Callback function that is invoked when USB host request \ref HID_REQUEST_CONTROL_SET_REPORT
* via control endpoint.
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] report_type specify which report (INPUT, OUTPUT, FEATURE) that host requests
* \param[in] p_report_data buffer containing the report's data
* \param[in] length number of bytes in the \a p_report_data
* \note By the time this callback is invoked, the USB control transfer is already completed in the hardware side.
* Application are free to handle data at its own will.
*/
-void tud_hid_keyboard_set_report_cb(uint8_t coreid, hid_request_report_type_t report_type, uint8_t p_report_data[], uint16_t length);
+void tud_hid_keyboard_set_report_cb(uint8_t port, hid_request_report_type_t report_type, uint8_t p_report_data[], uint16_t length);
/** @} */
/** @} */
@@ -130,15 +130,15 @@ void tud_hid_keyboard_set_report_cb(uint8_t coreid, hid_request_report_type_t re * @{ */
/** \brief Check if the interface is currently busy or not
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \retval true if the interface is busy meaning the stack is still transferring/waiting data from/to host
* \retval false if the interface is not busy meaning the stack successfully transferred data from/to host
* \note This function is primarily used for polling/waiting result after \ref tusbd_hid_mouse_send.
*/
-bool tud_hid_mouse_is_busy(uint8_t coreid);
+bool tud_hid_mouse_is_busy(uint8_t port);
/** \brief Perform transfer queuing
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in,out] p_report address that is used to store data from device. Must be accessible by usb controller (see \ref TUSB_CFG_ATTR_USBRAM)
* \returns \ref tusb_error_t type to indicate success or error condition.
* \retval TUSB_ERROR_NONE on success
@@ -148,7 +148,7 @@ bool tud_hid_mouse_is_busy(uint8_t coreid); * \note This function is non-blocking and returns immediately. Data will be transferred when USB Host work with this interface.
* The result of usb transfer will be reported by the interface's callback function
*/
-tusb_error_t tud_hid_mouse_send(uint8_t coreid, hid_mouse_report_t const *p_report);
+tusb_error_t tud_hid_mouse_send(uint8_t port, hid_mouse_report_t const *p_report);
//--------------------------------------------------------------------+
// APPLICATION CALLBACK API
@@ -156,18 +156,18 @@ tusb_error_t tud_hid_mouse_send(uint8_t coreid, hid_mouse_report_t const *p_repo /** \brief Callback function that is invoked when an transferring event occurred
* after invoking \ref tusbd_hid_mouse_send
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] event an value from \ref tusb_event_t
* \note event can be one of following
* - TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
* - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
* - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
*/
-void tud_hid_mouse_cb(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes);
+void tud_hid_mouse_cb(uint8_t port, tusb_event_t event, uint32_t xferred_bytes);
/** \brief Callback function that is invoked when USB host request \ref HID_REQUEST_CONTROL_GET_REPORT
* via control endpoint.
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] report_type specify which report (INPUT, OUTPUT, FEATURE) that host requests
* \param[out] pp_report pointer to buffer that application need to update, value must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
* \param[in] requested_length number of bytes that host requested
@@ -177,18 +177,18 @@ void tud_hid_mouse_cb(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes * \note After this callback, the request is silently executed by the tinyusb stack, thus
* the completion of this control request will not be reported to application
*/
-uint16_t tud_hid_mouse_get_report_cb(uint8_t coreid, hid_request_report_type_t report_type, void** pp_report, uint16_t requested_length);
+uint16_t tud_hid_mouse_get_report_cb(uint8_t port, hid_request_report_type_t report_type, void** pp_report, uint16_t requested_length);
/** \brief Callback function that is invoked when USB host request \ref HID_REQUEST_CONTROL_SET_REPORT
* via control endpoint.
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] report_type specify which report (INPUT, OUTPUT, FEATURE) that host requests
* \param[in] p_report_data buffer containing the report's data
* \param[in] length number of bytes in the \a p_report_data
* \note By the time this callback is invoked, the USB control transfer is already completed in the hardware side.
* Application are free to handle data at its own will.
*/
-void tud_hid_mouse_set_report_cb(uint8_t coreid, hid_request_report_type_t report_type, uint8_t p_report_data[], uint16_t length);
+void tud_hid_mouse_set_report_cb(uint8_t port, hid_request_report_type_t report_type, uint8_t p_report_data[], uint16_t length);
/** @} */
/** @} */
@@ -201,10 +201,10 @@ void tud_hid_mouse_set_report_cb(uint8_t coreid, hid_request_report_type_t repor #ifdef _TINY_USB_SOURCE_FILE_
void hidd_init(void);
-tusb_error_t hidd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
-tusb_error_t hidd_control_request_subtask(uint8_t coreid, tusb_control_request_t const * p_request);
+tusb_error_t hidd_open(uint8_t port, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
+tusb_error_t hidd_control_request_subtask(uint8_t port, tusb_control_request_t const * p_request);
tusb_error_t hidd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
-void hidd_close(uint8_t coreid);
+void hidd_close(uint8_t port);
#endif
diff --git a/tinyusb/class/msc/msc_device.c b/tinyusb/class/msc/msc_device.c index 381bbf07f..df3a4f327 100644 --- a/tinyusb/class/msc/msc_device.c +++ b/tinyusb/class/msc/msc_device.c @@ -79,12 +79,12 @@ void mscd_init(void) memclr_(&mscd_data, sizeof(mscd_interface_t));
}
-void mscd_close(uint8_t coreid)
+void mscd_close(uint8_t port)
{
memclr_(&mscd_data, sizeof(mscd_interface_t));
}
-tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
+tusb_error_t mscd_open(uint8_t port, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
{
ASSERT( ( MSC_SUBCLASS_SCSI == p_interface_desc->bInterfaceSubClass &&
MSC_PROTOCOL_BOT == p_interface_desc->bInterfaceProtocol ), TUSB_ERROR_MSC_UNSUPPORTED_PROTOCOL );
@@ -101,7 +101,7 @@ tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int endpoint_handle_t * p_edpt_hdl = ( p_endpoint->bEndpointAddress & TUSB_DIR_DEV_TO_HOST_MASK ) ?
&p_msc->edpt_in : &p_msc->edpt_out;
- VERIFY( hal_dcd_pipe_open(coreid, p_endpoint, p_edpt_hdl), TUSB_ERROR_DCD_FAILED );
+ VERIFY( hal_dcd_pipe_open(port, p_endpoint, p_edpt_hdl), TUSB_ERROR_DCD_FAILED );
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_endpoint );
}
@@ -115,7 +115,7 @@ tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int return TUSB_ERROR_NONE;
}
-tusb_error_t mscd_control_request_subtask(uint8_t coreid, tusb_control_request_t const * p_request)
+tusb_error_t mscd_control_request_subtask(uint8_t port, tusb_control_request_t const * p_request)
{
ASSERT(p_request->bmRequestType_bit.type == TUSB_REQUEST_TYPE_CLASS, TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT);
@@ -124,12 +124,12 @@ tusb_error_t mscd_control_request_subtask(uint8_t coreid, tusb_control_request_t switch(p_request->bRequest)
{
case MSC_REQUEST_RESET:
- hal_dcd_control_xfer(coreid, TUSB_DIR_HOST_TO_DEV, NULL, 0, false);
+ hal_dcd_control_xfer(port, TUSB_DIR_HOST_TO_DEV, NULL, 0, false);
break;
case MSC_REQUEST_GET_MAX_LUN:
p_msc->scsi_data[0] = p_msc->max_lun; // Note: lpc11/13u need xfer data's address to be aligned 64 -> make use of scsi_data instead of using max_lun directly
- hal_dcd_control_xfer(coreid, TUSB_DIR_DEV_TO_HOST, p_msc->scsi_data, 1, false);
+ hal_dcd_control_xfer(port, TUSB_DIR_DEV_TO_HOST, p_msc->scsi_data, 1, false);
break;
default:
@@ -174,7 +174,7 @@ tusb_error_t mscd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32 // TODO SCSI data out transfer is not yet supported
ASSERT_FALSE( p_cbw->xfer_bytes > 0 && !BIT_TEST_(p_cbw->dir, 7), TUSB_ERROR_NOT_SUPPORTED_YET);
- p_csw->status = tud_msc_scsi_cb(edpt_hdl.coreid, p_cbw->lun, p_cbw->command, &p_buffer, &actual_length);
+ p_csw->status = tud_msc_scsi_cb(edpt_hdl.port, p_cbw->lun, p_cbw->command, &p_buffer, &actual_length);
//------------- Data Phase (non READ10, WRITE10) -------------//
if ( p_cbw->xfer_bytes )
@@ -230,8 +230,8 @@ static bool read10_write10_data_xfer(mscd_interface_t* p_msc) uint16_t const block_count = __be2n_16(p_readwrite->block_count);
void *p_buffer = NULL;
- uint16_t xferred_block = (SCSI_CMD_READ_10 == p_cbw->command[0]) ? tud_msc_read10_cb (edpt_hdl.coreid, p_cbw->lun, &p_buffer, lba, block_count) :
- tud_msc_write10_cb(edpt_hdl.coreid, p_cbw->lun, &p_buffer, lba, block_count);
+ uint16_t xferred_block = (SCSI_CMD_READ_10 == p_cbw->command[0]) ? tud_msc_read10_cb (edpt_hdl.port, p_cbw->lun, &p_buffer, lba, block_count) :
+ tud_msc_write10_cb(edpt_hdl.port, p_cbw->lun, &p_buffer, lba, block_count);
xferred_block = min16_of(xferred_block, block_count);
uint16_t const xferred_byte = xferred_block * (p_cbw->xfer_bytes / block_count);
diff --git a/tinyusb/class/msc/msc_device.h b/tinyusb/class/msc/msc_device.h index c8cc29db8..0fde78a47 100644 --- a/tinyusb/class/msc/msc_device.h +++ b/tinyusb/class/msc/msc_device.h @@ -61,7 +61,7 @@ //--------------------------------------------------------------------+
/** \brief Callback that is invoked when tinyusb stack received \ref SCSI_CMD_READ_10 command from host
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] lun Targeted Logical Unit
* \param[out] pp_buffer Pointer to buffer which application need to update with the response data's address.
* Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
@@ -76,10 +76,10 @@ * \n\n Although this callback is called by tinyusb device task (non-isr context), however as all the classes share
* the same task (to save resource), any delay in this callback will cause delay in reponse on other classes.
*/
-uint16_t tud_msc_read10_cb (uint8_t coreid, uint8_t lun, void** pp_buffer, uint32_t lba, uint16_t block_count);
+uint16_t tud_msc_read10_cb (uint8_t port, uint8_t lun, void** pp_buffer, uint32_t lba, uint16_t block_count);
/** \brief Callback that is invoked when tinyusb stack received \ref SCSI_CMD_WRITE_10 command from host
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] lun Targeted Logical Unit
* \param[out] pp_buffer Pointer to buffer which application need to update with the address to hold data from host
* Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
@@ -94,12 +94,12 @@ uint16_t tud_msc_read10_cb (uint8_t coreid, uint8_t lun, void** pp_buffer, uint3 * \n\n Although this callback is called by tinyusb device task (non-isr context), however as all the classes share
* the same task (to save resource), any delay in this callback will cause delay in reponse on other classes.
*/
-uint16_t tud_msc_write10_cb(uint8_t coreid, uint8_t lun, void** pp_buffer, uint32_t lba, uint16_t block_count);
+uint16_t tud_msc_write10_cb(uint8_t port, uint8_t lun, void** pp_buffer, uint32_t lba, uint16_t block_count);
// p_length [in,out] allocated/maximum length, application update with actual length
/** \brief Callback that is invoked when tinyusb stack received an SCSI command other than \ref SCSI_CMD_WRITE_10 and
* \ref SCSI_CMD_READ_10 command from host
- * \param[in] coreid USB Controller ID
+ * \param[in] port USB Controller ID
* \param[in] lun Targeted Logical Unit
* \param[in] scsi_cmd SCSI command contents, application should examine this command block to know which command host requested
* \param[out] pp_buffer Pointer to buffer which application need to update with the address to transfer data with host.
@@ -111,7 +111,7 @@ uint16_t tud_msc_write10_cb(uint8_t coreid, uint8_t lun, void** pp_buffer, uint3 * \note Although this callback is called by tinyusb device task (non-isr context), however as all the classes share
* the same task (to save resource), any delay in this callback will cause delay in reponse on other classes.
*/
-msc_csw_status_t tud_msc_scsi_cb (uint8_t coreid, uint8_t lun, uint8_t scsi_cmd[16], void const ** pp_buffer, uint16_t* p_length);
+msc_csw_status_t tud_msc_scsi_cb (uint8_t port, uint8_t lun, uint8_t scsi_cmd[16], void const ** pp_buffer, uint16_t* p_length);
/** @} */
/** @} */
@@ -122,10 +122,10 @@ msc_csw_status_t tud_msc_scsi_cb (uint8_t coreid, uint8_t lun, uint8_t scsi_cmd[ #ifdef _TINY_USB_SOURCE_FILE_
void mscd_init(void);
-tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
-tusb_error_t mscd_control_request_subtask(uint8_t coreid, tusb_control_request_t const * p_request);
+tusb_error_t mscd_open(uint8_t port, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
+tusb_error_t mscd_control_request_subtask(uint8_t port, tusb_control_request_t const * p_request);
tusb_error_t mscd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
-void mscd_close(uint8_t coreid);
+void mscd_close(uint8_t port);
#endif
|
