I2C: Getting Compiation Error for application program
Sachin Rane
SRane at alphion.com
Wed Sep 20 22:51:10 EST 2006
Hi,
I am trying to compile simple program (appended), but getting lots of compilation error.
I am using Timesys Linux 2.6.13 for ppc440 evaluation board.
Command used for compilation:
$> gcc eeprom-client.c -o eeprom-client.o
Could you help me to find out the reason behind getting the errors?
Regards,
Sachin Rane
8< ------------------------eeprom-client.c -------------------------------------------------------------------------------------
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
int main()
{
int file;
int adapter_nr = 0; /* probably dynamically determined */
char filename[20];
int addr = 0xA1; /* The I2C address */
sprintf(filename,"/dev/i2c-%d",adapter_nr);
if ((file = open(filename,O_RDWR)) < 0)
{
exit(1);
}
if (ioctl(file,I2C_SLAVE,addr) < 0)
{
exit(1);
}
else
{
printf("\n Able to bind the adapter");
}
return 0;
}
8< -------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20060920/7f489ab7/attachment.htm
More information about the Linuxppc-embedded
mailing list