ModusToolbox Safety Test Library
Loading...
Searching...
No Matches

General Description

Functions

void UartMesMaster_Init (CySCB_Type *uart_base, TCPWM_Type *counter_base, uint32_t cntNum)
 Initializes the UART master protocol unit.
void UartMesMaster_DeInit (void)
 De-initializes the UART master protocol unit.
uint8_t UartMesMaster_DataProc (uint8_t address, uint8_t *txd, uint8_t tlen, uint8_t *rxd, uint8_t rlen)
 Starts the background process of the packet's transmission.
uint8_t UartMesMaster_State (void)
 Returns the current master unit state.
uint8_t UartMesMaster_GetDataSize (void)
 Returns the size of the received data.
void UartMesMaster_Timeout_ISR (void)
 UART timer guard interrupt.
void UartMesMaster_Msg_ISR (void)
 Interrupt handler for UART to receive/transmit.

Function Documentation

◆ UartMesMaster_Init()

void UartMesMaster_Init ( CySCB_Type * uart_base,
TCPWM_Type * counter_base,
uint32_t cntNum )

Initializes the UART master protocol unit.

This function starts the required components and initializes the control status structure.

Note
This function enables the UART peripheral, clears TX/RX FIFOs, and sets the interrupt masks used by the message protocol. Use a UART instance dedicated to this protocol or reinitialize the application UART configuration after calling UartMesMaster_DeInit.
Parameters
uart_baseThe pointer to the master UART SCB instance.
counter_baseThe pointer to the master TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.

◆ UartMesMaster_DeInit()

void UartMesMaster_DeInit ( void )

De-initializes the UART master protocol unit.

Disables all TX/RX interrupts, flushes the FIFOs, stops the guard timer, disables the UART peripheral, and resets the internal control status structure.

◆ UartMesMaster_DataProc()

uint8_t UartMesMaster_DataProc ( uint8_t address,
uint8_t * txd,
uint8_t tlen,
uint8_t * rxd,
uint8_t rlen )

Starts the background process of the packet's transmission.

Parameters
addressSlave address for data transfer.
txdThe pointer to transmitted data.
tlenThe size of transmitted data in bytes.
rxdThe pointer to the buffer where the received data will be stored.
rlenThe size of the received data buffer.
Note
This function starts an interrupt-driven background transaction. Do not call it again while UartMesMaster_State returns UM_BUSY. The txd and rxd buffers must remain valid and unmodified until the state becomes UM_COMPLETE or UM_ERROR.
Returns
UART_MASTER_MESSAGE_STARTED_STATUS (0) - The unit started a message process
UART_MASTER_MESSAGE_NOT_STARTED_STATUS (1) - The unit did not start a message process
Note
Use UartMesMaster_State() to check busy state

◆ UartMesMaster_State()

uint8_t UartMesMaster_State ( void )

Returns the current master unit state.

Returns
UM_ERROR - The last message process ended with an error (the slave did not respond or teh invalid format of responded data).
UM_COMPLETE - The last message process succeeded (responded data is in the received buffer).
UM_BUSY - The unit is busy with the message process.

◆ UartMesMaster_GetDataSize()

uint8_t UartMesMaster_GetDataSize ( void )

Returns the size of the received data.

Returns
Received the data size in the buffer.
Note
The result is valid only if the unit state is UM_COMPLETE. Use UartMesMaster_State() to check this condition.

◆ UartMesMaster_Timeout_ISR()

void UartMesMaster_Timeout_ISR ( void )

UART timer guard interrupt.

This function provides the timeout control when data is sent but the response is not received after the packet transaction.