EmbLogic's Blog

Category Archives: Character Driver

Module code to show how to perform read operation in multiple quantums.

RCS file: readf.c,v Working file: readf.c head: 1.14 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 14;    selected revisions: 14 description: chardev_read() function reside here which is responsible for performing the read operation. —————————- revision 1.14 … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code showing how to read data in a single quantum using copy_to_user() function.

RCS file: readf.c,v Working file: readf.c head: 1.11 branch: locks: strict root: 1.11 access list: symbolic names: keyword substitution: kv total revisions: 11;    selected revisions: 11 description: chardev_read() function is implemented here in this file. —————————- revision 1.11    locked by: … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code showing how to write data in multiple quantums from a user application.

RCS file: writef.c,v Working file: writef.c head: 1.19 branch: locks: strict root: 1.19 access list: symbolic names: keyword substitution: kv total revisions: 19;    selected revisions: 19 description: chardev_write() function reside here. —————————- revision 1.19    locked by: root; date: 2014/03/03 19:00:50;  … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code showing how to write data in multiple qset arrays from a user application.

RCS file: writef.c,v Working file: writef.c head: 1.37 branch: locks: strict root: 1.37 access list: symbolic names: keyword substitution: kv total revisions: 37;    selected revisions: 37 description: chardev_write() function reside here. —————————- revision 1.37    locked by: root; date: 2014/03/04 18:55:04;  … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code to show how to perform “trim” operation by calling chardev_trim() before the device is opened for writing.

RCS file: openf.c,v Working file: openf.c head: 1.14 branch: locks: strict root: 1.14 access list: symbolic names: keyword substitution: kv total revisions: 14;    selected revisions: 14 description: The functionality of chardev_open() is implemented here inside this file.Whenever the application calls … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code to show how to write data in a single quantum using copy_from_user() function.

RCS file: writef.c,v Working file: writef.c head: 1.15 branch: locks: strict root: 1.15 access list: symbolic names: keyword substitution: kv total revisions: 15;    selected revisions: 15 description: chardev_write() function reside here. —————————- revision 1.15    locked by: root; date: 2014/03/01 11:19:07;  … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code to show how to use container_of() macro inside driver’s open function and storing the return value of container_of() inside filep->private_data.

RCS file: openf.c,v Working file: openf.c head: 1.6 branch: locks: strict root: 1.6 access list: symbolic names: keyword substitution: kv total revisions: 6;    selected revisions: 6 description: The functionality of chardev_open() is implemented here inside this file.Whenever the application calls … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

module code to show how to perform an open and release operation, when an application issues open() and close() system call.

RCS file: header.h,v Working file: header.h head: 1.16 branch: locks: strict root: 1.16 access list: symbolic names: keyword substitution: kv total revisions: 16;    selected revisions: 16 description: Base header file that includes the definitions of all the macros,structures and contains … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

module code to show how an open operation is performed on the device file when an application calls ” open() function”.

RCS file: header.h,v Working file: header.h head: 1.16 branch: locks: strict root: 1.16 access list: symbolic names: keyword substitution: kv total revisions: 16;    selected revisions: 16 description: Base header file that includes the definitions of all the macros,structures and contains … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

module code to show how to initialize a cdev data structure with cdev_init() and tell the kernel about it with cdev_add().

RCS file: header.h,v Working file: header.h head: 1.16 branch: locks: strict root: 1.16 access list: symbolic names: keyword substitution: kv total revisions: 16;    selected revisions: 16 description: Base header file that includes the definitions of all the macros,structures and contains … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code to show how to allocate and deallocate memory using kmalloc() and kfree() functions for Sculldev (i.e the data structure used to hold device information)respectively.

RCS file: header.h,v Working file: header.h head: 1.14 branch: locks: strict root: 1.14 access list: symbolic names: keyword substitution: kv total revisions: 14;    selected revisions: 14 description: Base header file that includes the definitions of all the macros,structures and contains … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code to show how parameters can be passed to a module while loading it with the help of macro called module_param().

RCS file: header.h,v Working file: header.h head: 1.8 branch: locks: strict root: 1.8 access list: symbolic names: keyword substitution: kv total revisions: 8;    selected revisions: 8 description: Base header file that includes the definitions of all the macros,structures and contains … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Module code to show how device numbers are allocated and deallocated using alloc_chrdev_region() and unregister_chrdev_region().

RCS file: header.h,v Working file: header.h head: 1.7 branch: locks: strict root: 1.7 access list: symbolic names: keyword substitution: kv total revisions: 7;    selected revisions: 7 description: Base header file that includes the definitions of all the macros,structures and contains … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Simplest driver module code to understand the macros module_init() and module_exit().

RCS file: header.h,v Working file: header.h head: 1.5 branch: locks: strict root: 1.5 access list: symbolic names: keyword substitution: kv total revisions: 5;    selected revisions: 5 description: Base header file that includes the definitions of all the macros,structure definitions and … Continue reading

Posted in Character Driver | Leave a comment

character driver

Finally i completed the writing in multiple quantum. Description of my Character driver- step-1-> registered the driver by alloc_chrdev_region() and unregistered in exit function by unregister_chrdev_region(). After registering the driver you have major number that is given by by kernel. step-2->Now … Continue reading

Posted in Character Driver | Leave a comment