RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
+ Device System 的协作图:

结构体

struct  rt_wqueue
 
struct  rt_device
 
struct  rt_device_notify
 

宏定义

#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)
 

类型定义

typedef struct rt_driver * rt_driver_t
 
typedef struct rt_devicert_device_t
 
typedef struct rt_wqueue rt_wqueue_t
 

枚举

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:

宏定义说明

◆ RT_DEVICE_FLAG_DEACTIVATE

#define RT_DEVICE_FLAG_DEACTIVATE   0x000

device flags definitions device is not not initialized

在文件 rtdef.h1284 行定义.

◆ RT_DEVICE_FLAG_RDONLY

#define RT_DEVICE_FLAG_RDONLY   0x001

read only

在文件 rtdef.h1286 行定义.

◆ RT_DEVICE_FLAG_WRONLY

#define RT_DEVICE_FLAG_WRONLY   0x002

write only

在文件 rtdef.h1287 行定义.

◆ RT_DEVICE_FLAG_RDWR

#define RT_DEVICE_FLAG_RDWR   0x003

read and write

在文件 rtdef.h1288 行定义.

◆ RT_DEVICE_FLAG_REMOVABLE

#define RT_DEVICE_FLAG_REMOVABLE   0x004

removable device

在文件 rtdef.h1290 行定义.

◆ RT_DEVICE_FLAG_STANDALONE

#define RT_DEVICE_FLAG_STANDALONE   0x008

standalone device

在文件 rtdef.h1291 行定义.

◆ RT_DEVICE_FLAG_ACTIVATED

#define RT_DEVICE_FLAG_ACTIVATED   0x010

device is activated

在文件 rtdef.h1292 行定义.

◆ RT_DEVICE_FLAG_SUSPENDED

#define RT_DEVICE_FLAG_SUSPENDED   0x020

device is suspended

在文件 rtdef.h1293 行定义.

◆ RT_DEVICE_FLAG_STREAM

#define RT_DEVICE_FLAG_STREAM   0x040

stream mode

在文件 rtdef.h1294 行定义.

◆ RT_DEVICE_FLAG_DYNAMIC

#define RT_DEVICE_FLAG_DYNAMIC   0x080

device is determined when open()

在文件 rtdef.h1295 行定义.

◆ RT_DEVICE_FLAG_INT_RX

#define RT_DEVICE_FLAG_INT_RX   0x100

INT mode on Rx

在文件 rtdef.h1297 行定义.

◆ RT_DEVICE_FLAG_DMA_RX

#define RT_DEVICE_FLAG_DMA_RX   0x200

DMA mode on Rx

在文件 rtdef.h1298 行定义.

◆ RT_DEVICE_FLAG_INT_TX

#define RT_DEVICE_FLAG_INT_TX   0x400

INT mode on Tx

在文件 rtdef.h1299 行定义.

◆ RT_DEVICE_FLAG_DMA_TX

#define RT_DEVICE_FLAG_DMA_TX   0x800

DMA mode on Tx

在文件 rtdef.h1300 行定义.

◆ RT_DEVICE_OFLAG_CLOSE

#define RT_DEVICE_OFLAG_CLOSE   0x000

device is closed

在文件 rtdef.h1302 行定义.

◆ RT_DEVICE_OFLAG_RDONLY

#define RT_DEVICE_OFLAG_RDONLY   0x001

read only access

在文件 rtdef.h1303 行定义.

◆ RT_DEVICE_OFLAG_WRONLY

#define RT_DEVICE_OFLAG_WRONLY   0x002

write only access

在文件 rtdef.h1304 行定义.

◆ RT_DEVICE_OFLAG_RDWR

#define RT_DEVICE_OFLAG_RDWR   0x003

read and write

在文件 rtdef.h1305 行定义.

◆ RT_DEVICE_OFLAG_OPEN

#define RT_DEVICE_OFLAG_OPEN   0x008

device is opened

在文件 rtdef.h1306 行定义.

◆ RT_DEVICE_OFLAG_MASK

#define RT_DEVICE_OFLAG_MASK   0xf0f

mask of open flag

在文件 rtdef.h1307 行定义.

◆ 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.h1315 行定义.

◆ RT_DEVICE_CTRL_SUSPEND

#define RT_DEVICE_CTRL_SUSPEND   0x02

suspend device

在文件 rtdef.h1316 行定义.

◆ RT_DEVICE_CTRL_CONFIG

#define RT_DEVICE_CTRL_CONFIG   0x03

configure device

在文件 rtdef.h1317 行定义.

◆ RT_DEVICE_CTRL_CLOSE

#define RT_DEVICE_CTRL_CLOSE   0x04

close device

在文件 rtdef.h1318 行定义.

◆ RT_DEVICE_CTRL_NOTIFY_SET

#define RT_DEVICE_CTRL_NOTIFY_SET   0x05

set notify func

在文件 rtdef.h1319 行定义.

◆ RT_DEVICE_CTRL_SET_INT

#define RT_DEVICE_CTRL_SET_INT   0x06

set interrupt

在文件 rtdef.h1320 行定义.

◆ RT_DEVICE_CTRL_CLR_INT

#define RT_DEVICE_CTRL_CLR_INT   0x07

clear interrupt

在文件 rtdef.h1321 行定义.

◆ RT_DEVICE_CTRL_GET_INT

#define RT_DEVICE_CTRL_GET_INT   0x08

get interrupt status

在文件 rtdef.h1322 行定义.

◆ RT_DEVICE_CTRL_CONSOLE_OFLAG

#define RT_DEVICE_CTRL_CONSOLE_OFLAG   0x09

get console open flag

在文件 rtdef.h1323 行定义.

◆ RT_DEVICE_CTRL_MASK

#define RT_DEVICE_CTRL_MASK   0x1f

mask for contrl commands

在文件 rtdef.h1324 行定义.

◆ RT_DEVICE_CTRL_BASE

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

device control

在文件 rtdef.h1329 行定义.

类型定义说明

◆ rt_driver_t

typedef struct rt_driver* rt_driver_t

在文件 rtdef.h1331 行定义.

◆ rt_device_t

typedef struct rt_device* rt_device_t

在文件 rtdef.h1332 行定义.

◆ rt_wqueue_t

typedef struct rt_wqueue rt_wqueue_t

在文件 rtdef.h1359 行定义.

枚举类型说明

◆ rt_device_class_type

device (I/O) class type

枚举值
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

在文件 rtdef.h1245 行定义.

1246{
1279};
@ RT_Device_Class_SPIDevice
@ RT_Device_Class_Timer
@ RT_Device_Class_Touch
@ RT_Device_Class_Miscellaneous
@ RT_Device_Class_Graphic
@ RT_Device_Class_Bus
@ RT_Device_Class_PM
@ RT_Device_Class_MTD
@ RT_Device_Class_CAN
@ RT_Device_Class_Portal
@ RT_Device_Class_DAC
@ RT_Device_Class_PWM
@ RT_Device_Class_Block
@ RT_Device_Class_ADC
@ RT_Device_Class_Pipe
@ RT_Device_Class_USBOTG
@ RT_Device_Class_Sound
@ RT_Device_Class_Pin
@ RT_Device_Class_NetIf
@ RT_Device_Class_RTC
@ RT_Device_Class_WLAN
@ RT_Device_Class_SDIO
@ RT_Device_Class_USBDevice
@ RT_Device_Class_PHY
@ RT_Device_Class_Char
@ RT_Device_Class_Security
@ RT_Device_Class_USBHost
@ RT_Device_Class_WDT
@ RT_Device_Class_Unknown
@ RT_Device_Class_I2CBUS
@ RT_Device_Class_Sensor
@ RT_Device_Class_SPIBUS

函数说明

◆ rt_device_find()

rt_device_t rt_device_find ( const char * name)
+ 这是这个函数的调用关系图:

◆ rt_device_register()

rt_err_t rt_device_register ( rt_device_t dev,
const char * name,
rt_uint16_t flags )

◆ rt_device_unregister()

rt_err_t rt_device_unregister ( rt_device_t dev)

◆ rt_device_create()

rt_device_t rt_device_create ( int type,
int attach_size )

◆ rt_device_destroy()

void rt_device_destroy ( rt_device_t device)

◆ rt_device_set_rx_indicate()

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_device_set_tx_complete()

rt_err_t rt_device_set_tx_complete ( rt_device_t dev,
rt_err_t(* tx_done )(rt_device_t dev, void *buffer) )

◆ rt_device_init()

rt_err_t rt_device_init ( rt_device_t dev)

◆ rt_device_open()

rt_err_t rt_device_open ( rt_device_t dev,
rt_uint16_t oflag )
+ 这是这个函数的调用关系图:

◆ rt_device_close()

rt_err_t rt_device_close ( rt_device_t dev)
+ 这是这个函数的调用关系图:

◆ rt_device_read()

rt_ssize_t rt_device_read ( rt_device_t dev,
rt_off_t pos,
void * buffer,
rt_size_t size )
+ 这是这个函数的调用关系图:

◆ rt_device_write()

rt_ssize_t rt_device_write ( rt_device_t dev,
rt_off_t pos,
const void * buffer,
rt_size_t size )

◆ rt_device_control()

rt_err_t rt_device_control ( rt_device_t dev,
int cmd,
void * arg )