RTEMS: UART Line Interface

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
UART Line Interface
Board Support Packages » ARM » Intel Cyclone V » Contributed Code » UART Driver API

## Typedefs
typedef enum ALT_16550_DATABITS_e | ALT_16550_DATABITS_t
typedef enum ALT_16550_STOPBITS_e | ALT_16550_STOPBITS_t
typedef enum ALT_16550_PARITY_e | ALT_16550_PARITY_t
typedef enum ALT_16550_LINE_STATUS_e | ALT_16550_LINE_STATUS_t

## Enumerations
enum | ALT_16550_DATABITS_e { ALT_16550_DATABITS_5 = 0 , ALT_16550_DATABITS_6 = 1 , ALT_16550_DATABITS_7 = 2 , ALT_16550_DATABITS_8 = 3 }
enum | ALT_16550_STOPBITS_e { ALT_16550_STOPBITS_1 = 0 , ALT_16550_STOPBITS_2 = 1 }
enum | ALT_16550_PARITY_e { ALT_16550_PARITY_DISABLE = 0 , ALT_16550_PARITY_ODD = 1 , ALT_16550_PARITY_EVEN = 2 }
enum | ALT_16550_LINE_STATUS_e { ALT_16550_LINE_STATUS_RFE = 1 << 7 , ALT_16550_LINE_STATUS_TEMT = 1 << 6 , ALT_16550_LINE_STATUS_THRE = 1 << 5 , ALT_16550_LINE_STATUS_BI = 1 << 4 , ALT_16550_LINE_STATUS_FE = 1 << 3 , ALT_16550_LINE_STATUS_PE = 1 << 2 , ALT_16550_LINE_STATUS_OE = 1 << 1 , ALT_16550_LINE_STATUS_DR = 1 << 0 }

## Functions
ALT_STATUS_CODE | alt_16550_line_config_set (ALT_16550_HANDLE_t *handle, ALT_16550_DATABITS_t databits, ALT_16550_PARITY_t parity, ALT_16550_STOPBITS_t stopbits)
ALT_STATUS_CODE | alt_16550_line_break_enable (ALT_16550_HANDLE_t *handle)
ALT_STATUS_CODE | alt_16550_line_break_disable (ALT_16550_HANDLE_t *handle)
ALT_STATUS_CODE | alt_16550_line_status_get (ALT_16550_HANDLE_t *handle, uint32_t *status)

## Detailed Description

This group of APIs provides access, configuration, and control of the UART Line interface.

## Typedef Documentation

## ◆ ALT_16550_DATABITS_t

typedef enum ALT_16550_DATABITS_e ALT_16550_DATABITS_t

This type definition enumerates the supported databits per frame.

## ◆ ALT_16550_LINE_STATUS_t

typedef enum ALT_16550_LINE_STATUS_e ALT_16550_LINE_STATUS_t

This type definition enumerates the set of UART line status conditions as register mask values.

## ◆ ALT_16550_PARITY_t

typedef enum ALT_16550_PARITY_e ALT_16550_PARITY_t

This type definition enumerates the possible parity to use per frame.

## ◆ ALT_16550_STOPBITS_t

typedef enum ALT_16550_STOPBITS_e ALT_16550_STOPBITS_t

This type definition enumerates the supported stopbits per frame.

## Enumeration Type Documentation

## ◆ ALT_16550_DATABITS_e

enum ALT_16550_DATABITS_e

This type definition enumerates the supported databits per frame.

Enumerator
ALT_16550_DATABITS_5 | This option selects 5 databits per frame.
ALT_16550_DATABITS_6 | This option selects 6 databits per frame.
ALT_16550_DATABITS_7 | This option selects 7 databits per frame.
ALT_16550_DATABITS_8 | This option selects 8 databits per frame.

## ◆ ALT_16550_LINE_STATUS_e

enum ALT_16550_LINE_STATUS_e

This type definition enumerates the set of UART line status conditions as register mask values.

Enumerator
ALT_16550_LINE_STATUS_RFE | Receiver FIFO Error. This status indicates that one or more parity error, framing error, or break indication exists in the receiver FIFO. It is only set when FIFO is enabled. This status cleared when line status is read, the character with the issue is at the top of the FIFO, and when no other issues exist in the FIFO.
ALT_16550_LINE_STATUS_TEMT | Transmitter EMpTy (Empty). This status indicates that transmitter shift register is empty. If FIFOs are enabled, the status is set when the transmitter FIFO is also empty. This status is cleared when the transmitter shift registers is loaded by writing to the UART transmitter buffer or transmitter FIFO if FIFOs are enabled. This is done by calling alt_16550_write() and alt_16550_fifo_write() respectively.
ALT_16550_LINE_STATUS_THRE | Transmitter Holding Register Empty. This status indicates that the transmitter will run out of data soon. The definition of soon depends on whether the FIFOs are enabled. If FIFOs are disabled, this status indicates that the transmitter will run out of data to send after the current transmit shift register completes. In this case, this status is cleared when the data is written to the UART. This can be done by calling alt_16550_write(). If FIFOs are enabled, this status indicates that the transmitter FIFO level is below the transmitter trigger level specified. In this case, this status is cleared by writing a sufficiently large buffer to the transmitter FIFO such that the FIFO is filled above the transmitter trigger level specified by calling alt_16550_fifo_write() or by adjusting the transmitter trigger level appropriately by calling alt_16550_fifo_trigger_set_tx().
ALT_16550_LINE_STATUS_BI | Break Interrupt. This status indicates that a break interrupt sequence is detected in the incoming serial data. This happens when the the data is 0 for longer than a frame would normally be transmitted. The break interrupt status is cleared by reading the line status by calling alt_16550_line_status_get(). If FIFOs are enabled, this status will be set when the character with the break interrupt status is at the top of the receiver FIFO.
ALT_16550_LINE_STATUS_FE | Framing Error. This status indicates that a framing error occurred in the receiver. This happens when the receiver detects a missing or incorrect number of stopbit(s). If FIFOs are enabled, this status will be set when the character with the framing error is at the top of the FIFO. When a framing error occurs, the UART attempts to resynchronize with the transmitting UART. This status is also set if break interrupt occurred.
ALT_16550_LINE_STATUS_PE | Parity Error. This status indicates that a parity error occurred in the receiver. If FIFOs are enabled, this status will be set when the character with the parity error is at the top of the receiver FIFO. This status is also set if a break interrupt occurred.
ALT_16550_LINE_STATUS_OE | Overrun Error. This status indicates that an overrun occurred in the receiver. If FIFOs are disabled, the arriving character will overwrite the existing character in the receiver. Any previously existing character(s) will be lost. If FIFOs are disabled, the arriving character will be discarded. The buffer will continue to contain the preexisting characters.
ALT_16550_LINE_STATUS_DR | Data Ready. This status indicates that the receiver or receiver FIFO contains at least one character.

## ◆ ALT_16550_PARITY_e

enum ALT_16550_PARITY_e

This type definition enumerates the possible parity to use per frame.

Enumerator
ALT_16550_PARITY_DISABLE | This option disables the parity error detection bit in the data frame.
ALT_16550_PARITY_ODD | This option enables the odd parity error detection bit in the data frame.
ALT_16550_PARITY_EVEN | This option enables the even parity error detection bit in the data frame.

## ◆ ALT_16550_STOPBITS_e

enum ALT_16550_STOPBITS_e

This type definition enumerates the supported stopbits per frame.

Enumerator
ALT_16550_STOPBITS_1 | This options specifies 1 stopbit per frame.
ALT_16550_STOPBITS_2 | This options specifies 2 stopbits per frame. If the frame is configured with 5 databits, 1.5 stopbits is used instead.

## Function Documentation

## ◆ alt_16550_line_break_disable()

ALT_STATUS_CODE alt_16550_line_break_disable | ( | ALT_16550_HANDLE_t * | handle | ) |

Stops transmitting a break condition.

Parameters

  handle | The UART device handle.

Return values

  ALT_E_SUCCESS | The operation was successful.
  ALT_E_ERROR | The operation failed.
  ALT_E_BAD_ARG | The given UART device handle is invalid.

## ◆ alt_16550_line_break_enable()

ALT_STATUS_CODE alt_16550_line_break_enable | ( | ALT_16550_HANDLE_t * | handle | ) |

Starts transmitting a break condition by transmitting a logic 0 state longer than a frame would normally be transmitted.

Parameters

  handle | The UART device handle.

Return values

  ALT_E_SUCCESS | The operation was successful.
  ALT_E_ERROR | The operation failed.
  ALT_E_BAD_ARG | The given UART device handle is invalid.

## ◆ alt_16550_line_config_set()

ALT_STATUS_CODE alt_16550_line_config_set | ( | ALT_16550_HANDLE_t * | handle,
|  | ALT_16550_DATABITS_t | databits,
|  | ALT_16550_PARITY_t | parity,
|  | ALT_16550_STOPBITS_t | stopbits
| ) |  |

Sets the configuration for a given character frame.

Parameters

  handle | The UART device handle.
  databits | The number of databits for each character frame.
  parity | The parity to use for each character frame.
  stopbits | The number of stopbits for each character frame.

Return values

  ALT_E_SUCCESS | The operation was successful.
  ALT_E_ERROR | The operation failed.
  ALT_E_BAD_ARG | The given UART device handle is invalid.

## ◆ alt_16550_line_status_get()

ALT_STATUS_CODE alt_16550_line_status_get | ( | ALT_16550_HANDLE_t * | handle,
|  | uint32_t * | status
| ) |  |

Reads the line status from the UART.

Parameters

  handle | The UART device handle.
  status | [out] Pointer to an output parameter that contains the current line status of the UART.

Return values

  ALT_E_SUCCESS | The operation was successful.
  ALT_E_ERROR | The operation failed.
  ALT_E_BAD_ARG | The given UART device handle is invalid.