Paparazzi UAS  v5.15_devel-88-gb3ad7fe
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
i2c_smbus.h File Reference

I2C-bus driver. More...

#include <linux/types.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
+ Include dependency graph for i2c_smbus.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  i2c_msg
 
union  i2c_smbus_data
 

Macros

#define I2C_M_TEN   0x10 /* we have a ten bit chip address */
 
#define I2C_M_RD   0x01
 
#define I2C_M_NOSTART   0x4000
 
#define I2C_M_REV_DIR_ADDR   0x2000
 
#define I2C_M_IGNORE_NAK   0x1000
 
#define I2C_M_NO_RD_ACK   0x0800
 
#define I2C_FUNC_I2C   0x00000001
 
#define I2C_FUNC_10BIT_ADDR   0x00000002
 
#define I2C_FUNC_PROTOCOL_MANGLING   0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
 
#define I2C_FUNC_SMBUS_PEC   0x00000008
 
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL   0x00008000 /* SMBus 2.0 */
 
#define I2C_FUNC_SMBUS_QUICK   0x00010000
 
#define I2C_FUNC_SMBUS_READ_BYTE   0x00020000
 
#define I2C_FUNC_SMBUS_WRITE_BYTE   0x00040000
 
#define I2C_FUNC_SMBUS_READ_BYTE_DATA   0x00080000
 
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA   0x00100000
 
#define I2C_FUNC_SMBUS_READ_WORD_DATA   0x00200000
 
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA   0x00400000
 
#define I2C_FUNC_SMBUS_PROC_CALL   0x00800000
 
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA   0x01000000
 
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA   0x02000000
 
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK   0x04000000 /* I2C-like block xfer */
 
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK   0x08000000 /* w/ 1-byte reg. addr. */
 
#define I2C_FUNC_SMBUS_BYTE
 
#define I2C_FUNC_SMBUS_BYTE_DATA
 
#define I2C_FUNC_SMBUS_WORD_DATA
 
#define I2C_FUNC_SMBUS_BLOCK_DATA
 
#define I2C_FUNC_SMBUS_I2C_BLOCK
 
#define I2C_FUNC_SMBUS_HWPEC_CALC   I2C_FUNC_SMBUS_PEC
 
#define I2C_SMBUS_BLOCK_MAX   32 /* As specified in SMBus standard */
 
#define I2C_SMBUS_I2C_BLOCK_MAX   32 /* Not specified but we use same structure */
 
#define I2C_SMBUS_READ   1
 
#define I2C_SMBUS_WRITE   0
 
#define I2C_SMBUS_QUICK   0
 
#define I2C_SMBUS_BYTE   1
 
#define I2C_SMBUS_BYTE_DATA   2
 
#define I2C_SMBUS_WORD_DATA   3
 
#define I2C_SMBUS_PROC_CALL   4
 
#define I2C_SMBUS_BLOCK_DATA   5
 
#define I2C_SMBUS_I2C_BLOCK_BROKEN   6
 
#define I2C_SMBUS_BLOCK_PROC_CALL   7 /* SMBus 2.0 */
 
#define I2C_SMBUS_I2C_BLOCK_DATA   8
 
#define I2C_RETRIES   0x0701 /* number of times a device address */
 
#define I2C_TIMEOUT   0x0702 /* set timeout - call with int */
 
#define I2C_SLAVE   0x0703 /* Change slave address */
 
#define I2C_SLAVE_FORCE   0x0706 /* Change slave address */
 
#define I2C_TENBIT   0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
 
#define I2C_FUNCS   0x0705 /* Get the adapter functionality */
 
#define I2C_RDWR   0x0707 /* Combined R/W transfer (one stop only)*/
 
#define I2C_PEC   0x0708 /* != 0 for SMBus PEC */
 
#define I2C_SMBUS   0x0720 /* SMBus-level access */
 

Functions

static __s32 i2c_smbus_access (int file, char read_write, __u8 command, int size, union i2c_smbus_data *data)
 
static __s32 i2c_smbus_write_quick (int file, __u8 value)
 
static __s32 i2c_smbus_read_byte (int file)
 
static __s32 i2c_smbus_write_byte (int file, __u8 value)
 
static __s32 i2c_smbus_read_byte_data (int file, __u8 command)
 
static __s32 i2c_smbus_write_byte_data (int file, __u8 command, __u8 value)
 
static __s32 i2c_smbus_read_word_data (int file, __u8 command)
 
static __s32 i2c_smbus_write_word_data (int file, __u8 command, __u16 value)
 
static __s32 i2c_smbus_process_call (int file, __u8 command, __u16 value)
 
static __s32 i2c_smbus_read_block_data (int file, __u8 command, __u8 *values)
 
static __s32 i2c_smbus_write_block_data (int file, __u8 command, __u8 length, __u8 *values)
 
static __s32 i2c_smbus_read_i2c_block_data (int file, __u8 command, __u8 length, __u8 *values)
 
static __s32 i2c_smbus_write_i2c_block_data (int file, __u8 command, __u8 length, __u8 *values)
 
static __s32 i2c_smbus_block_process_call (int file, __u8 command, __u8 length, __u8 *values)
 

Detailed Description

I2C-bus driver.

Definition in file i2c_smbus.h.


Data Structure Documentation

struct i2c_msg

Definition at line 40 of file i2c_smbus.h.

Data Fields
__u16 addr
char * buf
unsigned short flags
short len
union i2c_smbus_data

Definition at line 92 of file i2c_smbus.h.

Data Fields
__u8 block[I2C_SMBUS_BLOCK_MAX+2]
__u8 byte
__u16 word

Macro Definition Documentation

#define I2C_FUNC_10BIT_ADDR   0x00000002

Definition at line 56 of file i2c_smbus.h.

#define I2C_FUNC_I2C   0x00000001

Definition at line 55 of file i2c_smbus.h.

#define I2C_FUNC_PROTOCOL_MANGLING   0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */

Definition at line 57 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_BLOCK_DATA
Value:
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
Definition: i2c_smbus.h:69
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA
Definition: i2c_smbus.h:68

Definition at line 79 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL   0x00008000 /* SMBus 2.0 */

Definition at line 59 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_BYTE
Value:
#define I2C_FUNC_SMBUS_READ_BYTE
Definition: i2c_smbus.h:61
#define I2C_FUNC_SMBUS_WRITE_BYTE
Definition: i2c_smbus.h:62

Definition at line 73 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_BYTE_DATA
Value:
#define I2C_FUNC_SMBUS_READ_BYTE_DATA
Definition: i2c_smbus.h:63
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA
Definition: i2c_smbus.h:64

Definition at line 75 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_HWPEC_CALC   I2C_FUNC_SMBUS_PEC

Definition at line 85 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_I2C_BLOCK
Value:
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
Definition: i2c_smbus.h:71
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK
Definition: i2c_smbus.h:70

Definition at line 81 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_PEC   0x00000008

Definition at line 58 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_PROC_CALL   0x00800000

Definition at line 67 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_QUICK   0x00010000

Definition at line 60 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_READ_BLOCK_DATA   0x01000000

Definition at line 68 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_READ_BYTE   0x00020000

Definition at line 61 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_READ_BYTE_DATA   0x00080000

Definition at line 63 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_READ_I2C_BLOCK   0x04000000 /* I2C-like block xfer */

Definition at line 70 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_READ_WORD_DATA   0x00200000

Definition at line 65 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_WORD_DATA
Value:
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA
Definition: i2c_smbus.h:66
#define I2C_FUNC_SMBUS_READ_WORD_DATA
Definition: i2c_smbus.h:65

Definition at line 77 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA   0x02000000

Definition at line 69 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_WRITE_BYTE   0x00040000

Definition at line 62 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA   0x00100000

Definition at line 64 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK   0x08000000 /* w/ 1-byte reg. addr. */

Definition at line 71 of file i2c_smbus.h.

#define I2C_FUNC_SMBUS_WRITE_WORD_DATA   0x00400000

Definition at line 66 of file i2c_smbus.h.

#define I2C_FUNCS   0x0705 /* Get the adapter functionality */

Definition at line 137 of file i2c_smbus.h.

#define I2C_M_IGNORE_NAK   0x1000

Definition at line 47 of file i2c_smbus.h.

#define I2C_M_NO_RD_ACK   0x0800

Definition at line 48 of file i2c_smbus.h.

#define I2C_M_NOSTART   0x4000

Definition at line 45 of file i2c_smbus.h.

#define I2C_M_RD   0x01

Definition at line 44 of file i2c_smbus.h.

Referenced by i2c_thread().

#define I2C_M_REV_DIR_ADDR   0x2000

Definition at line 46 of file i2c_smbus.h.

#define I2C_M_TEN   0x10 /* we have a ten bit chip address */

Definition at line 43 of file i2c_smbus.h.

#define I2C_PEC   0x0708 /* != 0 for SMBus PEC */

Definition at line 139 of file i2c_smbus.h.

#define I2C_RDWR   0x0707 /* Combined R/W transfer (one stop only)*/

Definition at line 138 of file i2c_smbus.h.

Referenced by i2c_thread().

#define I2C_RETRIES   0x0701 /* number of times a device address */

Definition at line 122 of file i2c_smbus.h.

#define I2C_SLAVE   0x0703 /* Change slave address */

Definition at line 129 of file i2c_smbus.h.

Referenced by i2c_thread().

#define I2C_SLAVE_FORCE   0x0706 /* Change slave address */

Definition at line 131 of file i2c_smbus.h.

Referenced by bat_voltage_ardrone2_init().

#define I2C_SMBUS   0x0720 /* SMBus-level access */

Definition at line 141 of file i2c_smbus.h.

Referenced by i2c_smbus_access().

#define I2C_SMBUS_BLOCK_DATA   5

Definition at line 110 of file i2c_smbus.h.

Referenced by i2c_smbus_read_block_data(), and i2c_smbus_write_block_data().

#define I2C_SMBUS_BLOCK_MAX   32 /* As specified in SMBus standard */

Definition at line 90 of file i2c_smbus.h.

#define I2C_SMBUS_BLOCK_PROC_CALL   7 /* SMBus 2.0 */

Definition at line 112 of file i2c_smbus.h.

Referenced by i2c_smbus_block_process_call().

#define I2C_SMBUS_BYTE   1

Definition at line 106 of file i2c_smbus.h.

Referenced by i2c_smbus_read_byte(), and i2c_smbus_write_byte().

#define I2C_SMBUS_BYTE_DATA   2

Definition at line 107 of file i2c_smbus.h.

Referenced by i2c_smbus_read_byte_data(), and i2c_smbus_write_byte_data().

#define I2C_SMBUS_I2C_BLOCK_BROKEN   6

Definition at line 111 of file i2c_smbus.h.

Referenced by i2c_smbus_read_i2c_block_data(), and i2c_smbus_write_i2c_block_data().

#define I2C_SMBUS_I2C_BLOCK_DATA   8

Definition at line 113 of file i2c_smbus.h.

Referenced by i2c_smbus_read_i2c_block_data().

#define I2C_SMBUS_I2C_BLOCK_MAX   32 /* Not specified but we use same structure */

Definition at line 91 of file i2c_smbus.h.

#define I2C_SMBUS_PROC_CALL   4

Definition at line 109 of file i2c_smbus.h.

Referenced by i2c_smbus_process_call().

#define I2C_SMBUS_QUICK   0

Definition at line 105 of file i2c_smbus.h.

Referenced by i2c_smbus_write_quick().

#define I2C_SMBUS_WORD_DATA   3

Definition at line 108 of file i2c_smbus.h.

Referenced by i2c_smbus_read_word_data(), and i2c_smbus_write_word_data().

#define I2C_TENBIT   0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */

Definition at line 135 of file i2c_smbus.h.

#define I2C_TIMEOUT   0x0702 /* set timeout - call with int */

Definition at line 125 of file i2c_smbus.h.

Function Documentation

static __s32 i2c_smbus_access ( int  file,
char  read_write,
__u8  command,
int  size,
union i2c_smbus_data data 
)
inlinestatic
static __s32 i2c_smbus_block_process_call ( int  file,
__u8  command,
__u8  length,
__u8 *  values 
)
inlinestatic

Definition at line 312 of file i2c_smbus.h.

References i2c_smbus_data::block, i2c_smbus_access(), I2C_SMBUS_BLOCK_PROC_CALL, and I2C_SMBUS_WRITE.

+ Here is the call graph for this function:

static __s32 i2c_smbus_process_call ( int  file,
__u8  command,
__u16  value 
)
inlinestatic

Definition at line 223 of file i2c_smbus.h.

References i2c_smbus_access(), I2C_SMBUS_PROC_CALL, I2C_SMBUS_WRITE, and i2c_smbus_data::word.

+ Here is the call graph for this function:

static __s32 i2c_smbus_read_block_data ( int  file,
__u8  command,
__u8 *  values 
)
inlinestatic

Definition at line 237 of file i2c_smbus.h.

References i2c_smbus_data::block, i2c_smbus_access(), I2C_SMBUS_BLOCK_DATA, and I2C_SMBUS_READ.

+ Here is the call graph for this function:

static __s32 i2c_smbus_read_byte ( int  file)
inlinestatic

Definition at line 167 of file i2c_smbus.h.

References i2c_smbus_data::byte, i2c_smbus_access(), I2C_SMBUS_BYTE, and I2C_SMBUS_READ.

+ Here is the call graph for this function:

static __s32 i2c_smbus_read_byte_data ( int  file,
__u8  command 
)
inlinestatic

Definition at line 183 of file i2c_smbus.h.

References i2c_smbus_data::byte, i2c_smbus_access(), I2C_SMBUS_BYTE_DATA, and I2C_SMBUS_READ.

Referenced by bat_voltage_ardrone2_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static __s32 i2c_smbus_read_i2c_block_data ( int  file,
__u8  command,
__u8  length,
__u8 *  values 
)
inlinestatic

Definition at line 273 of file i2c_smbus.h.

References i2c_smbus_data::block, i2c_smbus_access(), I2C_SMBUS_I2C_BLOCK_BROKEN, I2C_SMBUS_I2C_BLOCK_DATA, and I2C_SMBUS_READ.

+ Here is the call graph for this function:

static __s32 i2c_smbus_read_word_data ( int  file,
__u8  command 
)
inlinestatic

Definition at line 203 of file i2c_smbus.h.

References i2c_smbus_access(), I2C_SMBUS_READ, I2C_SMBUS_WORD_DATA, and i2c_smbus_data::word.

+ Here is the call graph for this function:

static __s32 i2c_smbus_write_block_data ( int  file,
__u8  command,
__u8  length,
__u8 *  values 
)
inlinestatic

Definition at line 253 of file i2c_smbus.h.

References i2c_smbus_data::block, i2c_smbus_access(), I2C_SMBUS_BLOCK_DATA, and I2C_SMBUS_WRITE.

+ Here is the call graph for this function:

static __s32 i2c_smbus_write_byte ( int  file,
__u8  value 
)
inlinestatic

Definition at line 177 of file i2c_smbus.h.

References i2c_smbus_access(), I2C_SMBUS_BYTE, and I2C_SMBUS_WRITE.

+ Here is the call graph for this function:

static __s32 i2c_smbus_write_byte_data ( int  file,
__u8  command,
__u8  value 
)
inlinestatic

Definition at line 194 of file i2c_smbus.h.

References i2c_smbus_data::byte, i2c_smbus_access(), I2C_SMBUS_BYTE_DATA, and I2C_SMBUS_WRITE.

Referenced by electrical_ardrone2_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static __s32 i2c_smbus_write_i2c_block_data ( int  file,
__u8  command,
__u8  length,
__u8 *  values 
)
inlinestatic

Definition at line 295 of file i2c_smbus.h.

References i2c_smbus_data::block, i2c_smbus_access(), I2C_SMBUS_I2C_BLOCK_BROKEN, and I2C_SMBUS_WRITE.

+ Here is the call graph for this function:

static __s32 i2c_smbus_write_quick ( int  file,
__u8  value 
)
inlinestatic

Definition at line 162 of file i2c_smbus.h.

References i2c_smbus_access(), and I2C_SMBUS_QUICK.

+ Here is the call graph for this function:

static __s32 i2c_smbus_write_word_data ( int  file,
__u8  command,
__u16  value 
)
inlinestatic

Definition at line 214 of file i2c_smbus.h.

References i2c_smbus_access(), I2C_SMBUS_WORD_DATA, I2C_SMBUS_WRITE, and i2c_smbus_data::word.

+ Here is the call graph for this function: