Line 83... |
Line 83... |
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 )
|
#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 )
|
|
|
#define portYIELD_FROM_ISR() vTaskSwitchContext()
|
#define portYIELD_FROM_ISR() vTaskSwitchContext()
|
#define portYIELD() { \
|
#define portYIELD() { \
|
__asm__ __volatile__ ( "l.addi r1, r1, -4" ); \
|
__asm__ __volatile__ ( "l.sw -4(r1), r11" ); \
|
__asm__ __volatile__ ( "l.sw 0x0(r1), r11" ); \
|
|
__asm__ __volatile__ ( "l.addi r11, r0, 0x0FCC" ); \
|
__asm__ __volatile__ ( "l.addi r11, r0, 0x0FCC" ); \
|
__asm__ __volatile__ ( "l.sys 0x0FCC" ); \
|
__asm__ __volatile__ ( "l.sys 0x0FCC" ); \
|
__asm__ __volatile__ ( "l.nop " ); \
|
__asm__ __volatile__ ( "l.nop " ); \
|
}
|
}
|
#define portNOP() __asm__ __volatile__ ( "l.nop" )
|
#define portNOP() __asm__ __volatile__ ( "l.nop" )
|
Line 113... |
Line 112... |
|
|
|
|
// Critical section handling.
|
// Critical section handling.
|
// switch supervisormode, disable tick interrupt and all external interrupt, switch back usermode
|
// switch supervisormode, disable tick interrupt and all external interrupt, switch back usermode
|
#define portENTER_CRITICAL() { \
|
#define portENTER_CRITICAL() { \
|
__asm__ __volatile__ ( "l.addi r1, r1, -4" ); \
|
__asm__ __volatile__ ( "l.sw -4(r1), r11" ); \
|
__asm__ __volatile__ ( "l.sw 0x0(r1), r11" ); \
|
|
__asm__ __volatile__ ( "l.addi r11, r0, 0x0FCE" ); \
|
__asm__ __volatile__ ( "l.addi r11, r0, 0x0FCE" ); \
|
__asm__ __volatile__ ( "l.sys 0x0FCE" ); \
|
__asm__ __volatile__ ( "l.sys 0x0FCE" ); \
|
__asm__ __volatile__ ( "l.nop " ); \
|
__asm__ __volatile__ ( "l.nop " ); \
|
}
|
}
|
|
|
// switch supervisormode, enable tick interrupt and all external interrupt, switch back usermode
|
// switch supervisormode, enable tick interrupt and all external interrupt, switch back usermode
|
#define portEXIT_CRITICAL() { \
|
#define portEXIT_CRITICAL() { \
|
__asm__ __volatile__ ( "l.addi r1, r1, -4" ); \
|
__asm__ __volatile__ ( "l.sw -4(r1), r11" ); \
|
__asm__ __volatile__ ( "l.sw 0x0(r1), r11" ); \
|
|
__asm__ __volatile__ ( "l.addi r11, r0, 0x0FCF" ); \
|
__asm__ __volatile__ ( "l.addi r11, r0, 0x0FCF" ); \
|
__asm__ __volatile__ ( "l.sys 0x0FCF" ); \
|
__asm__ __volatile__ ( "l.sys 0x0FCF" ); \
|
__asm__ __volatile__ ( "l.nop " ); \
|
__asm__ __volatile__ ( "l.nop " ); \
|
}
|
}
|
|
|
Line 142... |
Line 139... |
// Macro to save all registers, stack pointer into the TCB.
|
// Macro to save all registers, stack pointer into the TCB.
|
#define portSAVE_CONTEXT() \
|
#define portSAVE_CONTEXT() \
|
asm volatile ( \
|
asm volatile ( \
|
" .global pxCurrentTCB \n\t" \
|
" .global pxCurrentTCB \n\t" \
|
" # make rooms in stack \n\t" \
|
" # make rooms in stack \n\t" \
|
" l.addi r1, r1, -132 \n\t" \
|
" l.addi r1, r1, -128 \n\t" \
|
" # early save r3-r5, these are clobber register\n\t" \
|
" # early save r3-r5, these are clobber register\n\t" \
|
" l.sw 0x08(r1), r3 \n\t" \
|
" l.sw 0x08(r1), r3 \n\t" \
|
" l.sw 0x0C(r1), r4 \n\t" \
|
" l.sw 0x0C(r1), r4 \n\t" \
|
" l.sw 0x10(r1), r5 \n\t" \
|
" l.sw 0x10(r1), r5 \n\t" \
|
" # save SPR_ESR_BASE(0), SPR_EPCR_BASE(0)\n\t" \
|
" # save SPR_ESR_BASE(0), SPR_EPCR_BASE(0)\n\t" \
|
Line 238... |
Line 235... |
" l.mtspr r0, r4, (0<<11) + 32 \n\t" \
|
" l.mtspr r0, r4, (0<<11) + 32 \n\t" \
|
" # restore clobber register \n\t" \
|
" # restore clobber register \n\t" \
|
" l.lwz r3, 0x08(r1) \n\t" \
|
" l.lwz r3, 0x08(r1) \n\t" \
|
" l.lwz r4, 0x0C(r1) \n\t" \
|
" l.lwz r4, 0x0C(r1) \n\t" \
|
" l.lwz r5, 0x10(r1) \n\t" \
|
" l.lwz r5, 0x10(r1) \n\t" \
|
|
" l.addi r1, r1, 128 \n\t" \
|
" l.rfe \n\t" \
|
" l.rfe \n\t" \
|
" l.nop \n\t" \
|
" l.nop \n\t" \
|
);
|
);
|
|
|
#endif /* PORTMACRO_H */
|
#endif /* PORTMACRO_H */
|