Message-ID: <50C851BF.2060303@xenomai.org> Date: Wed, 12 Dec 2012 10:43:27 +0100 From: Gilles Chanteperdrix MIME-Version: 1.0 References: <1491832.238.1355257934434.JavaMail.poli@jacqueline> <50C8330D.8040305@xenomai.org> <325B0F26-79FE-4C8B-A41E-10ED40FC0B3B@mah.priv.at> <50C849BB.9090307@xenomai.org> <7A843E24-17B0-4F91-96DA-84CE8007AC5A@mah.priv.at> In-Reply-To: <7A843E24-17B0-4F91-96DA-84CE8007AC5A@mah.priv.at> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] RT GPIO with Raspberry Pi List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Haberler Cc: xenomai@xenomai.org On 12/12/2012 10:28 AM, Michael Haberler wrote: > > Am 12.12.2012 um 10:09 schrieb Gilles Chanteperdrix: > >> On 12/12/2012 09:30 AM, Michael Haberler wrote: >>>> >>>> ... >>> >>> just to make sure I understand your suggestion: >>> >>> in kernel mode you'd suggest to go through gpiolib and use >>> gpio_get_value/gpio_set_value if possible ? >>> >>> in user mode you can prepare things through sysfs but I dont see >>> an alternative to memory-mapped register manipulation in that >>> case if one wants to avoid system calls like >>> read/write/open/ioctl which likely will be a dog on top of >>> switching to secondary domain >> >> This happens if you put the kernel/user split in the wrong place. >> For instance, if your GPIOS are used to implement an I2C master, >> implementing the I2C master in user-space manipulating GPIOS in >> kernel-space is the wrong thing to do. What you should do is >> implement the I2C master in kernel-space, and use it either in >> other drivers, or in user-space. This way, you will get a write for >> a whole I2C transfer instead of a write for each GPIO change. The >> same goes for a PWM, SPI master, RS232 why not, etc... If your >> GPIOs are used to power on/power off some devices, then using them >> in primary mode is probably not relevant. > > in that particular application, the GPIO's are used, among others, > for generating stepper pulses, and the thread running this should be > as fast as possible; in the RTAI/parport version of that code that's > anywhere from 20-50uSec > > nothing else though except wiggling pins, in particular no > interrupt-driven input; so I dont see any extra functionality a > kernel driver could provide A kernel driver provides an interface which allows changing the driver implementation and the underlying hardware without changing either the kernel/user interface, or the application (I did not invent that, I read it for instance in the excellent "Linux device drivers" which I suggest you read or reread if you missed that point), in addition to allowing implementing for instance a reliable 50us pulse with a lower jitter. I will stop answering your posts at this point. -- Gilles.