diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html
index c392167edc..c2ed3b4d1b 100644
--- a/Documentation/NuttxPortingGuide.html
+++ b/Documentation/NuttxPortingGuide.html
@@ -118,10 +118,11 @@
6.3.3 I2C Device Drivers
6.3.4 Serial Device Drivers
6.3.5 Frame Buffer Drivers
- 6.3.6 Memory Technology Device Drivers
- 6.3.7 SDIO Device Drivers
- 6.3.8 USB Host-Side Drivers
- 6.3.9 USB Device-Side Drivers
+ 6.3.6 LCD Drivers
+ 6.3.7 Memory Technology Device Drivers
+ 6.3.8 SDIO Device Drivers
+ 6.3.9 USB Host-Side Drivers
+ 6.3.10 USB Device-Side Drivers
Appendix A: NuttX Configuration Settings
@@ -1128,7 +1129,7 @@ The system can be re-made subsequently by just typing make
.
is defined.
Inputs:
Inputs:tcb
: The TCB of new task.
@@ -1719,10 +1720,13 @@ extern void up_ledoff(int led);
include/nuttx/fs.h
.
All structures and APIs needed to work with character drivers are provided in this header file.
+
struct file_operations
.
Each character device driver must implement an instance of struct file_operations
.
That structure defines a call table with the following methods:
@@ -1735,23 +1739,30 @@ extern void up_ledoff(int led);
int ioctl(FAR struct file *filp, int cmd, unsigned long arg);
int poll(FAR struct file *filp, struct pollfd *fds, bool setup);
int register_driver(const char *path, const struct file_operations *fops, mode_t mode, void *priv);
.
Each character driver registers itself by calling register_driver()
, passing it the
path
where it will appear in the pseudo-file-system and it's
initialized instance of struct file_operations
.
+
User Access.
After it has been registered, the character driver can be accessed by user code using the standard
driver operations including
open()
, close()
, read()
, write()
, etc.
+
Examples:
drivers/dev_null.c
, drivers/fifo.c
, drivers/serial.c
, etc.
-
include/nuttx/fs.h
.
All structures and APIs needed to work with block drivers are provided in this header file.
+
struct block_operations
.
Each block device driver must implement an instance of struct block_operations
.
That structure defines a call table with the following methods:
@@ -1776,34 +1790,45 @@ extern void up_ledoff(int led);
int geometry(FAR struct inode *inode, FAR struct geometry *geometry);
int ioctl(FAR struct inode *inode, int cmd, unsigned long arg);
int register_blockdriver(const char *path, const struct block_operations *bops, mode_t mode, void *priv);
.
Each block driver registers itself by calling register_blockdriver()
, passing it the
path
where it will appear in the pseudo-file-system and it's
initialized instance of struct block_operations
.
+
User Access.
Users do not normally access block drivers directly, rather, they access block drivers
indirectly through the mount()
API.
The mount()
API binds a block driver instance with a file system and with a mountpoint.
Then the user may use the block driver to access the file system on the underlying media.
Example: See the cmd_mount()
implementation in examples/nsh/nsh_fscmds.c
.
+
Accessing a Character Driver as a Block Device.
See the loop device at drivers/loop.c
.
Example: See the cmd_losetup()
implementation in examples/nsh/nsh_fscmds.c
.
+
Accessing a Block Driver as Character Device.
See the Block-to-Character (BCH) conversion logic in drivers/bch/
.
Example: See the cmd_dd()
implementation in examples/nsh/nsh_ddcmd.c
.
+
Examples.
drivers/loop.c
, drivers/mmcsd/mmcsd_spi.c
, drivers/ramdisk.c
, etc.
+
include/net/uip/uip-arch.h
.
All structures and APIs needed to work with Ethernet drivers are provided in this header file.
The structure struct uip_driver_s
defines the interface and is passed to uIP via
netdev_register()
.
+
int netdev_register(FAR struct uip_driver_s *dev);
.
Each Ethernet driver registers itself by calling netdev_register()
.
+
Examples:
drivers/net/dm90x0.c
, arch/drivers/arm/src/c5471/c5471_ethernet.c
, arch/z80/src/ez80/ez80_emac.c
, etc.
+
include/nuttx/spi.h
.
All structures and APIs needed to work with SPI drivers are provided in this header file.
+
struct spi_ops_s
.
Each SPI device driver must implement an instance of struct spi_ops_s
.
That structure defines a call table with the following methods:
@@ -1849,21 +1883,28 @@ extern void up_ledoff(int led);
uint16_t send(FAR struct spi_dev_s *dev, uint16_t wd);
void exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords);
int registercallback(FAR struct spi_dev_s *dev, mediachange_t callback, void *arg);
int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi)
in drivers/mmcsd/mmcsd_spi.c
.
- In general, the binding sequence is:
- struct spi_dev_s
from the hardware-specific SPI device driver, and
+ Binding SPI Drivers.
+ SPI drivers are not normally directly accessed by user code, but are usually bound to another,
+ higher level device driver.
+ See for example, int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi)
in drivers/mmcsd/mmcsd_spi.c
.
+ In general, the binding sequence is:
+
+
struct spi_dev_s
from the hardware-specific SPI device driver, and drivers/loop.c
, drivers/mmcsd/mmcsd_spi.c
, drivers/ramdisk.c
, etc.
+
+ Examples:
+ drivers/loop.c
, drivers/mmcsd/mmcsd_spi.c
, drivers/ramdisk.c
, etc.
+
include/nuttx/i2c.h
.
All structures and APIs needed to work with I2C drivers are provided in this header file.
+
struct i2c_ops_s
.
Each I2C device driver must implement an instance of struct i2c_ops_s
.
That structure defines a call table with the following methods:
@@ -1883,20 +1927,27 @@ extern void up_ledoff(int led);
int setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits);
int write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen);
int read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen);
struct i2c_dev_s
from the hardware-specific I2C device driver, and + Binding I2C Drivers. + I2C drivers are not normally directly accessed by user code, but are usually bound to another, + higher level device driver. + In general, the binding sequence is: +
++
struct i2c_dev_s
from the hardware-specific I2C device driver, and arch/z80/src/ez80/ez80_i2c.c
, arch/z80/src/z8/z8_i2c.c
, etc.
+
+ Examples:
+ arch/z80/src/ez80/ez80_i2c.c
, arch/z80/src/z8/z8_i2c.c
, etc.
+
include/nuttx/serial.h
.
All structures and APIs needed to work with serial drivers are provided in this header file.
+
struct uart_ops_s
.
Each serial device driver must implement an instance of struct uart_ops_s
.
That structure defines a call table with the following methods:
@@ -1925,22 +1979,29 @@ extern void up_ledoff(int led);
bool txready(FAR struct uart_dev_s *dev);
bool txempty(FAR struct uart_dev_s *dev);
int uart_register(FAR const char *path, FAR uart_dev_t *dev);
.
A serial driver may register itself by calling uart_register()
, passing it the
path
where it will appear in the pseudo-file-system and it's
initialized instance of struct uart_ops_s
.
By convention, serial device drivers are registered at paths like /dev/ttyS0
, /dev/ttyS1
, etc.
See the uart_register()
implementation in drivers/serial.c
.
+
User Access. Serial drivers are, ultimately, normal character drivers and are accessed as other character drivers. +
Examples:
arch/arm/src/chip/lm3s_serial.c
, arch/arm/src/lpc214x/lpc214x_serial.c
, arch/z16/src/z16f/z16f_serial.c
, etc.
+
include/nuttx/fb.h
.
- All structures and APIs needed to work with frame buffer drivers are provided in this header file.
+
+ include/nuttx/fb.h
.
+ All structures and APIs needed to work with frame buffer drivers are provided in this header file.
+
struct fb_vtable_s
.
- Each frame buffer device driver must implement an instance of struct fb_vtable_s
.
- That structure defines a call table with the following methods:
+
+ struct fb_vtable_s
.
+ Each frame buffer device driver must implement an instance of struct fb_vtable_s
.
+ That structure defines a call table with the following methods:
+
Get information about the video controller configuration and the configuration of each color plane.
@@ -1964,7 +2029,7 @@ extern void up_ledoff(int led);The following are provided only if the video hardware supports RGB color mapping: -
int (*getcmap)(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap);
int (*putcmap)(FAR struct fb_vtable_s *vtable, FAR const struct fb_cmap_s *cmap);
struct fb_vtable_s
from the hardware-specific frame buffer device driver, and + Binding Frame Buffer Drivers. + Frame buffer drivers are not normally directly accessed by user code, but are usually bound to another, + higher level device driver. + In general, the binding sequence is: +
++
struct fb_vtable_s
from the hardware-specific frame buffer device driver, and arch/sim/src/up_framebuffer.c
.
- See also the usage of the frame buffer driver in the graphics/
directory.
+
+ Examples:
+ arch/sim/src/up_framebuffer.c
.
+ See also the usage of the frame buffer driver in the graphics/
directory.
+
include/nuttx/mtd.h
.
- All structures and APIs needed to work with MTD drivers are provided in this header file.
+
+ include/nuttx/lcd/lcd.h
.
+ Structures and APIs needed to work with LCD drivers are provided in this header file.
+ This header file also depends on some of the same definitions used for the frame buffer driver as privided in include/nuttx/fb.h
.
+
struct mtd_dev_s
.
- Each MTD device driver must implement an instance of struct mtd_dev_s
.
- That structure defines a call table with the following methods:
+
+ struct lcd_dev_s
.
+ Each LCD device driver must implement an instance of struct lcd_dev_s
.
+ That structure defines a call table with the following methods:
+
+ Get information about the LCD video controller configuration and the configuration of each LCD color plane. +
+
+ int (*getvideoinfo)(FAR struct lcd_dev_s *dev, FAR struct fb_videoinfo_s *vinfo);
+ int (*getplaneinfo)(FAR struct lcd_dev_s *dev, unsigned int planeno, FAR struct lcd_planeinfo_s *pinfo);
+
+ The following are provided only if the video hardware supports RGB color mapping: +
+
+ int (*getcmap)(FAR struct lcd_dev_s *dev, FAR struct fb_cmap_s *cmap);
+ int (*putcmap)(FAR struct lcd_dev_s *dev, FAR const struct fb_cmap_s *cmap);
+
+ The following are provided only if the video hardware supports a hardware cursor: +
+
+ int (*getcursor)(FAR struct lcd_dev_s *dev, FAR struct fb_cursorattrib_s *attrib);
+ int (*setcursor)(FAR struct lcd_dev_s *dev, FAR struct fb_setcursor_s *settings)
+
+ Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER
: full on).
+ On backlit LCDs, this setting may correspond to the backlight setting.
+
+ int (*getpower)(struct lcd_dev_s *dev);
+
+ Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER
: full on).
+ On backlit LCDs, this setting may correspond to the backlight setting.
+
+ int (*setpower)(struct lcd_dev_s *dev, int power);
+
+ Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST) */ +
+
+ int (*getcontrast)(struct lcd_dev_s *dev);
+
+ Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST) +
+
+ int (*setcontrast)(struct lcd_dev_s *dev, unsigned int contrast);
+
+ Binding LCD Drivers. + LCD drivers are not normally directly accessed by user code, but are usually bound to another, + higher level device driver. + In general, the binding sequence is: +
++
struct lcd_dev_s
from the hardware-specific LCD device driver, and
+ Examples:
+ drivers/lcd/nokia6100.c
, drivers/lcd/p14201.c
, configs/sam3u-ek/src/up_lcd.c.
+ See also the usage of the LCD driver in the graphics/
directory.
+
+ include/nuttx/mtd.h
.
+ All structures and APIs needed to work with MTD drivers are provided in this header file.
+
+ struct mtd_dev_s
.
+ Each MTD device driver must implement an instance of struct mtd_dev_s
.
+ That structure defines a call table with the following methods:
+
Erase the specified erase blocks (units are erase blocks):
@@ -2013,7 +2189,7 @@ extern void up_ledoff(int led);Read/write from the specified read/write blocks: -
ssize_t (*bread)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, FAR uint8_t *buffer);
ssize_t (*bwrite)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, FAR const uint8_t *buffer);
struct mtd_dev_s
from the hardware-specific MTD device driver, and + Binding MTD Drivers. + MTD drivers are not normally directly accessed by user code, but are usually bound to another, + higher level device driver. + In general, the binding sequence is: +
++
struct mtd_dev_s
from the hardware-specific MTD device driver, and drivers/mtd/m25px.c
and drivers/mtd/ftl.c
+
+ Examples:
+ drivers/mtd/m25px.c
and drivers/mtd/ftl.c
+
include/nuttx/sdio.h
.
- All structures and APIs needed to work with SDIO drivers are provided in this header file.
+
+ include/nuttx/sdio.h
.
+ All structures and APIs needed to work with SDIO drivers are provided in this header file.
+
struct sdio_dev_s
.
- Each SDIOI device driver must implement an instance of struct sdio_dev_s
.
- That structure defines a call table with the following methods:
+
+ struct sdio_dev_s
.
+ Each SDIOI device driver must implement an instance of struct sdio_dev_s
.
+ That structure defines a call table with the following methods:
+
Initialization/setup:
@@ -2114,27 +2300,35 @@ extern void up_ledoff(int led);struct sdio_dev_s
from the hardware-specific SDIO device driver, and + Binding SDIO Drivers. + SDIO drivers are not normally directly accessed by user code, but are usually bound to another, + higher level device driver. + In general, the binding sequence is: +
++
struct sdio_dev_s
from the hardware-specific SDIO device driver, and arch/arm/src/stm32/stm32_sdio.c
and drivers/mmcsd/mmcsd_sdio.c
+
+ Examples:
+ arch/arm/src/stm32/stm32_sdio.c
and drivers/mmcsd/mmcsd_sdio.c
+
include/nuttx/usb/usbhost.h
.
- All structures and APIs needed to work with USB host-side drivers are provided in this header file.
+
+ include/nuttx/usb/usbhost.h
.
+ All structures and APIs needed to work with USB host-side drivers are provided in this header file.
+
@@ -2215,7 +2409,7 @@ extern void up_ledoff(int led); In general, the binding sequence is:
-
Each USB host class driver includes an intialization entry point that is called from the
@@ -2249,17 +2443,19 @@ extern void up_ledoff(int led);
See the call to register_blockdriver()
in the function usbhost_initvolume()
in the file drivers/usbhost/usbhost_storage.c
.
include/nuttx/usb/usbdev.h
.
- All structures and APIs needed to work with USB device-side drivers are provided in this header file.
+
+ include/nuttx/usb/usbdev.h
.
+ All structures and APIs needed to work with USB device-side drivers are provided in this header file.
+
@@ -2294,7 +2490,7 @@ extern void up_ledoff(int led); In general, the binding sequence is:
-
Each USB device class driver includes an intialization entry point that is called from the @@ -2313,7 +2509,7 @@ extern void up_ledoff(int led); completing the initialization.