]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/MSP430FR5969_LaunchPad/driverlib/MSP430FR5xx_6xx/wdt_a.c
Start of an MSP430FR5969 IAR project - currently running Blinky only.
[freertos] / FreeRTOS / Demo / MSP430FR5969_LaunchPad / driverlib / MSP430FR5xx_6xx / wdt_a.c
diff --git a/FreeRTOS/Demo/MSP430FR5969_LaunchPad/driverlib/MSP430FR5xx_6xx/wdt_a.c b/FreeRTOS/Demo/MSP430FR5969_LaunchPad/driverlib/MSP430FR5xx_6xx/wdt_a.c
new file mode 100644 (file)
index 0000000..bba45df
--- /dev/null
@@ -0,0 +1,102 @@
+/* --COPYRIGHT--,BSD\r
+ * Copyright (c) 2014, Texas Instruments Incorporated\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ *\r
+ * *  Redistributions of source code must retain the above copyright\r
+ *    notice, this list of conditions and the following disclaimer.\r
+ *\r
+ * *  Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the\r
+ *    documentation and/or other materials provided with the distribution.\r
+ *\r
+ * *  Neither the name of Texas Instruments Incorporated nor the names of\r
+ *    its contributors may be used to endorse or promote products derived\r
+ *    from this software without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\r
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\r
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * --/COPYRIGHT--*/\r
+//*****************************************************************************\r
+//\r
+// wdt_a.c - Driver for the wdt_a Module.\r
+//\r
+//*****************************************************************************\r
+\r
+//*****************************************************************************\r
+//\r
+//! \addtogroup wdt_a_api wdt_a\r
+//! @{\r
+//\r
+//*****************************************************************************\r
+\r
+#include "inc/hw_regaccess.h"\r
+#include "inc/hw_memmap.h"\r
+\r
+#ifdef __MSP430_HAS_WDT_A__\r
+#include "wdt_a.h"\r
+\r
+#include <assert.h>\r
+\r
+void WDT_A_hold(uint16_t baseAddress)\r
+{\r
+    // Set Hold bit\r
+    uint8_t newWDTStatus =\r
+        ((HWREG16(baseAddress + OFS_WDTCTL) & 0x00FF) | WDTHOLD);\r
+\r
+    HWREG16(baseAddress + OFS_WDTCTL) = WDTPW + newWDTStatus;\r
+}\r
+\r
+void WDT_A_start(uint16_t baseAddress)\r
+{\r
+    // Reset Hold bit\r
+    uint8_t newWDTStatus =\r
+        ((HWREG16(baseAddress + OFS_WDTCTL) & 0x00FF) & ~(WDTHOLD));\r
+\r
+    HWREG16(baseAddress + OFS_WDTCTL) = WDTPW + newWDTStatus;\r
+}\r
+\r
+void WDT_A_resetTimer(uint16_t baseAddress)\r
+{\r
+    // Set Counter Clear bit\r
+    uint8_t newWDTStatus =\r
+        ((HWREG16(baseAddress + OFS_WDTCTL) & 0x00FF) | WDTCNTCL);\r
+\r
+    HWREG16(baseAddress + OFS_WDTCTL) = WDTPW + newWDTStatus;\r
+}\r
+\r
+void WDT_A_initWatchdogTimer(uint16_t baseAddress,\r
+                             uint8_t clockSelect,\r
+                             uint8_t clockDivider)\r
+{\r
+    HWREG16(baseAddress + OFS_WDTCTL) =\r
+        WDTPW + WDTCNTCL + WDTHOLD + clockSelect + clockDivider;\r
+}\r
+\r
+void WDT_A_initIntervalTimer(uint16_t baseAddress,\r
+                             uint8_t clockSelect,\r
+                             uint8_t clockDivider)\r
+{\r
+    HWREG16(baseAddress + OFS_WDTCTL) =\r
+        WDTPW + WDTCNTCL + WDTHOLD + WDTTMSEL + clockSelect + clockDivider;\r
+}\r
+\r
+#endif\r
+//*****************************************************************************\r
+//\r
+//! Close the doxygen group for wdt_a_api\r
+//! @}\r
+//\r
+//*****************************************************************************\r