<?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; Avtar Singh</title>
	<atom:link href="https://www.emblogic.com/blog/author/avtar8015/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>USB device driver</title>
		<link>https://www.emblogic.com/blog/12/usb-device-driver/</link>
		<comments>https://www.emblogic.com/blog/12/usb-device-driver/#comments</comments>
		<pubDate>Mon, 30 Dec 2013 11:35:23 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7968</guid>
		<description><![CDATA[USB Device Driver &#160; Introduction to USB: These days we are using USB(Universal Serial Bus) devices like pen drive ,mouse,printer etc instead of using serial or parallel port devices. One of the original intentions of USB was to reduce the &#8230; <a href="https://www.emblogic.com/blog/12/usb-device-driver/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>USB Device Driver</strong></p>
<p>&nbsp;</p>
<p>Introduction to USB:</p>
<p>These days we are using USB(Universal Serial Bus) devices like pen drive</p>
<p>,mouse,printer etc instead of using serial or parallel port devices. One of the original intentions of USB was to reduce the amount of cabling at the back of your PC. USB port can connect up to 127 peripheral devices by using hub. Averagely it gives us 12Mbps data transfer speed.</p>
<p>Basically host controller keep checking at the USB port to detect device. Whenever device came due to voltage difference it generate interrupt and inform to the system about the device.</p>
<p>&nbsp;</p>
<p>Now to make USB communication between the host and the device there is need of the drivers on the both side.In our system there is core usb driver which load the appropriate interfacing driver (that is of our concern )for the usb device (mouse ,keyboard etc.) for service. In our system there are different different drivers for different type of devices to make core driver less bulky.</p>
<p>&nbsp;</p>
<p>USB device basic:</p>
<p>USB device may have one or more configurations and each configuration consist of one or more interfaces and each interfaces consist of one or more endpoints. Generally there is only one configuration in more devices if more, then it will be select able by hardware switch. In our GSM modem there is facility of attaching storage device also so it has two interfaces.</p>
<p>Now for communication we have to send or receive data from the endpoints which is inside the interface ,these may be input endpoint or output endpoint for receiving and sending respectively.</p>
<p>&nbsp;</p>
<p>Type of data transfer from endpoint:</p>
<p>Control :</p>
<p>Control endpoint is used to retrieve the device information at the time of enumeration of device</p>
<p>Enumeration is the process in which core driver take the information about the hardware from the device firmware to check the vendor id,product id ,serial number etc to load appropriate interfacing driver to serve.</p>
<p>Interrupt:</p>
<p>Interrupt endpoint is used to send the small data of in asynchronous manner like in keyboard. This endpoint is not used to transfer large amount of data.</p>
<p>Isochronous:</p>
<p>Isochronous endpoint is used to send large amount of data but it is generally used where we can accept some data loss like in video streaming where continuous stream of data is required.</p>
<p>Bulk:</p>
<p>Bulk endpoint is also used to send large amount of data and there is no loss in the data. It is used for the mass storage devices to copy the data to and from t he system. It split the data into small chunks if there is large amount of data according to the block size.</p>
<p>&nbsp;</p>
<p>Now it is clear from above discussion that data is transferred from the endpoint. Data is generally transferred in URBs i.e USB request blocks.</p>
<p>&nbsp;</p>
<p>Interfacing Driver:</p>
<p>Interfacing driver means that driver which is loaded by usb core driver for specific device to server. It communicate between the application layer and the usb core driver to serve the device request. If we want to use our interfacing driver in the system to provide service then we have to register our driver with USB subsystem first using usb_register() system call and then in our driver we also have to specify that our driver is made for which device (vendor id, product id etc.). All these information is provided in the linux/usb.h header file.</p>
<p>Now one important thing is that you have to remove the usbhid named driver from the system using rmmod usbhid if it is moduler otherwise recompile raw kernel by making hid(human interface device) driver moduler from static.</p>
<p>&nbsp;</p>
<p>Thank you.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/12/usb-device-driver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Socket Programming</title>
		<link>https://www.emblogic.com/blog/12/socket-programming-2/</link>
		<comments>https://www.emblogic.com/blog/12/socket-programming-2/#comments</comments>
		<pubDate>Thu, 05 Dec 2013 12:48:40 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7667</guid>
		<description><![CDATA[Socket Programming Socket: Sockets are basically used for inter process communication within single or over the network systems. So sockets are basically two endpoints of the communication via which we can communicate. So socket represents a single connection between exactly &#8230; <a href="https://www.emblogic.com/blog/12/socket-programming-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Socket Programming</p>
<p>Socket:</p>
<p>Sockets are basically used for inter process communication within single or over the network systems. So sockets are basically two endpoints of the communication via which we can communicate. So socket represents a single connection between exactly two pieces of software but we can also communicate between multiple piece of softwares but this requires multiple sockets.</p>
<p>*Sockets are use of unidirectional as well as bidirectional communication.</p>
<p>&nbsp;</p>
<p>Now as we know if we have to work on the network then we have to deal with IP addresses also because each and every system on the network is recognized by its IP address.In this we have one server and many clients to take the service of the server. Notice that the client needs to know the existence of and the address of the server, but the server does not need to know the address of (or even the existence of) the client prior to the connection being established. Notice also that once a connection is established, both sides can send and receive information.</p>
<p>&nbsp;</p>
<p>Socket Types:</p>
<p>&nbsp;</p>
<p>There are two widely used socket types, stream sockets, and datagram sockets. Stream sockets treat communications as a continuous stream of characters, while datagram sockets have to read entire messages at once. Each uses its own communications protocol. Stream sockets use TCP (Transmission Control Protocol), which is a reliable, stream oriented protocol, and datagram sockets use UDP (Unix Datagram Protocol), which is unreliable and message oriented.</p>
<p>&nbsp;</p>
<p>The address of a socket in the Internet domain consists of the Internet address of the host machine (a unique 32 bit address, often referred to as its IP address). In addition, each socket needs a port number on that host. Port numbers are 16 bit unsigned integers. The lower numbers are reserved in Unix for standard services. For example, the port number for the FTP server is 21. It is important that standard services be at the same port on all computers so that clients will know their addresses. However, port numbers above 2000 are generally available.</p>
<p>&nbsp;</p>
<p>API to establish socket:</p>
<p>&nbsp;</p>
<p>In server side:</p>
<p>Socket system calls are declaired in the linux system at standard path in the &lt;sys/socket.h&gt; header file.</p>
<p>Firstly we have to make socket with socket() call. When a socket is created, the program has to specify the address domain and the socket type. Two processes can communicate with each other only if their sockets are of the same type and in the same domain. There are two widely used address domains, the unix domain, in which two processes which share a common file system communicate, and the Internet domain, in which two processes running on any two hosts on the Internet communicate. Each of these has its own address format.</p>
<p>&nbsp;</p>
<p>Bind the socket to an address using the bind() system call. For a server socket on the Internet, an address consists of a port number on the host machine.</p>
<p>&nbsp;</p>
<p>Listen for connections with the listen() system call</p>
<p>&nbsp;</p>
<p>Accept a connection with the accept() system call. This call typically blocks until a client connects with the server.</p>
<p>&nbsp;</p>
<p>In client side:</p>
<p>In the client side also we have to make socket,Connect the socket to the address of the server using the connect() system call</p>
<p>Send and receive data. There are a number of ways to do this, but the simplest is to use the read() and write() system calls.</p>
<p>&nbsp;</p>
<p>We can check our client and server program by loopback means by giving the IP address “127.0.0.1”.</p>
<p>on client and server side on single system.</p>
<p>&nbsp;</p>
<p>Thanks</p>
<p>Avtar Singh</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/12/socket-programming-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E-30.01.30:Embedded OS Porting on Olinuxino Board</title>
		<link>https://www.emblogic.com/blog/11/e-30-01-30embedded-os-porting-on-olinuxino-board/</link>
		<comments>https://www.emblogic.com/blog/11/e-30-01-30embedded-os-porting-on-olinuxino-board/#comments</comments>
		<pubDate>Mon, 25 Nov 2013 12:23:31 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7540</guid>
		<description><![CDATA[Porting of Embedded OS on Olinuxino Board Embedded OS: Embedded Operating System is simply a light version of complete OS ,means in embedded OS we reduce some functionality from the OS according to the our requirement like if we don&#8217;t &#8230; <a href="https://www.emblogic.com/blog/11/e-30-01-30embedded-os-porting-on-olinuxino-board/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><span style="font-size: large"> Porting of Embedded OS on Olinuxino Board</span></p>
<p><span style="font-size: medium">Embedded OS:</span></p>
<p><span style="font-size: small"> Embedded Operating System is simply a light version of complete OS ,means in embedded OS we reduce some functionality from the OS according to the our requirement like if we don&#8217;t want to use the USB camera then we disable it. We can put applications according to the requirement which decrease the overhead of OS.</span></p>
<p><span style="font-size: medium">Porting:</span></p>
<p><span style="font-size: medium"> <span style="font-size: small">Porting is the process in which we put compiled software in the target machine (in my case arm based olinuxino board )after developing it on the host machine like x86.</span></span></p>
<p><span style="font-size: small">Note: I have used x86 machine for development because it is faster than the ARM based system.</span></p>
<p><span style="font-size: medium">Why Olinuxino Board???</span></p>
<p><span style="font-size: medium"> <span style="font-size: small">Many boards are used for development purpose but i have used Olinuxino board ( by Olimex )due to below positive points:</span></span></p>
<p><span style="font-size: small"> Open source</span></p>
<p><span style="font-size: small"> Open hardware</span></p>
<p><span style="font-size: small"> Complete documentation is freely available on the network.</span></p>
<p><span style="font-size: small">Some main features:</span></p>
<p><span style="font-size: small"> 1.Ghz Processor(A13 Cortex A8 by Allwinner Technologies China) speed.</span></p>
<p><span style="font-size: small"> 2.3D mali 400 GPU.</span></p>
<p><span style="font-size: small"> 3.VGA video output.</span></p>
<p><span style="font-size: small"> 4.Touch screen interface.</span></p>
<p><span style="font-size: small"> 5.512 MB RAM</span></p>
<p><span style="font-size: small"> 6.GPIO pins.</span></p>
<p><span style="font-size: small"> 7.SD card slot.</span></p>
<p><span style="font-size: medium">Primary Requirements for Board Bring Up:</span></p>
<p><span style="font-size: medium"> <span style="font-size: small">For standing up our system we need below softwares.</span></span></p>
<p><span style="font-size: small">1.Tool chain</span></p>
<p><span style="font-size: small">2.Secound stage boot loader(u-boot)</span></p>
<p><span style="font-size: small">3.Kernel Image(uImage)</span></p>
<p><span style="font-size: small">4.Debian Root file system.</span></p>
<p><span style="font-size: small">*All the above packages are free available on the internet to download.</span></p>
<p><span style="font-size: small">Brief Note On development Process:</span></p>
<p><span style="font-size: small">Tool chain is used to cross compile all the packages on the x86 machine according to the ARM based system. </span></p>
<p><span style="font-size: small">So I cross compiled firstly kernel before selecting required functionalitie by menuconfig.</span></p>
<p><span style="font-size: small">After that I cross compile U-boot which is second stage boot loader and required to load the kernel image on the RAM for execution.</span></p>
<p><span style="font-size: small">Card Partitioning:</span></p>
<p><span style="font-size: small">Card partitioning is essential in the board bringing up to partition the card and making appropriate file system because at the initial stage of the system boot up ,system can&#8217;t support the heavy file system like ext 2 or ext3 due to absence of kernel.</span></p>
<p><span style="font-size: small">So we make first partition of 16MB of vfat file system and rest memory of ext3 file system.</span></p>
<p><span style="font-size: small">I partitioned the card using “fdisk” utility.</span></p>
<p><span style="font-size: small">Porting On MMC Card:</span></p>
<p><span style="font-size: small">1.Using “dd” command i placed the sunxi-spl.bin and u-boot.bin from the u-boot to the unpartitioned space which is after the 8kb and before 1MB respectively.</span></p>
<p><span style="font-size: small">2.Now I simply copied the uImage and script.bin to the first partition of 16MB</span></p>
<p><span style="font-size: small">3.At last in the secound partition i uncompressed the archive image of debian root file system.</span></p>
<p><span style="font-size: small">After this my card was ready to boot up on the olinuxino board</span></p>
<p>&nbsp;</p>
<p><span style="font-size: small">Thanks</span></p>
<p><span style="font-size: small">Avtar Singh</span></p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/11/e-30-01-30embedded-os-porting-on-olinuxino-board/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>c++ assignment status</title>
		<link>https://www.emblogic.com/blog/08/c-assignment-status-9/</link>
		<comments>https://www.emblogic.com/blog/08/c-assignment-status-9/#comments</comments>
		<pubDate>Sat, 24 Aug 2013 13:55:18 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[siddhartha sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7138</guid>
		<description><![CDATA[i have completed 2 assignment with c++. also practice some program using inline function.]]></description>
				<content:encoded><![CDATA[<p>i have completed 2 assignment with c++.</p>
<p>also practice some program using inline function.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/c-assignment-status-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avtar Singh C &amp; c++ assignment status</title>
		<link>https://www.emblogic.com/blog/08/avtar-singh-c-c-assignment-status/</link>
		<comments>https://www.emblogic.com/blog/08/avtar-singh-c-c-assignment-status/#comments</comments>
		<pubDate>Fri, 09 Aug 2013 15:41:31 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[siddarth sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7075</guid>
		<description><![CDATA[I have completed 8 assignments with some doubts on floating point numbers and working on 9th assignment. some problems are comming in 9th assignment. Also done 1 assignment of c++.]]></description>
				<content:encoded><![CDATA[<p>I have completed 8 assignments with some doubts on floating point numbers and working on 9th assignment.</p>
<p>some problems are comming in 9th assignment.</p>
<p style="text-align: left">Also done 1 assignment of c++.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/avtar-singh-c-c-assignment-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avtar Singh E-30.01.30</title>
		<link>https://www.emblogic.com/blog/08/avtar-singh-e-30-01-30-8/</link>
		<comments>https://www.emblogic.com/blog/08/avtar-singh-e-30-01-30-8/#comments</comments>
		<pubDate>Sat, 03 Aug 2013 12:09:28 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[To Sidhdharth Sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6997</guid>
		<description><![CDATA[done first 9 assignments with some problems. main problem is coming in low level file input-output operations.]]></description>
				<content:encoded><![CDATA[<p>done first 9 assignments with some problems.</p>
<p>main problem is coming in low level file input-output operations.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/avtar-singh-e-30-01-30-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avtar Singh E-30.01.30</title>
		<link>https://www.emblogic.com/blog/08/avtar-singh-e-30-01-30-7/</link>
		<comments>https://www.emblogic.com/blog/08/avtar-singh-e-30-01-30-7/#comments</comments>
		<pubDate>Thu, 01 Aug 2013 12:43:29 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[to pravjot sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6986</guid>
		<description><![CDATA[RCS file: new_lkm.c,v Working file: new_lkm.c head: 1.30 branch: locks: strict root: 1.30 access list: symbolic names: keyword substitution: kv total revisions: 31;    selected revisions: 31 description: in this i register many no. of devices that we can provide at &#8230; <a href="https://www.emblogic.com/blog/08/avtar-singh-e-30-01-30-7/">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.30<br />
branch:<br />
locks: strict<br />
root: 1.30<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 31;    selected revisions: 31<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.30    locked by: root;<br />
date: 2013/08/01 12:32:18;  author: root;  state: Exp;  lines: +31 -0<br />
implemented capability also in my ioctl function.<br />
done some basic checking in program.<br />
added more command operations also .<br />
working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.29<br />
date: 2013/08/01 11:09:10;  author: root;  state: Exp;  lines: +112 -10<br />
implemented basic ioctl.<br />
in this i have made some basic commands like IOCMD_RESET,IOCMD_SQUANTUM,etc..<br />
made a new header file named ioctl_header.h,included in driver source code as well as in the application.<br />
so that commands become visible to the driver and applications.<br />
driver giving response to the requested commands by app.<br />
every operations of ioctl is mapped with the function named ioctl().<br />
working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.28<br />
date: 2013/07/28 18:02:06;  author: root;  state: Exp;  lines: +17 -5<br />
implemented create_read_proc_entry successfully.<br />
now device entry in /proc mapped with the my function named read_proc in the driver(new_lkm.c).<br />
it provide the information about the attributes of the sculldev or device like device name,device size,etc..<br />
some questions is still in mind<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.27<br />
date: 2013/07/28 16:14:45;  author: root;  state: Exp;  lines: +43 -6<br />
implemented create_proc_read_entry() in very simple way.<br />
able to print any string to the page in read_proc function using sprintf().<br />
till now working.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.26<br />
date: 2013/07/26 06:54:01;  author: root;  state: Exp;  lines: +14 -10<br />
implemented the driver using one semaphore and one completion.<br />
it can handle many writers as well as many readers .<br />
it will accept first writer then accept one reader now again accept one writer and then again one reader and so on.<br />
still now it is working properly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.25<br />
date: 2013/07/24 18:58:42;  author: root;  state: Exp;  lines: +53 -18<br />
implemented completion for one writer and many reader.<br />
using init_completion() in O_WRONLY condition of open function.<br />
waiting by wait_for_completion() in read function for putting readers in a small driver&#8217;s queue.<br />
used complete once at the bottom of write and then afterward at the bottom of read call to allow other readers to read.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.24<br />
date: 2013/07/23 12:40:18;  author: root;  state: Exp;  lines: +35 -9<br />
using two semaphores ,one to control read and secound to control writing over the scull.<br />
in this in starting one writer is essential and after writing one reader is essential to proceed.<br />
tested for two writing apps and two reading applications .<br />
till now it is working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.23<br />
date: 2013/07/23 06:26:06;  author: root;  state: Exp;  lines: +4 -10<br />
move sem_init() from open_file() to the function setup_struct_cdev().<br />
here semaphore will initialize for each &amp; every device at the starting.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.22<br />
date: 2013/07/22 17:17:13;  author: root;  state: Exp;  lines: +8 -2<br />
implemented semaphore in kernel level.<br />
using sema_init(),down() in open function,it will make down to semaphore only in O_WRONLY because i am recently controlling the write calls from two diffrent applications.<br />
making up() after performing write function in scull_write().<br />
working properly till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.21<br />
date: 2013/07/22 07:55:54;  author: root;  state: Exp;  lines: +2 -2<br />
checked new version to read and trim.<br />
it is working successfully.<br />
i checked it upto 27 quantums to read and trim quantum by quantum.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.20<br />
date: 2013/07/22 07:23:59;  author: root;  state: Exp;  lines: +230 -28<br />
this is successfully trimming all the allocated space to the device when we open it for writing next time.<br />
i have also written a new version of read which will read and trim only quantums one by one.<br />
read trim is not tested yet.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.19<br />
date: 2013/07/19 11:07:56;  author: root;  state: Exp;  lines: +115 -8<br />
implemented scull_trim function properly.<br />
when we open same file in the write mode again then it trim all the data.<br />
means in this i deallocated the memory of quantums,qsets &amp; scullqsets.<br />
it is working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.18<br />
date: 2013/07/17 13:59:24;  author: root;  state: Exp;  lines: +0 -3<br />
three waste lines deleted .<br />
checked also to add many scullqsets with the previously allocated memory,that was less to write the new request by application.<br />
working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.17<br />
date: 2013/07/17 13:05:14;  author: root;  state: Exp;  lines: +54 -7<br />
successfully adding some memory when application gives more no. of characters than previously write call after g some positions.<br />
can add some quantums in the previously allocated memory.<br />
till now wprking successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.16<br />
date: 2013/07/16 13:54:00;  author: root;  state: Exp;  lines: +2 -2<br />
working for lseek of more than one quantums also .<br />
till now driver can lseek before write after write .<br />
results are comming correct.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.15<br />
date: 2013/07/16 13:03:18;  author: root;  state: Exp;  lines: +29 -25<br />
working for write ,then again write some data after 5 positions.<br />
reading the whole data after two write operations .<br />
checked only for less than 8 bytes to append.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.14<br />
date: 2013/07/16 11:21:28;  author: root;  state: Exp;  lines: +72 -14<br />
performing lseek by any no. of positions successfully.<br />
written only for SEEK_SET.<br />
performed lseek before write &amp; at the time of read operations.<br />
till now it is working properly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.13<br />
date: 2013/07/16 05:17:19;  author: root;  state: Exp;  lines: +52 -25<br />
implemented lseek when we read after writing to the quantums.<br />
only SEEK_SET implemented in the scull_lseek.<br />
it can seek within the quantum , inter quantum &amp; inter scullqset.<br />
till now it is working correctly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.12<br />
date: 2013/07/15 07:39:03;  author: root;  state: Exp;  lines: +23 -4<br />
coming in different case in scull_lseek according to the request of application.<br />
defined variable new_position to return the value to application &amp; to store the new position after lseek operation in scull_lseek.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11<br />
date: 2013/07/15 06:28:03;  author: root;  state: Exp;  lines: +34 -15<br />
add scull_lseek() to seek the cursor position according to the lseek call in the app.c.<br />
printing offset position &amp; offset type correctly.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<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.<br />
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/08/avtar-singh-e-30-01-30-7/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-6/</link>
		<comments>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30-6/#comments</comments>
		<pubDate>Mon, 29 Jul 2013 12:26:38 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[to pravjot sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6958</guid>
		<description><![CDATA[RCS file: new_lkm.c,v Working file: new_lkm.c head: 1.29 branch: locks: strict root: 1.29 access list: symbolic names: keyword substitution: kv total revisions: 30;    selected revisions: 30 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-6/">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.29<br />
branch:<br />
locks: strict<br />
root: 1.29<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 30;    selected revisions: 30<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.29    locked by: root;<br />
date: 2013/07/29 12:20:41;  author: root;  state: Exp;  lines: +31 -10<br />
used create_proc_read_entry successfully.<br />
write the information of the device when we open the /proc entry of device.<br />
used off variable to print the data on page.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.28<br />
date: 2013/07/28 18:02:06;  author: root;  state: Exp;  lines: +17 -5<br />
implemented create_read_proc_entry successfully.<br />
now device entry in /proc mapped with the my function named read_proc in the driver(new_lkm.c).<br />
it provide the information about the attributes of the sculldev or device like device name,device size,etc..<br />
some questions is still in mind<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.27<br />
date: 2013/07/28 16:14:45;  author: root;  state: Exp;  lines: +43 -6<br />
implemented create_proc_read_entry() in very simple way.<br />
able to print any string to the page in read_proc function using sprintf().<br />
till now working.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.26<br />
date: 2013/07/26 06:54:01;  author: root;  state: Exp;  lines: +14 -10<br />
implemented the driver using one semaphore and one completion.<br />
it can handle many writers as well as many readers .<br />
it will accept first writer then accept one reader now again accept one writer and then again one reader and so on.<br />
still now it is working properly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.25<br />
date: 2013/07/24 18:58:42;  author: root;  state: Exp;  lines: +53 -18<br />
implemented completion for one writer and many reader.<br />
using init_completion() in O_WRONLY condition of open function.<br />
waiting by wait_for_completion() in read function for putting readers in a small driver&#8217;s queue.<br />
used complete once at the bottom of write and then afterward at the bottom of read call to allow other readers to read.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.24<br />
date: 2013/07/23 12:40:18;  author: root;  state: Exp;  lines: +35 -9<br />
using two semaphores ,one to control read and secound to control writing over the scull.<br />
in this in starting one writer is essential and after writing one reader is essential to proceed.<br />
tested for two writing apps and two reading applications .<br />
till now it is working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.23<br />
date: 2013/07/23 06:26:06;  author: root;  state: Exp;  lines: +4 -10<br />
move sem_init() from open_file() to the function setup_struct_cdev().<br />
here semaphore will initialize for each &amp; every device at the starting.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.22<br />
date: 2013/07/22 17:17:13;  author: root;  state: Exp;  lines: +8 -2<br />
implemented semaphore in kernel level.<br />
using sema_init(),down() in open function,it will make down to semaphore only in O_WRONLY because i am recently controlling the write calls from two diffrent applications.<br />
making up() after performing write function in scull_write().<br />
working properly till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.21<br />
date: 2013/07/22 07:55:54;  author: root;  state: Exp;  lines: +2 -2<br />
checked new version to read and trim.<br />
it is working successfully.<br />
i checked it upto 27 quantums to read and trim quantum by quantum.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.20<br />
date: 2013/07/22 07:23:59;  author: root;  state: Exp;  lines: +230 -28<br />
this is successfully trimming all the allocated space to the device when we open it for writing next time.<br />
i have also written a new version of read which will read and trim only quantums one by one.<br />
read trim is not tested yet.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.19<br />
date: 2013/07/19 11:07:56;  author: root;  state: Exp;  lines: +115 -8<br />
implemented scull_trim function properly.<br />
when we open same file in the write mode again then it trim all the data.<br />
means in this i deallocated the memory of quantums,qsets &amp; scullqsets.<br />
it is working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.18<br />
date: 2013/07/17 13:59:24;  author: root;  state: Exp;  lines: +0 -3<br />
three waste lines deleted .<br />
checked also to add many scullqsets with the previously allocated memory,that was less to write the new request by application.<br />
working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.17<br />
date: 2013/07/17 13:05:14;  author: root;  state: Exp;  lines: +54 -7<br />
successfully adding some memory when application gives more no. of characters than previously write call after g some positions.<br />
can add some quantums in the previously allocated memory.<br />
till now wprking successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.16<br />
date: 2013/07/16 13:54:00;  author: root;  state: Exp;  lines: +2 -2<br />
working for lseek of more than one quantums also .<br />
till now driver can lseek before write after write .<br />
results are comming correct.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.15<br />
date: 2013/07/16 13:03:18;  author: root;  state: Exp;  lines: +29 -25<br />
working for write ,then again write some data after 5 positions.<br />
reading the whole data after two write operations .<br />
checked only for less than 8 bytes to append.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.14<br />
date: 2013/07/16 11:21:28;  author: root;  state: Exp;  lines: +72 -14<br />
performing lseek by any no. of positions successfully.<br />
written only for SEEK_SET.<br />
performed lseek before write &amp; at the time of read operations.<br />
till now it is working properly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.13<br />
date: 2013/07/16 05:17:19;  author: root;  state: Exp;  lines: +52 -25<br />
implemented lseek when we read after writing to the quantums.<br />
only SEEK_SET implemented in the scull_lseek.<br />
it can seek within the quantum , inter quantum &amp; inter scullqset.<br />
till now it is working correctly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.12<br />
date: 2013/07/15 07:39:03;  author: root;  state: Exp;  lines: +23 -4<br />
coming in different case in scull_lseek according to the request of application.<br />
defined variable new_position to return the value to application &amp; to store the new position after lseek operation in scull_lseek.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11<br />
date: 2013/07/15 06:28:03;  author: root;  state: Exp;  lines: +34 -15<br />
add scull_lseek() to seek the cursor position according to the lseek call in the app.c.<br />
printing offset position &amp; offset type correctly.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<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.<br />
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-6/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-5/</link>
		<comments>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30-5/#comments</comments>
		<pubDate>Sat, 20 Jul 2013 06:30:32 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[to pravjot sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6869</guid>
		<description><![CDATA[INTRODUCTION: Device driver is basically a module(piece of code) used to make possible the communication between hardware and application like VLC media player,firefox,USB devices etc.So device driver is used to drive the hardware according to the application.Different type of applications &#8230; <a href="https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30-5/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>INTRODUCTION:<br />
Device driver is basically a module(piece of code) used to make possible the communication between hardware and application like VLC media player,firefox,USB devices etc.So device driver is used to drive the hardware according to the application.Different type of applications require different type of drivers like USB driver can&#8217;t work for VLC media player and vice-versa.<br />
I think the need of using device drivers is to increase the functionality of kernel.We use the driver as LKM(Loadable Kernel Module) to make our kernel less bulky in size &amp; also it is not essential to keep driver present in the kernel until system is power on.<br />
I am working on Character Driver from last few days.In this article I am going to discuss what i know about character driver briefly.<br />
Character driver sends the data byte by byte to the kernel buffer and user buffer when application give call of write and read respectively.<br />
Now as I have to make my driver capable of directly handshake 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>DEVICE DRIVER IMPLEMENTATION ROUTE MAP:<br />
I firstly used 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 this entry_function and exit_function is written by me.So after executing module_exit 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 maximun memory of the driver. 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 prevoiusly 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 kernel library.This will give the result of 32 bit(12 + 20 bit) at the address as give in first argument of call.Now later on i have used that 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.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 initialize the sculldev structure(user defined structure that contain all information of the driver) to add the maximum memory of device and the partition of that memory like size of one quantum etc.<br />
Now I have open,write,read,lseek and close file till now.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.<br />
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<br />
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.<br />
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 quantum  when write request comes and give back that data according to the read request of application.I have also handled the single multi threaded application.</p>
<p>Now to test this driver firstly compile and insert our module in running kernel dynamically.This is done with command insmod &lt;lkm.ko&gt; on shell here lkm is my name of c file of driver.Compilation of the file should be by Makefile. And to make communication possible between application application and device driver,we require node in Virtual File System(VFS). Node is created by the commend &#8220;mknod node_name c major no. minor no.&#8221;,here c is to specify that is making for character driver.<br />
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.<br />
That was all i have done with character driver.</p>
<p>THANK YOU!!!</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30-5/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-4/</link>
		<comments>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30-4/#comments</comments>
		<pubDate>Fri, 19 Jul 2013 14:10:55 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[to pravjot sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6859</guid>
		<description><![CDATA[RCS file: new_lkm.c,v Working file: new_lkm.c head: 1.19 branch: locks: strict root: 1.19 access list: symbolic names: keyword substitution: kv total revisions: 20;    selected revisions: 20 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-4/">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.19<br />
branch:<br />
locks: strict<br />
root: 1.19<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 20;    selected revisions: 20<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.19    locked by: root;<br />
date: 2013/07/19 11:07:56;  author: root;  state: Exp;  lines: +115 -8<br />
implemented scull_trim function properly.<br />
when we open same file in the write mode again then it trim all the data.<br />
means in this i deallocated the memory of quantums,qsets &amp; scullqsets.<br />
it is working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.18<br />
date: 2013/07/17 13:59:24;  author: root;  state: Exp;  lines: +0 -3<br />
three waste lines deleted .<br />
checked also to add many scullqsets with the previously allocated memory,that was less to write the new request by application.<br />
working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.17<br />
date: 2013/07/17 13:05:14;  author: root;  state: Exp;  lines: +54 -7<br />
successfully adding some memory when application gives more no. of characters than previously write call after g some positions.<br />
can add some quantums in the previously allocated memory.<br />
till now wprking successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.16<br />
date: 2013/07/16 13:54:00;  author: root;  state: Exp;  lines: +2 -2<br />
working for lseek of more than one quantums also .<br />
till now driver can lseek before write after write .<br />
results are comming correct.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.15<br />
date: 2013/07/16 13:03:18;  author: root;  state: Exp;  lines: +29 -25<br />
working for write ,then again write some data after 5 positions.<br />
reading the whole data after two write operations .<br />
checked only for less than 8 bytes to append.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.14<br />
date: 2013/07/16 11:21:28;  author: root;  state: Exp;  lines: +72 -14<br />
performing lseek by any no. of positions successfully.<br />
written only for SEEK_SET.<br />
performed lseek before write &amp; at the time of read operations.<br />
till now it is working properly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.13<br />
date: 2013/07/16 05:17:19;  author: root;  state: Exp;  lines: +52 -25<br />
implemented lseek when we read after writing to the quantums.<br />
only SEEK_SET implemented in the scull_lseek.<br />
it can seek within the quantum , inter quantum &amp; inter scullqset.<br />
till now it is working correctly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.12<br />
date: 2013/07/15 07:39:03;  author: root;  state: Exp;  lines: +23 -4<br />
coming in different case in scull_lseek according to the request of application.<br />
defined variable new_position to return the value to application &amp; to store the new position after lseek operation in scull_lseek.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11<br />
date: 2013/07/15 06:28:03;  author: root;  state: Exp;  lines: +34 -15<br />
add scull_lseek() to seek the cursor position according to the lseek call in the app.c.<br />
printing offset position &amp; offset type correctly.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<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.<br />
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-4/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-3/</link>
		<comments>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30-3/#comments</comments>
		<pubDate>Thu, 18 Jul 2013 13:56:51 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[to pravjot sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6843</guid>
		<description><![CDATA[RCS file: new_lkm.c,v Working file: new_lkm.c head: 1.18 branch: locks: strict root: 1.18 access list: symbolic names: keyword substitution: kv total revisions: 19;    selected revisions: 19 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-3/">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.18<br />
branch:<br />
locks: strict<br />
root: 1.18<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 19;    selected revisions: 19<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.18    locked by: root;<br />
date: 2013/07/17 13:59:24;  author: root;  state: Exp;  lines: +0 -3<br />
three waste lines deleted .<br />
checked also to add many scullqsets with the previously allocated memory,that was less to write the new request by application.<br />
working successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.17<br />
date: 2013/07/17 13:05:14;  author: root;  state: Exp;  lines: +54 -7<br />
successfully adding some memory when application gives more no. of characters than previously write call after g some positions.<br />
can add some quantums in the previously allocated memory.<br />
till now wprking successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.16<br />
date: 2013/07/16 13:54:00;  author: root;  state: Exp;  lines: +2 -2<br />
working for lseek of more than one quantums also .<br />
till now driver can lseek before write after write .<br />
results are comming correct.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.15<br />
date: 2013/07/16 13:03:18;  author: root;  state: Exp;  lines: +29 -25<br />
working for write ,then again write some data after 5 positions.<br />
reading the whole data after two write operations .<br />
checked only for less than 8 bytes to append.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.14<br />
date: 2013/07/16 11:21:28;  author: root;  state: Exp;  lines: +72 -14<br />
performing lseek by any no. of positions successfully.<br />
written only for SEEK_SET.<br />
performed lseek before write &amp; at the time of read operations.<br />
till now it is working properly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.13<br />
date: 2013/07/16 05:17:19;  author: root;  state: Exp;  lines: +52 -25<br />
implemented lseek when we read after writing to the quantums.<br />
only SEEK_SET implemented in the scull_lseek.<br />
it can seek within the quantum , inter quantum &amp; inter scullqset.<br />
till now it is working correctly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.12<br />
date: 2013/07/15 07:39:03;  author: root;  state: Exp;  lines: +23 -4<br />
coming in different case in scull_lseek according to the request of application.<br />
defined variable new_position to return the value to application &amp; to store the new position after lseek operation in scull_lseek.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11<br />
date: 2013/07/15 06:28:03;  author: root;  state: Exp;  lines: +34 -15<br />
add scull_lseek() to seek the cursor position according to the lseek call in the app.c.<br />
printing offset position &amp; offset type correctly.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<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.<br />
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-3/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-2/</link>
		<comments>https://www.emblogic.com/blog/07/avtar-singh-e-30-01-30-2/#comments</comments>
		<pubDate>Tue, 16 Jul 2013 17:46:41 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[to pravjot sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6812</guid>
		<description><![CDATA[RCS file: new_lkm.c,v Working file: new_lkm.c head: 1.16 branch: locks: strict root: 1.16 access list: symbolic names: keyword substitution: kv total revisions: 17;    selected revisions: 17 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-2/">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.16<br />
branch:<br />
locks: strict<br />
root: 1.16<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 17;    selected revisions: 17<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.16   locked by: root;<br />
date: 2013/07/16 13:54:00;  author: root;  state: Exp;  lines: +2 -2<br />
working for lseek of more than one quantums also .<br />
till now driver can lseek before write after write .<br />
results are comming correct.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.15<br />
date: 2013/07/16 13:03:18;  author: root;  state: Exp;  lines: +29 -25<br />
working for write ,then again write some data after 5 positions.<br />
reading the whole data after two write operations .<br />
checked only for less than 8 bytes to append.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.14<br />
date: 2013/07/16 11:21:28;  author: root;  state: Exp;  lines: +72 -14<br />
performing lseek by any no. of positions successfully.<br />
written only for SEEK_SET.<br />
performed lseek before write &amp; at the time of read operations.<br />
till now it is working properly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.13<br />
date: 2013/07/16 05:17:19;  author: root;  state: Exp;  lines: +52 -25<br />
implemented lseek when we read after writing to the quantums.<br />
only SEEK_SET implemented in the scull_lseek.<br />
it can seek within the quantum , inter quantum &amp; inter scullqset.<br />
till now it is working correctly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.12<br />
date: 2013/07/15 07:39:03;  author: root;  state: Exp;  lines: +23 -4<br />
coming in different case in scull_lseek according to the request of application.<br />
defined variable new_position to return the value to application &amp; to store the new position after lseek operation in scull_lseek.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11<br />
date: 2013/07/15 06:28:03;  author: root;  state: Exp;  lines: +34 -15<br />
add scull_lseek() to seek the cursor position according to the lseek call in the app.c.<br />
printing offset position &amp; offset type correctly.<br />
working successfully till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<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.<br />
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-2/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>
		<item>
		<title>E 30 Avtar Singh</title>
		<link>https://www.emblogic.com/blog/06/e-30-avtar-singh/</link>
		<comments>https://www.emblogic.com/blog/06/e-30-avtar-singh/#comments</comments>
		<pubDate>Tue, 25 Jun 2013 18:55:44 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Project 04: FTP based Client Server using Threads and Sockets]]></category>
		<category><![CDATA[to pravjot sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6602</guid>
		<description><![CDATA[RCS file: server.c,v Working file: server.c head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2;    selected revisions: 2 description: server with one processing client to increment received data by 1. in this threads are &#8230; <a href="https://www.emblogic.com/blog/06/e-30-avtar-singh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: server.c,v<br />
Working file: server.c<br />
head: 1.2<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 2;    selected revisions: 2<br />
description:<br />
server with one processing client to increment received data by 1.<br />
in this threads are invoking processing client for operation.<br />
two message queues is used b/w server &amp; requesting client ,one to send data &amp; 2nd to receive data from thread.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/06/25 18:30:00;  author: root;  state: Exp;  lines: +42 -17<br />
Server with two messege queue ,1st to receive data from clients &amp; 2nd to send processed data from server to requesting client.<br />
In this server invoke thread to give response to the requesting client.<br />
Thread call the processing client through fork and execl call.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/06/25 12:29:16;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/06/e-30-avtar-singh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Data Compression &amp; Encryption</title>
		<link>https://www.emblogic.com/blog/03/multiple-data-compression-encryption-2/</link>
		<comments>https://www.emblogic.com/blog/03/multiple-data-compression-encryption-2/#comments</comments>
		<pubDate>Sun, 03 Mar 2013 11:43:07 +0000</pubDate>
		<dc:creator><![CDATA[Avtar Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://emblogic.org/blog/?p=6250</guid>
		<description><![CDATA[i have completed multiple data compression and decompression&#8230;.]]></description>
				<content:encoded><![CDATA[<p>i have completed multiple data compression and decompression&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/03/multiple-data-compression-encryption-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
