[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: programming I2C

On Thursday 17 July 2003 11:28, fjrg_cesinel@xxxxxxx.com wrote:
>   this is my code:
> #include <linux/i2c.h>
> #include <linux/i2c-dev.h>

You can't use the 'standard' i2c driver, you have to use the etrax i2c driver.

#include <asm/etraxi2c.h>

Make sure you enable the etrax i2c driver in your kernelconfig, though you 
probably have done so, since you could open /dev/i2c

>   // setting the address
>   if (ioctl(descriptor,I2C_SLAVE,direccion_adaptador) < 0)
>   {
>     printf("Error al especificar direccion del dispositivo i2c\n");
>     exit(1);
>   }

The etrax i2c driver only provides readreg/writereg through ioctl. Ioctl 
commands for the 'standard' i2c driver will indeed fail.

Best regards,