summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnuttx/Documentation/README.html2
-rwxr-xr-xnuttx/README.txt2
-rw-r--r--nuttx/drivers/Makefile23
-rw-r--r--nuttx/drivers/README.txt56
-rw-r--r--nuttx/drivers/pipes/Make.defs41
-rw-r--r--nuttx/drivers/pipes/fifo.c (renamed from nuttx/drivers/fifo.c)4
-rw-r--r--nuttx/drivers/pipes/pipe.c (renamed from nuttx/drivers/pipe.c)2
-rw-r--r--nuttx/drivers/pipes/pipe_common.c (renamed from nuttx/drivers/pipe_common.c)2
-rw-r--r--nuttx/drivers/pipes/pipe_common.h (renamed from nuttx/drivers/pipe_common.h)4
-rw-r--r--nuttx/drivers/serial/Make.defs41
-rw-r--r--[-rwxr-xr-x]nuttx/drivers/serial/lowconsole.c (renamed from nuttx/drivers/lowconsole.c)2
-rw-r--r--nuttx/drivers/serial/serial.c (renamed from nuttx/drivers/serial.c)2
-rw-r--r--nuttx/drivers/serial/serialirq.c (renamed from nuttx/drivers/serialirq.c)2
-rw-r--r--nuttx/include/nuttx/ioctl.h55
-rw-r--r--nuttx/include/nuttx/lib.h11
15 files changed, 210 insertions, 39 deletions
diff --git a/nuttx/Documentation/README.html b/nuttx/Documentation/README.html
index 025bd273f..8a727506e 100755
--- a/nuttx/Documentation/README.html
+++ b/nuttx/Documentation/README.html
@@ -123,6 +123,8 @@
| | |- <a href="configs/z8f64200100kit/ostest/README.txt">ostest/README.txt</a>
| | `- <a href="configs/z8f64200100kit/README.txt"><b><i>README.txt</i></b></a>
| `- <a href="configs/README.txt"><b><i>README.txt</i></b></a>
+ |- drivers/
+ | `- <a href="drivers/README.txt"><b><i>README.txt</i></b></a>
|- examples/
| |- <a href="examples/nsh/README.txt"><b><i>nsh/README.txt</i></b></a>
| |- <a href="examples/pashello/README.txt">pashello/README.txt</a>
diff --git a/nuttx/README.txt b/nuttx/README.txt
index c8ce9a978..51cb91277 100755
--- a/nuttx/README.txt
+++ b/nuttx/README.txt
@@ -103,6 +103,8 @@ is a guide to the available README files:
| | |- ostest/README.txt
| | `- README.txt
| `- README.txt
+ |- drivers/
+ | `- README.txt
|- examples/
| |- nsh/README.txt
| |- pashello/README.txt
diff --git a/nuttx/drivers/Makefile b/nuttx/drivers/Makefile
index ad9dcaa0f..9155aedc1 100644
--- a/nuttx/drivers/Makefile
+++ b/nuttx/drivers/Makefile
@@ -39,12 +39,24 @@ ifeq ($(WINTOOL),y)
INCDIROPT = -w
endif
+ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
+include serial/Make.defs
+ROOTDEPPATH = --dep-path .
+SERIALDEPPATH = --dep-path serial
+endif
+
ifeq ($(CONFIG_NET),y)
include net/Make.defs
ROOTDEPPATH = --dep-path .
NETDEPPATH = --dep-path net
endif
+ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
+include pipes/Make.defs
+ROOTDEPPATH = --dep-path .
+PIPEDEPPATH = --dep-path pipes
+endif
+
ifeq ($(CONFIG_USBDEV),y)
include usbdev/Make.defs
ROOTDEPPATH = --dep-path .
@@ -66,18 +78,17 @@ CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/driv
endif
endif
-ASRCS = $(NET_ASRCS) $(USBDEV_ASRCS) $(MMCSD_ASRCS) $(BCH_ASRCS)
+ASRCS = $(SERIAL_ASRCS) $(NET_ASRCS) $(PIPE_ASRCS) $(USBDEV_ASRCS) $(MMCSD_ASRCS) $(BCH_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS =
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
-CSRCS += dev_null.c dev_zero.c pipe.c fifo.c pipe_common.c \
- loop.c serial.c serialirq.c lowconsole.c can.c
+CSRCS += dev_null.c dev_zero.c loop.c can.c
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += ramdisk.c
endif
endif
-CSRCS += $(NET_CSRCS) $(USBDEV_CSRCS) $(MMCSD_CSRCS) $(BCH_CSRCS)
+CSRCS += $(SERIAL_CSRCS) $(NET_CSRCS) $(PIPE_CSRCS) $(USBDEV_CSRCS) $(MMCSD_CSRCS) $(BCH_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
@@ -85,7 +96,7 @@ OBJS = $(AOBJS) $(COBJS)
BIN = libdrivers$(LIBEXT)
-VPATH = net:usbdev:mmcsd:bch
+VPATH = serial:net:pipes:usbdev:mmcsd:bch
all: $(BIN)
@@ -101,7 +112,7 @@ $(BIN): $(OBJS)
done ; )
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(NETDEPPATH) $(USBDEVDEPPATH) $(MMCSDDEPPATH) $(BCHDEPPATH) \
+ @$(MKDEP) $(ROOTDEPPATH) $(SERIALDEPPATH) $(NETDEPPATH) $(PIPEDEPPATH)$(USBDEVDEPPATH) $(MMCSDDEPPATH) $(BCHDEPPATH) \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
diff --git a/nuttx/drivers/README.txt b/nuttx/drivers/README.txt
new file mode 100644
index 000000000..c7e42c9a7
--- /dev/null
+++ b/nuttx/drivers/README.txt
@@ -0,0 +1,56 @@
+README
+^^^^^^
+
+This directory contains various device drivers -- both block and
+character drivers as well as other more specialized drivers.
+
+Files in this directory:
+^^^^^^^^^^^^^^^^^^^^^^^
+
+can.c
+ An unfinished CAN driver.
+
+dev_null.c and dev_zero.c
+ These files provide the standard /dev/null and /dev/zero devices.
+ See include/nuttx/fs.h for functions that should be called if you
+ want to register these devices (devnull_register() and
+ devzero_register()).
+
+loop.c
+ Supports the standard loop device that can be used to export a
+ file (or character device) as a block device. See losetup() and
+ loteardown() in include/nuttx/fs.h.
+
+ramdisk.c
+ Can be used to set up a block of memory or (read-only) FLASH as
+ a block driver that can be mounted as a files system. See
+ include/nuttx/ramdisk.h.
+
+Subdirectories of this directory:
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+bch/
+ Contains logic that may be used to convert a block driver into
+ a character driver. This is the complementary conversion as that
+ performed by loop.c. See include/nuttx/fs.h for registration
+ information.
+
+mmcsd/
+ Support for MMC/SD block drivers. At present, only SPI-based
+ MMC/SD is supported. See include/nuttx/mmcsd.h.
+
+net/
+ Network interface drivers. See also include/nuttx/net.h
+
+pipes/
+ FIFO and named pipe drivers. Standard interfaces are declared
+ in include/unistd.h
+
+serial/
+ Front-ends 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 include/nuttx/serial.h
+
+usbdev/
+ USB device drivers. See include/nuttx/usb*.h
+
diff --git a/nuttx/drivers/pipes/Make.defs b/nuttx/drivers/pipes/Make.defs
new file mode 100644
index 000000000..be16366bb
--- /dev/null
+++ b/nuttx/drivers/pipes/Make.defs
@@ -0,0 +1,41 @@
+############################################################################
+# drivers/pipes/Make.defs
+#
+# Copyright (C) 2009 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.
+#
+############################################################################
+
+PIPE_ASRCS =
+ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
+PIPE_CSRCS = pipe.c fifo.c pipe_common.c
+else
+PIPE_CSRCS =
+endif
diff --git a/nuttx/drivers/fifo.c b/nuttx/drivers/pipes/fifo.c
index 4e0bbf49c..bc9f629f5 100644
--- a/nuttx/drivers/fifo.c
+++ b/nuttx/drivers/pipes/fifo.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * drivers/fifo.c
+ * drivers/pipes/fifo.c
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
diff --git a/nuttx/drivers/pipe.c b/nuttx/drivers/pipes/pipe.c
index 4b052e40f..95049b354 100644
--- a/nuttx/drivers/pipe.c
+++ b/nuttx/drivers/pipes/pipe.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/pipe.c
+ * drivers/pipes/pipe.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/nuttx/drivers/pipe_common.c b/nuttx/drivers/pipes/pipe_common.c
index a0fd00b7a..60d028c00 100644
--- a/nuttx/drivers/pipe_common.c
+++ b/nuttx/drivers/pipes/pipe_common.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/pipe_common.c
+ * drivers/pipes/pipe_common.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/nuttx/drivers/pipe_common.h b/nuttx/drivers/pipes/pipe_common.h
index 56fa4865b..9e9f27fc1 100644
--- a/nuttx/drivers/pipe_common.h
+++ b/nuttx/drivers/pipes/pipe_common.h
@@ -1,7 +1,7 @@
/****************************************************************************
- * drivers/pipe_common.h
+ * drivers/pipe/pipe_common.h
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008i-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
diff --git a/nuttx/drivers/serial/Make.defs b/nuttx/drivers/serial/Make.defs
new file mode 100644
index 000000000..089e797d4
--- /dev/null
+++ b/nuttx/drivers/serial/Make.defs
@@ -0,0 +1,41 @@
+############################################################################
+# drivers/serial/Make.defs
+#
+# Copyright (C) 2009 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.
+#
+############################################################################
+
+SERIAL_ASRCS =
+ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
+SERIAL_CSRCS = serial.c serialirq.c lowconsole.c
+else
+SERIAL_CSRCS =
+endif
diff --git a/nuttx/drivers/lowconsole.c b/nuttx/drivers/serial/lowconsole.c
index 15f639391..1de76cc06 100755..100644
--- a/nuttx/drivers/lowconsole.c
+++ b/nuttx/drivers/serial/lowconsole.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/lowconsole.c
+ * drivers/serial/lowconsole.c
*
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/nuttx/drivers/serial.c b/nuttx/drivers/serial/serial.c
index a7cb42b20..df942a050 100644
--- a/nuttx/drivers/serial.c
+++ b/nuttx/drivers/serial/serial.c
@@ -1,5 +1,5 @@
/************************************************************************************
- * drivers/serial.c
+ * drivers/serial/serial.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/nuttx/drivers/serialirq.c b/nuttx/drivers/serial/serialirq.c
index d1a18b257..a4ce80944 100644
--- a/nuttx/drivers/serialirq.c
+++ b/nuttx/drivers/serial/serialirq.c
@@ -1,5 +1,5 @@
/************************************************************************************
- * drivers/serialirq.c
+ * drivers/serial/serialirq.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/nuttx/include/nuttx/ioctl.h b/nuttx/include/nuttx/ioctl.h
index 7d35548b2..670d75304 100644
--- a/nuttx/include/nuttx/ioctl.h
+++ b/nuttx/include/nuttx/ioctl.h
@@ -55,8 +55,9 @@
#define _FIOCBASE (0x8700) /* File system ioctl commands */
#define _DIOCBASE (0x8800) /* Character driver ioctl commands */
#define _BIOCBASE (0x8900) /* Block driver ioctl commands */
-#define _SIOCBASE (0x8a00) /* Socket ioctl commandss */
-#define _ARPBASE (0x8b00) /* ARP ioctl commandss */
+#define _MTDIOCBASE (0x8a00) /* MTD ioctl commands */
+#define _SIOCBASE (0x8b00) /* Socket ioctl commandss */
+#define _ARPBASE (0x8c00) /* ARP ioctl commandss */
/* Macros used to manage ioctl commands */
@@ -71,35 +72,49 @@
#define _FIOCVALID(c) (_IOC_TYPE(c)==_FIOCBASE)
#define _FIOC(nr) _IOC(_FIOCBASE,nr)
-#define FIOC_MMAP _FIOC(0x0001) /* IN: Location to return address (void **)
- * OUT: If media is directly acccesible,
- * return (void*) base address
- * of file
- */
+#define FIOC_MMAP _FIOC(0x0001) /* IN: Location to return address (void **)
+ * OUT: If media is directly acccesible,
+ * return (void*) base address
+ * of file
+ */
/* NuttX file system ioctl definitions */
#define _DIOCVALID(c) (_IOC_TYPE(c)==_DIOCBASE)
#define _DIOC(nr) _IOC(_DIOCBASE,nr)
-#define DIOC_GETPRIV _DIOC(0x0001) /* IN: Location to return handle (void **)
- * OUT: Reference to internal data
- * structure. May have a reference
- * incremented.
- */
-#define DIOC_RELPRIV _DIOC(0x0003) /* IN: None
- * OUT: None, reference obtained by
- * FIOC_GETPRIV released.
- */
+#define DIOC_GETPRIV _DIOC(0x0001) /* IN: Location to return handle (void **)
+ * OUT: Reference to internal data
+ * structure. May have a reference
+ * incremented.
+ */
+#define DIOC_RELPRIV _DIOC(0x0003) /* IN: None
+ * OUT: None, reference obtained by
+ * FIOC_GETPRIV released.
+ */
/* NuttX block driver ioctl definitions */
#define _BIOCVALID(c) (_IOC_TYPE(c)==_BIOCBASE)
#define _BIOC(nr) _IOC(_BIOCBASE,nr)
-#define BIOC_XIPBASE _BIOC(0x0001) /* IN: None
- * OUT: If media is directly acccesible,
- * return (void*) base address
- * of device memory */
+#define BIOC_XIPBASE _BIOC(0x0001) /* IN: None
+ * OUT: If media is directly acccesible,
+ * return (void*) base address
+ * of device memory */
+
+/* NuttX MTD driver ioctl definitions */
+
+#define _MTDIOCVALID(c) (_IOC_TYPE(c)==_MTDIOCBASE)
+#define _MTDIOC(nr) _IOC(_MTDIOCBASE,nr)
+
+#define MTDIOC_GEOMETRY _MTDIOC(0x0001) /* IN: Pointer to write-able struct
+ * mtd_geometry_s (see mtd.h)
+ * OUT: Geometry structure is populated
+ * with data for the MTD */
+#define MTDIOC_XIPBASE _MTDIOC(0x0002) /* IN: None
+ * OUT: If media is directly acccesible,
+ * return (void*) base address
+ * of device memory */
/* NuttX ARP driver ioctl definitions (see netinet/arp.h) */
diff --git a/nuttx/include/nuttx/lib.h b/nuttx/include/nuttx/lib.h
index cb11ae782..3c74257d4 100644
--- a/nuttx/include/nuttx/lib.h
+++ b/nuttx/include/nuttx/lib.h
@@ -49,12 +49,10 @@
****************************************************************************/
/****************************************************************************
- * Global Function Prototypes
+ * Public Data
****************************************************************************/
-/****************************************************************************
- * Global Function Prototypes
- ****************************************************************************/
+#ifndef __ASSEMBLY__
#ifdef __cplusplus
#define EXTERN extern "C"
@@ -63,6 +61,10 @@ extern "C" {
#define EXTERN extern
#endif
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
/* Functions contained in lib_init.c ****************************************/
EXTERN void weak_function lib_initialize(void);
@@ -77,4 +79,5 @@ EXTERN void lib_releaselist(FAR struct streamlist *list);
}
#endif
+#endif /* __ASSEMBLY__ */
#endif /* __LIB_H */