Completed i2c-dev. Not tested yet.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@160 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard committed 1999-01-13 19:07:57 +00:00
1 parent 1b05c9e1c1
commit a775db2fcc
5 files changed
+345 -64

No files matched your search

+14 -10
View File
@@ -23,8 +23,10 @@
#ifdef LM_SENSORS
#include "i2c.h"
#include "smbus.h"
#else /* ndef LM_SENSORS */
#include <linux/i2c.h>
#include <linux/smbus.h>
#endif /* def LM_SENSORS */
/* Some IOCTL commands are defined in <linux/i2c.h> */
@@ -34,12 +36,16 @@
/* This is the structure as used in the I2C_SMBUS ioctl call */
struct i2c_smbus_data {
char read_write,
u8 command,
int size,
union smbus_data data
char read_write;
u8 command;
int size;
union smbus_data *data;
};
#ifndef __KERNEL__
#include <linux/ioctl.h>
extern inline s32 i2c_smbus_access(int file, char read_write, u8 command,
int size, union smbus_data *data)
{
@@ -49,12 +55,8 @@ extern inline s32 i2c_smbus_access(int file, char read_write, u8 command,
args.read_write = read_write;
args.command = command;
args.size = size;
if (data)
memcpy(&args.data,data,sizeof(union smbus_data));
res = ioctl(f,I2C_SMBUS,&args);
if (data)
memcpy(data,&args,sizeof(union smbus_data));
return res;
args.data = data;
return ioctl(file,I2C_SMBUS,&args);
}
@@ -147,4 +149,6 @@ extern inline s32 i2c_smbus_write_block_data(int file, u8 command, u8 length,
return i2c_smbus_access(file,SMBUS_WRITE,command,SMBUS_BLOCK_DATA,&data);
}
#endif /* ndef __KERNEL__ */
#endif