2

I am newbie for the uclinux device drivers please guide me how to do this..

suppose I have connected a switch to one of the cortex m3 controller pin and whenever the switched is press the LED connected to other pin of controller as to light.

how to write the driver and registering of driver and how can access the driver from the user space...??

Please explain me with a simple example.

artless noise
  • 21,212
  • 6
  • 68
  • 105
amar
  • 509
  • 3
  • 8
  • 17
  • Have you considered using a user mode program which does a blocking read on one of the GPIO interrupt device files? The read will succede when the interrupt condition is satisfied, and then it can access another GPIO device node to set the output. Since you mention switches, its likely your timing needs are not such that the task must be done in the kernel itself. – Chris Stratton May 07 '13 at 15:54
  • please can you provide me an example how can i link my kernel device driver to user space...??since i am new to device driver I am not getting how to add my driver at kernel space and to access it at user space applications. It will great helpful for me if you gave me simple gpio driver and and procedure for relevant changes need to made. – amar May 08 '13 at 03:58

1 Answers1

1

As I understand, you want a LED to light up once a button is pressed, this can be done completely as an interrupt handler in a kernel module, no need for a user-space application. Beginning kernel module programming is very exciting, and I suggest you take a look in the kernel module hello world example.

This will get you started to fill how kernel modules looks like, how they are compiled and loaded. further reading will be of course Linux device drivers 3rd edition, which is freely available here

Regarding user-space <--> driver communication, the kernel allows various types of device driver interfaces, such as regular char devices, sysfs, procfs, etc. You can read the appropriate chapters on Linux device drivers 3rd edition

stdcall
  • 27,613
  • 18
  • 81
  • 125