This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new adc23911b7 arch/sparc/bm3803 fix use of uart1 and uart2
adc23911b7 is described below

commit adc23911b7c8a83e58c4f06b8095ea8bf8d4d86c
Author: zouboan <f...@feedforward.com.cn>
AuthorDate: Wed Jun 8 15:18:50 2022 +0800

    arch/sparc/bm3803 fix use of uart1 and uart2
---
 arch/sparc/src/bm3803/bm3803-lowconsole.c | 34 +++++++++++++++++++++++++++----
 arch/sparc/src/bm3803/bm3803-serial.c     |  4 ----
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/src/bm3803/bm3803-lowconsole.c 
b/arch/sparc/src/bm3803/bm3803-lowconsole.c
index 4b29dc0d12..b0aaca3279 100644
--- a/arch/sparc/src/bm3803/bm3803-lowconsole.c
+++ b/arch/sparc/src/bm3803/bm3803-lowconsole.c
@@ -140,7 +140,7 @@ void bm3803_uartconfigure(uintptr_t uart_base, uint32_t 
baudrate,
 
       uart1_flow_ctrl_config(OFF);
       uart1_loopback_config(OFF);
-
+      BM3803_REG.pio_dir = (BM3803_REG.pio_dir & 0xbfff) | 0x8000;
       uart1_enable();
     }
   else if (uart_base == BM3803_UART2_BASE)
@@ -166,9 +166,35 @@ void bm3803_uartconfigure(uintptr_t uart_base, uint32_t 
baudrate,
 
       uart2_flow_ctrl_config(OFF);
       uart2_loopback_config(OFF);
-
+      BM3803_REG.pio_dir = (BM3803_REG.pio_dir & 0xfbff) | 0x0800;
       uart2_enable();
     }
+  else if (uart_base == BM3803_UART3_BASE)
+    {
+      /* Select baud. */
+
+      uart3_set_baudrate(baudrate);
+
+      /* Select parity */
+
+      if (parity == 1)
+        {
+          uart3_parity_config(ODD); /* Odd parity */
+        }
+      else if (parity == 2)
+        {
+          uart3_parity_config(EVEN); /* Even parity */
+        }
+      else
+        {
+          uart3_parity_config(NONE); /* Even none */
+        }
+
+      uart3_flow_ctrl_config(OFF);
+      uart3_loopback_config(OFF);
+
+      uart3_enable();
+    }
   else
     {
       return;
@@ -195,7 +221,7 @@ void uart1_configure(void)
 
   uart1_flow_ctrl_config(OFF);
   uart1_loopback_config(OFF);
-
+  BM3803_REG.pio_dir = (BM3803_REG.pio_dir & 0xbfff) | 0x8000;
   uart1_enable();
 }
 #endif
@@ -219,7 +245,7 @@ void uart2_configure(void)
 
   uart2_flow_ctrl_config(OFF);
   uart2_loopback_config(OFF);
-
+  BM3803_REG.pio_dir = (BM3803_REG.pio_dir & 0xfbff) | 0x0800;
   uart2_enable();
 }
 #endif
diff --git a/arch/sparc/src/bm3803/bm3803-serial.c 
b/arch/sparc/src/bm3803/bm3803-serial.c
index b88d83cdd4..e33165dc0f 100644
--- a/arch/sparc/src/bm3803/bm3803-serial.c
+++ b/arch/sparc/src/bm3803/bm3803-serial.c
@@ -298,15 +298,11 @@ static uart_dev_t g_uart3port =
 {
   .recv      =
   {
-    .head = 0,
-    .tail = 0,
     .size    = CONFIG_UART3_RXBUFSIZE,
     .buffer  = g_uart3rxbuffer,
   },
   .xmit      =
   {
-    .head = 0,
-    .tail = 0,
     .size    = CONFIG_UART3_TXBUFSIZE,
     .buffer  = g_uart3txbuffer,
   },

Reply via email to