MSS_UART_set_modemstatus_handler

Function MSS_UART_set_modemstatus_handler 

Source
pub unsafe extern "C" fn MSS_UART_set_modemstatus_handler(
    this_uart: *mut mss_uart_instance_t,
    handler: mss_uart_irq_handler_t,
)
Expand description

/ /** The MSS_UART_set_modemstatus_handler() function registers a modem status handler function that is called by the driver when a UART modem status (MS) interrupt occurs. You must create and register the handler function to suit your application.

Note: The MSS_UART_set_modemstatus_handler() function enables both the MS interrupt in the MSS UART instance and the corresponding MSS UART instance interrupt in the PolarFire® SoC Core Complex PLIC as part of its implementation.

Note: You can disable the MS interrupt when required by calling the MSS_UART_disable_irq() function. This is your choice and it depends upon your application.

@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 modem status interrupt handler function provided by your application that is called when a UART MS interrupt is triggered. This handler function must be of type mss_uart_irq_handler_t.

@return This function does not return a value.

@example @code #include “mss_uart.h”

void uart_modem_handler(mss_uart_instance_t * this_uart) { uint8_t status; status = MSS_UART_get_modem_status(this_uart); if(status & MSS_UART_CTS) { uart_cts_handler(); } }

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_modemstatus_handler(&g_mss_uart0_lo, uart_modem_handler);

while(1) { ; } return(0); } @endcode