rost_stargen wrote on Monday, April 23, 2007:
embeddedc,
From the LPC2100 manual (not the best grammar!!!):
"Vector Address register (VICVectAddr - 0xFFFF F030)
This is a read/write accessible register. When an IRQ interrupt occurs, the IRQ service routine can read this register and jump to the value read. If any of the interrupt requests or software interrupts that are assigned to a vectored IRQ slot is (are) enabled, classified as IRQ, and asserted, reading from this register returns the address in the Vector Address Register for the highest-priority such slot (lowest-numbered) such slot. Otherwise it returns the address in the Default Vector Address Register. Writing to this register does not set the value for future reads from it. Rather, this register should be written near the end of an ISR, to update the priority hardware."
I don’t think the above is very clear (ha ha), we understand it to mean the register can be read but written values are ignored, writes simply trigger the CPU to update it’s view of the pending interrupts.
From serialISR.c (FreeRTOS demo for ARM7_LPC2106_GCC):
void vUART_ISR( void )
{
/* This ISR can cause a context switch, so the first statement must be a
call to the portENTER_SWITCHING_ISR() macro. This must be BEFORE any
variable declarations. */
portENTER_SWITCHING_ISR();
…
/* Clear the ISR in the VIC. */
VICVectAddr = serCLEAR_VIC_INTERRUPT; <---- this is defined to be ZERO
/* Exit the ISR. If a task was woken by either a character being received
or transmitted then a context switch will occur. */
portEXIT_SWITCHING_ISR( ( xTaskWokenByTx || xTaskWokenByRx ) );
}
From my code:
void vEUI_ISR( void )
{
/* This ISR can cause a context switch, so the first statement must be a
call to the portENTER_SWITCHING_ISR() macro. This must be BEFORE any
variable declarations. */
portENTER_SWITCHING_ISR();
…
/* Clear the ISR in the VIC. */
WRITE(VICVectAddr, euiCLEAR_VIC_INTERRUPT); <— "write" is our own routine for reg access, the param here is defined as ZERO…in other words, this should be the same as the demo example (I did try the EXACT syntax from the demo, same result)
/* Exit the ISR. No context switch will occur. */
portEXIT_SWITCHING_ISR(bQueueReturnValue);
}
Bothe the demo and my code call xQueueSendFromISR.
Brian