📄 devices.h
字号:
#ifndef INC_DEVICE_TABLE_H#define INC_DEVICE_TABLE_H#include <types.h>#include <reent.h> // describes what is found at driver level.typedef const struct { const char *name; // constant to define device type: mmc, etc. ushort device_type; // device methods for newlib interface. int (*open)(struct _reent *r,const char *name, int flags, int mode); int (*close)(struct _reent *r,int file); _ssize_t (*read)(struct _reent *r,int file, void *ptr, size_t len); _ssize_t (*write)(struct _reent *r,int file, const void *ptr, size_t len); // init the device / software layers. int (*init)(void); // and the venerable catch-22... int (*ioctl)(struct _reent *r, int file, int cmd, void *ptr);} DEVICE_TABLE_ENTRY; // device number is high byte of FILE "pointer".#define DEVICE(D) (D << 8)#define DEVICE_TYPE(D) ((D >> 8) & 0xff)typedef const struct { const DEVICE_TABLE_ENTRY * item;} DEVICE_TABLE_ARRAY;typedef const DEVICE_TABLE_ARRAY * DEVICE_TABLE_LIST;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -