[PATCH 2/3] Fixed ability to enable polling on the console using configure for atsamv

Lou Woods irnhorse4 at gmail.com
Tue Mar 26 13:56:06 UTC 2019


From: Lou Woods <Lou.Woods at OARCorp.com>

---
 bsps/arm/atsam/console/console.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/bsps/arm/atsam/console/console.c b/bsps/arm/atsam/console/console.c
index d51d2ac..4a6c339 100644
--- a/bsps/arm/atsam/console/console.c
+++ b/bsps/arm/atsam/console/console.c
@@ -29,7 +29,7 @@ typedef struct {
   rtems_vector_number irq;
   uint32_t id;
   bool console;
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   bool transmitting;
 #endif
 } atsam_usart_context;
@@ -56,7 +56,7 @@ static atsam_usart_context atsam_usart_instances[] = {
 #endif
 };
 
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
 static void atsam_usart_interrupt(void *arg)
 {
   rtems_termios_tty *tty = arg;
@@ -144,7 +144,7 @@ static bool atsam_usart_first_open(
 {
   atsam_usart_context *ctx = (atsam_usart_context *) base;
   Usart *regs = ctx->regs;
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   rtems_status_code sc;
 #endif
 
@@ -156,7 +156,7 @@ static bool atsam_usart_first_open(
   rtems_termios_set_initial_baud(tty, ATSAM_CONSOLE_BAUD);
   atsam_usart_set_attributes(base, term);
 
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   regs->US_IER = US_IDR_RXRDY;
   sc = rtems_interrupt_handler_install(
     ctx->irq,
@@ -181,7 +181,7 @@ static void atsam_usart_last_close(
 {
   atsam_usart_context *ctx = (atsam_usart_context *) base;
 
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   rtems_interrupt_handler_remove(ctx->irq, atsam_usart_interrupt, tty);
 #endif
 
@@ -199,7 +199,7 @@ static void atsam_usart_write(
   atsam_usart_context *ctx = (atsam_usart_context *) base;
   Usart *regs = ctx->regs;
 
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   if (len > 0) {
     ctx->transmitting = true;
     regs->US_THR = buf[0];
@@ -240,7 +240,7 @@ static const rtems_termios_device_handler atsam_usart_handler = {
   .last_close = atsam_usart_last_close,
   .write = atsam_usart_write,
   .set_attributes = atsam_usart_set_attributes,
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   .mode = TERMIOS_IRQ_DRIVEN
 #else
   .poll_read = atsam_usart_read,
@@ -254,7 +254,7 @@ typedef struct {
   rtems_vector_number irq;
   uint32_t id;
   bool console;
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   bool transmitting;
 #endif
 } atsam_uart_context;
@@ -295,7 +295,7 @@ static atsam_uart_context atsam_uart_instances[] = {
 #endif
 };
 
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
 static void atsam_uart_interrupt(void *arg)
 {
   rtems_termios_tty *tty = arg;
@@ -370,7 +370,7 @@ static bool atsam_uart_first_open(
 {
   atsam_uart_context *ctx = (atsam_uart_context *) base;
   Uart *regs = ctx->regs;
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   rtems_status_code sc;
 #endif
 
@@ -382,7 +382,7 @@ static bool atsam_uart_first_open(
   rtems_termios_set_initial_baud(tty, ATSAM_CONSOLE_BAUD);
   atsam_uart_set_attributes(base, term);
 
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   regs->UART_IER = UART_IDR_RXRDY;
   sc = rtems_interrupt_handler_install(
     ctx->irq,
@@ -407,7 +407,7 @@ static void atsam_uart_last_close(
 {
   atsam_uart_context *ctx = (atsam_uart_context *) base;
 
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   rtems_interrupt_handler_remove(ctx->irq, atsam_uart_interrupt, tty);
 #endif
 
@@ -425,7 +425,7 @@ static void atsam_uart_write(
   atsam_uart_context *ctx = (atsam_uart_context *) base;
   Uart *regs = ctx->regs;
 
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   if (len > 0) {
     ctx->transmitting = true;
     regs->UART_THR = buf[0];
@@ -466,7 +466,7 @@ static const rtems_termios_device_handler atsam_uart_handler = {
   .last_close = atsam_uart_last_close,
   .write = atsam_uart_write,
   .set_attributes = atsam_uart_set_attributes,
-#ifdef ATSAM_CONSOLE_USE_INTERRUPTS
+#if ATSAM_CONSOLE_USE_INTERRUPTS
   .mode = TERMIOS_IRQ_DRIVEN
 #else
   .poll_read = atsam_uart_read,
-- 
1.8.3.1




More information about the devel mailing list