USB Device Vendor API#
USB Device Vendor API.
Modules#
Typedefs#
App callback used for async comm.
Functions#
FUNCTION PROTOTYPES.
Add a new instance of the Vendor class.
Add the Vendor class instance into the specified configuration (see Note #1).
Get the vendor class enable state.
Add a Microsoft OS extended property to this vendor class instance.
Abort send the data to the host through the Bulk IN endpoint.
Abort receive the data from the host through the Interrupt OUT endpoint.
Abort send the data to the host through the Interrupt IN endpoint.
Receive the data from the host through the Bulk OUT endpoint.
Send data to the host through Bulk IN endpoint.
Receive data from the host through the Bulk OUT endpoint.
Send data to the host through the Bulk IN endpoint.
Receive data from the the host through the Interrupt OUT endpoint.
Send data to the host through the Interrupt IN endpoint.
Receive data from the host through Interrupt OUT endpoint.
Send data to the host through the Interrupt IN endpoint.
Typedef Documentation#
sl_usbd_vendor_async_function_t#
typedef void(* sl_usbd_vendor_async_function_t) (uint8_t class_nbr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_callback_arg, sl_status_t status) )(uint8_t class_nbr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_callback_arg, sl_status_t status)
App callback used for async comm.
63
of file protocol/usb/inc/sl_usbd_class_vendor.h
Function Documentation#
sl_usbd_vendor_init#
sl_status_t sl_usbd_vendor_init (void )
FUNCTION PROTOTYPES.
N/A |
VENDOR FUNCTIONS
Initialize the internal structures and variables used by the Vendor class.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
89
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_create_instance#
sl_status_t sl_usbd_vendor_create_instance (bool intr_en, uint16_t interval, sl_usbd_vendor_callbacks_t * p_vendor_callbacks, uint8_t * p_class_nbr)
Add a new instance of the Vendor class.
N/A | intr_en | Interrupt endpoints IN and OUT flag:
|
N/A | interval | Endpoint interval in milliseconds (must be a power of 2). |
N/A | p_vendor_callbacks | Pointer to vendor callback structure. [Content MUST be persistent] |
N/A | p_class_nbr | Pointer to a variable that will receive class instance number, if no errors are returned, or SL_USBD_CLASS_NBR_NONE otherwise. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
108
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_add_to_configuration#
sl_status_t sl_usbd_vendor_add_to_configuration (uint8_t class_nbr, uint8_t config_nbr)
Add the Vendor class instance into the specified configuration (see Note #1).
N/A | class_nbr | Class instance number. |
N/A | config_nbr | Configuration index to which to add the Vendor class instance. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) Called several times, it creates multiple instances and configurations. For instance, the following architecture could be created :
* FS * |-- Configuration 0 * |-- Interface 0 (Vendor 0) * |-- Configuration 1 * |-- Interface 0 (Vendor 0) * |-- Interface 1 (Vendor 1) *
In that example, there are two instances of Vendor class: 'Vendor 0' and '1', and two possible configurations: 'Configuration 0' and '1'. 'Configuration 1' is composed of two interfaces. Each class instance has an association with one of the interfaces. If 'Configuration 1' is activated by the host, it allows the host to access two different functionalities offered by the device.
(2) Configuration Descriptor corresponding to a Vendor-specific device has the following format :
* Configuration Descriptor * |-- Interface Descriptor (Vendor class) * |-- Endpoint Descriptor (Bulk OUT) * |-- Endpoint Descriptor (Bulk IN) * |-- Endpoint Descriptor (Interrupt OUT) - optional * |-- Endpoint Descriptor (Interrupt IN) - optional *
149
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_is_enabled#
sl_status_t sl_usbd_vendor_is_enabled (uint8_t class_nbr, bool * p_enabled)
Get the vendor class enable state.
N/A | class_nbr | Class instance number. |
N/A | p_enabled | Pointer to a variable that will receive the enable state. The variable is set to true, if the Vendor class is enabled, and is set to false if the Vendor class is NOT enabled. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
163
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_abort_read_bulk#
sl_status_t sl_usbd_vendor_abort_read_bulk (uint8_t class_nbr, property_type, p_property_name, property_name_len, p_property, property_len)
Add a Microsoft OS extended property to this vendor class instance.
N/A | class_nbr | Class instance number. |
N/A | property_type | Property type (see Note #2).
|
N/A | p_property_name | Pointer to the buffer that contains the property name. -— Buffer assumed to be persistent -— |
N/A | property_name_len | Length of the property name in octets. |
N/A | p_property | Pointer to the buffer that contains the property name. -— Buffer assumed to be persistent -— |
N/A | property_len | Length of the property in octets. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) For more information on Microsoft OS descriptors, see 'http://msdn.microsoft.com/en-us/library/windows/hardware/gg463179.aspx'.
(2) For more information on property types, refer to "Table 3. Property Data Types" of "Extended Properties OS Feature Descriptor Specification" document provided by Microsoft available at 'http://msdn.microsoft.com/en-us/library/windows/hardware/gg463179.aspx'.
Abort receive the data from the host through the Bulk OUT endpoint.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
216
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_abort_write_bulk#
sl_status_t sl_usbd_vendor_abort_write_bulk (uint8_t class_nbr)
Abort send the data to the host through the Bulk IN endpoint.
N/A | class_nbr | Class instance number. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
225
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_abort_read_interrupt#
sl_status_t sl_usbd_vendor_abort_read_interrupt (uint8_t class_nbr)
Abort receive the data from the host through the Interrupt OUT endpoint.
N/A | class_nbr | Class instance number. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
234
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_abort_write_interrupt#
sl_status_t sl_usbd_vendor_abort_write_interrupt (uint8_t class_nbr)
Abort send the data to the host through the Interrupt IN endpoint.
N/A | class_nbr | Class instance number. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
243
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_read_bulk_sync#
sl_status_t sl_usbd_vendor_read_bulk_sync (uint8_t class_nbr, void * p_buf, uint32_t buf_len, uint16_t timeout, uint32_t * p_xfer_len)
Receive the data from the host through the Bulk OUT endpoint.
N/A | class_nbr | Class instance number. |
N/A | p_buf | Pointer to the receive buffer. |
N/A | buf_len | Receive the buffer length in octets. |
N/A | timeout | Timeout in milliseconds. |
N/A | p_xfer_len | Pointer to a variable that will receive transfer length. The variable is set to number of octets received, if no errors are returned, or is set to 0 if any errors are returned. |
This function is blocking.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
262
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_write_bulk_sync#
sl_status_t sl_usbd_vendor_write_bulk_sync (uint8_t class_nbr, void * p_buf, uint32_t buf_len, uint16_t timeout, bool end, uint32_t * p_xfer_len)
Send data to the host through Bulk IN endpoint.
N/A | class_nbr | Class instance number. |
N/A | p_buf | Pointer to the transmit buffer. |
N/A | buf_len | Transmit the buffer length in octets. |
N/A | timeout | Timeout in milliseconds. |
N/A | end | End-of-transfer flag (see Note #1). |
N/A | p_xfer_len | Pointer to a variable that will receive transfer length. The variable is set to number of octets received, if no errors are returned, or is set to 0 if any errors are returned. |
This function is blocking.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) If the end-of-transfer is set and the transfer length is a multiple of the maximum packet size, a zero-length packet is transferred to signal the end of transfer to the host.
290
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_read_bulk_async#
sl_status_t sl_usbd_vendor_read_bulk_async (uint8_t class_nbr, void * p_buf, uint32_t buf_len, sl_usbd_vendor_async_function_t async_fnct, void * p_async_arg)
Receive data from the host through the Bulk OUT endpoint.
N/A | class_nbr | Class instance number. |
N/A | p_buf | Pointer to the receive buffer. |
N/A | buf_len | Receive buffer length in octets. |
N/A | async_fnct | Receive the the callback. |
N/A | p_async_arg | Additional argument provided by the application for the receive callback. |
This function is non-blocking are returns immediately after transfer preparation. Upon transfer completion, a callback provided by the application will be called to finalize the transfer.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
314
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_write_bulk_async#
sl_status_t sl_usbd_vendor_write_bulk_async (uint8_t class_nbr, void * p_buf, uint32_t buf_len, sl_usbd_vendor_async_function_t async_fnct, void * p_async_arg, bool end)
Send data to the host through the Bulk IN endpoint.
N/A | class_nbr | Class instance number. |
N/A | p_buf | Pointer to the transmit buffer. |
N/A | buf_len | Transmit buffer length in octets. |
N/A | async_fnct | Transmit the callback. |
N/A | p_async_arg | Additional argument provided by the application for the transmit callback. |
N/A | end | End-of-transfer flag (see Note #1). |
This function is non-blocking and returns immediately after transfer preparation. Upon transfer completion, a callback provided by the application will be called to finalize the transfer.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) If the end-of-transfer is set and the transfer length is a multiple of the maximum packet size, a zero-length packet is transferred to signal the end of transfer to the host.
342
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_read_interrupt_sync#
sl_status_t sl_usbd_vendor_read_interrupt_sync (uint8_t class_nbr, void * p_buf, uint32_t buf_len, uint16_t timeout, uint32_t * p_xfer_len)
Receive data from the the host through the Interrupt OUT endpoint.
N/A | class_nbr | Class instance number. |
N/A | p_buf | Pointer to the receive buffer. |
N/A | buf_len | Receive buffer length in octets. |
N/A | timeout | Timeout in milliseconds. |
N/A | p_xfer_len | Pointer to a variable that will receive transfer length. The variable is set to number of octets received, if no errors are returned, or is set to 0 if any errors are returned. |
This function is blocking.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
366
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_write_interrupt_sync#
sl_status_t sl_usbd_vendor_write_interrupt_sync (uint8_t class_nbr, void * p_buf, uint32_t buf_len, uint16_t timeout, bool end, uint32_t * p_xfer_len)
Send data to the host through the Interrupt IN endpoint.
N/A | class_nbr | Class instance number. |
N/A | p_buf | Pointer to the transmit buffer. |
N/A | buf_len | Transmit buffer length in octets. |
N/A | timeout | Timeout in milliseconds. |
N/A | end | End-of-transfer flag (see Note #1). |
N/A | p_xfer_len | Pointer to a variable that will receive transfer length. The variable is set to number of octets received, if no errors are returned, or is set to 0 if any errors are returned. |
This function is blocking.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) If the end-of-transfer is set and the transfer length is a multiple of the maximum packet size, a zero-length packet is transferred to signal the end of transfer to the host.
394
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_read_interrupt_async#
sl_status_t sl_usbd_vendor_read_interrupt_async (uint8_t class_nbr, void * p_buf, uint32_t buf_len, sl_usbd_vendor_async_function_t async_fnct, void * p_async_arg)
Receive data from the host through Interrupt OUT endpoint.
N/A | class_nbr | Class instance number. |
N/A | p_buf | Pointer to the receive buffer. |
N/A | buf_len | Receive buffer length in octets. |
N/A | async_fnct | Receive callback. |
N/A | p_async_arg | Additional argument provided by application for the receive callback. |
This function is non-blocking and returns immediately after transfer preparation. Upon transfer completion, a callback provided by the application will be called to finalize the transfer.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
418
of file protocol/usb/inc/sl_usbd_class_vendor.h
sl_usbd_vendor_write_interrupt_async#
sl_status_t sl_usbd_vendor_write_interrupt_async (uint8_t class_nbr, void * p_buf, uint32_t buf_len, sl_usbd_vendor_async_function_t async_fnct, void * p_async_arg, bool end)
Send data to the host through the Interrupt IN endpoint.
N/A | class_nbr | Class instance number. |
N/A | p_buf | Pointer to the transmit buffer. |
N/A | buf_len | Transmit buffer length in octets. |
N/A | async_fnct | Transmit callback. |
N/A | p_async_arg | Additional argument provided by the application for the transmit callback. |
N/A | end | End-of-transfer flag (see Note #1). |
This function is non-blocking and returns immediately after transfer preparation. Upon transfer completion, a callback provided by the application will be called to finalize the transfer.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) If the end-of-transfer is set and the transfer length is a multiple of the maximum packet size, a zero-length packet is transferred to signal the end of transfer to the host.
446
of file protocol/usb/inc/sl_usbd_class_vendor.h