Wednesday, June 19, 2013

Device driver diary : my notes

Virtual device are devices which does not have real hardware, these are used to provide certain functionality.
Character devices are used to provide interface to platform to access hardware through certain file operations.
Platform devices are used to put certain functionality inside the device, so that other devices(virtual or physical) can use its functionality.
How init function of each driver is getting called ?
Ans : When we compile the module code, it puts the function pointer of that module init in a file called init.txt. So at the running time, in main.c file a function
reads all of these function pointer and call those one by one.
- device_create() is used to create device, but we need to tell whether it is platform device or character device. Character device do that using cdev_add or cdev_init.
platform device use platform_device_register().
- Major and Minor combination is used identify the device driver by device file.so whenever we create the device as well as add the device to device hierarchy we use this number.
Character Device:
Refere this link : http://www.linuxforu.com/2011/02/linux-character-drivers/

No comments: