Hello,

I am working in a controller using the motorola coldfire 5282 into the
uCevolution test board from Arcturus. In the last days, I downloaded the
"uClinux-dist-2008-FEB-05-r0-release" distribution from arcturus site.
It's working with the kernel 2.6, and I understand that this
distribution have a better support for i2c communication. I have been
tried to implement the i2c but I don't know how to do this.

I have configure Device Drivers---->
                     I2C Support-------->
                            <m>  I2C Support-------->
                                      <m> I2C Device Interface
                                          I2C Hardware bus support --->
                                             <m> MCF Coldfire

Then I read from documentation inside the distribution
linux2.6/Documentation/i2c/dev-interface    to use this protocol is
necessary only do this:

So let's say you want to access an i2c adapter from a C program. The
first thing to do is "#include <linux/i2c-dev.h>". Please note that
there are two files named "i2c-dev.h" out there, one is distributed
with the Linux kernel and is meant to be included from kernel
driver code, the other one is distributed with lm_sensors and is
meant to be included from user-space programs. You obviously want
the second one here.

Now, you have to decide which adapter you want to access. You should
inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned
somewhat dynamically, so you can not even assume /dev/i2c-0 is the
first adapter.

Next thing, open the device file, as follows:
  int file;
  int adapter_nr = 2; /* probably dynamically determined */
  char filename[20];
  
  sprintf(filename,"/dev/i2c-%d",adapter_nr);
  if ((file = open(filename,O_RDWR)) < 0) {
    /* ERROR HANDLING; you can check errno to see what went wrong */
    exit(1);
  }

When you have opened the device, you must specify with what device
address you want to communicate:
  int addr = 0x40; /* The I2C address */
  if (ioctl(file,I2C_SLAVE,addr) < 0) {
    /* ERROR HANDLING; you can check errno to see what went wrong */
    exit(1);
  }




but this does not work, I need more documentation and if is possible a
example that can help me to make my work possible.


I have seen that can be load a module for i2c in the mcf called
i2c-mcf.c i load the module using insmod i2c-mcf.ko, but my question is
how i can use the function in that the module have, or how i  can use
the driver I am confuse.  


PLEASE HELP ME BECAUSE I AM HAVE STUCK IN THE DEVELOPMENT OF A VERY
IMPORTANT PROJECT.  



_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to