RTEMS: bsps/arm/atsam/contrib/libraries/libchip/source/uart.c File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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.
void | UART_SetTransmitterEnabled (Uart *uart, uint8_t enabled)
| Enables or disables the transmitter of an UART peripheral.
void | UART_SetReceiverEnabled (Uart *uart, uint8_t enabled)
| Enables or disables the receiver of an UART peripheral.
uint32_t | UART_IsRxReady (Uart *uart)
| Return 1 if a character can be read in UART.
uint8_t | UART_GetChar (Uart *uart)
| Reads and returns a character from the UART.
uint32_t | UART_IsTxReady (Uart *uart)
| Return 1 if a character can be send to UART.
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.
uint32_t | UART_GetStatus (Uart *uart)
| Get present status.
void | UART_EnableIt (Uart *uart, uint32_t mode)
| Enable interrupt.
void | UART_DisableIt (Uart *uart, uint32_t mode)
| Disable interrupt.
uint32_t | UART_GetItMask (Uart *uart)
| Return interrupt mask.
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

  uart | Pointer to the UART peripheral to configure.
  mode | Desired value for the UART mode register (see the datasheet).
  baudrate | Baudrate at which the UART should operate (in Hz).
  masterClock | Frequency of the system master clock (in Hz).

## ◆ UART_DisableIt()

void UART_DisableIt | ( | Uart * | uart,
|  | uint32_t | mode
| ) |  |

Disable interrupt.

Parameters

  uart | Pointer to an UART peripheral.
  mode | Interrupt mode.

## ◆ UART_EnableIt()

void UART_EnableIt | ( | Uart * | uart,
|  | uint32_t | mode
| ) |  |

Enable interrupt.

Parameters

  uart | Pointer to an UART peripheral.
  mode | Interrupt 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

  uart | Pointer to an UART peripheral.

Returns
  Character received.

## ◆ UART_GetItMask()

uint32_t UART_GetItMask | ( | Uart * | uart | ) |

Return interrupt mask.

Parameters

  uart | Pointer to an UART peripheral.

## ◆ UART_GetStatus()

uint32_t UART_GetStatus | ( | Uart * | uart | ) |

Get present status.

Parameters

  uart | Pointer to an UART peripheral.

## ◆ UART_IsRxReady()

uint32_t UART_IsRxReady | ( | Uart * | uart | ) |

Return 1 if a character can be read in UART.

Parameters

  uart | Pointer to an UART peripheral.

## ◆ UART_IsTxReady()

uint32_t UART_IsTxReady | ( | Uart * | uart | ) |

Return 1 if a character can be send to UART.

Parameters

  uart | Pointer 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

  uart | Pointer to an UART peripheral.
  c | Character to send

## ◆ UART_SetReceiverEnabled()

void UART_SetReceiverEnabled | ( | Uart * | uart,
|  | uint8_t | enabled
| ) |  |

Enables or disables the receiver of an UART peripheral.

Parameters

  uart | Pointer to an UART peripheral
  enabled | If 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

  uart | Pointer to an UART peripheral
  enabled | If true, the transmitter is enabled; otherwise it is disabled.