Kasper, I will not comment every line, but a bit >> .macro SC_TFUNC name >> .text >> .code 16 >> .thumb_func >> .globl name >> name: >> .endm Simply a macro for my lazy fingers ... BTW: Get hands on ARM ARM and read it carefully. You will meet assembly anyway :-) >> SC_TFUNC sc_sysLock >> bx pc >> nop >> .code 32 >> .globl sc_sysLock_a >> sc_sysLock_a: >> mrs r0,cpsr >> orr r1,r0,#PSR_I_BIT >> msr cpsr_c,r1 >> bx lr Disable interrupts and returns the old PSR in R0 in order to restore it later. The bx pc; nop is a veneer to change from Thumb to ARM mode. >> SC_TFUNC sc_sysUnlock >> bx pc >> nop >> .code 32 >> .globl sc_sysUnlock_a >> sc_sysUnlock_a: >> and r0,r0,#PSR_I_BIT >> mrs r1,cpsr >> bic r1,r1,#PSR_I_BIT >> orr r1,r1,r0 >> msr cpsr_c,r1 >> bx lr This _restores_ the I bit with the value stored in R0. Restore because , sc_sysLock() might be called with interrupts already disabled. > Thanks very much for your answer. Sorry but I do not know asm so > could you please explain what happens in every line and is the above > ready to insert in my existing C-code? Put it in lock.S (or any other file, but with capital S) and compile it (with gcc !). Add prototypes to your C code. Use it. You may inline it, but _I_ use inline only in very rare situations. -- 42Bastian Schick
Message
Re: [lpc2000] Re: LPC2129 ARM7 Disable/Enable Interrupt..
2005-05-13 by 42Bastian Schick
Attachments
- No local attachments were found for this message.