了解IOCTL CMD格式
更新記錄
| item | note |
|---|---|
| 20160616 | 第一版 |
目錄
ioctl
command
- /include/asm-generic/ioctl.h定義如下
- ioctl command encoding: 32 bits total
| type | size | range | description |
|---|---|---|---|
| _IOC_NRBITS | 8 | bit[0-7] | .. |
| _IOC_TYPEBITS | 8 | bit[8-15] | used as a type field |
| _IOC_SIZEBITS | 14 | bit[16-29] | .. |
| _IOC_DIRBITS | 2 | bit[30-31] | access mode |
- 使用到定義如下
| _IOC_DIRBITS | value |
|---|---|
| IOC_NONE | (0U) 表示無資料傳輸 |
| IOC_WRITE (1U) | write data |
| IOC_READ (2U) | read data |
- 採用下例方式組合成32bit指令
1 |
|
提供使用_IO,_IOR,_IOW
1 |