![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
Collaboration diagram for Device Driver:Modules | |
| ADC | |
| Clock | |
| DAC | |
| Audio | |
| CAN Driver | |
| I2C | |
| Pin | |
| PWM | |
| RTC | |
| Serial | |
| Serial v2 | |
| SPI | |
| Touch | |
| blk | |
Data Structures | |
| struct | rt_wqueue |
| struct | rt_device |
| struct | rt_device_notify |
device I/O subsystem
The Device System is designed as simple and minimum layer to help communication between applications and drivers.
The Device System provide five interfaces to driver:
| #define RT_DEVICE_FLAG_DEACTIVATE 0x000 |
device flags definitions device is not not initialized
| #define RT_DEVICE_FLAG_RDONLY 0x001 |
read only
| #define RT_DEVICE_FLAG_WRONLY 0x002 |
write only
| #define RT_DEVICE_FLAG_RDWR 0x003 |
read and write
| #define RT_DEVICE_FLAG_REMOVABLE 0x004 |
removable device
| #define RT_DEVICE_FLAG_STANDALONE 0x008 |
standalone device
| #define RT_DEVICE_FLAG_ACTIVATED 0x010 |
device is activated
| #define RT_DEVICE_FLAG_SUSPENDED 0x020 |
device is suspended
| #define RT_DEVICE_FLAG_STREAM 0x040 |
stream mode
| #define RT_DEVICE_FLAG_DYNAMIC 0x080 |
device is determined when open()
| #define RT_DEVICE_FLAG_INT_RX 0x100 |
INT mode on Rx
| #define RT_DEVICE_FLAG_DMA_RX 0x200 |
DMA mode on Rx
| #define RT_DEVICE_FLAG_INT_TX 0x400 |
INT mode on Tx
| #define RT_DEVICE_FLAG_DMA_TX 0x800 |
DMA mode on Tx
| #define RT_DEVICE_OFLAG_CLOSE 0x000 |
device is closed
| #define RT_DEVICE_OFLAG_RDONLY 0x001 |
read only access
| #define RT_DEVICE_OFLAG_WRONLY 0x002 |
write only access
| #define RT_DEVICE_OFLAG_RDWR 0x003 |
read and write
| #define RT_DEVICE_OFLAG_OPEN 0x008 |
device is opened
| #define RT_DEVICE_OFLAG_MASK 0xf0f |
mask of open flag
| #define RT_DEVICE_CTRL_RESUME 0x01 |
general device commands 0x01 - 0x1F general device control commands 0x20 - 0x3F udevice control commands 0x40 - special device control commands resume device
| #define RT_DEVICE_CTRL_SUSPEND 0x02 |
suspend device
| #define RT_DEVICE_CTRL_CONFIG 0x03 |
configure device
| #define RT_DEVICE_CTRL_CLOSE 0x04 |
close device
| #define RT_DEVICE_CTRL_NOTIFY_SET 0x05 |
set notify func
| #define RT_DEVICE_CTRL_SET_INT 0x06 |
set interrupt
| #define RT_DEVICE_CTRL_CLR_INT 0x07 |
clear interrupt
| #define RT_DEVICE_CTRL_GET_INT 0x08 |
get interrupt status
| #define RT_DEVICE_CTRL_CONSOLE_OFLAG 0x09 |
get console open flag
| #define RT_DEVICE_CTRL_MASK 0x1f |
mask for contrl commands
| #define RT_DEVICE_CTRL_BASE | ( | Type | ) | ((RT_Device_Class_##Type + 1) * 0x100) |
device control
| enum rt_device_class_type |
device (I/O) class type