|
enum | rt_device_class_type {
RT_Device_Class_Char = 0
, RT_Device_Class_Block
, RT_Device_Class_NetIf
, RT_Device_Class_MTD
,
RT_Device_Class_CAN
, RT_Device_Class_RTC
, RT_Device_Class_Sound
, RT_Device_Class_Graphic
,
RT_Device_Class_I2CBUS
, RT_Device_Class_USBDevice
, RT_Device_Class_USBHost
, RT_Device_Class_USBOTG
,
RT_Device_Class_SPIBUS
, RT_Device_Class_SPIDevice
, RT_Device_Class_SDIO
, RT_Device_Class_PM
,
RT_Device_Class_Pipe
, RT_Device_Class_Portal
, RT_Device_Class_Timer
, RT_Device_Class_Miscellaneous
,
RT_Device_Class_Sensor
, RT_Device_Class_Touch
, RT_Device_Class_PHY
, RT_Device_Class_Security
,
RT_Device_Class_WLAN
, RT_Device_Class_Pin
, RT_Device_Class_ADC
, RT_Device_Class_DAC
,
RT_Device_Class_WDT
, RT_Device_Class_PWM
, RT_Device_Class_Bus
, RT_Device_Class_Unknown
} |
|
|
rt_device_t | rt_device_find (const char *name) |
|
rt_err_t | rt_device_register (rt_device_t dev, const char *name, rt_uint16_t flags) |
|
rt_err_t | rt_device_unregister (rt_device_t dev) |
|
rt_device_t | rt_device_create (int type, int attach_size) |
|
void | rt_device_destroy (rt_device_t device) |
|
rt_err_t | rt_device_set_rx_indicate (rt_device_t dev, rt_err_t(*rx_ind)(rt_device_t dev, rt_size_t size)) |
|
rt_err_t | rt_device_set_tx_complete (rt_device_t dev, rt_err_t(*tx_done)(rt_device_t dev, void *buffer)) |
|
rt_err_t | rt_device_init (rt_device_t dev) |
|
rt_err_t | rt_device_open (rt_device_t dev, rt_uint16_t oflag) |
|
rt_err_t | rt_device_close (rt_device_t dev) |
|
rt_ssize_t | rt_device_read (rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) |
|
rt_ssize_t | rt_device_write (rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) |
|
rt_err_t | rt_device_control (rt_device_t dev, int cmd, void *arg) |
|
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:
- open, open a device
- close, close a device
- read, read some data from a device
- write, write some data to a device
- control, send some control command to a device
◆ RT_DEVICE_FLAG_DEACTIVATE
#define RT_DEVICE_FLAG_DEACTIVATE 0x000 |
device flags definitions device is not not initialized
在文件 rtdef.h 第 1284 行定义.
◆ RT_DEVICE_FLAG_RDONLY
#define RT_DEVICE_FLAG_RDONLY 0x001 |
◆ RT_DEVICE_FLAG_WRONLY
#define RT_DEVICE_FLAG_WRONLY 0x002 |
◆ RT_DEVICE_FLAG_RDWR
#define RT_DEVICE_FLAG_RDWR 0x003 |
◆ RT_DEVICE_FLAG_REMOVABLE
#define RT_DEVICE_FLAG_REMOVABLE 0x004 |
◆ RT_DEVICE_FLAG_STANDALONE
#define RT_DEVICE_FLAG_STANDALONE 0x008 |
◆ RT_DEVICE_FLAG_ACTIVATED
#define RT_DEVICE_FLAG_ACTIVATED 0x010 |
◆ RT_DEVICE_FLAG_SUSPENDED
#define RT_DEVICE_FLAG_SUSPENDED 0x020 |
◆ RT_DEVICE_FLAG_STREAM
#define RT_DEVICE_FLAG_STREAM 0x040 |
◆ RT_DEVICE_FLAG_DYNAMIC
#define RT_DEVICE_FLAG_DYNAMIC 0x080 |
◆ RT_DEVICE_FLAG_INT_RX
#define RT_DEVICE_FLAG_INT_RX 0x100 |
◆ RT_DEVICE_FLAG_DMA_RX
#define RT_DEVICE_FLAG_DMA_RX 0x200 |
◆ RT_DEVICE_FLAG_INT_TX
#define RT_DEVICE_FLAG_INT_TX 0x400 |
◆ RT_DEVICE_FLAG_DMA_TX
#define RT_DEVICE_FLAG_DMA_TX 0x800 |
◆ RT_DEVICE_OFLAG_CLOSE
#define RT_DEVICE_OFLAG_CLOSE 0x000 |
◆ RT_DEVICE_OFLAG_RDONLY
#define RT_DEVICE_OFLAG_RDONLY 0x001 |
◆ RT_DEVICE_OFLAG_WRONLY
#define RT_DEVICE_OFLAG_WRONLY 0x002 |
◆ RT_DEVICE_OFLAG_RDWR
#define RT_DEVICE_OFLAG_RDWR 0x003 |
◆ RT_DEVICE_OFLAG_OPEN
#define RT_DEVICE_OFLAG_OPEN 0x008 |
◆ RT_DEVICE_OFLAG_MASK
#define RT_DEVICE_OFLAG_MASK 0xf0f |
◆ RT_DEVICE_CTRL_RESUME
#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
在文件 rtdef.h 第 1315 行定义.
◆ RT_DEVICE_CTRL_SUSPEND
#define RT_DEVICE_CTRL_SUSPEND 0x02 |
◆ RT_DEVICE_CTRL_CONFIG
#define RT_DEVICE_CTRL_CONFIG 0x03 |
◆ RT_DEVICE_CTRL_CLOSE
#define RT_DEVICE_CTRL_CLOSE 0x04 |
◆ RT_DEVICE_CTRL_NOTIFY_SET
#define RT_DEVICE_CTRL_NOTIFY_SET 0x05 |
◆ RT_DEVICE_CTRL_SET_INT
#define RT_DEVICE_CTRL_SET_INT 0x06 |
◆ RT_DEVICE_CTRL_CLR_INT
#define RT_DEVICE_CTRL_CLR_INT 0x07 |
◆ RT_DEVICE_CTRL_GET_INT
#define RT_DEVICE_CTRL_GET_INT 0x08 |
◆ RT_DEVICE_CTRL_CONSOLE_OFLAG
#define RT_DEVICE_CTRL_CONSOLE_OFLAG 0x09 |
◆ RT_DEVICE_CTRL_MASK
#define RT_DEVICE_CTRL_MASK 0x1f |
◆ RT_DEVICE_CTRL_BASE
#define RT_DEVICE_CTRL_BASE |
( |
| Type | ) |
|
值:((RT_Device_Class_##Type + 1) * 0x100)
device control
在文件 rtdef.h 第 1329 行定义.
◆ rt_driver_t
◆ rt_device_t
◆ rt_wqueue_t
◆ rt_device_class_type
device (I/O) class type
枚举值 |
---|
RT_Device_Class_Char | 0 | character device
|
RT_Device_Class_Block | | block device
|
RT_Device_Class_NetIf | | net interface
|
RT_Device_Class_MTD | | memory device
|
RT_Device_Class_CAN | | CAN device
|
RT_Device_Class_RTC | | RTC device
|
RT_Device_Class_Sound | | Sound device
|
RT_Device_Class_Graphic | | Graphic device
|
RT_Device_Class_I2CBUS | | I2C bus device
|
RT_Device_Class_USBDevice | | USB slave device
|
RT_Device_Class_USBHost | | USB host bus
|
RT_Device_Class_USBOTG | | USB OTG bus
|
RT_Device_Class_SPIBUS | | SPI bus device
|
RT_Device_Class_SPIDevice | | SPI device
|
RT_Device_Class_SDIO | | SDIO bus device
|
RT_Device_Class_PM | | PM pseudo device
|
RT_Device_Class_Pipe | | Pipe device
|
RT_Device_Class_Portal | | Portal device
|
RT_Device_Class_Timer | | Timer device
|
RT_Device_Class_Miscellaneous | | Miscellaneous device
|
RT_Device_Class_Sensor | | Sensor device
|
RT_Device_Class_Touch | | Touch device
|
RT_Device_Class_PHY | | PHY device
|
RT_Device_Class_Security | | Security device
|
RT_Device_Class_WLAN | | WLAN device
|
RT_Device_Class_Pin | | Pin device
|
RT_Device_Class_ADC | | ADC device
|
RT_Device_Class_DAC | | DAC device
|
RT_Device_Class_WDT | | WDT device
|
RT_Device_Class_PWM | | PWM device
|
RT_Device_Class_Bus | | Bus device
|
RT_Device_Class_Unknown | | unknown device
|
在文件 rtdef.h 第 1245 行定义.
1246{
1279};
@ RT_Device_Class_SPIDevice
@ RT_Device_Class_Miscellaneous
@ RT_Device_Class_Graphic
@ RT_Device_Class_USBDevice
@ RT_Device_Class_Security
@ RT_Device_Class_USBHost
@ RT_Device_Class_Unknown
◆ rt_device_find()
◆ rt_device_register()
◆ rt_device_unregister()
◆ rt_device_create()
rt_device_t rt_device_create |
( |
int | type, |
|
|
int | attach_size ) |
◆ rt_device_destroy()
◆ rt_device_set_rx_indicate()
◆ rt_device_set_tx_complete()
◆ rt_device_init()
◆ rt_device_open()
◆ rt_device_close()
◆ rt_device_read()
◆ rt_device_write()
◆ rt_device_control()