<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EmbLogic &#187; Mr.Pravjot Singh</title>
	<atom:link href="https://www.emblogic.com/blog/tag/mr-pravjot-singh/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.emblogic.com/blog</link>
	<description>Embedded System and ARM Training</description>
	<lastBuildDate>Tue, 03 Mar 2020 13:00:06 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>Toolchain</title>
		<link>https://www.emblogic.com/blog/10/toolchain-3/</link>
		<comments>https://www.emblogic.com/blog/10/toolchain-3/#comments</comments>
		<pubDate>Fri, 16 Oct 2015 10:48:24 +0000</pubDate>
		<dc:creator><![CDATA[Sachin Jangid]]></dc:creator>
				<category><![CDATA[ARM Embedded Processors]]></category>
		<category><![CDATA[Project 9: Embedded Linux on ARM]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=12973</guid>
		<description><![CDATA[i m doing toolchain. There is an error in glibc. When im doing make check, then following errors occures. ============== ************* ================ libgcc_s.so.1 must be installed for pthread_cancel to work Didn&#8217;t expect signal from child: got `Aborted&#8217; make[2]: *** [/home/emblogic/sachin_jangid/abhishek_toolchain/build_tools/build_glibc/nptl/tst-mutexpi8.out] &#8230; <a href="https://www.emblogic.com/blog/10/toolchain-3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>i m doing toolchain. There is an error in glibc. When im doing make check, then following errors occures.<br />
============== ************* ================<br />
libgcc_s.so.1 must be installed for pthread_cancel to work<br />
Didn&#8217;t expect signal from child: got `Aborted&#8217;<br />
make[2]: *** [/home/emblogic/sachin_jangid/abhishek_toolchain/build_tools/build_glibc/nptl/tst-mutexpi8.out] Error 1<br />
make[2]: Leaving directory `/home/emblogic/sachin_jangid/abhishek_toolchain/build_tools/glibc-2.13/nptl&#8217;<br />
make[1]: *** [nptl/tests] Error 2<br />
make[1]: Leaving directory `/home/emblogic/sachin_jangid/abhishek_toolchain/build_tools/glibc-2.13&#8242;<br />
make: *** [check] Error 2<br />
============== ************* ================</p>
<p>plz help me to over come this. </p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/10/toolchain-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>relatin b/w fork() &amp;n execl..</title>
		<link>https://www.emblogic.com/blog/06/relatin-bw-fork-execl/</link>
		<comments>https://www.emblogic.com/blog/06/relatin-bw-fork-execl/#comments</comments>
		<pubDate>Fri, 13 Jun 2014 15:26:53 +0000</pubDate>
		<dc:creator><![CDATA[kashishgarg1992]]></dc:creator>
				<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>
		<category><![CDATA[Project 04: FTP based Client Server using Threads and Sockets]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10471</guid>
		<description><![CDATA[Trying to use execl b/w server and processing clients without fork(); O/P&#8211;&#62;block on read or write will definitely occur on server-pro_client side&#8230;&#8230;. When we use fork( ) to create a child process the child process does not contain the entire &#8230; <a href="https://www.emblogic.com/blog/06/relatin-bw-fork-execl/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Trying to use execl b/w server and processing clients without fork();</p>
<p>O/P&#8211;&gt;block on read or write will definitely occur on server-pro_client side&#8230;&#8230;.</p>
<p>When we use fork( ) to create a child process the child process<br />
does not contain the entire data and code of the parent process.<br />
Then</p>
<p><strong> Does it mean that the child process contains the data and code below the fork( ) call???????</strong></p>
<p>Even this is not so. In actuality the code<br />
never gets duplicated. Linux internally manages to intelligently<br />
share it. As against this, some data is shared, some is not. Till the<br />
time both the processes do not change the value of the variables<br />
they keep getting shared. However, if any of the processes (either<br />
child or parent) attempt to change the value of a variable it is no<br />
longer shared. Instead a new copy of the variable is made for the<br />
process that is attempting to change it. This not only ensures data<br />
integrity but also saves precious memory.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/06/relatin-bw-fork-execl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>https://www.emblogic.com/blog/10/7400/</link>
		<comments>https://www.emblogic.com/blog/10/7400/#comments</comments>
		<pubDate>Sat, 26 Oct 2013 07:39:38 +0000</pubDate>
		<dc:creator><![CDATA[u.sravan]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Dheeraj sir]]></category>
		<category><![CDATA[Harpreet sir]]></category>
		<category><![CDATA[Jasmeen ma'am]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7400</guid>
		<description><![CDATA[what is UNIX? difference between linux and UNIX? kindly explain from scratch]]></description>
				<content:encoded><![CDATA[<p>what is UNIX?</p>
<p>difference between linux and UNIX?</p>
<p>kindly explain from scratch</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/10/7400/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E30.01.30 (Character Driver)</title>
		<link>https://www.emblogic.com/blog/08/e30-01-30-character-driver/</link>
		<comments>https://www.emblogic.com/blog/08/e30-01-30-character-driver/#comments</comments>
		<pubDate>Wed, 07 Aug 2013 13:19:20 +0000</pubDate>
		<dc:creator><![CDATA[Om Parkash]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7042</guid>
		<description><![CDATA[implemented busywait delay and processor yielding delay&#8230; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.17 locked by: emblogic; date: 2013/08/07 13:00:03; author: emblogic; state: Exp; lines: +161 -17 implemented delay using busywait method (using cpu_relax). implemented a delay using processor yielding method(using schedule()). working on &#8230; <a href="https://www.emblogic.com/blog/08/e30-01-30-character-driver/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>implemented busywait delay and processor yielding delay&#8230;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.17   locked by: emblogic;<br />
date: 2013/08/07 13:00:03;  author: emblogic;  state: Exp;  lines: +161 -17<br />
implemented delay using busywait method (using cpu_relax).<br />
implemented a delay using processor yielding method(using schedule()).<br />
working on wait_event&#8217;s.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/e30-01-30-character-driver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E 30.01.30 : Kushal Chugh</title>
		<link>https://www.emblogic.com/blog/07/e-30-01-30-kushal-chugh/</link>
		<comments>https://www.emblogic.com/blog/07/e-30-01-30-kushal-chugh/#comments</comments>
		<pubDate>Mon, 22 Jul 2013 04:01:28 +0000</pubDate>
		<dc:creator><![CDATA[kushal.chugh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6926</guid>
		<description><![CDATA[? ARTICLE: CHARACTER DRIVER. Heard so much about Character Driver when i came to Emblogic and now I am working on Character Driver on Linux from last couple of weeks. Driver &#8211; As per my knowledge a Driver is basically &#8230; <a href="https://www.emblogic.com/blog/07/e-30-01-30-kushal-chugh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>?<br />
ARTICLE:</p>
<p>CHARACTER DRIVER.</p>
<p>Heard so much about Character  Driver when i came to Emblogic and now I am working on Character Driver on Linux from last couple of weeks.</p>
<p>Driver &#8211;  As per my knowledge a Driver is basically a communication medium b/w the application layer and the hardware.<br />
Device Drivers is classified into three basic types: (i) Character driver, (ii) Block driver and  (iii)Network driver.</p>
<p>A Character device is one that can be accessed as a stream of bytes i.e. character by character and it sends the data byte by byte to the kernel buffer and user buffer when application give call of write and read respectively.</p>
<p>We use the driver as LKM(Loadable Kernel Module) as it is not essential to keep driver present in the kernel until system is power on. Each module is made up of object code that can be dynamically linked to the running kernel by the insmod program and can be unlinked by the rmmod program. Whenever we do insmod, the macro &#8216;module_init&#8217; invokes our initialization routine and module is inserted to the kernel if it is valid. And when we do the  rmmod, our module gets removed from the kernel through the macro &#8216;module_exit&#8217;. Our initialization routine registers the driver for the devices and obtains major no. from the registration call int register_chrdev_region(); or int alloc_chrdev_region()); which is defined in the library fs.h . After registering our device,  we have to initialize all the resources that are going to be used in our device program. In module_exit, the exact opposite of initialization procedure is performed but in the reverse order. All the resources allocated to the driver will have to be freed . After our module gets inserted successfully onto the kernel,it can be seen in /proc/modules file.</p>
<p>We develop Charater Driver because it is most suitable for simple Hardware devices.<br />
For implementing my character driver, we have used SCULL (Simple Character Utility for Loading Localities) because of its advantage that it does not depend upon hardwre. Scull is just some memory which is  allocated from the kernel.  We have defined the behaviour of the system calls for  the device. We have used cdev_init and cdev_add functions to initialize the struct cdev. Struct cdev is the actual representation of the device.<br />
 Next step is  to map the system calls with the routines written in my  character driver.  In our open routine,we are checking the mode and depending on that mode,  we are performing some specific tasks . In the open routine we mappthe scull to the device by using the macro &#8216;container_of&#8217;. The return value of container_of will be starting address of mapped memory that we will use to read and write on device and we store this address in the private_data of the struct file structure defined in fs.h library. The difference between the kmalloc and container_of macro is that using kmalloc, the memory is allocated in the RAM but container_of  macro maps the maps the scull into the device. </p>
<p>Write Data &amp; Read Data.<br />
In our write routine we write the data from application to the device via scull quantum by using  copy_from_user() function. Write routine also checks for the offset value (file position) where the application wants to write.<br />
In read routine we read the data from the device via scull quantum by using  copy_to_user() function. Read routine also checks for the offset value from where application wants to read.<br />
We have also implemented lseek routine that sets the offset value as provided by the application in lseek system call.</p>
<p>Now the time has come to test the driver.<br />
(i) Compile and insert our module in running kernel dynamically. This is done byinsmod  on shell here lkm is my name of c file of driver.Compilation of the file should be by Makefile. 		</p>
<p>(ii)To make communication possible between application application and device driver,we require node in (VFS).<br />
Node is created by the command “mknod node_name c major no. minor no.”, where c specifies that it is for character driver.</p>
<p>(iii)After testing we should have to remove the module from kernel with command &#8220;rmmod&#8221; like rmmod lkm to free the allocated major number.</p>
<p>Character driver though while working was not an easy task to accomplish but with guidance of Sir and fellow friends it was a great experience.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/e-30-01-30-kushal-chugh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RANA BRIJENDRA  SINGH</title>
		<link>https://www.emblogic.com/blog/07/rana-brijendra-singh/</link>
		<comments>https://www.emblogic.com/blog/07/rana-brijendra-singh/#comments</comments>
		<pubDate>Mon, 22 Jul 2013 03:52:36 +0000</pubDate>
		<dc:creator><![CDATA[ranabrijendra12]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6923</guid>
		<description><![CDATA[                                                                           SUBMITTED TO:  Mr. &#8230; <a href="https://www.emblogic.com/blog/07/rana-brijendra-singh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div>
<p>                                                                           SUBMITTED TO:  Mr. PRAVJOT SINGH                                  <span style="text-decoration: underline">LINUX DEVICE DRIVERS  </span></p>
</div>
<p>v  <strong>ARTICLE ON CHARACTER DRIVER:</strong></p>
<p>THIS  ARTICLE   IS ALL ABOUT  TO  THE CONCEPTS  THAT  I HAVE  LEARNED  AND  MAINLY  CONCERNED TO THE WORK  WHATEVER  I HAVE PERFORMED  IN THE PROJECT  REGARDING ASSIGNMENT IN ORDER  TO  SUCCESSFUL  COMPLETION OF TRAINING.</p>
<p>v  <strong>INTRODUCTION OF CHARACTER DRIVER:</strong></p>
<p>AS THE  NAME  SUGGESTS  ,THE DEVICE -DRIVER  PROVIDES THE MECHANISM  TO  DRIVE THE  HARDWARE(DEVICE)  ACCORDING  TO  THE  APPLICTION.THE TYPE &amp; CATEGORY   OF THE DRIVER  IS DEPENDENT  ON  THE  TYPE &amp;  REQUIREMENT OF APPLICATION  WHICH  WEAREUSING. WHICH MEANS TOSAYTHAT  TO ACCESS  THE  PENDRIVE WE NEED USB  DRIVER  ,FOR BTLUETOOTH WE WE NEED BT DRIVER &amp; FOR  MEDIA  PLAYER  WE  NEED  A  SEPRATE ONE.  DIFFERENT TYPES OF APPLICATION  REQUIRES   DIFFERENT  TYPE  OF  DRIVERS.</p>
<p>CHARACTER DRIVER WORKS FOR CHARACTER DEVICES   WHICH  CAN BE ACCESSED AS STREAM OF BYTES. SUCH DRIVER USUALLY IMPLEMENTS OPEN, WRITE,  READ  &amp;  CLOSE  SYSTEM  CALLS.</p>
<p>I think One of the good features of Linux is the ability to extend at runtime the set of features offered by the kernel. This means that you can add modules to the kernel (and remove modules as well) while the system is up and running. The need of using device drivers is to increase the functionality of kernel . Each piece of code that can be added to the kernel at runtime is called a module. Each module is made up of piece of codes that can be dynamically linked to the running kernel by the insmod program and can be unlinked by the rmmod program.</p>
<p>Currently I am working on character driver &amp; its practical implementation. In this article I am going to discuss what i know about character driver briefly.</p>
<p>Now as I have to make my driver capable of directly handshake-able with the kernel so it was essential to work in kernel space instead of user space ,so i have to use the kernel libraries(like kernel.h, init.h ,fs.h etc..) instead of glibc libraries(like stdio.h,stdlib.h,fcntl.h etc&#8230;).</p>
<p>v  HOW   TO   IMPLEMENT?</p>
<ul>
<li>I AM GOING TO DESCRIBE THE BASIC  STEPS WHICH  I  HAVE  FOLLOWED WHILE  IMPLEMENTING CHARACTER DRIVER:</li>
</ul>
<p>–     I started to write the program  using two predefined macros named as module_init (entry_function) and module_exit(exit_function) as entrance point as main() in user space and exit point respectively.In which I have written my own start &amp;  end function. So after executing module_init execution will start from my function where I have to specify the major number and name of our driver, capacity to handle maximum number of device at a time and maximum memory of the driver. The major number identifies the driver associated with the device. I am firstly allocating major number to my driver which is basically a highest possible integer value between 0 to 255 by which our driver will be known in the kernel like other device drivers as stored in /proc/devices file .We can select major number for our driver from previously mentioned path but generally we privilege kernel to select major number because kernel will allocate it dynamically .This can be done with the register_chrdev_region() function call defined in fs.h  which is in kernel library .In current scenario register_allok_chardev_region is in trend to do the errlier mentioned task .This will give the result of 32 bit(12 + 20 bit) at the address as give in first argument of call. After that I have used the first 12 bit i.e major number but i specify my own minor number generally 0 to upward in MKDEV() macro defined in kdev_t.h. After that I have allocated memory to sculldev structure(user defined structure that contain all information of the driver)) &amp; separately initialized all its members as sculldev initialization function .Now used the cdev_init() and cdev_add() to initialize and add the cdev structure for our device which will contains the device specifications. Now I have written separate functions for each ( to create scullQsets structures, create q-sets structures, create quantums)&amp; called these functions from write &amp; read functions of driver modules to perform the desired operations in device.</p>
<p>In order to perform various operations like open, write, read, lseek and close file I have written an application in  user space &amp; mapped it similar kind if file operations (open, write read, llseek, release)that is in my driver program .So i have mapped these system calls in struct file_operations structure with my respective open,write,read,lseek and close functions according to prototype defined in &lt;fs.h&gt; kernel header file that will now handles the application calls instead of drivers of the OS.</p>
<p>But Before doing anything we have to map our allocated memory with the device memory this is done in the open function of driver with</p>
<p>container_of(ptr, type, member) in which first argument is pointer to i_cdev member of struct inode,2nd argument is user defined structure which contains pointer to struct cdev and third argument is pointer to struct cdev.Actually struct cdev is actual representation of the device. Now return of container_of will be starting address of mapped memory that we will use to read and write on device and i store this address in the private_data of the struct file structure defined in fs.h library.</p>
<p>After doing this now i have made my read, write and lseek function compatible with the almost all type of requests from application.In this write function will store the written data in own quantums when write request comes and give back that data according to the read request of application.I have also handled the single multithreaded application.</p>
<p>Now to test this driver we have to compile and insert our module in running kernel dynamically. This is done with command insmod ./modules/program name(without .c).ko  &amp; Compilation of the file should be by Makefile. After completion of work (successful insertion &amp; execution of task) we have to remove our module this is done by command rmmod  program name(without .c).</p>
<p>If every step is correct &amp; written in proper manner then  program will run &amp; it will give desired result otherwise kernel will be crashed.</p>
<p>REMARKS: THERE MAY BE  POSSIBILITY OF ERROR IN SYNTEX, SENTENCES,ARGUMENTS (&amp; SOME-WHAT IN CONCEPTS ALSO ). SO ANY COMMENT, CORRECTION, SUGGESTION  IS CORDIONLY INVITED.</p>
<p>REGARD’S</p>
<p><em>RANA BRIJENDRA SINGH</em></p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/rana-brijendra-singh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>prince singla E -30.01.30</title>
		<link>https://www.emblogic.com/blog/07/prince-singla-e-30-01-30-3/</link>
		<comments>https://www.emblogic.com/blog/07/prince-singla-e-30-01-30-3/#comments</comments>
		<pubDate>Sun, 21 Jul 2013 11:13:24 +0000</pubDate>
		<dc:creator><![CDATA[prince.singla]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6914</guid>
		<description><![CDATA[Device Drivers can be classified into three basic types: 1.Character driver 2.Block driver 3.Network driver. A character device is one that can be accessed as a stream of bytes i.e. character by character. And code needed make communication possible b/w &#8230; <a href="https://www.emblogic.com/blog/07/prince-singla-e-30-01-30-3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Device Drivers can be classified into three basic types:<br />
1.Character driver<br />
2.Block driver<br />
3.Network driver.<br />
A character device is one that can be accessed as a stream of bytes i.e. character by character. And code needed make communication possible b/w a character device and application is character driver.<br />
Now lets explain the basic arch :-<br />
memory are divided into two parts kernel space and user space .all the application in user space and all device driver in kernel space .the only way to interface between user space and kernel space through node.node will create by mknod. module_init and module_exit(MACRO)use to add and remove driver.module_init insert driver to memory(RAM) using lsmod.<br />
module_init remove driver to memory using (rmmod) .if our driver is insert than we register driver using alloc_chardev_region().alloc_chrdev_region register driver ,creat the major(type dev_t) and they also register the driver for n number of devices.they will give address 32bits firts 12 bits are major number and left 20 bits are minor number.if we insert driver than they give highest avalible major number .the range of major number is (0 to 255). &amp; give lowest avalible major no (range 0 to 255).one advantage of alloc_chrdev_region that register the driver n number of device .after register driver than kmalloc to sculldev.kmalloc give physical space(address) on memory(ram).<br />
scull:-<br />
scull is basically a linklist,every struct we can say node and they are connected to each other thats way we can say linklist ,the first node name as sculldev,struct sculldev first member struct scullqset and many more like private data,wcount,quantum_size,qset_size,device_size,c_dev,scull second node that is scullqset (member of sculldev).in scullqset first member is struct scullQset *next and second member is void **data,double pointer data is basically<br />
pointout memory(that store information(double pointer data that is first pointout qset and that qset pointout quantum<br />
that quantum store information(the size of quantum is 8 bits)).<br />
In application we perform some task like open,write,read,close.in application firstly we want to open a node.than we using open system call(sys/open).in open system call we define two arr(string(file name),mode(permission)),that system call are define in glibe ,they open the node and return highest avalible fd.<br />
container_of:-<br />
In container_of(ptr,type,member) in which first argument is pointer to i_cdev member of struct inode,2nd argument is user defined structure which contains pointer to struct cdev and third argument is pointer to struct cdev.Actually struct cdev is actual representation of the device.Now return of container_of will be starting address of mapped memory(sculldev).<br />
now node open application full access on node ,application any opertion perform like read ,write,close .but in my application first i write than lseek than again write after write read data.application write  data driver will start  write on memory(with the help of copy_from_user).first they check the size of data.than they check how many scullqset,qset and quantum needed and they create that.after this they perform read task,that is very similiar write opertion(read opertion using with the help of copy_to_user).after read opertion done call scull_trim().that are free the memory.to free the memory using kfree.<br />
application:<br />
now write the multithread one application.in application perform some task open,read,write,close on different thread.now to test this firstly compile char driver .after this module_init insert using lsmod.than execute application.working fine.after finished application than remove driver to use rmmod.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/prince-singla-e-30-01-30-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E 30:01:30 Vikram Sharma</title>
		<link>https://www.emblogic.com/blog/07/e-300130-vikram-sharma-2/</link>
		<comments>https://www.emblogic.com/blog/07/e-300130-vikram-sharma-2/#comments</comments>
		<pubDate>Sat, 20 Jul 2013 12:23:37 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6876</guid>
		<description><![CDATA[Article on Character Driver: I have been working upon Device Driver (Character Driver, to be specific) since last 20 days.Before start working, First of all I needed to know what really a device driver is? As we all know it &#8230; <a href="https://www.emblogic.com/blog/07/e-300130-vikram-sharma-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Article on Character Driver:</p>
<p>I have been working upon Device Driver (Character Driver, to be specific) since last 20 days.Before start working, First of all I needed to know what really a device driver is? As we all know it is the kernel what is directly going to interact with the Hardware and if our application need to access the hardware we need a driver(Specific one for a class of devices)for that in kernel space. As the name suggest a Device Driver is a LKM(Loadable Kernel Module) which drives(runs) our device.Drivers are of two types, Static and Dynamic. One i am going to develop will be dynamic i.e it will be removed from kernel when not needed any more. The good thing about a Moduler kernel is a Module can be inserted and removed from the running kernel(using kernel utilities insmod and rmmod respectively). There are three types of devices i.e Character devices like printers, Block devices like Mass storage devices and Network devices like USB modem etc. Now a Character driver is a driver developed to handle character devices.<br />
Now lets explain the basic arch. of a character driver. Memory of our system is divided in to two parts User space and kernel space. Our applications runs in the user space and our driver runs in kernel space. An application cant see anything in kernel space.Driver is just like a black box for the application developer. So if the application need to access the kernel space, it need a fifo in the VFS(Virtual File System) layer. We create this for the specific device using mknod. In kernel space a driver is identified by its unique 12bit major number and a device is identified by its unique 20bit minor number. This 32bit unique number is called dev id(device id). This 32bit no is obtained for a device using a kernel MACRO i.e alloc_chrdev_region(). This registration is to be done right after inserting our module in to the kernel and it should also be unregistered before removing the module.<br />
There are four most important structures, knowing about those was very much needed. First one is struct cdev. This structure is the representation of a character device in the kernel. This one have a lot of hardware specific information of the device. its most important members are dev(for dev id),owner(owner of the device, the module itself) and *fops (pointer to the struct file_operations). Second one in struct file_operations which is a collection of function pointers, each of the function is routine for performing a specific operation over the device like read, write ,open, close etc. Another one is struct inode(for the device file). We all know everything in linux is treated as a file, some are regular files and some are special files. A character device is treated as a special file in our system. Attributes of a file are stored in the structure struct inode and struct inode i am talking about have attributes of that special character device file. Fourth one is struct file. struct file is a structure which contains the attributes of a stream. This stream is a stream created between our app and node in vfs, when we give an open call from app.<br />
I have allocated some memory in the kernel space of my RAM in form of SCULL(Simple Character Utility for Loading Localities), which i am treating as a device. This memory is variable as i will be performing write and read, it will be allocated and deallocated accordingly. Starting node of this memory is ScullDev which will be loaded with the lot of info about the device like device_size, data_size, quantum_size, qset_size, write_count and the most important an object of struct cdev. We need to initialize and add this cdev object as our device in the kernel using two MACROS cdev_init() and cdev_add(). cdev_init will initialize our object for the set of operations and cdev_add will add this device in to the device table.<br />
After all this, my device is ready to be worked upon i.e open,write,read,close. For this it was required to map my driver routines to the routines called by system as when a call is given from app my routines should run in the driver. This mapping is to be done in struct file_operations by giving the addresses of my_routines to corresponding function pointers in fops. In open i fetched the address of my ScullDev for the perticular cdev and stored it in private_data field of a system generated structure struct file pointed by *filep in open for the future use of this address in write and read.<br />
Now i am able to write data to the multiple quantums, multiple scullqset in trunc as well as append mode. I am able to read from the same as well. lseek is also done, and i am testing my driver for multithreaded apps.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/e-300130-vikram-sharma-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E 30.01.30 &#8211; Om Parkash</title>
		<link>https://www.emblogic.com/blog/07/e-30-01-30-om-parkash/</link>
		<comments>https://www.emblogic.com/blog/07/e-30-01-30-om-parkash/#comments</comments>
		<pubDate>Sat, 20 Jul 2013 06:36:51 +0000</pubDate>
		<dc:creator><![CDATA[Om Parkash]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6871</guid>
		<description><![CDATA[ARTICLE: I am working on Character Driver on Linux from last few days.Device Driver is simply a piece of code as a part of kernel,dynamic (temporary) or static (permanent) required to make the hardware accessible to the application. Device Drivers &#8230; <a href="https://www.emblogic.com/blog/07/e-30-01-30-om-parkash/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>ARTICLE:</p>
<p>	I am working on Character Driver on Linux from last few days.Device Driver is simply a piece of code as a part of kernel,dynamic (temporary) or static (permanent) required to make the hardware accessible to the application. Device Drivers can be classified into three basic types: Character driver, Block driver and Network driver. A character device is one that can be accessed as a stream of bytes i.e. character by character. And code needed make communication possible b/w a character device and application is character driver.<br />
	As there is a very good feature of Linux i.e. the ability to extend the set of features offered by the kernel at runtime. This means that we can add functionality to the kernel (and remove functionality as well) while the system is up and running. Each piece of code that can be added to the kernel at runtime is called a module. Different types (or classes) of modules,that can be inserted to the Linux kernel includes device drivers but not limited to this. Each module is made up of object code that can be dynamically linked to the running kernel by the insmod program and can be unlinked by the rmmod program. Whenever we do insmod, the macro &#8216;module_init&#8217; invokes our initialization routine and module is inserted to the kernel if it is valid. And when rmmod is done our module gets removed from the kernel through the macro &#8216;module_exit&#8217;. Our initialization routine registers the driver for the devices and obtains major no. from the registration call( int register_chrdev_region(dev_t first, unsigned int count, char *name); or int alloc_chrdev_region(dev_t *dev, unsigned int firstminor, unsigned int count, char *name);) and sets up some basic parameters we&#8217;ll be using ahead e.g struct ScullDev&#8217;s elements. Also we have to initialize the resources that are going to be used.In module_exit the opposite of initialization procedure is performed in reverse order.All the resources allocated to the driver to be freed and this is done by exit routine.After our module gets inserted successfully to the kernel,it can be seen in &#8216;/proc/modules&#8217; file.And if we are able to register our driver successfully, we can see the driver&#8217;s name in &#8216;/proc/devices&#8217; file.<br />
	To implement our character driver we have used SCULL (Simple Character Utility for Loading Localities). Scull acts on a memory as though it were a device.The advantage of scull is that it isn’t hardware dependent. Scull just acts on some memory, allocated from the kernel. Anyone can compile and run scull.We have mapped the system calls to the routines written in our own driver i.e. we have defined the behaviour of the system calls for a particular device. We have used cdev_init and cdev_add functions to initialize the struct cdev and inform the kernel about the device. In our open routine,we are checking the mode,the device is trying to being opened. And depending on that mode flags we are performing some specific tasks e.g. if device is opened in write only mode then the device memory will get trimmed before going ahead.In trimming routine we just free all the memory allocated to the scull. Also in open routine we are mapping the scull to the device by using the macro &#8216;container_of&#8217;.In brief it simply maps the scull into the device and returns a pointer to the memory of device having scull mapped onto it.And we have stored this pointer into the void pointer &#8216;filep-&gt;private_data&#8217; to preserve the starting address of device memory for further use. In our write routine we are writing the data from application to the device through the scull quantums by using &#8216;copy_from_user&#8217;.Write routine also checks for the offset value i.e. cursor position where application wants to write.In read routine we are copying data from the device through scull quantums using &#8216;copy_to_user&#8217; function.Read routine also checks for the offset value from where application wants to read. We have also implemented lseek routine that sets the offset value as provided by the application in lseek system call.And finally in release routine we have just released the resources used after opening the device.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/e-30-01-30-om-parkash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Om Parkash E.30.01.30 (impemented scull_trim)</title>
		<link>https://www.emblogic.com/blog/07/om-parkash-e-30-01-30-impemented-scull_trim/</link>
		<comments>https://www.emblogic.com/blog/07/om-parkash-e-30-01-30-impemented-scull_trim/#comments</comments>
		<pubDate>Thu, 18 Jul 2013 13:44:16 +0000</pubDate>
		<dc:creator><![CDATA[Om Parkash]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6841</guid>
		<description><![CDATA[RCS file: chard.c,v Working file: chard.c head: 1.10 branch: locks: strict emblogic: 1.10 access list: symbolic names: keyword substitution: kv total revisions: 10;    selected revisions: 10 description: registered and unregistered devices using alloc_chrdev_region and unregis_chrdev_region. implemented scull_setup function. implemented scull_open &#8230; <a href="https://www.emblogic.com/blog/07/om-parkash-e-30-01-30-impemented-scull_trim/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: chard.c,v<br />
Working file: chard.c<br />
head: 1.10<br />
branch:<br />
locks: strict<br />
emblogic: 1.10<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 10;    selected revisions: 10<br />
description:<br />
registered and unregistered devices using alloc_chrdev_region and unregis_chrdev_region.<br />
implemented scull_setup function.<br />
implemented scull_open routine.<br />
started scull_trim,scull_release,scull_write and scull_read routines.<br />
working well till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10    locked by: emblogic;<br />
date: 2013/07/18 11:26:50;  author: emblogic;  state: Exp;  lines: +12 -14<br />
implemented scull_trim for O_WRONLY mode.<br />
read,write,lseek and trim are completed.<br />
working well.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2013/07/17 13:55:42;  author: emblogic;  state: Exp;  lines: +36 -4<br />
implementing trim.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2013/07/17 08:48:06;  author: emblogic;  state: Exp;  lines: +5 -2<br />
modfied scull_write for count+offset &lt; wcount&#8230;.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2013/07/17 07:05:35;  author: emblogic;  state: Exp;  lines: +15 -12<br />
Implemnted lseek successfully.<br />
all issues resolved.<br />
working well.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2013/07/17 06:43:42;  author: emblogic;  state: Exp;  lines: +239 -65<br />
Implemnted lseek ..<br />
written successfully after seeking.<br />
read returning more than expected value.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/07/11 08:48:05;  author: emblogic;  state: Exp;  lines: +19 -47<br />
implemented read and write successfully for any no. of bytes.<br />
checked for upto 1000 bytes .successfully written to scull Quantums and read from the quantums as well.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/07/10 11:43:39;  author: emblogic;  state: Exp;  lines: +89 -8<br />
read successfully .<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/07/10 06:02:17;  author: emblogic;  state: Exp;  lines: +58 -4<br />
written to scull successfully using write2scull function.<br />
working well.<br />
but printing garbage due to absence of NULL.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/07/09 12:03:54;  author: emblogic;  state: Exp;  lines: +170 -5<br />
implemented creat_scullqset,creat_qset and creat_quantums&#8230;.aloocated memory to write to scull.<br />
quantums created successfully .<br />
working well till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/07/08 11:03:54;  author: emblogic;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/om-parkash-e-30-01-30-impemented-scull_trim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>prince singla E -30.01.30</title>
		<link>https://www.emblogic.com/blog/07/prince-singla-e-30-01-30-2/</link>
		<comments>https://www.emblogic.com/blog/07/prince-singla-e-30-01-30-2/#comments</comments>
		<pubDate>Thu, 18 Jul 2013 13:30:35 +0000</pubDate>
		<dc:creator><![CDATA[prince.singla]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6838</guid>
		<description><![CDATA[RCS file: char_driver.c,v Working file: char_driver.c head: 1.8 branch: locks: strict root: 1.6.1.1 access list: symbolic names: keyword substitution: kv total revisions: 9; selected revisions: 9 description: register using alloc. successfullu implement sculldev sucessfully implement cdev &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.8 date: &#8230; <a href="https://www.emblogic.com/blog/07/prince-singla-e-30-01-30-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: char_driver.c,v<br />
Working file: char_driver.c<br />
head: 1.8<br />
branch:<br />
locks: strict<br />
	root: 1.6.1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 9;	selected revisions: 9<br />
description:<br />
register using alloc.<br />
successfullu implement sculldev<br />
sucessfully implement cdev<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2013/07/19 19:05:08;  author: root;  state: Exp;  lines: +372 -192<br />
implement lseek for read &amp; write().<br />
no of quantum or qset successfully craeted.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2013/07/16 13:44:47;  author: emblogic;  state: Exp;  lines: +73 -35<br />
problem&#8230;&#8230;&#8230;&#8230;.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2013/07/12 19:04:31;  author: emblogic;  state: Exp;  lines: +57 -11<br />
branches:  1.6.1;<br />
scull_read working successfully for multiple no of scullqset.<br />
used copy_to_user.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/07/12 14:37:34;  author: emblogic;  state: Exp;  lines: +4 -3<br />
written to multiple scullqset.<br />
declared nobws,lcount,lnoq<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/07/12 14:01:12;  author: emblogic;  state: Exp;  lines: +29 -8<br />
written n no of bytes to scull using copy_from_user.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/07/12 12:18:38;  author: emblogic;  state: Exp;  lines: +7 -3<br />
written 8 bytes to scull using copy_from_user.<br />
printed written data into the driver.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/07/10 18:01:30;  author: emblogic;  state: Exp;  lines: +319 -9<br />
implemented sucllqset ().<br />
implemented qset(),quantum(),<br />
allocate memory to quantum and qset .<br />
succesfully working .<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/07/02 10:35:38;  author: emblogic;  state: Exp;<br />
Initial revision<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6.1.1	locked by: root;<br />
date: 2013/07/16 15:54:53;  author: emblogic;  state: Exp;  lines: +58 -8<br />
successfully implimented llseek() for SEEK_SET.<br />
decleare snoq,snob.<br />
value update in f_pos.<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/prince-singla-e-30-01-30-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E30.01.30 Om Parkash</title>
		<link>https://www.emblogic.com/blog/07/e30-01-30-om-parkash/</link>
		<comments>https://www.emblogic.com/blog/07/e30-01-30-om-parkash/#comments</comments>
		<pubDate>Tue, 16 Jul 2013 18:07:29 +0000</pubDate>
		<dc:creator><![CDATA[Om Parkash]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6814</guid>
		<description><![CDATA[RCS file: chard.c,v Working file: chard.c head: 1.6 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 6;     selected revisions: 6 description: registered and unregistered devices using alloc_chrdev_region and unregis_chrdev_region. implemented scull_setup function. implemented scull_open routine. started &#8230; <a href="https://www.emblogic.com/blog/07/e30-01-30-om-parkash/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: chard.c,v<br />
Working file: chard.c<br />
head: 1.6<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 6;     selected revisions: 6<br />
description:<br />
registered and unregistered devices using alloc_chrdev_region and unregis_chrdev_region.<br />
implemented scull_setup function.<br />
implemented scull_open routine.<br />
started scull_trim,scull_release,scull_write and scull_read routines.<br />
working well till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2013/07/16 17:56:34;  author: emblogic;  state: Exp;  lines: +235 -65<br />
Implemented lseek using scull_lseek.<br />
new quantums get created when needed.<br />
working well.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/07/11 08:48:05;  author: emblogic;  state: Exp;  lines: +19 -47<br />
implemented read and write successfully for any no. of bytes.<br />
checked for upto 1000 bytes .successfully written to scull Quantums and read from the quantums as well.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/07/10 11:43:39;  author: emblogic;  state: Exp;  lines: +89 -8<br />
read successfully .<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/07/10 06:02:17;  author: emblogic;  state: Exp;  lines: +58 -4<br />
written to scull successfully using write2scull function.<br />
working well.<br />
but printing garbage due to absence of NULL.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/07/09 12:03:54;  author: emblogic;  state: Exp;  lines: +170 -5<br />
implemented creat_scullqset,creat_qset and creat_quantums&#8230;.aloocated memory to write to scull.<br />
quantums created successfully .<br />
working well till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/07/08 11:03:54;  author: emblogic;  state: Exp;<br />
Initial revision<br />
=============================================================================<br />
~</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/e30-01-30-om-parkash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implemented lseek in character driver (project 05)</title>
		<link>https://www.emblogic.com/blog/07/implemented-lseek-in-character-driver-project-05/</link>
		<comments>https://www.emblogic.com/blog/07/implemented-lseek-in-character-driver-project-05/#comments</comments>
		<pubDate>Sun, 14 Jul 2013 10:52:04 +0000</pubDate>
		<dc:creator><![CDATA[Om Parkash]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6775</guid>
		<description><![CDATA[RCS file: chard.c,v Working file: chard.c head: 1.6 branch: locks: strict emblogic: 1.6 access list: symbolic names: keyword substitution: kv total revisions: 6;     selected revisions: 6 description: registered and unregistered devices using alloc_chrdev_region and unregis_chrdev_region. implemented scull_setup function. implemented scull_open &#8230; <a href="https://www.emblogic.com/blog/07/implemented-lseek-in-character-driver-project-05/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: chard.c,v<br />
Working file: chard.c<br />
head: 1.6<br />
branch:<br />
locks: strict<br />
emblogic: 1.6<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 6;     selected revisions: 6<br />
description:<br />
registered and unregistered devices using alloc_chrdev_region and unregis_chrdev_region.<br />
implemented scull_setup function.<br />
implemented scull_open routine.<br />
started scull_trim,scull_release,scull_write and scull_read routines.<br />
working well till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6    locked by: emblogic;<br />
date: 2013/07/14 10:32:08;  author: emblogic;  state: Exp;  lines: +169 -50<br />
implemented lseek using scull_lseek.<br />
created new quantums when needed.<br />
read and written successfully after seeking.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/07/11 08:48:05;  author: emblogic;  state: Exp;  lines: +19 -47<br />
implemented read and write successfully for any no. of bytes.<br />
checked for upto 1000 bytes .successfully written to scull Quantums and read from the quantums as well.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/07/10 11:43:39;  author: emblogic;  state: Exp;  lines: +89 -8<br />
read successfully .<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/07/10 06:02:17;  author: emblogic;  state: Exp;  lines: +58 -4<br />
written to scull successfully using write2scull function.<br />
working well.<br />
but printing garbage due to absence of NULL.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/07/09 12:03:54;  author: emblogic;  state: Exp;  lines: +170 -5<br />
implemented creat_scullqset,creat_qset and creat_quantums&#8230;.aloocated memory to write to scull.<br />
quantums created successfully .<br />
working well till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/07/08 11:03:54;  author: emblogic;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/implemented-lseek-in-character-driver-project-05/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kushal Chugh : E-30.01.30</title>
		<link>https://www.emblogic.com/blog/07/kushal-chugh-e-30-01-30/</link>
		<comments>https://www.emblogic.com/blog/07/kushal-chugh-e-30-01-30/#comments</comments>
		<pubDate>Fri, 12 Jul 2013 04:16:20 +0000</pubDate>
		<dc:creator><![CDATA[kushal.chugh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6721</guid>
		<description><![CDATA[RCS file: lkm.c,v Working file: lkm.c head: 1.11 branch: locks: strict emblogic: 1.11 access list: symbolic names: keyword substitution: kv total revisions: 11; selected revisions: 11 description: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.11 locked by: emblogic; date: 2013/07/11 12:37:36; author: emblogic; state: Exp; &#8230; <a href="https://www.emblogic.com/blog/07/kushal-chugh-e-30-01-30/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: lkm.c,v<br />
Working file: lkm.c<br />
head: 1.11<br />
branch:<br />
locks: strict<br />
	emblogic: 1.11<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 11;	selected revisions: 11<br />
description:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11	locked by: emblogic;<br />
date: 2013/07/11 12:37:36;  author: emblogic;  state: Exp;  lines: +1 -1<br />
slight addition in the printk ;ine of the read function.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<br />
date: 2013/07/11 12:32:53;  author: emblogic;  state: Exp;  lines: +111 -10<br />
Successfully Implemented he read function.<br />
Able to read the data for muliple quantums.<br />
Implemented reading for multiple qsets as well.<br />
Succesfully done<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2013/07/11 08:37:45;  author: emblogic;  state: Exp;  lines: +0 -2<br />
So as Implemented Writing into multiple qsets as well.<br />
Successfully written.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2013/07/11 08:27:07;  author: emblogic;  state: Exp;  lines: +67 -27<br />
Implemented writting in Multiple quantums.<br />
Successfully written.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2013/07/11 06:21:43;  author: emblogic;  state: Exp;  lines: +36 -10<br />
Implemented writting for 1 Quantum.<br />
Successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2013/07/09 12:11:32;  author: emblogic;  state: Exp;  lines: +61 -3<br />
Successfully implemented scullqset,qset &amp; quantum function.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/07/09 10:50:17;  author: emblogic;  state: Exp;  lines: +128 -3<br />
working on creat_qset.<br />
created scullqset function<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/07/08 10:57:52;  author: emblogic;  state: Exp;  lines: +43 -1<br />
scull_read &amp;scull_write function mapped.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/07/08 06:31:57;  author: emblogic;  state: Exp;  lines: +20 -1<br />
scull_trim function called inside scull_open function.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/07/08 06:20:02;  author: emblogic;  state: Exp;  lines: +8 -5<br />
open and release function implied<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/07/02 12:56:06;  author: emblogic;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/kushal-chugh-e-30-01-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avtar Singh E- 30.01.30</title>
		<link>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30/</link>
		<comments>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30/#comments</comments>
		<pubDate>Fri, 12 Jul 2013 04:12:19 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6711</guid>
		<description><![CDATA[RCS file: new_lkm.c,v Working file: new_lkm.c head: 1.10 branch: locks: strict root: 1.10 access list: symbolic names: keyword substitution: kv total revisions: 11; selected revisions: 11 description: in this i register many no. of devices that we can provide at &#8230; <a href="https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: new_lkm.c,v<br />
Working file: new_lkm.c<br />
head: 1.10<br />
branch:<br />
locks: strict<br />
root: 1.10<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 11; selected revisions: 11<br />
description:<br />
in this i register many no. of devices that we can provide at the time of insmod as command line argument.<br />
use setup_struct_cdev() function i.e user defined to setup of the struct cdev,in this we use cdev_init() &amp; cdev_add().<br />
in cleanup we use cdev_del to delete the cdev setup for all devices.<br />
also used kmalloc() &amp; kfree() to allocate &amp; deallocate the memory to scull_dev (pointer of struct Sculldev).<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10 locked by: root;<br />
date: 2013/07/11 15:05:36; author: root; state: Exp; lines: +36 -8<br />
gave response to read call of application.<br />
scull_read() function is taking request of read call.<br />
use copy_to_user() function to copy no. of bytes requested by application from kernel space i.e quantums to the user buffer.<br />
rbuff is our user buffer in our case.<br />
successfully jumping from one scullqset to another when one scullqset fills.<br />
overall successfully writing to user buffer is performing.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2013/07/11 12:09:24; author: root; state: Exp; lines: +40 -2<br />
to read call driver is comming in scull<br />
scull_read().<br />
here copy_to_user() is working properly only to write first quantum from kernel space to user buffer i.e rbuff in my case.<br />
it is successfully writing upto this.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2013/07/11 10:48:47; author: root; state: Exp; lines: +47 -8<br />
in scull_write(),use copy_from_user() to copy data from user buffer i.e wbuff in our case to the quantums that was allocated.<br />
also after copying data from ubuff to kernel buffer i.e quantums i link the fscullqset with the scullqset of the sculldev that was stored in the filep-&gt;private_data .<br />
till now it is successfully working.<br />
it can also move from one scullqset to next when all the quantums of the present scullqset fills.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2013/07/10 10:20:09; author: root; state: Exp; lines: +11 -8<br />
in create_scullqset(),make fscullqset-&gt;next = NULL.<br />
sometimes without doing this result in kernel crash in create_quantum().<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2013/07/10 07:40:20; author: root; state: Exp; lines: +215 -3<br />
declaire variable noq &amp; nosqs for no. of quantum &amp; no. of scullqset respectively.<br />
from the given info. in header ,found the value of noq &amp; nosqs.<br />
now to create nosqs called function create_scullqset(), &amp;to create no. of qsets i called function create_qset() .<br />
at last i called create_quantum() to create requirted no. of quantums.value in size comes from application app.c ,i.e 3rd argument of write.<br />
till now working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/07/08 11:15:20; author: emblogic; state: Exp; lines: +97 -18<br />
defined read &amp; write function for reading &amp; writing to &amp; from the kernel buffer to user space buffer.<br />
only control is going to read &amp; write when called by application .<br />
noting is performing in the read &amp; write function.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/07/08 11:14:01; author: emblogic; state: Exp; lines: +0 -3<br />
2 lines deleted.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/07/08 11:12:58; author: emblogic; state: Exp; lines: +2 -0<br />
2 lines added.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/07/02 12:25:03; author: root; state: Exp; lines: +57 -7<br />
branches: 1.2.1;<br />
driver comming in the open_file function after receiving the open call from the application ,app.c.<br />
initialize struct Sculldev elements like qset_size,quantum_size,device_size &amp; data_size.<br />
added open_file() &amp; close_file() function to give response yo the open &amp; close call of app.c program.<br />
in script ,we make node to interface b/w US &amp; KS by using mknod command.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/07/02 08:50:13; author: root; state: Exp;<br />
Initial revision<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2.1.1<br />
date: 2013/07/05 06:49:09; author: emblogic; state: Exp; lines: +48 -17<br />
in open_file function i use container_of() function to map the machine memory &amp; device memory.<br />
this function return address of that mapped memory whis i am storing in the lsculldev i.e pointer to struct Sculldev.<br />
now this address is put in the private data of struct file .<br />
now i check the requested permission by anding the f_flags member of struct file with O_ACCMODE .<br />
now accordingly control goes to the scull_trim function.<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
