M480 BSP V3.05.006
The Board Support Package for M480 Series
Macros | Functions

Macros

#define UART_BAUD_MODE0_DIVIDER(u32SrcFreq, u32BaudRate)
 Calculate UART baudrate mode0 divider. More...
 
#define UART_BAUD_MODE2_DIVIDER(u32SrcFreq, u32BaudRate)
 Calculate UART baudrate mode2 divider. More...
 
#define UART_WRITE(uart, u8Data)
 Write UART data. More...
 
#define UART_READ(uart)
 Read UART data. More...
 
#define UART_GET_TX_EMPTY(uart)
 Get Tx empty. More...
 
#define UART_GET_RX_EMPTY(uart)
 Get Rx empty. More...
 
#define UART_IS_TX_EMPTY(uart)
 Check specified UART port transmission is over. More...
 
#define UART_WAIT_TX_EMPTY(uart)
 Wait specified UART port transmission is over. More...
 
#define UART_IS_RX_READY(uart)
 Check RX is ready or not. More...
 
#define UART_IS_TX_FULL(uart)
 Check TX FIFO is full or not. More...
 
#define UART_IS_RX_FULL(uart)
 Check RX FIFO is full or not. More...
 
#define UART_GET_TX_FULL(uart)
 Get Tx full register value. More...
 
#define UART_GET_RX_FULL(uart)
 Get Rx full register value. More...
 
#define UART_ENABLE_INT(uart, u32eIntSel)
 Enable specified UART interrupt. More...
 
#define UART_DISABLE_INT(uart, u32eIntSel)
 Disable specified UART interrupt. More...
 
#define UART_GET_INT_FLAG(uart, u32eIntTypeFlag)
 Get specified interrupt flag/status. More...
 
#define UART_RS485_CLEAR_ADDR_FLAG(uart)
 Clear RS-485 Address Byte Detection Flag. More...
 
#define UART_RS485_GET_ADDR_FLAG(uart)
 Get RS-485 Address Byte Detection Flag. More...
 
#define UART_PDMA_ENABLE(uart, u32FuncSel)
 Enable specified UART PDMA function. More...
 
#define UART_PDMA_DISABLE(uart, u32FuncSel)
 Disable specified UART PDMA function. More...
 

Functions

__STATIC_INLINE void UART_CLEAR_RTS (UART_T *uart)
 Set RTS pin to low. More...
 
__STATIC_INLINE void UART_SET_RTS (UART_T *uart)
 Set RTS pin to high. More...
 
void UART_ClearIntFlag (UART_T *uart, uint32_t u32InterruptFlag)
 Clear UART specified interrupt flag. More...
 
void UART_Close (UART_T *uart)
 Disable UART interrupt. More...
 
void UART_DisableFlowCtrl (UART_T *uart)
 Disable UART auto flow control function. More...
 
void UART_DisableInt (UART_T *uart, uint32_t u32InterruptFlag)
 Disable UART specified interrupt. More...
 
void UART_EnableFlowCtrl (UART_T *uart)
 Enable UART auto flow control function. More...
 
void UART_EnableInt (UART_T *uart, uint32_t u32InterruptFlag)
 The function is used to enable UART specified interrupt and enable NVIC UART IRQ. More...
 
void UART_Open (UART_T *uart, uint32_t u32baudrate)
 Open and set UART function. More...
 
uint32_t UART_Read (UART_T *uart, uint8_t pu8RxBuf[], uint32_t u32ReadBytes)
 Read UART data. More...
 
void UART_SetLineConfig (UART_T *uart, uint32_t u32baudrate, uint32_t u32data_width, uint32_t u32parity, uint32_t u32stop_bits)
 Set UART line configuration. More...
 
void UART_SetTimeoutCnt (UART_T *uart, uint32_t u32TOC)
 Set Rx timeout count. More...
 
void UART_SelectIrDAMode (UART_T *uart, uint32_t u32Buadrate, uint32_t u32Direction)
 Select and configure IrDA function. More...
 
void UART_SelectRS485Mode (UART_T *uart, uint32_t u32Mode, uint32_t u32Addr)
 Select and configure RS485 function. More...
 
void UART_SelectLINMode (UART_T *uart, uint32_t u32Mode, uint32_t u32BreakLength)
 Select and configure LIN function. More...
 
uint32_t UART_Write (UART_T *uart, uint8_t pu8TxBuf[], uint32_t u32WriteBytes)
 Write UART data. More...
 

Detailed Description

Macro Definition Documentation

◆ UART_BAUD_MODE0_DIVIDER

#define UART_BAUD_MODE0_DIVIDER (   u32SrcFreq,
  u32BaudRate 
)

Calculate UART baudrate mode0 divider.

Parameters
[in]u32SrcFreqUART clock frequency
[in]u32BaudRateBaudrate of UART module
Returns
UART baudrate mode0 divider

This macro calculate UART baudrate mode0 divider.

Definition at line 135 of file uart.h.

◆ UART_BAUD_MODE2_DIVIDER

#define UART_BAUD_MODE2_DIVIDER (   u32SrcFreq,
  u32BaudRate 
)

Calculate UART baudrate mode2 divider.

Parameters
[in]u32SrcFreqUART clock frequency
[in]u32BaudRateBaudrate of UART module
Returns
UART baudrate mode2 divider

This macro calculate UART baudrate mode2 divider.

Definition at line 149 of file uart.h.

◆ UART_DISABLE_INT

#define UART_DISABLE_INT (   uart,
  u32eIntSel 
)

Disable specified UART interrupt.

Parameters
[in]uartThe pointer of the specified UART module
[in]u32eIntSelInterrupt type select
Returns
None

This macro enable specified UART interrupt.

Definition at line 348 of file uart.h.

◆ UART_ENABLE_INT

#define UART_ENABLE_INT (   uart,
  u32eIntSel 
)

Enable specified UART interrupt.

Parameters
[in]uartThe pointer of the specified UART module
[in]u32eIntSelInterrupt type select
Returns
None

This macro enable specified UART interrupt.

Definition at line 325 of file uart.h.

◆ UART_GET_INT_FLAG

#define UART_GET_INT_FLAG (   uart,
  u32eIntTypeFlag 
)

Get specified interrupt flag/status.

Parameters
[in]uartThe pointer of the specified UART module
[in]u32eIntTypeFlagInterrupt Type Flag, should be
Return values
0The specified interrupt is not happened. 1 The specified interrupt is happened.

This macro get specified interrupt flag or interrupt indicator status.

Definition at line 385 of file uart.h.

◆ UART_GET_RX_EMPTY

#define UART_GET_RX_EMPTY (   uart)

Get Rx empty.

Parameters
[in]uartThe pointer of the specified UART module
Return values
0Rx FIFO is not empty
>=1Rx FIFO is empty

This macro get Receiver FIFO empty register value.

Definition at line 204 of file uart.h.

◆ UART_GET_RX_FULL

#define UART_GET_RX_FULL (   uart)

Get Rx full register value.

Parameters
[in]uartThe pointer of the specified UART module
Return values
0Rx FIFO is not full.
>=1Rx FIFO is full.

This macro get Rx full register value.

Definition at line 302 of file uart.h.

◆ UART_GET_TX_EMPTY

#define UART_GET_TX_EMPTY (   uart)

Get Tx empty.

Parameters
[in]uartThe pointer of the specified UART module
Return values
0Tx FIFO is not empty
>=1Tx FIFO is empty

This macro get Transmitter FIFO empty register value.

Definition at line 190 of file uart.h.

◆ UART_GET_TX_FULL

#define UART_GET_TX_FULL (   uart)

Get Tx full register value.

Parameters
[in]uartThe pointer of the specified UART module
Return values
0Tx FIFO is not full.
>=1Tx FIFO is full.

This macro get Tx full register value.

Definition at line 288 of file uart.h.

◆ UART_IS_RX_FULL

#define UART_IS_RX_FULL (   uart)

Check RX FIFO is full or not.

Parameters
[in]uartThe pointer of the specified UART module
Return values
1RX FIFO is full
0RX FIFO is not full

This macro check RX FIFO is full or not.

Definition at line 274 of file uart.h.

◆ UART_IS_RX_READY

#define UART_IS_RX_READY (   uart)

Check RX is ready or not.

Parameters
[in]uartThe pointer of the specified UART module
Return values
0The number of bytes in the RX FIFO is less than the RFITL
1The number of bytes in the RX FIFO equals or larger than RFITL

This macro check receive data available interrupt flag is set or not.

Definition at line 246 of file uart.h.

◆ UART_IS_TX_EMPTY

#define UART_IS_TX_EMPTY (   uart)

Check specified UART port transmission is over.

Parameters
[in]uartThe pointer of the specified UART module
Return values
0Tx transmission is not over
1Tx transmission is over

This macro return Transmitter Empty Flag register bit value. It indicates if specified UART port transmission is over nor not.

Definition at line 219 of file uart.h.

◆ UART_IS_TX_FULL

#define UART_IS_TX_FULL (   uart)

Check TX FIFO is full or not.

Parameters
[in]uartThe pointer of the specified UART module
Return values
1TX FIFO is full
0TX FIFO is not full

This macro check TX FIFO is full or not.

Definition at line 260 of file uart.h.

◆ UART_PDMA_DISABLE

#define UART_PDMA_DISABLE (   uart,
  u32FuncSel 
)

Disable specified UART PDMA function.

Parameters
[in]uartThe pointer of the specified UART module
[in]u32FuncSelCombination of following functions
Returns
None

Definition at line 474 of file uart.h.

◆ UART_PDMA_ENABLE

#define UART_PDMA_ENABLE (   uart,
  u32FuncSel 
)

Enable specified UART PDMA function.

Parameters
[in]uartThe pointer of the specified UART module
[in]u32FuncSelCombination of following functions
Returns
None

Definition at line 461 of file uart.h.

◆ UART_READ

#define UART_READ (   uart)

Read UART data.

Parameters
[in]uartThe pointer of the specified UART module
Returns
The oldest data byte in RX FIFO.

This macro read Rx data register.

Definition at line 176 of file uart.h.

◆ UART_RS485_CLEAR_ADDR_FLAG

#define UART_RS485_CLEAR_ADDR_FLAG (   uart)

Clear RS-485 Address Byte Detection Flag.

Parameters
[in]uartThe pointer of the specified UART module
Returns
None

This macro clear RS-485 address byte detection flag.

Definition at line 398 of file uart.h.

◆ UART_RS485_GET_ADDR_FLAG

#define UART_RS485_GET_ADDR_FLAG (   uart)

Get RS-485 Address Byte Detection Flag.

Parameters
[in]uartThe pointer of the specified UART module
Return values
0Receiver detects a data that is not an address bit.
1Receiver detects a data that is an address bit.

This macro get RS-485 address byte detection flag.

Definition at line 412 of file uart.h.

◆ UART_WAIT_TX_EMPTY

#define UART_WAIT_TX_EMPTY (   uart)

Wait specified UART port transmission is over.

Parameters
[in]uartThe pointer of the specified UART module
Returns
None

This macro wait specified UART port transmission is over.

Definition at line 232 of file uart.h.

◆ UART_WRITE

#define UART_WRITE (   uart,
  u8Data 
)

Write UART data.

Parameters
[in]uartThe pointer of the specified UART module
[in]u8DataData byte to transmit.
Returns
None

This macro write Data to Tx data register.

Definition at line 163 of file uart.h.

Function Documentation

◆ UART_CLEAR_RTS()

__STATIC_INLINE void UART_CLEAR_RTS ( UART_T uart)

Set RTS pin to low.

Parameters
[in]uartThe pointer of the specified UART module
Returns
None

This macro set RTS pin to low.

Definition at line 428 of file uart.h.

◆ UART_ClearIntFlag()

void UART_ClearIntFlag ( UART_T uart,
uint32_t  u32InterruptFlag 
)

Clear UART specified interrupt flag.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32InterruptFlagThe specified interrupt of UART module.
Returns
None

The function is used to clear UART specified interrupt flag.

Definition at line 41 of file uart.c.

◆ UART_Close()

void UART_Close ( UART_T uart)

Disable UART interrupt.

Parameters
[in]uartThe pointer of the specified UART module.
Returns
None

The function is used to disable UART interrupt.

Definition at line 89 of file uart.c.

◆ UART_DisableFlowCtrl()

void UART_DisableFlowCtrl ( UART_T uart)

Disable UART auto flow control function.

Parameters
[in]uartThe pointer of the specified UART module.
Returns
None

The function is used to disable UART auto flow control.

Definition at line 104 of file uart.c.

◆ UART_DisableInt()

void UART_DisableInt ( UART_T uart,
uint32_t  u32InterruptFlag 
)

Disable UART specified interrupt.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32InterruptFlagThe specified interrupt of UART module.
Returns
None

The function is used to disable UART specified interrupt and disable NVIC UART IRQ.

Definition at line 128 of file uart.c.

◆ UART_EnableFlowCtrl()

void UART_EnableFlowCtrl ( UART_T uart)

Enable UART auto flow control function.

Parameters
[in]uartThe pointer of the specified UART module.
Returns
None

The function is used to Enable UART auto flow control.

Definition at line 144 of file uart.c.

◆ UART_EnableInt()

void UART_EnableInt ( UART_T uart,
uint32_t  u32InterruptFlag 
)

The function is used to enable UART specified interrupt and enable NVIC UART IRQ.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32InterruptFlagThe specified interrupt of UART module:
Returns
None

The function is used to enable UART specified interrupt and enable NVIC UART IRQ.

Definition at line 175 of file uart.c.

◆ UART_Open()

void UART_Open ( UART_T uart,
uint32_t  u32baudrate 
)

Open and set UART function.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32baudrateThe baudrate of UART module.
Returns
None

This function use to enable UART function and set baud-rate.

Definition at line 192 of file uart.c.

◆ UART_Read()

uint32_t UART_Read ( UART_T uart,
uint8_t  pu8RxBuf[],
uint32_t  u32ReadBytes 
)

Read UART data.

Parameters
[in]uartThe pointer of the specified UART module.
[in]pu8RxBufThe buffer to receive the data of receive FIFO.
[in]u32ReadBytesThe the read bytes number of data.
Returns
u32Count Receive byte count

The function is used to read Rx data from RX FIFO and the data will be stored in pu8RxBuf.

Definition at line 299 of file uart.c.

◆ UART_SelectIrDAMode()

void UART_SelectIrDAMode ( UART_T uart,
uint32_t  u32Buadrate,
uint32_t  u32Direction 
)

Select and configure IrDA function.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32BuadrateThe baudrate of UART module.
[in]u32DirectionThe direction of UART module in IrDA mode:
Returns
None

The function is used to configure IrDA relative settings. It consists of TX or RX mode and baudrate.

Definition at line 488 of file uart.c.

◆ UART_SelectLINMode()

void UART_SelectLINMode ( UART_T uart,
uint32_t  u32Mode,
uint32_t  u32BreakLength 
)

Select and configure LIN function.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32ModeThe LIN direction :
[in]u32BreakLengthThe break field length.
Returns
None

The function is used to set LIN relative setting.

Definition at line 631 of file uart.c.

◆ UART_SelectRS485Mode()

void UART_SelectRS485Mode ( UART_T uart,
uint32_t  u32Mode,
uint32_t  u32Addr 
)

Select and configure RS485 function.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32ModeThe operation mode(NMM/AUD/AAD).
[in]u32AddrThe RS485 address.
Returns
None

The function is used to set RS485 relative setting.

Definition at line 607 of file uart.c.

◆ UART_SET_RTS()

__STATIC_INLINE void UART_SET_RTS ( UART_T uart)

Set RTS pin to high.

Parameters
[in]uartThe pointer of the specified UART module
Returns
None

This macro set RTS pin to high.

Definition at line 444 of file uart.h.

◆ UART_SetLineConfig()

void UART_SetLineConfig ( UART_T uart,
uint32_t  u32baudrate,
uint32_t  u32data_width,
uint32_t  u32parity,
uint32_t  u32stop_bits 
)

Set UART line configuration.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32baudrateThe register value of baudrate of UART module. If u32baudrate = 0, UART baudrate will not change.
[in]u32data_widthThe data length of UART module.
[in]u32parityThe parity setting (none/odd/even/mark/space) of UART module.
[in]u32stop_bitsThe stop bit length (1/1.5/2 bit) of UART module.
Returns
None

This function use to config UART line setting.

Definition at line 362 of file uart.c.

◆ UART_SetTimeoutCnt()

void UART_SetTimeoutCnt ( UART_T uart,
uint32_t  u32TOC 
)

Set Rx timeout count.

Parameters
[in]uartThe pointer of the specified UART module.
[in]u32TOCRx timeout counter.
Returns
None

This function use to set Rx timeout count.

Definition at line 465 of file uart.c.

◆ UART_Write()

uint32_t UART_Write ( UART_T uart,
uint8_t  pu8TxBuf[],
uint32_t  u32WriteBytes 
)

Write UART data.

Parameters
[in]uartThe pointer of the specified UART module.
[in]pu8TxBufThe buffer to send the data to UART transmission FIFO.
[out]u32WriteBytesThe byte number of data.
Returns
u32Count transfer byte count

The function is to write data into TX buffer to transmit data by UART.

Definition at line 653 of file uart.c.