29.01.2015 Views

AN QP and ARM7/9 - Quantum Leaps

AN QP and ARM7/9 - Quantum Leaps

AN QP and ARM7/9 - Quantum Leaps

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Application Note<br />

<strong>QP</strong> <strong>and</strong> <strong>ARM7</strong>/9<br />

www.state-machine.com/arm<br />

3.3.7 Initializing the Vector Table <strong>and</strong> the Vectored Interrupt Controller<br />

Auto-vectoring is NOT used, so the ARM vector table <strong>and</strong> the interrupt controller must be correctly<br />

initialized differently than in other QK port. The following listing shows the initialization placed in the<br />

QF_onStart() callback.<br />

Listing 9 Initialization of the ARM vector table <strong>and</strong> the interrupt controller in QF_onStart() for the<br />

Philips LPC213x.<br />

(1) __arm void QF_onStart(void) {<br />

(2) QF_INT_LOCK_ARM(); /* lock interrupts */<br />

/* hook the IRQ h<strong>and</strong>ler from the QK port */<br />

(3) *(uint32_t volatile *)0x24 = (uint32_t)&QF_undef;<br />

(4) *(uint32_t volatile *)0x28 = (uint32_t)&QF_swi;<br />

(5) *(uint32_t volatile *)0x2C = (uint32_t)&QF_pAbort;<br />

(6) *(uint32_t volatile *)0x30 = (uint32_t)&QF_dAbort;<br />

(7) *(uint32_t volatile *)0x34 = (uint32_t)&QF_reserved;<br />

(8) *(uint32_t volatile *)0x38 = (uint32_t)&QF_irq;<br />

(9) *(uint32_t volatile *)0x3C = (uint32_t)&QF_fiq;<br />

VICIntSelect = 0x0; /* assign all interrupts to the IRQ category */<br />

/* Setting up Timer1 to h<strong>and</strong>le the time tick interrupt.<br />

* Timer1 has priorty 1 (second to the highest)<br />

*/<br />

VICVectCntl1 = 0x25;<br />

(10) VICVectAddr1 = (uint32_t)&ISR_tick;<br />

VICIntEnable = (1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!