<?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; Vikram Sharma</title>
	<atom:link href="https://www.emblogic.com/blog/author/vikram007/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>sysfs</title>
		<link>https://www.emblogic.com/blog/02/sysfs-2/</link>
		<comments>https://www.emblogic.com/blog/02/sysfs-2/#comments</comments>
		<pubDate>Mon, 17 Feb 2014 06:58:11 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=8401</guid>
		<description><![CDATA[#include #include #include #include #include #include #include #include #include MODULE_LICENSE(&#8220;GPL&#8221;); MODULE_AUTHOR(&#8220;KERNEL_CODE&#8221;); #define DEBUG #define NAME &#8220;char_dev&#8221; #define NODE 5 #define SCULL_MAJOR 0 #define SCULL_MINOR 0 #define QUANTUM 8 #define SIZE 0 #define QSET 8 #define DEV_SIZE 1024 #define DEVICE_NAME &#8220;char_dev&#8221; &#8230; <a href="https://www.emblogic.com/blog/02/sysfs-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include<br />
#include<br />
#include<br />
#include<br />
#include<br />
#include<br />
#include<br />
#include<br />
#include </p>
<p>MODULE_LICENSE(&#8220;GPL&#8221;);<br />
MODULE_AUTHOR(&#8220;KERNEL_CODE&#8221;);</p>
<p>#define DEBUG<br />
#define NAME &#8220;char_dev&#8221;<br />
#define NODE 5<br />
#define SCULL_MAJOR 0<br />
#define SCULL_MINOR 0<br />
#define QUANTUM 8<br />
#define SIZE 0<br />
#define QSET 8<br />
#define DEV_SIZE 1024<br />
#define DEVICE_NAME &#8220;char_dev&#8221;<br />
#define CLASS_NAME &#8220;scull&#8221;</p>
<p>static int scull_minor = SCULL_MINOR;<br />
static int scull_major = SCULL_MAJOR;<br />
static struct class* scull_class = NULL;<br />
static struct device* scull_device = NULL;<br />
int size = SIZE;<br />
int qset = QSET;<br />
int quantum = QUANTUM;</p>
<p>struct Scull_qset{<br />
	struct Scull_qset *next;<br />
	void **data1;<br />
};<br />
dev_t dev;</p>
<p>struct Scull_dev{<br />
	struct Scull_qset *data;<br />
	int quantum;<br />
	int qset;<br />
	int device_size;<br />
	int data_size;<br />
	struct cdev cdev;<br />
};</p>
<p>struct Scull_dev *scull_dev;<br />
const struct file_operations fops=<br />
{};</p>
<p>struct inode *finode;<br />
struct file *ffile;</p>
<p>/***********************************************************************************/<br />
/* sysfs entry for 1st operation *//*we can pass the arguments we need*/<br />
static ssize_t sys_entry1(struct device* dev, struct device_attribute* attr, const char* buf, size_t count)<br />
{<br />
	#ifdef DEBUG<br />
	printk(KERN_INFO &#8221; string from user is%s\n&#8221;,buf);<br />
	#endif<br />
 return count;<br />
}</p>
<p>/* Declare the sysfs entries. The macros create instances of dev_attr_fifo and dev_attr_reset */<br />
static DEVICE_ATTR(entry, S_IWUSR, NULL, sys_entry1);<br />
/***********************************************************************************/</p>
<p>static int __init hello_world(void){</p>
<p>	int retval;</p>
<p>	retval =  alloc_chrdev_region(&amp;dev,scull_minor,NODE,DEVICE_NAME);<br />
	scull_minor = MINOR(dev);<br />
        scull_major = MAJOR(dev);<br />
	scull_dev = kmalloc(NODE*sizeof(struct Scull_dev),GFP_KERNEL);<br />
       	memset(scull_dev,&#8221;,sizeof(struct Scull_dev));</p>
<p>/*  	use a &#8220;virtual&#8221; device class. */<br />
	scull_class = class_create(THIS_MODULE, CLASS_NAME);<br />
       	printk(KERN_DEBUG&#8221;register device class &#8216;%s&#8217;\n&#8221;, CLASS_NAME);<br />
		if (!scull_class) {<br />
       		printk(KERN_DEBUG&#8221;register device class &#8216;%s&#8217;\n&#8221;, CLASS_NAME);<br />
		  goto OUT;<br />
		 }</p>
<p>	/* With a class, the easiest way to instantiate a device is to call device_create() */<br />
	scull_device = device_create(scull_class, NULL, MKDEV(scull_major, 0), NULL, CLASS_NAME &#8220;_&#8221; DEVICE_NAME);<br />
		if (!scull_device) {<br />
       		printk(KERN_DEBUG&#8221;register device class &#8216;%s&#8217;\n&#8221;, DEVICE_NAME);<br />
		  goto OUT;<br />
		 }</p>
<p>/* 	dev_attr_entry come from the DEVICE_ATTR(&#8230;) earlier */<br />
	retval = device_create_file(scull_device, &amp;dev_attr_entry);<br />
	if (retval cdev,&amp;fops);<br />
	scull_dev-&gt;quantum = quantum;<br />
	scull_dev-&gt;qset = qset;<br />
	scull_dev-&gt;device_size= size;<br />
	scull_dev-&gt;cdev.owner = THIS_MODULE;<br />
	scull_dev-&gt;cdev.ops = &amp;fops;<br />
	retval = cdev_add(&amp;scull_dev-&gt;cdev,dev, NODE);<br />
		if(retvalcdev);<br />
kfree(scull_dev);<br />
device_remove_file(scull_device, &amp;dev_attr_entry);<br />
device_destroy(scull_class, MKDEV(scull_major, 0));<br />
class_unregister(scull_class);<br />
class_destroy(scull_class);<br />
	#ifdef DEBUG<br />
	printk(KERN_INFO&#8221;cha_device unregistration from fun  %s\n&#8221;,__func__);<br />
	printk(KERN_INFO&#8221;BYE BYE \n&#8221;);<br />
	#endif<br />
}</p>
<p>module_init(hello_world);<br />
module_exit(hello_exit);</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/02/sysfs-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to GRUB</title>
		<link>https://www.emblogic.com/blog/12/introduction-to-grub/</link>
		<comments>https://www.emblogic.com/blog/12/introduction-to-grub/#comments</comments>
		<pubDate>Mon, 30 Dec 2013 07:50:04 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7925</guid>
		<description><![CDATA[Briefly, a boot loader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to an operating system kernel software (such as Linux or GNU Mach). The kernel, in turn, initializes &#8230; <a href="https://www.emblogic.com/blog/12/introduction-to-grub/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Briefly, a boot loader is the first software program that runs when a computer starts. It<br />
is responsible for loading and transferring control to an operating system kernel software<br />
(such as Linux or GNU Mach). The kernel, in turn, initializes the rest of the operating<br />
system (e.g. a GNU system).<br />
GNU GRUB is a very powerful boot loader, which can load a wide variety of free<br />
operating systems, as well as proprietary operating systems with chain-loading. GRUB<br />
is designed to address the complexity of booting a personal computer; both the program<br />
and this manual are tightly bound to that computer platform, although porting to other<br />
platforms may be addressed in the future.<br />
One of the important features in GRUB is flexibility; GRUB understands filesystems<br />
and kernel executable formats, so you can load an arbitrary operating system the way you like, without recording the physical position of your kernel on the disk. Thus you can load <span style="font-size: 16px">the kernel </span><span style="font-size: 16px">just by specifying its file name and the drive and partition where the kernel </span><span style="font-size: 16px">resides.</span></p>
<p><span style="font-size: 16px">GRUB features</span></p>
<p>The primary requirement for GRUB is that it be compliant with the Multiboot Specification, which is described in Section “Motivation” in The Multiboot Specification.<br />
The other goals, listed in approximate order of importance, are:<br />
 Basic functions must be straightforward for end-users.<br />
 Rich functionality to support kernel experts and designers.<br />
 Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are supported via a chain-loading function.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/12/introduction-to-grub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Article:Character Driver</title>
		<link>https://www.emblogic.com/blog/12/articlecharacter-driver/</link>
		<comments>https://www.emblogic.com/blog/12/articlecharacter-driver/#comments</comments>
		<pubDate>Thu, 05 Dec 2013 12:13:57 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

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

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7517</guid>
		<description><![CDATA[Serial Interface is one of the most commonly used interface in Embedded Systems, during development and in field also. Almost every machine have a serial port over it. So that it could be connected to some peripheral or another Embedded &#8230; <a href="https://www.emblogic.com/blog/11/serial-communication/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Serial Interface is one of the most commonly used interface in Embedded Systems, during development and in field also. Almost every machine have a serial port over it. So that it could be connected to some peripheral or another Embedded System.</p>
<p>Types of Serial Communication:</p>
<p>1)Synchronous: In Master/Slave interface, both master and slave are driven with same clock(master clock). So this interface is termed as synchronous.<br />
2)Asynchronous: In Point to Point or peer interfaces clock need not to be synchronized between DTE(Data Terminal Equipment) and DCE(Data Communication Equipment). Most of the peer interfaces are asynchronous.</p>
<p>Why Serial???</p>
<p>As every Embedded System has to communicate with external world, it could be some peripheral device or another system for debugging purpose. And Serial interface serves as the best due to many reasons.</p>
<p>1)Small number of pins needed (2 or 3).<br />
2)Availability of different protocols for different interfaces.<br />
3)Good for long distance communication.<br />
4)High Speed.</p>
<p>Protocols:</p>
<p>There are many different serial protocols for different interfaces. Most popular ones are,<br />
RS232, SPI, I2C CAN. Depending upon the application we can select the most appropriate one.<br />
RS232 is commonly used for debugging purpose. Max possible speed is 115.2 kbps.<br />
SPI(Serial Peripheral Interface) is as its name suggest used to interface peripherals. It is a Mater/Slave Synchronous protocol.<br />
I2C(Inter IC) is commonly used to interface, on board peripherals(IC). It is a multi master synchronous protocol.<br />
CAN is used for Inter MCU(micro controller unit) communication in a System. For example it is used in vehicle where number of MCUs are used to serve different purposes.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/11/serial-communication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bus Error (Core Dumped):</title>
		<link>https://www.emblogic.com/blog/10/bus-error-core-dumped/</link>
		<comments>https://www.emblogic.com/blog/10/bus-error-core-dumped/#comments</comments>
		<pubDate>Mon, 07 Oct 2013 09:29:59 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Dheeraj sir]]></category>
		<category><![CDATA[Jasmeen ma'am]]></category>
		<category><![CDATA[Siddharth sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7297</guid>
		<description><![CDATA[I was checking the size of the stack space allocated to a process. For that i used recursion and I got Seg fault after almost 8 MB(7.98 MB) of data pushed on to the stack. Then I increased the size &#8230; <a href="https://www.emblogic.com/blog/10/bus-error-core-dumped/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I was checking the size of the stack space allocated to a process. For that i used recursion and I got Seg fault after almost 8 MB(7.98 MB) of data pushed on to the stack.</p>
<p>Then I increased the size of Stack to 256 MB  (using system call setrlimit()) now i am getting an error i.e Bus error (core dumped)&#8230;</p>
<p>I googled for this error but still i am not getting what actually caused this???</p>
<p>How is this different from Segmentation fault????</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/10/bus-error-core-dumped/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Query:</title>
		<link>https://www.emblogic.com/blog/10/query-2/</link>
		<comments>https://www.emblogic.com/blog/10/query-2/#comments</comments>
		<pubDate>Sun, 06 Oct 2013 12:34:49 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Dheeraj sir]]></category>
		<category><![CDATA[Jasmeen ma'am]]></category>
		<category><![CDATA[Siddharth sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7289</guid>
		<description><![CDATA[At what stage of compiler the call of an inline function is replaced with its definition???? &#160;]]></description>
				<content:encoded><![CDATA[<p>At what stage of compiler the call of an inline function is replaced with its definition????</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/10/query-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Threads:</title>
		<link>https://www.emblogic.com/blog/10/threads-2/</link>
		<comments>https://www.emblogic.com/blog/10/threads-2/#comments</comments>
		<pubDate>Thu, 03 Oct 2013 08:33:16 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Project 04: FTP based Client Server using Threads and Sockets]]></category>
		<category><![CDATA[Dheeraj sir]]></category>
		<category><![CDATA[jasmeen mam]]></category>
		<category><![CDATA[Siddharth sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7245</guid>
		<description><![CDATA[Can we manually switch between two Threads of a process ?? Means, is it possible to context out a running thread and context in a user desired thread, at any time????]]></description>
				<content:encoded><![CDATA[<p>Can we manually switch between two Threads of a process ?? Means, is it possible to context out a running thread and context in a user desired thread, at any time????</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/10/threads-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E 30:01:30 Vikram Sharma</title>
		<link>https://www.emblogic.com/blog/07/e-300130-vikram-sharma-2/</link>
		<comments>https://www.emblogic.com/blog/07/e-300130-vikram-sharma-2/#comments</comments>
		<pubDate>Sat, 20 Jul 2013 12:23:37 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>
		<category><![CDATA[Mr.Pravjot Singh]]></category>

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

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6864</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; #include&#60;stdlib.h&#62; int main() { void *ptr; char i; ptr = malloc(sizeof(int ) * 5); for(i = 0; i&#60;(sizeof(int) * 5); i++) { *(int *)(ptr + i) = i; printf(&#8221; ptr + %d = %p\t %d\n&#8221;, i, (ptr + i &#8230; <a href="https://www.emblogic.com/blog/07/pointers-4/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;stdlib.h&gt;</p>
<p>int main()<br />
{<br />
void *ptr;</p>
<p>char i;</p>
<p>ptr = malloc(sizeof(int ) * 5);</p>
<p>for(i = 0; i&lt;(sizeof(int) * 5); i++)<br />
{<br />
*(int *)(ptr + i) = i;<br />
printf(&#8221; ptr + %d = %p\t %d\n&#8221;, i, (ptr + i &#8211; 1), *(int *)(ptr + i &#8211; 1));<br />
}<br />
return 0;<br />
}</p>
</div>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/pointers-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E 30:01:30 Vikram Sharma</title>
		<link>https://www.emblogic.com/blog/07/e-300130-vikram-sharma/</link>
		<comments>https://www.emblogic.com/blog/07/e-300130-vikram-sharma/#comments</comments>
		<pubDate>Tue, 16 Jul 2013 17:35:38 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>
		<category><![CDATA[to pravjot sir]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6810</guid>
		<description><![CDATA[CS file: ./ch_d.c,v Working file: ./ch_d.c head: 1.15 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 15;    selected revisions: 15 description: Basic Driver Arch. with cdev initionlized &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.15 date: 2013/07/16 23:23:14;  author: vikram;  state: &#8230; <a href="https://www.emblogic.com/blog/07/e-300130-vikram-sharma/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>CS file: ./ch_d.c,v<br />
Working file: ./ch_d.c<br />
head: 1.15<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 15;    selected revisions: 15<br />
description:<br />
Basic Driver Arch. with cdev initionlized<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.15<br />
date: 2013/07/16 23:23:14;  author: vikram;  state: Exp;  lines: +10 -1<br />
Problem While reading second Qset&#8230;&#8230;.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.14<br />
date: 2013/07/16 21:37:09;  author: vikram;  state: Exp;  lines: +54 -20<br />
problem While Reading Multiple qsets.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.13<br />
date: 2013/07/16 16:27:32;  author: vikram;  state: Exp;  lines: +35 -16<br />
lseek Implemented compltly on Write.<br />
still have to implement for read.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.12<br />
date: 2013/07/15 21:47:38;  author: vikram;  state: Exp;  lines: +9 -5<br />
lseek partially working.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11<br />
date: 2013/07/15 19:55:12;  author: vikram;  state: Exp;  lines: +69 -5<br />
partially implemented lseek.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<br />
date: 2013/07/13 17:56:16;  author: vikram;  state: Exp;  lines: +26 -12<br />
read done for Now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2013/07/13 15:03:39;  author: vikram;  state: Exp;  lines: +56 -2<br />
my_read mapped and implemented properly.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2013/07/11 22:50:38;  author: vikram;  state: Exp;  lines: +62 -0<br />
mapped my_read&#8230;..copy_to_user, still to be implemented.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2013/07/11 18:14:14;  author: vikram;  state: Exp;  lines: +0 -1<br />
Written 300+ Bytes in ScullDev.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2013/07/11 17:46:13;  author: vikram;  state: Exp;  lines: +113 -7<br />
Written Over Kernel Space.<br />
for multiple quantums.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/07/10 17:25:17;  author: vikram;  state: Exp;  lines: +1 -1<br />
create_scullqset Implemented.<br />
create_qset implimented.<br />
create_quantum Implemented<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/07/10 15:41:12;  author: vikram;  state: Exp;  lines: +178 -3<br />
create quantum done<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/07/08 20:24:35;  author: vikram;  state: Exp;  lines: +80 -3<br />
my_write implemented.<br />
scull_trim implemented.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/07/05 22:13:30;  author: vikram;  state: Exp;  lines: +32 -2<br />
maped open and release with my_open and my_close.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/07/04 01:38:08;  author: vikram;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/e-300130-vikram-sharma/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E 30: Vikram Sharma</title>
		<link>https://www.emblogic.com/blog/06/e-30-vikram-sharma-2/</link>
		<comments>https://www.emblogic.com/blog/06/e-30-vikram-sharma-2/#comments</comments>
		<pubDate>Wed, 26 Jun 2013 05:19:49 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></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=6609</guid>
		<description><![CDATA[&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.5 date: 2013/06/26 14:31:12;  author: vikram;  state: Exp;  lines: +27 -12 300 Clients Served Successfully. with NO changes. fro version 1.4. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-]]></description>
				<content:encoded><![CDATA[<div>
<div>
<div>
<div>
<form action="post.php" method="post" name="post">
<div>
<div>
<div>
<div>
<div>
<div></div>
<div>
<table id="content_tbl" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>
<table id="content_toolbar1" cellspacing="0" cellpadding="0" align="">
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<table id="content_spellchecker" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<table id="post-status-info" cellspacing="0">
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/06/26 14:31:12;  author: vikram;  state: Exp;  lines: +27 -12<br />
300 Clients Served Successfully.<br />
with NO changes.<br />
fro version 1.4.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</div>
</div>
</div>
</div>
</form>
</div>
<form action="" method="get"></form>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/06/e-30-vikram-sharma-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E 30: Vikram Sharma</title>
		<link>https://www.emblogic.com/blog/06/e-30-vikram-sharma/</link>
		<comments>https://www.emblogic.com/blog/06/e-30-vikram-sharma/#comments</comments>
		<pubDate>Tue, 25 Jun 2013 18:02:52 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></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=6600</guid>
		<description><![CDATA[RCS file: ./server.c,v Working file: server.c head: 1.4 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 4;    selected revisions: 4 description: Initial server.c But some BUGS. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.4 date: 2013/06/26 03:13:53;  author: vikram;  state: Exp;  &#8230; <a href="https://www.emblogic.com/blog/06/e-30-vikram-sharma/">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.4<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 4;    selected revisions: 4<br />
description:<br />
Initial server.c<br />
But some BUGS.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/06/26 03:13:53;  author: vikram;  state: Exp;  lines: +45 -19<br />
Used exclusive fifo for each Processing Client.<br />
Still need to work on this.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/06/25 22:39:48;  author: vikram;  state: Exp;  lines: +2 -2<br />
Server working Good for exclusive clients.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/06/25 22:17:58;  author: vikram;  state: Exp;  lines: +2 -0<br />
fetching proper Req from client.<br />
 <img src="https://www.emblogic.com/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/06/25 21:42:34;  author: vikram;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/06/e-30-vikram-sharma/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project 03</title>
		<link>https://www.emblogic.com/blog/04/project-03/</link>
		<comments>https://www.emblogic.com/blog/04/project-03/#comments</comments>
		<pubDate>Mon, 01 Apr 2013 17:41:32 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6326</guid>
		<description><![CDATA[While we Duplicate a process using fork(); what exectly happens 1) child process shares the parent&#8217;s process context??? or 2)child is provided with a new copy of parent&#8217;s process context???]]></description>
				<content:encoded><![CDATA[<p>While we Duplicate a process using fork(); what exectly happens</p>
<p>1) child process shares the parent&#8217;s process context???</p>
<p>or</p>
<p>2)child is provided with a new copy of parent&#8217;s process context???</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/04/project-03/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Project 01</title>
		<link>https://www.emblogic.com/blog/03/project-01-9/</link>
		<comments>https://www.emblogic.com/blog/03/project-01-9/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 06:09:35 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://emblogic.org/blog/?p=6272</guid>
		<description><![CDATA[Multiple data Compression and Decompression Done&#8230;..for all code lengths.]]></description>
				<content:encoded><![CDATA[<p>Multiple data Compression and Decompression Done&#8230;..for all code lengths.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/03/project-01-9/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Project 01</title>
		<link>https://www.emblogic.com/blog/02/project-01-7/</link>
		<comments>https://www.emblogic.com/blog/02/project-01-7/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 06:44:54 +0000</pubDate>
		<dc:creator><![CDATA[Vikram Sharma]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://emblogic.org/blog/?p=6227</guid>
		<description><![CDATA[I am facing a Problem when i am creating a file manually like using command vim filename&#8230;.size of the file is one greater than the no of bytes(charcters) in the file&#8230;while checking what exactly that last byte is, i found &#8230; <a href="https://www.emblogic.com/blog/02/project-01-7/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I am facing a Problem</p>
<p>when i am creating a file manually like using command vim filename&#8230;.size of the file is one greater than the no of bytes(charcters) in the file&#8230;while checking what exactly that last byte is, i found that is EOLine (10 in decimal)..</p>
<p>But if i creat a file using c library function open and write, the size is exactly equal to the no of bytes in file&#8230;.Why is it so?????</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/02/project-01-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
