diff --git a/drivers/Kconfig b/drivers/Kconfig index 52f5b5a6f54..3ed0446dd37 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -27,13 +27,7 @@ config DEV_RANDOM default n depends on ARCH_HAVE_RNG -config LOOP - bool "Enable loop device" - default n - ---help--- - 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/fs.h. +source drivers/loop/Kconfig menu "Buffering" diff --git a/drivers/Makefile b/drivers/Makefile index 80630ed5af9..8f552005810 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -55,6 +55,7 @@ include bch$(DELIM)Make.defs include input$(DELIM)Make.defs include discrete$(DELIM)Make.defs include lcd$(DELIM)Make.defs +include loop$(DELIM)Make.defs include mmcsd$(DELIM)Make.defs include mtd$(DELIM)Make.defs include eeprom$(DELIM)Make.defs @@ -76,7 +77,7 @@ ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) CSRCS += dev_null.c dev_zero.c ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) - CSRCS += ramdisk.c loop.c + CSRCS += ramdisk.c ifeq ($(CONFIG_DRVR_WRITEBUFFER),y) CSRCS += rwbuffer.c else diff --git a/drivers/README.txt b/drivers/README.txt index 39b46109212..fb43d81305e 100644 --- a/drivers/README.txt +++ b/drivers/README.txt @@ -21,11 +21,6 @@ dev_null.c and dev_zero.c 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/fs.h. - pwm.c Provides the "upper half" of a pulse width modulation (PWM) driver. The "lower half" of the PWM driver is provided by device-specific @@ -36,18 +31,10 @@ ramdisk.c a block driver that can be mounted as a files system. See include/nuttx/fs/ramdisk.h. -timer.c - Provides the "upper half" for a generic timer driver. See - include/nuttx/timers/timer.h for more information. - rwbuffer.c A facility that can be use by any block driver in-order to add writing buffering and read-ahead buffering. -watchdog.c - Provides the "upper half" for a generic watchdog driver. See - include/nuttx/timers/watchdog.h for more information. - Subdirectories of this directory: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -94,6 +81,11 @@ lcd/ Drivers for parallel and serial LCD and OLED type devices. These drivers support interfaces as defined in include/nuttx/lcd/lcd.h +loop/ + 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/fs.h. + mmcsd/ Support for MMC/SD block drivers. MMC/SD block drivers based on SPI and SDIO/MCI interfaces are supported. See include/nuttx/mmcsd.h @@ -153,6 +145,17 @@ spi/ syslog/ System logging devices. See include/syslog.h and include/nuttx/syslog/syslog.h +timers/ + Includes support for various timer devices including: + + - An "upper half" for a generic timer driver. See + include/nuttx/timers/timer.h for more information. + + - An "upper half" for a generic watchdog driver. See + include/nuttx/timers/watchdog.h for more information. + + - RTC drivers + usbdev/ USB device drivers. See also include/nuttx/usb/usbdev.h diff --git a/drivers/loop/Kconfig b/drivers/loop/Kconfig new file mode 100644 index 00000000000..06fbd8ddead --- /dev/null +++ b/drivers/loop/Kconfig @@ -0,0 +1,11 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config LOOP + bool "Enable loop device" + default n + ---help--- + Supports the standard loop device that can be used to export a + file (or character device) as a block device. diff --git a/drivers/loop/Make.defs b/drivers/loop/Make.defs new file mode 100644 index 00000000000..04c8f65103a --- /dev/null +++ b/drivers/loop/Make.defs @@ -0,0 +1,54 @@ +############################################################################ +# drivers/loop/Make.defs +# +# Copyright (C) 2015 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +############################################################################ + +# Loop device can only be used with mountpoint support + +ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) + +# Include loop device support + +ifneq ($(CONFIG_LOOP),y) +# CSRCS += loop.c +endif + +CSRCS += losetup.c + +# Add loop devicer build support + +DEPPATH += --dep-path loop +VPATH += :loop +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)loop} + +endif diff --git a/drivers/loop.c b/drivers/loop/losetup.c similarity index 99% rename from drivers/loop.c rename to drivers/loop/losetup.c index 9d51dd74656..a70bbe2fc50 100644 --- a/drivers/loop.c +++ b/drivers/loop/losetup.c @@ -1,7 +1,7 @@ /**************************************************************************** - * drivers/loop.c + * drivers/losetup.c * - * Copyright (C) 2008-2009, 2011, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2011, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without