1 /****************************************************************************** 2 * Filename: watchdog_doc.h 3 * 4 * Copyright (c) 2015 - 2022, Texas Instruments Incorporated 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * 1) Redistributions of source code must retain the above copyright notice, 11 * this list of conditions and the following disclaimer. 12 * 13 * 2) Redistributions in binary form must reproduce the above copyright notice, 14 * this list of conditions and the following disclaimer in the documentation 15 * and/or other materials provided with the distribution. 16 * 17 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 * 33 ******************************************************************************/ 34 //! \addtogroup wdt_api 35 //! @{ 36 //! \section sec_wdt Introduction 37 //! 38 //! The Watchdog Timer (WDT) allows the application to regain control if the system stalls due to 39 //! unexpected software behavior. The WDT can generate a normal interrupt or a non-maskable interrupt 40 //! on the first time-out and a system reset on the following time-out if the application fails to 41 //! restart the WDT. 42 //! 43 //! WDT has the following features: 44 //! - 32-bit down counter with a configurable load register. 45 //! - Configurable interrupt generation logic with interrupt masking and optional NMI function. 46 //! - Optional reset generation. 47 //! - Register protection from runaway software (lock). 48 //! - User-enabled stalling when the system CPU asserts the CPU Halt flag during debug. 49 //! 50 //! The WDT runs at system HF clock divided by 32; however, when in powerdown it runs at 51 //! LF clock (32 kHz) - if the LF clock to the MCU domain is enabled. 52 //! 53 //! If application does not restart the WDT, using \ref WatchdogIntClear(), before a time-out: 54 //! - At the first time-out the WDT asserts the interrupt, reloads the 32-bit counter with the load 55 //! value, and resumes counting down from that value. 56 //! - If the WDT counts down to zero again before the application clears the interrupt, and the 57 //! reset signal has been enabled, the WDT asserts its reset signal to the system. 58 //! 59 //! \note By default, a "warm reset" triggers a pin reset and thus reboots the device. 60 //! 61 //! A reset caused by the WDT can be detected as a "warm reset" using \ref SysCtrlResetSourceGet(). 62 //! However, it is not possible to detect which of the warm reset sources that caused the reset. 63 //! 64 //! Typical use case: 65 //! - Use \ref WatchdogIntTypeSet() to select either standard interrupt or non-maskable interrupt on 66 //! first time-out. 67 //! - The application must implement an interrupt handler for the selected interrupt type. If 68 //! application uses the \e static vector table (see startup_<compiler>.c) the interrupt 69 //! handlers for standard interrupt and non-maskable interrupt are named WatchdogIntHandler() 70 //! and NmiSR() respectively. For more information about \e static and \e dynamic vector table, 71 //! see \ref sec_interrupt_table. 72 //! - Use \ref WatchdogResetEnable() to enable reset on second time-out. 73 //! - Use \ref WatchdogReloadSet() to set (re)load value of the counter. 74 //! - Use \ref WatchdogEnable() to start the WDT counter. The WDT counts down from the load value. 75 //! - Use \ref WatchdogLock() to lock WDT configuration to prevent unintended re-configuration. 76 //! - Application must use \ref WatchdogIntClear() to restart the counter before WDT times out. 77 //! - If application does not restart the counter before it reaches zero (times out) the WDT asserts 78 //! the selected type of interrupt, reloads the counter, and starts counting down again. 79 //! - The interrupt handler triggered by the first time-out can be used to log debug information 80 //! or try to enter a safe "pre-reset" state in order to have a more graceful reset when the WDT 81 //! times out the second time. 82 //! - It is \b not recommended that the WDT interrupt handler clears the WDT interrupt and thus 83 //! reloads the WDT counter. This means that the WDT interrupt handler never returns. 84 //! - If the application does not clear the WDT interrupt and the WDT times out when the interrupt 85 //! is still asserted then WDT triggers a reset (if enabled). 86 //! 87 //! \section sec_wdt_api API 88 //! 89 //! The API functions can be grouped like this: 90 //! 91 //! Watchdog configuration: 92 //! - \ref WatchdogIntTypeSet() 93 //! - \ref WatchdogResetEnable() 94 //! - \ref WatchdogResetDisable() 95 //! - \ref WatchdogReloadSet() 96 //! - \ref WatchdogEnable() 97 //! 98 //! Status: 99 //! - \ref WatchdogRunning() 100 //! - \ref WatchdogValueGet() 101 //! - \ref WatchdogReloadGet() 102 //! - \ref WatchdogIntStatus() 103 //! 104 //! Interrupt configuration: 105 //! - \ref WatchdogIntEnable() 106 //! - \ref WatchdogIntClear() 107 //! - \ref WatchdogIntRegister() 108 //! - \ref WatchdogIntUnregister() 109 //! 110 //! Register protection: 111 //! - \ref WatchdogLock() 112 //! - \ref WatchdogLockState() 113 //! - \ref WatchdogUnlock() 114 //! 115 //! Stall configuration for debugging: 116 //! - \ref WatchdogStallDisable() 117 //! - \ref WatchdogStallEnable() 118 //! 119 //! @} 120