USB Device Core API#

USB Device Core API.

Modules#

sl_usbd_device_config_t

sl_usbd_setup_req_t

sl_usbd_class_driver_t

Enumerations#

enum
SL_USBD_DEVICE_SPEED_INVALID = 0u
SL_USBD_DEVICE_SPEED_LOW
SL_USBD_DEVICE_SPEED_FULL
SL_USBD_DEVICE_SPEED_HIGH
}

DATA TYPES.

enum
SL_USBD_DEVICE_STATE_NONE = 0
SL_USBD_DEVICE_STATE_INIT
SL_USBD_DEVICE_STATE_ATTACHED
SL_USBD_DEVICE_STATE_DEFAULT
SL_USBD_DEVICE_STATE_ADDRESSED
SL_USBD_DEVICE_STATE_CONFIGURED
SL_USBD_DEVICE_STATE_SUSPENDED
}
enum
SL_USBD_EVENT_BUS_CONNECT = 0
SL_USBD_EVENT_BUS_DISCONNECT
SL_USBD_EVENT_BUS_RESET
SL_USBD_EVENT_BUS_SUSPEND
SL_USBD_EVENT_BUS_RESUME
}

BUS EVENT DATA TYPE.

enum
SL_USBD_EVENT_CONFIG_SET = 0
SL_USBD_EVENT_CONFIG_UNSET
}

CONFIG EVENT DATA TYPE.

Typedefs#

typedef void(*
sl_usbd_async_function_t)(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_arg, sl_status_t status)

EP ASYNCHRONOUS CALLBACK API.

Functions#

sl_status_t

FUNCTION PROTOTYPES.

sl_status_t

Start the device stack.

sl_status_t

Stop the device stack.

sl_status_t
sl_usbd_core_get_device_state(sl_usbd_device_state_t *p_dev_state)

Get the current device state.

sl_status_t
sl_usbd_core_get_device_speed(sl_usbd_device_speed_t *p_dev_speed)

Get device speed.

sl_status_t

Set the device's current power source.

sl_status_t
sl_usbd_core_get_device_configuration(sl_usbd_device_config_t **p_dev_cfg)

Set the device's Microsoft vendor code.

sl_status_t

Get the last frame number from the driver.

sl_status_t
sl_usbd_core_add_configuration(uint8_t attrib, uint16_t max_pwr, sl_usbd_device_speed_t spd, const char *p_name, uint8_t *p_cfg_nbr)

Add a configuration attribute to the device.

sl_status_t
sl_usbd_core_add_interface(uint8_t cfg_nbr, sl_usbd_class_driver_t *p_class_drv, void *p_if_class_arg, void *p_if_alt_class_arg, uint8_t class_code, uint8_t class_sub_code, uint8_t class_protocol_code, const char *p_name, uint8_t *p_if_nbr)

Associate a configuration with its alternative-speed counterpart.

sl_status_t
sl_usbd_core_add_alt_interface(uint8_t config_nbr, uint8_t if_nbr, void *p_class_arg, const char *p_name, uint8_t *p_if_alt_nbr)

Add an alternate setting to a specific interface.

sl_status_t
sl_usbd_core_add_interface_group(uint8_t config_nbr, uint8_t class_code, uint8_t class_sub_code, uint8_t class_protocol_code, uint8_t if_start, uint8_t if_cnt, const char *p_name, uint8_t *p_if_grp_num)

Create an interface group.

sl_status_t
sl_usbd_core_get_device_descriptor(uint8_t *p_buf, uint8_t max_len, uint8_t *p_desc_len)

Get the device descriptor.

sl_status_t
sl_usbd_core_get_configuration_descriptor(uint8_t *p_buf, uint16_t max_len, uint8_t config_ix, uint16_t *p_desc_len)

Get a configuration descriptor.

sl_status_t
sl_usbd_core_get_string_descriptor(uint8_t *p_buf, uint8_t max_len, uint8_t str_ix, uint8_t *p_desc_len)

Get a string descriptor.

sl_status_t
sl_usbd_core_add_string(const char *p_str)

Add string to USB device.

sl_status_t
sl_usbd_core_get_string_index(const char *p_str, uint8_t *p_str_ix)

Get string index corresponding to a given string.

sl_status_t

Write an 8-bit value to the descriptor buffer.

sl_status_t

Write a 16-bit value in the descriptor buffer.

sl_status_t

Write a 24-bit value to the descriptor buffer.

sl_status_t

Write a 32-bit value to the descriptor buffer.

sl_status_t
sl_usbd_core_write_buf_to_descriptor_buf(const uint8_t *p_buf, uint16_t len)

Write a buffer into the descriptor buffer.

sl_status_t
sl_usbd_core_write_control_sync(void *p_buf, uint32_t buf_len, uint16_t timeout_ms, bool end, uint32_t *p_xfer_len)

Send data on the Control IN endpoint.

sl_status_t
sl_usbd_core_read_control_sync(void *p_buf, uint32_t buf_len, uint16_t timeout_ms, uint32_t *p_xfer_len)

Receive data on the Control OUT endpoint.

sl_status_t
sl_usbd_core_add_bulk_endpoint(uint8_t config_nbr, uint8_t if_nbr, uint8_t if_alt_nbr, bool dir_in, uint16_t max_pkt_len, uint8_t *p_ep_addr)

Add a bulk endpoint to alternate setting interface.

sl_status_t
sl_usbd_core_read_bulk_sync(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint16_t timeout_ms, uint32_t *p_xfer_len)

Receive data on Bulk OUT endpoint.

sl_status_t
sl_usbd_core_read_bulk_async(uint8_t ep_addr, void *p_buf, uint32_t buf_len, sl_usbd_async_function_t async_fnct, void *p_async_arg)

Receive data on Bulk OUT endpoint asynchronously.

sl_status_t
sl_usbd_core_write_bulk_sync(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint16_t timeout_ms, bool end, uint32_t *p_xfer_len)

Send data on a Bulk IN endpoint.

sl_status_t
sl_usbd_core_write_bulk_async(uint8_t ep_addr, void *p_buf, uint32_t buf_len, sl_usbd_async_function_t async_fnct, void *p_async_arg, bool end)

Send data on the Bulk IN endpoint asynchronously.

sl_status_t
sl_usbd_core_add_interrupt_endpoint(uint8_t config_nbr, uint8_t if_nbr, uint8_t if_alt_nbr, bool dir_in, uint16_t max_pkt_len, uint16_t interval, uint8_t *p_ep_addr)

Add an interrupt endpoint to an alternate setting interface.

sl_status_t
sl_usbd_core_read_interrupt_sync(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint16_t timeout_ms, uint32_t *p_xfer_len)

Receive data on the Interrupt OUT endpoint.

sl_status_t
sl_usbd_core_read_interrupt_async(uint8_t ep_addr, void *p_buf, uint32_t buf_len, sl_usbd_async_function_t async_fnct, void *p_async_arg)

Receive data on Interrupt OUT endpoint asynchronously.

sl_status_t
sl_usbd_core_write_interrupt_sync(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint16_t timeout_ms, bool end, uint32_t *p_xfer_len)

Send data on Interrupt IN endpoint.

sl_status_t
sl_usbd_core_write_interrupt_async(uint8_t ep_addr, void *p_buf, uint32_t buf_len, sl_usbd_async_function_t async_fnct, void *p_async_arg, bool end)

Send data on the Interrupt IN endpoint asynchronously.

sl_status_t
sl_usbd_core_endpoint_write_zlp(uint8_t ep_addr, uint16_t timeout_ms)

Add an isochronous endpoint to alternate setting interface.

sl_status_t
sl_usbd_core_endpoint_read_zlp(uint8_t ep_addr, uint16_t timeout_ms)

Receive zero-length packet from the host.

sl_status_t

Abort I/O transfer on the endpoint.

sl_status_t

Notify USB stack that packet receive has completed.

sl_status_t

Notify USB stack that packet transmit has completed.

sl_status_t
sl_usbd_core_endpoint_write_complete_extended(uint8_t ep_log_nbr, sl_status_t xfer_err)

Notify USB stack that packet transmit has completed (see Note #1).

sl_status_t
sl_usbd_core_stall_endpoint(uint8_t ep_addr, bool state)

Stall the non-control endpoint.

sl_status_t
sl_usbd_core_is_endpoint_stalled(uint8_t ep_addr, bool *p_ep_stall)

Get the stall status of a non-control endpoint.

sl_status_t
sl_usbd_core_get_max_endpoint_packet_size(uint8_t ep_addr, uint16_t *p_max_size)

Retrieve the endpoint maximum packet size.

sl_status_t

Get the maximum physical endpoint number.

sl_status_t
__WEAK void
sl_usbd_on_bus_event(sl_usbd_bus_event_t event)
__WEAK void
sl_usbd_on_config_event(sl_usbd_config_event_t event, uint8_t config_nbr)

Macros#

#define

MODULE.

#define
SL_USBD_FRAME_NBR_MASK 0b0000011111111111
#define
SL_USBD_MICROFRAME_NBR_MASK 0b0011100000000000
#define

CONFIGURATION ATTRIBUTES.

#define

DEVICE DESCRIPTOR LENGTH.

#define
#define
#define
#define
#define

SUB-CLASS CODES.

#define

PROTOCOL CODES.

#define

FEATURE SELECTORS.

#define

DEVICE POWER CONSTRAINS.

#define

ENDPOINT TYPE.

#define

ENDPOINT ADDRESS.

#define

MICROSOFT OS DESCRIPTOR DEFINES.

#define

USB EP INFORMATION TABLE DEFINES.

#define

USB OBJECT NUMBER.

#define

USB DEFAULT CONFIGS.

#define
SL_USBD_URB_MAX_NBR SL_USBD_OPEN_ENDPOINTS_QUANTITY
#define

USB CORE EVENTS.

#define
SL_USBD_CORE_EVENT_BUS_NBR_TOTAL (SL_USBD_CORE_EVENT_BUS_NBR * SL_USBD_DEVICE_QUANTITY)
#define
SL_USBD_CORE_EVENT_ASYNC_NBR ((SL_USBD_OPEN_ENDPOINTS_QUANTITY * SL_USBD_DEVICE_QUANTITY) + SL_USBD_EXTRA_URB_QUANTITY)
#define
SL_USBD_CORE_EVENT_NBR_TOTAL (SL_USBD_CORE_EVENT_BUS_NBR_TOTAL + SL_USBD_CORE_EVENT_ASYNC_NBR)
#define

GLOBAL CONSTANTS.

#define
#define
SL_USBD_FRAME_NBR_DIFF_GET (frame_nbr1, frame_nbr2)
#define

ENDPOINT CONVERSION MACROS.

#define
#define

Enumeration Documentation#

sl_usbd_device_speed_t#

sl_usbd_device_speed_t

DATA TYPES.

                                  USB DEVICE SPEED DATA TYPE

Note

  • (1) 'Universal Serial Bus Specification Rev 2.0', section 4.2.1 defines three data rates:

    • (a) The USB Low-Speed (LS) signaling bit rate is 1.5 Mb/s.

    • (b) The USB Full-Speed (FS) signaling bit rate is 12 Mb/s.

    • (c) The USB High-Speed (HS) signaling bit rate is 480 Mb/s.

Enumerator
SL_USBD_DEVICE_SPEED_INVALID
SL_USBD_DEVICE_SPEED_LOW

Low-Speed (see Note #1a).

SL_USBD_DEVICE_SPEED_FULL

Full-Speed (see Note #1b).

SL_USBD_DEVICE_SPEED_HIGH

High-Speed (see Note #1c).


Definition at line 414 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_device_state_t#

sl_usbd_device_state_t
                                  USB DEVICE STATES DATA TYPE

Note

  • (1) 'Universal Serial Bus Specification Rev 2.0', section 9.1.1 defines seven visible device states:

    • (a) SL_USBD_DEVICE_STATE_INIT : Device is not attached to the USB.

    • (b) SL_USBD_DEVICE_STATE_ATTACHED : Device is attached to the USB, but not powered.

    • (c) USBD_DEV_STATE_POWERED : Device is attached to the USB and powered, but has not been reset.

    • (d) SL_USBD_DEVICE_STATE_DEFAULT : Device is attached to the USB and powered and has been reset, but has not been assigned a unique address. Device responds at the default address.

    • (e) SL_USBD_DEVICE_STATE_ADDRESSED : Device is attached to the USB, powered, has been reset, and a unique device address has been assigned. Device is not configured.

    • (f) SL_USBD_DEVICE_STATE_CONFIGURED : Device is attached to the USB, powered, has been reset, has a unique address, is configured, and is not suspended. The host may now use the function provided by the device.

    • (g) SL_USBD_DEVICE_STATE_SUSPENDED : Device is, at minimum, attached to the USB and is powered and has not seen bus activity for 3 ms. It may also have a unique address and be configured for use. However, because the device is suspended, the host may not use the device's function.

  • (2) An additional state is added (USBD_DEV_STATE_START) to determine if the device controller has been initialized.

Enumerator
SL_USBD_DEVICE_STATE_NONE
SL_USBD_DEVICE_STATE_INIT
SL_USBD_DEVICE_STATE_ATTACHED
SL_USBD_DEVICE_STATE_DEFAULT
SL_USBD_DEVICE_STATE_ADDRESSED
SL_USBD_DEVICE_STATE_CONFIGURED
SL_USBD_DEVICE_STATE_SUSPENDED

Definition at line 448 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_bus_event_t#

sl_usbd_bus_event_t

BUS EVENT DATA TYPE.

Enumerator
SL_USBD_EVENT_BUS_CONNECT
SL_USBD_EVENT_BUS_DISCONNECT
SL_USBD_EVENT_BUS_RESET
SL_USBD_EVENT_BUS_SUSPEND
SL_USBD_EVENT_BUS_RESUME

Definition at line 462 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_config_event_t#

sl_usbd_config_event_t

CONFIG EVENT DATA TYPE.

Enumerator
SL_USBD_EVENT_CONFIG_SET
SL_USBD_EVENT_CONFIG_UNSET

Definition at line 474 of file protocol/usb/inc/sl_usbd_core.h

Typedef Documentation#

sl_usbd_async_function_t#

typedef void(* sl_usbd_async_function_t) (uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_arg, sl_status_t status) )(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_arg, sl_status_t status)

EP ASYNCHRONOUS CALLBACK API.


Definition at line 588 of file protocol/usb/inc/sl_usbd_core.h

Function Documentation#

sl_usbd_core_init#

sl_status_t sl_usbd_core_init (void )

FUNCTION PROTOTYPES.

Parameters
N/A

CONFIGURATION OVERRIDE FUNCTIONS USBD CORE FUNCTIONS

Note(s) : (1) USB Spec 2.0, Section 5.5 states "Control transfers allow access to different parts of a device. Control transfers are intended to support configuration/command/status type communication flows between client software and its function".

(a) "Each USB device is required to implement the Default Control Pipe as a message pipe. This pipe is used by the USB System Software. The Default Control Pipe provides access to the USB device's configuration, status, and control information".

The 'sl_usbd_core_ep_XXXX()' functions perform operations in the default endpoint. Class drivers should use 'sl_usbd_core_ep_XXXX()' to send/receive class specific requests.

                                            sl_usbd_core_init()

Initialize the USB device stack.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) sli_usbd_core_init_internals() MUST be called ... :

    • (a) ONLY ONCE from a product's application;

    • (b) With the following conditions:

      • (1) AFTER the product's OS has been initialized.

      • (2) BEFORE the product's application calls any USB device stack function(s).


Definition at line 685 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_start_device#

sl_status_t sl_usbd_core_start_device (void )

Start the device stack.

Parameters
N/A

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Device stack can be only started if the device is in one of the following states:

    • SL_USBD_DEVICE_STATE_NONE Device controller has not been initialized.

    • SL_USBD_DEVICE_STATE_INIT Device controller is already initialized.


Definition at line 696 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_stop_device#

sl_status_t sl_usbd_core_stop_device (void )

Stop the device stack.

Parameters
N/A

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 703 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_device_state#

sl_status_t sl_usbd_core_get_device_state (sl_usbd_device_state_t * p_dev_state)

Get the current device state.

Parameters
N/Ap_dev_state

Pointer to device state to be returned. Set to current device state, if no errors are returned, or SL_USBD_DEVICE_STATE_NONE, if any errors are returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 714 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_device_speed#

sl_status_t sl_usbd_core_get_device_speed (sl_usbd_device_speed_t * p_dev_speed)

Get device speed.

Parameters
N/Ap_dev_speed

Pointer to the variable that will be set to device speed upon return. It will be set to current device speed, if successful, or SL_USBD_DEVICE_SPEED_INVALID, if unsuccessful.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 725 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_set_device_self_power#

sl_status_t sl_usbd_core_set_device_self_power (bool self_pwr)

Set the device's current power source.

Parameters
N/Aself_pwr

The power source of the device :

  • true device is self-powered.

  • false device is bus-powered.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 736 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_device_configuration#

sl_status_t sl_usbd_core_get_device_configuration (sl_usbd_device_config_t ** p_dev_cfg)

Set the device's Microsoft vendor code.

Parameters
N/Ap_dev_cfg

Pointer to a variable of type (sl_usbd_device_config_t *) which will receive the memory address of device configuration structure upon return. The variable will be set to point to device configuration, if no errors are returned, or it will be set to NULL if any errors are returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) The vendor code used MUST be different from any vendor bRequest value.

Get the device configuration.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 761 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_device_frame_number#

sl_status_t sl_usbd_core_get_device_frame_number (uint16_t * p_frame_nbr)

Get the last frame number from the driver.

Parameters
N/Ap_frame_nbr

Pointer to variable that will receive frame number.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) The frame number will always be in the range of 0-2047 (11 bits).

  • (2) Frame number returned to the caller contains the frame and microframe numbers. It is encoded following this 16-bit format:

    *               | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
    *               |  0    0 |  microframe  |                  frame                     |
    *               

    Caller must use the macros SL_USBD_FRAME_NBR_GET() or SL_USBD_MICROFRAME_NBR_GET() to get the frame or microframe number only.


Definition at line 781 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_add_configuration#

sl_status_t sl_usbd_core_add_configuration (uint8_t attrib, uint16_t max_pwr, sl_usbd_device_speed_t spd, const char * p_name, uint8_t * p_cfg_nbr)

Add a configuration attribute to the device.

Parameters
N/Aattrib

Available configuration attributes.

  • SL_USBD_DEV_ATTRIB_SELF_POWERED Power does not come from VBUS.

  • SL_USBD_DEV_ATTRIB_REMOTE_WAKEUP Remote wakeup feature enabled.

N/Amax_pwr

Bus power required for this device (see Note #1).

N/Aspd

Available configuration speeds.

  • SL_USBD_DEVICE_SPEED_FULL Configuration is added in the full-speed configuration set.

N/Ap_name

Pointer to string describing the configuration (see Note #2).

N/Ap_cfg_nbr

Pointer to variable that will receive the configuration number. It will be set to the configuration number, if no errors are returned, otherwise it will be set to SL_USBD_CONFIG_NBR_NONE if any errors are returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) USB spec 2.0 (section 7.2.1.3/4) defines power constraints for bus-powered devices: "A low-power function draws up to one unit load from the USB cable when operational" "A function is high-power if, when fully powered, draws over one, but no more than five, unit loads from the USB cable." A unit load is defined as 100mA, so 'max_pwr' argument should be between 0 mA and 500mA

  • (2) String support is optional: 'p_name' can be a NULL string pointer.

  • (3) Configuration can only be added when the device is in the following states:

    • SL_USBD_DEVICE_STATE_NONE Device controller has not been initialized.

    • SL_USBD_DEVICE_STATE_INIT Device controller is already initialized.


Definition at line 816 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_add_interface#

sl_status_t sl_usbd_core_add_interface (uint8_t cfg_nbr, sl_usbd_class_driver_t * p_class_drv, void * p_if_class_arg, void * p_if_alt_class_arg, uint8_t class_code, uint8_t class_sub_code, uint8_t class_protocol_code, const char * p_name, uint8_t * p_if_nbr)

Associate a configuration with its alternative-speed counterpart.

Parameters
N/Acfg_nbr

Configuration index to add the interface.

N/Ap_class_drv

Pointer to interface driver.

N/Ap_if_class_arg

Pointer to interface driver argument.

N/Ap_if_alt_class_arg

Pointer to alternate interface argument.

N/Aclass_code

Class code assigned by the USB-IF.

N/Aclass_sub_code

Subclass code assigned by the USB-IF.

N/Aclass_protocol_code

protocol code assigned by the USB-IF.

N/Ap_name

Pointer to string describing the Interface.

N/Ap_if_nbr

Pointer to a variable that will receive interface number after creation. The variable will be set to the interface number, if no errors are returned, otherwise it is set to SL_USBD_INTERFACE_NBR_NONE.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Configurations from high- and full-speed can be associated with each other to provide comparable functionality regardless of speed.

  • (2) Configuration can ONLY be associated when the device is in the following states:

    • SL_USBD_DEVICE_STATE_NONE Device controller has not been initialized.

    • SL_USBD_DEVICE_STATE_INIT Device controller is already initialized.

Add an interface to a specific configuration.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) USB Spec 2.0 Interface (section 9.6.5) states: "An interface may include alternate settings that allow the endpoints and/or their characteristics to be varied after the device has been configured. The default setting for an interface is always an alternate setting of zero."


Definition at line 873 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_add_alt_interface#

sl_status_t sl_usbd_core_add_alt_interface (uint8_t config_nbr, uint8_t if_nbr, void * p_class_arg, const char * p_name, uint8_t * p_if_alt_nbr)

Add an alternate setting to a specific interface.

Parameters
N/Aconfig_nbr

Configuration number.

N/Aif_nbr

Interface number.

N/Ap_class_arg

Pointer to alternate interface argument.

N/Ap_name

Pointer to alternate setting name.

N/Ap_if_alt_nbr

Pointer to variable that will receive alternate setting number upon return. It will be set to interface alternate setting number if no error(s) are returned, or SL_USBD_ALT_INTERFACE_NBR_NONE if any errors are returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 900 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_add_interface_group#

sl_status_t sl_usbd_core_add_interface_group (uint8_t config_nbr, uint8_t class_code, uint8_t class_sub_code, uint8_t class_protocol_code, uint8_t if_start, uint8_t if_cnt, const char * p_name, uint8_t * p_if_grp_num)

Create an interface group.

Parameters
N/Aconfig_nbr

Configuration number.

N/Aclass_code

Class code assigned by the USB-IF.

N/Aclass_sub_code

Subclass code assigned by the USB-IF.

N/Aclass_protocol_code

protocol code assigned by the USB-IF.

N/Aif_start

Interface number of the first interface that is associated with this group.

N/Aif_cnt

Number of consecutive interfaces that are associated with this group.

N/Ap_name

Pointer to the string that describes the interface group.

N/Ap_if_grp_num

Pointer to the variable that will receive interface group number upon return. The variable is set to interface group number if no errors are returned, or SL_USBD_INTERFACE_GROUP_NBR_NONE if any errors are returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 929 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_device_descriptor#

sl_status_t sl_usbd_core_get_device_descriptor (uint8_t * p_buf, uint8_t max_len, uint8_t * p_desc_len)

Get the device descriptor.

Parameters
N/Ap_buf

Pointer to the destination buffer.

N/Amax_len

Maximum number of bytes to write in destination buffer.

N/Ap_desc_len

Pointer to a variable that will receive the actual size of the descriptor. The variable is set to number of bytes actually in the descriptor if no errors are returned, or set to 0 if any errors are returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) This function should be used by drivers that supporting the standard requests auto-reply, (during the initialization process).


Definition at line 954 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_configuration_descriptor#

sl_status_t sl_usbd_core_get_configuration_descriptor (uint8_t * p_buf, uint16_t max_len, uint8_t config_ix, uint16_t * p_desc_len)

Get a configuration descriptor.

Parameters
N/Ap_buf

Pointer to the destination buffer.

N/Amax_len

Maximum number of bytes to write in the destination buffer.

N/Aconfig_ix

Index of the desired configuration descriptor.

N/Ap_desc_len

Pointer to a variable that will receive the actual size of the descriptor. The variable is set to number of bytes actually in the descriptor if no errors are returned, or set to 0 if any errors are returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) This function should be used by drivers supporting a standard request's auto-reply, during the initialization process.


Definition at line 976 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_string_descriptor#

sl_status_t sl_usbd_core_get_string_descriptor (uint8_t * p_buf, uint8_t max_len, uint8_t str_ix, uint8_t * p_desc_len)

Get a string descriptor.

Parameters
N/Ap_buf

Pointer to the destination buffer.

N/Amax_len

Maximum number of bytes to write in destination buffer.

N/Astr_ix

Index of the desired string descriptor.

N/Ap_desc_len

Pointer to a variable that will receive the actual size of the descriptor. The variable is set to number of bytes actually in the descriptor if no errors are returned, or set to 0 if any errors are returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) This function should be used by drivers supporting a standard request's auto-reply, during the initialization process.


Definition at line 1000 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_add_string#

sl_status_t sl_usbd_core_add_string (const char * p_str)

Add string to USB device.

Parameters
N/Ap_str

Pointer to string to add (see Note #1).

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) USB spec 2.0 chapter 9.5 states: "Where appropriate, descriptors contain references to string descriptors that provide displayable information describing a descriptor in human-readable form. The inclusion of string descriptors is optional. However, the reference fields within descriptors are mandatory. If a device does not support string descriptors, string reference fields must be reset to zero to indicate no string descriptor is available". Since string descriptors are optional, 'p_str' could be a NULL pointer.


Definition at line 1022 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_string_index#

sl_status_t sl_usbd_core_get_string_index (const char * p_str, uint8_t * p_str_ix)

Get string index corresponding to a given string.

Parameters
N/Ap_str

Pointer to string.

N/Ap_str_ix

Pointer to variable where string index will be returned.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 1035 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_08b_to_descriptor_buf#

sl_status_t sl_usbd_core_write_08b_to_descriptor_buf (uint8_t val)

Write an 8-bit value to the descriptor buffer.

Parameters
N/Aval

8-bit value to write in the descriptor buffer.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) USB classes may use this function to append class-specific descriptors to the configuration descriptor.


Definition at line 1049 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_16b_to_descriptor_buf#

sl_status_t sl_usbd_core_write_16b_to_descriptor_buf (uint16_t val)

Write a 16-bit value in the descriptor buffer.

Parameters
N/Aval

16-bit value.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) USB classes may use this function to append class-specific descriptors to the configuration descriptor.

  • (2) USB descriptors are in little-endian format.


Definition at line 1063 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_24b_to_descriptor_buf#

sl_status_t sl_usbd_core_write_24b_to_descriptor_buf (uint32_t val)

Write a 24-bit value to the descriptor buffer.

Parameters
N/Aval

32-bit value containing 24 useful bits to write in the descriptor buffer.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) USB classes may use this function to append class-specific descriptors to the configuration descriptor.

  • (2) USB descriptors are in little-endian format.


Definition at line 1077 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_32b_to_descriptor_buf#

sl_status_t sl_usbd_core_write_32b_to_descriptor_buf (uint32_t val)

Write a 32-bit value to the descriptor buffer.

Parameters
N/Aval

32-bit value to write in the descriptor buffer.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) USB classes may use this function to append class-specific descriptors to the configuration descriptor.

  • (2) USB descriptors are in little-endian format.


Definition at line 1091 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_buf_to_descriptor_buf#

sl_status_t sl_usbd_core_write_buf_to_descriptor_buf (const uint8_t * p_buf, uint16_t len)

Write a buffer into the descriptor buffer.

Parameters
N/Ap_buf

Pointer to the buffer to write into the descriptor buffer.

N/Alen

Length of the buffer.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) USB classes may use this function to append class-specific descriptors to the configuration descriptor.


Definition at line 1105 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_control_sync#

sl_status_t sl_usbd_core_write_control_sync (void * p_buf, uint32_t buf_len, uint16_t timeout_ms, bool end, uint32_t * p_xfer_len)

Send data on the Control IN endpoint.

Parameters
N/Ap_buf

Pointer to the buffer of data that will be sent (see Note #2).

N/Abuf_len

Number of octets to transmit.

N/Atimeout_ms

Timeout in milliseconds.

N/Aend

End-of-transfer flag (see Note #1).

N/Ap_xfer_len

Pointer to a variable that will be set to the number of octets transmitted. The variable is set to the number of octets transmitted if no errors are returned, otherwise it is set to 0.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) If end-of-transfer is set and transfer length is multiple of maximum packet size, a zero-length packet is transferred to indicate a short transfer to the host.

  • (2) Transmit buffer must be 32 bits aligned.


Definition at line 1130 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_read_control_sync#

sl_status_t sl_usbd_core_read_control_sync (void * p_buf, uint32_t buf_len, uint16_t timeout_ms, uint32_t * p_xfer_len)

Receive data on the Control OUT endpoint.

Parameters
N/Ap_buf

Pointer to the destination buffer to receive data (see Note #1).

N/Abuf_len

Number of octets to receive.

N/Atimeout_ms

Timeout in milliseconds.

N/Ap_xfer_len

Pointer to a variable that will be set to the number of octets received. The variable is set to the number of octets received if no errors are returned, otherwise it is set to 0.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Receive buffer must be 32 bits aligned.


Definition at line 1153 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_add_bulk_endpoint#

sl_status_t sl_usbd_core_add_bulk_endpoint (uint8_t config_nbr, uint8_t if_nbr, uint8_t if_alt_nbr, bool dir_in, uint16_t max_pkt_len, uint8_t * p_ep_addr)

Add a bulk endpoint to alternate setting interface.

Parameters
N/Aconfig_nbr

Configuration number.

N/Aif_nbr

Interface number.

N/Aif_alt_nbr

Interface alternate setting number.

N/Adir_in

Endpoint direction.

  • true IN direction.

  • false OUT direction.

N/Amax_pkt_len

Endpoint maximum packet length (see Note #1)

N/Ap_ep_addr

Pointer to a variable that will receive the new endpoint address. The variable will be set to endpoint address if no errors are returned, otherwise it will be set to SL_USBD_ENDPOINT_ADDR_NONE.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) If the 'max_pkt_len' argument is '0', the stack will allocate the first available BULK endpoint, regardless its maximum packet size.


Definition at line 1182 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_read_bulk_sync#

sl_status_t sl_usbd_core_read_bulk_sync (uint8_t ep_addr, void * p_buf, uint32_t buf_len, uint16_t timeout_ms, uint32_t * p_xfer_len)

Receive data on Bulk OUT endpoint.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_buf

Pointer to the destination buffer to receive data (see Note #1).

N/Abuf_len

Number of octets to receive.

N/Atimeout_ms

Timeout in milliseconds.

N/Ap_xfer_len

Pointer to a variable that will be set to the number of octets received. The variable is set to the number of octets received if no errors are returned, otherwise it is set to 0.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Receive buffer must be 32 bits aligned.


Definition at line 1208 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_read_bulk_async#

sl_status_t sl_usbd_core_read_bulk_async (uint8_t ep_addr, void * p_buf, uint32_t buf_len, sl_usbd_async_function_t async_fnct, void * p_async_arg)

Receive data on Bulk OUT endpoint asynchronously.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_buf

Pointer to the destination buffer to receive data (see Note #1).

N/Abuf_len

Number of octets to receive.

N/Aasync_fnct

Function that will be invoked upon completion of receive operation.

N/Ap_async_arg

Pointer to the argument that will be passed as parameter of 'async_fnct'.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Receive buffer must be 32 bits aligned.


Definition at line 1231 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_bulk_sync#

sl_status_t sl_usbd_core_write_bulk_sync (uint8_t ep_addr, void * p_buf, uint32_t buf_len, uint16_t timeout_ms, bool end, uint32_t * p_xfer_len)

Send data on a Bulk IN endpoint.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_buf

Pointer to buffer of data that will be transmitted (see Note #2).

N/Abuf_len

Number of octets to transmit.

N/Atimeout_ms

Timeout in milliseconds.

N/Aend

End-of-transfer flag (see Note #3).

N/Ap_xfer_len

Pointer to a variable that will receive the number of octets transmitted. The variable is set to the number of octets transmitted if no errors are returned, otherwise it is set to 0.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) This function SHOULD NOT be called from interrupt service routine (ISR).

  • (2) Transmit buffer must be 32 bits aligned.

  • (3) If end-of-transfer is set and transfer length is multiple of maximum packet sizes, a zero-length packet is transferred to indicate a short transfer to the host.


Definition at line 1263 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_bulk_async#

sl_status_t sl_usbd_core_write_bulk_async (uint8_t ep_addr, void * p_buf, uint32_t buf_len, sl_usbd_async_function_t async_fnct, void * p_async_arg, bool end)

Send data on the Bulk IN endpoint asynchronously.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_buf

Pointer to the buffer of data that will be transmitted (see Note #1).

N/Abuf_len

Number of octets to transmit.

N/Aasync_fnct

Function that will be invoked upon completion of transmit operation.

N/Ap_async_arg

Pointer to the argument that will be passed as parameter of 'async_fnct'.

N/Aend

End-of-transfer flag (see Note #2).

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Transmit buffer must be 32 bits aligned.

  • (2) If end-of-transfer is set and transfer length is multiple of maximum packet size, a zero-length packet is transferred to indicate a short transfer to the host.


Definition at line 1292 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_add_interrupt_endpoint#

sl_status_t sl_usbd_core_add_interrupt_endpoint (uint8_t config_nbr, uint8_t if_nbr, uint8_t if_alt_nbr, bool dir_in, uint16_t max_pkt_len, uint16_t interval, uint8_t * p_ep_addr)

Add an interrupt endpoint to an alternate setting interface.

Parameters
N/Aconfig_nbr

Configuration number.

N/Aif_nbr

Interface number.

N/Aif_alt_nbr

Interface alternate setting number.

N/Adir_in

Endpoint Direction.

  • true IN direction.

  • false OUT direction.

N/Amax_pkt_len

Endpoint maximum packet length. (see Note #1)

N/Ainterval

Endpoint interval in frames or microframes.

N/Ap_ep_addr

Pointer to a variable that will receive the new endpoint address. The variable will be set to endpoint address if no errors are returned, otherwise it will be set to SL_USBD_ENDPOINT_ADDR_NONE.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) If the 'max_pkt_len' argument is '0', the stack will allocate the first available INTERRUPT endpoint, regardless its maximum packet size.


Definition at line 1325 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_read_interrupt_sync#

sl_status_t sl_usbd_core_read_interrupt_sync (uint8_t ep_addr, void * p_buf, uint32_t buf_len, uint16_t timeout_ms, uint32_t * p_xfer_len)

Receive data on the Interrupt OUT endpoint.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_buf

Pointer to the destination buffer to receive data (see Note #2).

N/Abuf_len

Number of octets to receive.

N/Atimeout_ms

Timeout in milliseconds.

N/Ap_xfer_len

Pointer to a variable that will be set to the number of octets received. The variable is set to the number of octets received if no errors are returned, otherwise it is set to 0.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) This function SHOULD NOT be called from interrupt service routine (ISR).

  • (2) Receive buffer must be 32 bits aligned.


Definition at line 1354 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_read_interrupt_async#

sl_status_t sl_usbd_core_read_interrupt_async (uint8_t ep_addr, void * p_buf, uint32_t buf_len, sl_usbd_async_function_t async_fnct, void * p_async_arg)

Receive data on Interrupt OUT endpoint asynchronously.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_buf

Pointer to the destination buffer to receive data (see Note #1).

N/Abuf_len

Number of octets to receive.

N/Aasync_fnct

Function that will be invoked upon completion of receive operation.

N/Ap_async_arg

Pointer to argument that will be passed as parameter of 'async_fnct'.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Receive buffer must be 32 bits aligned.


Definition at line 1377 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_interrupt_sync#

sl_status_t sl_usbd_core_write_interrupt_sync (uint8_t ep_addr, void * p_buf, uint32_t buf_len, uint16_t timeout_ms, bool end, uint32_t * p_xfer_len)

Send data on Interrupt IN endpoint.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_buf

Pointer to the buffer of data that will be transmitted (see Note #2).

N/Abuf_len

Number of octets to transmit.

N/Atimeout_ms

Timeout in milliseconds.

N/Aend

End-of-transfer flag (see Note #3).

N/Ap_xfer_len

Pointer to a variable that will be set to the number of octets transmitted. The variable is set to the number of octets transmitted if no errors are returned, otherwise it is set to 0.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) This function SHOULD NOT be called from interrupt service routine (ISR).

  • (2) Transmit buffer must be 32 bits aligned.

  • (3) If end-of-transfer is set and transfer length is multiple of maximum packet size, a zero-length packet is transferred to indicate a short transfer to the host.


Definition at line 1409 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_write_interrupt_async#

sl_status_t sl_usbd_core_write_interrupt_async (uint8_t ep_addr, void * p_buf, uint32_t buf_len, sl_usbd_async_function_t async_fnct, void * p_async_arg, bool end)

Send data on the Interrupt IN endpoint asynchronously.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_buf

Pointer to the buffer of data that will be transmitted (see Note #1).

N/Abuf_len

Number of octets to transmit.

N/Aasync_fnct

Function that will be invoked upon completion of transmit operation.

N/Ap_async_arg

Pointer to the argument that will be passed as parameter of 'async_fnct'.

N/Aend

End-of-transfer flag (see Note #2).

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Transmit buffer must be 32 bits aligned.

  • (2) If end-of-transfer is set and transfer length is multiple of maximum packet size, a zero-length packet is transferred to indicate a short transfer to the host.


Definition at line 1438 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_endpoint_write_zlp#

sl_status_t sl_usbd_core_endpoint_write_zlp (uint8_t ep_addr, uint16_t timeout_ms, if_alt_nbr, dir_in, attrib, max_pkt_len, transaction_frame, interval, p_ep_addr)

Add an isochronous endpoint to alternate setting interface.

Parameters
N/Aep_addr

Endpoint address.

N/Atimeout_ms

Timeout in milliseconds.

N/Aif_alt_nbr

Interface alternate setting number.

N/Adir_in

Data endpoint address.

N/Aattrib

Associated synchronization endpoint.

N/Amax_pkt_len

Endpoint maximum packet length (see Note #1).

N/Atransaction_frame

Endpoint transactions per (micro)frame (see Note #2).

N/Ainterval

Endpoint interval in frames or microframes.

N/Ap_ep_addr

Pointer to a variable that will receive the new endpoint address. The variable will be set to endpoint address if no errors are returned, otherwise it will be set to SL_USBD_ENDPOINT_ADDR_NONE.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) If the 'max_pkt_len' argument is '0', the stack allocates the first available ISOCHRONOUS endpoint regardless of its maximum packet size.

  • (2) For full-speed endpoints, 'transaction_frame' must be set to 1 since there is no support for high-bandwidth endpoints.

  • (3) For full-/high-speed isochronous endpoints, bInterval value must be in the range from 1 to 16. The bInterval value is used as the exponent for a 2^(bInterval-1) value. Maximum polling interval value is 2^(16-1) = 32768 frames in full-speed and 32768 microframes (i.e., 4096 frames) in high-speed.

Receive data on an isochronous OUT endpoint asynchronously.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Receive buffer must be 32 bits aligned.

Send data on an isochronous IN endpoint asynchronously.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Transmit buffer must be 32 bits aligned.

Set synchronization feedback rate on synchronization isochronous endpoint.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Synchronization endpoints can ONLY be associated when the device is in the following states:

    • SL_USBD_DEVICE_STATE_NONE Device controller has not been initialized.

    • SL_USBD_DEVICE_STATE_INIT Device controller is already initialized.

  • (2) For audio class 1.0, the interface class code must be SL_USBD_CLASS_CODE_AUDIO and protocol 'zero'

  • (3) If explicit synchronization mechanism is needed to maintain synchronization during transfers, the information carried over the synchronization path must be available every 2 ^ (10 - P) frames, with P ranging from 1 to 9 (512 ms down to 2 ms).

  • (4) Table 4-22 "Standard AS Isochronous Synch Endpoint Descriptor" of Audio 1.0 specification indicates for bmAttributes field no usage type for bits 5..4. But USB 2.0 specification, Table 9-13 "Standard Endpoint Descriptor" indicates several types of usage. When an explicit feedback is defined for a asynchronous isochronous endpoint, the associated synch feedback should use the Usage type 'Feedback endpoint'.

Associate synchronization endpoint to isochronous endpoint.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) Synchronization endpoints can ONLY be associated when the device is in the following states:

    • SL_USBD_DEVICE_STATE_NONE Device controller has not been initialized.

    • SL_USBD_DEVICE_STATE_INIT Device controller is already initialized.

  • (2) For audio class 1.0, interface class code must be SL_USBD_CLASS_CODE_AUDIO and protocol 'zero'.

Send zero-length packet to the host.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) This function should only be called during a synchronous transfer.


Definition at line 1630 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_endpoint_read_zlp#

sl_status_t sl_usbd_core_endpoint_read_zlp (uint8_t ep_addr, uint16_t timeout_ms)

Receive zero-length packet from the host.

Parameters
N/Aep_addr

Endpoint address.

N/Atimeout_ms

Timeout in milliseconds.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note

  • (1) This function should only be called during a synchronous transfer.


Definition at line 1644 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_abort_endpoint#

sl_status_t sl_usbd_core_abort_endpoint (uint8_t ep_addr)

Abort I/O transfer on the endpoint.

Parameters
N/Aep_addr

Endpoint address.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 1654 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_endpoint_read_complete#

sl_status_t sl_usbd_core_endpoint_read_complete (uint8_t ep_log_nbr)

Notify USB stack that packet receive has completed.

Parameters
N/Aep_log_nbr

Endpoint logical number.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 1663 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_endpoint_write_complete#

sl_status_t sl_usbd_core_endpoint_write_complete (uint8_t ep_log_nbr)

Notify USB stack that packet transmit has completed.

Parameters
N/Aep_log_nbr

Endpoint logical number.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 1672 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_endpoint_write_complete_extended#

sl_status_t sl_usbd_core_endpoint_write_complete_extended (uint8_t ep_log_nbr, sl_status_t xfer_err)

Notify USB stack that packet transmit has completed (see Note #1).

Parameters
N/Aep_log_nbr

Endpoint logical number.

N/Axfer_err

Error code returned by the USB driver.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.

Note


Definition at line 1686 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_stall_endpoint#

sl_status_t sl_usbd_core_stall_endpoint (uint8_t ep_addr, bool state)

Stall the non-control endpoint.

Parameters
N/Aep_addr

Endpoint address.

N/Astate

Endpoint stall state.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 1698 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_is_endpoint_stalled#

sl_status_t sl_usbd_core_is_endpoint_stalled (uint8_t ep_addr, bool * p_ep_stall)

Get the stall status of a non-control endpoint.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_ep_stall

Pointer to a boolean that will receive the endpoint stalled status. The boolean variable is set to true if endpoint is stalled, or is set to false if endpoint is not stalled.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 1712 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_max_endpoint_packet_size#

sl_status_t sl_usbd_core_get_max_endpoint_packet_size (uint8_t ep_addr, uint16_t * p_max_size)

Retrieve the endpoint maximum packet size.

Parameters
N/Aep_addr

Endpoint address.

N/Ap_max_size

Pointer to a variable that will receive the maximum packet size upon return. The variable is set to the maximum packet size if no errors are returned, otherwise it is set to 0.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 1726 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_max_phy_endpoint_number#

sl_status_t sl_usbd_core_get_max_phy_endpoint_number (uint8_t * p_ep_phy_nbr)

Get the maximum physical endpoint number.

Parameters
N/Ap_ep_phy_nbr

Pointer to variable where maximum physical endpoint number will be returned. If no errors are returned, the variable will be set to maximum physical endpoint number, otherwise it will be set to SL_USBD_ENDPOINT_PHY_NONE.

Returns

  • Returns SL_STATUS_OK on success or another SL_STATUS code on failure.


Definition at line 1738 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_core_get_max_open_endpoint_number#

sl_status_t sl_usbd_core_get_max_open_endpoint_number (uint8_t * p_nbr_open)
Parameters
N/Ap_nbr_open

Definition at line 1740 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_on_bus_event#

__WEAK void sl_usbd_on_bus_event (sl_usbd_bus_event_t event)
Parameters
N/Aevent

Definition at line 1743 of file protocol/usb/inc/sl_usbd_core.h

sl_usbd_on_config_event#

__WEAK void sl_usbd_on_config_event (sl_usbd_config_event_t event, uint8_t config_nbr)
Parameters
N/Aevent
N/Aconfig_nbr

Definition at line 1745 of file protocol/usb/inc/sl_usbd_core.h

Macro Definition Documentation#

SL_USBD_FRAME_NBR_MAX#

#define SL_USBD_FRAME_NBR_MAX
Value:
2047u

MODULE.

INCLUDE FILES MACROS

                                              FRAME

Note(s) : (1) Section 8.3.3 of USB spec 2.0 describes the frame number as: "The frame number field is an 11-bit field that is incremented by the host on a per-frame basis. The frame number field rolls over upon reaching its maximum value of 7FFH and is sent only in SOF tokens at the start of each (micro)frame."


Definition at line 72 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_FRAME_NBR_MASK#

#define SL_USBD_FRAME_NBR_MASK
Value:
0b0000011111111111

Definition at line 73 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROFRAME_NBR_MASK#

#define SL_USBD_MICROFRAME_NBR_MASK
Value:
0b0011100000000000

Definition at line 74 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DEV_ATTRIB_SELF_POWERED#

#define SL_USBD_DEV_ATTRIB_SELF_POWERED
Value:
0x01u

CONFIGURATION ATTRIBUTES.


Definition at line 80 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DEV_ATTRIB_REMOTE_WAKEUP#

#define SL_USBD_DEV_ATTRIB_REMOTE_WAKEUP
Value:
0x02u

Definition at line 81 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_DEV#

#define SL_USBD_DESC_LEN_DEV
Value:
18u

DEVICE DESCRIPTOR LENGTH.


Definition at line 87 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_DEV_QUAL#

#define SL_USBD_DESC_LEN_DEV_QUAL
Value:
10u

Definition at line 88 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_HDR#

#define SL_USBD_DESC_LEN_HDR
Value:
2u

Definition at line 89 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_CFG#

#define SL_USBD_DESC_LEN_CFG
Value:
9u

Definition at line 90 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_OTHER_SPD_CFG#

#define SL_USBD_DESC_LEN_OTHER_SPD_CFG
Value:
9u

Definition at line 91 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_IF#

#define SL_USBD_DESC_LEN_IF
Value:
9u

Definition at line 92 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_IF_ASSOCIATION#

#define SL_USBD_DESC_LEN_IF_ASSOCIATION
Value:
8u

Definition at line 93 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_EP#

#define SL_USBD_DESC_LEN_EP
Value:
7u

Definition at line 94 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_LEN_OTG#

#define SL_USBD_DESC_LEN_OTG
Value:
3u

Definition at line 95 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_DIR_MASK#

#define SL_USBD_REQ_DIR_MASK
Value:
0x80u
                                  REQUEST CHARACTERISTICS

Note(s) : (1) Request types are defined in USB spec 2.0, section 9.3, Table 9-2, 'RequestType' field.


Definition at line 103 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_DIR_HOST_TO_DEVICE#

#define SL_USBD_REQ_DIR_HOST_TO_DEVICE
Value:
0x00u

Definition at line 104 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_DIR_DEVICE_TO_HOST#

#define SL_USBD_REQ_DIR_DEVICE_TO_HOST
Value:
0x80u

Definition at line 105 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_DIR_BIT#

#define SL_USBD_REQ_DIR_BIT
Value:
0x80u

Definition at line 106 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_TYPE_MASK#

#define SL_USBD_REQ_TYPE_MASK
Value:
0x60u

Definition at line 108 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_TYPE_STANDARD#

#define SL_USBD_REQ_TYPE_STANDARD
Value:
0x00u

Definition at line 109 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_TYPE_CLASS#

#define SL_USBD_REQ_TYPE_CLASS
Value:
0x20u

Definition at line 110 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_TYPE_VENDOR#

#define SL_USBD_REQ_TYPE_VENDOR
Value:
0x40u

Definition at line 111 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_TYPE_RESERVED#

#define SL_USBD_REQ_TYPE_RESERVED
Value:
0x60u

Definition at line 112 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_RECIPIENT_MASK#

#define SL_USBD_REQ_RECIPIENT_MASK
Value:
0x1Fu

Definition at line 114 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_RECIPIENT_DEVICE#

#define SL_USBD_REQ_RECIPIENT_DEVICE
Value:
0x00u

Definition at line 115 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_RECIPIENT_INTERFACE#

#define SL_USBD_REQ_RECIPIENT_INTERFACE
Value:
0x01u

Definition at line 116 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_RECIPIENT_ENDPOINT#

#define SL_USBD_REQ_RECIPIENT_ENDPOINT
Value:
0x02u

Definition at line 117 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_RECIPIENT_OTHER#

#define SL_USBD_REQ_RECIPIENT_OTHER
Value:
0x03u

Definition at line 118 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_GET_STATUS#

#define SL_USBD_REQ_GET_STATUS
Value:
0u
                                      STANDARD REQUESTS

Note(s) : (1) Request types are defined in USB spec 2.0, section 9.4, Table 9-4, 'RequestType' field.


Definition at line 126 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_CLEAR_FEATURE#

#define SL_USBD_REQ_CLEAR_FEATURE
Value:
1u

Definition at line 127 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_SET_FEATURE#

#define SL_USBD_REQ_SET_FEATURE
Value:
3u

Definition at line 128 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_SET_ADDRESS#

#define SL_USBD_REQ_SET_ADDRESS
Value:
5u

Definition at line 129 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_GET_DESCRIPTOR#

#define SL_USBD_REQ_GET_DESCRIPTOR
Value:
6u

Definition at line 130 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_SET_DESCRIPTOR#

#define SL_USBD_REQ_SET_DESCRIPTOR
Value:
7u

Definition at line 131 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_GET_CONFIGURATION#

#define SL_USBD_REQ_GET_CONFIGURATION
Value:
8u

Definition at line 132 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_SET_CONFIGURATION#

#define SL_USBD_REQ_SET_CONFIGURATION
Value:
9u

Definition at line 133 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_GET_INTERFACE#

#define SL_USBD_REQ_GET_INTERFACE
Value:
10u

Definition at line 134 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_SET_INTERFACE#

#define SL_USBD_REQ_SET_INTERFACE
Value:
11u

Definition at line 135 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_REQ_SYNCH_FRAME#

#define SL_USBD_REQ_SYNCH_FRAME
Value:
12u

Definition at line 136 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_DEVICE#

#define SL_USBD_DESC_TYPE_DEVICE
Value:
1u
                                      DESCRIPTOR TYPES

Note(s) : (1) Descriptors types are defined in the USB spec 2.0 section 9.2.6, Table 9-5.


Definition at line 144 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_CONFIGURATION#

#define SL_USBD_DESC_TYPE_CONFIGURATION
Value:
2u

Definition at line 145 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_STRING#

#define SL_USBD_DESC_TYPE_STRING
Value:
3u

Definition at line 146 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_INTERFACE#

#define SL_USBD_DESC_TYPE_INTERFACE
Value:
4u

Definition at line 147 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_ENDPOINT#

#define SL_USBD_DESC_TYPE_ENDPOINT
Value:
5u

Definition at line 148 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_DEVICE_QUALIFIER#

#define SL_USBD_DESC_TYPE_DEVICE_QUALIFIER
Value:
6u

Definition at line 149 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_OTHER_SPEED_CONFIGURATION#

#define SL_USBD_DESC_TYPE_OTHER_SPEED_CONFIGURATION
Value:
7u

Definition at line 150 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_INTERFACE_POWER#

#define SL_USBD_DESC_TYPE_INTERFACE_POWER
Value:
8u

Definition at line 151 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_OTG#

#define SL_USBD_DESC_TYPE_OTG
Value:
9u

Definition at line 152 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_DESC_TYPE_IAD#

#define SL_USBD_DESC_TYPE_IAD
Value:
11u

Definition at line 153 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_ARABIC_SAUDI_ARABIA#

#define SL_USBD_LANG_ID_ARABIC_SAUDI_ARABIA
Value:
0x0401u
                                      LANGUAGE IDENTIFIERS

Note(s) : (1) Languages identifier are defined in "http://www.usb.org/developers/docs/USB_LANGIDs.pdf".


Definition at line 161 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_CHINESE_TAIWAN#

#define SL_USBD_LANG_ID_CHINESE_TAIWAN
Value:
0x0404u

Definition at line 162 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_ENGLISH_US#

#define SL_USBD_LANG_ID_ENGLISH_US
Value:
0x0409u

Definition at line 163 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_ENGLISH_UK#

#define SL_USBD_LANG_ID_ENGLISH_UK
Value:
0x0809u

Definition at line 164 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_FRENCH#

#define SL_USBD_LANG_ID_FRENCH
Value:
0x040Cu

Definition at line 165 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_GERMAN#

#define SL_USBD_LANG_ID_GERMAN
Value:
0x0407u

Definition at line 166 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_GREEK#

#define SL_USBD_LANG_ID_GREEK
Value:
0x0408u

Definition at line 167 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_ITALIAN#

#define SL_USBD_LANG_ID_ITALIAN
Value:
0x0410u

Definition at line 168 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_PORTUGUESE#

#define SL_USBD_LANG_ID_PORTUGUESE
Value:
0x0816u

Definition at line 169 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_LANG_ID_SANSKRIT#

#define SL_USBD_LANG_ID_SANSKRIT
Value:
0x044Fu

Definition at line 170 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_USE_IF_DESC#

#define SL_USBD_CLASS_CODE_USE_IF_DESC
Value:
0x00u
                                          CLASS CODES

Note(s) : (1) Class codes are defined in "http://www.usb.org/developers/defined_class".

      (2) Class code information can be placed in the Device descriptor or in the Interface
          descriptor. Some defined class code are allowed to be used only in the Device
          descriptor, others can used in both Device and Interface descriptors and come can
          only be used in Interface Descriptors.

      (3) Subclass & protocol codes are defined in the relevant class drivers.

Definition at line 185 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_AUDIO#

#define SL_USBD_CLASS_CODE_AUDIO
Value:
0x01u

Definition at line 186 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_CDC_CONTROL#

#define SL_USBD_CLASS_CODE_CDC_CONTROL
Value:
0x02u

Definition at line 187 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_HID#

#define SL_USBD_CLASS_CODE_HID
Value:
0x03u

Definition at line 188 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_PHYSICAL#

#define SL_USBD_CLASS_CODE_PHYSICAL
Value:
0x05u

Definition at line 189 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_IMAGE#

#define SL_USBD_CLASS_CODE_IMAGE
Value:
0x06u

Definition at line 190 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_PRINTER#

#define SL_USBD_CLASS_CODE_PRINTER
Value:
0x07u

Definition at line 191 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_MASS_STORAGE#

#define SL_USBD_CLASS_CODE_MASS_STORAGE
Value:
0x08u

Definition at line 192 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_HUB#

#define SL_USBD_CLASS_CODE_HUB
Value:
0x09u

Definition at line 193 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_CDC_DATA#

#define SL_USBD_CLASS_CODE_CDC_DATA
Value:
0x0Au

Definition at line 194 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_SMART_CARD#

#define SL_USBD_CLASS_CODE_SMART_CARD
Value:
0x0Bu

Definition at line 195 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_CONTENT_SECURITY#

#define SL_USBD_CLASS_CODE_CONTENT_SECURITY
Value:
0x0Du

Definition at line 196 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_VIDEO#

#define SL_USBD_CLASS_CODE_VIDEO
Value:
0x0Eu

Definition at line 197 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_PERSONAL_HEALTHCARE#

#define SL_USBD_CLASS_CODE_PERSONAL_HEALTHCARE
Value:
0x0Fu

Definition at line 198 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_DIAGNOSTIC_DEVICE#

#define SL_USBD_CLASS_CODE_DIAGNOSTIC_DEVICE
Value:
0xDCu

Definition at line 199 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_WIRELESS_CONTROLLER#

#define SL_USBD_CLASS_CODE_WIRELESS_CONTROLLER
Value:
0xE0u

Definition at line 200 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_MISCELLANEOUS#

#define SL_USBD_CLASS_CODE_MISCELLANEOUS
Value:
0xEFu

Definition at line 201 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_APPLICATION_SPECIFIC#

#define SL_USBD_CLASS_CODE_APPLICATION_SPECIFIC
Value:
0xFEu

Definition at line 202 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_CODE_VENDOR_SPECIFIC#

#define SL_USBD_CLASS_CODE_VENDOR_SPECIFIC
Value:
0xFFu

Definition at line 203 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_SUBCLASS_CODE_USE_IF_DESC#

#define SL_USBD_SUBCLASS_CODE_USE_IF_DESC
Value:
0x00u

SUB-CLASS CODES.


Definition at line 209 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_SUBCLASS_CODE_USE_COMMON_CLASS#

#define SL_USBD_SUBCLASS_CODE_USE_COMMON_CLASS
Value:
0x02u

Definition at line 210 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_SUBCLASS_CODE_VENDOR_SPECIFIC#

#define SL_USBD_SUBCLASS_CODE_VENDOR_SPECIFIC
Value:
0xFFu

Definition at line 211 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_PROTOCOL_CODE_USE_IF_DESC#

#define SL_USBD_PROTOCOL_CODE_USE_IF_DESC
Value:
0x00u

PROTOCOL CODES.


Definition at line 217 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_PROTOCOL_CODE_USE_IAD#

#define SL_USBD_PROTOCOL_CODE_USE_IAD
Value:
0x01u

Definition at line 218 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_PROTOCOL_CODE_VENDOR_SPECIFIC#

#define SL_USBD_PROTOCOL_CODE_VENDOR_SPECIFIC
Value:
0xFFu

Definition at line 219 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_FEATURE_SEL_ENDPOINT_HALT#

#define SL_USBD_FEATURE_SEL_ENDPOINT_HALT
Value:
0u

FEATURE SELECTORS.


Definition at line 225 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_FEATURE_SEL_DEVICE_REMOTE_WAKEUP#

#define SL_USBD_FEATURE_SEL_DEVICE_REMOTE_WAKEUP
Value:
1u

Definition at line 226 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_FEATURE_SEL_TEST_MODE#

#define SL_USBD_FEATURE_SEL_TEST_MODE
Value:
2u

Definition at line 227 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MAX_BUS_PWR_LIMIT_mA#

#define SL_USBD_MAX_BUS_PWR_LIMIT_mA
Value:
500u

DEVICE POWER CONSTRAINS.


Definition at line 233 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_MASK#

#define SL_USBD_ENDPOINT_TYPE_MASK
Value:
0x03u

ENDPOINT TYPE.

Note(s) : (1) Endpoint types are defined in the USB spec 2.0 section 9.6.6, Table 9-13, 'bmAttributes' field.


Definition at line 242 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_CTRL#

#define SL_USBD_ENDPOINT_TYPE_CTRL
Value:
0x00u

Definition at line 243 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_ISOC#

#define SL_USBD_ENDPOINT_TYPE_ISOC
Value:
0x01u

Definition at line 244 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_BULK#

#define SL_USBD_ENDPOINT_TYPE_BULK
Value:
0x02u

Definition at line 245 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_INTR#

#define SL_USBD_ENDPOINT_TYPE_INTR
Value:
0x03u

Definition at line 246 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_SYNC_MASK#

#define SL_USBD_ENDPOINT_TYPE_SYNC_MASK
Value:
0x0Cu

Definition at line 248 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_SYNC_NONE#

#define SL_USBD_ENDPOINT_TYPE_SYNC_NONE
Value:
0x00u

Definition at line 249 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_SYNC_ASYNC#

#define SL_USBD_ENDPOINT_TYPE_SYNC_ASYNC
Value:
0x04u

Definition at line 250 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_SYNC_ADAPTIVE#

#define SL_USBD_ENDPOINT_TYPE_SYNC_ADAPTIVE
Value:
0x08u

Definition at line 251 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_SYNC_SYNC#

#define SL_USBD_ENDPOINT_TYPE_SYNC_SYNC
Value:
0x0Cu

Definition at line 252 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_USAGE_MASK#

#define SL_USBD_ENDPOINT_TYPE_USAGE_MASK
Value:
0x30u

Definition at line 254 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_USAGE_DATA#

#define SL_USBD_ENDPOINT_TYPE_USAGE_DATA
Value:
0x00u

Definition at line 255 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_USAGE_FEEDBACK#

#define SL_USBD_ENDPOINT_TYPE_USAGE_FEEDBACK
Value:
0x10u

Definition at line 256 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TYPE_USAGE_IMPLICIT_FEEDBACK#

#define SL_USBD_ENDPOINT_TYPE_USAGE_IMPLICIT_FEEDBACK
Value:
0x20u

Definition at line 257 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_NBR_MASK#

#define SL_USBD_ENDPOINT_NBR_MASK
Value:
0x0Fu

ENDPOINT ADDRESS.

Note(s) : (1) Endpoint address is defined in the USB spec 2.0, section 9.6.6, Table 9-13, 'bEndpointAddress' field.


Definition at line 266 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_MAX_NBR#

#define SL_USBD_ENDPOINT_MAX_NBR
Value:
32u

Definition at line 267 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_DIR_MASK#

#define SL_USBD_ENDPOINT_DIR_MASK
Value:
0x80u

Definition at line 269 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_DIR_BIT#

#define SL_USBD_ENDPOINT_DIR_BIT
Value:
0x80u

Definition at line 270 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_DIR_OUT#

#define SL_USBD_ENDPOINT_DIR_OUT
Value:
0x00u

Definition at line 271 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_DIR_IN#

#define SL_USBD_ENDPOINT_DIR_IN
Value:
0x80u

Definition at line 272 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TRANSACTION_PER_UFRAME_1#

#define SL_USBD_ENDPOINT_TRANSACTION_PER_UFRAME_1
Value:
1u

Definition at line 274 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TRANSACTION_PER_UFRAME_2#

#define SL_USBD_ENDPOINT_TRANSACTION_PER_UFRAME_2
Value:
2u

Definition at line 275 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_TRANSACTION_PER_UFRAME_3#

#define SL_USBD_ENDPOINT_TRANSACTION_PER_UFRAME_3
Value:
3u

Definition at line 276 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_MAX_INTERVAL_VAL#

#define SL_USBD_ENDPOINT_MAX_INTERVAL_VAL
Value:
32768u

Definition at line 278 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_COMPAT_ID_NULL#

#define SL_USBD_MICROSOFT_COMPAT_ID_NULL
Value:
0u

MICROSOFT OS DESCRIPTOR DEFINES.

Note(s) : (1) For more information on Microsoft OS descriptors, see 'http://msdn.microsoft.com/en-us/library/windows/hardware/gg463179.aspx'.


Definition at line 288 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_COMPAT_ID_RNDIS#

#define SL_USBD_MICROSOFT_COMPAT_ID_RNDIS
Value:
1u

Definition at line 289 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_COMPAT_ID_PTP#

#define SL_USBD_MICROSOFT_COMPAT_ID_PTP
Value:
2u

Definition at line 290 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_COMPAT_ID_MTP#

#define SL_USBD_MICROSOFT_COMPAT_ID_MTP
Value:
3u

Definition at line 291 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_COMPAT_ID_XUSB20#

#define SL_USBD_MICROSOFT_COMPAT_ID_XUSB20
Value:
4u

Definition at line 292 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_COMPAT_ID_BLUETOOTH#

#define SL_USBD_MICROSOFT_COMPAT_ID_BLUETOOTH
Value:
5u

Definition at line 293 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_COMPAT_ID_WINUSB#

#define SL_USBD_MICROSOFT_COMPAT_ID_WINUSB
Value:
6u

Definition at line 294 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_COMPAT_ID_NONE#

#define SL_USBD_MICROSOFT_COMPAT_ID_NONE
Value:
255u

Definition at line 295 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_SUBCOMPAT_ID_NULL#

#define SL_USBD_MICROSOFT_SUBCOMPAT_ID_NULL
Value:
0u

Definition at line 298 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_SUBCOMPAT_ID_BLUETOOTH_1_1#

#define SL_USBD_MICROSOFT_SUBCOMPAT_ID_BLUETOOTH_1_1
Value:
1u

Definition at line 299 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_SUBCOMPAT_ID_BLUETOOTH_1_2#

#define SL_USBD_MICROSOFT_SUBCOMPAT_ID_BLUETOOTH_1_2
Value:
2u

Definition at line 300 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_SUBCOMPAT_ID_BLUETOOTH_EDR#

#define SL_USBD_MICROSOFT_SUBCOMPAT_ID_BLUETOOTH_EDR
Value:
3u

Definition at line 301 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_SZ#

#define SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_SZ
Value:
1u

Definition at line 304 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_EXPAND_SZ#

#define SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_EXPAND_SZ
Value:
2u

Definition at line 305 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_BINARY#

#define SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_BINARY
Value:
3u

Definition at line 306 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_DWORD_LITTLE_ENDIAN#

#define SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_DWORD_LITTLE_ENDIAN
Value:
4u

Definition at line 307 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_DWORD_BIG_ENDIAN#

#define SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_DWORD_BIG_ENDIAN
Value:
5u

Definition at line 308 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_LINK#

#define SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_LINK
Value:
6u

Definition at line 309 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_MULTI_SZ#

#define SL_USBD_MICROSOFT_PROPERTY_TYPE_REG_MULTI_SZ
Value:
7u

Definition at line 310 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_INFO_TYPE_CTRL#

#define SL_USBD_ENDPOINT_INFO_TYPE_CTRL
Value:
0x01u

USB EP INFORMATION TABLE DEFINES.


Definition at line 317 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_INFO_TYPE_ISOC#

#define SL_USBD_ENDPOINT_INFO_TYPE_ISOC
Value:
0x02u

Definition at line 318 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_INFO_TYPE_BULK#

#define SL_USBD_ENDPOINT_INFO_TYPE_BULK
Value:
0x04u

Definition at line 319 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_INFO_TYPE_INTR#

#define SL_USBD_ENDPOINT_INFO_TYPE_INTR
Value:
0x08u

Definition at line 320 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_INFO_DIR_OUT#

#define SL_USBD_ENDPOINT_INFO_DIR_OUT
Value:
0x10u

Definition at line 323 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_INFO_DIR_IN#

#define SL_USBD_ENDPOINT_INFO_DIR_IN
Value:
0x20u

Definition at line 324 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CONFIG_NBR_NONE#

#define SL_USBD_CONFIG_NBR_NONE
Value:
255u

USB OBJECT NUMBER.


Definition at line 330 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CONFIG_NBR_SPD_BIT#

#define SL_USBD_CONFIG_NBR_SPD_BIT
Value:
0x80u

Definition at line 331 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_INTERFACE_NBR_NONE#

#define SL_USBD_INTERFACE_NBR_NONE
Value:
255u

Definition at line 333 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ALT_INTERFACE_NBR_NONE#

#define SL_USBD_ALT_INTERFACE_NBR_NONE
Value:
255u

Definition at line 335 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_INTERFACE_GROUP_NBR_NONE#

#define SL_USBD_INTERFACE_GROUP_NBR_NONE
Value:
255u

Definition at line 337 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_ADDR_NONE#

#define SL_USBD_ENDPOINT_ADDR_NONE
Value:
255u

Definition at line 339 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_PHY_NONE#

#define SL_USBD_ENDPOINT_PHY_NONE
Value:
255u

Definition at line 340 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_NBR_NONE#

#define SL_USBD_ENDPOINT_NBR_NONE
Value:
255u

Definition at line 342 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CLASS_NBR_NONE#

#define SL_USBD_CLASS_NBR_NONE
Value:
255u

Definition at line 344 of file protocol/usb/inc/sl_usbd_core.h

USBD_CFG_STR_EN#

#define USBD_CFG_STR_EN
Value:
1

USB DEFAULT CONFIGS.


Definition at line 351 of file protocol/usb/inc/sl_usbd_core.h

USBD_CFG_MS_OS_DESC_EN#

#define USBD_CFG_MS_OS_DESC_EN
Value:
0

Definition at line 355 of file protocol/usb/inc/sl_usbd_core.h

USBD_CFG_URB_EXTRA_EN#

#define USBD_CFG_URB_EXTRA_EN
Value:
0

Definition at line 359 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_URB_MAX_NBR#

#define SL_USBD_URB_MAX_NBR
Value:
SL_USBD_OPEN_ENDPOINTS_QUANTITY

Definition at line 365 of file protocol/usb/inc/sl_usbd_core.h

USBD_CFG_HS_EN#

#define USBD_CFG_HS_EN
Value:
0

Definition at line 369 of file protocol/usb/inc/sl_usbd_core.h

USBD_CFG_EP_ISOC_EN#

#define USBD_CFG_EP_ISOC_EN
Value:
0

Definition at line 373 of file protocol/usb/inc/sl_usbd_core.h

USBD_CFG_OPTIMIZE_SPD#

#define USBD_CFG_OPTIMIZE_SPD
Value:
0

Definition at line 377 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CORE_EVENT_BUS_NBR#

#define SL_USBD_CORE_EVENT_BUS_NBR
Value:
7u

USB CORE EVENTS.

Note(s) : (1) There are 7 possible USB callback events:

              sli_usbd_core_reset_event(),
              sli_usbd_core_suspend_event(),
              sli_usbd_core_resume_event(),
              sli_usbd_core_connect_event(),
              sli_usbd_core_disconnect_event(),
              sli_usbd_core_high_speed_event().

Definition at line 393 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CORE_EVENT_BUS_NBR_TOTAL#

#define SL_USBD_CORE_EVENT_BUS_NBR_TOTAL
Value:
(SL_USBD_CORE_EVENT_BUS_NBR * SL_USBD_DEVICE_QUANTITY)

Definition at line 395 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CORE_EVENT_ASYNC_NBR#

#define SL_USBD_CORE_EVENT_ASYNC_NBR
Value:
((SL_USBD_OPEN_ENDPOINTS_QUANTITY * SL_USBD_DEVICE_QUANTITY) + SL_USBD_EXTRA_URB_QUANTITY)

Definition at line 396 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_CORE_EVENT_NBR_TOTAL#

#define SL_USBD_CORE_EVENT_NBR_TOTAL
Value:
(SL_USBD_CORE_EVENT_BUS_NBR_TOTAL + SL_USBD_CORE_EVENT_ASYNC_NBR)

Definition at line 397 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_FRAME_NBR_GET#

#define SL_USBD_FRAME_NBR_GET
Value:
(frame_nbr)

GLOBAL CONSTANTS.

MACROS FRAME MACROS

Note(s) : (1) This macro takes into account when the frame number rolls over upon reaching the maximum value of 2047.


Definition at line 614 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_MICROFRAME_NBR_GET#

#define SL_USBD_MICROFRAME_NBR_GET
Value:
(microframe_nbr)

Definition at line 616 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_FRAME_NBR_DIFF_GET#

#define SL_USBD_FRAME_NBR_DIFF_GET
Value:
(((frame_nbr2) >= (frame_nbr1)) \
? ((frame_nbr2) - (frame_nbr1)) \
: ((SL_USBD_FRAME_NBR_MAX + 1u + (frame_nbr2)) - (frame_nbr1)))

Definition at line 619 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_PHY_TO_ADDR#

#define SL_USBD_ENDPOINT_PHY_TO_ADDR
Value:
( ((ep_phy_nbr) / 2u) \
| (((ep_phy_nbr) % 2u) ? SL_USBD_ENDPOINT_DIR_BIT : 0x00u))

ENDPOINT CONVERSION MACROS.


Definition at line 627 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_ADDR_TO_PHY#

#define SL_USBD_ENDPOINT_ADDR_TO_PHY
Value:
((((ep_addr) & SL_USBD_ENDPOINT_NBR_MASK) * 2u) \
+ ((((ep_addr) & SL_USBD_ENDPOINT_DIR_MASK) != 0u) ? 1u : 0u))

Definition at line 630 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_ADDR_TO_LOG#

#define SL_USBD_ENDPOINT_ADDR_TO_LOG
Value:
(ep_addr)

Definition at line 633 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_PHY_TO_LOG#

#define SL_USBD_ENDPOINT_PHY_TO_LOG
Value:
(ep_phy_nbr)

Definition at line 635 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_LOG_TO_ADDR_IN#

#define SL_USBD_ENDPOINT_LOG_TO_ADDR_IN
Value:
(ep_log_nbr)

Definition at line 637 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_LOG_TO_ADDR_OUT#

#define SL_USBD_ENDPOINT_LOG_TO_ADDR_OUT
Value:
(ep_log_nbr)

Definition at line 639 of file protocol/usb/inc/sl_usbd_core.h

SL_USBD_ENDPOINT_IS_IN#

#define SL_USBD_ENDPOINT_IS_IN
Value:
(ep_addr)

Definition at line 641 of file protocol/usb/inc/sl_usbd_core.h