LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-17-2010, 02:02 PM   #1
nakul.k1
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Rep: Reputation: 0
Smile character device doubt


hello every one

i have a doubt on how the data is written and read to and from the character device . i need the complete sequence in few words of which structures are involved and which function is involved untill data is written to the actual hardware


let us assume there is a character device and this is not memory mapped in the kernel space
so my flow would be like this

ioctl(CMD=WRITE) --- system call --- ioctl(CMD=WRITE)
userspace ------------------------->kernelspace------------->

i have show a diagram above which says userspace ioctl call with cmd=WRITE executes kernel space ioctl(CMD=WRITE) present in file_operations structure. after this i wanted to know what are the functions executed so that the data is actually written on the hardware device.
can any one reply to me with your answer.

Nakul
 
Old 10-21-2010, 06:58 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Read up:
Code:
cd /usr/src/linux-<your_version>/Documentation/driver-model

and
http://tldp.org/LDP/lkmpg/2.6/html/x569.html
 
Old 10-22-2010, 06:32 AM   #3
nakul.k1
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Original Poster
Rep: Reputation: 0
that is not what i was looking at anisha basically how the interaction happen with the character device the one you shown is just a layer above it but i wanted to know what happens when you want read write on the device
 
Old 10-22-2010, 09:13 AM   #4
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
do you mean you want to see the assembly code for the same then, i.e. how the registers are set etc ?
 
Old 10-23-2010, 10:12 AM   #5
nakul.k1
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Original Poster
Rep: Reputation: 0
hello anisha
see i was mainly looking at

every device in the kernel space is represented by a struct device and then it has a struct device_driver and then there is a struct bus_driver now i wanted to know how the file_operations structure communicates with this struct device_driver and then struct bus_driver to write the data on the character device .

Nakul
 
Old 10-24-2010, 11:17 PM   #6
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
I don't know whether I have understood you clearly or not but if you want to know the communications between these internal structures of the device drivers then I think you'll have to read definitions of those functions which are responsible for the same.
 
Old 10-26-2010, 03:17 PM   #7
nakul.k1
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Original Poster
Rep: Reputation: 0
yeps agreed done
Thanks a lot for the help

Nakul
 
Old 10-26-2010, 10:17 PM   #8
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
If you are not joking then I request you to post here exactly what function definitions of what structures did you read.
 
Old 10-27-2010, 02:43 PM   #9
nakul.k1
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Original Poster
Rep: Reputation: 0
hello anisha

why will i joke

i mean view it from a hardware perspective that is not mapped using ioremap for that how a file_operations structure communicates with the struct device

first let me make my self clear do you agree every char device at the low level is represented my struct device yes or no.


Nakul
 
Old 10-27-2010, 11:58 PM   #10
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
Not every device has a bus driver.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux device drivers : how can i unregister a character device ? zampa Linux - General 5 06-21-2012 05:34 AM
[SOLVED] Character device mounting Dufresne Programming 10 04-01-2010 03:37 AM
Difference between using Raw block device with O_DIRECT and Raw Character Device srithi Linux - Newbie 1 08-19-2009 10:52 AM
Difference between Block device and Character device quartslove Fedora 2 11-29-2006 08:50 PM
Doubt in char device driver for linux 2.6 tomkaith13 Programming 6 11-27-2006 04:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration