EE445M RTOS
Taken at the University of Texas Spring 2015
Uart_api

Macros

#define UART_CLK_DIVIDER   8
 

Functions

static uint32_t _UARTIntNumberGet (uint32_t ui32Base)
 
void UARTParityModeSet (uint32_t ui32Base, uint32_t ui32Parity)
 
uint32_t UARTParityModeGet (uint32_t ui32Base)
 
void UARTFIFOLevelSet (uint32_t ui32Base, uint32_t ui32TxLevel, uint32_t ui32RxLevel)
 
void UARTFIFOLevelGet (uint32_t ui32Base, uint32_t *pui32TxLevel, uint32_t *pui32RxLevel)
 
void UARTConfigSetExpClk (uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t ui32Baud, uint32_t ui32Config)
 
void UARTConfigGetExpClk (uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t *pui32Baud, uint32_t *pui32Config)
 
void UARTEnable (uint32_t ui32Base)
 
void UARTDisable (uint32_t ui32Base)
 
void UARTFIFOEnable (uint32_t ui32Base)
 
void UARTFIFODisable (uint32_t ui32Base)
 
void UARTEnableSIR (uint32_t ui32Base, bool bLowPower)
 
void UARTDisableSIR (uint32_t ui32Base)
 
void UARTSmartCardEnable (uint32_t ui32Base)
 
void UARTSmartCardDisable (uint32_t ui32Base)
 
void UARTModemControlSet (uint32_t ui32Base, uint32_t ui32Control)
 
void UARTModemControlClear (uint32_t ui32Base, uint32_t ui32Control)
 
uint32_t UARTModemControlGet (uint32_t ui32Base)
 
uint32_t UARTModemStatusGet (uint32_t ui32Base)
 
void UARTFlowControlSet (uint32_t ui32Base, uint32_t ui32Mode)
 
uint32_t UARTFlowControlGet (uint32_t ui32Base)
 
void UARTTxIntModeSet (uint32_t ui32Base, uint32_t ui32Mode)
 
uint32_t UARTTxIntModeGet (uint32_t ui32Base)
 
bool UARTCharsAvail (uint32_t ui32Base)
 
bool UARTSpaceAvail (uint32_t ui32Base)
 
int32_t UARTCharGetNonBlocking (uint32_t ui32Base)
 
int32_t UARTCharGet (uint32_t ui32Base)
 
bool UARTCharPutNonBlocking (uint32_t ui32Base, unsigned char ucData)
 
void UARTCharPut (uint32_t ui32Base, unsigned char ucData)
 
void UARTBreakCtl (uint32_t ui32Base, bool bBreakState)
 
bool UARTBusy (uint32_t ui32Base)
 
void UARTIntRegister (uint32_t ui32Base, void(*pfnHandler)(void))
 
void UARTIntUnregister (uint32_t ui32Base)
 
void UARTIntEnable (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void UARTIntDisable (uint32_t ui32Base, uint32_t ui32IntFlags)
 
uint32_t UARTIntStatus (uint32_t ui32Base, bool bMasked)
 
void UARTIntClear (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void UARTDMAEnable (uint32_t ui32Base, uint32_t ui32DMAFlags)
 
void UARTDMADisable (uint32_t ui32Base, uint32_t ui32DMAFlags)
 
uint32_t UARTRxErrorGet (uint32_t ui32Base)
 
void UARTRxErrorClear (uint32_t ui32Base)
 
void UARTClockSourceSet (uint32_t ui32Base, uint32_t ui32Source)
 
uint32_t UARTClockSourceGet (uint32_t ui32Base)
 
void UART9BitEnable (uint32_t ui32Base)
 
void UART9BitDisable (uint32_t ui32Base)
 
void UART9BitAddrSet (uint32_t ui32Base, uint8_t ui8Addr, uint8_t ui8Mask)
 
void UART9BitAddrSend (uint32_t ui32Base, uint8_t ui8Addr)
 

Variables

static const uint32_t g_ppui32UARTIntMap [][2]
 
static const uint_fast8_t g_ui8UARTIntMapRows
 
static const uint32_t g_ppui32UARTIntMapSnowflake [][2]
 
static const uint_fast8_t g_ui8UARTIntMapRowsSnowflake
 

Detailed Description

Macro Definition Documentation

#define UART_CLK_DIVIDER   8

Definition at line 64 of file uart.c.

Referenced by UARTConfigSetExpClk().

Function Documentation

static uint32_t _UARTIntNumberGet ( uint32_t  ui32Base)
static

Definition at line 137 of file uart.c.

References CLASS_IS_TM4C129, g_ppui32UARTIntMap, g_ppui32UARTIntMapSnowflake, g_ui8UARTIntMapRows, and g_ui8UARTIntMapRowsSnowflake.

Referenced by UARTIntRegister(), and UARTIntUnregister().

138 {
139  uint_fast8_t ui8Idx, ui8Rows;
140  const uint32_t (*ppui32UARTIntMap)[2];
141 
142  //
143  // Default interrupt map.
144  //
145  ppui32UARTIntMap = g_ppui32UARTIntMap;
146  ui8Rows = g_ui8UARTIntMapRows;
147 
148  if(CLASS_IS_TM4C129)
149  {
150  ppui32UARTIntMap = g_ppui32UARTIntMapSnowflake;
152  }
153 
154  //
155  // Loop through the table that maps UART base addresses to interrupt
156  // numbers.
157  //
158  for(ui8Idx = 0; ui8Idx < ui8Rows; ui8Idx++)
159  {
160  //
161  // See if this base address matches.
162  //
163  if(ppui32UARTIntMap[ui8Idx][0] == ui32Base)
164  {
165  //
166  // Return the corresponding interrupt number.
167  //
168  return(ppui32UARTIntMap[ui8Idx][1]);
169  }
170  }
171 
172  //
173  // The base address could not be found, so return an error.
174  //
175  return(0);
176 }
static const uint32_t g_ppui32UARTIntMap[][2]
Definition: uart.c:71
static const uint_fast8_t g_ui8UARTIntMapRowsSnowflake
Definition: uart.c:95
#define CLASS_IS_TM4C129
Definition: hw_types.h:99
static const uint32_t g_ppui32UARTIntMapSnowflake[][2]
Definition: uart.c:84
static const uint_fast8_t g_ui8UARTIntMapRows
Definition: uart.c:82

Here is the caller graph for this function:

void UART9BitAddrSend ( uint32_t  ui32Base,
uint8_t  ui8Addr 
)

Sends an address character from the specified port when operating in 9-bit mode.

Parameters
ui32Baseis the base address of the UART port.
ui8Addris the address to be transmitted.

This function waits until all data has been sent from the specified port and then sends the given address as an address byte. It then waits until the address byte has been transmitted before returning.

The normal data functions (UARTCharPut(), UARTCharPutNonBlocking(), UARTCharGet(), and UARTCharGetNonBlocking()) are used to send and receive data characters in 9-bit mode.

Note
The availability of 9-bit mode varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1910 of file uart.c.

References ASSERT, HWREG, UART_FR_BUSY, UART_FR_TXFE, UART_LCRH_EPS, UART_LCRH_PEN, UART_LCRH_SPS, UART_O_DR, UART_O_FR, and UART_O_LCRH.

1911 {
1912  uint32_t ui32LCRH;
1913 
1914  //
1915  // Check the arguments.
1916  //
1917  ASSERT(_UARTBaseValid(ui32Base));
1918 
1919  //
1920  // Wait until the FIFO is empty and the UART is not busy.
1921  //
1922  while((HWREG(ui32Base + UART_O_FR) & (UART_FR_TXFE | UART_FR_BUSY)) !=
1923  UART_FR_TXFE)
1924  {
1925  }
1926 
1927  //
1928  // Force the address/data bit to 1 to indicate this is an address byte.
1929  //
1930  ui32LCRH = HWREG(ui32Base + UART_O_LCRH);
1931  HWREG(ui32Base + UART_O_LCRH) = ((ui32LCRH & ~UART_LCRH_EPS) |
1933 
1934  //
1935  // Send the address.
1936  //
1937  HWREG(ui32Base + UART_O_DR) = ui8Addr;
1938 
1939  //
1940  // Wait until the address has been sent.
1941  //
1942  while((HWREG(ui32Base + UART_O_FR) & (UART_FR_TXFE | UART_FR_BUSY)) !=
1943  UART_FR_TXFE)
1944  {
1945  }
1946 
1947  //
1948  // Restore the address/data setting.
1949  //
1950  HWREG(ui32Base + UART_O_LCRH) = ui32LCRH;
1951 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_FR_TXFE
Definition: hw_uart.h:105
#define UART_O_LCRH
Definition: hw_uart.h:56
#define ASSERT(expr)
Definition: debug.h:67
#define UART_FR_BUSY
Definition: hw_uart.h:109
#define UART_LCRH_EPS
Definition: hw_uart.h:151
#define UART_O_DR
Definition: hw_uart.h:48
#define UART_LCRH_PEN
Definition: hw_uart.h:152
#define UART_LCRH_SPS
Definition: hw_uart.h:143
#define UART_O_FR
Definition: hw_uart.h:51
void UART9BitAddrSet ( uint32_t  ui32Base,
uint8_t  ui8Addr,
uint8_t  ui8Mask 
)

Sets the device address(es) for 9-bit mode.

Parameters
ui32Baseis the base address of the UART port.
ui8Addris the device address.
ui8Maskis the device address mask.

This function configures the device address or range of device addresses that respond to requests on the 9-bit UART port. The received address is masked with the mask and then compared against the given address, allowing either a single address (if ui8Mask is 0xff) or a set of addresses to be matched.

Note
The availability of 9-bit mode varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1871 of file uart.c.

References ASSERT, HWREG, UART_9BITADDR_ADDR_S, UART_9BITAMASK_MASK_S, UART_O_9BITADDR, and UART_O_9BITAMASK.

1873 {
1874  //
1875  // Check the arguments.
1876  //
1877  ASSERT(_UARTBaseValid(ui32Base));
1878 
1879  //
1880  // Set the address and mask.
1881  //
1882  HWREG(ui32Base + UART_O_9BITADDR) = ui8Addr << UART_9BITADDR_ADDR_S;
1883  HWREG(ui32Base + UART_O_9BITAMASK) = ui8Mask << UART_9BITAMASK_MASK_S;
1884 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_9BITADDR_ADDR_S
Definition: hw_uart.h:336
#define UART_O_9BITADDR
Definition: hw_uart.h:64
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_9BITAMASK
Definition: hw_uart.h:65
#define UART_9BITAMASK_MASK_S
Definition: hw_uart.h:345
void UART9BitDisable ( uint32_t  ui32Base)

Disables 9-bit mode on the specified UART.

Parameters
ui32Baseis the base address of the UART port.

This function disables the 9-bit operational mode of the UART.

Note
The availability of 9-bit mode varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1836 of file uart.c.

References ASSERT, HWREG, UART_9BITADDR_9BITEN, and UART_O_9BITADDR.

1837 {
1838  //
1839  // Check the arguments.
1840  //
1841  ASSERT(_UARTBaseValid(ui32Base));
1842 
1843  //
1844  // Disable 9-bit mode.
1845  //
1846  HWREG(ui32Base + UART_O_9BITADDR) &= ~UART_9BITADDR_9BITEN;
1847 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_9BITADDR_9BITEN
Definition: hw_uart.h:334
#define UART_O_9BITADDR
Definition: hw_uart.h:64
#define ASSERT(expr)
Definition: debug.h:67
void UART9BitEnable ( uint32_t  ui32Base)

Enables 9-bit mode on the specified UART.

Parameters
ui32Baseis the base address of the UART port.

This function enables the 9-bit operational mode of the UART.

Note
The availability of 9-bit mode varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1807 of file uart.c.

References ASSERT, HWREG, UART_9BITADDR_9BITEN, and UART_O_9BITADDR.

1808 {
1809  //
1810  // Check the arguments.
1811  //
1812  ASSERT(_UARTBaseValid(ui32Base));
1813 
1814  //
1815  // Enable 9-bit mode.
1816  //
1818 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_9BITADDR_9BITEN
Definition: hw_uart.h:334
#define UART_O_9BITADDR
Definition: hw_uart.h:64
#define ASSERT(expr)
Definition: debug.h:67
void UARTBreakCtl ( uint32_t  ui32Base,
bool  bBreakState 
)

Causes a BREAK to be sent.

Parameters
ui32Baseis the base address of the UART port.
bBreakStatecontrols the output level.

Calling this function with bBreakState set to true asserts a break condition on the UART. Calling this function with bBreakState set to false removes the break condition. For proper transmission of a break command, the break must be asserted for at least two complete frames.

Returns
None.

Definition at line 1304 of file uart.c.

References ASSERT, HWREG, UART_LCRH_BRK, and UART_O_LCRH.

1305 {
1306  //
1307  // Check the arguments.
1308  //
1309  ASSERT(_UARTBaseValid(ui32Base));
1310 
1311  //
1312  // Set the break condition as requested.
1313  //
1314  HWREG(ui32Base + UART_O_LCRH) =
1315  (bBreakState ?
1316  (HWREG(ui32Base + UART_O_LCRH) | UART_LCRH_BRK) :
1317  (HWREG(ui32Base + UART_O_LCRH) & ~(UART_LCRH_BRK)));
1318 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_LCRH_BRK
Definition: hw_uart.h:153
#define UART_O_LCRH
Definition: hw_uart.h:56
#define ASSERT(expr)
Definition: debug.h:67
bool UARTBusy ( uint32_t  ui32Base)

Determines whether the UART transmitter is busy or not.

Parameters
ui32Baseis the base address of the UART port.

This function allows the caller to determine whether all transmitted bytes have cleared the transmitter hardware. If false is returned, the transmit FIFO is empty and all bits of the last transmitted character, including all stop bits, have left the hardware shift register.

Returns
Returns true if the UART is transmitting or false if all transmissions are complete.

Definition at line 1336 of file uart.c.

References ASSERT, HWREG, UART_FR_BUSY, and UART_O_FR.

1337 {
1338  //
1339  // Check the argument.
1340  //
1341  ASSERT(_UARTBaseValid(ui32Base));
1342 
1343  //
1344  // Determine if the UART is busy.
1345  //
1346  return((HWREG(ui32Base + UART_O_FR) & UART_FR_BUSY) ? true : false);
1347 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_FR_BUSY
Definition: hw_uart.h:109
#define UART_O_FR
Definition: hw_uart.h:51
int32_t UARTCharGet ( uint32_t  ui32Base)

Waits for a character from the specified port.

Parameters
ui32Baseis the base address of the UART port.

This function gets a character from the receive FIFO for the specified port. If there are no characters available, this function waits until a character is received before returning.

Returns
Returns the character read from the specified port, cast as a int32_t.

Definition at line 1184 of file uart.c.

References ASSERT, HWREG, UART_FR_RXFE, UART_O_DR, and UART_O_FR.

Referenced by uart_get_string_().

1185 {
1186  //
1187  // Check the arguments.
1188  //
1189  ASSERT(_UARTBaseValid(ui32Base));
1190 
1191  //
1192  // Wait until a char is available.
1193  //
1194  while(HWREG(ui32Base + UART_O_FR) & UART_FR_RXFE)
1195  {
1196  }
1197 
1198  //
1199  // Now get the char.
1200  //
1201  return(HWREG(ui32Base + UART_O_DR));
1202 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_DR
Definition: hw_uart.h:48
#define UART_FR_RXFE
Definition: hw_uart.h:108
#define UART_O_FR
Definition: hw_uart.h:51

Here is the caller graph for this function:

int32_t UARTCharGetNonBlocking ( uint32_t  ui32Base)

Receives a character from the specified port.

Parameters
ui32Baseis the base address of the UART port.

This function gets a character from the receive FIFO for the specified port.

Returns
Returns the character read from the specified port, cast as a int32_t. A -1 is returned if there are no characters present in the receive FIFO. The UARTCharsAvail() function should be called before attempting to call this function.

Definition at line 1143 of file uart.c.

References ASSERT, HWREG, UART_FR_RXFE, UART_O_DR, and UART_O_FR.

Referenced by UART0_Handler(), and uart_get_char_().

1144 {
1145  //
1146  // Check the arguments.
1147  //
1148  ASSERT(_UARTBaseValid(ui32Base));
1149 
1150  //
1151  // See if there are any characters in the receive FIFO.
1152  //
1153  if(!(HWREG(ui32Base + UART_O_FR) & UART_FR_RXFE))
1154  {
1155  //
1156  // Read and return the next character.
1157  //
1158  return(HWREG(ui32Base + UART_O_DR));
1159  }
1160  else
1161  {
1162  //
1163  // There are no characters, so return a failure.
1164  //
1165  return(-1);
1166  }
1167 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_DR
Definition: hw_uart.h:48
#define UART_FR_RXFE
Definition: hw_uart.h:108
#define UART_O_FR
Definition: hw_uart.h:51

Here is the caller graph for this function:

void UARTCharPut ( uint32_t  ui32Base,
unsigned char  ucData 
)

Waits to send a character from the specified port.

Parameters
ui32Baseis the base address of the UART port.
ucDatais the character to be transmitted.

This function sends the character ucData to the transmit FIFO for the specified port. If there is no space available in the transmit FIFO, this function waits until there is space available before returning.

Returns
None.

Definition at line 1268 of file uart.c.

References ASSERT, HWREG, UART_FR_TXFF, UART_O_DR, and UART_O_FR.

Referenced by doctor(), UART0_Handler(), uart_consumer(), uart_send_char_(), and uart_send_string_().

1269 {
1270  //
1271  // Check the arguments.
1272  //
1273  ASSERT(_UARTBaseValid(ui32Base));
1274 
1275  //
1276  // Wait until space is available.
1277  //
1278  while(HWREG(ui32Base + UART_O_FR) & UART_FR_TXFF)
1279  {
1280  }
1281 
1282  //
1283  // Send the char.
1284  //
1285  HWREG(ui32Base + UART_O_DR) = ucData;
1286 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_DR
Definition: hw_uart.h:48
#define UART_O_FR
Definition: hw_uart.h:51
#define UART_FR_TXFF
Definition: hw_uart.h:107

Here is the caller graph for this function:

bool UARTCharPutNonBlocking ( uint32_t  ui32Base,
unsigned char  ucData 
)

Sends a character to the specified port.

Parameters
ui32Baseis the base address of the UART port.
ucDatais the character to be transmitted.

This function writes the character ucData to the transmit FIFO for the specified port. This function does not block, so if there is no space available, then a false is returned and the application must retry the function later.

Returns
Returns true if the character was successfully placed in the transmit FIFO or false if there was no space available in the transmit FIFO.

Definition at line 1222 of file uart.c.

References ASSERT, HWREG, UART_FR_TXFF, UART_O_DR, and UART_O_FR.

1223 {
1224  //
1225  // Check the arguments.
1226  //
1227  ASSERT(_UARTBaseValid(ui32Base));
1228 
1229  //
1230  // See if there is space in the transmit FIFO.
1231  //
1232  if(!(HWREG(ui32Base + UART_O_FR) & UART_FR_TXFF))
1233  {
1234  //
1235  // Write this character to the transmit FIFO.
1236  //
1237  HWREG(ui32Base + UART_O_DR) = ucData;
1238 
1239  //
1240  // Success.
1241  //
1242  return(true);
1243  }
1244  else
1245  {
1246  //
1247  // There is no space in the transmit FIFO, so return a failure.
1248  //
1249  return(false);
1250  }
1251 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_DR
Definition: hw_uart.h:48
#define UART_O_FR
Definition: hw_uart.h:51
#define UART_FR_TXFF
Definition: hw_uart.h:107
bool UARTCharsAvail ( uint32_t  ui32Base)

Determines if there are any characters in the receive FIFO.

Parameters
ui32Baseis the base address of the UART port.

This function returns a flag indicating whether or not there is data available in the receive FIFO.

Returns
Returns true if there is data in the receive FIFO or false if there is no data in the receive FIFO.

Definition at line 1087 of file uart.c.

References ASSERT, HWREG, UART_FR_RXFE, and UART_O_FR.

Referenced by s_Handler(), UART0_Handler(), and uart_get_string_().

1088 {
1089  //
1090  // Check the arguments.
1091  //
1092  ASSERT(_UARTBaseValid(ui32Base));
1093 
1094  //
1095  // Return the availability of characters.
1096  //
1097  return((HWREG(ui32Base + UART_O_FR) & UART_FR_RXFE) ? false : true);
1098 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_FR_RXFE
Definition: hw_uart.h:108
#define UART_O_FR
Definition: hw_uart.h:51

Here is the caller graph for this function:

uint32_t UARTClockSourceGet ( uint32_t  ui32Base)

Gets the baud clock source for the specified UART.

Parameters
ui32Baseis the base address of the UART port.

This function returns the baud clock source for the specified UART. The possible baud clock source are the system clock (UART_CLOCK_SYSTEM) or the precision internal oscillator (UART_CLOCK_PIOSC).

Note
The ability to specify the UART baud clock source varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1778 of file uart.c.

References ASSERT, HWREG, and UART_O_CC.

1779 {
1780  //
1781  // Check the arguments.
1782  //
1783  ASSERT(_UARTBaseValid(ui32Base));
1784 
1785  //
1786  // Return the UART clock source.
1787  //
1788  return(HWREG(ui32Base + UART_O_CC));
1789 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_CC
Definition: hw_uart.h:67
void UARTClockSourceSet ( uint32_t  ui32Base,
uint32_t  ui32Source 
)

Sets the baud clock source for the specified UART.

Parameters
ui32Baseis the base address of the UART port.
ui32Sourceis the baud clock source for the UART.

This function allows the baud clock source for the UART to be selected. The possible clock source are the system clock (UART_CLOCK_SYSTEM) or the precision internal oscillator (UART_CLOCK_PIOSC).

Changing the baud clock source changes the baud rate generated by the UART. Therefore, the baud rate should be reconfigured after any change to the baud clock source.

Note
The ability to specify the UART baud clock source varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1745 of file uart.c.

References ASSERT, HWREG, UART_CLOCK_PIOSC, UART_CLOCK_SYSTEM, and UART_O_CC.

1746 {
1747  //
1748  // Check the arguments.
1749  //
1750  ASSERT(_UARTBaseValid(ui32Base));
1751  ASSERT((ui32Source == UART_CLOCK_SYSTEM) ||
1752  (ui32Source == UART_CLOCK_PIOSC));
1753 
1754  //
1755  // Set the UART clock source.
1756  //
1757  HWREG(ui32Base + UART_O_CC) = ui32Source;
1758 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_CC
Definition: hw_uart.h:67
#define UART_CLOCK_PIOSC
Definition: uart.h:187
#define UART_CLOCK_SYSTEM
Definition: uart.h:186
void UARTConfigGetExpClk ( uint32_t  ui32Base,
uint32_t  ui32UARTClk,
uint32_t *  pui32Baud,
uint32_t *  pui32Config 
)

Gets the current configuration of a UART.

Parameters
ui32Baseis the base address of the UART port.
ui32UARTClkis the rate of the clock supplied to the UART module.
pui32Baudis a pointer to storage for the baud rate.
pui32Configis a pointer to storage for the data format.

This function determines the baud rate and data format for the UART, given an explicitly provided peripheral clock (hence the ExpClk suffix). The returned baud rate is the actual baud rate; it may not be the exact baud rate requested or an ``official'' baud rate. The data format returned in pui32Config is enumerated the same as the ui32Config parameter of UARTConfigSetExpClk().

The peripheral clock is the same as the processor clock. The frequency of the system clock is the value returned by SysCtlClockGet(), or it can be explicitly hard coded if it is constant and known (to save the code/execution overhead of a call to SysCtlClockGet()).

For Tiva parts that have the ability to specify the UART baud clock source (via UARTClockSourceSet()), the peripheral clock can be changed to PIOSC. In this case, the peripheral clock should be specified as 16,000,000 (the nominal rate of PIOSC).

Returns
None.

Definition at line 467 of file uart.c.

References ASSERT, HWREG, UART_CTL_HSE, UART_LCRH_EPS, UART_LCRH_PEN, UART_LCRH_SPS, UART_LCRH_STP2, UART_LCRH_WLEN_M, UART_O_CTL, UART_O_FBRD, UART_O_IBRD, and UART_O_LCRH.

469 {
470  uint32_t ui32Int, ui32Frac;
471 
472  //
473  // Check the arguments.
474  //
475  ASSERT(_UARTBaseValid(ui32Base));
476 
477  //
478  // Compute the baud rate.
479  //
480  ui32Int = HWREG(ui32Base + UART_O_IBRD);
481  ui32Frac = HWREG(ui32Base + UART_O_FBRD);
482  *pui32Baud = (ui32UARTClk * 4) / ((64 * ui32Int) + ui32Frac);
483 
484  //
485  // See if high speed mode enabled.
486  //
487  if(HWREG(ui32Base + UART_O_CTL) & UART_CTL_HSE)
488  {
489  //
490  // High speed mode is enabled so the actual baud rate is actually
491  // double what was just calculated.
492  //
493  *pui32Baud *= 2;
494  }
495 
496  //
497  // Get the parity, data length, and number of stop bits.
498  //
499  *pui32Config = (HWREG(ui32Base + UART_O_LCRH) &
502 }
#define UART_LCRH_STP2
Definition: hw_uart.h:150
#define UART_O_FBRD
Definition: hw_uart.h:54
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define ASSERT(expr)
Definition: debug.h:67
#define UART_LCRH_EPS
Definition: hw_uart.h:151
#define UART_LCRH_PEN
Definition: hw_uart.h:152
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_LCRH_SPS
Definition: hw_uart.h:143
#define UART_LCRH_WLEN_M
Definition: hw_uart.h:144
#define UART_CTL_HSE
Definition: hw_uart.h:167
#define UART_O_IBRD
Definition: hw_uart.h:53
void UARTConfigSetExpClk ( uint32_t  ui32Base,
uint32_t  ui32UARTClk,
uint32_t  ui32Baud,
uint32_t  ui32Config 
)

Sets the configuration of a UART.

Parameters
ui32Baseis the base address of the UART port.
ui32UARTClkis the rate of the clock supplied to the UART module.
ui32Baudis the desired baud rate.
ui32Configis the data format for the port (number of data bits, number of stop bits, and parity).

This function configures the UART for operation in the specified data format. The baud rate is provided in the ui32Baud parameter and the data format in the ui32Config parameter.

The ui32Config parameter is the logical OR of three values: the number of data bits, the number of stop bits, and the parity. UART_CONFIG_WLEN_8, UART_CONFIG_WLEN_7, UART_CONFIG_WLEN_6, and UART_CONFIG_WLEN_5 select from eight to five data bits per byte (respectively). UART_CONFIG_STOP_ONE and UART_CONFIG_STOP_TWO select one or two stop bits (respectively). UART_CONFIG_PAR_NONE, UART_CONFIG_PAR_EVEN, UART_CONFIG_PAR_ODD, UART_CONFIG_PAR_ONE, and UART_CONFIG_PAR_ZERO select the parity mode (no parity bit, even parity bit, odd parity bit, parity bit always one, and parity bit always zero, respectively).

The peripheral clock is the same as the processor clock. The frequency of the system clock is the value returned by SysCtlClockGet(), or it can be explicitly hard coded if it is constant and known (to save the code/execution overhead of a call to SysCtlClockGet()).

For Tiva parts that have the ability to specify the UART baud clock source (via UARTClockSourceSet()), the peripheral clock can be changed to PIOSC. In this case, the peripheral clock should be specified as 16,000,000 (the nominal rate of PIOSC).

Returns
None.

Definition at line 368 of file uart.c.

References ASSERT, HWREG, UART_CLK_DIVIDER, UART_CTL_HSE, UART_O_CTL, UART_O_FBRD, UART_O_FR, UART_O_IBRD, UART_O_LCRH, UARTDisable(), and UARTEnable().

Referenced by main(), and uart_init().

370 {
371  uint32_t ui32Div;
372 
373  //
374  // Check the arguments.
375  //
376  ASSERT(_UARTBaseValid(ui32Base));
377  ASSERT(ui32Baud != 0);
378  ASSERT(ui32UARTClk >= (ui32Baud * UART_CLK_DIVIDER));
379 
380  //
381  // Stop the UART.
382  //
383  UARTDisable(ui32Base);
384 
385  //
386  // Is the required baud rate greater than the maximum rate supported
387  // without the use of high speed mode?
388  //
389  if((ui32Baud * 16) > ui32UARTClk)
390  {
391  //
392  // Enable high speed mode.
393  //
394  HWREG(ui32Base + UART_O_CTL) |= UART_CTL_HSE;
395 
396  //
397  // Half the supplied baud rate to compensate for enabling high speed
398  // mode. This allows the following code to be common to both cases.
399  //
400  ui32Baud /= 2;
401  }
402  else
403  {
404  //
405  // Disable high speed mode.
406  //
407  HWREG(ui32Base + UART_O_CTL) &= ~(UART_CTL_HSE);
408  }
409 
410  //
411  // Compute the fractional baud rate divider.
412  //
413  ui32Div = (((ui32UARTClk * 8) / ui32Baud) + 1) / 2;
414 
415  //
416  // Set the baud rate.
417  //
418  HWREG(ui32Base + UART_O_IBRD) = ui32Div / 64;
419  HWREG(ui32Base + UART_O_FBRD) = ui32Div % 64;
420 
421  //
422  // Set parity, data length, and number of stop bits.
423  //
424  HWREG(ui32Base + UART_O_LCRH) = ui32Config;
425 
426  //
427  // Clear the flags register.
428  //
429  HWREG(ui32Base + UART_O_FR) = 0;
430 
431  //
432  // Start the UART.
433  //
434  UARTEnable(ui32Base);
435 }
#define UART_CLK_DIVIDER
Definition: uart.c:64
#define UART_O_FBRD
Definition: hw_uart.h:54
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define ASSERT(expr)
Definition: debug.h:67
void UARTDisable(uint32_t ui32Base)
Definition: uart.c:548
#define UART_O_CTL
Definition: hw_uart.h:57
void UARTEnable(uint32_t ui32Base)
Definition: uart.c:516
#define UART_O_FR
Definition: hw_uart.h:51
#define UART_CTL_HSE
Definition: hw_uart.h:167
#define UART_O_IBRD
Definition: hw_uart.h:53

Here is the call graph for this function:

Here is the caller graph for this function:

void UARTDisable ( uint32_t  ui32Base)

Disables transmitting and receiving.

Parameters
ui32Baseis the base address of the UART port.

This function disables the UART, waits for the end of transmission of the current character, and flushes the transmit FIFO.

Returns
None.

Definition at line 548 of file uart.c.

References ASSERT, HWREG, UART_CTL_RXE, UART_CTL_TXE, UART_CTL_UARTEN, UART_FR_BUSY, UART_LCRH_FEN, UART_O_CTL, UART_O_FR, and UART_O_LCRH.

Referenced by UARTConfigSetExpClk().

549 {
550  //
551  // Check the arguments.
552  //
553  ASSERT(_UARTBaseValid(ui32Base));
554 
555  //
556  // Wait for end of TX.
557  //
558  while(HWREG(ui32Base + UART_O_FR) & UART_FR_BUSY)
559  {
560  }
561 
562  //
563  // Disable the FIFO.
564  //
565  HWREG(ui32Base + UART_O_LCRH) &= ~(UART_LCRH_FEN);
566 
567  //
568  // Disable the UART.
569  //
570  HWREG(ui32Base + UART_O_CTL) &= ~(UART_CTL_UARTEN | UART_CTL_TXE |
571  UART_CTL_RXE);
572 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define UART_LCRH_FEN
Definition: hw_uart.h:149
#define ASSERT(expr)
Definition: debug.h:67
#define UART_CTL_RXE
Definition: hw_uart.h:164
#define UART_FR_BUSY
Definition: hw_uart.h:109
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_CTL_UARTEN
Definition: hw_uart.h:172
#define UART_O_FR
Definition: hw_uart.h:51
#define UART_CTL_TXE
Definition: hw_uart.h:165

Here is the caller graph for this function:

void UARTDisableSIR ( uint32_t  ui32Base)

Disables SIR (IrDA) mode on the specified UART.

Parameters
ui32Baseis the base address of the UART port.

This function disables SIR(IrDA) mode on the UART. This function only has an effect if the UART has not been enabled by a call to UARTEnable(). The call UARTEnableSIR() must be made before a call to UARTConfigSetExpClk() because the UARTConfigSetExpClk() function calls the UARTEnable() function. Another option is to call UARTDisable() followed by UARTEnableSIR() and then enable the UART by calling UARTEnable().

Note
The availability of SIR (IrDA) operation varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 688 of file uart.c.

References ASSERT, HWREG, UART_CTL_SIREN, UART_CTL_SIRLP, and UART_O_CTL.

689 {
690  //
691  // Check the arguments.
692  //
693  ASSERT(_UARTBaseValid(ui32Base));
694 
695  //
696  // Disable SIR and SIRLP (if appropriate).
697  //
698  HWREG(ui32Base + UART_O_CTL) &= ~(UART_CTL_SIREN | UART_CTL_SIRLP);
699 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_CTL_SIREN
Definition: hw_uart.h:171
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_CTL_SIRLP
Definition: hw_uart.h:170
void UARTDMADisable ( uint32_t  ui32Base,
uint32_t  ui32DMAFlags 
)

Disable UART uDMA operation.

Parameters
ui32Baseis the base address of the UART port.
ui32DMAFlagsis a bit mask of the uDMA features to disable.

This function is used to disable UART uDMA features that were enabled by UARTDMAEnable(). The specified UART uDMA features are disabled. The ui32DMAFlags parameter is the logical OR of any of the following values:

  • UART_DMA_RX - disable uDMA for receive
  • UART_DMA_TX - disable uDMA for transmit
  • UART_DMA_ERR_RXSTOP - do not disable uDMA receive on UART error
Returns
None.

Definition at line 1649 of file uart.c.

References ASSERT, HWREG, and UART_O_DMACTL.

1650 {
1651  //
1652  // Check the arguments.
1653  //
1654  ASSERT(_UARTBaseValid(ui32Base));
1655 
1656  //
1657  // Clear the requested bits in the UART uDMA control register.
1658  //
1659  HWREG(ui32Base + UART_O_DMACTL) &= ~ui32DMAFlags;
1660 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_DMACTL
Definition: hw_uart.h:63
void UARTDMAEnable ( uint32_t  ui32Base,
uint32_t  ui32DMAFlags 
)

Enable UART uDMA operation.

Parameters
ui32Baseis the base address of the UART port.
ui32DMAFlagsis a bit mask of the uDMA features to enable.

The specified UART uDMA features are enabled. The UART can be configured to use uDMA for transmit or receive and to disable receive if an error occurs. The ui32DMAFlags parameter is the logical OR of any of the following values:

  • UART_DMA_RX - enable uDMA for receive
  • UART_DMA_TX - enable uDMA for transmit
  • UART_DMA_ERR_RXSTOP - disable uDMA receive on UART error
Note
The uDMA controller must also be set up before DMA can be used with the UART.
Returns
None.

Definition at line 1617 of file uart.c.

References ASSERT, HWREG, and UART_O_DMACTL.

1618 {
1619  //
1620  // Check the arguments.
1621  //
1622  ASSERT(_UARTBaseValid(ui32Base));
1623 
1624  //
1625  // Set the requested bits in the UART uDMA control register.
1626  //
1627  HWREG(ui32Base + UART_O_DMACTL) |= ui32DMAFlags;
1628 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_DMACTL
Definition: hw_uart.h:63
void UARTEnable ( uint32_t  ui32Base)

Enables transmitting and receiving.

Parameters
ui32Baseis the base address of the UART port.

This function enables the UART and its transmit and receive FIFOs.

Returns
None.

Definition at line 516 of file uart.c.

References ASSERT, HWREG, UART_CTL_RXE, UART_CTL_TXE, UART_CTL_UARTEN, UART_LCRH_FEN, UART_O_CTL, and UART_O_LCRH.

Referenced by UARTConfigSetExpClk().

517 {
518  //
519  // Check the arguments.
520  //
521  ASSERT(_UARTBaseValid(ui32Base));
522 
523  //
524  // Enable the FIFO.
525  //
526  HWREG(ui32Base + UART_O_LCRH) |= UART_LCRH_FEN;
527 
528  //
529  // Enable RX, TX, and the UART.
530  //
531  HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_UARTEN | UART_CTL_TXE |
532  UART_CTL_RXE);
533 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define UART_LCRH_FEN
Definition: hw_uart.h:149
#define ASSERT(expr)
Definition: debug.h:67
#define UART_CTL_RXE
Definition: hw_uart.h:164
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_CTL_UARTEN
Definition: hw_uart.h:172
#define UART_CTL_TXE
Definition: hw_uart.h:165

Here is the caller graph for this function:

void UARTEnableSIR ( uint32_t  ui32Base,
bool  bLowPower 
)

Enables SIR (IrDA) mode on the specified UART.

Parameters
ui32Baseis the base address of the UART port.
bLowPowerindicates if SIR Low Power Mode is to be used.

This function enables SIR (IrDA) mode on the UART. If the bLowPower flag is set, then SIR low power mode will be selected as well. This function only has an effect if the UART has not been enabled by a call to UARTEnable(). The call UARTEnableSIR() must be made before a call to UARTConfigSetExpClk() because the UARTConfigSetExpClk() function calls the UARTEnable() function. Another option is to call UARTDisable() followed by UARTEnableSIR() and then enable the UART by calling UARTEnable().

Note
The availability of SIR (IrDA) operation varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 647 of file uart.c.

References ASSERT, HWREG, UART_CTL_SIREN, UART_CTL_SIRLP, and UART_O_CTL.

648 {
649  //
650  // Check the arguments.
651  //
652  ASSERT(_UARTBaseValid(ui32Base));
653 
654  //
655  // Enable SIR and SIRLP (if appropriate).
656  //
657  if(bLowPower)
658  {
659  HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_SIREN | UART_CTL_SIRLP);
660  }
661  else
662  {
663  HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_SIREN);
664  }
665 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_CTL_SIREN
Definition: hw_uart.h:171
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_CTL_SIRLP
Definition: hw_uart.h:170
void UARTFIFODisable ( uint32_t  ui32Base)

Disables the transmit and receive FIFOs.

Parameters
ui32Baseis the base address of the UART port.

This function disables the transmit and receive FIFOs in the UART.

Returns
None.

Definition at line 611 of file uart.c.

References ASSERT, HWREG, UART_LCRH_FEN, and UART_O_LCRH.

612 {
613  //
614  // Check the arguments.
615  //
616  ASSERT(_UARTBaseValid(ui32Base));
617 
618  //
619  // Disable the FIFO.
620  //
621  HWREG(ui32Base + UART_O_LCRH) &= ~(UART_LCRH_FEN);
622 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define UART_LCRH_FEN
Definition: hw_uart.h:149
#define ASSERT(expr)
Definition: debug.h:67
void UARTFIFOEnable ( uint32_t  ui32Base)

Enables the transmit and receive FIFOs.

Parameters
ui32Baseis the base address of the UART port.

This functions enables the transmit and receive FIFOs in the UART.

Returns
None.

Definition at line 586 of file uart.c.

References ASSERT, HWREG, UART_LCRH_FEN, and UART_O_LCRH.

587 {
588  //
589  // Check the arguments.
590  //
591  ASSERT(_UARTBaseValid(ui32Base));
592 
593  //
594  // Enable the FIFO.
595  //
596  HWREG(ui32Base + UART_O_LCRH) |= UART_LCRH_FEN;
597 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define UART_LCRH_FEN
Definition: hw_uart.h:149
#define ASSERT(expr)
Definition: debug.h:67
void UARTFIFOLevelGet ( uint32_t  ui32Base,
uint32_t *  pui32TxLevel,
uint32_t *  pui32RxLevel 
)

Gets the FIFO level at which interrupts are generated.

Parameters
ui32Baseis the base address of the UART port.
pui32TxLevelis a pointer to storage for the transmit FIFO level, returned as one of UART_FIFO_TX1_8, UART_FIFO_TX2_8, UART_FIFO_TX4_8, UART_FIFO_TX6_8, or UART_FIFO_TX7_8.
pui32RxLevelis a pointer to storage for the receive FIFO level, returned as one of UART_FIFO_RX1_8, UART_FIFO_RX2_8, UART_FIFO_RX4_8, UART_FIFO_RX6_8, or UART_FIFO_RX7_8.

This function gets the FIFO level at which transmit and receive interrupts are generated.

Returns
None.

Definition at line 307 of file uart.c.

References ASSERT, HWREG, UART_IFLS_RX_M, UART_IFLS_TX_M, and UART_O_IFLS.

309 {
310  uint32_t ui32Temp;
311 
312  //
313  // Check the arguments.
314  //
315  ASSERT(_UARTBaseValid(ui32Base));
316 
317  //
318  // Read the FIFO level register.
319  //
320  ui32Temp = HWREG(ui32Base + UART_O_IFLS);
321 
322  //
323  // Extract the transmit and receive FIFO levels.
324  //
325  *pui32TxLevel = ui32Temp & UART_IFLS_TX_M;
326  *pui32RxLevel = ui32Temp & UART_IFLS_RX_M;
327 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_IFLS_TX_M
Definition: hw_uart.h:186
#define UART_IFLS_RX_M
Definition: hw_uart.h:179
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_IFLS
Definition: hw_uart.h:58
void UARTFIFOLevelSet ( uint32_t  ui32Base,
uint32_t  ui32TxLevel,
uint32_t  ui32RxLevel 
)

Sets the FIFO level at which interrupts are generated.

Parameters
ui32Baseis the base address of the UART port.
ui32TxLevelis the transmit FIFO interrupt level, specified as one of UART_FIFO_TX1_8, UART_FIFO_TX2_8, UART_FIFO_TX4_8, UART_FIFO_TX6_8, or UART_FIFO_TX7_8.
ui32RxLevelis the receive FIFO interrupt level, specified as one of UART_FIFO_RX1_8, UART_FIFO_RX2_8, UART_FIFO_RX4_8, UART_FIFO_RX6_8, or UART_FIFO_RX7_8.

This function configures the FIFO level at which transmit and receive interrupts are generated.

Returns
None.

Definition at line 264 of file uart.c.

References ASSERT, HWREG, UART_FIFO_RX1_8, UART_FIFO_RX2_8, UART_FIFO_RX4_8, UART_FIFO_RX6_8, UART_FIFO_RX7_8, UART_FIFO_TX1_8, UART_FIFO_TX2_8, UART_FIFO_TX4_8, UART_FIFO_TX6_8, UART_FIFO_TX7_8, and UART_O_IFLS.

266 {
267  //
268  // Check the arguments.
269  //
270  ASSERT(_UARTBaseValid(ui32Base));
271  ASSERT((ui32TxLevel == UART_FIFO_TX1_8) ||
272  (ui32TxLevel == UART_FIFO_TX2_8) ||
273  (ui32TxLevel == UART_FIFO_TX4_8) ||
274  (ui32TxLevel == UART_FIFO_TX6_8) ||
275  (ui32TxLevel == UART_FIFO_TX7_8));
276  ASSERT((ui32RxLevel == UART_FIFO_RX1_8) ||
277  (ui32RxLevel == UART_FIFO_RX2_8) ||
278  (ui32RxLevel == UART_FIFO_RX4_8) ||
279  (ui32RxLevel == UART_FIFO_RX6_8) ||
280  (ui32RxLevel == UART_FIFO_RX7_8));
281 
282  //
283  // Set the FIFO interrupt levels.
284  //
285  HWREG(ui32Base + UART_O_IFLS) = ui32TxLevel | ui32RxLevel;
286 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_FIFO_RX1_8
Definition: uart.h:117
#define ASSERT(expr)
Definition: debug.h:67
#define UART_FIFO_RX2_8
Definition: uart.h:118
#define UART_FIFO_TX4_8
Definition: uart.h:107
#define UART_FIFO_RX6_8
Definition: uart.h:120
#define UART_FIFO_TX7_8
Definition: uart.h:109
#define UART_FIFO_TX2_8
Definition: uart.h:106
#define UART_O_IFLS
Definition: hw_uart.h:58
#define UART_FIFO_TX1_8
Definition: uart.h:105
#define UART_FIFO_RX7_8
Definition: uart.h:121
#define UART_FIFO_TX6_8
Definition: uart.h:108
#define UART_FIFO_RX4_8
Definition: uart.h:119
uint32_t UARTFlowControlGet ( uint32_t  ui32Base)

Returns the UART hardware flow control mode currently in use.

Parameters
ui32Baseis the base address of the UART port.

This function returns the current hardware flow control mode.

Note
The availability of hardware flow control varies with the Tiva part and UART in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
Returns the current flow control mode in use. This value is a logical OR combination of values UART_FLOWCONTROL_TX if transmit (CTS) flow control is enabled and UART_FLOWCONTROL_RX if receive (RTS) flow control is in use. If hardware flow control is disabled, UART_FLOWCONTROL_NONE is returned.

Definition at line 983 of file uart.c.

References ASSERT, HWREG, UART_FLOWCONTROL_RX, UART_FLOWCONTROL_TX, and UART_O_CTL.

984 {
985  //
986  // Check the arguments.
987  //
988  ASSERT(_UARTBaseValid(ui32Base));
989 
990  return(HWREG(ui32Base + UART_O_CTL) & (UART_FLOWCONTROL_TX |
992 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_FLOWCONTROL_RX
Definition: uart.h:168
#define UART_FLOWCONTROL_TX
Definition: uart.h:167
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_CTL
Definition: hw_uart.h:57
void UARTFlowControlSet ( uint32_t  ui32Base,
uint32_t  ui32Mode 
)

Sets the UART hardware flow control mode to be used.

Parameters
ui32Baseis the base address of the UART port.
ui32Modeindicates the flow control modes to be used. This parameter is a logical OR combination of values UART_FLOWCONTROL_TX and UART_FLOWCONTROL_RX to enable hardware transmit (CTS) and receive (RTS) flow control or UART_FLOWCONTROL_NONE to disable hardware flow control.

This function configures the required hardware flow control modes. If ui32Mode contains flag UART_FLOWCONTROL_TX, data is only transmitted if the incoming CTS signal is asserted. If ui32Mode contains flag UART_FLOWCONTROL_RX, the RTS output is controlled by the hardware and is asserted only when there is space available in the receive FIFO. If no hardware flow control is required, UART_FLOWCONTROL_NONE should be passed.

Note
The availability of hardware flow control varies with the Tiva part and UART in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 947 of file uart.c.

References ASSERT, HWREG, UART_FLOWCONTROL_RX, UART_FLOWCONTROL_TX, and UART_O_CTL.

948 {
949  //
950  // Check the arguments.
951  //
952  ASSERT(_UARTBaseValid(ui32Base));
953  ASSERT((ui32Mode & ~(UART_FLOWCONTROL_TX | UART_FLOWCONTROL_RX)) == 0);
954 
955  //
956  // Set the flow control mode as requested.
957  //
958  HWREG(ui32Base + UART_O_CTL) = ((HWREG(ui32Base + UART_O_CTL) &
960  UART_FLOWCONTROL_RX)) | ui32Mode);
961 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_FLOWCONTROL_RX
Definition: uart.h:168
#define UART_FLOWCONTROL_TX
Definition: uart.h:167
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_CTL
Definition: hw_uart.h:57
void UARTIntClear ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Clears UART interrupt sources.

Parameters
ui32Baseis the base address of the UART port.
ui32IntFlagsis a bit mask of the interrupt sources to be cleared.

The specified UART interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being triggered again immediately upon exit.

The ui32IntFlags parameter has the same definition as the ui32IntFlags parameter to UARTIntEnable().

Note
Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).
Returns
None.

Definition at line 1581 of file uart.c.

References ASSERT, HWREG, and UART_O_ICR.

Referenced by UART0_Handler(), uart_get_char_(), and uart_get_string_().

1582 {
1583  //
1584  // Check the arguments.
1585  //
1586  ASSERT(_UARTBaseValid(ui32Base));
1587 
1588  //
1589  // Clear the requested interrupt sources.
1590  //
1591  HWREG(ui32Base + UART_O_ICR) = ui32IntFlags;
1592 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_ICR
Definition: hw_uart.h:62

Here is the caller graph for this function:

void UARTIntDisable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Disables individual UART interrupt sources.

Parameters
ui32Baseis the base address of the UART port.
ui32IntFlagsis the bit mask of the interrupt sources to be disabled.

This function disables the indicated UART interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ui32IntFlags parameter has the same definition as the ui32IntFlags parameter to UARTIntEnable().

Returns
None.

Definition at line 1503 of file uart.c.

References ASSERT, HWREG, and UART_O_IM.

1504 {
1505  //
1506  // Check the arguments.
1507  //
1508  ASSERT(_UARTBaseValid(ui32Base));
1509 
1510  //
1511  // Disable the specified interrupts.
1512  //
1513  HWREG(ui32Base + UART_O_IM) &= ~(ui32IntFlags);
1514 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_IM
Definition: hw_uart.h:59
void UARTIntEnable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Enables individual UART interrupt sources.

Parameters
ui32Baseis the base address of the UART port.
ui32IntFlagsis the bit mask of the interrupt sources to be enabled.

This function enables the indicated UART interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ui32IntFlags parameter is the logical OR of any of the following:

  • UART_INT_9BIT - 9-bit Address Match interrupt
  • UART_INT_OE - Overrun Error interrupt
  • UART_INT_BE - Break Error interrupt
  • UART_INT_PE - Parity Error interrupt
  • UART_INT_FE - Framing Error interrupt
  • UART_INT_RT - Receive Timeout interrupt
  • UART_INT_TX - Transmit interrupt
  • UART_INT_RX - Receive interrupt
  • UART_INT_DSR - DSR interrupt
  • UART_INT_DCD - DCD interrupt
  • UART_INT_CTS - CTS interrupt
  • UART_INT_RI - RI interrupt
Returns
None.

Definition at line 1471 of file uart.c.

References ASSERT, HWREG, and UART_O_IM.

Referenced by uart_init().

1472 {
1473  //
1474  // Check the arguments.
1475  //
1476  ASSERT(_UARTBaseValid(ui32Base));
1477 
1478  //
1479  // Enable the specified interrupts.
1480  //
1481  HWREG(ui32Base + UART_O_IM) |= ui32IntFlags;
1482 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_IM
Definition: hw_uart.h:59

Here is the caller graph for this function:

void UARTIntRegister ( uint32_t  ui32Base,
void(*)(void)  pfnHandler 
)

Registers an interrupt handler for a UART interrupt.

Parameters
ui32Baseis the base address of the UART port.
pfnHandleris a pointer to the function to be called when the UART interrupt occurs.

This function does the actual registering of the interrupt handler. This function enables the global interrupt in the interrupt controller; specific UART interrupts must be enabled via UARTIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

Definition at line 1369 of file uart.c.

References _UARTIntNumberGet(), ASSERT, IntEnable(), and IntRegister().

1370 {
1371  uint32_t ui32Int;
1372 
1373  //
1374  // Check the arguments.
1375  //
1376  ASSERT(_UARTBaseValid(ui32Base));
1377 
1378  //
1379  // Determine the interrupt number based on the UART port.
1380  //
1381  ui32Int = _UARTIntNumberGet(ui32Base);
1382 
1383  ASSERT(ui32Int != 0);
1384 
1385  //
1386  // Register the interrupt handler.
1387  //
1388  IntRegister(ui32Int, pfnHandler);
1389 
1390  //
1391  // Enable the UART interrupt.
1392  //
1393  IntEnable(ui32Int);
1394 }
static uint32_t _UARTIntNumberGet(uint32_t ui32Base)
Definition: uart.c:137
#define ASSERT(expr)
Definition: debug.h:67
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Definition: interrupt.c:309
void IntEnable(uint32_t ui32Interrupt)
Definition: interrupt.c:610

Here is the call graph for this function:

uint32_t UARTIntStatus ( uint32_t  ui32Base,
bool  bMasked 
)

Gets the current interrupt status.

Parameters
ui32Baseis the base address of the UART port.
bMaskedis false if the raw interrupt status is required and true if the masked interrupt status is required.

This function returns the interrupt status for the specified UART. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

Returns
Returns the current interrupt status, enumerated as a bit field of values described in UARTIntEnable().

Definition at line 1533 of file uart.c.

References ASSERT, HWREG, UART_O_MIS, and UART_O_RIS.

Referenced by s_Handler(), UART0_Handler(), uart_get_char_(), and uart_get_string_().

1534 {
1535  //
1536  // Check the arguments.
1537  //
1538  ASSERT(_UARTBaseValid(ui32Base));
1539 
1540  //
1541  // Return either the interrupt status or the raw interrupt status as
1542  // requested.
1543  //
1544  if(bMasked)
1545  {
1546  return(HWREG(ui32Base + UART_O_MIS));
1547  }
1548  else
1549  {
1550  return(HWREG(ui32Base + UART_O_RIS));
1551  }
1552 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_MIS
Definition: hw_uart.h:61
#define UART_O_RIS
Definition: hw_uart.h:60

Here is the caller graph for this function:

void UARTIntUnregister ( uint32_t  ui32Base)

Unregisters an interrupt handler for a UART interrupt.

Parameters
ui32Baseis the base address of the UART port.

This function does the actual unregistering of the interrupt handler. It clears the handler to be called when a UART interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

Definition at line 1414 of file uart.c.

References _UARTIntNumberGet(), ASSERT, IntDisable(), and IntUnregister().

1415 {
1416  uint32_t ui32Int;
1417 
1418  //
1419  // Check the arguments.
1420  //
1421  ASSERT(_UARTBaseValid(ui32Base));
1422 
1423  //
1424  // Determine the interrupt number based on the UART port.
1425  //
1426  ui32Int = _UARTIntNumberGet(ui32Base);
1427 
1428  ASSERT(ui32Int != 0);
1429 
1430  //
1431  // Disable the interrupt.
1432  //
1433  IntDisable(ui32Int);
1434 
1435  //
1436  // Unregister the interrupt handler.
1437  //
1438  IntUnregister(ui32Int);
1439 }
static uint32_t _UARTIntNumberGet(uint32_t ui32Base)
Definition: uart.c:137
#define ASSERT(expr)
Definition: debug.h:67
void IntUnregister(uint32_t ui32Interrupt)
Definition: interrupt.c:381
void IntDisable(uint32_t ui32Interrupt)
Definition: interrupt.c:684

Here is the call graph for this function:

void UARTModemControlClear ( uint32_t  ui32Base,
uint32_t  ui32Control 
)

Clears the states of the DTR and/or RTS modem control signals.

Parameters
ui32Baseis the base address of the UART port.
ui32Controlis a bit-mapped flag indicating which modem control bits should be set.

This function clears the states of the DTR or RTS modem handshake outputs from the UART.

The ui32Control parameter is the logical OR of any of the following:

  • UART_OUTPUT_DTR - The modem control DTR signal
  • UART_OUTPUT_RTS - The modem control RTS signal
Note
The availability of hardware modem handshake signals varies with the Tiva part and UART in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 842 of file uart.c.

References ASSERT, HWREG, UART1_BASE, UART_O_CTL, UART_OUTPUT_DTR, and UART_OUTPUT_RTS.

843 {
844  uint32_t ui32Temp;
845 
846  //
847  // Check the arguments.
848  //
849  ASSERT(ui32Base == UART1_BASE);
850  ASSERT((ui32Control & ~(UART_OUTPUT_RTS | UART_OUTPUT_DTR)) == 0);
851 
852  //
853  // Set the appropriate modem control output bits.
854  //
855  ui32Temp = HWREG(ui32Base + UART_O_CTL);
856  ui32Temp &= ~(ui32Control & (UART_OUTPUT_RTS | UART_OUTPUT_DTR));
857  HWREG(ui32Base + UART_O_CTL) = ui32Temp;
858 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_OUTPUT_DTR
Definition: uart.h:149
#define UART1_BASE
Definition: hw_memmap.h:62
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_OUTPUT_RTS
Definition: uart.h:148
uint32_t UARTModemControlGet ( uint32_t  ui32Base)

Gets the states of the DTR and RTS modem control signals.

Parameters
ui32Baseis the base address of the UART port.

This function returns the current states of each of the two UART modem control signals, DTR and RTS.

Note
The availability of hardware modem handshake signals varies with the Tiva part and UART in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
Returns the states of the handshake output signals. This value is a logical OR combination of values UART_OUTPUT_RTS and UART_OUTPUT_DTR where the presence of each flag indicates that the associated signal is asserted.

Definition at line 880 of file uart.c.

References ASSERT, HWREG, UART1_BASE, UART_O_CTL, UART_OUTPUT_DTR, and UART_OUTPUT_RTS.

881 {
882  //
883  // Check the arguments.
884  //
885  ASSERT(ui32Base == UART1_BASE);
886 
887  return(HWREG(ui32Base + UART_O_CTL) & (UART_OUTPUT_RTS | UART_OUTPUT_DTR));
888 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_OUTPUT_DTR
Definition: uart.h:149
#define UART1_BASE
Definition: hw_memmap.h:62
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_OUTPUT_RTS
Definition: uart.h:148
void UARTModemControlSet ( uint32_t  ui32Base,
uint32_t  ui32Control 
)

Sets the states of the DTR and/or RTS modem control signals.

Parameters
ui32Baseis the base address of the UART port.
ui32Controlis a bit-mapped flag indicating which modem control bits should be set.

This function configures the states of the DTR or RTS modem handshake outputs from the UART.

The ui32Control parameter is the logical OR of any of the following:

  • UART_OUTPUT_DTR - The modem control DTR signal
  • UART_OUTPUT_RTS - The modem control RTS signal
Note
The availability of hardware modem handshake signals varies with the Tiva part and UART in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 800 of file uart.c.

References ASSERT, HWREG, UART1_BASE, UART_O_CTL, UART_OUTPUT_DTR, and UART_OUTPUT_RTS.

801 {
802  uint32_t ui32Temp;
803 
804  //
805  // Check the arguments.
806  //
807  ASSERT(ui32Base == UART1_BASE);
808  ASSERT((ui32Control & ~(UART_OUTPUT_RTS | UART_OUTPUT_DTR)) == 0);
809 
810  //
811  // Set the appropriate modem control output bits.
812  //
813  ui32Temp = HWREG(ui32Base + UART_O_CTL);
814  ui32Temp |= (ui32Control & (UART_OUTPUT_RTS | UART_OUTPUT_DTR));
815  HWREG(ui32Base + UART_O_CTL) = ui32Temp;
816 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_OUTPUT_DTR
Definition: uart.h:149
#define UART1_BASE
Definition: hw_memmap.h:62
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_OUTPUT_RTS
Definition: uart.h:148
uint32_t UARTModemStatusGet ( uint32_t  ui32Base)

Gets the states of the RI, DCD, DSR and CTS modem status signals.

Parameters
ui32Baseis the base address of the UART port.

This function returns the current states of each of the four UART modem status signals, RI, DCD, DSR and CTS.

Note
The availability of hardware modem handshake signals varies with the Tiva part and UART in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
Returns the states of the handshake output signals. This value is a logical OR combination of values UART_INPUT_RI, UART_INPUT_DCD, UART_INPUT_CTS and UART_INPUT_DSR where the presence of each flag indicates that the associated signal is asserted.

Definition at line 910 of file uart.c.

References ASSERT, HWREG, UART1_BASE, UART_INPUT_CTS, UART_INPUT_DCD, UART_INPUT_DSR, UART_INPUT_RI, and UART_O_FR.

911 {
912  //
913  // Check the arguments.
914  //
915  ASSERT(ui32Base == UART1_BASE);
916 
917  return(HWREG(ui32Base + UART_O_FR) & (UART_INPUT_RI | UART_INPUT_DCD |
919 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_INPUT_DSR
Definition: uart.h:158
#define UART1_BASE
Definition: hw_memmap.h:62
#define UART_INPUT_CTS
Definition: uart.h:159
#define UART_O_FR
Definition: hw_uart.h:51
#define UART_INPUT_DCD
Definition: uart.h:157
#define UART_INPUT_RI
Definition: uart.h:156
uint32_t UARTParityModeGet ( uint32_t  ui32Base)

Gets the type of parity currently being used.

Parameters
ui32Baseis the base address of the UART port.

This function gets the type of parity used for transmitting data and expected when receiving data.

Returns
Returns the current parity settings, specified as one of UART_CONFIG_PAR_NONE, UART_CONFIG_PAR_EVEN, UART_CONFIG_PAR_ODD, UART_CONFIG_PAR_ONE, or UART_CONFIG_PAR_ZERO.

Definition at line 231 of file uart.c.

References ASSERT, HWREG, UART_LCRH_EPS, UART_LCRH_PEN, UART_LCRH_SPS, and UART_O_LCRH.

232 {
233  //
234  // Check the arguments.
235  //
236  ASSERT(_UARTBaseValid(ui32Base));
237 
238  //
239  // Return the current parity setting.
240  //
241  return(HWREG(ui32Base + UART_O_LCRH) &
243 }
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define ASSERT(expr)
Definition: debug.h:67
#define UART_LCRH_EPS
Definition: hw_uart.h:151
#define UART_LCRH_PEN
Definition: hw_uart.h:152
#define UART_LCRH_SPS
Definition: hw_uart.h:143
void UARTParityModeSet ( uint32_t  ui32Base,
uint32_t  ui32Parity 
)

Sets the type of parity.

Parameters
ui32Baseis the base address of the UART port.
ui32Parityspecifies the type of parity to use.

This function configures the type of parity to use for transmitting and expect when receiving. The ui32Parity parameter must be one of UART_CONFIG_PAR_NONE, UART_CONFIG_PAR_EVEN, UART_CONFIG_PAR_ODD, UART_CONFIG_PAR_ONE, or UART_CONFIG_PAR_ZERO. The last two parameters allow direct control of the parity bit; it is always either one or zero based on the mode.

Returns
None.

Definition at line 196 of file uart.c.

References ASSERT, HWREG, UART_CONFIG_PAR_EVEN, UART_CONFIG_PAR_NONE, UART_CONFIG_PAR_ODD, UART_CONFIG_PAR_ONE, UART_CONFIG_PAR_ZERO, UART_LCRH_EPS, UART_LCRH_PEN, UART_LCRH_SPS, and UART_O_LCRH.

197 {
198  //
199  // Check the arguments.
200  //
201  ASSERT(_UARTBaseValid(ui32Base));
202  ASSERT((ui32Parity == UART_CONFIG_PAR_NONE) ||
203  (ui32Parity == UART_CONFIG_PAR_EVEN) ||
204  (ui32Parity == UART_CONFIG_PAR_ODD) ||
205  (ui32Parity == UART_CONFIG_PAR_ONE) ||
206  (ui32Parity == UART_CONFIG_PAR_ZERO));
207 
208  //
209  // Set the parity mode.
210  //
211  HWREG(ui32Base + UART_O_LCRH) = ((HWREG(ui32Base + UART_O_LCRH) &
213  UART_LCRH_PEN)) | ui32Parity);
214 }
#define UART_CONFIG_PAR_EVEN
Definition: uart.h:94
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define ASSERT(expr)
Definition: debug.h:67
#define UART_LCRH_EPS
Definition: hw_uart.h:151
#define UART_CONFIG_PAR_ZERO
Definition: uart.h:97
#define UART_LCRH_PEN
Definition: hw_uart.h:152
#define UART_CONFIG_PAR_ODD
Definition: uart.h:95
#define UART_LCRH_SPS
Definition: hw_uart.h:143
#define UART_CONFIG_PAR_ONE
Definition: uart.h:96
#define UART_CONFIG_PAR_NONE
Definition: uart.h:93
void UARTRxErrorClear ( uint32_t  ui32Base)

Clears all reported receiver errors.

Parameters
ui32Baseis the base address of the UART port.

This function is used to clear all receiver error conditions reported via UARTRxErrorGet(). If using the overrun, framing error, parity error or break interrupts, this function must be called after clearing the interrupt to ensure that later errors of the same type trigger another interrupt.

Returns
None.

Definition at line 1708 of file uart.c.

References ASSERT, HWREG, and UART_O_ECR.

1709 {
1710  //
1711  // Check the arguments.
1712  //
1713  ASSERT(_UARTBaseValid(ui32Base));
1714 
1715  //
1716  // Any write to the Error Clear Register clears all bits which are
1717  // currently set.
1718  //
1719  HWREG(ui32Base + UART_O_ECR) = 0;
1720 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_ECR
Definition: hw_uart.h:50
uint32_t UARTRxErrorGet ( uint32_t  ui32Base)

Gets current receiver errors.

Parameters
ui32Baseis the base address of the UART port.

This function returns the current state of each of the 4 receiver error sources. The returned errors are equivalent to the four error bits returned via the previous call to UARTCharGet() or UARTCharGetNonBlocking() with the exception that the overrun error is set immediately when the overrun occurs rather than when a character is next read.

Returns
Returns a logical OR combination of the receiver error flags, UART_RXERROR_FRAMING, UART_RXERROR_PARITY, UART_RXERROR_BREAK and UART_RXERROR_OVERRUN.

Definition at line 1680 of file uart.c.

References ASSERT, HWREG, and UART_O_RSR.

1681 {
1682  //
1683  // Check the arguments.
1684  //
1685  ASSERT(_UARTBaseValid(ui32Base));
1686 
1687  //
1688  // Return the current value of the receive status register.
1689  //
1690  return(HWREG(ui32Base + UART_O_RSR) & 0x0000000F);
1691 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_RSR
Definition: hw_uart.h:49
void UARTSmartCardDisable ( uint32_t  ui32Base)

Disables ISO7816 smart card mode on the specified UART.

Parameters
ui32Baseis the base address of the UART port.

This function clears the SMART (ISO7816 smart card) bit in the UART control register.

Note
The availability of ISO7816 smart card mode varies with the Tiva part and UART in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 763 of file uart.c.

References ASSERT, HWREG, UART_CTL_SMART, and UART_O_CTL.

764 {
765  //
766  // Check the arguments.
767  //
768  ASSERT(_UARTBaseValid(ui32Base));
769 
770  //
771  // Disable the SMART bit.
772  //
773  HWREG(ui32Base + UART_O_CTL) &= ~UART_CTL_SMART;
774 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_CTL_SMART
Definition: hw_uart.h:169
#define UART_O_CTL
Definition: hw_uart.h:57
void UARTSmartCardEnable ( uint32_t  ui32Base)

Enables ISO7816 smart card mode on the specified UART.

Parameters
ui32Baseis the base address of the UART port.

This function enables the SMART control bit for the ISO7816 smart card mode on the UART. This call also sets 8-bit word length and even parity as required by ISO7816.

Note
The availability of ISO7816 smart card mode varies with the Tiva part and UART in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 719 of file uart.c.

References ASSERT, HWREG, UART_CTL_SMART, UART_LCRH_EPS, UART_LCRH_PEN, UART_LCRH_SPS, UART_LCRH_STP2, UART_LCRH_WLEN_8, UART_LCRH_WLEN_M, UART_O_CTL, and UART_O_LCRH.

720 {
721  uint32_t ui32Val;
722 
723  //
724  // Check the arguments.
725  //
726  ASSERT(_UARTBaseValid(ui32Base));
727 
728  //
729  // Set 8-bit word length, even parity, 2 stop bits (note that although the
730  // STP2 bit is ignored when in smartcard mode, this code lets the caller
731  // read back the actual setting in use).
732  //
733  ui32Val = HWREG(ui32Base + UART_O_LCRH);
734  ui32Val &= ~(UART_LCRH_SPS | UART_LCRH_EPS | UART_LCRH_PEN |
738  HWREG(ui32Base + UART_O_LCRH) = ui32Val;
739 
740  //
741  // Enable SMART mode.
742  //
743  HWREG(ui32Base + UART_O_CTL) |= UART_CTL_SMART;
744 }
#define UART_LCRH_STP2
Definition: hw_uart.h:150
#define HWREG(x)
Definition: hw_types.h:48
#define UART_O_LCRH
Definition: hw_uart.h:56
#define ASSERT(expr)
Definition: debug.h:67
#define UART_CTL_SMART
Definition: hw_uart.h:169
#define UART_LCRH_EPS
Definition: hw_uart.h:151
#define UART_LCRH_WLEN_8
Definition: hw_uart.h:148
#define UART_LCRH_PEN
Definition: hw_uart.h:152
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_LCRH_SPS
Definition: hw_uart.h:143
#define UART_LCRH_WLEN_M
Definition: hw_uart.h:144
bool UARTSpaceAvail ( uint32_t  ui32Base)

Determines if there is any space in the transmit FIFO.

Parameters
ui32Baseis the base address of the UART port.

This function returns a flag indicating whether or not there is space available in the transmit FIFO.

Returns
Returns true if there is space available in the transmit FIFO or false if there is no space available in the transmit FIFO.

Definition at line 1114 of file uart.c.

References ASSERT, HWREG, UART_FR_TXFF, and UART_O_FR.

1115 {
1116  //
1117  // Check the arguments.
1118  //
1119  ASSERT(_UARTBaseValid(ui32Base));
1120 
1121  //
1122  // Return the availability of space.
1123  //
1124  return((HWREG(ui32Base + UART_O_FR) & UART_FR_TXFF) ? false : true);
1125 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_O_FR
Definition: hw_uart.h:51
#define UART_FR_TXFF
Definition: hw_uart.h:107
uint32_t UARTTxIntModeGet ( uint32_t  ui32Base)

Returns the current operating mode for the UART transmit interrupt.

Parameters
ui32Baseis the base address of the UART port.

This function returns the current operating mode for the UART transmit interrupt. The return value is UART_TXINT_MODE_EOT if the transmit interrupt is currently configured to be asserted once the transmitter is completely idle - the transmit FIFO is empty and all bits, including any stop bits, have cleared the transmitter. The return value is UART_TXINT_MODE_FIFO if the interrupt is configured to be asserted based on the level of the transmit FIFO.

Note
The availability of end-of-transmission mode varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
Returns UART_TXINT_MODE_FIFO or UART_TXINT_MODE_EOT.

Definition at line 1059 of file uart.c.

References ASSERT, HWREG, UART_O_CTL, UART_TXINT_MODE_EOT, and UART_TXINT_MODE_FIFO.

1060 {
1061  //
1062  // Check the arguments.
1063  //
1064  ASSERT(_UARTBaseValid(ui32Base));
1065 
1066  //
1067  // Return the current transmit interrupt mode.
1068  //
1069  return(HWREG(ui32Base + UART_O_CTL) & (UART_TXINT_MODE_EOT |
1071 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_TXINT_MODE_FIFO
Definition: uart.h:177
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_TXINT_MODE_EOT
Definition: uart.h:178
void UARTTxIntModeSet ( uint32_t  ui32Base,
uint32_t  ui32Mode 
)

Sets the operating mode for the UART transmit interrupt.

Parameters
ui32Baseis the base address of the UART port.
ui32Modeis the operating mode for the transmit interrupt. It may be UART_TXINT_MODE_EOT to trigger interrupts when the transmitter is idle or UART_TXINT_MODE_FIFO to trigger based on the current transmit FIFO level.

This function allows the mode of the UART transmit interrupt to be set. By default, the transmit interrupt is asserted when the FIFO level falls past a threshold set via a call to UARTFIFOLevelSet(). Alternatively, if this function is called with ui32Mode set to UART_TXINT_MODE_EOT, the transmit interrupt is asserted once the transmitter is completely idle - the transmit FIFO is empty and all bits, including any stop bits, have cleared the transmitter.

Note
The availability of end-of-transmission mode varies with the Tiva part in use. Please consult the datasheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1020 of file uart.c.

References ASSERT, HWREG, UART_O_CTL, UART_TXINT_MODE_EOT, and UART_TXINT_MODE_FIFO.

1021 {
1022  //
1023  // Check the arguments.
1024  //
1025  ASSERT(_UARTBaseValid(ui32Base));
1026  ASSERT((ui32Mode == UART_TXINT_MODE_EOT) ||
1027  (ui32Mode == UART_TXINT_MODE_FIFO));
1028 
1029  //
1030  // Set or clear the EOT bit of the UART control register as appropriate.
1031  //
1032  HWREG(ui32Base + UART_O_CTL) = ((HWREG(ui32Base + UART_O_CTL) &
1034  UART_TXINT_MODE_FIFO)) | ui32Mode);
1035 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define UART_TXINT_MODE_FIFO
Definition: uart.h:177
#define UART_O_CTL
Definition: hw_uart.h:57
#define UART_TXINT_MODE_EOT
Definition: uart.h:178

Variable Documentation

const uint32_t g_ppui32UARTIntMap[][2]
static
Initial value:
=
{
}
#define UART7_BASE
Definition: hw_memmap.h:68
#define INT_UART4_TM4C123
Definition: hw_ints.h:121
#define INT_UART7_TM4C123
Definition: hw_ints.h:124
#define UART4_BASE
Definition: hw_memmap.h:65
#define INT_UART6_TM4C123
Definition: hw_ints.h:123
#define UART6_BASE
Definition: hw_memmap.h:67
#define INT_UART5_TM4C123
Definition: hw_ints.h:122
#define UART1_BASE
Definition: hw_memmap.h:62
#define INT_UART3_TM4C123
Definition: hw_ints.h:120
#define INT_UART0_TM4C123
Definition: hw_ints.h:69
#define UART5_BASE
Definition: hw_memmap.h:66
#define UART0_BASE
Definition: hw_memmap.h:61
#define INT_UART2_TM4C123
Definition: hw_ints.h:98
#define INT_UART1_TM4C123
Definition: hw_ints.h:70
#define UART3_BASE
Definition: hw_memmap.h:64
#define UART2_BASE
Definition: hw_memmap.h:63

Definition at line 71 of file uart.c.

Referenced by _UARTIntNumberGet().

const uint32_t g_ppui32UARTIntMapSnowflake[][2]
static
Initial value:
=
{
}
#define INT_UART7_TM4C129
Definition: hw_ints.h:236
#define UART7_BASE
Definition: hw_memmap.h:68
#define UART4_BASE
Definition: hw_memmap.h:65
#define INT_UART4_TM4C129
Definition: hw_ints.h:233
#define UART6_BASE
Definition: hw_memmap.h:67
#define INT_UART6_TM4C129
Definition: hw_ints.h:235
#define UART1_BASE
Definition: hw_memmap.h:62
#define INT_UART0_TM4C129
Definition: hw_ints.h:181
#define INT_UART1_TM4C129
Definition: hw_ints.h:182
#define UART5_BASE
Definition: hw_memmap.h:66
#define INT_UART2_TM4C129
Definition: hw_ints.h:209
#define INT_UART5_TM4C129
Definition: hw_ints.h:234
#define UART0_BASE
Definition: hw_memmap.h:61
#define UART3_BASE
Definition: hw_memmap.h:64
#define UART2_BASE
Definition: hw_memmap.h:63
#define INT_UART3_TM4C129
Definition: hw_ints.h:232

Definition at line 84 of file uart.c.

Referenced by _UARTIntNumberGet().

const uint_fast8_t g_ui8UARTIntMapRows
static
Initial value:
=
static const uint32_t g_ppui32UARTIntMap[][2]
Definition: uart.c:71

Definition at line 82 of file uart.c.

Referenced by _UARTIntNumberGet().

const uint_fast8_t g_ui8UARTIntMapRowsSnowflake
static
Initial value:
=
static const uint32_t g_ppui32UARTIntMapSnowflake[][2]
Definition: uart.c:84

Definition at line 95 of file uart.c.

Referenced by _UARTIntNumberGet().