Talk:GPIO Driver

From ArmadeusWiki
Revision as of 14:58, 12 May 2009 by JulienB (Talk | contribs)

Jump to: navigation, search

Compilation

The first thing you have to do is to compile the driver. The only way to do that for the moment is to compile it as a module:

 [host]$ cd armadeus/
 [host]$ make linux26-menuconfig

Then go in menu:

Device Drivers  
    --> Armadeus specific drivers
        <M> Armadeus GPIO driver
        <M> Armadeus Parallel Port driver
Note Note: The parallel port driver will only work on APF9328 based systems !


Exit and save your kernel configuration, then compile it:

 [host]$ make linux26

When compiled, you will obtain 2 modules in armadeus/target/linux/modules/gpio/:

  • gpio.ko: this is the main driver. It should be loaded first and will allow you to easily control gpio pin from user space,
  • ppdev.ko: this is an extension driver to add PPDEV emulation to gpio.ko. This way you will be able to emulate a standard parallel port on one GPIO port (to connect a textual LCD, for example).

Installation

You have to:

  • reflash your rootfs or copy these modules on your target in /lib/modules/2.6.18.1/extra/gpio (don't forget modules.dep file),
  • copy loadgpio.sh script on your rootfs in /etc/

After that you can launch:

 # sh /etc/loadgpio.sh

or look inside this script if you want to manually enter the module parameters:

 # modprobe gpio portB_init=0,0,0x00FFFF00,0,0,0,0,0,0x0FF00000,0,0,0,0,0,0,0x0FF00000

gpio module parameters are values for PORTA, PORTB, PORTC, PORTD configuration registers in following order: DDIR, OCR1, OCR2, ICONFA1, ICONFA2, ICONFB1, ICONFB2, DR, GIUS, SSR, ICR1, ICR2, IMR, GPR, SWR, PUEN,
If you don't know what these registers means, load the module without parameters !!