在ARM9内核中,实现低功耗的方法之一可以通过MMU进行管理,在idle任务中增加如下代码即可: .section __cache_asm .global __mmuWaitForInterrupt ;/* 系统内核进入低功耗模式, */ ;/* 等待 FIQ/IRQ 激活 */ .func __mmuWaitForInterrupt __mmuWaitForInterrupt: ;/* ARM 进入节能状态,等待中断 */ mov r0, 0 MCR p15, 0, R0, c7, c0, 4 MOV PC, LR .endfunc 以ARM926内核为例。Linux内核在arch/arm/mm/proc-arm926.S文件中实现: 97 /* 98 * cpu_arm926_do_idle() #空闲任务 99 * 100 * Called with IRQs disabled 101 */ 102 .align 10 103 ENTRY(cpu_arm926_do_idle) 104 mov r0, #0 105 mrc p15, 0, r1, c1, c0, 0 @ Read control register 106 mcr p15, 0, r0, c7, c10, 4 @ Drain write buffer 107 bic r2, r1, #1 << 12 108 mrs r3, cpsr @ Disable FIQs while Icache 109 orr ip, r3, #PSR_F_BIT @ is disabled 110 msr cpsr_c, ip 111 mcr p15, 0, r2, c1, c0, 0 @ Disable I cache 112 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 113 mcr p15, 0, r1, c1, c0, 0 @ Restore ICache enable 114 msr cpsr_c, r3 @ Restore FIQ state 115 mov pc, lr 116 |