MSS_UART_get_tx_status

Function MSS_UART_get_tx_status 

Source
pub unsafe extern "C" fn MSS_UART_get_tx_status(
    this_uart: *mut mss_uart_instance_t,
) -> u8
Expand description

/ /** The MSS_UART_get_tx_status() function returns the transmitter status of the MSS UART instance. It reads both the UART’s line status register (LSR) and returns the status of the transmit holding register empty (THRE) and transmitter empty (TEMT) bits.

@param this_uart The this_uart parameter is a pointer to an mss_uart_instance_t structure that identifies the MSS UART hardware block performing the requested function. There are ten such data structures. The data structures from g_mss_uart0_lo to g_mss_uart4_lo are associated with MSS UART0 to MSS UART4 when they are connected on the AXI switch slave 5 (main APB bus). The data structures g_mss_uart0_hi to g_mss_uart4_hi are associated with MSS UART0 to MSS UART4 when they are connected on the AXI switch slave 6 (AMP APB bus). This parameter must point to one of these ten global data structure defined within the UART driver. Note: If you are using the UART on the AMP APB bus, the hardware configuration to connect UART on AMP APB bus must already be done by the application using SYSREG registers before initializing the UART instance structure.

@return This function returns the UART’s transmitter status as an 8-bit unsigned integer. The returned value is 0, if the transmitter status bits are not set or the function execution failed. The driver provides a set of bit mask constants that should be compared with and/or used to mask the returned value to determine the transmitter status. When the return value is compared to the following bit mask, a non-zero result indicates that the corresponding transmitter status bit is set:

  • MSS_UART_THRE (bit mask = 0x20)
  • MSS_UART_TEMT (bit mask = 0x40)

When the return value is compared to the following bit mask, a non-zero result indicates that the transmitter is busy or the function execution failed:

  • MSS_UART_TX_BUSY (bit mask = 0x00)

@example @code uint8_t tx_buff[10] = “abcdefghi”; MSS_UART_init(&g_mss_uart0_lo, MSS_UART_57600_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT);

MSS_UART_polled_tx(&g_mss_uart0_lo, tx_buff, sizeof(tx_buff));

while(!(MSS_UART_TEMT & MSS_UART_get_tx_status(&g_mss_uart0))) { ; } @endcode