USB Device ACM API#

USB Device CDC ACM API.

Modules#

sl_usbd_cdc_acm_line_coding_t

sl_usbd_cdc_acm_callbacks_t

Functions#

sl_status_t

GLOBAL VARIABLES.

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_read_async(uint8_t subclass_nbr, uint8_t *p_buf, uint32_t buf_len, sl_usbd_cdc_async_function_t async_fnct, void *p_async_arg)

Receive data on the CDC ACM serial emulation subclass asynchronously.

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_write_async(uint8_t subclass_nbr, uint8_t *p_buf, uint32_t buf_len, sl_usbd_cdc_async_function_t async_fnct, void *p_async_arg)

Send data on the CDC ACM serial emulation subclass asynchronously.

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 )

GLOBAL VARIABLES.

Parameters
N/A

MACROS GLOBAL CONSTANTS FUNCTION PROTOTYPES CDC ACM FUNCTIONS

Initialize the CDC ACM serial emulation subclass.

Returns

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


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

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
N/Aline_state_interval

Line state notification interval in milliseconds (value must be a power of 2).

N/Acall_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.

N/Ap_acm_callbacks

Optional pointers to callback functions to be called on various events.

N/Ap_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.


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

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Aconfig_nbr

Configuration index to add new test class interface to.

Returns

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


Definition at line 215 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Ap_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.


Definition at line 229 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Ap_buf

Pointer to the destination buffer to receive data.

N/Abuf_len

Number of octets to receive.

N/Atimeout

Timeout, in milliseconds.

N/Ap_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.


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

sl_usbd_cdc_acm_read_async#

sl_status_t sl_usbd_cdc_acm_read_async (uint8_t subclass_nbr, uint8_t * p_buf, uint32_t buf_len, sl_usbd_cdc_async_function_t async_fnct, void * p_async_arg)

Receive data on the CDC ACM serial emulation subclass asynchronously.

Parameters
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Ap_buf

Pointer to the destination buffer to receive data.

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.


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

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Ap_buf

Pointer to the buffer of data that will be transmitted.

N/Abuf_len

Number of octets to transmit.

N/Atimeout

Timeout in milliseconds.

N/Ap_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.


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

sl_usbd_cdc_acm_write_async#

sl_status_t sl_usbd_cdc_acm_write_async (uint8_t subclass_nbr, uint8_t * p_buf, uint32_t buf_len, sl_usbd_cdc_async_function_t async_fnct, void * p_async_arg)

Send data on the CDC ACM serial emulation subclass asynchronously.

Parameters
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Ap_buf

Pointer to the buffer of data that will be transmitted.

N/Abuf_len

Number of octets to transmit.

N/Aasync_fnct

Function that will be invoked upon completion of transfer 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.


Definition at line 314 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Ap_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.


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

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Ap_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.


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

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Ap_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.


Definition at line 354 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Aevents

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.


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

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
N/Asubclass_nbr

CDC ACM serial emulation subclass instance number.

N/Aevents

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.


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

Macro Definition Documentation#

SL_USBD_CDC_ACM_NBR_NONE#

#define SL_USBD_CDC_ACM_NBR_NONE
Value:
255u

MODULE.

INCLUDE FILES DEFINES


Definition at line 55 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_PARITY_NONE#

#define SL_USBD_CDC_ACM_PARITY_NONE
Value:
0u

PORT SETTINGS DEFINES.


Definition at line 61 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_PARITY_ODD#

#define SL_USBD_CDC_ACM_PARITY_ODD
Value:
1u

Definition at line 62 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_PARITY_EVEN#

#define SL_USBD_CDC_ACM_PARITY_EVEN
Value:
2u

Definition at line 63 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_PARITY_MARK#

#define SL_USBD_CDC_ACM_PARITY_MARK
Value:
3u

Definition at line 64 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_PARITY_SPACE#

#define SL_USBD_CDC_ACM_PARITY_SPACE
Value:
4u

Definition at line 65 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_STOP_BIT_1#

#define SL_USBD_CDC_ACM_STOP_BIT_1
Value:
0u

Definition at line 67 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_STOP_BIT_1_5#

#define SL_USBD_CDC_ACM_STOP_BIT_1_5
Value:
1u

Definition at line 68 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_STOP_BIT_2#

#define SL_USBD_CDC_ACM_STOP_BIT_2
Value:
2u

Definition at line 69 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_CTRL_BREAK#

#define SL_USBD_CDC_ACM_CTRL_BREAK
Value:
0x01u

LINE EVENTS FLAGS DEFINES.


Definition at line 75 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_CTRL_RTS#

#define SL_USBD_CDC_ACM_CTRL_RTS
Value:
0x02u

Definition at line 76 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_CTRL_DTR#

#define SL_USBD_CDC_ACM_CTRL_DTR
Value:
0x04u

Definition at line 77 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_STATE_DCD#

#define SL_USBD_CDC_ACM_STATE_DCD
Value:
0x01u

Definition at line 79 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_STATE_DSR#

#define SL_USBD_CDC_ACM_STATE_DSR
Value:
0x02u

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

SL_USBD_CDC_ACM_STATE_BREAK#

#define SL_USBD_CDC_ACM_STATE_BREAK
Value:
0x04u

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

SL_USBD_CDC_ACM_STATE_RING#

#define SL_USBD_CDC_ACM_STATE_RING
Value:
0x08u

Definition at line 82 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_STATE_FRAMING#

#define SL_USBD_CDC_ACM_STATE_FRAMING
Value:
0x10u

Definition at line 83 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_STATE_PARITY#

#define SL_USBD_CDC_ACM_STATE_PARITY
Value:
0x20u

Definition at line 84 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_STATE_OVERUN#

#define SL_USBD_CDC_ACM_STATE_OVERUN
Value:
0x40u

Definition at line 85 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_CALL_MGMT_DEV#

#define SL_USBD_CDC_ACM_CALL_MGMT_DEV
Value:
0x01u

CALL MANAGEMENT CAPABILITIES.

Note(s) : (1) See 'USB, Communications Class, Subclass Specification for PSTN Devices, Revision 1.2, February 9 2007', section '5.3.1 Call Management Functional Descriptor' for more details about the Call Management capabilities.


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

SL_USBD_CDC_ACM_CALL_MGMT_DATA_CCI_DCI#

#define SL_USBD_CDC_ACM_CALL_MGMT_DATA_CCI_DCI
Value:
0x02u

Definition at line 96 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h

SL_USBD_CDC_ACM_CALL_MGMT_DATA_OVER_DCI#

#define SL_USBD_CDC_ACM_CALL_MGMT_DATA_OVER_DCI
Value:
(0x02u | 0x01u)

Definition at line 97 of file protocol/usb/inc/sl_usbd_class_cdc_acm.h