All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: Heikki Lindholm <holindho@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Handling a interrupt from user space on PPC405
Date: Thu, 14 Dec 2006 10:39:23 +0100	[thread overview]
Message-ID: <45811BCB.2060606@domain.hid> (raw)
In-Reply-To: <458113DF.4040606@domain.hid>

Heikki Lindholm wrote:
> Wolfgang Grandegger kirjoitti:
>> Heikki Lindholm wrote:
>>
>>> Niklaus Giger kirjoitti:
>>>
>>>> Hi
>>>>
>>>> I tried to use the FIT (Fixed Interrupt Timer) on my PPC405GPr 
>>>> board, which uses 0x1010 as its interrupt vector in a user space 
>>>> (vxworks-skin) application.
>>>> <..>
>>>>   RT_INTR FITnterrupt;
>>>>   res = rt_intr_create(&FITnterrupt, 0, 0x1010, I_NOAUTOENA);
>>>> <..>
>>>> But I got -22 EINVAL as error.
>>>> Could somebody please tell me, what is wrong with my example.
>>>
>>>
>>> The 0x1010 is the HW interrupt vector, but the argument should be the 
>>> interrupt _line_. Besides, last time I checked, the ppc405 FIT isn't 
>>> even 'wired' in the kernel; actually, there's no space for the 
>>> interrupt prologue code, which basically results that no handler is 
>>> called when the FIT interrupt occurs.
>>
>>
>> Yes, in head_4xx.c there is the following note:
>>
>>   /* NOTE:
>>    * FIT and WDT handlers are not implemented yet.
>>    */
>>
>> But the relevant code could be copied from the PIT interrupt.
>>
>>   /* 0x1000 - Programmable Interval Timer (PIT) Exception */
>>         START_EXCEPTION(0x1000, Decrementer)
>>         NORMAL_EXCEPTION_PROLOG
>>         lis     r0,TSR_PIS@h
>>         mtspr   SPRN_TSR,r0             /* Clear the PIT exception */
>>         addi    r3,r1,STACK_FRAME_OVERHEAD
>>   #ifdef CONFIG_IPIPE
>>         EXC_XFER_IPIPE(0x1000, __ipipe_grab_timer)
>>   #else /* !CONFIG_IPIPE */
>>         EXC_XFER_LITE(0x1000, timer_interrupt)
>>   #endif /* CONFIG_IPIPE */
>>
>> and modified accordingly.
> 
> But one should note that the decrementer vector is at 0x1000 and the FIT 
> vector at 0x1010. The decrementer exception prologue is obviously bigger 
> than 0x10 (16) bytes and thus needs to be moved elsewhere (and branched 
> to from the decr vector.) It might be feasible to unite the handlers, 
> though, by passing some variable to the C-language handler, telling 
> which happened.

The above code snippet has to be modified for the FIT exception, of 
course, which calls _ipipe_grap_fit(). Here is what is basically needed:

   __ipipe_init_platform()
     calls fit_virq = ipipe_alloc_virq();

   __ipipe_grap_fit(regs)
     calls __ipipe_handle_irq(IPIPE_FIT_VIRQ, regs);

And the FIT timer has to be programed properly elsewhere.

Wolfgang.


  reply	other threads:[~2006-12-14  9:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-13 22:15 [Xenomai-help] Handling a interrupt from user space on PPC405 Niklaus Giger
2006-12-14  7:05 ` Heikki Lindholm
2006-12-14  8:23   ` Wolfgang Grandegger
2006-12-14  9:05     ` Heikki Lindholm
2006-12-14  9:39       ` Wolfgang Grandegger [this message]
2006-12-14 12:43   ` Niklaus Giger
2006-12-14  8:08 ` Wolfgang Grandegger

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=45811BCB.2060606@domain.hid \
    --to=wg@domain.hid \
    --cc=holindho@domain.hid \
    --cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.