[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: [rtl] Trying To Use "request_RTirq"
On Mon, Jun 08, 1998 at 07:56:34AM -0400, Donald Radke wrote:
> The code below is a modified version of "rt_process.c" found in the 2tasks
> example. I have the orginal 2task working but am curious about using an
> interrupt instead. From what I read about "request_RTirq" and "free_RTirq"
> the below program should send a message to the FIFO everytime the timer
> interrupt goes off. Doesn't seem to do that though. Nothing happens than
> the linux task (app.c) ends.
>
> I tried changing timer_irq value to 1 (keyboard) and I'll receive the data
> message just after hitting the return key on the prompt line. But no matter
> how many times I hit the keyboard, nothing comes back from the RT-Task.
>
> I understand "request_RTirq" to work as follows:
>
> request_RTirq ( monitor_irq, execute_some_func );
>
> Whenever the monitor_irq (whichever one I want) goes off, perform the
> function (ie execute_some_func). I'm I wrong, or is there something else
> that needs to be setup???
>
> Donald Radke
>
Perhaps you find some recommendation useful:
1. Don't use interrupts for RT-Linux that Linux need for proper
operations (like the keyboard interrupt). I guess it is hard
to figure out what will happen.
> /* Actual function to handle output */
> void irq_handler ( )
> {
> int i;
>
> for ( i = 0; i < 1024; i++ )
> {
> data[i] = 'R';
> }
2. Don't do initializations in ISR. Send a few bytes; not kilobytes
for test purposes.
>
> rtf_put ( fifo
> , &data
> , 1024
> );
>
> return;
3. fifo seems to be not known here???
4. &data is a pointer to an array. Does not make much sense and is
ignored by most compilers.
>
> } /* End Of irq_handler */
>
>
> int main_handler ( unsigned int fifo )
> {
> struct my_msg_struct msg;
> int err;
> int timer_irq = 0; /* Set to timer interrupt */
>
> while ((err = rtf_get(3, &msg, sizeof(msg))) == sizeof(msg))
> {
> switch (msg.command)
> {
> case START_TASK:
> request_RTirq ( timer_irq, &irq_handler );
5. &irq_handler, like 4.
--
Kai P. Mueller
Control Department (Regelungstechnik) | Phone [+49] (531) 391-3835
Technical University Braunschweig | Fax [+49] (531) 391-5194
D-38092 Braunschweig | Email mueller@ifr.ing.tu-bs.de
--- [rtl] ---
For more information on Real-Time Linux see:
http://www.rtlinux.org/