Rev 1 | Rev 369 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 195 | ||
---|---|---|---|
Line 208... | Line 208... | ||
208 | * Function Name : IRQHandler |
208 | * Function Name : IRQHandler |
209 | * Description : This function called when IRQ exception is entered. |
209 | * Description : This function called when IRQ exception is entered. |
210 | * Input : none |
210 | * Input : none |
211 | * Output : none |
211 | * Output : none |
212 | *******************************************************************************/ |
212 | *******************************************************************************/ |
213 | - | ||
214 | IRQHandler: |
213 | IRQHandler: |
215 | SUB lr, lr, #4 /* Update the link register */ |
214 | SUB lr, lr, #4 /* Update the link register */ |
216 | SaveContext r0, r12 /* Save the workspace plus the current */ |
215 | SaveContext r0, r12 /* Save the workspace plus the current */ |
217 | /* return address lr_irq and spsr_irq */ |
216 | /* return address lr_irq and spsr_irq */ |
218 | LDR r0, =VectorAddress |
217 | LDR r0, =VectorAddress |
219 | LDR r0, [r0] /* Read the routine address */ |
218 | LDR r0, [r0] /* Read the routine address of VIC0 */ |
220 | LDR r1, =VectorAddressDaisy |
219 | LDR r1, =VectorAddressDaisy |
221 | LDR r1, [r1] |
220 | LDR r1, [r1] /* Read the routine address of VIC1 */ |
222 | /* Padding between the acknowledge and re-enable of interrupts */ |
221 | /* Padding between the acknowledge and re-enable of interrupts */ |
223 | /* For more details, please refer to the following URL */ |
222 | /* For more details, please refer to the following URL */ |
224 | /* http://www.arm.com/support/faqip/3682.html */ |
223 | /* http://www.arm.com/support/faqip/3682.html */ |
225 | NOP |
224 | NOP |
226 | NOP |
225 | NOP |
227 | MSR cpsr_c, #Mode_SYS /* Switch to SYS mode and enable IRQ */ |
226 | # MSR cpsr_c, #Mode_SYS /* Switch to SYS mode and enable IRQ */ |
228 | STMFD sp!, {lr} /* Save the link register. */ |
227 | # STMFD sp!, {lr} /* Save the link register. */ |
229 | LDR lr, =ReturnAddress /* Read the return address. */ |
228 | LDR lr, =ReturnAddress /* Read the return address. */ |
- | 229 | CMP r0, #0 /* Is VIC0 VAR zero? */ |
|
- | 230 | BEQ SkipVic0 |
|
230 | MOV pc, r0 /* Branch to the IRQ handler. */ |
231 | BX r0 /* Branch to the IRQ handler. */ |
- | 232 | SkipVic0: |
|
- | 233 | CMP r1, #0 /* Is VIC1 VAR zero? */ |
|
- | 234 | BEQ ReturnAddress |
|
- | 235 | BX r1 /* Branch to the IRQ handler. */ |
|
231 | ReturnAddress: |
236 | ReturnAddress: |
232 | LDMFD sp!, {lr} /* Restore the link register. */ |
237 | # LDMFD sp!, {lr} /* Restore the link register. */ |
233 | MSR cpsr_c, #Mode_IRQ|I_BIT|F_BIT /* Switch to IRQ mode and disable IRQ */ |
238 | # MSR cpsr_c, #Mode_IRQ|I_BIT /* Switch to IRQ mode and disable IRQ */ |
234 | LDR r0, =VectorAddress /* Write to the VectorAddress to clear the */ |
239 | LDR r0, =VectorAddress /* Write to the VectorAddress to clear the */ |
235 | STR r0, [r0] /* respective interrupt in the internal interrupt */ |
240 | STR r0, [r0] /* respective interrupt in the internal interrupt */ |
236 | LDR r1, =VectorAddressDaisy /* Write to the VectorAddressDaisy to clear the */ |
241 | LDR r1, =VectorAddressDaisy /* Write to the VectorAddressDaisy to clear the */ |
237 | STR r1, [r1] /* respective interrupt in the internal interrupt */ |
242 | STR r1, [r1] /* respective interrupt in the internal interrupt */ |
238 | RestoreContext r0, r12 /* Restore the context and return to the program execution. */ |
243 | RestoreContext r0, r12 /* Restore the context and return to the program execution. */ |