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; 7+ 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] 7+ 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; 7+ 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] 7+ messages in thread

* Re: [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
  1 sibling, 0 replies; 7+ 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] 7+ messages in thread

* Re: [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
  1 sibling, 0 replies; 7+ 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] 7+ messages in thread

* Re: [gentoo-embedded] writing device drivers howto
  2006-08-22 13:54 [gentoo-embedded] writing device drivers howto Morgan, Austin D.
@ 2006-08-22 18:50 ` Walter Goossens
  2006-08-22 19:15   ` Vladimir Pouzanov
  0 siblings, 1 reply; 7+ 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] 7+ messages in thread

* Re: [gentoo-embedded] writing device drivers howto
  2006-08-22 18:50 ` Walter Goossens
@ 2006-08-22 19:15   ` Vladimir Pouzanov
  2006-08-23  7:22     ` andreas.sumper
  0 siblings, 1 reply; 7+ 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] 7+ messages in thread

* Re: Re: [gentoo-embedded] writing device drivers howto
  2006-08-22 19:15   ` Vladimir Pouzanov
@ 2006-08-23  7:22     ` andreas.sumper
  0 siblings, 0 replies; 7+ messages in thread
From: andreas.sumper @ 2006-08-23  7:22 UTC (permalink / raw
  To: gentoo-embedded

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

First of all thanks for all the hints.
 
I will have a look at LDD3 to get myself further. The /proc - filesystem 
is not considered to be good kernel- or module-conding-style (as I found 
out at kernelnewbies.org). If I manage to get it to work, I guess I will 
write some sort of step-by-step howto, to make life for other people 
easier (and for myself, as I tend to forget things, I do not need for 
quite some time ;-)).

Once again,
Thanks!

Bye,
Andy

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

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

end of thread, other threads:[~2006-08-23  7:23 UTC | newest]

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

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