summaryrefslogtreecommitdiff
path: root/supervisor/port.h
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-12-07 15:34:43 -0500
committerGitHub <noreply@github.com>2018-12-07 15:34:43 -0500
commit2fbaceb2b15ff7d2c368a6cf4dfc10881f5979e7 (patch)
tree60210206b73c579e74288333a3ecc4e8f233dd1b /supervisor/port.h
parent481c4954afd161448aa37d353fa577d409d880c6 (diff)
parent89ef6eef575501e736ae528f13d9979e1302be63 (diff)
Merge pull request #1294 from tannewt/stack_check4.0.0-alpha.4
Add stack validity check and raise an error when it happens.
Diffstat (limited to 'supervisor/port.h')
-rw-r--r--supervisor/port.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/supervisor/port.h b/supervisor/port.h
index dd4a82209..59898c8e4 100644
--- a/supervisor/port.h
+++ b/supervisor/port.h
@@ -33,12 +33,7 @@
#error "Please define PORT_HEAP_SIZE to specify heap size in bytes."
#endif
-typedef enum {
- NO_SAFE_MODE = 0,
- BROWNOUT,
- HARD_CRASH,
- USER_SAFE_MODE,
-} safe_mode_t;
+#include "supervisor/shared/safe_mode.h"
// Provided by the linker;
extern uint32_t _ezero;
@@ -51,7 +46,10 @@ extern uint32_t _ebss;
safe_mode_t port_init(void);
-// Reset the microcontroller.
+// Reset the microcontroller completely.
+void reset_cpu(void);
+
+// Reset the microcontroller state.
void reset_port(void);
// Reset the rest of the board.
@@ -60,8 +58,8 @@ void reset_board(void);
// Reset to the bootloader
void reset_to_bootloader(void);
-#ifdef NRF52_SERIES
-void HardFault_Handler(void);
-#endif
+// Save and retrieve a word from memory that is preserved over reset. Used for safe mode.
+void port_set_saved_word(uint32_t);
+uint32_t port_get_saved_word(void);
#endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H