5 #if defined(__CWCC__) && defined(CFG_VLE)
\r
6 .section .text_vle,text_vle
\r
7 #elif defined(__DCC__)
\r
8 // Must be indented (diab)
\r
10 #elif defined(__GNUC__)
\r
14 #if defined(CFG_MPC5516) || defined(CFG_MPC5668)
\r
15 #define CRP_RECPTR 0xfffec058
\r
20 .global McuE_EnterLowPower
\r
23 subi r1, r1, 0x94 // Allocate space on stack 0x94 = 148 r2--r31 + 7 SPRs
\r
24 stmw r2, 0(r1) // Save registers r2-r31 to stack
\r
32 stmw r25, 0x78(r1) // Store SPR data to stack
\r
34 LOAD_ADDR_32(r4,CRP_RECPTR)
\r
35 stw r1,0x0(r4) // Save stack pointer to CRP to be preserved during LPM
\r
37 /* Note! You cannot step over the wait instruction with the debugger */
\r
39 .long 0x7C00007C // Wait instruction
\r
46 * Low Power Vector...needs to be on 4K + 0xffc
\r
47 * We only have 1 instruction before we are outside TLB0 so just jump
\r
49 #if defined(__GNUC__)
\r
50 .section ".lowpower_vector","ax"
\r
51 #elif defined(__CWCC__)
\r
52 #if defined(CFG_VLE)
\r
53 .section .lowpower_vector,text_vle
\r
55 .section .lowpower_vector,4,"rw"
\r
57 #elif defined(__DCC__)
\r
58 .section .text_vle,x
\r
61 .global McuE_LowPowerVector
\r
63 McuE_LowPowerVector:
\r
64 b McuE_LowPowerRecoverFlash
\r
67 #if defined(__GNUC__)
\r
68 .section ".lowpower_text","ax"
\r
69 #elif defined(__CWCC__)
\r
70 #if defined(CFG_VLE)
\r
71 .section .lowpower_text,text_vle
\r
73 .section .lowpower_text,4,"rw"
\r
75 #elif defined(__DCC__)
\r
76 .section .text_vle,x
\r
79 .extern EcuM_CheckWakeup
\r
80 .global McuE_LowPowerRecoverFlash
\r
83 * When we come back here only TLB0 is setup for flash and then only 4K.
\r
86 * - WinIDEA : Hardware->Emulation Options->CPU Setup->MPC55xx->Low Power Debug
\r
87 * This will make the debugger stop on the function below.
\r
88 * - UDE: No support for this yet. It just runs through the "wait" instruction.
\r
90 McuE_LowPowerRecoverFlash:
\r
94 /* Recover the stack */
\r
95 LOAD_ADDR_32(r4,CRP_RECPTR)
\r
96 lwz r1,0x0(r4) // Restore stack pointer from CRP
\r
97 lmw r25,0x78(r1) // Load SPR values back into GPRs
\r
104 mtCTR r31 // Load SPRs with GPR values
\r
105 lmw r2, 0(r1) // Restore GPRs from stack
\r
106 addi r1,r1,0x94 // Deallocate space on stack
\r
108 #if defined(USE_ECUM)
\r
110 /* We have no idea what made us wakeup, pass all */
\r
111 LOAD_ADDR_32(r3,0x3fffffff); // EcuM_WakeupSourceType
\r
112 bl EcuM_CheckWakeup
\r
118 /* branch back to Mcu_SetMode().. */
\r
122 #if defined(CFG_VLE)
\r
123 #define VLE_VAL MAS2_VLE
\r
128 #if defined(CFG_MPC5516) || defined(CFG_MPC5668)
\r
129 #define SRAM_START 0x40000000
\r
130 #define FLASH_START 0x00000000
\r
131 #define PERIPHERAL_START 0xfff00000
\r
133 #error No support for this MCU
\r
139 #***************************************************/
\r
141 #***************************************************/
\r
143 #TLB Entry 0 = 1M Internal flash
\r
144 LOAD_ADDR_32(5, 0x10000000 + (0<<16))
\r
146 LOAD_ADDR_32(5, 0xC0000000 + MAS1_TSIZE_4M )
\r
148 LOAD_ADDR_32(5, FLASH_START + VLE_VAL )
\r
150 LOAD_ADDR_32(5, FLASH_START + MAS3_FULL_ACCESS )
\r
158 #TLB Entry 1 = Peripheral bridge and BAM
\r
159 LOAD_ADDR_32(5, 0x10000000 + (1<<16))
\r
161 LOAD_ADDR_32(5, 0xC0000000 + MAS1_TSIZE_1M)
\r
163 LOAD_ADDR_32(5, PERIPHERAL_START + VLE_VAL + MAS2_I)
\r
165 LOAD_ADDR_32(5, PERIPHERAL_START + MAS3_FULL_ACCESS )
\r
173 #TLB Entry 2 = External RAM. Skip this.
\r
175 #TLB Entry 3 = Internal SRAM
\r
176 LOAD_ADDR_32(5, 0x10000000+(3<<16))
\r
178 LOAD_ADDR_32(5, 0xC0000000 + MAS1_TSIZE_256K )
\r
180 LOAD_ADDR_32(5, SRAM_START + VLE_VAL )
\r
182 LOAD_ADDR_32(5, SRAM_START + MAS3_FULL_ACCESS )
\r