public inbox for gentoo-embedded@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-embedded] writing device drivers howto
@ 2006-08-22 13:37 andreas.sumper
  2006-08-22 14:02 ` Natanael Copa
  2006-08-22 14:48 ` Kelly Price
  0 siblings, 2 replies; 6+ messages in thread
From: andreas.sumper @ 2006-08-22 13:37 UTC (permalink / raw
  To: gentoo-embedded

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

Hi list!

This is some sort of offtopic, but I guess this is the best point to ask.
I have an embedded system running linux. I need to access some special 
registers (e.g. containing the clock cycles, ...) So I managed to write a 
very simple module, which is able to access the registers. But what makes 
me worrying now, is the way, I have to get the data into my user-space 
application. Is there some documentation, concerning writing device 
drivers and accessing them from the user space anywhere? I found some 
documentation, but either I did not understand the part about getting data 
from kernel space into user space, or it was just simply missing.

Maybe anyone here can help me out!

Thanks in advance and kind regards!

Bye,
Andy

[-- Attachment #2: Type: text/html, Size: 1047 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [gentoo-embedded] writing device drivers howto
@ 2006-08-22 13:54 Morgan, Austin D.
  2006-08-22 18:50 ` Walter Goossens
  0 siblings, 1 reply; 6+ messages in thread
From: Morgan, Austin D. @ 2006-08-22 13:54 UTC (permalink / raw
  To: gentoo-embedded

The book Linux Device Drivers is my favorite reference for this type of
question.  You can purchase it from anyone who has OReilly books, or
download it since it is published under Creative Commons.  The newest
version is 3rd ed.

Austin Morgan


-----Original Message-----
From: gentoo-embedded+bounces-1145-AUSTIN.D.MORGAN=saic.com@gentoo.org on
behalf of andreas.sumper@cnsystems.at
Sent: Tue 8/22/2006 8:37 AM
To: gentoo-embedded@lists.gentoo.org
Subject: [gentoo-embedded] writing device drivers howto
 
Hi list!

This is some sort of offtopic, but I guess this is the best point to ask.
I have an embedded system running linux. I need to access some special 
registers (e.g. containing the clock cycles, ...) So I managed to write a 
very simple module, which is able to access the registers. But what makes 
me worrying now, is the way, I have to get the data into my user-space 
application. Is there some documentation, concerning writing device 
drivers and accessing them from the user space anywhere? I found some 
documentation, but either I did not understand the part about getting data 
from kernel space into user space, or it was just simply missing.

Maybe anyone here can help me out!

Thanks in advance and kind regards!

Bye,
Andy

-- 
gentoo-embedded@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-embedded] writing device drivers howto
  2006-08-22 13:37 [gentoo-embedded] writing device drivers howto andreas.sumper
@ 2006-08-22 14:02 ` Natanael Copa
  2006-08-22 14:48 ` Kelly Price
  1 sibling, 0 replies; 6+ messages in thread
From: Natanael Copa @ 2006-08-22 14:02 UTC (permalink / raw
  To: gentoo-embedded

On Tue, 2006-08-22 at 15:37 +0200, andreas.sumper@cnsystems.at wrote:
> 
> Hi list! 
> 
> This is some sort of offtopic, but I guess this is the best point to
> ask.
> I have an embedded system running linux. I need to access some special
> registers (e.g. containing the clock cycles, ...) So I managed to
> write a very simple module, which is able to access the registers. But
> what makes me worrying now, is the way, I have to get the data into my
> user-space application. Is there some documentation, concerning
> writing device drivers and accessing them from the user space
> anywhere? I found some documentation, but either I did not understand
> the part about getting data from kernel space into user space, or it
> was just simply missing. 
> 
> Maybe anyone here can help me out! 
> 
> Thanks in advance and kind regards! 
> 

I don't have much experience with kernel development but I think you
need a device in /dev that you can control with ioctl to communicate
with the module.

I looked into how to access the md5/sha1/sha256 kernel modules and I
concluded that a /dev/crypto was needed. Someone had made a patch for it
but it doesn look like it will go into main kernel so I gave it up.

You can look how he did. google for cryptodev.

> Bye, 
> Andy

--
Natanael Copa

-- 
gentoo-embedded@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-embedded] writing device drivers howto
  2006-08-22 13:37 [gentoo-embedded] writing device drivers howto andreas.sumper
  2006-08-22 14:02 ` Natanael Copa
@ 2006-08-22 14:48 ` Kelly Price
  1 sibling, 0 replies; 6+ messages in thread
From: Kelly Price @ 2006-08-22 14:48 UTC (permalink / raw
  To: gentoo-embedded

On 8/22/06, andreas.sumper@cnsystems.at <andreas.sumper@cnsystems.at> wrote:
> This is some sort of offtopic, but I guess this is the best point to ask.
> I have an embedded system running linux. I need to access some special
> registers (e.g. containing the clock cycles, ...) So I managed to write a
> very simple module, which is able to access the registers. But what makes me
> worrying now, is the way, I have to get the data into my user-space
> application. Is there some documentation, concerning writing device drivers
> and accessing them from the user space anywhere? I found some documentation,
> but either I did not understand the part about getting data from kernel
> space into user space, or it was just simply missing.
>

Check the Linux Journal on Miscellaneous Character Devices.  There's
an article there you can use to base your work on.

-- 
Kelly "STrRedWolf" Price
http://strredwolf.furrynet.com
-- 
gentoo-embedded@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-embedded] writing device drivers howto
  2006-08-22 13:54 Morgan, Austin D.
@ 2006-08-22 18:50 ` Walter Goossens
  2006-08-22 19:15   ` Vladimir Pouzanov
  0 siblings, 1 reply; 6+ messages in thread
From: Walter Goossens @ 2006-08-22 18:50 UTC (permalink / raw
  To: gentoo-embedded

Morgan, Austin D. wrote:
> The book Linux Device Drivers is my favorite reference for this type of
> question.  You can purchase it from anyone who has OReilly books, or
> download it since it is published under Creative Commons.  The newest
> version is 3rd ed.
>
> Austin Morgan
>
>   
That's one of my favorite reads...
You can also (ab)use the /proc filesystem for your module. I used this 
quite a lot and it is easier to use when then the /dev filesystem.
You could also use the /sys filesystem but I have no experience with that...
I'm not sure if it's a good design practice to the /proc filesystem a 
lot (There both people encouraging and discouraging it...) but I found 
it a very easy way to talk to userspace!

Anyway find the book here:
http://lwn.net/Kernel/LDD3/
It is usable both as a reference and as a tutorial!

Greetz Walter Goossens
> -----Original Message-----
> From: gentoo-embedded+bounces-1145-AUSTIN.D.MORGAN=saic.com@gentoo.org on
> behalf of andreas.sumper@cnsystems.at
> Sent: Tue 8/22/2006 8:37 AM
> To: gentoo-embedded@lists.gentoo.org
> Subject: [gentoo-embedded] writing device drivers howto
>  
> Hi list!
>
> This is some sort of offtopic, but I guess this is the best point to ask.
> I have an embedded system running linux. I need to access some special 
> registers (e.g. containing the clock cycles, ...) So I managed to write a 
> very simple module, which is able to access the registers. But what makes 
> me worrying now, is the way, I have to get the data into my user-space 
> application. Is there some documentation, concerning writing device 
> drivers and accessing them from the user space anywhere? I found some 
> documentation, but either I did not understand the part about getting data 
> from kernel space into user space, or it was just simply missing.
>
> Maybe anyone here can help me out!
>
> Thanks in advance and kind regards!
>
> Bye,
> Andy
>
>   

-- 
gentoo-embedded@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-embedded] writing device drivers howto
  2006-08-22 18:50 ` Walter Goossens
@ 2006-08-22 19:15   ` Vladimir Pouzanov
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Pouzanov @ 2006-08-22 19:15 UTC (permalink / raw
  To: gentoo-embedded

On 8/22/06, Walter Goossens <wa.goossens@home.nl> wrote:
> You can also (ab)use the /proc filesystem for your module. I used this
> quite a lot and it is easier to use when then the /dev filesystem.

Also you can try debugfs, it's very easy to output a lot of text data
via it. You can check drivers/i2c/chips/tps65010.c for example of
usage.

-- 
Sincerely,
Vladimir "Farcaller" Pouzanov
http://www.hackndev.com
-- 
gentoo-embedded@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-08-22 19:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-22 13:37 [gentoo-embedded] writing device drivers howto andreas.sumper
2006-08-22 14:02 ` Natanael Copa
2006-08-22 14:48 ` Kelly Price
  -- strict thread matches above, loose matches on Subject: below --
2006-08-22 13:54 Morgan, Austin D.
2006-08-22 18:50 ` Walter Goossens
2006-08-22 19:15   ` Vladimir Pouzanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox