2020-07-21 00:18:26 +02:00
|
|
|
==============
|
|
|
|
Device Drivers
|
|
|
|
==============
|
2020-10-18 18:48:44 +02:00
|
|
|
|
2020-09-05 23:36:36 +02:00
|
|
|
NuttX supports a variety of device drivers, which can be broadly
|
|
|
|
divided in three classes:
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
character/index.rst
|
|
|
|
block/index.rst
|
2020-10-18 18:48:44 +02:00
|
|
|
special/index.rst
|
|
|
|
|
2020-09-05 23:36:36 +02:00
|
|
|
.. note::
|
|
|
|
Device driver support depends on the *in-memory*, *pseudo*
|
|
|
|
file system that is enabled by default.
|
|
|
|
|
|
|
|
Lower-half and upper-half
|
|
|
|
=========================
|
|
|
|
|
|
|
|
Drivers in NuttX generally work in two distinct layers:
|
|
|
|
|
|
|
|
* An *upper half* which registers itself to NuttX using
|
|
|
|
a call such as :c:func:`register_driver` or
|
|
|
|
:c:func:`register_blockdriver` and implements the corresponding
|
|
|
|
high-level interface (`read`, `write`, `close`, etc.).
|
|
|
|
implements the interface. This *upper half* calls into
|
|
|
|
the *lower half* via callbacks.
|
|
|
|
* A "lower half" which is typically hardware-specific. This is
|
|
|
|
usually implemented at the architecture or board level.
|
2020-07-21 00:18:26 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Subdirectories of ``nuttx/drivers``
|
|
|
|
===================================
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``1wire/`` :doc:`character/1wire`
|
|
|
|
|
|
|
|
1wire device drivers.
|
|
|
|
|
|
|
|
* ``analog/`` :doc:`character/analog`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
This directory holds implementations of analog device drivers.
|
|
|
|
This includes drivers for Analog to Digital Conversion (ADC) as
|
|
|
|
well as drivers for Digital to Analog Conversion (DAC).
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``audio/`` :doc:`special/audio`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
Audio device drivers.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``bch/`` :doc:`character/bch`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``can/`` :doc:`character/can`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
This is the CAN drivers and logic support.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``clk/``:doc:`special/clk`
|
|
|
|
|
|
|
|
Clock management (CLK) device drivers.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``contactless/`` :doc:`character/contactless`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
Contactless devices are related to wireless devices. They are not
|
|
|
|
communication devices with other similar peers, but couplers/interfaces
|
|
|
|
to contactless cards and tags.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``crypto/`` :doc:`character/crypto/index`
|
|
|
|
|
|
|
|
Contains crypto drivers and support logic, including the
|
|
|
|
``/dev/urandom`` device.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``devicetree/`` :doc:`special/devicetree`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Device Tree support.
|
|
|
|
|
|
|
|
* ``dma/`` :doc:`special/dma`
|
|
|
|
|
|
|
|
DMA drivers support.
|
|
|
|
|
|
|
|
* ``eeprom/`` :doc:`block/eeprom`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
An EEPROM is a form of Memory Technology Device (see ``drivers/mtd``).
|
|
|
|
EEPROMs are non-volatile memory like FLASH, but differ in underlying
|
|
|
|
memory technology and differ in usage in many respects: They may not
|
|
|
|
be organized into blocks (at least from the standpoint of the user)
|
|
|
|
and it is not necessary to erase the EEPROM memory before re-writing
|
|
|
|
it. In addition, EEPROMs tend to be much smaller than FLASH parts,
|
|
|
|
usually only a few kilobytes vs megabytes for FLASH. EEPROM tends to
|
|
|
|
be used to retain a small amount of device configuration information;
|
|
|
|
FLASH tends to be used for program or massive data storage. For these
|
|
|
|
reasons, it may not be convenient to use the more complex MTD
|
|
|
|
interface but instead use the simple character interface provided by
|
|
|
|
the EEPROM drivers.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``efuse/`` :doc:`character/efuse`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
EFUSE drivers support.
|
|
|
|
|
|
|
|
* ``i2c/`` :doc:`special/i2c`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
I2C drivers and support logic.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``i2s/`` :doc:`character/i2s`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
I2S drivers and support logic.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``input/`` :doc:`character/input/index`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
This directory holds implementations of human input device (HID) drivers.
|
|
|
|
This includes such things as mouse, touchscreen, joystick,
|
|
|
|
keyboard and keypad drivers.
|
|
|
|
|
|
|
|
Note that USB HID devices are treated differently. These can be found under
|
|
|
|
``usbdev/`` or ``usbhost/``.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``ioexpander/`` :doc:`special/ioexpander`
|
|
|
|
|
|
|
|
IO Expander drivers.
|
|
|
|
|
|
|
|
* ``ipcc/`` :doc:`character/ipcc`
|
|
|
|
|
|
|
|
IPCC (Inter Processor Communication Controller) driver.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``lcd/`` :doc:`special/lcd`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Drivers for parallel and serial LCD and OLED type devices.
|
|
|
|
|
|
|
|
* ``leds/`` :doc:`character/leds/index`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
Various LED-related drivers including discrete as well as PWM- driven LEDs.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``loop/`` :doc:`character/loop`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
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``.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``math/`` :doc:`character/math`
|
|
|
|
|
|
|
|
MATH Acceleration drivers.
|
|
|
|
|
|
|
|
* ``misc/`` :doc:`character/nullzero` :doc:`special/rwbuffer` :doc:`block/ramdisk`
|
|
|
|
|
|
|
|
Various drivers that don't fit elsewhere.
|
|
|
|
|
|
|
|
* ``mmcsd/`` :doc:`special/sdio` :doc:`special/mmcsd`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
Support for MMC/SD block drivers. MMC/SD block drivers based on
|
|
|
|
SPI and SDIO/MCI interfaces are supported.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``modem/`` :doc:`character/modem`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Modem Support.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``motor/`` :doc:`character/motor/index`
|
|
|
|
|
|
|
|
Motor control drivers.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``mtd/`` :doc:`special/mtd`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Memory Technology Device (MTD) drivers. Some simple drivers for
|
|
|
|
memory technologies like FLASH, EEPROM, NVRAM, etc.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
(Note: This is a simple memory interface and should not be
|
|
|
|
confused with the "real" MTD developed at infradead.org. This
|
|
|
|
logic is unrelated; I just used the name MTD because I am not
|
|
|
|
aware of any other common way to refer to this class of devices).
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``net/`` :doc:`special/net/index`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
Network interface drivers.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``notes/`` :doc:`character/note`
|
|
|
|
|
|
|
|
Note Driver Support.
|
|
|
|
|
|
|
|
* ``pipes/`` :doc:`special/pipes`
|
|
|
|
|
|
|
|
FIFO and named pipe drivers.
|
|
|
|
Standard interfaces are declared in ``include/unistd.h``
|
|
|
|
|
|
|
|
* ``power/`` :doc:`special/power/index`
|
|
|
|
|
2023-10-28 21:40:30 +02:00
|
|
|
Various drivers related to power management.
|
2023-10-27 12:57:14 +02:00
|
|
|
|
|
|
|
* ``rc/`` :doc:`character/rc`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Remote Control Device Support.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``regmap/`` :doc:`special/regmap`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Regmap Subsystems Support.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``reset/`` :doc:`special/reset`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Reset Driver Support.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``rf/`` :doc:`character/rf`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
RF Device Support.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``rptun/`` :doc:`special/rptun`
|
|
|
|
|
|
|
|
Remote Proc Tunnel Driver Support.
|
|
|
|
|
|
|
|
* ``segger/`` :doc:`special/segger`
|
|
|
|
|
|
|
|
Segger RTT drivers.
|
|
|
|
|
|
|
|
* ``sensors/`` :doc:`special/sensors`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
Drivers for various sensors. A sensor driver differs little from
|
|
|
|
other types of drivers other than they are use to provide measurements
|
|
|
|
of things in environment like temperature, orientation, acceleration,
|
|
|
|
altitude, direction, position, etc.
|
|
|
|
|
|
|
|
DACs might fit this definition of a sensor driver as well since they
|
|
|
|
measure and convert voltage levels. DACs, however, are retained in
|
|
|
|
the ``analog/`` sub-directory.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``serial/``:doc:`character/serial`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``spi/`` :doc:`special/spi`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
SPI drivers and support logic.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``syslog/`` :doc:`special/syslog`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
System logging devices.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``timers/`` :doc:`character/timers/index`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Includes support for various timer devices.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``usbdev/`` :doc:`special/usbdev`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
USB device drivers.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``usbhost/`` :doc:`special/usbhost`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
USB host drivers.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``usbmisc/`` :doc:`special/usbmisc`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
USB Miscellaneous drivers.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``usbmonitor/`` :doc:`special/usbmonitor`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
USB Monitor support.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``usrsock/`` :doc:`special/usrsock`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
Usrsock Driver Support.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``video/`` :doc:`special/video`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
Video-related drivers.
|
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``virtio/`` :doc:`special/virtio`
|
|
|
|
|
|
|
|
Virtio Device Support.
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-27 12:57:14 +02:00
|
|
|
* ``wireless/`` :doc:`special/wireless`
|
2023-10-25 15:27:01 +02:00
|
|
|
|
|
|
|
Drivers for various wireless devices.
|
|
|
|
|
|
|
|
Skeleton Files
|
|
|
|
==============
|
|
|
|
|
|
|
|
Skeleton files are "empty" frameworks for NuttX drivers. They are provided to
|
|
|
|
give you a good starting point if you want to create a new NuttX driver.
|
2023-10-29 16:40:32 +01:00
|
|
|
The following skeleton files are available:
|
2023-10-25 15:27:01 +02:00
|
|
|
|
2023-10-29 16:40:32 +01:00
|
|
|
* ``drivers/lcd/skeleton.c`` Skeleton LCD driver
|
|
|
|
* ``drivers/mtd/skeleton.c`` Skeleton memory technology device drivers
|
|
|
|
* ``drivers/net/skeleton.c`` Skeleton network/Ethernet drivers
|
|
|
|
* ``drivers/usbhost/usbhost_skeleton.c`` Skeleton USB host class driver
|