I have downloaded some examples from the net (ie. inside IDEaliST from Anglia).
I wonder why in all the example I found the interrupts are switched back in system mode instead of using interrupt mode.
for example:
/*******************************************************************************
* Macro Name : IRQ_to_SYS
* Description : This macro used to switch form IRQ mode to SYS mode
* Input : none.
* Output : none
*******************************************************************************/
.macro IRQ_to_SYS
MSR cpsr_c, #0x1F /* Switch to SYS mode */
STMFD sp!, {lr} /* Save the link register. */
.endm
/*******************************************************************************
* Macro Name : SYS_to_IRQ
* Description : This macro used to switch from SYS mode to IRQ mode
then to return to IRQHnadler routine.
* Input : none.
* Output : none.
*******************************************************************************/
.macro SYS_to_IRQ
LDMFD sp!, {lr} /* Restore the link register. */
MSR cpsr_c, #0xD2 /* Switch to IRQ mode. */
MOV pc, lr /* Return to IRQHandler routine to clear the */
/* pending bit. */
.endm
/*******************************************************************************
* Function Name : EXTIT10IRQHandler
* Description : This function used to switch to SYS mode before entering
the EXTIT10_IRQHandler function
Then to return to IRQ mode after the
EXTIT10_IRQHandler function termination.
* Input : none
* Output : none
*******************************************************************************/
EXTIT10IRQHandler:
IRQ_to_SYS
mBLX EXTIT10_IRQHandler
SYS_to_IRQ
Is there some pitfall using interrupt mode?
thanks