]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Nuvoton_Code/StdDriver/inc/wwdt.h
Add Cortex M23 GCC and IAR ports. Add demo projects for Nuvoton NuMaker-PFM-2351.
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC / Nuvoton_Code / StdDriver / inc / wwdt.h
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Nuvoton_Code/StdDriver/inc/wwdt.h b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Nuvoton_Code/StdDriver/inc/wwdt.h
new file mode 100644 (file)
index 0000000..4645e62
--- /dev/null
@@ -0,0 +1,151 @@
+/**************************************************************************//**\r
+ * @file     wwdt.h\r
+ * @version  V3.00\r
+ * @brief    Window Watchdog Timer(WWDT) driver header file\r
+ *\r
+ * @copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.\r
+ *****************************************************************************/\r
+#ifndef __WWDT_H__\r
+#define __WWDT_H__\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/** @addtogroup Standard_Driver Standard Driver\r
+  @{\r
+*/\r
+\r
+/** @addtogroup WWDT_Driver WWDT Driver\r
+  @{\r
+*/\r
+\r
+/** @addtogroup WWDT_EXPORTED_CONSTANTS WWDT Exported Constants\r
+  @{\r
+*/\r
+/*---------------------------------------------------------------------------------------------------------*/\r
+/*  WWDT Prescale Period Constant Definitions                                                              */\r
+/*---------------------------------------------------------------------------------------------------------*/\r
+#define WWDT_PRESCALER_1        (0 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 1 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_2        (1 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 2 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_4        (2 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 4 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_8        (3 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 8 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_16       (4 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 16 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_32       (5 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 32 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_64       (6 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 64 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_128      (7 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 128 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_192      (8 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 192 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_256      (9 << WWDT_CTL_PSCSEL_Pos)  /*!< Select max time-out period to 256 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_384      (10 << WWDT_CTL_PSCSEL_Pos) /*!< Select max time-out period to 384 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_512      (11 << WWDT_CTL_PSCSEL_Pos) /*!< Select max time-out period to 512 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_768      (12 << WWDT_CTL_PSCSEL_Pos) /*!< Select max time-out period to 768 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_1024     (13 << WWDT_CTL_PSCSEL_Pos) /*!< Select max time-out period to 1024 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_1536     (14 << WWDT_CTL_PSCSEL_Pos) /*!< Select max time-out period to 1536 * (64*WWDT_CLK) \hideinitializer */\r
+#define WWDT_PRESCALER_2048     (15 << WWDT_CTL_PSCSEL_Pos) /*!< Select max time-out period to 2048 * (64*WWDT_CLK) \hideinitializer */\r
+\r
+/*---------------------------------------------------------------------------------------------------------*/\r
+/*  WWDT Reload Counter Keyword Constant Definitions                                                       */\r
+/*---------------------------------------------------------------------------------------------------------*/\r
+#define WWDT_RELOAD_WORD        (0x00005AA5)                /*!< Fill this value to WWDT_RLDCNT register to reload WWDT counter \hideinitializer */\r
+\r
+/*@}*/ /* end of group WWDT_EXPORTED_CONSTANTS */\r
+\r
+\r
+/** @addtogroup WWDT_EXPORTED_FUNCTIONS WWDT Exported Functions\r
+  @{\r
+*/\r
+\r
+/**\r
+  * @brief      Clear WWDT Reset System Flag\r
+  *\r
+  * @param      None\r
+  *\r
+  * @return     None\r
+  *\r
+  * @details    This macro is used to clear WWDT time-out reset system flag.\r
+  * \hideinitializer\r
+  */\r
+#define WWDT_CLEAR_RESET_FLAG()     (WWDT->STATUS = WWDT_STATUS_WWDTRF_Msk)\r
+\r
+/**\r
+  * @brief      Clear WWDT Compared Match Interrupt Flag\r
+  *\r
+  * @param      None\r
+  *\r
+  * @return     None\r
+  *\r
+  * @details    This macro is used to clear WWDT compared match interrupt flag.\r
+  * \hideinitializer\r
+  */\r
+#define WWDT_CLEAR_INT_FLAG()       (WWDT->STATUS = WWDT_STATUS_WWDTIF_Msk)\r
+\r
+/**\r
+  * @brief      Get WWDT Reset System Flag\r
+  *\r
+  * @param      None\r
+  *\r
+  * @retval     0   WWDT time-out reset system did not occur\r
+  * @retval     1   WWDT time-out reset system occurred\r
+  *\r
+  * @details    This macro is used to indicate system has been reset by WWDT time-out reset or not.\r
+  * \hideinitializer\r
+  */\r
+#define WWDT_GET_RESET_FLAG()       ((WWDT->STATUS & WWDT_STATUS_WWDTRF_Msk)? 1 : 0)\r
+\r
+/**\r
+  * @brief      Get WWDT Compared Match Interrupt Flag\r
+  *\r
+  * @param      None\r
+  *\r
+  * @retval     0   WWDT compare match interrupt did not occur\r
+  * @retval     1   WWDT compare match interrupt occurred\r
+  *\r
+  * @details    This macro is used to indicate WWDT counter value matches CMPDAT value or not.\r
+  * \hideinitializer\r
+  */\r
+#define WWDT_GET_INT_FLAG()         ((WWDT->STATUS & WWDT_STATUS_WWDTIF_Msk)? 1 : 0)\r
+\r
+/**\r
+  * @brief      Get WWDT Counter\r
+  *\r
+  * @param      None\r
+  *\r
+  * @return     WWDT Counter Value\r
+  *\r
+  * @details    This macro reflects the current WWDT counter value.\r
+  * \hideinitializer\r
+  */\r
+#define WWDT_GET_COUNTER()          (WWDT->CNT)\r
+\r
+/**\r
+  * @brief      Reload WWDT Counter\r
+  *\r
+  * @param      None\r
+  *\r
+  * @return     None\r
+  *\r
+  * @details    This macro is used to reload the WWDT counter value to 0x3F.\r
+  * @note       User can only write WWDT_RLDCNT register to reload WWDT counter value when current WWDT counter value \n\r
+  *             between 0 and CMPDAT value. If user writes WWDT_RLDCNT when current WWDT counter value is larger than CMPDAT, \n\r
+  *             WWDT reset signal will generate immediately to reset system.\r
+  * \hideinitializer\r
+  */\r
+#define WWDT_RELOAD_COUNTER()       (WWDT->RLDCNT = WWDT_RELOAD_WORD)\r
+\r
+void WWDT_Open(uint32_t u32PreScale, uint32_t u32CmpValue, uint32_t u32EnableInt);\r
+\r
+/*@}*/ /* end of group WWDT_EXPORTED_FUNCTIONS */\r
+\r
+/*@}*/ /* end of group WWDT_Driver */\r
+\r
+/*@}*/ /* end of group Standard_Driver */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* __WWDT_H__ */\r
+\r
+/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/\r