From: Vladimir Gurevich <vag@paulidav.org>
To: None Atall <linux_meis@yahoo.com>
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: Linux Kernel generic question (procedure queue)
Date: Tue, 06 May 2003 00:20:55 -0700 [thread overview]
Message-ID: <3EB76257.6000407@paulidav.org> (raw)
In-Reply-To: 20030506064428.74357.qmail@web9704.mail.yahoo.com
Hello Dimitrios,
There are a number of mechanisms in the Linux kernel
that allow you to schedule execution of some code at
a later time as well as to wait for something to
happen. Wait queues, tasklets, kernel timers are
the most important ones.
The problem is that to choose and to use them properly
you need to know how they work, how they differ from
each other and how they are supposed to be used (because
they can easily be misused and this usually leads to
disasters). It is definitely not possible to go over
it in an email, so I'd refer you to the excellent book
by Rubini and Corbet that discusses all these (and many
other) issues.
As for your question goes, there are two main mechanisms
you should look at:
-- wait queues are usually used in drivers to
return the control to the scheduler until the
HW operation is finished. Look for
interruptible_sleep_on() and wake_up_interruptible()
-- I don't know exactly how do you plan to use your GPIOs
to implement SPI, but if you plan to use interrupts
you might be better of by using the write_buff()
function to fill your driver's buffer, submit
the first byte to the device via write_byte() and then go
to sleep on a wait queue. Then use the interrupt handler
to drain the buffer and wake up the process after
you have finished sending data (you can also use kernel
timers to wake it up in case there was a timeout).
But my main advise will be to get yourself a copy of
"Linux Device Drivers" by Rubini and Corbet first.
Happy hacking,
Vladimir Gurevich
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2003-05-06 7:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-06 6:44 Linux Kernel generic question (procedure queue) None Atall
2003-05-06 6:01 ` Der Herr Hofrat
2003-05-06 7:20 ` Vladimir Gurevich [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-05-06 12:40 Steven Rothweiler
2003-05-06 13:26 ` Gary Thomas
2003-05-06 13:37 Steven Rothweiler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3EB76257.6000407@paulidav.org \
--to=vag@paulidav.org \
--cc=linux_meis@yahoo.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).