Skip to contentSkip to conversation

Draft for a RTDM I2C driver, V2

Xenomai-core Dirk Eibach 3 participants 5 messages Nov 29, 2006 – Sep 25, 2014

lore
Share & tools
lore
#0 lore raw

Hello,

I did some redesigning on my first draft.
- Now we have some kind of profile in include/rti2c.h.
- I got rid of some chunks of code that were not really needed.
- Linux kernel dependencies have been removed (I hope I catched all of them)

Cheers.

Signature · 5 lines
Dirk Eibach <[email protected]>
Guntermann & Drunck Systementwicklung GmbH
F & E
Dortmunder Str. 4a, D-57234 Wilnsdorf
Tel.: +49 (0) 2739 8901 100, Fax.: +49 (0) 2739 8901 120
#1 lore raw
Quoted 7 lines · Dirk Eibach

Hello,

I did some redesigning on my first draft.
- Now we have some kind of profile in include/rti2c.h.
- I got rid of some chunks of code that were not really needed.
- Linux kernel dependencies have been removed (I hope I catched all of them)

Will have a look at the code later.

Did you already consider to integrate it in a local Xenomai tree and post patches against SVN head (=> /drivers/i2c, /include/rtdm)? Would make it easier to test compilation and doc generation. What is the empty algo folder supposed to contain one day?

What would also be nice is a simple demo application. We still have no policy were to put such stuff. Maybe we'll take the chance and create an examples folder in SVN and/or put code/description into the wiki.

Jan

#2 lore raw
Quoted 9 lines · [email protected] wrote:
Quoted 7 lines · Dirk Eibach

Hello,

I did some redesigning on my first draft.
- Now we have some kind of profile in include/rti2c.h.
- I got rid of some chunks of code that were not really needed.
- Linux kernel dependencies have been removed (I hope I catched all of them)

Quoted 6 lines

Will have a look at the code later.

Did you already consider to integrate it in a local Xenomai tree and post patches against SVN head (=> /drivers/i2c, /include/rtdm)? Would make it easier to test compilation and doc generation. What is the empty algo folder supposed to contain one day?

I have already thought about integrating it in my local Xenomia tree, but for my first steps I took the easy way. Probably time has come to change this now.
The algo folder should be used for the implementation of common algorithms i.e. bit-banging or the PCF8584. Those algorithms are used for specific implementations that are placed in the busses folder.

Quoted 3 lines

What would also be nice is a simple demo application. We still have no policy were to put such stuff. Maybe we'll take the chance and create an examples folder in SVN and/or put code/description into the wiki.

I have a simple demo application ready. Just telle me where to put it.

Dirk

#4 lore raw
In reply to Dirk Eibach
Quoted 7 lines · Dirk Eibach

Hello,

I did some redesigning on my first draft.
- Now we have some kind of profile in include/rti2c.h.
- I got rid of some chunks of code that were not really needed.
- Linux kernel dependencies have been removed (I hope I catched all of them)

Hmm, I would rather suggest the opposite: Unless you have to deviate from the original Linux API (which seems to exist in kernel 2.4 as well), I would prefer to keep structure and constant names identical. I see no technically problem ATM in including the original I2C Linux header, both in kernel and user space.

Then I'm curious what /real-time/ application scenarios are behind the SMBus wrapping functions. Are you driving time-critical hardware via such a protocol? May other users do the same, or is this a special use case? Sorry, my knowledge about the SMBus is quite limited. The question for me is simply, if those helpers should become part of the official API specification or not.

There are still some duplications in the headers /rti2c.h and /include/rti2c.h (I assume rti2c-api.h is just a copy of /include/rti2c.h without profile comments). Please avoid this. Everything the user needs to see should be in the profile header, and that can then be included by the driver header.

And I think I found a bug (you may want to try CONFIG_XENO_OPT_DEBUG_RTDM): rti2c_adapter_register, e.g., uses an RTDM mutex, but I strongly suspect it (only?) runs in Linux context. Please check your locking in this regard, also the other way around (non-RT services in RT context - we currently lack automated checking for this).

Another remark while cross-reading (which means: no guarantee I found all issues): correct error code for wrong context is EPERM (rti2c_ioctl_rt, RTI2C_RDWR).

So far for now.

Jan