libi2c low-level implementation question again

Jiri Freyvald jiri.freyvald at gmail.com
Tue Dec 11 16:02:40 UTC 2012


Hi Claas,
I am planning to add i2c support to stm32f4 so I've been trying to find 
some information about it too.
So far I've found i2c implementation for LPC24xx and I would take it as 
a template for my port.
The implementation is here: c/src/lib/libbsp/arm/lpc24xx/i2c/i2c.c.

It looks like all the function: send_start, send_addr and send_stop do 
the following steps:

1/ set appropriate bits in i2c peripheral's control  register and write 
data to data register - so the transfer can immediatelly start
2/ obtain RTEMS semaphor - so device is locked
3/ enable interrupt
3/ finish

the device will stay locked until interrupt handler is called, then:
1/ checks the current state of the i2c device and prepare another 
transmittion (if it wasn't the last byte transmitted/received)
2/ release the semaphor and disable interrupt - if it wasn't the last byte)

But I must confess, I haven't study the documentation how to port RTEMS 
yet, so I just guess  (having some knowledge about drivers in Linux).
So I can't guarantie I am 100% right.

Maybe someone could confirm that it is ok

Regards,
Jiri



On 11/12/12 10:16, Claas Ziemke wrote:
> hi all,
>
> sorry for spamming all the lists with this, but since nobody answered 
> on my first try i have to repost this.
> if nobody wants to take this one, please point me to the right 
> documentation or the right people to ask directly.
>
> i am currently working on the implementation of the low-level driver 
> for the beagleboard/omap35xx i2c drivers.
>
> i see that in the libi2c there are 5 hooks defined:
>
> const rtems_libi2c_bus_ops_t beagle_i2c_ops = {
>   .init = beagle_i2c_init,
>   .send_start = beagle_i2c_send_start,
>   .send_stop = beagle_i2c_send_stop,
>   .send_addr = beagle_i2c_send_addr,
>   .read_bytes = beagle_i2c_read,
>   .write_bytes = beagle_i2c_write,
>   .ioctl = beagle_i2c_ioctl
> };
>
> my question is:
>
> are the send_start, send_addr and send_stop functions supposed to 
> actually _send_ the according signals to the bus when called?
> or are they just preparing the device and the actual sending takes 
> place in the read/write functions?
>
> i have some difficulties generating the former behaviour on the 
> beagleboard hardware.
>
> thx for the great help so far, i am recently making really good 
> progress, the interrupt handling is working now and i only have to
> implement the i2c drivers and the clockdriver which i hope to do till 
> xmas, so that u get a new BSP for RTEMS as a little xmas
> present finally...
>
> greetz,
>
> claas
>
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20121211/13a2cf15/attachment-0001.html>


More information about the devel mailing list