<?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; monika.chahal</title>
	<atom:link href="https://www.emblogic.com/blog/author/monika-chahal/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>30.1.30 : Monika</title>
		<link>https://www.emblogic.com/blog/08/30-1-30-monika-3/</link>
		<comments>https://www.emblogic.com/blog/08/30-1-30-monika-3/#comments</comments>
		<pubDate>Sat, 24 Aug 2013 15:32:17 +0000</pubDate>
		<dc:creator><![CDATA[monika.chahal]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7142</guid>
		<description><![CDATA[Completed next 2 assignments in c, this time with some less problems. Also trying c++ questions and functions.]]></description>
				<content:encoded><![CDATA[<p>Completed next 2 assignments in c, this time with some less problems.</p>
<p>Also trying c++ questions and functions.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/30-1-30-monika-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>30.1.30 : Monika</title>
		<link>https://www.emblogic.com/blog/08/30-1-30-monika-2/</link>
		<comments>https://www.emblogic.com/blog/08/30-1-30-monika-2/#comments</comments>
		<pubDate>Wed, 07 Aug 2013 15:52:16 +0000</pubDate>
		<dc:creator><![CDATA[monika.chahal]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=7051</guid>
		<description><![CDATA[Completed first 6 assignments in C with doubt in some questions and the most difficult which i felt is low-level file i/o in which how do we create a file of a fixed size? Is it related to page size? &#8230; <a href="https://www.emblogic.com/blog/08/30-1-30-monika-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Completed first 6 assignments in C with doubt in some questions and the most difficult which i felt is low-level file i/o in which how do we create a file of a fixed size? Is it related to page size?</p>
<p>Also trying now those assignments with C++..</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/30-1-30-monika-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>30.1.30 : Monika</title>
		<link>https://www.emblogic.com/blog/07/30-1-30-monika/</link>
		<comments>https://www.emblogic.com/blog/07/30-1-30-monika/#comments</comments>
		<pubDate>Sat, 20 Jul 2013 17:33:59 +0000</pubDate>
		<dc:creator><![CDATA[monika.chahal]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6902</guid>
		<description><![CDATA[Character Device Driver I&#8217;ve been working on character device driver since last few days and here i can share what all i have learnt till now. Device drivers are the Loadable Kerenl Modules(LKMs)that can be inserted in the kernel at &#8230; <a href="https://www.emblogic.com/blog/07/30-1-30-monika/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong><em><span style="text-decoration: underline">Character Device Driver</span></em></strong></p>
<p>I&#8217;ve been working on character device driver since last few days and here i can share what all i have learnt till now.</p>
<p>Device drivers are the Loadable Kerenl Modules(LKMs)that can be inserted in the kernel at run time. They act as black boxes and provide a well defined interface for hardware to respond to a specific application code that want to communicate with the hardware. User just gives some specific code through application and to make these commands work in the hardware is the role of device driver.</p>
<p>Character device is the device that can be accessed as character by character, i.e., as stream of bytes as in files.</p>
<p>And characeter driver is the one that handles character devices.</p>
<p>The basic operations that a character driver atleast provides are open, write, read, release.</p>
<p><strong><em><span style="text-decoration: underline">Implementation:</span></em></strong></p>
<p>The very first operation to perform is inserting the driver into kernel when we want to access the device and when our work is done then to remove the module from kernel space. These two operations can be performed using module_init(init_func_name) and module_exit(exit_func_name).The initialisation function and exit function are written separately and passed to these macros.</p>
<p>The next step is to register our driver for any no. of devices using alloc_chrdev_region(). A single driver can handle any no. of devices and therefore to recognise driver and devices major numbers and minor numbers are used.Major no. are used by kernel to recognise the driver and minor no. are used by driver to recognise devices. Major no. and minor no. as a combination are stored in dev_t  datatype that is a 32-bit field with 12 bits for major and rest 20 for minor numbers.Using MAJOR() and MINOR() macros we can take out major and minor numbers from dev_t while if we have them separately we can dev_t using MKDEV().</p>
<p>When inserting the module durimg run time we usually don&#8217;t know the correct major number that is free so we dynamically allocate the major number and minor number and the return type of alloc_chrdev_region() is the first device number for &#8216;n&#8217; number of devices.In exit function we also have to unregister our module using unregister_chrdev_region() by providing the correct device no. and the no. of devices we want to unregister.</p>
<p>As we are working at kernel level so the library functions and header files that were available at user level will not work here. The header files are to be included from kernel directory. Similarly, malloc() function&#8217;s work here is done by kmalloc() function.</p>
<p>The most important structure here is SCULL(simple characetr utility for loading localities). Scull is a character driver that acts on a memory as though it were a device. The entry point to scull is pointer to struct sculldev and sculldev is allocated memory using kmalloc() for nod no. of devices. Struct sculldev has a field struct cdev which is the kernel internal representation of the device and we also have to initilaise this cdev field while setting up the scull.The cdev_init() initialises the cdev, cdev_add() adds the device to the kernel device drivers table and and in exit function we can unregister cdev using cedv_del().There are other fields as well in struct sculldev which are to initialised as their initial values. This also contains a pointer to struct scullqset which are same as linked list and consisits of node poinitg to next scullqset and data field which pints to qsetarray and qset contain pointers to quantums which actually store the data to writen to and read from device&#8217;s memory.</p>
<p>We can map our own operations to the standard function_calls such as open,etc. in struct f_ops which is predefined. Therefore we are supposed to write our own open, write ,read and release functions for our device.The application will communiceta with our device using a node which can be created using mknod macro. All communication will take place through this node between application and device driver and hence device.</p>
<p>Open function should just initialise the device and scull_trim function is used if the device is opened in write only mode.There is a macro &#8216;container_of&#8217; that actually maps our scull onto the device&#8217;s memory by linking inode, cdev and sculldev structure. The resulting sculldev in private_data field of struct file so that the opened sculldev can be used durin write and read.</p>
<p>Write function will actually create scullqset, qsets and quantums depending on the size of data to write. We use a macro &#8216;copy_from_user()&#8217; to write to quantums from the user buffer &amp; this is a very important macro as it prevents application from directly peeping into the kernel and hence provides security.Similarly in read function we use &#8216;copy_to_user()&#8217; to copy from quantums to the user buffer.</p>
<p>Release function just releases all the acquired parameters when the application closes the device.There is a funcion for lseek as well if the user wants to append something to previous data or user wants to read some selected data.</p>
<p>I&#8217;have learnt till here till now and hope that soon i&#8217;ll be able to complete my character driver!!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/30-1-30-monika/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>30.01.30 : Monika &#8211; Char Driver</title>
		<link>https://www.emblogic.com/blog/07/30-01-30-monika-char-driver/</link>
		<comments>https://www.emblogic.com/blog/07/30-01-30-monika-char-driver/#comments</comments>
		<pubDate>Mon, 15 Jul 2013 05:59:02 +0000</pubDate>
		<dc:creator><![CDATA[monika.chahal]]></dc:creator>
				<category><![CDATA[Character Driver]]></category>
		<category><![CDATA[Device Drivers]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6783</guid>
		<description><![CDATA[RCS file: hello.c,v Working file: hello.c head: 1.17 branch: access list: symbolic names: keyword substitution: kv total revisions: 17;    selected revisions: 17 description: Base module. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.17 date: 2013/07/12 07:02:51;  author: user1;  state: Exp;  lines: +35 -6 Modified read() &#8230; <a href="https://www.emblogic.com/blog/07/30-01-30-monika-char-driver/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: hello.c,v<br />
Working file: hello.c<br />
head: 1.17<br />
branch:<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 17;    selected revisions: 17<br />
description:<br />
Base module.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.17<br />
date: 2013/07/12 07:02:51;  author: user1;  state: Exp;  lines: +35 -6<br />
Modified read() function to check for no. of bytes requested for reading to be not greater than bytes actually written<br />
But it is actually checking for no. of quantums not to be greater than no.of quantums actually written.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.16   locked by: user1;<br />
date: 2013/07/11 08:09:20;  author: user1;  state: Exp;  lines: +73 -5<br />
Implemented successfully read() function for any number of bytes using copy_to_user().<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.15<br />
date: 2013/07/11 07:00:44;  author: user1;  state: Exp;  lines: +30 -7<br />
Modified write() function to write in quantums from user buffer.<br />
Implemented for any number of bytes to be written.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.14   locked by: user1;<br />
date: 2013/07/09 09:07:19;  author: user1;  state: Exp;  lines: +61 -21<br />
Added creat_quantums() function.<br />
Working fine till now.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.13<br />
date: 2013/07/09 08:11:40;  author: user1;  state: Exp;  lines: +56 -3<br />
Modified the creat_qset() function to make required no. of qsets.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.12<br />
date: 2013/07/09 07:49:02;  author: user1;  state: Exp;  lines: +168 -1<br />
Calculated no. of quantums, qsets, struct scullqset.<br />
Added creat_scullqset() function.<br />
Added creat_qset() function.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11<br />
date: 2013/07/08 06:54:49;  author: user1;  state: Exp;  lines: +39 -3<br />
Added opencount to struct sculldev.<br />
Mapped scull_read() and scull_read().<br />
Scull_trim function modified.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<br />
date: 2013/07/04 06:31:35;  author: user1;  state: Exp;  lines: +23 -0<br />
Used macro container_of for mapping memory of device.<br />
Preserved the mapping using private_data field of struct file.<br />
Added scull_trim function for devices opened with write only.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2013/07/02 07:24:47;  author: user1;  state: Exp;  lines: +1 -0<br />
Used memset for sculldev after kmalloc.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2013/07/02 07:05:06;  author: user1;  state: Exp;  lines: +14 -0<br />
Declared scull_open() , scull_release() functions.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2013/07/02 06:23:12;  author: user1;  state: Exp;  lines: +55 -24<br />
Added definition of scull_init function for initialisation of struct sculldev.<br />
Added scull_setup_cdev for cdev_add function.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2013/07/02 05:57:06;  author: user1;  state: Exp;  lines: +15 -17<br />
Edited major no. value and scull pointer double pointer to single pointer.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2013/07/01 10:38:35;  author: user1;  state: Exp;  lines: +32 -2<br />
Used kalloc to allocate memory to sculldev pointer variable.<br />
Added the number of devices to the kernel device table using cdev_init,cdev_add.<br />
Deleted them using cdev_del in cleanup code.<br />
Free the memory using kfree.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2013/07/01 08:36:32;  author: user1;  state: Exp;  lines: +23 -26<br />
Registered device driver using alloc_chrdev_region and register_chrdev_region for 1 device.<br />
Unregistered the driver in cleanup code using unregister_chrdev_region.<br />
Used MAJOR , MINOR , MKDEV macros for major no. and minor no.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2013/06/30 06:23:26;  author: user1;  state: Exp;  lines: +12 -1<br />
Added register_chrdev function in initialisation_code function to register the driver.<br />
Added unregister_chrdev in cleanup_code to unregister the driver.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2013/06/30 06:08:23;  author: user1;  state: Exp;  lines: +8 -7<br />
Added header.h file.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2013/06/29 09:53:23;  author: user1;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/30-01-30-monika-char-driver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E30:Monika</title>
		<link>https://www.emblogic.com/blog/06/e30monika/</link>
		<comments>https://www.emblogic.com/blog/06/e30monika/#comments</comments>
		<pubDate>Wed, 26 Jun 2013 11:27:58 +0000</pubDate>
		<dc:creator><![CDATA[monika.chahal]]></dc:creator>
				<category><![CDATA[Project 04: FTP based Client Server using Threads and Sockets]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=6617</guid>
		<description><![CDATA[RCS file: server.c,v Working file: server.c head: 1.1 branch: locks: strict user1: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1;     selected revisions: 1 description: This is client-server based implementation of multiple threads. It is implemented using msgqueues &#8230; <a href="https://www.emblogic.com/blog/06/e30monika/">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.1<br />
branch:<br />
locks: strict<br />
user1: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;     selected revisions: 1<br />
description:<br />
This is client-server based implementation of multiple threads.<br />
It is implemented using msgqueues and shared memory.<br />
Client sends request to server using msgqueue.<br />
for every request server creates a thread which then separately handles the client.<br />
Thread invokes a processing client and gets the result using shared memory.<br />
It then returns the result to client using msgqueue.<br />
Thread is detached from main-thread.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1    locked by: user1;<br />
date: 2013/06/26 11:14:56;  author: user1;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/06/e30monika/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Batch E-29: Project 09: An Embedded Linux,ARM Cortex A8 using storage based project</title>
		<link>https://www.emblogic.com/blog/03/batch-e-29-project-09-an-embedded-linuxarm-cortex-a8-using-storage-based-project/</link>
		<comments>https://www.emblogic.com/blog/03/batch-e-29-project-09-an-embedded-linuxarm-cortex-a8-using-storage-based-project/#comments</comments>
		<pubDate>Tue, 26 Mar 2013 09:23:34 +0000</pubDate>
		<dc:creator><![CDATA[monika.chahal]]></dc:creator>
				<category><![CDATA[Project 9: Embedded Linux on ARM]]></category>

		<guid isPermaLink="false">http://emblogic.org/blog/?p=6318</guid>
		<description><![CDATA[Porting Embedded Linux onto ARM based Limited Resources Devices]]></description>
				<content:encoded><![CDATA[<p>Porting Embedded Linux onto ARM based Limited Resources Devices</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/03/batch-e-29-project-09-an-embedded-linuxarm-cortex-a8-using-storage-based-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
