Synergy Software Package User's Manual

RTOS-integrated USBX CDC ACM device implementation. More...

Data Structures

struct  sf_el_ux_comms_instance_ctrl_t
 

Functions

ssp_err_t SF_EL_UX_COMMS_Open (sf_comms_ctrl_t *const p_api_ctrl, sf_comms_cfg_t const *const p_cfg)
 Initializes a USB channel for CDC ACM mode. More...
 
ssp_err_t SF_EL_UX_COMMS_Close (sf_comms_ctrl_t *const p_api_ctrl)
 Releases all the ThreadX Resources. More...
 
ssp_err_t SF_EL_UX_COMMS_Read (sf_comms_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint32_t const bytes, UINT const timeout)
 Read data from the USBX CDC-ACM driver. More...
 
ssp_err_t SF_EL_UX_COMMS_Write (sf_comms_ctrl_t *const p_api_ctrl, uint8_t const *const p_src, uint32_t const bytes, UINT const timeout)
 Write data to the USBX CDC-ACM framework. More...
 
ssp_err_t SF_EL_UX_COMMS_Lock (sf_comms_ctrl_t *const p_api_ctrl, sf_comms_lock_t lock_type, UINT timeout)
 Lock the USB COM resource. More...
 
ssp_err_t SF_EL_UX_COMMS_Unlock (sf_comms_ctrl_t *const p_api_ctrl, sf_comms_lock_t lock_type)
 Unlock the USB COM resource. More...
 
ssp_err_t SF_EL_UX_COMMS_VersionGet (ssp_version_t *const p_version)
 Get driver version. More...
 

Detailed Description

RTOS-integrated USBX CDC ACM device implementation.

Function Documentation

◆ SF_EL_UX_COMMS_Close()

ssp_err_t SF_EL_UX_COMMS_Close ( sf_comms_ctrl_t *const  p_api_ctrl)

Releases all the ThreadX Resources.

Return values
SSP_SUCCESSChannel successfully closed
SSP_ERR_ASSERTIONPointer to control block is NULL
SSP_ERR_NOT_OPENModule is not opened.
Note
This function is reentrant.

Check if module has been opened.

Delete transmit mutex.

Delete receive mutex.

Deletes a semaphore for USBX CDC instance

◆ SF_EL_UX_COMMS_Lock()

ssp_err_t SF_EL_UX_COMMS_Lock ( sf_comms_ctrl_t *const  p_api_ctrl,
sf_comms_lock_t  lock_type,
UINT  timeout 
)

Lock the USB COM resource.

Return values
SSP_SUCCESSLocking a USB COM resource successful.
SSP_ERR_ASSERTIONPointer to control block is NULL.
SSP_ERR_NOT_OPENModule is not opened.
SSP_ERR_TIMEOUTMutex not available in timeout.

If lock type is ALL, both TX and RX gets locked else either TX or RX is locked.

If TX or RX fails to acquire mutex, return error.

◆ SF_EL_UX_COMMS_Open()

ssp_err_t SF_EL_UX_COMMS_Open ( sf_comms_ctrl_t *const  p_api_ctrl,
sf_comms_cfg_t const *const  p_cfg 
)

Initializes a USB channel for CDC ACM mode.

Parameters
[in]p_api_ctrlPointer to control structure block.
[in]p_cfgPointer to configuration structure block. This parameter is not used in the framework hence the NULL parameter check not implemented.
Return values
SSP_SUCCESSChannel opened successfully.
SSP_ERR_ASSERTIONp_api_ctrl pointer parameter to control block is NULL.
SSP_ERR_TIMEOUTSemaphore not available in timeout.
SSP_ERR_INTERNALTransmit/Receive mutex or Semaphore creation fails.
SSP_ERR_IN_USEChannel/peripheral is running/busy.
Note
This function is reentrant.

Create semaphore if the USBX CDC instance is not ready.

If the semaphore creation fails, return error.

Suspend here until a USBX CDC instance is created by the USBX CDC for this module.

Create the mutex for protecting the access to control structure for transmit and related hardware

Create the mutex for protecting the access to control structure for receive and related hardware

Mark control block open.

◆ SF_EL_UX_COMMS_Read()

ssp_err_t SF_EL_UX_COMMS_Read ( sf_comms_ctrl_t *const  p_api_ctrl,
uint8_t *const  p_dest,
uint32_t const  bytes,
UINT const  timeout 
)

Read data from the USBX CDC-ACM driver.

Return values
SSP_SUCCESSData reception ends successfully.
SSP_ERR_INTERNALAn error has occurred if usb read operation fails or buffer overflow occurred.
SSP_ERR_TIMEOUTReceive mutex get timed out
Note
This API is reentrant.

Get mutex.

Set timeout value in the transfer request.

If there is data leftover from the last packet, use it.

Read from the CDC class.

Release mutex in case of buffer overflow or read error .

Release mutex for Read API.

◆ SF_EL_UX_COMMS_Unlock()

ssp_err_t SF_EL_UX_COMMS_Unlock ( sf_comms_ctrl_t *const  p_api_ctrl,
sf_comms_lock_t  lock_type 
)

Unlock the USB COM resource.

Return values
SSP_SUCCESSUnlocking a USB COM resource successful.
SSP_ERR_ASSERTIONPointer to control block is NULL.
SSP_ERR_NOT_OPENModule is not opened.
SSP_ERR_INTERNALFailed to release the mutex.

Unlock the USB CDC COM resource as per the user request.

If USB CDC COM resource fails to unlock,returns error.

◆ SF_EL_UX_COMMS_VersionGet()

ssp_err_t SF_EL_UX_COMMS_VersionGet ( ssp_version_t *const  p_version)

Get driver version.

Parameters
[out]p_versionVersion will be stored here.
Note
This function is reentrant.

◆ SF_EL_UX_COMMS_Write()

ssp_err_t SF_EL_UX_COMMS_Write ( sf_comms_ctrl_t *const  p_api_ctrl,
uint8_t const *const  p_src,
uint32_t const  bytes,
UINT const  timeout 
)

Write data to the USBX CDC-ACM framework.

Return values
SSP_SUCCESSData transmission finished successfully.
SSP_ERR_INTERNALAn error has occurred, when usb write operation fails.
SSP_ERR_TIMEOUTTransmit mutex get timed out or when DTR and RTS state setting gets timed out.
Note
This function is reentrant.

Wait for DTR and RTS state to set.

Get Transmit mutex.

Set timeout value in the transfer request.

Release mutex in case of error condition and log the error .

Release Transmit mutex for Write API.