1
0
Fork 0
forked from nuttx/nuttx-update

Move some drivers to separate subdirectories

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2156 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-10-18 13:52:21 +00:00
parent 1456e6bd4e
commit 9b04ee217e
15 changed files with 210 additions and 39 deletions

View file

@ -123,6 +123,8 @@
| | |- <a href="configs/z8f64200100kit/ostest/README.txt">ostest/README.txt</a> | | |- <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/z8f64200100kit/README.txt"><b><i>README.txt</i></b></a>
| `- <a href="configs/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/ |- examples/
| |- <a href="examples/nsh/README.txt"><b><i>nsh/README.txt</i></b></a> | |- <a href="examples/nsh/README.txt"><b><i>nsh/README.txt</i></b></a>
| |- <a href="examples/pashello/README.txt">pashello/README.txt</a> | |- <a href="examples/pashello/README.txt">pashello/README.txt</a>

View file

@ -103,6 +103,8 @@ is a guide to the available README files:
| | |- ostest/README.txt | | |- ostest/README.txt
| | `- README.txt | | `- README.txt
| `- README.txt | `- README.txt
|- drivers/
| `- README.txt
|- examples/ |- examples/
| |- nsh/README.txt | |- nsh/README.txt
| |- pashello/README.txt | |- pashello/README.txt

View file

@ -39,12 +39,24 @@ ifeq ($(WINTOOL),y)
INCDIROPT = -w INCDIROPT = -w
endif endif
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
include serial/Make.defs
ROOTDEPPATH = --dep-path .
SERIALDEPPATH = --dep-path serial
endif
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
include net/Make.defs include net/Make.defs
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
NETDEPPATH = --dep-path net NETDEPPATH = --dep-path net
endif endif
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
include pipes/Make.defs
ROOTDEPPATH = --dep-path .
PIPEDEPPATH = --dep-path pipes
endif
ifeq ($(CONFIG_USBDEV),y) ifeq ($(CONFIG_USBDEV),y)
include usbdev/Make.defs include usbdev/Make.defs
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -66,18 +78,17 @@ CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/driv
endif endif
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)) AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = CSRCS =
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
CSRCS += dev_null.c dev_zero.c pipe.c fifo.c pipe_common.c \ CSRCS += dev_null.c dev_zero.c loop.c can.c
loop.c serial.c serialirq.c lowconsole.c can.c
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += ramdisk.c CSRCS += ramdisk.c
endif endif
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)) COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
@ -85,7 +96,7 @@ OBJS = $(AOBJS) $(COBJS)
BIN = libdrivers$(LIBEXT) BIN = libdrivers$(LIBEXT)
VPATH = net:usbdev:mmcsd:bch VPATH = serial:net:pipes:usbdev:mmcsd:bch
all: $(BIN) all: $(BIN)
@ -101,7 +112,7 @@ $(BIN): $(OBJS)
done ; ) done ; )
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) $(NETDEPPATH) $(USBDEVDEPPATH) $(MMCSDDEPPATH) $(BCHDEPPATH) \ @$(MKDEP) $(ROOTDEPPATH) $(SERIALDEPPATH) $(NETDEPPATH) $(PIPEDEPPATH)$(USBDEVDEPPATH) $(MMCSDDEPPATH) $(BCHDEPPATH) \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@

56
drivers/README.txt Normal file
View file

@ -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

41
drivers/pipes/Make.defs Normal file
View file

@ -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

View file

@ -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> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* drivers/pipe.c * drivers/pipes/pipe.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>

View file

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* drivers/pipe_common.c * drivers/pipes/pipe_common.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>

View file

@ -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> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

41
drivers/serial/Make.defs Normal file
View file

@ -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

2
drivers/lowconsole.c → drivers/serial/lowconsole.c Executable file → Normal file
View file

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* drivers/lowconsole.c * drivers/serial/lowconsole.c
* *
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>

View file

@ -1,5 +1,5 @@
/************************************************************************************ /************************************************************************************
* drivers/serial.c * drivers/serial/serial.c
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>

View file

@ -1,5 +1,5 @@
/************************************************************************************ /************************************************************************************
* drivers/serialirq.c * drivers/serial/serialirq.c
* *
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>

View file

@ -55,8 +55,9 @@
#define _FIOCBASE (0x8700) /* File system ioctl commands */ #define _FIOCBASE (0x8700) /* File system ioctl commands */
#define _DIOCBASE (0x8800) /* Character driver ioctl commands */ #define _DIOCBASE (0x8800) /* Character driver ioctl commands */
#define _BIOCBASE (0x8900) /* Block driver ioctl commands */ #define _BIOCBASE (0x8900) /* Block driver ioctl commands */
#define _SIOCBASE (0x8a00) /* Socket ioctl commandss */ #define _MTDIOCBASE (0x8a00) /* MTD ioctl commands */
#define _ARPBASE (0x8b00) /* ARP ioctl commandss */ #define _SIOCBASE (0x8b00) /* Socket ioctl commandss */
#define _ARPBASE (0x8c00) /* ARP ioctl commandss */
/* Macros used to manage ioctl commands */ /* Macros used to manage ioctl commands */
@ -71,35 +72,49 @@
#define _FIOCVALID(c) (_IOC_TYPE(c)==_FIOCBASE) #define _FIOCVALID(c) (_IOC_TYPE(c)==_FIOCBASE)
#define _FIOC(nr) _IOC(_FIOCBASE,nr) #define _FIOC(nr) _IOC(_FIOCBASE,nr)
#define FIOC_MMAP _FIOC(0x0001) /* IN: Location to return address (void **) #define FIOC_MMAP _FIOC(0x0001) /* IN: Location to return address (void **)
* OUT: If media is directly acccesible, * OUT: If media is directly acccesible,
* return (void*) base address * return (void*) base address
* of file * of file
*/ */
/* NuttX file system ioctl definitions */ /* NuttX file system ioctl definitions */
#define _DIOCVALID(c) (_IOC_TYPE(c)==_DIOCBASE) #define _DIOCVALID(c) (_IOC_TYPE(c)==_DIOCBASE)
#define _DIOC(nr) _IOC(_DIOCBASE,nr) #define _DIOC(nr) _IOC(_DIOCBASE,nr)
#define DIOC_GETPRIV _DIOC(0x0001) /* IN: Location to return handle (void **) #define DIOC_GETPRIV _DIOC(0x0001) /* IN: Location to return handle (void **)
* OUT: Reference to internal data * OUT: Reference to internal data
* structure. May have a reference * structure. May have a reference
* incremented. * incremented.
*/ */
#define DIOC_RELPRIV _DIOC(0x0003) /* IN: None #define DIOC_RELPRIV _DIOC(0x0003) /* IN: None
* OUT: None, reference obtained by * OUT: None, reference obtained by
* FIOC_GETPRIV released. * FIOC_GETPRIV released.
*/ */
/* NuttX block driver ioctl definitions */ /* NuttX block driver ioctl definitions */
#define _BIOCVALID(c) (_IOC_TYPE(c)==_BIOCBASE) #define _BIOCVALID(c) (_IOC_TYPE(c)==_BIOCBASE)
#define _BIOC(nr) _IOC(_BIOCBASE,nr) #define _BIOC(nr) _IOC(_BIOCBASE,nr)
#define BIOC_XIPBASE _BIOC(0x0001) /* IN: None #define BIOC_XIPBASE _BIOC(0x0001) /* IN: None
* OUT: If media is directly acccesible, * OUT: If media is directly acccesible,
* return (void*) base address * return (void*) base address
* of device memory */ * 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) */ /* NuttX ARP driver ioctl definitions (see netinet/arp.h) */

View file

@ -49,12 +49,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Global Function Prototypes * Public Data
****************************************************************************/ ****************************************************************************/
/**************************************************************************** #ifndef __ASSEMBLY__
* Global Function Prototypes
****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
#define EXTERN extern "C" #define EXTERN extern "C"
@ -63,6 +61,10 @@ extern "C" {
#define EXTERN extern #define EXTERN extern
#endif #endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/* Functions contained in lib_init.c ****************************************/ /* Functions contained in lib_init.c ****************************************/
EXTERN void weak_function lib_initialize(void); EXTERN void weak_function lib_initialize(void);
@ -77,4 +79,5 @@ EXTERN void lib_releaselist(FAR struct streamlist *list);
} }
#endif #endif
#endif /* __ASSEMBLY__ */
#endif /* __LIB_H */ #endif /* __LIB_H */