altos: Use explicit boot loader signal in ao_boot_reboot
authorKeith Packard <keithp@keithp.com>
Fri, 16 May 2014 05:34:17 +0000 (23:34 -0600)
committerKeith Packard <keithp@keithp.com>
Fri, 16 May 2014 05:38:40 +0000 (23:38 -0600)
Instead of just "knowing" that ao_boot_loader will be passed zero when
the application wants to get back to the boot loader, explicitly
define the values so that both sides always agree.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/lpc/ao_boot.h
src/lpc/ao_boot_chain.c
src/stm/ao_boot.h
src/stm/ao_boot_chain.c

index e0ed4de78cabc9f0a119639ecf51b3fa2ec1de78..62392d254d6461604e4c34947be99b2b56cf50e0 100644 (file)
@@ -31,9 +31,11 @@ ao_boot_check_chain(void);
 void
 ao_boot_reboot(uint32_t *base);
 
 void
 ao_boot_reboot(uint32_t *base);
 
+#define AO_BOOT_FORCE_LOADER   ((uint32_t *) 0)
+
 static inline void
 ao_boot_loader(void) {
 static inline void
 ao_boot_loader(void) {
-       ao_boot_reboot(AO_BOOT_LOADER_BASE);
+       ao_boot_reboot(AO_BOOT_FORCE_LOADER);
 }
 
 #endif /* _AO_BOOT_H_ */
 }
 
 #endif /* _AO_BOOT_H_ */
index a08d1f2c647b823fec0c151a952d0a6644e8832d..9e45ba27f085eaa5e8b2d07515eaa9c14b26adc7 100644 (file)
@@ -43,14 +43,14 @@ struct ao_boot {
 };
 
 static struct ao_boot __attribute__ ((section(".boot"))) ao_boot;
 };
 
 static struct ao_boot __attribute__ ((section(".boot"))) ao_boot;
-       
+
 int
 ao_boot_check_chain(void)
 {
        if (ao_boot.signal == AO_BOOT_SIGNAL && ao_boot.check == AO_BOOT_CHECK) {
                ao_boot.signal = 0;
                ao_boot.check = 0;
 int
 ao_boot_check_chain(void)
 {
        if (ao_boot.signal == AO_BOOT_SIGNAL && ao_boot.check == AO_BOOT_CHECK) {
                ao_boot.signal = 0;
                ao_boot.check = 0;
-               if (ao_boot.base == 0)
+               if (ao_boot.base == AO_BOOT_FORCE_LOADER)
                        return 0;
                ao_boot_chain(ao_boot.base);
        }
                        return 0;
                ao_boot_chain(ao_boot.base);
        }
index e0ed4de78cabc9f0a119639ecf51b3fa2ec1de78..62392d254d6461604e4c34947be99b2b56cf50e0 100644 (file)
@@ -31,9 +31,11 @@ ao_boot_check_chain(void);
 void
 ao_boot_reboot(uint32_t *base);
 
 void
 ao_boot_reboot(uint32_t *base);
 
+#define AO_BOOT_FORCE_LOADER   ((uint32_t *) 0)
+
 static inline void
 ao_boot_loader(void) {
 static inline void
 ao_boot_loader(void) {
-       ao_boot_reboot(AO_BOOT_LOADER_BASE);
+       ao_boot_reboot(AO_BOOT_FORCE_LOADER);
 }
 
 #endif /* _AO_BOOT_H_ */
 }
 
 #endif /* _AO_BOOT_H_ */
index 6a3864a71356ac69c80059f15cf85a6d8b6ba4dd..bcebf033ed5b9fa78dd19e80daf240262e5ed9ee 100644 (file)
@@ -50,7 +50,7 @@ ao_boot_check_chain(void)
        if (ao_boot.signal == AO_BOOT_SIGNAL && ao_boot.check == AO_BOOT_CHECK) {
                ao_boot.signal = 0;
                ao_boot.check = 0;
        if (ao_boot.signal == AO_BOOT_SIGNAL && ao_boot.check == AO_BOOT_CHECK) {
                ao_boot.signal = 0;
                ao_boot.check = 0;
-               if (ao_boot.base == 0)
+               if (ao_boot.base == AO_BOOT_FORCE_LOADER)
                        return 0;
                ao_boot_chain(ao_boot.base);
        }
                        return 0;
                ao_boot_chain(ao_boot.base);
        }