RT-Thread RTOS  1.2.0
An open source embedded real-time operating system
+ Collaboration diagram for Device System:

Data Structures

struct  rt_wqueue
 
struct  rt_device
 
struct  rt_device_notify
 

Macros

#define RT_DEVICE_FLAG_DEACTIVATE   0x000
 
#define RT_DEVICE_FLAG_RDONLY   0x001
 
#define RT_DEVICE_FLAG_WRONLY   0x002
 
#define RT_DEVICE_FLAG_RDWR   0x003
 
#define RT_DEVICE_FLAG_REMOVABLE   0x004
 
#define RT_DEVICE_FLAG_STANDALONE   0x008
 
#define RT_DEVICE_FLAG_ACTIVATED   0x010
 
#define RT_DEVICE_FLAG_SUSPENDED   0x020
 
#define RT_DEVICE_FLAG_STREAM   0x040
 
#define RT_DEVICE_FLAG_DYNAMIC   0x080
 
#define RT_DEVICE_FLAG_INT_RX   0x100
 
#define RT_DEVICE_FLAG_DMA_RX   0x200
 
#define RT_DEVICE_FLAG_INT_TX   0x400
 
#define RT_DEVICE_FLAG_DMA_TX   0x800
 
#define RT_DEVICE_OFLAG_CLOSE   0x000
 
#define RT_DEVICE_OFLAG_RDONLY   0x001
 
#define RT_DEVICE_OFLAG_WRONLY   0x002
 
#define RT_DEVICE_OFLAG_RDWR   0x003
 
#define RT_DEVICE_OFLAG_OPEN   0x008
 
#define RT_DEVICE_OFLAG_MASK   0xf0f
 
#define RT_DEVICE_CTRL_RESUME   0x01
 
#define RT_DEVICE_CTRL_SUSPEND   0x02
 
#define RT_DEVICE_CTRL_CONFIG   0x03
 
#define RT_DEVICE_CTRL_CLOSE   0x04
 
#define RT_DEVICE_CTRL_NOTIFY_SET   0x05
 
#define RT_DEVICE_CTRL_SET_INT   0x06
 
#define RT_DEVICE_CTRL_CLR_INT   0x07
 
#define RT_DEVICE_CTRL_GET_INT   0x08
 
#define RT_DEVICE_CTRL_CONSOLE_OFLAG   0x09
 
#define RT_DEVICE_CTRL_MASK   0x1f
 
#define RT_DEVICE_CTRL_BASE(Type)   ((RT_Device_Class_##Type + 1) * 0x100)
 

Enumerations

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
}
 

Detailed Description

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:

Macro Definition Documentation

◆ RT_DEVICE_FLAG_DEACTIVATE

#define RT_DEVICE_FLAG_DEACTIVATE   0x000

device flags definitions device is not not initialized

◆ RT_DEVICE_FLAG_RDONLY

#define RT_DEVICE_FLAG_RDONLY   0x001

read only

◆ RT_DEVICE_FLAG_WRONLY

#define RT_DEVICE_FLAG_WRONLY   0x002

write only

◆ RT_DEVICE_FLAG_RDWR

#define RT_DEVICE_FLAG_RDWR   0x003

read and write

◆ RT_DEVICE_FLAG_REMOVABLE

#define RT_DEVICE_FLAG_REMOVABLE   0x004

removable device

◆ RT_DEVICE_FLAG_STANDALONE

#define RT_DEVICE_FLAG_STANDALONE   0x008

standalone device

◆ RT_DEVICE_FLAG_ACTIVATED

#define RT_DEVICE_FLAG_ACTIVATED   0x010

device is activated

◆ RT_DEVICE_FLAG_SUSPENDED

#define RT_DEVICE_FLAG_SUSPENDED   0x020

device is suspended

◆ RT_DEVICE_FLAG_STREAM

#define RT_DEVICE_FLAG_STREAM   0x040

stream mode

◆ RT_DEVICE_FLAG_DYNAMIC

#define RT_DEVICE_FLAG_DYNAMIC   0x080

device is determined when open()

◆ RT_DEVICE_FLAG_INT_RX

#define RT_DEVICE_FLAG_INT_RX   0x100

INT mode on Rx

◆ RT_DEVICE_FLAG_DMA_RX

#define RT_DEVICE_FLAG_DMA_RX   0x200

DMA mode on Rx

◆ RT_DEVICE_FLAG_INT_TX

#define RT_DEVICE_FLAG_INT_TX   0x400

INT mode on Tx

◆ RT_DEVICE_FLAG_DMA_TX

#define RT_DEVICE_FLAG_DMA_TX   0x800

DMA mode on Tx

◆ RT_DEVICE_OFLAG_CLOSE

#define RT_DEVICE_OFLAG_CLOSE   0x000

device is closed

◆ RT_DEVICE_OFLAG_RDONLY

#define RT_DEVICE_OFLAG_RDONLY   0x001

read only access

◆ RT_DEVICE_OFLAG_WRONLY

#define RT_DEVICE_OFLAG_WRONLY   0x002

write only access

◆ RT_DEVICE_OFLAG_RDWR

#define RT_DEVICE_OFLAG_RDWR   0x003

read and write

◆ RT_DEVICE_OFLAG_OPEN

#define RT_DEVICE_OFLAG_OPEN   0x008

device is opened

◆ RT_DEVICE_OFLAG_MASK

#define RT_DEVICE_OFLAG_MASK   0xf0f

mask of open flag

◆ 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

◆ RT_DEVICE_CTRL_SUSPEND

#define RT_DEVICE_CTRL_SUSPEND   0x02

suspend device

◆ RT_DEVICE_CTRL_CONFIG

#define RT_DEVICE_CTRL_CONFIG   0x03

configure device

◆ RT_DEVICE_CTRL_CLOSE

#define RT_DEVICE_CTRL_CLOSE   0x04

close device

◆ RT_DEVICE_CTRL_NOTIFY_SET

#define RT_DEVICE_CTRL_NOTIFY_SET   0x05

set notify func

◆ RT_DEVICE_CTRL_SET_INT

#define RT_DEVICE_CTRL_SET_INT   0x06

set interrupt

◆ RT_DEVICE_CTRL_CLR_INT

#define RT_DEVICE_CTRL_CLR_INT   0x07

clear interrupt

◆ RT_DEVICE_CTRL_GET_INT

#define RT_DEVICE_CTRL_GET_INT   0x08

get interrupt status

◆ RT_DEVICE_CTRL_CONSOLE_OFLAG

#define RT_DEVICE_CTRL_CONSOLE_OFLAG   0x09

get console open flag

◆ RT_DEVICE_CTRL_MASK

#define RT_DEVICE_CTRL_MASK   0x1f

mask for contrl commands

◆ RT_DEVICE_CTRL_BASE

#define RT_DEVICE_CTRL_BASE (   Type)    ((RT_Device_Class_##Type + 1) * 0x100)

device control

Enumeration Type Documentation

◆ rt_device_class_type

device (I/O) class type

Enumerator
RT_Device_Class_Char 

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