pub unsafe extern "C" fn MSS_UART_set_rx_handler(
this_uart: *mut mss_uart_instance_t,
handler: mss_uart_irq_handler_t,
trigger_level: mss_uart_rx_trig_level_t,
)Expand description
/ /** The MSS_UART_set_rx_handler() function registers a receive handler function that is called by the driver when a UART receive data available (RDA) interrupt occurs. You must create and register the receive handler function to suit your application and it must call the MSS_UART_get_rx() function to actually read the received data.
Note: The MSS_UART_set_rx_handler() function enables both the RDA interrupt in the MSS UART instance and in the corresponding MSS UART instance interrupt in the PolarFire® SoC Core Complex PLIC as part of its implementation.
Note: You can disable the RDA interrupt when required by calling the MSS_UART_disable_irq() function. This is your choice and is dependent upon your application.
Note: The trigger level is actually applied only if the this_uart is set to ready mode 1. For more information, see the MSS_UART_set_ready_mode() function.
@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.
@param handler The handler parameter is a pointer to a receive interrupt handler function provided by your application that is called when a UART RDA interrupt is triggered. This handler function must be of type mss_uart_irq_handler_t.
@param trigger_level The trigger_level parameter is the receive FIFO trigger level. This specifies the number of bytes that must be received before the UART triggers an RDA interrupt.
@return This function does not return a value.
@example @code #include “mss_uart.h”
#define RX_BUFF_SIZE 64
uint8_t g_rx_buff[RX_BUFF_SIZE];
void uart0_rx_handler(mss_uart_instance_t * this_uart) { MSS_UART_get_rx(this_uart, &g_rx_buff[g_rx_idx], sizeof(g_rx_buff)); }
int main(void) { 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_set_rx_handler(&g_mss_uart0_lo, uart0_rx_handler, MSS_UART_FIFO_SINGLE_BYTE);
while(1) { ; } return(0); } @endcode