GadgetSeed  0.9.6
i2c_ioctl.h
[詳解]
1 /** @file
2  @brief I2Cドライバ ioctl 用マクロ定義
3 
4  推奨デバイス名 : "i2c"
5 
6  @date 2015.09.27
7  @author Takashi SHUDO
8 */
9 
10 #ifndef I2C_IOCTL_H
11 #define I2C_IOCTL_H
12 
13 #include "device/std_ioctl.h"
14 
15 #define DEF_DEV_NAME_I2C "i2c" ///< 標準I2Cコントローラデバイス名
16 
17 struct st_i2c_config {
18  int speed; ///< ビットレート(Kbps)
19 
20 #define I2C_ADDR_MODE_7BIT 0 ///< I2C 7ビットアドレスモード
21 #define I2C_ADDR_MODE_11BIT 1 ///< I2C 11ビットアドレスモード
22  int address_mode; ///< 未使用(予約) @todo I2C 11ビットアドレスデバイス対応
23 
24  unsigned int slave_addr; ///< I2Cスレーブデバイスアドレス
25 
26 #define I2C_MEM_ADDR_SIZE_8BIT 0 ///< I2Cスレーブデバイスメモリアドレスサイズは8ビット
27 #define I2C_MEM_ADDR_SIZE_16BIT 1 ///< I2Cスレーブデバイスメモリアドレスサイズは16ビット
28  int mem_addr_size; ///< I2Cスレーブデバイスメモリアドレスサイズ
29 }; ///< I2Cコンフィグデータ
30 
31 
32 #define IOCMD_I2C_SPEED STDIOCTL(DEV_I2C,0x00) ///< com : 通信速度を設定する, arg : 通信速度(bps)
33 #define IOCMD_I2C_SLAVE_ADDR7 STDIOCTL(DEV_I2C,0x01) ///< Set Save 7bit Address
34 
35 #define IOCMD_I2C_ADDRMODE STDIOCTL(DEV_I2C,0x05) ///< 0:7bit or 1:11bit address
36 #define IOCMD_I2C_MEMADDRSIZE STDIOCTL(DEV_I2C,0x06) ///< Memory Address Size 8bit or 16bit etc
37 #define IOCMD_I2C_SETCONFIG STDIOCTL(DEV_I2C,0x07) ///< Device Access configration
38 
39 #endif // I2C_IOCTL_H
I2Cコンフィグデータ
Definition: i2c_ioctl.h:17
デバイスドライバ ioctl 用マクロ定義
int speed
ビットレート(Kbps)
Definition: i2c_ioctl.h:18
unsigned int slave_addr
I2Cスレーブデバイスアドレス
Definition: i2c_ioctl.h:24