diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-03-21 19:47:23 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-03-21 19:47:23 +0000 |
commit | a58d4b265fbd75b37070dee1acb75b95bf1dbeda (patch) | |
tree | 8f0a4d9856f6528b5bed17930b2fa6f5a1c2a1b2 /nuttx | |
parent | c22a13ef4ae689ff6ff1973fba950c6e673342af (diff) | |
download | px4-firmware-a58d4b265fbd75b37070dee1acb75b95bf1dbeda.tar.gz px4-firmware-a58d4b265fbd75b37070dee1acb75b95bf1dbeda.tar.bz2 px4-firmware-a58d4b265fbd75b37070dee1acb75b95bf1dbeda.zip |
Move serial header files to include/nuttx/serial
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4500 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx')
41 files changed, 400 insertions, 398 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index b923409c3..1c82e0202 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1532,8 +1532,8 @@ (and others). Contributed by Uros Platise. * examples/nsh and tools/mkromfsimg.sh: Add support for platform-specific ROMFS-based NSH start-up scripts. - * drivers/uart_16550.c and include/nuttx/uart_16550.h: Support for a generic - 16550 UART. + * drivers/serial/uart_16550.c and include/nuttx/serial/uart_16550.h: Support + for a generic 16550 UART. * configure/qemu-i486/nsh: QEMU NSH example. * ../apps: The apps directory add-on was created by Uros Platise. It supports a set of end-user applications than can be executed on top of @@ -2581,3 +2581,5 @@ device is, however, still non-functional when debug is OFF. * include/nuttx/fs: Move all file-system related files from include/nuttx to include/nuttx/fs. + * include/nuttx/serial: Move all serial-driver related files from include/nuttx to + include/nuttx/serial. diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 8550d98fc..8b4476614 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -2542,7 +2542,7 @@ extern void up_ledoff(int led); <ul> <li> <p> - <b><code>include/nuttx/serial.h</code></b>. + <b><code>include/nuttx/serial/serial.h</code></b>. All structures and APIs needed to work with serial drivers are provided in this header file. </p> </li> diff --git a/nuttx/arch/arm/src/c5471/c5471_serial.c b/nuttx/arch/arm/src/c5471/c5471_serial.c index 020210d31..0e7c53c17 100644 --- a/nuttx/arch/arm/src/c5471/c5471_serial.c +++ b/nuttx/arch/arm/src/c5471/c5471_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "chip.h" diff --git a/nuttx/arch/arm/src/dm320/dm320_serial.c b/nuttx/arch/arm/src/dm320/dm320_serial.c index b09104e57..15e4ecdf9 100644 --- a/nuttx/arch/arm/src/dm320/dm320_serial.c +++ b/nuttx/arch/arm/src/dm320/dm320_serial.c @@ -51,7 +51,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/arm/src/imx/imx_serial.c b/nuttx/arch/arm/src/imx/imx_serial.c index 556eb4ebd..26e6592be 100644 --- a/nuttx/arch/arm/src/imx/imx_serial.c +++ b/nuttx/arch/arm/src/imx/imx_serial.c @@ -51,7 +51,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/arm/src/kinetis/kinetis_serial.c b/nuttx/arch/arm/src/kinetis/kinetis_serial.c index dd1cd6873..a35e0eef0 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_serial.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/arm/src/lm3s/lm3s_serial.c b/nuttx/arch/arm/src/lm3s/lm3s_serial.c index 50384a1b9..45c388aec 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_serial.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c index f5d1e3c01..10b4a4838 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c b/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c index a838e3143..bf7c1ec34 100644 --- a/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c +++ b/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c @@ -49,7 +49,7 @@ #include <debug.h> #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "chip.h" diff --git a/nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c b/nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c index 8d3a020c7..69738dae5 100755 --- a/nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c +++ b/nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c @@ -54,7 +54,7 @@ #include <debug.h> #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "chip.h" diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_serial.c b/nuttx/arch/arm/src/lpc31xx/lpc31_serial.c index 770731882..c5438e1c8 100755 --- a/nuttx/arch/arm/src/lpc31xx/lpc31_serial.c +++ b/nuttx/arch/arm/src/lpc31xx/lpc31_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "up_arch.h" diff --git a/nuttx/arch/arm/src/sam3u/sam3u_serial.c b/nuttx/arch/arm/src/sam3u/sam3u_serial.c index 063de7a58..811bfda69 100644 --- a/nuttx/arch/arm/src/sam3u/sam3u_serial.c +++ b/nuttx/arch/arm/src/sam3u/sam3u_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c index 9e103092f..e91411272 100644 --- a/nuttx/arch/arm/src/stm32/stm32_serial.c +++ b/nuttx/arch/arm/src/stm32/stm32_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/arm/src/str71x/str71x_serial.c b/nuttx/arch/arm/src/str71x/str71x_serial.c index 1cc6731ac..d9e9cc348 100644 --- a/nuttx/arch/arm/src/str71x/str71x_serial.c +++ b/nuttx/arch/arm/src/str71x/str71x_serial.c @@ -49,7 +49,7 @@ #include <debug.h> #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "chip.h" diff --git a/nuttx/arch/avr/src/at32uc3/at32uc3_serial.c b/nuttx/arch/avr/src/at32uc3/at32uc3_serial.c index ff5c5490d..06b4adb39 100644 --- a/nuttx/arch/avr/src/at32uc3/at32uc3_serial.c +++ b/nuttx/arch/avr/src/at32uc3/at32uc3_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/avr/src/at90usb/at90usb_serial.c b/nuttx/arch/avr/src/at90usb/at90usb_serial.c index f75f38062..8d906a915 100644 --- a/nuttx/arch/avr/src/at90usb/at90usb_serial.c +++ b/nuttx/arch/avr/src/at90usb/at90usb_serial.c @@ -51,7 +51,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <avr/io.h> #include <arch/board/board.h> diff --git a/nuttx/arch/avr/src/atmega/atmega_serial.c b/nuttx/arch/avr/src/atmega/atmega_serial.c index b3106b1d0..ec8a9b6f5 100644 --- a/nuttx/arch/avr/src/atmega/atmega_serial.c +++ b/nuttx/arch/avr/src/atmega/atmega_serial.c @@ -51,7 +51,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <avr/io.h> #include <arch/board/board.h> diff --git a/nuttx/arch/mips/src/pic32mx/pic32mx-serial.c b/nuttx/arch/mips/src/pic32mx/pic32mx-serial.c index f04e7f682..6cb566bb6 100644 --- a/nuttx/arch/mips/src/pic32mx/pic32mx-serial.c +++ b/nuttx/arch/mips/src/pic32mx/pic32mx-serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/board/board.h> diff --git a/nuttx/arch/rgmp/src/x86/com.c b/nuttx/arch/rgmp/src/x86/com.c index 36ca15238..e5e7f70f6 100644 --- a/nuttx/arch/rgmp/src/x86/com.c +++ b/nuttx/arch/rgmp/src/x86/com.c @@ -51,7 +51,7 @@ #include <debug.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <nuttx/kmalloc.h> #include <arch/com.h> diff --git a/nuttx/arch/sh/src/m16c/m16c_serial.c b/nuttx/arch/sh/src/m16c/m16c_serial.c index a3bc2485c..0027d423a 100644 --- a/nuttx/arch/sh/src/m16c/m16c_serial.c +++ b/nuttx/arch/sh/src/m16c/m16c_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "chip.h" diff --git a/nuttx/arch/sh/src/sh1/sh1_serial.c b/nuttx/arch/sh/src/sh1/sh1_serial.c index 027da35fa..e696c96f5 100644 --- a/nuttx/arch/sh/src/sh1/sh1_serial.c +++ b/nuttx/arch/sh/src/sh1/sh1_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "chip.h" diff --git a/nuttx/arch/x86/src/qemu/qemu_serial.c b/nuttx/arch/x86/src/qemu/qemu_serial.c index 4c7d462ea..8419c67d9 100644 --- a/nuttx/arch/x86/src/qemu/qemu_serial.c +++ b/nuttx/arch/x86/src/qemu/qemu_serial.c @@ -40,7 +40,7 @@ #include <nuttx/config.h> #include <nuttx/arch.h> -#include <nuttx/uart_16550.h> +#include <nuttx/serial/uart_16550.h> #include <arch/io.h> diff --git a/nuttx/arch/z16/src/z16f/z16f_serial.c b/nuttx/arch/z16/src/z16f/z16f_serial.c index ffe03decc..42c814737 100644 --- a/nuttx/arch/z16/src/z16f/z16f_serial.c +++ b/nuttx/arch/z16/src/z16f/z16f_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "chip/chip.h" diff --git a/nuttx/arch/z80/src/ez80/ez80_serial.c b/nuttx/arch/z80/src/ez80/ez80_serial.c index 8fbbe46c1..c6631c47a 100644 --- a/nuttx/arch/z80/src/ez80/ez80_serial.c +++ b/nuttx/arch/z80/src/ez80/ez80_serial.c @@ -50,7 +50,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include <arch/io.h> diff --git a/nuttx/arch/z80/src/z8/z8_serial.c b/nuttx/arch/z80/src/z8/z8_serial.c index db13ab67d..eb7305bbc 100755 --- a/nuttx/arch/z80/src/z8/z8_serial.c +++ b/nuttx/arch/z80/src/z8/z8_serial.c @@ -51,7 +51,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "chip/chip.h" diff --git a/nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb b/nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb Binary files differindex 935e97e45..db83e52db 100755 --- a/nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb +++ b/nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb diff --git a/nuttx/configs/xtrs/src/xtr_serial.c b/nuttx/configs/xtrs/src/xtr_serial.c index c0c9f1f4c..df76b1e3f 100644 --- a/nuttx/configs/xtrs/src/xtr_serial.c +++ b/nuttx/configs/xtrs/src/xtr_serial.c @@ -53,7 +53,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "up_arch.h" diff --git a/nuttx/configs/z80sim/src/z80_serial.c b/nuttx/configs/z80sim/src/z80_serial.c index bdb4e6221..d699b4598 100644 --- a/nuttx/configs/z80sim/src/z80_serial.c +++ b/nuttx/configs/z80sim/src/z80_serial.c @@ -49,7 +49,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <arch/serial.h> #include "up_arch.h" diff --git a/nuttx/drivers/README.txt b/nuttx/drivers/README.txt index 584edc4dd..ff67d8ede 100644 --- a/nuttx/drivers/README.txt +++ b/nuttx/drivers/README.txt @@ -106,7 +106,7 @@ sensors/ serial/ Front-end character drivers for chip-specific UARTs. This provide some TTY-like functionality and are commonly used (but not required for) - the NuttX system console. See also include/nuttx/serial.h + the NuttX system console. See also include/nuttx/serial/serial.h usbdev/ USB device drivers. See also include/nuttx/usb/usbdev.h diff --git a/nuttx/drivers/serial/serial.c b/nuttx/drivers/serial/serial.c index 43f3cd8e0..2fbd94cfd 100644 --- a/nuttx/drivers/serial/serial.c +++ b/nuttx/drivers/serial/serial.c @@ -53,7 +53,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> #include <nuttx/fs/fs.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> /************************************************************************************ * Definitions diff --git a/nuttx/drivers/serial/serialirq.c b/nuttx/drivers/serial/serialirq.c index 22af6896f..f42e0ad22 100644 --- a/nuttx/drivers/serial/serialirq.c +++ b/nuttx/drivers/serial/serialirq.c @@ -43,7 +43,7 @@ #include <stdint.h> #include <semaphore.h> #include <debug.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> /************************************************************************************ * Pre-processor Definitions diff --git a/nuttx/drivers/serial/uart_16550.c b/nuttx/drivers/serial/uart_16550.c index 201751dd0..9bebcd3f6 100644 --- a/nuttx/drivers/serial/uart_16550.c +++ b/nuttx/drivers/serial/uart_16550.c @@ -51,9 +51,9 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <nuttx/fs/ioctl.h> -#include <nuttx/uart_16550.h> +#include <nuttx/serial/uart_16550.h> #include <arch/board/board.h> diff --git a/nuttx/drivers/usbdev/cdcacm.c b/nuttx/drivers/usbdev/cdcacm.c index cefdf1b6b..bb8a74024 100644 --- a/nuttx/drivers/usbdev/cdcacm.c +++ b/nuttx/drivers/usbdev/cdcacm.c @@ -53,7 +53,7 @@ #include <nuttx/kmalloc.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <nuttx/usb/usb.h> #include <nuttx/usb/cdc.h> diff --git a/nuttx/drivers/usbdev/pl2303.c b/nuttx/drivers/usbdev/pl2303.c index f285e506b..48db77c8a 100644 --- a/nuttx/drivers/usbdev/pl2303.c +++ b/nuttx/drivers/usbdev/pl2303.c @@ -55,7 +55,7 @@ #include <nuttx/kmalloc.h> #include <nuttx/arch.h> -#include <nuttx/serial.h> +#include <nuttx/serial/serial.h> #include <nuttx/usb/usb.h> #include <nuttx/usb/usbdev.h> #include <nuttx/usb/usbdev_trace.h> diff --git a/nuttx/include/nuttx/fs/ioctl.h b/nuttx/include/nuttx/fs/ioctl.h index 8832f212e..fe28b1128 100644 --- a/nuttx/include/nuttx/fs/ioctl.h +++ b/nuttx/include/nuttx/fs/ioctl.h @@ -82,7 +82,7 @@ /* Terminal I/O IOCTL definitions are retained in tioctl.h */ -#include <nuttx/tioctl.h> +#include <nuttx/serial/tioctl.h> /* Watchdog driver ioctl commands *******************************************/ diff --git a/nuttx/include/nuttx/serial.h b/nuttx/include/nuttx/serial/serial.h index 88faca879..1c40f1b6b 100644 --- a/nuttx/include/nuttx/serial.h +++ b/nuttx/include/nuttx/serial/serial.h @@ -1,5 +1,5 @@ /************************************************************************************ - * include/nuttx/serial.h + * include/nuttx/serial/serial.h * * Copyright (C) 2007-2008, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __INCLUDE_NUTTX_SERIAL_H -#define __INCLUDE_NUTTX_SERIAL_H +#ifndef __INCLUDE_NUTTX_SERIAL_SERIAL_H +#define __INCLUDE_NUTTX_SERIAL_SERIAL_H /************************************************************************************ * Included Files @@ -299,4 +299,4 @@ EXTERN void uart_datasent(FAR uart_dev_t *dev); } #endif -#endif /* __INCLUDE_NUTTX_SERIAL_H */ +#endif /* __INCLUDE_NUTTX_SERIAL_SERIAL_H */ diff --git a/nuttx/include/nuttx/tioctl.h b/nuttx/include/nuttx/serial/tioctl.h index 69d965ca8..a3ce2c7d3 100644 --- a/nuttx/include/nuttx/tioctl.h +++ b/nuttx/include/nuttx/serial/tioctl.h @@ -1,5 +1,5 @@ /******************************************************************************************** - * include/nuttx/tioctl.h + * include/nuttx/serial/tioctl.h * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -36,8 +36,8 @@ * via include/nuttx/fs/ioctl.h. */ -#ifndef __INCLUDE_NUTTX_TIOCTL_H -#define __INCLUDE_NUTTX_TIOCTL_H +#ifndef __INCLUDE_NUTTX_SERIAL_TIOCTL_H +#define __INCLUDE_NUTTX_SERIAL_TIOCTL_H /******************************************************************************************** * Included Files @@ -194,4 +194,4 @@ extern "C" { } #endif -#endif /* __INCLUDE_NUTTX_TIOCTL_H */ +#endif /* __INCLUDE_NUTTX_SERIAL_TIOCTL_H */ diff --git a/nuttx/include/nuttx/uart_16550.h b/nuttx/include/nuttx/serial/uart_16550.h index 3ab6552b0..bc7ab8f95 100644 --- a/nuttx/include/nuttx/uart_16550.h +++ b/nuttx/include/nuttx/serial/uart_16550.h @@ -1,351 +1,351 @@ -/************************************************************************************
- * include/nuttx/uart_16550.h
- * Serial driver for 16550 UART
- *
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __INCLUDE_NUTTX_UART_16550_H
-#define __INCLUDE_NUTTX_UART_16550_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include <nuttx/config.h>
-
-#ifdef CONFIG_16550_UART
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* CONFIGURATION ********************************************************************/
-
-/* Are any UARTs enabled? */
-
-#undef HAVE_UART
-#if defined(CONFIG_16550_UART0) || defined(CONFIG_16550_UART1) || \
- defined(CONFIG_16550_UART2) || defined(CONFIG_16550_UART3)
-# define HAVE_UART 1
-#endif
-
-/* We need to be told the address increment between registers and the register bit
- * width.
- */
-
-#ifndef CONFIG_16550_REGINCR
-# error "CONFIG_16550_REGINCR not defined"
-#endif
-
-#if CONFIG_16550_REGINCR != 1 && CONFIG_16550_REGINCR != 2 && CONFIG_16550_REGINCR != 4
-# error "CONFIG_16550_REGINCR not supported"
-#endif
-
-#ifndef CONFIG_16550_REGWIDTH
-# error "CONFIG_16550_REGWIDTH not defined"
-#endif
-
-#if CONFIG_16550_REGWIDTH != 8 && CONFIG_16550_REGWIDTH != 16 && CONFIG_16550_REGWIDTH != 32
-# error "CONFIG_16550_REGWIDTH not supported"
-#endif
-
-#ifndef CONFIG_16550_ADDRWIDTH
-# error "CONFIG_16550_ADDRWIDTH not defined"
-#endif
-
-#if CONFIG_16550_ADDRWIDTH != 8 && CONFIG_16550_ADDRWIDTH != 16 && CONFIG_16550_ADDRWIDTH != 32
-# error "CONFIG_16550_ADDRWIDTH not supported"
-#endif
-
-/* If a UART is enabled, then its base address, clock, and IRQ must also be provided */
-
-#ifdef CONFIG_16550_UART0
-# ifndef CONFIG_16550_UART0_BASE
-# error "CONFIG_16550_UART0_BASE not provided"
-# undef CONFIG_16550_UART0
-# endif
-# ifndef CONFIG_16550_UART0_CLOCK
-# error "CONFIG_16550_UART0_CLOCK not provided"
-# undef CONFIG_16550_UART0
-# endif
-# ifndef CONFIG_16550_UART0_IRQ
-# error "CONFIG_16550_UART0_IRQ not provided"
-# undef CONFIG_16550_UART0
-# endif
-#endif
-
-#ifdef CONFIG_16550_UART1
-# ifndef CONFIG_16550_UART1_BASE
-# error "CONFIG_16550_UART1_BASE not provided"
-# undef CONFIG_16550_UART1
-# endif
-# ifndef CONFIG_16550_UART1_CLOCK
-# error "CONFIG_16550_UART1_CLOCK not provided"
-# undef CONFIG_16550_UART1
-# endif
-# ifndef CONFIG_16550_UART1_IRQ
-# error "CONFIG_16550_UART1_IRQ not provided"
-# undef CONFIG_16550_UART1
-# endif
-#endif
-
-#ifdef CONFIG_16550_UART2
-# ifndef CONFIG_16550_UART2_BASE
-# error "CONFIG_16550_UART2_BASE not provided"
-# undef CONFIG_16550_UART2
-# endif
-# ifndef CONFIG_16550_UART2_CLOCK
-# error "CONFIG_16550_UART2_CLOCK not provided"
-# undef CONFIG_16550_UART2
-# endif
-# ifndef CONFIG_16550_UART2_IRQ
-# error "CONFIG_16550_UART2_IRQ not provided"
-# undef CONFIG_16550_UART2
-# endif
-#endif
-
-#ifdef CONFIG_16550_UART3
-# ifndef CONFIG_16550_UART3_BASE
-# error "CONFIG_16550_UART3_BASE not provided"
-# undef CONFIG_16550_UART3
-# endif
-# ifndef CONFIG_16550_UART3_CLOCK
-# error "CONFIG_16550_UART3_CLOCK not provided"
-# undef CONFIG_16550_UART3
-# endif
-# ifndef CONFIG_16550_UART3_IRQ
-# error "CONFIG_16550_UART3_IRQ not provided"
-# undef CONFIG_16550_UART3
-# endif
-#endif
-
-/* Is there a serial console? There should be at most one defined. It could be on
- * any UARTn, n=0,1,2,3
- */
-
-#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_16550_UART0)
-# undef CONFIG_UART1_SERIAL_CONSOLE
-# undef CONFIG_UART2_SERIAL_CONSOLE
-# undef CONFIG_UART3_SERIAL_CONSOLE
-# define HAVE_16550_CONSOLE 1
-#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_16550_UART1)
-# undef CONFIG_UART0_SERIAL_CONSOLE
-# undef CONFIG_UART2_SERIAL_CONSOLE
-# undef CONFIG_UART3_SERIAL_CONSOLE
-# define HAVE_16550_CONSOLE 1
-#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_16550_UART2)
-# undef CONFIG_UART0_SERIAL_CONSOLE
-# undef CONFIG_UART1_SERIAL_CONSOLE
-# undef CONFIG_UART3_SERIAL_CONSOLE
-# define HAVE_16550_CONSOLE 1
-#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_16550_UART3)
-# undef CONFIG_UART0_SERIAL_CONSOLE
-# undef CONFIG_UART1_SERIAL_CONSOLE
-# undef CONFIG_UART2_SERIAL_CONSOLE
-# define HAVE_16550_CONSOLE 1
-#else
-# undef CONFIG_UART0_SERIAL_CONSOLE
-# undef CONFIG_UART1_SERIAL_CONSOLE
-# undef CONFIG_UART2_SERIAL_CONSOLE
-# undef CONFIG_UART3_SERIAL_CONSOLE
-# undef HAVE_16550_CONSOLE
-#endif
-
-/* Register offsets *****************************************************************/
-
-#define UART_RBR_INCR 0 /* (DLAB =0) Receiver Buffer Register */
-#define UART_THR_INCR 0 /* (DLAB =0) Transmit Holding Register */
-#define UART_DLL_INCR 0 /* (DLAB =1) Divisor Latch LSB */
-#define UART_DLM_INCR 1 /* (DLAB =1) Divisor Latch MSB */
-#define UART_IER_INCR 1 /* (DLAB =0) Interrupt Enable Register */
-#define UART_IIR_INCR 2 /* Interrupt ID Register */
-#define UART_FCR_INCR 2 /* FIFO Control Register */
-#define UART_LCR_INCR 3 /* Line Control Register */
-#define UART_MCR_INCR 4 /* Modem Control Register */
-#define UART_LSR_INCR 5 /* Line Status Register */
-#define UART_MSR_INCR 6 /* Modem Status Register */
-#define UART_SCR_INCR 7 /* Scratch Pad Register */
-
-#define UART_RBR_OFFSET (CONFIG_16550_REGINCR*UART_RBR_INCR)
-#define UART_THR_OFFSET (CONFIG_16550_REGINCR*UART_THR_INCR)
-#define UART_DLL_OFFSET (CONFIG_16550_REGINCR*UART_DLL_INCR)
-#define UART_DLM_OFFSET (CONFIG_16550_REGINCR*UART_DLM_INCR)
-#define UART_IER_OFFSET (CONFIG_16550_REGINCR*UART_IER_INCR)
-#define UART_IIR_OFFSET (CONFIG_16550_REGINCR*UART_IIR_INCR)
-#define UART_FCR_OFFSET (CONFIG_16550_REGINCR*UART_FCR_INCR)
-#define UART_LCR_OFFSET (CONFIG_16550_REGINCR*UART_LCR_INCR)
-#define UART_MCR_OFFSET (CONFIG_16550_REGINCR*UART_MCR_INCR)
-#define UART_LSR_OFFSET (CONFIG_16550_REGINCR*UART_LSR_INCR)
-#define UART_MSR_OFFSET (CONFIG_16550_REGINCR*UART_MSR_INCR)
-#define UART_SCR_OFFSET (CONFIG_16550_REGINCR*UART_SCR_INCR)
-
-/* Register bit definitions *********************************************************/
-
-/* RBR (DLAB =0) Receiver Buffer Register */
-
-#define UART_RBR_MASK (0xff) /* Bits 0-7: Oldest received byte in RX FIFO */
- /* Bits 8-31: Reserved */
-
-/* THR (DLAB =0) Transmit Holding Register */
-
-#define UART_THR_MASK (0xff) /* Bits 0-7: Adds byte to TX FIFO */
- /* Bits 8-31: Reserved */
-
-/* DLL (DLAB =1) Divisor Latch LSB */
-
-#define UART_DLL_MASK (0xff) /* Bits 0-7: DLL */
- /* Bits 8-31: Reserved */
-
-/* DLM (DLAB =1) Divisor Latch MSB */
-
-#define UART_DLM_MASK (0xff) /* Bits 0-7: DLM */
- /* Bits 8-31: Reserved */
-
-/* IER (DLAB =0) Interrupt Enable Register */
-
-#define UART_IER_ERBFI (1 << 0) /* Bit 0: Enable received data available interrupt */
-#define UART_IER_ETBEI (1 << 1) /* Bit 1: Enable THR empty interrupt */
-#define UART_IER_ELSI (1 << 2) /* Bit 2: Enable receiver line status interrupt */
-#define UART_IER_EDSSI (1 << 3) /* Bit 3: Enable MODEM status interrupt */
- /* Bits 4-7: Reserved */
-#define UART_IER_ALLIE (0x0f)
-
-/* IIR Interrupt ID Register */
-
-#define UART_IIR_INTSTATUS (1 << 0) /* Bit 0: Interrupt status (active low) */
-#define UART_IIR_INTID_SHIFT (1) /* Bits 1-3: Interrupt identification */
-#define UART_IIR_INTID_MASK (7 << UART_IIR_INTID_SHIFT)
-# define UART_IIR_INTID_MSI (0 << UART_IIR_INTID_SHIFT) /* Modem Status */
-# define UART_IIR_INTID_THRE (1 << UART_IIR_INTID_SHIFT) /* THR Empty Interrupt */
-# define UART_IIR_INTID_RDA (2 << UART_IIR_INTID_SHIFT) /* Receive Data Available (RDA) */
-# define UART_IIR_INTID_RLS (3 << UART_IIR_INTID_SHIFT) /* Receiver Line Status (RLS) */
-# define UART_IIR_INTID_CTI (6 << UART_IIR_INTID_SHIFT) /* Character Time-out Indicator (CTI) */
- /* Bits 4-5: Reserved */
-#define UART_IIR_FIFOEN_SHIFT (6) /* Bits 6-7: RCVR FIFO interrupt */
-#define UART_IIR_FIFOEN_MASK (3 << UART_IIR_FIFOEN_SHIFT)
-
-/* FCR FIFO Control Register */
-
-#define UART_FCR_FIFOEN (1 << 0) /* Bit 0: Enable FIFOs */
-#define UART_FCR_RXRST (1 << 1) /* Bit 1: RX FIFO Reset */
-#define UART_FCR_TXRST (1 << 2) /* Bit 2: TX FIFO Reset */
-#define UART_FCR_DMAMODE (1 << 3) /* Bit 3: DMA Mode Select */
- /* Bits 4-5: Reserved */
-#define UART_FCR_RXTRIGGER_SHIFT (6) /* Bits 6-7: RX Trigger Level */
-#define UART_FCR_RXTRIGGER_MASK (3 << UART_FCR_RXTRIGGER_SHIFT)
-# define UART_FCR_RXTRIGGER_1 (0 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 0 (1 character) */
-# define UART_FCR_RXTRIGGER_4 (1 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 1 (4 characters) */
-# define UART_FCR_RXTRIGGER_8 (2 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 2 (8 characters) */
-# define UART_FCR_RXTRIGGER_14 (3 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 3 (14 characters) */
-
-/* LCR Line Control Register */
-
-#define UART_LCR_WLS_SHIFT (0) /* Bit 0-1: Word Length Select */
-#define UART_LCR_WLS_MASK (3 << UART_LCR_WLS_SHIFT)
-# define UART_LCR_WLS_5BIT (0 << UART_LCR_WLS_SHIFT)
-# define UART_LCR_WLS_6BIT (1 << UART_LCR_WLS_SHIFT)
-# define UART_LCR_WLS_7BIT (2 << UART_LCR_WLS_SHIFT)
-# define UART_LCR_WLS_8BIT (3 << UART_LCR_WLS_SHIFT)
-#define UART_LCR_STB (1 << 2) /* Bit 2: Number of Stop Bits */
-#define UART_LCR_PEN (1 << 3) /* Bit 3: Parity Enable */
-#define UART_LCR_EPS (1 << 4) /* Bit 4: Even Parity Select */
-#define UART_LCR_STICKY (1 << 5) /* Bit 5: Stick Parity */
-#define UART_LCR_BRK (1 << 6) /* Bit 6: Break Control */
-#define UART_LCR_DLAB (1 << 7) /* Bit 7: Divisor Latch Access Bit (DLAB) */
-
-/* MCR Modem Control Register */
-
-#define UART_MCR_DTR (1 << 0) /* Bit 0: DTR Control Source for DTR output */
-#define UART_MCR_RTS (1 << 1) /* Bit 1: Control Source for RTS output */
-#define UART_MCR_OUT1 (1 << 2) /* Bit 2: Auxiliary user-defined output 1 */
-#define UART_MCR_OUT2 (1 << 3) /* Bit 3: Auxiliary user-defined output 2 */
-#define UART_MCR_LPBK (1 << 4) /* Bit 4: Loopback Mode Select */
- /* Bit 5-7: Reserved */
-
-/* LSR Line Status Register */
-
-#define UART_LSR_DR (1 << 0) /* Bit 0: Data Ready */
-#define UART_LSR_OE (1 << 1) /* Bit 1: Overrun Error */
-#define UART_LSR_PE (1 << 2) /* Bit 2: Parity Error */
-#define UART_LSR_FE (1 << 3) /* Bit 3: Framing Error */
-#define UART_LSR_BI (1 << 4) /* Bit 4: Break Interrupt */
-#define UART_LSR_THRE (1 << 5) /* Bit 5: Transmitter Holding Register Empty */
-#define UART_LSR_TEMT (1 << 6) /* Bit 6: Transmitter Empty */
-#define UART_LSR_RXFE (1 << 7) /* Bit 7: Error in RX FIFO (RXFE) */
-
-/* SCR Scratch Pad Register */
-
-#define UART_SCR_MASK (0xff) /* Bits 0-7: SCR data */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-#if CONFIG_16550_REGWIDTH == 8
-typedef uint8_t uart_datawidth_t;
-#elif CONFIG_16550_REGWIDTH == 16
-typedef uint16_t uart_datawidth_t;
-#elif CONFIG_16550_REGWIDTH == 32
-typedef uint32_t uart_datawidth_t;
-#endif
-
-#if CONFIG_16550_ADDRWIDTH == 8
-typedef uint8_t uart_addrwidth_t;
-#elif CONFIG_16550_ADDRWIDTH == 16
-typedef uint16_t uart_addrwidth_t;
-#elif CONFIG_16550_ADDRWIDTH == 32
-typedef uint32_t uart_addrwidth_t;
-#endif
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-/************************************************************************************
- * Name: uart_getreg(), uart_putreg()
- *
- * Description:
- * These functions must be provided by the processor-specific code in order to
- * correctly access 16550 registers
- *
- ************************************************************************************/
-
-extern uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset);
-extern void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value);
-
-#endif /* CONFIG_UART_16550 */
-#endif /* __INCLUDE_NUTTX_UART_16550_H */
+/************************************************************************************ + * include/nuttx/serial/uart_16550.h + * Serial driver for 16550 UART + * + * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +#ifndef __INCLUDE_NUTTX_SERIAL_UART_16550_H +#define __INCLUDE_NUTTX_SERIAL_UART_16550_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include <nuttx/config.h> + +#ifdef CONFIG_16550_UART + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* CONFIGURATION ********************************************************************/ + +/* Are any UARTs enabled? */ + +#undef HAVE_UART +#if defined(CONFIG_16550_UART0) || defined(CONFIG_16550_UART1) || \ + defined(CONFIG_16550_UART2) || defined(CONFIG_16550_UART3) +# define HAVE_UART 1 +#endif + +/* We need to be told the address increment between registers and the register bit + * width. + */ + +#ifndef CONFIG_16550_REGINCR +# error "CONFIG_16550_REGINCR not defined" +#endif + +#if CONFIG_16550_REGINCR != 1 && CONFIG_16550_REGINCR != 2 && CONFIG_16550_REGINCR != 4 +# error "CONFIG_16550_REGINCR not supported" +#endif + +#ifndef CONFIG_16550_REGWIDTH +# error "CONFIG_16550_REGWIDTH not defined" +#endif + +#if CONFIG_16550_REGWIDTH != 8 && CONFIG_16550_REGWIDTH != 16 && CONFIG_16550_REGWIDTH != 32 +# error "CONFIG_16550_REGWIDTH not supported" +#endif + +#ifndef CONFIG_16550_ADDRWIDTH +# error "CONFIG_16550_ADDRWIDTH not defined" +#endif + +#if CONFIG_16550_ADDRWIDTH != 8 && CONFIG_16550_ADDRWIDTH != 16 && CONFIG_16550_ADDRWIDTH != 32 +# error "CONFIG_16550_ADDRWIDTH not supported" +#endif + +/* If a UART is enabled, then its base address, clock, and IRQ must also be provided */ + +#ifdef CONFIG_16550_UART0 +# ifndef CONFIG_16550_UART0_BASE +# error "CONFIG_16550_UART0_BASE not provided" +# undef CONFIG_16550_UART0 +# endif +# ifndef CONFIG_16550_UART0_CLOCK +# error "CONFIG_16550_UART0_CLOCK not provided" +# undef CONFIG_16550_UART0 +# endif +# ifndef CONFIG_16550_UART0_IRQ +# error "CONFIG_16550_UART0_IRQ not provided" +# undef CONFIG_16550_UART0 +# endif +#endif + +#ifdef CONFIG_16550_UART1 +# ifndef CONFIG_16550_UART1_BASE +# error "CONFIG_16550_UART1_BASE not provided" +# undef CONFIG_16550_UART1 +# endif +# ifndef CONFIG_16550_UART1_CLOCK +# error "CONFIG_16550_UART1_CLOCK not provided" +# undef CONFIG_16550_UART1 +# endif +# ifndef CONFIG_16550_UART1_IRQ +# error "CONFIG_16550_UART1_IRQ not provided" +# undef CONFIG_16550_UART1 +# endif +#endif + +#ifdef CONFIG_16550_UART2 +# ifndef CONFIG_16550_UART2_BASE +# error "CONFIG_16550_UART2_BASE not provided" +# undef CONFIG_16550_UART2 +# endif +# ifndef CONFIG_16550_UART2_CLOCK +# error "CONFIG_16550_UART2_CLOCK not provided" +# undef CONFIG_16550_UART2 +# endif +# ifndef CONFIG_16550_UART2_IRQ +# error "CONFIG_16550_UART2_IRQ not provided" +# undef CONFIG_16550_UART2 +# endif +#endif + +#ifdef CONFIG_16550_UART3 +# ifndef CONFIG_16550_UART3_BASE +# error "CONFIG_16550_UART3_BASE not provided" +# undef CONFIG_16550_UART3 +# endif +# ifndef CONFIG_16550_UART3_CLOCK +# error "CONFIG_16550_UART3_CLOCK not provided" +# undef CONFIG_16550_UART3 +# endif +# ifndef CONFIG_16550_UART3_IRQ +# error "CONFIG_16550_UART3_IRQ not provided" +# undef CONFIG_16550_UART3 +# endif +#endif + +/* Is there a serial console? There should be at most one defined. It could be on + * any UARTn, n=0,1,2,3 + */ + +#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_16550_UART0) +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# define HAVE_16550_CONSOLE 1 +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_16550_UART1) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# define HAVE_16550_CONSOLE 1 +#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_16550_UART2) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# define HAVE_16550_CONSOLE 1 +#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_16550_UART3) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# define HAVE_16550_CONSOLE 1 +#else +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef HAVE_16550_CONSOLE +#endif + +/* Register offsets *****************************************************************/ + +#define UART_RBR_INCR 0 /* (DLAB =0) Receiver Buffer Register */ +#define UART_THR_INCR 0 /* (DLAB =0) Transmit Holding Register */ +#define UART_DLL_INCR 0 /* (DLAB =1) Divisor Latch LSB */ +#define UART_DLM_INCR 1 /* (DLAB =1) Divisor Latch MSB */ +#define UART_IER_INCR 1 /* (DLAB =0) Interrupt Enable Register */ +#define UART_IIR_INCR 2 /* Interrupt ID Register */ +#define UART_FCR_INCR 2 /* FIFO Control Register */ +#define UART_LCR_INCR 3 /* Line Control Register */ +#define UART_MCR_INCR 4 /* Modem Control Register */ +#define UART_LSR_INCR 5 /* Line Status Register */ +#define UART_MSR_INCR 6 /* Modem Status Register */ +#define UART_SCR_INCR 7 /* Scratch Pad Register */ + +#define UART_RBR_OFFSET (CONFIG_16550_REGINCR*UART_RBR_INCR) +#define UART_THR_OFFSET (CONFIG_16550_REGINCR*UART_THR_INCR) +#define UART_DLL_OFFSET (CONFIG_16550_REGINCR*UART_DLL_INCR) +#define UART_DLM_OFFSET (CONFIG_16550_REGINCR*UART_DLM_INCR) +#define UART_IER_OFFSET (CONFIG_16550_REGINCR*UART_IER_INCR) +#define UART_IIR_OFFSET (CONFIG_16550_REGINCR*UART_IIR_INCR) +#define UART_FCR_OFFSET (CONFIG_16550_REGINCR*UART_FCR_INCR) +#define UART_LCR_OFFSET (CONFIG_16550_REGINCR*UART_LCR_INCR) +#define UART_MCR_OFFSET (CONFIG_16550_REGINCR*UART_MCR_INCR) +#define UART_LSR_OFFSET (CONFIG_16550_REGINCR*UART_LSR_INCR) +#define UART_MSR_OFFSET (CONFIG_16550_REGINCR*UART_MSR_INCR) +#define UART_SCR_OFFSET (CONFIG_16550_REGINCR*UART_SCR_INCR) + +/* Register bit definitions *********************************************************/ + +/* RBR (DLAB =0) Receiver Buffer Register */ + +#define UART_RBR_MASK (0xff) /* Bits 0-7: Oldest received byte in RX FIFO */ + /* Bits 8-31: Reserved */ + +/* THR (DLAB =0) Transmit Holding Register */ + +#define UART_THR_MASK (0xff) /* Bits 0-7: Adds byte to TX FIFO */ + /* Bits 8-31: Reserved */ + +/* DLL (DLAB =1) Divisor Latch LSB */ + +#define UART_DLL_MASK (0xff) /* Bits 0-7: DLL */ + /* Bits 8-31: Reserved */ + +/* DLM (DLAB =1) Divisor Latch MSB */ + +#define UART_DLM_MASK (0xff) /* Bits 0-7: DLM */ + /* Bits 8-31: Reserved */ + +/* IER (DLAB =0) Interrupt Enable Register */ + +#define UART_IER_ERBFI (1 << 0) /* Bit 0: Enable received data available interrupt */ +#define UART_IER_ETBEI (1 << 1) /* Bit 1: Enable THR empty interrupt */ +#define UART_IER_ELSI (1 << 2) /* Bit 2: Enable receiver line status interrupt */ +#define UART_IER_EDSSI (1 << 3) /* Bit 3: Enable MODEM status interrupt */ + /* Bits 4-7: Reserved */ +#define UART_IER_ALLIE (0x0f) + +/* IIR Interrupt ID Register */ + +#define UART_IIR_INTSTATUS (1 << 0) /* Bit 0: Interrupt status (active low) */ +#define UART_IIR_INTID_SHIFT (1) /* Bits 1-3: Interrupt identification */ +#define UART_IIR_INTID_MASK (7 << UART_IIR_INTID_SHIFT) +# define UART_IIR_INTID_MSI (0 << UART_IIR_INTID_SHIFT) /* Modem Status */ +# define UART_IIR_INTID_THRE (1 << UART_IIR_INTID_SHIFT) /* THR Empty Interrupt */ +# define UART_IIR_INTID_RDA (2 << UART_IIR_INTID_SHIFT) /* Receive Data Available (RDA) */ +# define UART_IIR_INTID_RLS (3 << UART_IIR_INTID_SHIFT) /* Receiver Line Status (RLS) */ +# define UART_IIR_INTID_CTI (6 << UART_IIR_INTID_SHIFT) /* Character Time-out Indicator (CTI) */ + /* Bits 4-5: Reserved */ +#define UART_IIR_FIFOEN_SHIFT (6) /* Bits 6-7: RCVR FIFO interrupt */ +#define UART_IIR_FIFOEN_MASK (3 << UART_IIR_FIFOEN_SHIFT) + +/* FCR FIFO Control Register */ + +#define UART_FCR_FIFOEN (1 << 0) /* Bit 0: Enable FIFOs */ +#define UART_FCR_RXRST (1 << 1) /* Bit 1: RX FIFO Reset */ +#define UART_FCR_TXRST (1 << 2) /* Bit 2: TX FIFO Reset */ +#define UART_FCR_DMAMODE (1 << 3) /* Bit 3: DMA Mode Select */ + /* Bits 4-5: Reserved */ +#define UART_FCR_RXTRIGGER_SHIFT (6) /* Bits 6-7: RX Trigger Level */ +#define UART_FCR_RXTRIGGER_MASK (3 << UART_FCR_RXTRIGGER_SHIFT) +# define UART_FCR_RXTRIGGER_1 (0 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 0 (1 character) */ +# define UART_FCR_RXTRIGGER_4 (1 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 1 (4 characters) */ +# define UART_FCR_RXTRIGGER_8 (2 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 2 (8 characters) */ +# define UART_FCR_RXTRIGGER_14 (3 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 3 (14 characters) */ + +/* LCR Line Control Register */ + +#define UART_LCR_WLS_SHIFT (0) /* Bit 0-1: Word Length Select */ +#define UART_LCR_WLS_MASK (3 << UART_LCR_WLS_SHIFT) +# define UART_LCR_WLS_5BIT (0 << UART_LCR_WLS_SHIFT) +# define UART_LCR_WLS_6BIT (1 << UART_LCR_WLS_SHIFT) +# define UART_LCR_WLS_7BIT (2 << UART_LCR_WLS_SHIFT) +# define UART_LCR_WLS_8BIT (3 << UART_LCR_WLS_SHIFT) +#define UART_LCR_STB (1 << 2) /* Bit 2: Number of Stop Bits */ +#define UART_LCR_PEN (1 << 3) /* Bit 3: Parity Enable */ +#define UART_LCR_EPS (1 << 4) /* Bit 4: Even Parity Select */ +#define UART_LCR_STICKY (1 << 5) /* Bit 5: Stick Parity */ +#define UART_LCR_BRK (1 << 6) /* Bit 6: Break Control */ +#define UART_LCR_DLAB (1 << 7) /* Bit 7: Divisor Latch Access Bit (DLAB) */ + +/* MCR Modem Control Register */ + +#define UART_MCR_DTR (1 << 0) /* Bit 0: DTR Control Source for DTR output */ +#define UART_MCR_RTS (1 << 1) /* Bit 1: Control Source for RTS output */ +#define UART_MCR_OUT1 (1 << 2) /* Bit 2: Auxiliary user-defined output 1 */ +#define UART_MCR_OUT2 (1 << 3) /* Bit 3: Auxiliary user-defined output 2 */ +#define UART_MCR_LPBK (1 << 4) /* Bit 4: Loopback Mode Select */ + /* Bit 5-7: Reserved */ + +/* LSR Line Status Register */ + +#define UART_LSR_DR (1 << 0) /* Bit 0: Data Ready */ +#define UART_LSR_OE (1 << 1) /* Bit 1: Overrun Error */ +#define UART_LSR_PE (1 << 2) /* Bit 2: Parity Error */ +#define UART_LSR_FE (1 << 3) /* Bit 3: Framing Error */ +#define UART_LSR_BI (1 << 4) /* Bit 4: Break Interrupt */ +#define UART_LSR_THRE (1 << 5) /* Bit 5: Transmitter Holding Register Empty */ +#define UART_LSR_TEMT (1 << 6) /* Bit 6: Transmitter Empty */ +#define UART_LSR_RXFE (1 << 7) /* Bit 7: Error in RX FIFO (RXFE) */ + +/* SCR Scratch Pad Register */ + +#define UART_SCR_MASK (0xff) /* Bits 0-7: SCR data */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +#if CONFIG_16550_REGWIDTH == 8 +typedef uint8_t uart_datawidth_t; +#elif CONFIG_16550_REGWIDTH == 16 +typedef uint16_t uart_datawidth_t; +#elif CONFIG_16550_REGWIDTH == 32 +typedef uint32_t uart_datawidth_t; +#endif + +#if CONFIG_16550_ADDRWIDTH == 8 +typedef uint8_t uart_addrwidth_t; +#elif CONFIG_16550_ADDRWIDTH == 16 +typedef uint16_t uart_addrwidth_t; +#elif CONFIG_16550_ADDRWIDTH == 32 +typedef uint32_t uart_addrwidth_t; +#endif + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: uart_getreg(), uart_putreg() + * + * Description: + * These functions must be provided by the processor-specific code in order to + * correctly access 16550 registers + * + ************************************************************************************/ + +extern uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset); +extern void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value); + +#endif /* CONFIG_UART_16550 */ +#endif /* __INCLUDE_NUTTX_SERIAL_UART_16550_H */ diff --git a/nuttx/include/nuttx/usb/cdcacm.h b/nuttx/include/nuttx/usb/cdcacm.h index 4722a2eb7..307f2a597 100644 --- a/nuttx/include/nuttx/usb/cdcacm.h +++ b/nuttx/include/nuttx/usb/cdcacm.h @@ -222,7 +222,7 @@ /* IOCTL Commands ***********************************************************/ /* The USB serial driver will support a subset of the TIOC IOCTL commands - * defined in include/nuttx/tioctl.h. This subset includes: + * defined in include/nuttx/serial/tioctl.h. This subset includes: * * CAICO_REGISTERCB * Register a callback for serial event notification. Argument: diff --git a/nuttx/lib/termios/lib_tcgetattr.c b/nuttx/lib/termios/lib_tcgetattr.c index a267b3f2f..500871d9f 100644 --- a/nuttx/lib/termios/lib_tcgetattr.c +++ b/nuttx/lib/termios/lib_tcgetattr.c @@ -44,7 +44,7 @@ #include <termios.h> #include <errno.h> -#include <nuttx/tioctl.h> +#include <nuttx/serial/tioctl.h> /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/lib/termios/lib_tcsetattr.c b/nuttx/lib/termios/lib_tcsetattr.c index 7868ef219..791b519c8 100644 --- a/nuttx/lib/termios/lib_tcsetattr.c +++ b/nuttx/lib/termios/lib_tcsetattr.c @@ -44,7 +44,7 @@ #include <termios.h> #include <errno.h> -#include <nuttx/tioctl.h> +#include <nuttx/serial/tioctl.h> /**************************************************************************** * Pre-processor Definitions |