diff options
Diffstat (limited to 'libmaple/usart.c')
-rw-r--r-- | libmaple/usart.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libmaple/usart.c b/libmaple/usart.c index 27aab49..44a5c92 100644 --- a/libmaple/usart.c +++ b/libmaple/usart.c @@ -23,8 +23,6 @@ *****************************************************************************/ /** - * @file usart.c - * * @brief USART control routines */ @@ -78,22 +76,25 @@ struct usart_dev usart_dev_table[] = { #endif }; -/* usart interrupt handlers. +/* + * Usart interrupt handlers. + */ - Use of rb_safe_insert() implies that a full buffer ignores new - bytes. */ -__attribute__((always_inline)) static inline void usart_irq(int usart_num) { - /* TODO: use attributes to let GCC know it's always called with - constants, just to force the inliner to do its thing */ +static inline void usart_irq(int usart_num) { #ifdef USART_SAFE_INSERT + /* Ignore old bytes if the user defines USART_SAFE_INSERT. */ rb_safe_insert(&(usart_dev_table[usart_num].rb), (uint8)((usart_dev_table[usart_num].base)->DR)); #else + /* By default, push bytes around in the ring buffer. */ rb_push_insert(&(usart_dev_table[usart_num].rb), (uint8)((usart_dev_table[usart_num].base)->DR)); #endif } +/* TODO: Check the disassembly for the following functions to make + sure GCC inlined properly. */ + void USART1_IRQHandler(void) { usart_irq(USART1); } |