return cpu_psr;
}
/*
get PSR value and clear IE bit to disable interrupt
*/
static inline portLONG GetCPUPSR (void)
{
portLONG flags;
__asm__ __volatile__(
"mfcr %0, psr n"
"psrclr ien"
:"=r"(flags)
:
:
);
return flags;
}
/*
set PSR value
*/
static inline void SetCPUPSR (portLONG newMask)
{
asm volatile(
“mtcr %0, psr n”
:
:”r” (newMask)
:”memory”
);} // enable interrupt by set IE bit in PSR static inline void vPortEnableInterrupt(void) { asm volatile( “psrset ien” “rts n” ); } // disable interrupt by clear IE bit in PSR static inline void vPortDisableInterrupt(void) { asm volatile( “psrclr ien” “rts n” ); } ~~~ case 1 define portDISABLEINTERRUPTS() ulPortSetIPL(1) define portENABLEINTERRUPTS() ulPortSetIPL(0) define portSETINTERRUPTMASKFROMISR() GetCPUPSR() define portCLEARINTERRUPTMASKFROMISR(x) SetCPUPSR(x) result: all task can work correctly.. case 2 define portDISABLEINTERRUPTS() vPortDisableInterrupt() define portENABLEINTERRUPTS() vPortEnableInterrupt() define portSETINTERRUPTMASKFROMISR() GetCPUPSR() define portCLEARINTERRUPTMASKFROMISR(x) SetCPUPSR(x) result: first task can’t run and no task switch.. what I understand is portDISABLEINTERRUPTS() and portENABLEINTERRUPTS() is only used to disable all interrupts and enable interrupts purlly… but in case 1, ulPortSetIPL save PSR value in cpu_psr variable. and case 2 doesn’t save it .. is there other reason to cause it ?