Difference between revisions of "Linux drivers development"
From ArmadeusWiki
m (→Driver compilation) |
(→Useful Links) |
||
Line 32: | Line 32: | ||
//enable the PWM | //enable the PWM | ||
PWMC |= PWMC_EN; | PWMC |= PWMC_EN; | ||
+ | |||
+ | ==Debug== | ||
+ | Activate debug messages (from pr_debug() function) on console: | ||
+ | # echo 8 > /proc/sys/kernel/printk | ||
== Useful Links == | == Useful Links == | ||
* http://old.kernelnewbies.org/documents/kdoc/kernel-api/linuxkernelapi.html | * http://old.kernelnewbies.org/documents/kdoc/kernel-api/linuxkernelapi.html | ||
* http://lwn.net/Articles/driver-porting/ | * http://lwn.net/Articles/driver-porting/ |
Revision as of 17:13, 24 March 2007
This page summarizes all you need to know before starting to develop Linux drivers for your Armadeus board
Contents
Recommended reading before starting
We advise you to read (not necessarly understand ;-) ):
- Linux Device Drivers (3rd edition) book: http://lwn.net/Kernel/LDD3/
Driver compilation
Our custom drivers build is integrated to the Linux build system (kbuild). You can select, in the linux "menuconfig"/"xconfig" tool, which Armadeus drivers you want to add on your target. (only gpio, ppdev & ps2keyboard are integrated yet).
Here is the way to add custom drivers:
- in armadeus/target/linux/modules/, add a directory for you driver (ex toto/)
- put reference to this directory in the armadeus/target/linux/modules/Makefile and armadeus/target/linux/modules/Kconfig files
- in toto/ put your driver source code and create 2 files, Kconfig and Makefile. (Use armadeus/target/linux/modules/gpio/Makefile & Kconfig as examples.)
To compile the modules, either launch:
- "make" in armadeus/target/linux/modules/ directory
or
- "make linux" in armadeus/
only "make linux" will install the modules in target rootfs image
i.MX register access from driver
To access i.MX registers from your driver, please use the macros defined in:
#include <arch/arm/imx-regs.h>
For example (access to PWM control register):
//enable the PWM PWMC |= PWMC_EN;
Debug
Activate debug messages (from pr_debug() function) on console:
# echo 8 > /proc/sys/kernel/printk