VSF Documented
Macros | Functions
usart_common.c File Reference
#include "hal/driver/driver.h"

Macros

#define VSF_USART_CFG_FUNCTION_RENAME   DISABLED
 

Functions

vsf_err_t vsf_usart_init (vsf_usart_t *usart_ptr, vsf_usart_cfg_t *cfg_ptr)
 Initialize a USART instance.
 
void vsf_usart_fini (vsf_usart_t *usart_ptr)
 Finalize a USART instance.
 
fsm_rt_t vsf_usart_enable (vsf_usart_t *usart_ptr)
 Enable a USART instance.
 
fsm_rt_t vsf_usart_disable (vsf_usart_t *usart_ptr)
 Disable a USART instance.
 
void vsf_usart_irq_enable (vsf_usart_t *usart_ptr, vsf_usart_irq_mask_t irq_mask)
 Enable interrupt masks of USART instance.
 
void vsf_usart_irq_disable (vsf_usart_t *usart_ptr, vsf_usart_irq_mask_t irq_mask)
 Disable interrupt masks of USART instance.
 
vsf_usart_status_t vsf_usart_status (vsf_usart_t *usart_ptr)
 Get the status of USART instance.
 
vsf_usart_capability_t vsf_usart_capability (vsf_usart_t *usart_ptr)
 Get the capability of USART instance.
 
uint_fast16_t vsf_usart_rxfifo_get_data_count (vsf_usart_t *usart_ptr)
 Get the number of data currently received in the USART receive FIFO.
 
uint_fast16_t vsf_usart_rxfifo_read (vsf_usart_t *usart_ptr, void *buffer_ptr, uint_fast16_t count)
 
uint_fast16_t vsf_usart_txfifo_get_free_count (vsf_usart_t *usart_ptr)
 Get the maximum number of data that can be sent through the USART send FIFO.
 
uint_fast16_t vsf_usart_txfifo_write (vsf_usart_t *usart_ptr, void *buffer_ptr, uint_fast16_t count)
 
vsf_err_t vsf_usart_request_rx (vsf_usart_t *usart_ptr, void *buffer_ptr, uint_fast32_t count)
 Request a DMA receive operation through the USART.
 
vsf_err_t vsf_usart_request_tx (vsf_usart_t *usart_ptr, void *buffer_ptr, uint_fast32_t count)
 Request a DMA transmit operation through the USART.
 
vsf_err_t vsf_usart_cancel_rx (vsf_usart_t *usart_ptr)
 Cancel an ongoing USART receive operation.
 
vsf_err_t vsf_usart_cancel_tx (vsf_usart_t *usart_ptr)
 Cancel an ongoing USART transmit operation.
 
int_fast32_t vsf_usart_get_rx_count (vsf_usart_t *usart_ptr)
 Get the number of bytes received in the current or last USART operation.
 
int_fast32_t vsf_usart_get_tx_count (vsf_usart_t *usart_ptr)
 Get the number of bytes transmitted in the current or last USART operation.
 
vsf_err_t vsf_usart_ctrl (vsf_usart_t *usart_ptr, vsf_usart_ctrl_t ctrl, void *param)
 Execute a control command on the USART instance.
 

Macro Definition Documentation

◆ VSF_USART_CFG_FUNCTION_RENAME

#define VSF_USART_CFG_FUNCTION_RENAME   DISABLED

Function Documentation

◆ vsf_usart_init()

vsf_err_t vsf_usart_init ( vsf_usart_t usart_ptr,
vsf_usart_cfg_t cfg_ptr 
)

Initialize a USART instance.

Parameters
[in]usart_ptrPointer to USART instance
[in]cfg_ptrPointer to USART configuration
Returns
vsf_err_t VSF_ERR_NONE if successful, otherwise an error code
Note
This function must be called before using any other USART functions

◆ vsf_usart_fini()

void vsf_usart_fini ( vsf_usart_t usart_ptr)

Finalize a USART instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
none

◆ vsf_usart_enable()

fsm_rt_t vsf_usart_enable ( vsf_usart_t usart_ptr)

Enable a USART instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
fsm_rt_t: fsm_rt_cpl if USART was enabled, fsm_rt_on_going if USART is still enabling

◆ vsf_usart_disable()

fsm_rt_t vsf_usart_disable ( vsf_usart_t usart_ptr)

Disable a USART instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
fsm_rt_t: fsm_rt_cpl if USART was disabled, fsm_rt_on_going if USART is still disabling

◆ vsf_usart_irq_enable()

void vsf_usart_irq_enable ( vsf_usart_t usart_ptr,
vsf_usart_irq_mask_t  irq_mask 
)

Enable interrupt masks of USART instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
[in]irq_maskone or more values of enum vsf_usart_irq_mask_t
Returns
none
Note
All pending interrupts should be cleared before interrupts are enabled

◆ vsf_usart_irq_disable()

void vsf_usart_irq_disable ( vsf_usart_t usart_ptr,
vsf_usart_irq_mask_t  irq_mask 
)

Disable interrupt masks of USART instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
[in]irq_maskone or more values of enum vsf_usart_irq_mask_t
Returns
none

◆ vsf_usart_status()

vsf_usart_status_t vsf_usart_status ( vsf_usart_t usart_ptr)

Get the status of USART instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
vsf_usart_status_t: return all status of current USART

◆ vsf_usart_capability()

vsf_usart_capability_t vsf_usart_capability ( vsf_usart_t usart_ptr)

Get the capability of USART instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
vsf_usart_capability_t: return all capabilities of current USART vsf_usart_capability_t

◆ vsf_usart_rxfifo_get_data_count()

uint_fast16_t vsf_usart_rxfifo_get_data_count ( vsf_usart_t usart_ptr)

Get the number of data currently received in the USART receive FIFO.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
uint_fast32_t: the number of data currently in the USART receive queue

◆ vsf_usart_rxfifo_read()

uint_fast16_t vsf_usart_rxfifo_read ( vsf_usart_t usart_ptr,
void *  buffer_ptr,
uint_fast16_t  count 
)

◆ vsf_usart_txfifo_get_free_count()

uint_fast16_t vsf_usart_txfifo_get_free_count ( vsf_usart_t usart_ptr)

Get the maximum number of data that can be sent through the USART send FIFO.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
uint_fast32_t: return the maximum number of bytes that can be sent through the current USART send FIFO

◆ vsf_usart_txfifo_write()

uint_fast16_t vsf_usart_txfifo_write ( vsf_usart_t usart_ptr,
void *  buffer_ptr,
uint_fast16_t  count 
)

◆ vsf_usart_request_rx()

vsf_err_t vsf_usart_request_rx ( vsf_usart_t usart_ptr,
void *  buffer_ptr,
uint_fast32_t  count 
)

Request a DMA receive operation through the USART.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
[in]buffer_ptrPointer to the receive buffer
[in]countNumber of bytes to receive
Returns
vsf_err_t: VSF_ERR_NONE if the receive request was successfully started, otherwise returns error code
Note
This is an asynchronous operation

◆ vsf_usart_request_tx()

vsf_err_t vsf_usart_request_tx ( vsf_usart_t usart_ptr,
void *  buffer_ptr,
uint_fast32_t  count 
)

Request a DMA transmit operation through the USART.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
[in]buffer_ptrPointer to the transmit buffer
[in]countNumber of bytes to transmit
Returns
vsf_err_t: VSF_ERR_NONE if the transmit request was successfully started, otherwise returns error code
Note
This is an asynchronous operation

◆ vsf_usart_cancel_rx()

vsf_err_t vsf_usart_cancel_rx ( vsf_usart_t usart_ptr)

Cancel an ongoing USART receive operation.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
vsf_err_t: VSF_ERR_NONE if the receive operation was successfully cancelled, otherwise returns error code

◆ vsf_usart_cancel_tx()

vsf_err_t vsf_usart_cancel_tx ( vsf_usart_t usart_ptr)

Cancel an ongoing USART transmit operation.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
vsf_err_t: VSF_ERR_NONE if the transmit operation was successfully cancelled, otherwise returns error code

◆ vsf_usart_get_rx_count()

int_fast32_t vsf_usart_get_rx_count ( vsf_usart_t usart_ptr)

Get the number of bytes received in the current or last USART operation.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
int_fast32_t: Number of received bytes, negative value for error

◆ vsf_usart_get_tx_count()

int_fast32_t vsf_usart_get_tx_count ( vsf_usart_t usart_ptr)

Get the number of bytes transmitted in the current or last USART operation.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
int_fast32_t: Number of transmitted bytes, negative value for error

◆ vsf_usart_ctrl()

vsf_err_t vsf_usart_ctrl ( vsf_usart_t usart_ptr,
vsf_usart_ctrl_t  ctrl,
void *  param 
)

Execute a control command on the USART instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
[in]ctrlControl command from vsf_usart_ctrl_t enumeration
[in,out]paramCommand-specific parameter (can be NULL depending on command)
Returns
vsf_err_t: VSF_ERR_NONE if control command executed successfully, otherwise returns error code
Note
Available commands and their parameters depend on hardware support
Generated from commit: vsfteam/vsf@2b286be