USB Device ACM API
Description
USB Device CDC ACM API.
Data Structures |
|
struct | sl_usbd_cdc_acm_line_coding_t |
line coding data type
|
|
struct | sl_usbd_cdc_acm_callbacks_t |
CDC ACM Callbacks.
|
Functions |
|
sl_status_t | sl_usbd_cdc_acm_init (void) |
Initialize the CDC ACM serial emulation subclass.
|
|
sl_status_t | sl_usbd_cdc_acm_create_instance (uint16_t line_state_interval, uint16_t call_mgmt_capabilities, sl_usbd_cdc_acm_callbacks_t *p_acm_callbacks, uint8_t *p_subclass_nbr) |
Add a new instance of the CDC ACM serial emulation subclass.
|
|
sl_status_t | sl_usbd_cdc_acm_add_to_configuration (uint8_t subclass_nbr, uint8_t config_nbr) |
Add a CDC ACM subclass class instance into USB device configuration.
|
|
sl_status_t | sl_usbd_cdc_acm_is_enabled (uint8_t subclass_nbr, bool *p_enabled) |
Get the CDC ACM serial emulation subclass enable state.
|
|
sl_status_t | sl_usbd_cdc_acm_read (uint8_t subclass_nbr, uint8_t *p_buf, uint32_t buf_len, uint16_t timeout, uint32_t *p_xfer_len) |
Receive data on the CDC ACM serial emulation subclass.
|
|
sl_status_t | sl_usbd_cdc_acm_write (uint8_t subclass_nbr, uint8_t *p_buf, uint32_t buf_len, uint16_t timeout, uint32_t *p_xfer_len) |
Send data on the CDC ACM serial emulation subclass.
|
|
sl_status_t | sl_usbd_cdc_acm_get_line_control_state (uint8_t subclass_nbr, uint8_t *p_line_ctrl) |
Return the state of control lines.
|
|
sl_status_t | sl_usbd_cdc_acm_get_line_coding (uint8_t subclass_nbr, sl_usbd_cdc_acm_line_coding_t *p_line_coding) |
Get the current state of the line coding.
|
|
sl_status_t | sl_usbd_cdc_acm_set_line_coding (uint8_t subclass_nbr, sl_usbd_cdc_acm_line_coding_t *p_line_coding) |
Set a new line coding.
|
|
sl_status_t | sl_usbd_cdc_acm_set_line_state_event (uint8_t subclass_nbr, uint8_t events) |
Set a line state event(s).
|
|
sl_status_t | sl_usbd_cdc_acm_clear_line_state_event (uint8_t subclass_nbr, uint8_t events) |
Clear a line state event(s).
|
Function Documentation
◆ sl_usbd_cdc_acm_init()
sl_status_t sl_usbd_cdc_acm_init | ( | void |
|
) |
Initialize the CDC ACM serial emulation subclass.
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_create_instance()
sl_status_t sl_usbd_cdc_acm_create_instance | ( | uint16_t |
line_state_interval,
|
uint16_t |
call_mgmt_capabilities,
|
||
sl_usbd_cdc_acm_callbacks_t * |
p_acm_callbacks,
|
||
uint8_t * |
p_subclass_nbr
|
||
) |
Add a new instance of the CDC ACM serial emulation subclass.
- Parameters
-
line_state_interval
Line state notification interval in milliseconds (value must be a power of 2). call_mgmt_capabilities
Call Management Capabilities bitmap. OR'ed of the following flags: - SL_USBD_CDC_ACM_CALL_MGMT_DEV Device handles call management itself.
- SL_USBD_CDC_ACM_CALL_MGMT_DATA_CCI_DCI Device can send/receive call management information over a Data Class interface.
p_acm_callbacks
Optional pointers to callback functions to be called on various events. p_subclass_nbr
Param to variable that will receive CDC ACM serial emulation subclass instance number.
- Returns
- Return SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_add_to_configuration()
sl_status_t sl_usbd_cdc_acm_add_to_configuration | ( | uint8_t |
subclass_nbr,
|
uint8_t |
config_nbr
|
||
) |
Add a CDC ACM subclass class instance into USB device configuration.
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. config_nbr
Configuration index to add new test class interface to.
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_is_enabled()
sl_status_t sl_usbd_cdc_acm_is_enabled | ( | uint8_t |
subclass_nbr,
|
bool * |
p_enabled
|
||
) |
Get the CDC ACM serial emulation subclass enable state.
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. p_enabled
Boolean to a variable that will receive enable status. The variable is set to true, CDC ACM serial emulation is enabled. The variable is set to false, CDC ACM serial emulation is not enabled.
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_read()
sl_status_t sl_usbd_cdc_acm_read | ( | uint8_t |
subclass_nbr,
|
uint8_t * |
p_buf,
|
||
uint32_t |
buf_len,
|
||
uint16_t |
timeout,
|
||
uint32_t * |
p_xfer_len
|
||
) |
Receive data on the CDC ACM serial emulation subclass.
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. p_buf
Pointer to the destination buffer to receive data. buf_len
Number of octets to receive. timeout
Timeout, in milliseconds. p_xfer_len
Pointer to a variable that will receive transfer length. If no errors are returned, the variable is set to number of octets received, otherwise it is set to 0.
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_write()
sl_status_t sl_usbd_cdc_acm_write | ( | uint8_t |
subclass_nbr,
|
uint8_t * |
p_buf,
|
||
uint32_t |
buf_len,
|
||
uint16_t |
timeout,
|
||
uint32_t * |
p_xfer_len
|
||
) |
Send data on the CDC ACM serial emulation subclass.
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. p_buf
Pointer to the buffer of data that will be transmitted. buf_len
Number of octets to transmit. timeout
Timeout in milliseconds. p_xfer_len
Pointer to a variable that will receive transfer length. If no errors are returned, the variable is set to number of octets transmitted, otherwise it is set to 0.
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_get_line_control_state()
sl_status_t sl_usbd_cdc_acm_get_line_control_state | ( | uint8_t |
subclass_nbr,
|
uint8_t * |
p_line_ctrl
|
||
) |
Return the state of control lines.
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. p_line_ctrl
Pointer to the variable that will be set with the state of the control lines, encoded in bit fields.
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_get_line_coding()
sl_status_t sl_usbd_cdc_acm_get_line_coding | ( | uint8_t |
subclass_nbr,
|
sl_usbd_cdc_acm_line_coding_t * |
p_line_coding
|
||
) |
Get the current state of the line coding.
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. p_line_coding
Pointer to the structure where the current line coding will be stored.
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_set_line_coding()
sl_status_t sl_usbd_cdc_acm_set_line_coding | ( | uint8_t |
subclass_nbr,
|
sl_usbd_cdc_acm_line_coding_t * |
p_line_coding
|
||
) |
Set a new line coding.
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. p_line_coding
Pointer to the structure that contains the new line coding.
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_set_line_state_event()
sl_status_t sl_usbd_cdc_acm_set_line_state_event | ( | uint8_t |
subclass_nbr,
|
uint8_t |
events
|
||
) |
Set a line state event(s).
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. events
Line state event(s) to set. OR'ed of the following flags: - SL_USBD_CDC_ACM_STATE_DCD
- SL_USBD_CDC_ACM_STATE_DSR
- SL_USBD_CDC_ACM_STATE_BREAK
- SL_USBD_CDC_ACM_STATE_RING
- SL_USBD_CDC_ACM_STATE_FRAMING
- SL_USBD_CDC_ACM_STATE_PARITY
- SL_USBD_CDC_ACM_STATE_OVERUN
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆ sl_usbd_cdc_acm_clear_line_state_event()
sl_status_t sl_usbd_cdc_acm_clear_line_state_event | ( | uint8_t |
subclass_nbr,
|
uint8_t |
events
|
||
) |
Clear a line state event(s).
- Parameters
-
subclass_nbr
CDC ACM serial emulation subclass instance number. events
Line state event(s) set to be cleared. OR'ed of the following flags (see Note #1) : - SL_USBD_CDC_ACM_STATE_DCD Set DCD signal (Rx carrier).
- SL_USBD_CDC_ACM_STATE_DSR Set DSR signal (Tx carrier).
- Returns
- Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
- Note
- (1) USB PSTN spec ver 1.20 states: "For the irregular signals like break, the incoming ring signal, or the overrun error state, this will reset their values to zero and again will not send another notification until their state changes." The irregular events are automatically cleared by the ACM serial emulation subclass.