PERFORCE change 158517 for review

Ulf Lilleengen lulf at FreeBSD.org
Sun Mar 1 00:21:52 PST 2009


http://perforce.freebsd.org/chv.cgi?CH=158517

Change 158517 by lulf at lulf_carrot on 2009/03/01 08:21:27

	- Move sleep mode definitions into the general headers for ap700x, since
	  the implementations doesn't differ that much.
	- Fix broken sleep mode conditions. There are several ways to do this,
	  but for now, disallow sleep mode if global, exception, i1 or i2 masks
	  are set.
	
	
	Discussed with:		antab

Affected files ...

.. //depot/projects/avr32/src/sys/avr32/avr32/cpu.c#9 edit
.. //depot/projects/avr32/src/sys/avr32/include/at32ap7000.h#2 delete
.. //depot/projects/avr32/src/sys/avr32/include/at32ap700x.h#3 edit

Differences ...

==== //depot/projects/avr32/src/sys/avr32/avr32/cpu.c#9 (text+ko) ====

@@ -63,7 +63,6 @@
 #include <machine/reg_intc.h>
 #include <machine/reg_usart.h>
 #include <machine/at32ap700x.h>
-#include <machine/at32ap7000.h>
 
 extern vm_offset_t _evba;
 
@@ -90,17 +89,12 @@
 void
 cpu_idle(int busy)
 {
-	uint32_t gm;
-
-	gm = bit_offset(SYS, SR, GM);
-	/* Make sure interrupts are enabled before we do this. */
-	if (gm == 1 || (sysreg_read(SR) & INTR_MASK) == gm)
-		panic("sleeping with interrupts disabled");
-#if defined(CPU_AT32AP7000)
-	__asm__ __volatile ("sleep %0" : : "i"(AT32AP7000_SLEEP_IDLE));
-#else
-	avr32_impl();
-#endif
+	/* Make sure important interrupts are enabled before we do this. */
+	if (sysreg_read(SR) & (bit_offset(SYS, SR, GM) |
+	    bit_offset(SYS, SR, EM) | bit_offset(SYS, SR, I0M) |
+	    bit_offset(SYS, SR, I1M)))
+		panic("sleeping with critical interrupts masked");
+	__asm__ __volatile ("sleep %0" : : "i"(AT32AP700X_SLEEP_IDLE));
 }
 
 void

==== //depot/projects/avr32/src/sys/avr32/include/at32ap700x.h#3 (text+ko) ====

@@ -119,4 +119,11 @@
 #define AT32AP700X_EEC0_OFFSET		0xF03C00
 #define AT32AP700X_EEC0_SIZE		0x100
 
+/* Sleep modes. */
+#define AT32AP700X_SLEEP_IDLE		0
+#define AT32AP700X_SLEEP_FROZEN		1
+#define AT32AP700X_SLEEP_STANDBY	2
+#define AT32AP700X_SLEEP_STOP		3
+#define AT32AP700X_SLEEP_STATIC		5 /* Not a typo. */
+
 #endif /* !_MACHINE_AT32AP700X_H_ */


More information about the p4-projects mailing list