Lancaster University's (short term!) clone of mbed-src for micro:bit. This is a copy of the github branch https://github.com/lancaster-university/mbed-classic

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Jul 17 09:15:10 2015 +0100
Revision:
592:a274ee790e56
Parent:
579:53297373a894
Synchronized with git revision e7144f83a8d75df80c4877936b6ffe552b0be9e6

Full URL: https://github.com/mbedmicro/mbed/commit/e7144f83a8d75df80c4877936b6ffe552b0be9e6/

More API implementation for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 579:53297373a894 1 #ifndef RESET_H_INCLUDED
mbed_official 579:53297373a894 2 #define RESET_H_INCLUDED
mbed_official 579:53297373a894 3
mbed_official 579:53297373a894 4 #include <compiler.h>
mbed_official 579:53297373a894 5
mbed_official 579:53297373a894 6 #ifdef __cplusplus
mbed_official 579:53297373a894 7 extern "C" {
mbed_official 579:53297373a894 8 #endif
mbed_official 579:53297373a894 9
mbed_official 579:53297373a894 10 /**
mbed_official 579:53297373a894 11 * \addtogroup asfdoc_sam0_system_group
mbed_official 579:53297373a894 12 * @{
mbed_official 579:53297373a894 13 */
mbed_official 579:53297373a894 14
mbed_official 579:53297373a894 15 /**
mbed_official 579:53297373a894 16 * \brief Reset causes of the system.
mbed_official 579:53297373a894 17 *
mbed_official 579:53297373a894 18 * List of possible reset causes of the system.
mbed_official 579:53297373a894 19 */
mbed_official 579:53297373a894 20 enum system_reset_cause {
mbed_official 579:53297373a894 21 /** The system was last reset by a software reset. */
mbed_official 579:53297373a894 22 SYSTEM_RESET_CAUSE_SOFTWARE = PM_RCAUSE_SYST,
mbed_official 579:53297373a894 23 /** The system was last reset by the watchdog timer. */
mbed_official 579:53297373a894 24 SYSTEM_RESET_CAUSE_WDT = PM_RCAUSE_WDT,
mbed_official 579:53297373a894 25 /** The system was last reset because the external reset line was pulled low. */
mbed_official 579:53297373a894 26 SYSTEM_RESET_CAUSE_EXTERNAL_RESET = PM_RCAUSE_EXT,
mbed_official 579:53297373a894 27 /** The system was last reset by the BOD33. */
mbed_official 579:53297373a894 28 SYSTEM_RESET_CAUSE_BOD33 = PM_RCAUSE_BOD33,
mbed_official 579:53297373a894 29 /** The system was last reset by the BOD12. */
mbed_official 579:53297373a894 30 SYSTEM_RESET_CAUSE_BOD12 = PM_RCAUSE_BOD12,
mbed_official 579:53297373a894 31 /** The system was last reset by the POR (Power on reset). */
mbed_official 579:53297373a894 32 SYSTEM_RESET_CAUSE_POR = PM_RCAUSE_POR,
mbed_official 579:53297373a894 33 };
mbed_official 579:53297373a894 34
mbed_official 579:53297373a894 35
mbed_official 579:53297373a894 36 /**
mbed_official 579:53297373a894 37 * \name Reset Control
mbed_official 579:53297373a894 38 * @{
mbed_official 579:53297373a894 39 */
mbed_official 579:53297373a894 40
mbed_official 579:53297373a894 41 /**
mbed_official 579:53297373a894 42 * \brief Reset the MCU.
mbed_official 579:53297373a894 43 *
mbed_official 579:53297373a894 44 * Resets the MCU and all associated peripherals and registers, except RTC, all 32kHz sources,
mbed_official 579:53297373a894 45 * WDT (if ALWAYSON is set) and GCLK (if WRTLOCK is set).
mbed_official 579:53297373a894 46 *
mbed_official 579:53297373a894 47 */
mbed_official 579:53297373a894 48 static inline void system_reset(void)
mbed_official 579:53297373a894 49 {
mbed_official 579:53297373a894 50 NVIC_SystemReset();
mbed_official 579:53297373a894 51 }
mbed_official 579:53297373a894 52
mbed_official 579:53297373a894 53 /**
mbed_official 579:53297373a894 54 * \brief Return the reset cause.
mbed_official 579:53297373a894 55 *
mbed_official 579:53297373a894 56 * Retrieves the cause of the last system reset.
mbed_official 579:53297373a894 57 *
mbed_official 579:53297373a894 58 * \return An enum value indicating the cause of the last system reset.
mbed_official 579:53297373a894 59 */
mbed_official 579:53297373a894 60 static inline enum system_reset_cause system_get_reset_cause(void)
mbed_official 579:53297373a894 61 {
mbed_official 579:53297373a894 62 return (enum system_reset_cause)PM->RCAUSE.reg;
mbed_official 579:53297373a894 63 }
mbed_official 579:53297373a894 64
mbed_official 579:53297373a894 65 /**
mbed_official 579:53297373a894 66 * @}
mbed_official 579:53297373a894 67 */
mbed_official 579:53297373a894 68
mbed_official 579:53297373a894 69 /** @} */
mbed_official 579:53297373a894 70 #ifdef __cplusplus
mbed_official 579:53297373a894 71 }
mbed_official 579:53297373a894 72 #endif
mbed_official 579:53297373a894 73
mbed_official 579:53297373a894 74 #endif /* RESET_H_INCLUDED */