EmbLogic's Blog

Category Archives: Device Drivers

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

PARALLEL PORT INTERFACE

PARALLEL PORT A parallel port is a type of interface found on computers (personal and otherwise) for connecting peripherals. In computing, a parallel port is a parallel communication physical interface. It is also known as a printer port or Centronics … Continue reading

Posted in Parallel Port Driver | Leave a comment

Module code to show how to pass parameters to a module when using insmod using module_param() macro.

RCS file: header.h,v Working file: header.h head: 1.4 branch: locks: strict root: 1.4 access list: symbolic names: keyword substitution: kv total revisions: 4;    selected revisions: 4 description: Header file:<linux/init.h> is included to support module_init() and module_exit() macros. —————————- revision 1.4   … Continue reading

Posted in Character Driver, Device Drivers | Leave a comment

Charact. Device Driver- Synchronization Techniques

Completed Synchronizations Technique: 1. Semaphore 2. Mutex 3. RW_Semaphore 4. Completion 5. Spinlock

Posted in Character Driver | Tagged , | Leave a comment

DEVICE DRIVER

head    1.3; access; symbols; locks root:1.3; strict; comment @ * @; 1.3 date    2014.01.07.05.55.57;    author root;    state Exp; branches; next    1.2; 1.2 date    2014.01.07.04.44.27;    author root;    state Exp; branches; next    1.1; 1.1 date    2014.01.07.03.22.24;    author root;    state Exp; branches; next    … Continue reading

Posted in Character Driver | Tagged | Leave a comment

DEVICE DRIVER SCULLDEV ALLOCATION & DEALLOCATION

module initialization log_file head    1.2; access; symbols; locks root:1.2; strict; comment @ * @; 1.2 date    2014.01.07.04.44.27;    author root;    state Exp; branches; next    1.1; 1.1 date    2014.01.07.03.22.24;    author root;    state Exp; branches; next    ; desc @device driver registerd using alloc_chrdev_region … Continue reading

Posted in Character Driver | Tagged | Leave a comment

Character Device Driver 06/01/2014

log files head    1.1; access; symbols; locks; strict; comment    @ * @; 1.1 date    2014.01.06.10.23.58;    author root;    state Exp; branches; next    ; desc @Header file for init.c and exit .c —————————————————————————————————————————————————– head    1.1; access; symbols; locks; strict; comment    @ * … Continue reading

Posted in Character Driver, Device Drivers | Tagged | Leave a comment