USB Host USB2SER API#

  1. USBH_USB2SER_ConfigureBufAlignOctets()

  2. USBH_USB2SER_ConfigureDrvEntryTbl()

  3. USBH_USB2SER_ConfigureHS_En()

  4. USBH_USB2SER_ConfigureRxBufQty()

  5. USBH_USB2SER_ConfigureOptimizeSpdCfg()

  6. USBH_USB2SER_ConfigureInitAllocCfg()

  7. USBH_USB2SER_ConfigureMemSeg()

  8. USBH_USB2SER_Init()

  9. USBH_USB2SER_StdReqTimeoutSet()

  10. USBH_USB2SER_DevHandleGet()

  11. USBH_USB2SER_PortNbrGet()

  12. USBH_USB2SER_Reset()

  13. USBH_USB2SER_BaudRateSet()

  14. USBH_USB2SER_BaudRateGet()

  15. USBH_USB2SER_DataSet()

  16. USBH_USB2SER_DataGet()

  17. USBH_USB2SER_BreakSignalSet()

  18. USBH_USB2SER_ModemDTR_Set()

  19. USBH_USB2SER_ModemDTR_Get()

  20. USBH_USB2SER_ModemRTS_Set()

  21. USBH_USB2SER_ModemRTS_Get()

  22. USBH_USB2SER_HW_FlowCtrlSet()

  23. USBH_USB2SER_HW_FlowCtrlGet()

  24. USBH_USB2SER_SW_FlowCtrlSet()

  25. USBH_USB2SER_SW_FlowCtrlGet()

  26. USBH_USB2SER_StatusGet()

  27. USBH_USB2SER_TxAsync()

USBH_USB2SER_ConfigureBufAlignOctets()#

Description#

Configures the alignment of the internal buffers.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void  USBH_USB2SER_ConfigureBufAlignOctets (CPU_SIZE_T  buf_align_octets)

Arguments#

buf_align_octets

Buffer alignment, in octets.

Returned Value#

None.

Notes / Warnings#

  1. This function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the USB2SER class is initialized via the USBH_USB2SER_Init() function.

USBH_USB2SER_ConfigureDrvEntryTbl()#

Description#

Configures the adapter drivers table.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void  USBH_USB2SER_ConfigureDrvEntryTbl (USBH_USB2SER_ADAPTER_DRV_ENTRY  *p_tbl)

Arguments#

p_tbl

Pointer to table that contains the adapter driver entries. Table MUST be null-terminated. Content MUST be persistent.

Returned Value#

None.

Notes / Warnings#

  1. This function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the USB2SER class is initialized via the USBH_USB2SER_Init() function.

USBH_USB2SER_ConfigureHS_En()#

Description#

Configures the support for high-speed adapter devices.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void  USBH_USB2SER_ConfigureHS_En (CPU_BOOLEAN  hs_en)

Arguments#

hs_en

  • DEF_ENABLED, if support for high-speed adapter devices is enabled.

  • DEF_DISABLED, if support for high-speed adapter devices is disabled.

Returned Value#

None.

Notes / Warnings#

  1. This function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the USB2SER class is initialized via the USBH_USB2SER_Init() function.

USBH_USB2SER_ConfigureRxBufQty()#

Description#

Configures the quantity of receive buffers per adapter.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void  USBH_USB2SER_ConfigureRxBufQty (CPU_INT08U  rx_buf_qty)

Arguments#

rx_buf_qty

Quantity of receive buffers.

Returned Value#

None.

Notes / Warnings#

  1. This function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the USB2SER class is initialized via the USBH_USB2SER_Init() function.

USBH_USB2SER_ConfigureOptimizeSpdCfg()#

Description#

Sets the configurations required when optimize speed mode is enabled.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void  USBH_USB2SER_ConfigureOptimizeSpdCfg(const  USBH_USB2SER_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#

  1. This function MUST be called before the USB2SER class is initialized via the USBH_USB2SER_Init() function.

  2. This function MUST be called when the USBH_CFG_OPTIMIZE_SPD_EN configuration is set to DEF_ENABLED.

USBH_USB2SER_ConfigureInitAllocCfg()#

Description#

Sets the configurations required when allocation at initialization mode is enabled.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void  USBH_USB2SER_ConfigureInitAllocCfg  (const  USBH_USB2SER_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#

  1. This function MUST be called before the USB2SER class is initialized via the USBH_USB2SER_Init() function.

  2. This function MUST be called when the USBH_CFG_INIT_ALLOC_EN configuration is set to DEF_ENABLED.

USBH_USB2SER_ConfigureMemSeg()#

Description#

Configures the memory segment to use when allocating control data and buffers.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void  USBH_USB2SER_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_NULL means 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_NULL means general purpose heap segment.

Returned Value#

None.

Notes / Warnings#

  1. This function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the USB2SER class is initialized via the USBH_USB2SER_Init() function.

USBH_USB2SER_Init()#

Description#

Initializes the USB-to-serial Class.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_Init (USBH_USB2SER_APP_FNCTS  *p_app_fncts,
                         RTOS_ERR                *p_err)

Arguments#

p_app_fncts

Pointer to the callback functions structure that will be used to notify application of change in USB to Serial device status. Content MUST be persistent.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_OS_ILLEGAL_RUN_TIME

  • RTOS_ERR_SEG_OVF

  • RTOS_ERR_BLK_ALLOC_CALLBACK

  • RTOS_ERR_POOL_EMPTY

  • RTOS_ERR_NOT_AVAIL

Returned Value#

None.

Notes / Warnings#

None.

USBH_USB2SER_StdReqTimeoutSet()#

Description#

Assigns a new timeout delay for the USB2SER standard requests.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void  USBH_USB2SER_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_USB2SER_DevHandleGet()#

Description#

Retrieves the device handle associated to the USB-to-serial adapter.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

USBH_DEV_HANDLE USBH_USB2SER_DevHandleGet (USBH_USB2SER_FNCT_HANDLE    usb2ser_fnct_handle,
                                            RTOS_ERR                   *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_NOT_AVAIL

Returned Value#

Device handle.

Notes / Warnings#

None.

USBH_USB2SER_PortNbrGet()#

Description#

Retrieves the port number associated with the usb-to-serial function handle.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

CPU_INT08U USBH_USB2SER_PortNbrGet (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                                     RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

Port number.

Notes / Warnings#

None.

USBH_USB2SER_Reset()#

Description#

Purges the buffers on the device.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_Reset (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                          USBH_USB2SER_RESET_SEL     sel,
                          RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on USB-to-serial function.

sel

Type of reset.

  • USBH_USB2SER_RESET_SEL_TX

  • USBH_USB2SER_RESET_SEL_RX

  • USBH_USB2SER_RESET_SEL_ALL

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

None.

Notes / Warnings#

None.

USBH_USB2SER_BaudRateSet()#

Description#

Sets the baud rate of the communication port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_BaudRateSet (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                                CPU_INT32U                 baudrate,
                                RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

baudrate

Baud rate to configure (in bauds/second).

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

None.

Notes / Warnings#

None.

USBH_USB2SER_BaudRateGet()#

Description#

Gets the current baud rate of the communication port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

CPU_INT32U USBH_USB2SER_BaudRateGet (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                                      RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

Current baud rate in bauds/sec.

Notes / Warnings#

None.

USBH_USB2SER_DataSet()#

Description#

Sets the data characteristics of the communication port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_DataSet (USBH_USB2SER_FNCT_HANDLE    usb2ser_fnct_handle,
                            CPU_INT08U                  data_size,
                            USBH_USB2SER_PARITY         parity,
                            USBH_USB2SER_STOP_BITS      stop_bits,
                            RTOS_ERR                   *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

data_size

Number of data bits.

parity

Define the Parity to use, as follows:

  • USBH_USB2SER_PARITY_NONE, Do not use the parity bit.

  • USBH_USB2SER_PARITY_ODD, Use odd parity bit.

  • USBH_USB2SER_PARITY_EVEN, Use even parity bit.

  • USBH_USB2SER_PARITY_MARK, Use mark parity bit.

  • USBH_USB2SER_PARITY_SPACE, Use space parity bit.

stop_bits

Define the Number of stop bits, as follows:

  • USBH_USB2SER_STOP_BITS_1, Use 1 stop bit.

  • USBH_USB2SER_STOP_BITS_1_5, Use 1.5 stop bit.

  • USBH_USB2SER_STOP_BITS_2, Use 2 stop bits.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

None.

Notes / Warnings#

None.

USBH_USB2SER_DataGet()#

Description#

Gets the data characteristics of the communication port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_DataGet (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                            CPU_INT08U                *p_data_size,
                            USBH_USB2SER_PARITY       *p_parity,
                            USBH_USB2SER_STOP_BITS    *p_stop_bits,
                            RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_data_size

Pointer to the variable that will receive the number of data bits.

p_parity

Pointer to the variable that will receive the parity check used, as follows:

  • USBH_USB2SER_PARITY_NONE, Do not use the parity bit.

  • USBH_USB2SER_PARITY_ODD, Use odd parity bit.

  • USBH_USB2SER_PARITY_EVEN, Use even parity bit.

  • USBH_USB2SER_PARITY_MARK, Use mark parity bit.

  • USBH_USB2SER_PARITY_SPACE, Use space parity bit.

p_stop_bits

Pointer to the variable that will receive the number of stop bits, as follows:

  • USBH_USB2SER_STOP_BITS_1, Use 1 stop bit.

  • USBH_USB2SER_STOP_BITS_1_5, Use 1.5 stop bit.

  • USBH_USB2SER_STOP_BITS_2, Use 2 stop bits.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

None.

Notes / Warnings#

None.

USBH_USB2SER_BreakSignalSet()#

Description#

Sets the break signal.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_BreakSignalSet (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                                   CPU_BOOLEAN                set,
                                   RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

set

Boolean that indicates if the break signal should be set or cleared.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

None.

Notes / Warnings#

None.

USBH_USB2SER_ModemDTR_Set()#

Description#

Controls the modem DTR pin on a port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_ModemDTR_Set (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                                 CPU_BOOLEAN                set,
                                 RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on USB-to-serial function.

set

Sets or clears the Data Terminal Ready (DTR) pin.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

  • RTOS_ERR_USB2SER_FLOW_CTRL_EN

Returned Value#

None.

Notes / Warnings#

  1. If the current flow control is set to DTR/DSR, the DTR pin cannot be set manually.

USBH_USB2SER_ModemDTR_Get()#

Description#

Gets the DTR pin state on a port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

CPU_BOOLEAN USBH_USB2SER_ModemDTR_Get (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,                                         RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

  • RTOS_ERR_USB2SER_FLOW_CTRL_EN

Returned Value#

DTR pin state.

Notes / Warnings#

None.

USBH_USB2SER_ModemRTS_Set()#

Description#

Controls the modem RTS pin on a port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_ModemRTS_Set (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                                 CPU_BOOLEAN                set,
                                 RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

set

Sets or clears the Ready To Send (RTS) pin.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

  • RTOS_ERR_USB2SER_FLOW_CTRL_EN

Returned Value#

None.

Notes / Warnings#

  1. If the current flow control is set to RTS/CTS, the RTS pin cannot be set.

USBH_USB2SER_ModemRTS_Get()#

Description#

Gets the RTS pin state on a port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

CPU_BOOLEAN USBH_USB2SER_ModemRTS_Get (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,                                        RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on USB-to-serial function.

p_err

Pointer to the variable that will receive the return error code from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

  • RTOS_ERR_USB2SER_FLOW_CTRL_EN

Returned Value#

RTS pin status.

Notes / Warnings#

None.

USBH_USB2SER_HW_FlowCtrlSet()#

Description#

Sets the hardware flow control protocol on the serial port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_HW_FlowCtrlSet (USBH_USB2SER_FNCT_HANDLE             usb2ser_fnct_handle,
                                   USBH_USB2SER_HW_FLOW_CTRL_PROTOCOL   protocol,
                                   RTOS_ERR                            *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

protocol

Defines which hardware flow control protocol to use, as follows:

  • USBH_USB2SER_HW_FLOW_CTRL_PROTOCOL_RTS_CTS, Use RTS/CTS protocol.

  • USBH_USB2SER_HW_FLOW_CTRL_PROTOCOL_DTR_DSR, Use DTR/DSR protocol.

  • USBH_USB2SER_HW_FLOW_CTRL_PROTOCOL_NONE, No HW protocol.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

None.

Notes / Warnings#

None.

USBH_USB2SER_HW_FlowCtrlGet()#

Description#

Gets the hardware flow control protocol on the serial port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

USBH_USB2SER_HW_FLOW_CTRL_PROTOCOL USBH_USB2SER_HW_FlowCtrlGet (USBH_USB2SER_FNCT_HANDLE    usb2ser_fnct_handle,
                                                                  RTOS_ERR                   *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

Current hardware flow control protocol.

Notes / Warnings#

None.

USBH_USB2SER_SW_FlowCtrlSet()#

Description#

Sets the software flow control on the serial port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_SW_FlowCtrlSet (USBH_USB2SER_FNCT_HANDLE   usb2ser_fnct_handle,
                                   CPU_BOOLEAN                en,
                                   CPU_INT08U                 xon_char,
                                   CPU_INT08U                 xoff_char,
                                   RTOS_ERR                  *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

en

Boolean that indicates if the software flow control should be enabled.

xon_char

Xon character to use.

xoff_char

Xoff character to use.

p_err

Pointer to the variable that will receive the return error code from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

None.

Notes / Warnings#

None.

USBH_USB2SER_SW_FlowCtrlGet()#

Description#

Gets the software flow control state on the serial port.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

CPU_BOOLEAN USBH_USB2SER_SW_FlowCtrlGet (USBH_USB2SER_FNCT_HANDLE    usb2ser_fnct_handle,
                                          CPU_INT08                  *p_xon_char,
                                          CPU_INT08U                 *p_xoff_char,
                                          RTOS_ERR                   *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_xon_char

Pointer to the variable that will receive the Xon character.

p_xoff_char

Pointer to the variable that will receive the Xoff character.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_NOT_AVAIL

Returned Value#

State of the software flow control.

Notes / Warnings#

None.

USBH_USB2SER_StatusGet()#

Description#

Retrieves the current serial status.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

USBH_USB2SER_SERIAL_STATUS USBH_USB2SER_StatusGet (USBH_USB2SER_FNCT_HANDLE     usb2ser_fnct_handle,
                                                   RTOS_ERR                    *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_NOT_AVAIL

Returned Value#

Current serial status.

Notes / Warnings#

  1. The following masks determine if part of the modem status is set, as follows:

  • USBH_USB2SER_MODEM_STATUS_CTS

  • USBH_USB2SER_MODEM_STATUS_DSR

  • USBH_USB2SER_MODEM_STATUS_RING

  • USBH_USB2SER_MODEM_STATUS_CARRIER

  1. The following masks may be used to determine if part of the line status is set, as follows:

  • USBH_USB2SER_LINE_STATUS_RX_OVERFLOW_ERR

  • USBH_USB2SER_LINE_STATUS_PARITY_ERR

  • USBH_USB2SER_LINE_STATUS_FRAMING_ERR

  • USBH_USB2SER_LINE_STATUS_BRK_INT

USBH_USB2SER_TxAsync()#

Description#

Sends the data on the serial port. This function is non-blocking.

Files#

usbh_usb2ser.h/usbh_usb2ser.c

Prototype#

void USBH_USB2SER_TxAsync (USBH_USB2SER_FNCT_HANDLE      usb2ser_fnct_handle,
                            CPU_INT08U                   *p_buf,
                            CPU_INT32U                    buf_len,
                            USBH_USB2SER_ASYNC_TX_FNCT    tx_cmpl_notify,
                            void                         *p_arg,
                            RTOS_ERR                     *p_err)

Arguments#

usb2ser_fnct_handle

Handle on the USB-to-serial function.

p_buf

Pointer to the buffer of data that will be sent.

buf_len

Buffer length in bytes.

tx_cmpl_notify

Function that will be invoked upon completion of transmit operation.

p_arg

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

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_BLK_ALLOC_CALLBACK

  • RTOS_ERR_POOL_EMPTY

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_SEG_OVF

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_NOT_AVAIL

  • RTOS_ERR_WOULD_OVF

Returned Value#

None.

Notes / Warnings#

None.