[uClinux-dev] coldfire pio driver

Ron Fial ron at fial.com
Wed Mar 5 17:46:16 EST 2003

If this is for an embedded project, and there is only one program that will be setting and clearing the PIO port bits, then you can just do a direct read and write to the port data direction registers and to the port I/O-pins register.    This should take under 1 hour to implement.   It is best to keep an RAM variable 'image' of the port pins, change that, and write it out.

If you have two or more programs that use the port, but each uses different pins, then a simple semaphore arangement could be used to prevent simultaneous read/writes by two programs at the same time.  This might take an afternoon depending on how you do the mutex stuff.  You would probably read/modify/write the pins to reduce the need for 'shared' variables between the programs.

If you need interrupt handlers for high-speed read/analyze/write of port pins, then you really need a kernel driver with a simple open, close, ioctl and init routine, along with the proper /dev/pio node with a major and minor device number.  Figure 1-2 days if you have experience writing kernel drivers (this is a very simple driver).  Figure 1-2 weeks if you have never written a kernel driver before and need to buy Rubini's book  ("Linux Device Drivers, 2nd edition".    I think I have found the chapters available to read on the web, tho.   It is an excellent book.  Look around in /Linux-x.x.x/drivers/char for good examples of character oriented (not block-oriented) drivers.

If you have a budget to spend, and need the driver quickly, I', sure someone on the list would be able to quote you a price to create such a driver for you -- maybe even for free just for the experience. 
   Good Luck,
   Ron Fial

  At 05:23 PM 3/5/2003 +0100, you wrote:
>Dear all,
>I am searching for a pio driver for coldfire MCF5249 (i.e for led and
>button control). Does  any char driver exist allready which I can use as
>a pio driver!
>uClinux-dev mailing list
>uClinux-dev at uclinux.org
>This message was resent by uclinux-dev at uclinux.org

More information about the uClinux-dev mailing list