А это прибамбасы для GNU ARM C. См. внутри #define IRQ_MASK (~0x00000080)
#define INTERRUPT_ENTRY() asm volatile(" sub lr, lr,#4\n" \
" stmfd sp!,{r0-r12,lr}\n" \
" mrs r1, spsr\n" \
" stmfd sp!,{r1}")
#define INTERRUPT_EXIT() asm volatile(" ldmfd sp!,{r1}\n" \
" msr spsr_c,r1\n" \
" ldmfd sp!,{r0-r12,pc}^")
/********************************************************************************************
; Function: EnableIRQ
;
; Description: Clears the IRQ disable bit in the status register
;
; Inputs: Nothing
;
; Returns: Nothing
**********************************************************************************************/
static inline unsigned _GET_CPSR(void)
{
unsigned long retCode;
asm volatile (" mrs %0, cpsr" : "=r" (retCode) : );
return retCode;
}
static inline void _SET_CPSR(unsigned value)
{
asm volatile (" msr cpsr, %0" : : "r" (value) );
}
void EnableIRQ(void)
{
_SET_CPSR(_GET_CPSR() & IRQ_MASK);
}
/*********************************************************************************************
; Function: tprintf
;
; Description: Formats and prints a series of characters and values to the UART0
;
; Inputs: format - Format control
; argument - Optional arguments
;
; Returns: Nothing
;
***********************************************************************************************/
void tprintf( const char *format, ... )
{
char msgBuf[128] = {0};
va_list arglist;
va_start( arglist, format );
vsprintf(msgBuf,format,arglist );
va_end( arglist );
uart0Puts(msgBuf);
}