USB Host CDC API#
USBH_CDC_ConfigureBufAlignOctets()#
Description#
Configures the alignment of the internal buffers.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_ConfigureBufAlignOctets (CPU_SIZE_T buf_align_octets)Arguments#
buf_align_octets
Buffer alignment, in octets.
Returned Value#
None.
Notes / Warnings#
This function is optional, if it is not called, the default value will be used.
This function MUST be called before the CDC class is initialized via the
USBH_CDC_Init()function.
USBH_CDC_ConfigureEventURB_Qty()#
Description#
Configures the quantity of URBs used to retrieve CDC status to allocate/submit.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_ConfigureEventURB_Qty (CPU_INT08U event_urb_qty)Arguments#
event_urb_qty
Quantity of event URBs.
Returned Value#
None.
Notes / Warnings#
This function is optional, if it is not called, the default value will be used.
This function MUST be called before the CDC class is initialized via the
USBH_CDC_Init()function.
USBH_CDC_ConfigureOptimizeSpdCfg()#
Description#
Sets the configurations required when optimize speed mode is enabled.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_ConfigureOptimizeSpdCfg(const USBH_CDC_CFG_OPTIMIZE_SPD *p_optimize_spd_cfg)Arguments#
p_optimize_spd_cfg
Pointer to the structure containing the configurations for the optimize speed mode.
Returned Value#
None.
Notes / Warnings#
This function MUST be called before the CDC class is initialized via the
USBH_CDC_Init()function.This function MUST be called when the
USBH_CFG_OPTIMIZE_SPD_ENconfiguration is set toDEF_ENABLED.
USBH_CDC_ConfigureInitAllocCfg()#
Description#
Sets the configurations required when allocation at initialization mode is enabled.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_ConfigureInitAllocCfg (const USBH_CDC_CFG_INIT_ALLOC *p_init_alloc_cfg)Arguments#
p_init_alloc_cfg
Pointer to the structure containing the configurations for the allocation at initialization mode.
Returned Value#
None.
Notes / Warnings#
This function MUST be called before the CDC class is initialized via the
USBH_CDC_Init()function.This function MUST be called when the
USBH_CFG_INIT_ALLOC_ENconfiguration is set toDEF_ENABLED.
USBH_CDC_ConfigureMemSeg()#
Description#
Configures the memory segment to use when allocating control data and buffers.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_ConfigureMemSeg (MEM_SEG *p_mem_seg,
MEM_SEG *p_mem_seg_buf)Arguments#
p_mem_seg
Pointer to memory segment to use when allocating control data. Can be the same segment used for
p_mem_seg_buf.DEF_NULLmeans general purpose heap segment.
p_mem_seg_buf
Pointer to memory segment to use when allocating data buffers. Can be the same segment used for
p_mem_seg.DEF_NULLmeans general purpose heap segment.
Returned Value#
None.
Notes / Warnings#
This function is optional, if it is not called, the default value will be used.
This function MUST be called before the CDC class is initialized via the
USBH_CDC_Init()function.
USBH_CDC_Init()#
Description#
Initializes the Communication Device Class (CDC) driver.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_Init ( RTOS_ERR *p_err)Arguments#
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_OS_ILLEGAL_RUN_TIMERTOS_ERR_SEG_OVFRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_NOT_AVAIL
Returned Value#
None.
Notes / Warnings#
None.
USBH_CDC_StdReqTimeoutSet()#
Description#
Assigns a new timeout delay for the CDC standard requests.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_StdReqTimeoutSet (CPU_INT32U std_req_timeout_ms,
RTOS_ERR *p_err)Arguments#
std_req_timeout_ms
New timeout, in milliseconds.
p_err
Pointer to the variable that will receive one of the following error code(s) from this function:
RTOS_ERR_NONE
Returned Value#
None.
Notes / Warnings#
None.
USBH_CDC_PostInit()#
Description#
Post-initializes the Communication Device Class (CDC) driver once all the subclass drivers added.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_PostInit (RTOS_ERR *p_err)Arguments#
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_SEG_OVFRTOS_ERR_BLK_ALLOC_CALLBACK
Returned Value#
None.
Notes / Warnings#
This function MUST be called by the application once all the subclass drivers are initialized and BEFORE starting the USB Host product.
USBH_CDC_DevHandleGet()#
Description#
Gets the device handle of a given CDC function.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
USBH_DEV_HANDLE USBH_CDC_DevHandleGet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_INVALID_HANDLERTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAIL
Returned Value#
Device handle.
Notes / Warnings#
None.
USBH_CDC_FnctHandleGet()#
Description#
Gets the function handle of a given CDC function.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
USBH_FNCT_HANDLE USBH_CDC_FnctHandleGet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_INVALID_HANDLERTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAIL
Returned Value#
Function handle.
Notes / Warnings#
None.
USBH_CDC_DCI_QtyGet()#
Description#
Gets the quantity of Data Class Interface (DCI) for a given CDC function.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
CPU_INT08U USBH_CDC_DCI_QtyGet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on CDC function.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_INVALID_HANDLERTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAIL
Returned Value#
Number of DCI.
Notes / Warnings#
None.
USBH_CDC_RelNbrGet()#
Description#
Gets the CDC function release number (bcdCDC).
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
CPU_INT16U USBH_CDC_RelNbrGet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on CDC function.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_INVALID_HANDLERTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAIL
Returned Value#
Release number.
Notes / Warnings#
For more information on CDC release number, see 'USB Class Definitions for Communication Devices Specification", version 1.2, Section 5.2.3.1'.
USBH_CDC_EncapsulatedCmdTx()#
Description#
Sends the CDC encapsulated command.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
CPU_INT16U USBH_CDC_EncapsulatedCmdTx (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
CPU_INT08U *p_buf,
CPU_INT16U buf_len,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
p_buf
Pointer to the buffer that contains the command.
buf_len
Buffer length in octets.
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAILRTOS_ERR_TXRTOS_ERR_WOULD_OVF
Returned Value#
Number of octets transferred.
Notes / Warnings#
For more information on
SendEncapsulatedCommand, see 'USB Class Definitions for Communication Devices Specification", version 1.2, Section 6.2.1'.
USBH_CDC_EncapsulatedRespRx()#
Description#
Send the CDC encapsulated command.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
CPU_INT16U USBH_CDC_EncapsulatedRespRx (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
CPU_INT08U *p_buf,
CPU_INT16U buf_len,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
p_buf
Pointer to the buffer that will receive data.
buf_len
Buffer length in octets.
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAILRTOS_ERR_TXRTOS_ERR_WOULD_OVF
Returned Value#
Number of octets received.
Notes / Warnings#
For more information on GetEncapsulatedCommand, see 'USB Class Definitions for Communication Devices Specification", version 1.2, Section 6.2.2'.
USBH_CDC_CommFeatureSet()#
Description#
Configures the CDC communication feature.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_CommFeatureSet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
CPU_INT08U feature,
CPU_INT16U data,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on CDC function.
feature
Feature to configure, which includes:
USBH_CDC_COMM_FEATURE_ABSTRACT_STATEUSBH_CDC_COMM_FEATURE_COUNTRY_SETTING
data
Data of the configured communication feature request.
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_TXRTOS_ERR_NOT_AVAILRTOS_ERR_WOULD_OVF
Returned Value#
None.
Notes / Warnings#
For more information on
SetCommFeaturerequest, see 'Communication Class Subclass Specification for PSTN Devices, version 1.2, Section 6.3.1'.
USBH_CDC_CommFeatureGet()#
Description#
Gets CDC function line coding.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
CPU_INT16U USBH_CDC_CommFeatureGet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
CPU_INT08U feature,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
feature
Feature to Get, which includes:
USBH_CDC_COMM_FEATURE_ABSTRACT_STATEUSBH_CDC_COMM_FEATURE_COUNTRY_SETTING
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_TXRTOS_ERR_NOT_AVAILRTOS_ERR_WOULD_OVF
Returned Value#
Data of Get communication feature request.
Notes / Warnings#
For more information on
GetCommFeaturerequest, see 'Communication Class Subclass Specification for PSTN Devices, version 1.2, Section 6.3.2'.
USBH_CDC_CommFeatureClr()#
Description#
Clears the CDC function communication feature.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_CommFeatureClr (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
CPU_INT08U feature,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on CDC function.
feature
Feature to clear, which includes:
USBH_CDC_COMM_FEATURE_ABSTRACT_STATEUSBH_CDC_COMM_FEATURE_COUNTRY_SETTING
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAILRTOS_ERR_TXRTOS_ERR_WOULD_OVF
Returned Value#
None.
Notes / Warnings#
For more information on
ClearCommFeaturerequest, see 'Communication Class Subclass Specification for PSTN Devices, version 1.2, Section 6.3.3'.
USBH_CDC_LineCodingSet()#
Description#
Sets the CDC function line coding.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_LineCodingSet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
USBH_CDC_LINECODING *p_line_coding,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
p_line_coding
Pointer to the structure that contains line coding to set.
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_TXRTOS_ERR_NOT_AVAILRTOS_ERR_WOULD_OVF
Returned Value#
None.
Notes / Warnings#
For more information on
SetLineCodingcommand, see 'Communication Class Subclass Specification for PSTN Devices, version 1.2, Section 6.3.10'.
USBH_CDC_LineCodingGet()#
Description#
Gets the CDC function line coding.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_LineCodingGet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
USBH_CDC_LINECODING *p_line_coding,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
p_line_coding
Pointer to the structure that will receive line coding.
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_TXRTOS_ERR_NOT_AVAILRTOS_ERR_WOULD_OVF
Returned Value#
None.
Notes / Warnings#
For more information on
GetLineCodingcommand, see 'Communication Class Subclass Specification for PSTN Devices, version 1.2, Section 6.3.11'.
USBH_CDC_CtrlLineStateSet()#
Description#
Sets the CDC function control line state.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_CtrlLineStateSet (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
CPU_INT16U ctrl_signal,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
ctrl_signal
Control signal, which includes:
USBH_CDC_CTRL_LINE_STATE_CARRIERUSBH_CDC_CTRL_LINE_STATE_DTE
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAILRTOS_ERR_TXRTOS_ERR_WOULD_OVF
Returned Value#
None.
Notes / Warnings#
For more information on
SetControlLineStaterequest, see 'Communication Class Subclass Specification for PSTN Devices, version 1.2, Section 6.3.12'.
USBH_CDC_BrkSend()#
Description#
Sends the break signal to CDC function.
Files#
usbh_cdc.h/usbh_cdc.c
Prototype#
void USBH_CDC_BrkSend (USBH_CDC_FNCT_HANDLE cdc_fnct_handle,
CPU_INT16U dur,
CPU_INT32U timeout,
RTOS_ERR *p_err)Arguments#
cdc_fnct_handle
Handle on the CDC function.
dur
Duration of break.
timeout
Timeout in milliseconds.
p_err
Pointer to the variable that will receive one of these return error codes from this function :
RTOS_ERR_NONERTOS_ERR_ABORTRTOS_ERR_BLK_ALLOC_CALLBACKRTOS_ERR_POOL_EMPTYRTOS_ERR_WOULD_BLOCKRTOS_ERR_OS_SCHED_LOCKEDRTOS_ERR_IS_OWNERRTOS_ERR_INVALID_STATERTOS_ERR_URB_ALLOCRTOS_ERR_INVALID_HANDLERTOS_ERR_SEG_OVFRTOS_ERR_EP_INVALIDRTOS_ERR_INVALID_ARGRTOS_ERR_TIMEOUTRTOS_ERR_OS_OBJ_DELRTOS_ERR_NOT_AVAILRTOS_ERR_TXRTOS_ERR_WOULD_OVF
Returned Value#
None.
Notes / Warnings#
For more information on
endBreakrequest, see 'Communication Class Subclass Specification for PSTN Devices, version 1.2, Section 6.3.13'.