* [Xenomai-help] Handling a interrupt from user space on PPC405 @ 2006-12-13 22:15 Niklaus Giger 2006-12-14 7:05 ` Heikki Lindholm 2006-12-14 8:08 ` Wolfgang Grandegger 0 siblings, 2 replies; 7+ messages in thread From: Niklaus Giger @ 2006-12-13 22:15 UTC (permalink / raw) To: xenomai 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. I would like to have as little as possible code in the kernel and handling the whole interrupt in a RT (vxworks-skin) user space task. And how do I have to handle the case, where my interrupt handler is only interested in one of external interrupts of the PPC405? A good answer would enable me to publish afterwards a working example code. Best regards. -- Niklaus Giger ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Handling a interrupt from user space on PPC405 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 12:43 ` Niklaus Giger 2006-12-14 8:08 ` Wolfgang Grandegger 1 sibling, 2 replies; 7+ messages in thread From: Heikki Lindholm @ 2006-12-14 7:05 UTC (permalink / raw) To: niklaus.giger; +Cc: xenomai 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. -- Heikki Lindholm ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Handling a interrupt from user space on PPC405 2006-12-14 7:05 ` Heikki Lindholm @ 2006-12-14 8:23 ` Wolfgang Grandegger 2006-12-14 9:05 ` Heikki Lindholm 2006-12-14 12:43 ` Niklaus Giger 1 sibling, 1 reply; 7+ messages in thread From: Wolfgang Grandegger @ 2006-12-14 8:23 UTC (permalink / raw) To: Heikki Lindholm; +Cc: xenomai 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. Wolfgang. Wolfgang. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Handling a interrupt from user space on PPC405 2006-12-14 8:23 ` Wolfgang Grandegger @ 2006-12-14 9:05 ` Heikki Lindholm 2006-12-14 9:39 ` Wolfgang Grandegger 0 siblings, 1 reply; 7+ messages in thread From: Heikki Lindholm @ 2006-12-14 9:05 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: xenomai 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. -- Heikki Lindholm ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Handling a interrupt from user space on PPC405 2006-12-14 9:05 ` Heikki Lindholm @ 2006-12-14 9:39 ` Wolfgang Grandegger 0 siblings, 0 replies; 7+ messages in thread From: Wolfgang Grandegger @ 2006-12-14 9:39 UTC (permalink / raw) To: Heikki Lindholm; +Cc: xenomai 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Handling a interrupt from user space on PPC405 2006-12-14 7:05 ` Heikki Lindholm 2006-12-14 8:23 ` Wolfgang Grandegger @ 2006-12-14 12:43 ` Niklaus Giger 1 sibling, 0 replies; 7+ messages in thread From: Niklaus Giger @ 2006-12-14 12:43 UTC (permalink / raw) To: Heikki Lindholm, Wolfgang Grandegger; +Cc: xenomai Am Donnerstag, 14. Dezember 2006 08:05 schrieb Heikki Lindholm: > 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. > Thanks a lot for your tip. I did now test using IPIPE_TRAP_UNKNOWN, where my main test routine looks like this. > int res, j; > RT_INTR FITnterrupt; > printf("\n%s:", __FUNCTION__); > // res = rt_intr_create(&FITnterrupt, "sysAuxClk", 0x1010, I_NOAUTOENA); > // returns -22 EINVAL > res = rt_intr_create(&FITnterrupt, 0, IPIPE_TRAP_UNKNOWN, I_NOAUTOENA); > perror("rt_intr_create returned " ); > printf("%s: rt_intr_create return %d errno %s\n", __FUNCTION__, res, > strerror(res)); if (res != 0) exit(1); > > res = rt_intr_enable(&FITnterrupt); > printf("%s: rt_intr_enable return %d errno %s\n", __FUNCTION__, res, > strerror(res)); > > for (j=0; j < 3; j++) > { > /* Timeout is one second in timer jiffies, as with vxworks we have the > periodic time */ res = rt_intr_wait(&FITnterrupt, sysClkRateGet()); > printf("%s: rt_intr_wait return %d errno %s\n", __FUNCTION__, res, > strerror(res)); } > res = rt_intr_disable(&FITnterrupt); > printf("%s: rt_intr_disable return %d errno %s\n", __FUNCTION__, res, > strerror(res)); > > res = rt_intr_delete(&FITnterrupt); > printf("%s: rt_intr_delete return %d errno %s\n", __FUNCTION__, res, > strerror(res)); exit(0); My output at the target now looks like. > __xeno_user_init: rt_intr_enable return 0 errno Success > __xeno_user_init: rt_intr_wait return -110 errno Unknown error 4294967186 > __xeno_user_init: rt_intr_wait return -110 errno Unknown error 4294967186 > __xeno_user_init: rt_intr_wait return -110 errno Unknown error 4294967186 > __xeno_user_init: rt_intr_disable return 0 errno Success > __xeno_user_init: rt_intr_delete return 0 errno Success This is what I expect, as this interrupt should not occur. IPIPE_TRAP_UNKNOWN however cannot be found in any *.h exported to /usr/xenomai/include. I found it in include/asm-ppc/ipipe.h in the patched Linux kernel. So I suppose, that some how Xenomai should export this definition to user space, too. Dealing with FIT and other interrupts will take some more time. But I would like to thank you and Wolfgang for your help, as your answers helped me a lot to see the problem. Best regards -- Niklaus Giger ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Handling a interrupt from user space on PPC405 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:08 ` Wolfgang Grandegger 1 sibling, 0 replies; 7+ messages in thread From: Wolfgang Grandegger @ 2006-12-14 8:08 UTC (permalink / raw) To: niklaus.giger; +Cc: xenomai Niklaus Giger wrote: > 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 FIT exception is not an external interrupt and cannot be used with the the above function. And 0x1010 is not a valid IRQ number anyhow (it's actually the jump address of the FIT exception). > I would like to have as little as possible code in the kernel and handling the > whole interrupt in a RT (vxworks-skin) user space task. > > And how do I have to handle the case, where my interrupt handler is only > interested in one of external interrupts of the PPC405? > > A good answer would enable me to publish afterwards a working example code. The right thing to do is to handle the expection as VIRQ like the decrementer (or the PIT on the AMCC 405). Unfortunately, this requires various modifications to the ADEOS-IPIPE patch, but it's feasible, of course. Search for CONFIG_IPIPE in head_4xx.c, Wolfgang. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-12-14 12:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2006-12-14 12:43 ` Niklaus Giger 2006-12-14 8:08 ` Wolfgang Grandegger
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.