IRQTimer.mod:TimerHandler:"Update vic priority

Newcomers to Astrobe and Oberon are welcome to ask any beginner-level questions here
Post Reply
Oberoid
Posts: 18
Joined: Fri Jan 28, 2011 8:57 pm
Location: Amsterdam, Netherlands

IRQTimer.mod:TimerHandler:"Update vic priority

Post by Oberoid » Tue Jul 26, 2011 12:58 pm

Hello to you all,

i' m studying the VIC and have a question about the example code.
Following is the interrupt handler from the example module IRQTimer.mod.

Code: Select all

PROCEDURE TimerHandler[4]; (* 4 for IRQ or FIQ *)
BEGIN
  INC(timeVal);
  (* Clear the MR0 interrupt *)
  SYSTEM.PUT(LPC.T1IR, {0});                       
  (* Update the VIC priority hardware *)  
  SYSTEM.PUT(LPC.VICVectAddr, 0)
END TimerHandler;
I do not understand why it is necessary to "update the vic priority hardware".
And also, is the VICVectAddr the right adres to do so?

I found this example in um10139 page 79

Code: Select all

VICVectCntl0 = 0x0000 0026 ; interrupt source with index 6 (UART0) is enabled as
; the one with priority 0 (the highest)
So changing the priority is done with VICVectCntl0

Does anyone have an idea?

Greets,
Frans-Pieter Vonck

Oberoid
Posts: 18
Joined: Fri Jan 28, 2011 8:57 pm
Location: Amsterdam, Netherlands

Re: IRQTimer.mod:TimerHandler:"Update vic priority

Post by Oberoid » Tue Jul 26, 2011 1:27 pm

Probably found the answer in PrimeCel VIC manual PL192
Reading from this register provides the address of the ISR, and indicates to the priority
hardware that the interrupt is being serviced. Writing to this register indicates to the
priority hardware that the interrupt has been serviced. The register must be used as
follows:
• the ISR reads the VICADDRESS Register when an IRQ interrupt is generated
• at the end of the ISR, the VICADDRESS Register is written to, to update the
priority hardware.
What I assume with this information that writing to the VICADRESS (=LPC.VicVectAddr) is updating the priority hardware of the VIC and that what you write is not important.
So value 0 that is written in the example code has no significance.

Code: Select all

SYSTEM.PUT(LPC.VICVectAddr, 0)
I'm I right?

Greets,
Frans-Pieter

cfbsoftware
Site Admin
Posts: 423
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: IRQTimer.mod:TimerHandler:"Update vic priority

Post by cfbsoftware » Tue Jul 26, 2011 1:30 pm

Yes. This is also specified in section 7.7 "VIC Usage Notes" in UM10139:
Also, before the next interrupt can be
serviced, it is necessary that write is performed into the VICVectAddr register before the
return from interrupt is executed. This write will clear the respective interrupt flag in the
internal interrupt priority hardware.

Oberoid
Posts: 18
Joined: Fri Jan 28, 2011 8:57 pm
Location: Amsterdam, Netherlands

Re: IRQTimer.mod:TimerHandler:"Update vic priority

Post by Oberoid » Tue Jul 26, 2011 1:45 pm

Thank you for the quick answer, Chris.
Now I can go on experimenting with the VIC.

Greetings,
Frans-Pieter

Post Reply