lm4f: Implement UART interrupt control
Add a complete API for controlling the UART interrupts. Doxygen documentation with inline code examples is also provided in this patch. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
committed by
Piotr Esden-Tempski
parent
8112861b60
commit
a8fc67d569
@@ -375,6 +375,32 @@ enum uart_flowctl {
|
||||
UART_FLOWCTL_RTS_CTS,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief UART interrupt masks
|
||||
*
|
||||
* These masks can be OR'ed together to specify more than one interrupt. For
|
||||
* example, (UART_INT_TXIM | UART_INT_TXIM) specifies both Rx and Tx Interrupt.
|
||||
*/
|
||||
enum uart_interrupt_flag {
|
||||
|
||||
UART_INT_LME5 = UART_IM_LME5IM,
|
||||
UART_INT_LME1 = UART_IM_LME1IM,
|
||||
UART_INT_LMSB = UART_IM_LMSBIM,
|
||||
UART_INT_9BIT = UART_IM_9BITIM,
|
||||
UART_INT_OE = UART_IM_OEIM,
|
||||
UART_INT_BE = UART_IM_BEIM,
|
||||
UART_INT_PE = UART_IM_PEIM,
|
||||
UART_INT_FE = UART_IM_FEIM,
|
||||
UART_INT_RT = UART_IM_RTIM,
|
||||
UART_INT_TX = UART_IM_TXIM,
|
||||
UART_INT_RX = UART_IM_RXIM,
|
||||
UART_INT_DSR = UART_IM_DSRIM,
|
||||
UART_INT_DCD = UART_IM_DCDIM,
|
||||
UART_INT_CTS = UART_IM_CTSIM,
|
||||
UART_INT_RI = UART_IM_RIIM,
|
||||
};
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
* Function prototypes
|
||||
* ---------------------------------------------------------------------------*/
|
||||
@@ -403,12 +429,28 @@ void uart_disable_rx_dma(u32 uart);
|
||||
void uart_enable_tx_dma(u32 uart);
|
||||
void uart_disable_tx_dma(u32 uart);
|
||||
|
||||
void uart_enable_interrupts(u32 uart, enum uart_interrupt_flag ints);
|
||||
void uart_disable_interrupts(u32 uart, enum uart_interrupt_flag ints);
|
||||
void uart_enable_rx_interrupt(u32 uart);
|
||||
void uart_disable_rx_interrupt(u32 uart);
|
||||
void uart_enable_tx_interrupt(u32 uart);
|
||||
void uart_disable_tx_interrupt(u32 uart);
|
||||
bool uart_get_flag(u32 uart, u32 flag);
|
||||
bool uart_get_interrupt_source(u32 uart, u32 flag);
|
||||
void uart_clear_interrupt_flag(u32 uart, enum uart_interrupt_flag ints);
|
||||
|
||||
/* Let's keep this one inlined. It's designed to be used in ISRs */
|
||||
/** @ingroup uart_irq
|
||||
* @{
|
||||
* \brief Determine if interrupt is generated by the given source
|
||||
*
|
||||
* @param[in] uart UART block register address base @ref uart_reg_base
|
||||
* @param[in] source source to check.
|
||||
*/
|
||||
static inline
|
||||
bool uart_is_interrupt_source(u32 uart, enum uart_interrupt_flag source)
|
||||
{
|
||||
return UART_MIS(uart) & source;
|
||||
}
|
||||
/**@}*/
|
||||
|
||||
END_DECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user