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

xiaoxiang 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 2e35b6d  serial/uart_16550: Allow uintptr_t as addr width
2e35b6d is described below

commit 2e35b6d611af87bbf98dcf28722c561d5ad0c98f
Author: Huang Qi <[email protected]>
AuthorDate: Fri Jan 14 17:22:03 2022 +0800

    serial/uart_16550: Allow uintptr_t as addr width
    
    Signed-off-by: Huang Qi <[email protected]>
---
 drivers/serial/Kconfig-16550      | 4 +++-
 include/nuttx/serial/uart_16550.h | 9 ++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/serial/Kconfig-16550 b/drivers/serial/Kconfig-16550
index 259240d..b54b729 100644
--- a/drivers/serial/Kconfig-16550
+++ b/drivers/serial/Kconfig-16550
@@ -347,6 +347,8 @@ config 16550_ADDRWIDTH
        int "Address width of 16550 registers"
        default 8
        ---help---
-               The bit width of registers.  Options are 8, 16, or 32. Default: 
8
+               The bit width of registers.  Options are 0, 8, 16, or 32.
+               Default: 8
+               Note: 0 means auto detect address size (uintptr_t)
 
 endif # 16550_UART
diff --git a/include/nuttx/serial/uart_16550.h 
b/include/nuttx/serial/uart_16550.h
index 88295dc..102db04 100644
--- a/include/nuttx/serial/uart_16550.h
+++ b/include/nuttx/serial/uart_16550.h
@@ -68,8 +68,9 @@
 #  error "CONFIG_16550_ADDRWIDTH not defined"
 #endif
 
-#if CONFIG_16550_ADDRWIDTH != 8 && CONFIG_16550_ADDRWIDTH != 16 && \
-    CONFIG_16550_ADDRWIDTH != 32 && CONFIG_16550_ADDRWIDTH != 64
+#if CONFIG_16550_ADDRWIDTH != 0 && CONFIG_16550_ADDRWIDTH != 8 && \
+    CONFIG_16550_ADDRWIDTH != 16 && CONFIG_16550_ADDRWIDTH != 32 && \
+    CONFIG_16550_ADDRWIDTH != 64
 #  error "CONFIG_16550_ADDRWIDTH not supported"
 #endif
 
@@ -309,7 +310,9 @@ typedef uint16_t uart_datawidth_t;
 typedef uint32_t uart_datawidth_t;
 #endif
 
-#if CONFIG_16550_ADDRWIDTH == 8
+#if CONFIG_16550_ADDRWIDTH == 0
+typedef uintptr_t uart_addrwidth_t;
+#elif CONFIG_16550_ADDRWIDTH == 8
 typedef uint8_t uart_addrwidth_t;
 #elif CONFIG_16550_ADDRWIDTH == 16
 typedef uint16_t uart_addrwidth_t;

Reply via email to