Difference between revisions of "Linux drivers development"

From ArmadeusWiki
Jump to: navigation, search
m (Adding your own drivers)
m (i.MX register access from driver)
Line 26: Line 26:
  
 
To access i.MX registers from your driver, please use the macros defined in:
 
To access i.MX registers from your driver, please use the macros defined in:
#include <arch/arm/imx-regs.h>
+
<source lang="c">
 +
#include <mach/imx-regs.h>
 +
</source>
  
 
For example (access to PWM control register):
 
For example (access to PWM control register):
//enable the PWM
+
<source lang="c">
PWMC |= PWMC_EN;
+
/* enable the PWM */
 +
PWMC |= PWMC_EN;
 +
</source>
  
 
==Debug==
 
==Debug==

Revision as of 18:31, 16 December 2008

This page summarizes all you need to know before starting to develop Linux drivers for your Armadeus board

Recommended reading before starting

We advise you to read (not necessarly understand ;-) ):

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

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 all the custom modules, either launch:

$ make -C armadeus/target/linux/modules/

or

$ make linux26

only make linux26 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 <mach/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

Useful Links


FrenchFlag.png Cette page en Français