Character Device Drivers¶
Character device drivers have these properties:
include/nuttx/fs/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:
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
pathwhere it will appear in the pseudo file system and it’s initialized instance of
User Access. After it has been registered, the character driver can be accessed by user code using the standard driver operations including
Specialized Character Drivers. Within the common character driver framework, there are different specific varieties of specialized character drivers. The unique requirements of the underlying device hardware often mandates some customization of the character driver. These customizations tend to take the form of:
ioctl()commands used to performed specialized operations on the device. These
ioctl()will be documented in header files under
include/nuttxthat detail the specific device interface.
Specialized I/O formats. Some devices will require that
write()operations use data conforming to a specific format, rather than a plain stream of bytes. These specialized I/O formats will be documented in header files under
include/nuttxthat detail the specific device interface. The typical representation of the I/O format will be a C structure definition.
The specialized character drivers support by NuttX are documented in the following paragraphs.
- Serial Device Drivers
- Touchscreen Device Drivers
- Analog (ADC/DAC) Drivers
- PWM Drivers
- CAN Drivers
- Quadrature Encoder Drivers
- Timer Drivers
- RTC Drivers
- Watchdog Timer Drivers
- Keyboard/Keypad Drivers
- Note Driver Interface
- FOC Driver Interface