em_wdog.h

Go to the documentation of this file.
00001 /***************************************************************************/
00034 #ifndef __EM_WDOG_H
00035 #define __EM_WDOG_H
00036 
00037 #include "em_device.h"
00038 #if defined(WDOG_COUNT) && (WDOG_COUNT > 0)
00039 
00040 #include <stdbool.h>
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 /***************************************************************************/
00051 /***************************************************************************/
00056 /*******************************************************************************
00057  ********************************   ENUMS   ************************************
00058  ******************************************************************************/
00059 
00061 typedef enum
00062 {
00063   wdogClkSelULFRCO = _WDOG_CTRL_CLKSEL_ULFRCO,   
00064   wdogClkSelLFRCO  = _WDOG_CTRL_CLKSEL_LFRCO,    
00065   wdogClkSelLFXO   = _WDOG_CTRL_CLKSEL_LFXO      
00066 } WDOG_ClkSel_TypeDef;
00067 
00069 typedef enum
00070 {
00071   wdogPeriod_9    = 0x0, 
00072   wdogPeriod_17   = 0x1, 
00073   wdogPeriod_33   = 0x2, 
00074   wdogPeriod_65   = 0x3, 
00075   wdogPeriod_129  = 0x4, 
00076   wdogPeriod_257  = 0x5, 
00077   wdogPeriod_513  = 0x6, 
00078   wdogPeriod_1k   = 0x7, 
00079   wdogPeriod_2k   = 0x8, 
00080   wdogPeriod_4k   = 0x9, 
00081   wdogPeriod_8k   = 0xA, 
00082   wdogPeriod_16k  = 0xB, 
00083   wdogPeriod_32k  = 0xC, 
00084   wdogPeriod_64k  = 0xD, 
00085   wdogPeriod_128k = 0xE, 
00086   wdogPeriod_256k = 0xF  
00087 } WDOG_PeriodSel_TypeDef;
00088 
00089 /*******************************************************************************
00090  *******************************   STRUCTS   ***********************************
00091  ******************************************************************************/
00092 
00094 typedef struct
00095 {
00097   bool                   enable;
00098 
00100   bool                   debugRun;
00101 
00103   bool                   em2Run;
00104 
00106   bool                   em3Run;
00107 
00109   bool                   em4Block;
00110 
00112   bool                   swoscBlock;
00113 
00115   bool                   lock;
00116 
00118   WDOG_ClkSel_TypeDef    clkSel;
00119 
00121   WDOG_PeriodSel_TypeDef perSel;
00122 } WDOG_Init_TypeDef;
00123 
00125 #define WDOG_INIT_DEFAULT                                                                        \
00126   { true,               /* Start watchdog when init done */                                      \
00127     false,              /* WDOG not counting during debug halt */                                \
00128     false,              /* WDOG not counting when in EM2 */                                      \
00129     false,              /* WDOG not counting when in EM3 */                                      \
00130     false,              /* EM4 can be entered */                                                 \
00131     false,              /* Do not block disabling LFRCO/LFXO in CMU */                           \
00132     false,              /* Do not lock WDOG configuration (if locked, reset needed to unlock) */ \
00133     wdogClkSelULFRCO,   /* Select 1kHZ WDOG oscillator */                                        \
00134     wdogPeriod_256k     /* Set longest possible timeout period */                                \
00135   }
00136 
00137 
00138 /*******************************************************************************
00139  *****************************   PROTOTYPES   **********************************
00140  ******************************************************************************/
00141 
00142 void WDOG_Enable(bool enable);
00143 void WDOG_Feed(void);
00144 void WDOG_Init(const WDOG_Init_TypeDef *init);
00145 void WDOG_Lock(void);
00146 
00150 #ifdef __cplusplus
00151 }
00152 #endif
00153 
00154 #endif /* defined(WDOG_COUNT) && (WDOG_COUNT > 0) */
00155 #endif /* __EM_WDOG_H */