Show
Ignore:
Timestamp:
04/26/12 12:05:30 (2 years ago)
Author:
khali
Message:

i2c-dev.h: Minimize differences with kernel flavor

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • i2c-tools/trunk/include/linux/i2c-dev.h

    r5894 r6047  
    2121*/ 
    2222 
    23 /* $Id$ */ 
    24  
    25 #ifndef LIB_I2CDEV_H 
    26 #define LIB_I2CDEV_H 
     23#ifndef _LINUX_I2C_DEV_H 
     24#define _LINUX_I2C_DEV_H 
    2725 
    2826#include <linux/types.h> 
     
    112110 
    113111 
    114 /* ----- commands for the ioctl like i2c_command call: 
    115  * note that additional calls are defined in the algorithm and hw  
    116  *      dependent layers - these can be listed here, or see the  
    117  *      corresponding header files. 
     112/* /dev/i2c-X ioctl commands.  The ioctl's parameter is always an 
     113 * unsigned long, except for: 
     114 *      - I2C_FUNCS, takes pointer to an unsigned long 
     115 *      - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data 
     116 *      - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data 
    118117 */ 
    119                                 /* -> bit-adapter specific ioctls       */ 
    120 #define I2C_RETRIES     0x0701  /* number of times a device address      */ 
    121                                 /* should be polled when not            */ 
    122                                 /* acknowledging                        */ 
    123 #define I2C_TIMEOUT     0x0702  /* set timeout - call with int          */ 
    124  
    125  
    126 /* this is for i2c-dev.c        */ 
    127 #define I2C_SLAVE       0x0703  /* Change slave address                 */ 
    128                                 /* Attn.: Slave address is 7 or 10 bits */ 
    129 #define I2C_SLAVE_FORCE 0x0706  /* Change slave address                 */ 
    130                                 /* Attn.: Slave address is 7 or 10 bits */ 
    131                                 /* This changes the address, even if it */ 
    132                                 /* is already taken!                    */ 
    133 #define I2C_TENBIT      0x0704  /* 0 for 7 bit addrs, != 0 for 10 bit   */ 
    134  
    135 #define I2C_FUNCS       0x0705  /* Get the adapter functionality */ 
    136 #define I2C_RDWR        0x0707  /* Combined R/W transfer (one stop only)*/ 
    137 #define I2C_PEC         0x0708  /* != 0 for SMBus PEC                   */ 
    138  
    139 #define I2C_SMBUS       0x0720  /* SMBus-level access */ 
    140  
    141 /* -- i2c.h -- */ 
    142  
    143  
    144 /* Note: 10-bit addresses are NOT supported! */ 
     118#define I2C_RETRIES     0x0701  /* number of times a device address should 
     119                                   be polled when not acknowledging */ 
     120#define I2C_TIMEOUT     0x0702  /* set timeout in units of 10 ms */ 
     121 
     122/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses 
     123 * are NOT supported! (due to code brokenness) 
     124 */ 
     125#define I2C_SLAVE       0x0703  /* Use this slave address */ 
     126#define I2C_SLAVE_FORCE 0x0706  /* Use this slave address, even if it 
     127                                   is already in use by a driver! */ 
     128#define I2C_TENBIT      0x0704  /* 0 for 7 bit addrs, != 0 for 10 bit */ 
     129 
     130#define I2C_FUNCS       0x0705  /* Get the adapter functionality mask */ 
     131 
     132#define I2C_RDWR        0x0707  /* Combined R/W transfer (one STOP only) */ 
     133 
     134#define I2C_PEC         0x0708  /* != 0 to use PEC with SMBus */ 
     135#define I2C_SMBUS       0x0720  /* SMBus transfer */ 
     136 
    145137 
    146138/* This is the structure as used in the I2C_SMBUS ioctl call */ 
    147139struct i2c_smbus_ioctl_data { 
    148         char read_write; 
     140        __u8 read_write; 
    149141        __u8 command; 
    150         int size; 
     142        __u32 size; 
    151143        union i2c_smbus_data *data; 
    152144}; 
     
    155147struct i2c_rdwr_ioctl_data { 
    156148        struct i2c_msg *msgs;   /* pointers to i2c_msgs */ 
    157         int nmsgs;              /* number of i2c_msgs */ 
     149        __u32 nmsgs;                    /* number of i2c_msgs */ 
    158150}; 
     151 
     152#define  I2C_RDRW_IOCTL_MAX_MSGS        42 
    159153 
    160154 
     
    333327 
    334328 
    335 #endif /* LIB_I2CDEV_H */ 
     329#endif /* _LINUX_I2C_DEV_H */