Difference between revisions of "Linux drivers development"
From ArmadeusWiki
(→Adding your own drivers) |
(direct access to registers with Macro is deprecated) |
||
Line 37: | Line 37: | ||
== i.MX register access from driver == | == i.MX register access from driver == | ||
− | To access i.MX registers from your driver, please use the | + | To access i.MX registers from your driver, please use the ''readw/readl/writew/writel'' helper functions. |
− | + | Take a look at at ''arch/arm/mach-mx2/apf27.c'' or ''arch/arm/mach-imx/apf9328.c'' to have examples. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | / | + | |
− | + | ||
− | + | ||
==Debug== | ==Debug== |
Revision as of 17:48, 5 August 2009
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/
Adding your own drivers
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.
$ make linux26-menuconfig
Device Drivers ---> Armadeus specific drivers --->
Here is the way to add custom drivers:
- change current dir to your armadeus view
- in target/linux/modules/, add a directory for your driver (ex toto/)
- put reference to this directory in the target/linux/modules/Makefile and target/linux/modules/Kconfig files
- in toto/ put your driver source code and create 2 files, Kconfig and Makefile. (Use target/linux/modules/gpio/Makefile & Kconfig as examples.)
To compile all the custom modules, either launch:
$ make -C target/linux/modules/
or
$ make linux26
Only make linux26 will install the modules in the target rootfs image
i.MX register access from driver
To access i.MX registers from your driver, please use the readw/readl/writew/writel helper functions. Take a look at at arch/arm/mach-mx2/apf27.c or arch/arm/mach-imx/apf9328.c to have examples.
Debug
- Activate debug messages (from pr_debug() function) on console:
# echo 8 > /proc/sys/kernel/printk
Useful Links
- http://old.kernelnewbies.org/documents/kdoc/kernel-api/linuxkernelapi.html
- http://lwn.net/Articles/driver-porting/
Other languages: | |
---|---|
English • Français |