Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
ResetReason.h
00001 /* 00002 * Copyright (c) 2018-2019 Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef MBED_RESET_REASON_H 00018 #define MBED_RESET_REASON_H 00019 00020 #ifdef DEVICE_RESET_REASON 00021 00022 #include "reset_reason_api.h" 00023 00024 namespace mbed { 00025 /** \addtogroup drivers-public-api */ 00026 /** @{*/ 00027 00028 /** 00029 * \defgroup drivers_ResetReason ResetReason class 00030 * @{ 00031 */ 00032 /** A platform-independent method of checking the cause of the last system reset. 00033 * 00034 * When the system restarts, the reason for the restart is contained in 00035 * the system registers at boot time in a platform specific manner. 00036 * This API provides a generic method of fetching the reason for the restart. 00037 * 00038 */ 00039 class ResetReason { 00040 public: 00041 /** Get the platform independent reason code for the last system reset. 00042 * 00043 * @return enum containing the last reset reason for the board. 00044 * 00045 * Example: 00046 * @code 00047 * const reset_reason_t reason = ResetReason::get(); 00048 * 00049 * if (reason == RESET_REASON_WATCHDOG) { 00050 * printf("Watchdog reset\n"); 00051 * rollback(); 00052 * } 00053 * @endcode 00054 */ 00055 static reset_reason_t get(); 00056 00057 /** Get the platform specific reason code for the last system reset. 00058 * 00059 * Platform specific reasons that are not covered by the ::reset_reason_t enum 00060 * will cause the ResetReason::get() function to return 00061 * ::RESET_REASON_PLATFORM. In order to get the actual reason the register 00062 * value must be fetched directly using this function and interpreted in a 00063 * platform specific manner. 00064 * 00065 * @return value containing the reset reason register for the given platform. 00066 * If the platform contains reset reasons across multiple registers they 00067 * will be concatenated here. 00068 * 00069 * Example: 00070 * @code 00071 * if (ResetReason::get() == RESET_REASON_PLATFORM) { 00072 * const uint32_t platform_reason = ResetReason::get_raw(); 00073 * } 00074 * @endcode 00075 */ 00076 static uint32_t get_raw(); 00077 }; 00078 00079 /** @}*/ 00080 /** @}*/ 00081 00082 } // namespace mbed 00083 00084 #endif // DEVICE_RESET_REASON 00085 #endif // MBED_RESET_REASON_H
Generated on Tue Jul 12 2022 13:54:47 by
