How to change RTEMS real time interrupt source to external pin of LEON UT699
Thomas Doerfler (nt)
Thomas.Doerfler at imd-systems.de
Wed Aug 30 15:16:04 UTC 2017
Hi Richard,
another hint: Using printf inside interrupts is not always supported in
RTEMS...
wkr,
Thomas.
Am 30.08.2017 um 16:07 schrieb Richard.Glossop at L3T.com:
>
> Want to change the source of RTEMS time tick interrupt from Timer 0 on
> the LEON to a GPIO pin. Have had success enabling the GPIO pin for
> the interrupt source (I get Spurious Interrupt 5 messages on the gdb
> console – we are using GPIO 5 – this tells me the interrupt is
> happening). When I try to use rtems_interrupt_catch to install a new
> vector isr for the GPIO, the system crashes.
>
>
>
> Here is the code:
>
>
>
> rtems_isr_entry reMapRealTimeInterrupt (void)
>
> {
>
> int level;
>
> rtems_isr_entry old_handler;
>
> rtems_status_code retVal;
>
>
>
>
>
> rtems_interrupt_disable (level); // disable all maskable
> interrupts
>
>
>
>
>
>
>
> retVal = rtems_interrupt_catch( // re-map vector 5 to our
> handler (GPIO 5)
>
> handler,
>
> 5,
>
> &old_handler);
>
>
>
> printf("Remap retVal:0x%x\n",retVal);
>
>
>
>
>
>
>
> *(unsigned int*)TIMCTR1 &= ~0x00000009; // disable timer 1
> interrupt enable and timer enable
>
> *(unsigned int*)IMR &= ~0x00000040; // mask interrupt for
> timer 1 interrupt since it is no longer used
>
> *(unsigned int*)IMR |= 0x00000020; // enable GPIO 5 interrupt
> in IMR
>
> *(unsigned int*)ILR |= 0x00000020; // set interrupt 5 to be a
> level 1 interrupt
>
>
>
>
>
> *(unsigned int*)GPIOIMR |= 0x00000020; // enable bit 5 to cause
> interrupts (GPIO 5)
>
> *(unsigned int*)GPIOIER |= 0x00000020; // set GPIO interrupt 5 to
> be edge triggered
>
> *(unsigned int*)GPIOIPR |= 0x00000020; // set GPIO interrupt 5 to
> be rising edge
>
>
>
>
>
> rtems_interrupt_enable (level); // enable all previously
> enabled interrupts
>
>
>
> return old_handler; // return original isr
> address in case want to restore
>
>
>
> }
>
>
>
> rtems_isr handler (rtems_vector_number vector)
>
> {
>
> printf("This is irq %d.\n",vector);
>
> rtems_clock_tick();
>
>
>
>
>
> }
>
>
>
> Can anyone help with this, or point me to example code to accomplish
> the same thing?
>
>
> Effective immediately my new email address is Richard.Glossop at L3T.com.
> Please update your records.
>
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
--
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler Herbststrasse 8
D-82178 Puchheim Germany
email: Thomas.Doerfler at imd-systems.de
PGP public key available on request
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20170830/50b0b412/attachment-0002.html>
More information about the users
mailing list