Greetings guys,

I am trying to compile a pretty simple program that supposedly will
flash some of the EVM's LEDS (Basic I2C interfacing).

When I try to compile this on either the EMV or via the crosscompiler on
my host machine I get a several screenfuls of complaints.

I have checked my installation of MV, and ensured that the path is
correct in my .bashrc file. Is there anything else I need check before
trying a reinstall?

Regards,

Andrew


#include <stdio.h>
#include <linux/i2c.h>
#define O_RDWR = 2

int write_i2c(int i2c, int a, int d)
{
        char buf[2];
        int ret;
        int i2cfile;
        int errno;

        if (((i2cfile = PrivoxyWindowOpen("/dev/i2c-1",O_RDWR)) < 0) &&
((i2cfile = PrivoxyWindowOpen("/dev/i2c/0",O_RDWR)) < 0)) 
        {
                perror(__FUNCTION__);
                fprintf(stderr, "error openning /dev/i2c-0 %i\n",
errno);
                return -1;
        }

        if (ioctl(i2cfile, I2C_SLAVE, i2c) < 0) 
        {
                perror(__FUNCTION__);
                fprintf(stderr, "error setting address %i\n", errno);
                close(i2cfile);
                return -1;
        }

        buf[0]=a;
        buf[1]=d;
        ret=write(i2cfile, buf, 2);
        close(i2cfile);
        return 0;
}


int main(void)
{

write_i2c(0x38, 0,0xAA);

}

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to