EmbLogic's Blog

Device driver till device open and close

RCS file: RCS/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:
This is main header file
All the required header file are include here
—————————-
revision 1.8    locked by: root;
date: 2014/12/01 14:29:46;  author: root;  state: Exp;  lines: +6 -1
include kernel.h
used ifndef macro
—————————-
revision 1.7
date: 2014/11/29 07:24:42;  author: root;  state: Exp;  lines: +10 -1
define QSET and QUANTAM macro
—————————-
revision 1.6
date: 2014/11/26 16:50:17;  author: root;  state: Exp;  lines: +1 -0
include slab.h
—————————-
revision 1.5
date: 2014/11/26 09:48:43;  author: root;  state: Exp;  lines: +1 -0
include moduleparam.h
—————————-
revision 1.4
date: 2014/11/26 06:18:39;  author: root;  state: Exp;  lines: +1 -0
included the linux/kdev_t to get the defination of MAJOR and MINOR macro
—————————-
revision 1.3
date: 2014/11/25 17:31:08;  author: root;  state: Exp;  lines: +7 -0
define MINOR_NO and NOD macro
—————————-
revision 1.2
date: 2014/11/24 09:56:10;  author: root;  state: Exp;  lines: +1 -0
include linux/fs.h
—————————-
revision 1.1
date: 2014/11/23 10:35:10;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: RCS/declaration.h,v
Working file: declaration.h
head: 1.18
branch:
locks: strict
root: 1.18
access list:
symbolic names:
keyword substitution: kv
total revisions: 18;    selected revisions: 18
description:
this is Declaration file where prototype of function will be given
—————————-
revision 1.18    locked by: root;
date: 2014/12/01 16:43:33;  author: root;  state: Exp;  lines: +1 -1
changed argumnets
—————————-
revision 1.17
date: 2014/12/01 16:05:01;  author: root;  state: Exp;  lines: +3 -2
added routine for trim
—————————-
revision 1.16
date: 2014/12/01 14:30:10;  author: root;  state: Exp;  lines: +0 -1
remove the redclaration of fops
declare open and release routines
—————————-
revision 1.15
date: 2014/12/01 13:15:50;  author: root;  state: Exp;  lines: +2 -0
added dev_open call
added dev_release call
—————————-
revision 1.14
date: 2014/11/29 10:42:51;  author: root;  state: Exp;  lines: +1 -1
declare new_dev of type dev_t
—————————-
revision 1.13
date: 2014/11/29 07:25:05;  author: root;  state: Exp;  lines: +6 -1
define quantam and qset of type extern int
—————————-
revision 1.12
date: 2014/11/27 06:33:16;  author: root;  state: Exp;  lines: +1 -1
change the name of dev_new to dev
—————————-
revision 1.11
date: 2014/11/26 16:51:29;  author: root;  state: Exp;  lines: +11 -0
declare structure name struct ScullDev and ScullQset
declare structure variable sculldev of type struct ScullDev
—————————-
revision 1.10
date: 2014/11/26 09:49:15;  author: root;  state: Exp;  lines: +2 -0
declara a int type variable to get the module parameter
—————————-
revision 1.9
date: 2014/11/26 06:19:50;  author: root;  state: Exp;  lines: +3 -3
chnage the name of dev_t type variable from device to dev_new
declare a variable type extern unsigned int to get the major_no from the macro
—————————-
revision 1.8
date: 2014/11/25 17:43:55;  author: root;  state: Exp;  lines: +2 -2
comment the declaration of initialization and cleanup function as no need to declare in this file
—————————-
revision 1.7
date: 2014/11/25 17:32:04;  author: root;  state: Exp;  lines: +4 -4
declare: dev_t device
unsigned int nod
remove the declaration of struct file_operation f_ops
—————————-
revision 1.6
date: 2014/11/25 05:10:49;  author: root;  state: Exp;  lines: +2 -2
omit extern word from the function declaration
—————————-
revision 1.5
date: 2014/11/24 10:20:47;  author: root;  state: Exp;  lines: +2 -2
declare the dev_name and f_ops as const as well
—————————-
revision 1.4
date: 2014/11/24 09:57:00;  author: root;  state: Exp;  lines: +6 -1
#define the MAJOR_NO 0
declare some extern variable like major_no,dev_name,fops
—————————-
revision 1.3
date: 2014/11/24 08:22:02;  author: root;  state: Exp;  lines: +2 -2
make the initialization_func extern
—————————-
revision 1.2
date: 2014/11/24 07:30:42;  author: root;  state: Exp;  lines: +2 -2
omit the word extern from the function declaration
—————————-
revision 1.1
date: 2014/11/23 10:35:57;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: RCS/init.c,v
Working file: init.c
head: 1.27
branch:
locks: strict
root: 1.27
access list:
symbolic names:
keyword substitution: kv
total revisions: 27;    selected revisions: 27
description:
this is intialiazation file
module_init is used here
—————————-
revision 1.27    locked by: root;
date: 2014/12/01 14:30:51;  author: root;  state: Exp;  lines: +1 -1
header include file_oper.h
removed fops
—————————-
revision 1.26
date: 2014/11/30 08:57:52;  author: root;  state: Exp;  lines: +3 -3
add ; after nod
—————————-
revision 1.25
date: 2014/11/30 06:47:32;  author: root;  state: Exp;  lines: +1 -1
testing
—————————-
revision 1.24
date: 2014/11/29 10:48:00;  author: root;  state: Exp;  lines: +3 -3
use loop variable to get all minor no
—————————-
revision 1.23
date: 2014/11/29 10:43:37;  author: root;  state: Exp;  lines: +20 -19
add all the devices by cdev_add func using a for loop
—————————-
revision 1.22
date: 2014/11/29 07:26:03;  author: root;  state: Exp;  lines: +18 -6
implement cdev_init,
cdev_add
to add our device discription into device entry table
—————————-
revision 1.21
date: 2014/11/27 06:33:46;  author: root;  state: Exp;  lines: +14 -29
make module parameter = to nod
—————————-
revision 1.20
date: 2014/11/27 06:09:53;  author: root;  state: Exp;  lines: +1 -1
testing
—————————-
revision 1.19
date: 2014/11/26 16:53:18;  author: root;  state: Exp;  lines: +11 -4
implement function kmalloc to provide memory to sculldev
memset the sculldev with one’s
—————————-
revision 1.18
date: 2014/11/26 09:49:57;  author: root;  state: Exp;  lines: +5 -4
define mparam and print it to verify
—————————-
revision 1.17
date: 2014/11/26 08:42:18;  author: root;  state: Exp;  lines: +2 -2
make minor_no=minor_no+1
after the initial device register
—————————-
revision 1.16
date: 2014/11/26 07:35:18;  author: root;  state: Exp;  lines: +5 -0
testing on re-registration of device
—————————-
revision 1.15
date: 2014/11/26 07:20:53;  author: root;  state: Exp;  lines: +1 -0
make nod=nod+1 when re-registration will take place
—————————-
revision 1.14
date: 2014/11/26 07:15:22;  author: root;  state: Exp;  lines: +4 -7
checking for reregistration attemp of driver
implement register_chrdev_region function
In previous version this function was commented
—————————-
revision 1.13
date: 2014/11/26 07:06:18;  author: root;  state: Exp;  lines: +3 -3
testing
—————————-
revision 1.12
date: 2014/11/26 07:02:51;  author: root;  state: Exp;  lines: +3 -3
assigned the value to nod from the NOD macro
—————————-
revision 1.11
date: 2014/11/26 06:44:19;  author: root;  state: Exp;  lines: +22 -10
implement the register_chrdev_region function to register the more no of device on the same major no
—————————-
revision 1.10
date: 2014/11/26 06:22:29;  author: root;  state: Exp;  lines: +17 -7
get the major and minor no by using MAJOR(dev_new) and MINOR(dev_new) macro
print the value of major and minor no
—————————-
revision 1.9
date: 2014/11/25 17:45:02;  author: root;  state: Exp;  lines: +10 -2
check the return value of alloc_chrdev_region function and print message on failure
—————————-
revision 1.8
date: 2014/11/25 17:34:44;  author: root;  state: Exp;  lines: +8 -5
define register_chrdev_region function
sorry,, define alloc_chrdev_region function to register the device
—————————-
revision 1.7
date: 2014/11/24 10:22:01;  author: root;  state: Exp;  lines: +2 -2
add the const keyword with dev_name and struct file_operations f_ops
—————————-
revision 1.6
date: 2014/11/24 09:58:45;  author: root;  state: Exp;  lines: +8 -1
define major_no,dev_name,fops
implement the register_chrdev function to register the device
—————————-
revision 1.5
date: 2014/11/24 08:22:47;  author: root;  state: Exp;  lines: +8 -14
omit exit part
now it contain only initialization_func
—————————-
revision 1.4
date: 2014/11/24 07:48:21;  author: root;  state: Exp;  lines: +8 -3
direct include header.h
not include declaration.h
declare function
problem : the message inside the initialization_func is printed at when rmmod is calling or we can say when cleanup function is calling
—————————-
revision 1.3
date: 2014/11/24 07:31:24;  author: root;  state: Exp;  lines: +2 -2
make initialization and cleanup function static
—————————-
revision 1.2
date: 2014/11/24 07:16:36;  author: root;  state: Exp;  lines: +5 -0
define the exit function in the init file as not getting the desire output
—————————-
revision 1.1
date: 2014/11/23 10:36:49;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: RCS/application.c,v
Working file: application.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
created file_ops
—————————-
revision 1.2    locked by: root;
date: 2014/12/01 12:07:07;  author: root;  state: Exp;  lines: +1 -1
print the fd
—————————-
revision 1.1
date: 2014/12/01 11:48:15;  author: root;  state: Exp;
Initial revision
=============================================================================
rlog: RCS/file_oper.h,v: No such file or directory

RCS file: RCS/dev_open.c,v
Working file: dev_open.c
head: 1.3
branch:
locks: strict
root: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;    selected revisions: 3
description:
routines for device open call
—————————-
revision 1.3    locked by: root;
date: 2014/12/01 16:43:50;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.2
date: 2014/12/01 16:06:00;  author: root;  state: Exp;  lines: +5 -1
*** empty log message ***
—————————-
revision 1.1
date: 2014/12/01 14:31:16;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: RCS/dev_release.c,v
Working file: dev_release.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
routines for relase a device
—————————-
revision 1.1    locked by: root;
date: 2014/12/01 14:31:33;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: RCS/dev_trim.c,v
Working file: dev_trim.c
head: 1.4
branch:
locks: strict
root: 1.4
access list:
symbolic names:
keyword substitution: kv
total revisions: 4;    selected revisions: 4
description:
called dev_trim routines
—————————-
revision 1.4    locked by: root;
date: 2014/12/01 16:44:49;  author: root;  state: Exp;  lines: +0 -3
*** empty log message ***
—————————-
revision 1.3
date: 2014/12/01 16:43:49;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
—————————-
revision 1.2
date: 2014/12/01 16:08:08;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2014/12/01 16:05:24;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: RCS/exit.c,v
Working file: exit.c
head: 1.10
branch:
locks: strict
root: 1.10
access list:
symbolic names:
keyword substitution: kv
total revisions: 10;    selected revisions: 10
description:
this is cleanup file
—————————-
revision 1.10    locked by: root;
date: 2014/11/29 10:45:27;  author: root;  state: Exp;  lines: +3 -1
delete all the device using cdev_del
—————————-
revision 1.9
date: 2014/11/29 07:27:39;  author: root;  state: Exp;  lines: +1 -0
implement cdev_del to delete the entry before unregistering
—————————-
revision 1.8
date: 2014/11/27 06:34:15;  author: root;  state: Exp;  lines: +1 -1
change the name of dev_new to dev
—————————-
revision 1.7
date: 2014/11/26 16:55:24;  author: root;  state: Exp;  lines: +1 -0
free the allocated memory to sculldev with kfree function
—————————-
revision 1.6
date: 2014/11/26 06:24:04;  author: root;  state: Exp;  lines: +1 -1
change the name of dev_t type variable from device to dev_new
—————————-
revision 1.5
date: 2014/11/25 17:36:42;  author: root;  state: Exp;  lines: +1 -1
define the unregister_chrdev_region function to unregister the device
—————————-
revision 1.4
date: 2014/11/24 10:22:59;  author: root;  state: Exp;  lines: +1 -0
*** empty log message ***
—————————-
revision 1.3
date: 2014/11/24 09:59:48;  author: root;  state: Exp;  lines: +1 -0
implement the unregister_chrdev function to unregister the device
—————————-
revision 1.2
date: 2014/11/24 08:24:38;  author: root;  state: Exp;  lines: +1 -1
put \n at the end of printk statement
—————————-
revision 1.1
date: 2014/11/23 10:37:26;  author: root;  state: Exp;
Initial revision
=============================================================================

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>