MSS_UART_enable_local_irq

Function MSS_UART_enable_local_irq 

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

/ /** The MSS_UART_enable_local_irq() function enables the MMUART interrupt as a local interrupt to the hart rather than as a PLIC interrupt. MMUART interrupt can be configured to trigger a PLIC interrupt or it can be configured to trigger a local interrupt. The arrangement is such that the UART0 interrupt can appear as local interrupt on E51. The UART1 to UART4 interrupts can appear as local interrupt to U51_1 to U54_4, respectively. The UART0 to UART4 can appear as PLIC interrupt. Multiple harts can enable and receive the PLIC interrupt, the hart that claims the interrupt processes it. For rest of the harts, the IRQ gets silently skipped as the interrupt claim has already been taken. To enable the local interrupt, application must explicitly call MSS_UART_enable_local_irq() function. Note that this function disables the interrupt over PLIC if it was previously enabled. This function must be called after the MMUART is initialized, the required interrupt handler functions are set and before initiating any data transfers. If you want to register multiple interrupt handlers such as Tx handler, rx handler and so on, then this function must be called after all such handlers are set. Call to this function is treated as one time activity. The driver gives no option to disable the local interrupt and enable the PLIC interrupt again at runtime.

@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 does not return a value.

@example @code

__enable_irq(); 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);

MSS_UART_enable_local_irq(&g_mss_uart0_lo);

@endcode