RTEMS  5.0.0
Typedefs | Enumerations | Functions

Typedefs

typedef enum ALT_16550_BAUDRATE_e ALT_16550_BAUDRATE_t
 

Enumerations

enum  ALT_16550_BAUDRATE_e {
  ALT_16550_BAUDRATE_50 = 50, ALT_16550_BAUDRATE_75 = 75, ALT_16550_BAUDRATE_150 = 150, ALT_16550_BAUDRATE_300 = 300,
  ALT_16550_BAUDRATE_600 = 600, ALT_16550_BAUDRATE_900 = 900, ALT_16550_BAUDRATE_1200 = 1200, ALT_16550_BAUDRATE_1800 = 1800,
  ALT_16550_BAUDRATE_2400 = 2400, ALT_16550_BAUDRATE_3600 = 3600, ALT_16550_BAUDRATE_4800 = 4800, ALT_16550_BAUDRATE_7200 = 7200,
  ALT_16550_BAUDRATE_9600 = 9600, ALT_16550_BAUDRATE_14400 = 14400, ALT_16550_BAUDRATE_19200 = 19200, ALT_16550_BAUDRATE_28800 = 28800,
  ALT_16550_BAUDRATE_38400 = 38400, ALT_16550_BAUDRATE_57600 = 57600, ALT_16550_BAUDRATE_115200 = 115200
}
 

Functions

ALT_STATUS_CODE alt_16550_baudrate_get (ALT_16550_HANDLE_t *handle, uint32_t *baudrate)
 
ALT_STATUS_CODE alt_16550_baudrate_set (ALT_16550_HANDLE_t *handle, uint32_t baudrate)
 
ALT_STATUS_CODE alt_16550_divisor_get (ALT_16550_HANDLE_t *handle, uint32_t *divisor)
 
ALT_STATUS_CODE alt_16550_divisor_set (ALT_16550_HANDLE_t *handle, uint32_t divisor)
 

Detailed Description

This group of APIs allows for the configuration of the UART's baudrate generation related functions.

The UART baudrate is determined by dividing the ALT_CLK_L4_SP clock with the configured divisor.

Typedef Documentation

◆ ALT_16550_BAUDRATE_t

This enumeration lists out the common baudrates used with modem and serial ports. Not every baudrate is available for the UART due to the limits of the serial clock frequency and divisor value.

Enumeration Type Documentation

◆ ALT_16550_BAUDRATE_e

This enumeration lists out the common baudrates used with modem and serial ports. Not every baudrate is available for the UART due to the limits of the serial clock frequency and divisor value.

Enumerator
ALT_16550_BAUDRATE_50 

50 bps baudrate.

ALT_16550_BAUDRATE_75 

75 bps baudrate.

ALT_16550_BAUDRATE_150 

150 bps baudrate.

ALT_16550_BAUDRATE_300 

300 bps baudrate.

ALT_16550_BAUDRATE_600 

600 bps baudrate.

ALT_16550_BAUDRATE_900 

900 bps baudrate.

ALT_16550_BAUDRATE_1200 

1200 bps baudrate.

ALT_16550_BAUDRATE_1800 

1800 bps baudrate.

ALT_16550_BAUDRATE_2400 

2400 bps baudrate.

ALT_16550_BAUDRATE_3600 

3600 bps baudrate.

ALT_16550_BAUDRATE_4800 

4800 bps baudrate.

ALT_16550_BAUDRATE_7200 

7200 bps baudrate.

ALT_16550_BAUDRATE_9600 

9600 bps baudrate.

ALT_16550_BAUDRATE_14400 

14400 bps baudrate.

ALT_16550_BAUDRATE_19200 

19200 bps baudrate.

ALT_16550_BAUDRATE_28800 

28800 bps baudrate.

ALT_16550_BAUDRATE_38400 

38400 bps baudrate.

ALT_16550_BAUDRATE_57600 

57600 bps baudrate.

ALT_16550_BAUDRATE_115200 

115200 bps baudrate.

Function Documentation

◆ alt_16550_baudrate_get()

ALT_STATUS_CODE alt_16550_baudrate_get ( ALT_16550_HANDLE_t handle,
uint32_t *  baudrate 
)

Gets the baudrate for the UART.

This is done by calculating the baudrate from the divisor and the serial clock. The reported baudrate may not correspond exactly to the request baudrate.

Parameters
handleThe UART device handle.
baudrate[out] Pointer to an output paramter that contains the current baudrate of the UART.
Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_ERRORThe operation failed.
ALT_E_BAD_ARGThe given UART device handle is invalid.

◆ alt_16550_baudrate_set()

ALT_STATUS_CODE alt_16550_baudrate_set ( ALT_16550_HANDLE_t handle,
uint32_t  baudrate 
)

Sets the baudrate for the UART. This change will take effect when the UART moves from disabled to enabled.

This is done by calculating the correct divisor using the request baudrate and the known serial clock.

Parameters
handleThe UART device handle.
baudrateThe requested baudrate for the UART.
Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_ERRORThe operation failed.
ALT_E_BAD_ARGThe given UART device handle is invalid.
ALT_E_ARG_RANGEThe given baudrate is not possible due to limitations of the baudrate divisor and/or serial clock.

◆ alt_16550_divisor_get()

ALT_STATUS_CODE alt_16550_divisor_get ( ALT_16550_HANDLE_t handle,
uint32_t *  divisor 
)

Gets the baudrate divisor for the UART.

The baudrate is determined by the following formula:

  • Baudrate = (serial clock frequency) / (16 * divisor)
Parameters
handleThe UART device handle.
divisor[out] Pointer to an output parameter that contains the current divisor used for baudrate generation.
Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_ERRORThe operation failed.
ALT_E_BAD_ARGThe given UART device handle is invalid.

◆ alt_16550_divisor_set()

ALT_STATUS_CODE alt_16550_divisor_set ( ALT_16550_HANDLE_t handle,
uint32_t  divisor 
)

Sets the baudrate divisor for the UART. This change will take effect when the UART moves from disabled to enabled.

The baudrate is determined by the following formula:

  • Baudrate = (serial clock frequency) / (16 * divisor)
Parameters
handleThe UART device handle.
divisorThe specified divisor value to use for baudrate generation. Valid values are 1 - 65535.
Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_ERRORThe operation failed.
ALT_E_BAD_ARGThe given UART identifier is invalid or the specified divisor is not supported by the UART.