RTEMS  5.0.0
Functions
uart.c File Reference
#include "chip.h"
#include <assert.h>
#include <string.h>

Functions

void UART_Configure (Uart *uart, uint32_t mode, uint32_t baudrate, uint32_t masterClock)
 Configures an UART peripheral with the specified parameters. More...
 
void UART_SetTransmitterEnabled (Uart *uart, uint8_t enabled)
 Enables or disables the transmitter of an UART peripheral. More...
 
void UART_SetReceiverEnabled (Uart *uart, uint8_t enabled)
 Enables or disables the receiver of an UART peripheral. More...
 
uint32_t UART_IsRxReady (Uart *uart)
 Return 1 if a character can be read in UART. More...
 
uint8_t UART_GetChar (Uart *uart)
 Reads and returns a character from the UART. More...
 
uint32_t UART_IsTxReady (Uart *uart)
 Return 1 if a character can be send to UART. More...
 
void UART_PutChar (Uart *uart, uint8_t c)
 Sends one packet of data through the specified UART peripheral. This function operates synchronously, so it only returns when the data has been actually sent. More...
 
uint32_t UART_GetStatus (Uart *uart)
 Get present status. More...
 
void UART_EnableIt (Uart *uart, uint32_t mode)
 Enable interrupt. More...
 
void UART_DisableIt (Uart *uart, uint32_t mode)
 Disable interrupt. More...
 
uint32_t UART_GetItMask (Uart *uart)
 Return interrupt mask. More...
 
void UART_SendBuffer (Uart *uart, uint8_t *pBuffer, uint32_t BuffLen)
 
void UART_ReceiveBuffer (Uart *uart, uint8_t *pBuffer, uint32_t BuffLen)
 
void UART_CompareConfig (Uart *uart, uint8_t Val1, uint8_t Val2)
 

Detailed Description

Implementation of UART (Universal Asynchronous Receiver Transmitter) controller.

Function Documentation

◆ UART_Configure()

void UART_Configure ( Uart uart,
uint32_t  mode,
uint32_t  baudrate,
uint32_t  masterClock 
)

Configures an UART peripheral with the specified parameters.

Parameters
uartPointer to the UART peripheral to configure.
modeDesired value for the UART mode register (see the datasheet).
baudrateBaudrate at which the UART should operate (in Hz).
masterClockFrequency of the system master clock (in Hz).

◆ UART_DisableIt()

void UART_DisableIt ( Uart uart,
uint32_t  mode 
)

Disable interrupt.

Parameters
uartPointer to an UART peripheral.
modeInterrupt mode.

◆ UART_EnableIt()

void UART_EnableIt ( Uart uart,
uint32_t  mode 
)

Enable interrupt.

Parameters
uartPointer to an UART peripheral.
modeInterrupt mode.

◆ UART_GetChar()

uint8_t UART_GetChar ( Uart uart)

Reads and returns a character from the UART.

Note
This function is synchronous (i.e. uses polling).
Parameters
uartPointer to an UART peripheral.
Returns
Character received.

◆ UART_GetItMask()

uint32_t UART_GetItMask ( Uart uart)

Return interrupt mask.

Parameters
uartPointer to an UART peripheral.

◆ UART_GetStatus()

uint32_t UART_GetStatus ( Uart uart)

Get present status.

Parameters
uartPointer to an UART peripheral.

◆ UART_IsRxReady()

uint32_t UART_IsRxReady ( Uart uart)

Return 1 if a character can be read in UART.

Parameters
uartPointer to an UART peripheral.

◆ UART_IsTxReady()

uint32_t UART_IsTxReady ( Uart uart)

Return 1 if a character can be send to UART.

Parameters
uartPointer to an UART peripheral.

◆ UART_PutChar()

void UART_PutChar ( Uart uart,
uint8_t  c 
)

Sends one packet of data through the specified UART peripheral. This function operates synchronously, so it only returns when the data has been actually sent.

Parameters
uartPointer to an UART peripheral.
cCharacter to send

◆ UART_SetReceiverEnabled()

void UART_SetReceiverEnabled ( Uart uart,
uint8_t  enabled 
)

Enables or disables the receiver of an UART peripheral.

Parameters
uartPointer to an UART peripheral
enabledIf true, the receiver is enabled; otherwise it is disabled.

◆ UART_SetTransmitterEnabled()

void UART_SetTransmitterEnabled ( Uart uart,
uint8_t  enabled 
)

Enables or disables the transmitter of an UART peripheral.

Parameters
uartPointer to an UART peripheral
enabledIf true, the transmitter is enabled; otherwise it is disabled.