diff --git a/ion/include/ion.h b/ion/include/ion.h index 806e0508b..3441619f5 100644 --- a/ion/include/ion.h +++ b/ion/include/ion.h @@ -33,9 +33,6 @@ const char * softwareVersion(); const char * patchLevel(); const char * fccId(); -/* CAUTION: This is a complete reset! */ -void reset(bool jump = false); - // CRC32 : non xor-ed, non reversed, direct, polynomial 4C11DB7 // Only accepts whole 32bit values uint32_t crc32(const uint32_t * data, size_t length); diff --git a/ion/src/device/boot/rt0.cpp b/ion/src/device/boot/rt0.cpp index 678d7940b..e9af9b65d 100644 --- a/ion/src/device/boot/rt0.cpp +++ b/ion/src/device/boot/rt0.cpp @@ -24,7 +24,7 @@ void abort() { while (1) { } #else - Ion::reset(); + Ion::Device::coreReset(); #endif } diff --git a/ion/src/device/device.cpp b/ion/src/device/device.cpp index 2b642f8ba..cf5339127 100644 --- a/ion/src/device/device.cpp +++ b/ion/src/device/device.cpp @@ -66,27 +66,7 @@ uint32_t Ion::random() { return result; } -static void coreReset() { - // Perform a full core reset - CM4.AIRCR()->requestReset(); -} -static void jumpReset() { - Ion::Device::shutdown(); - uint32_t * stackPointerAddress = reinterpret_cast(0x08000000); - uint32_t * resetHandlerAddress = reinterpret_cast(0x08000004); - set_msp(*stackPointerAddress); - void (*ResetHandler)(void) = (void (*)())(*resetHandlerAddress); - ResetHandler(); -} - -void Ion::reset(bool jump) { - if (jump) { - jumpReset(); - } else { - coreReset(); - } -} static inline char hex(uint8_t d) { if (d > 9) { @@ -121,6 +101,20 @@ void initFPU() { // FIXME: The pipeline should be flushed at this point } +void coreReset() { + // Perform a full core reset + CM4.AIRCR()->requestReset(); +} + +void jumpReset() { + shutdown(); + uint32_t * stackPointerAddress = reinterpret_cast(0x08000000); + uint32_t * resetHandlerAddress = reinterpret_cast(0x08000004); + set_msp(*stackPointerAddress); + void (*ResetHandler)(void) = (void (*)())(*resetHandlerAddress); + ResetHandler(); +} + void init() { initClocks(); diff --git a/ion/src/device/device.h b/ion/src/device/device.h index b72759bae..48058c9ef 100644 --- a/ion/src/device/device.h +++ b/ion/src/device/device.h @@ -8,6 +8,9 @@ void init(); void shutdown(); void initFPU(); +void coreReset(); +void jumpReset(); + void initPeripherals(); void shutdownPeripherals(); void initClocks();