summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc313x/lpc313x_wdt.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-12-24 00:12:54 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-12-24 00:12:54 +0000
commit7748ea4e77ad9a4d85de0ff929f006a3041b607b (patch)
treec5d07010d13ffb1f863845b8d0615d91aba2c848 /nuttx/arch/arm/src/lpc313x/lpc313x_wdt.h
parent10b097e7e80e5bec84604ad1ebb76d4835da4676 (diff)
downloadpx4-nuttx-7748ea4e77ad9a4d85de0ff929f006a3041b607b.tar.gz
px4-nuttx-7748ea4e77ad9a4d85de0ff929f006a3041b607b.tar.bz2
px4-nuttx-7748ea4e77ad9a4d85de0ff929f006a3041b607b.zip
Add lpc313x header files
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2415 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc313x/lpc313x_wdt.h')
-rwxr-xr-xnuttx/arch/arm/src/lpc313x/lpc313x_wdt.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/nuttx/arch/arm/src/lpc313x/lpc313x_wdt.h b/nuttx/arch/arm/src/lpc313x/lpc313x_wdt.h
new file mode 100755
index 000000000..fd6e0f4e0
--- /dev/null
+++ b/nuttx/arch/arm/src/lpc313x/lpc313x_wdt.h
@@ -0,0 +1,130 @@
+/************************************************************************************************
+ * arch/arm/src/lpc313x/lpc313x_wdt.h
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC313X_WDT_H
+#define __ARCH_ARM_SRC_LPC313X_WDT_H
+
+/************************************************************************************************
+ * Included Files
+ ************************************************************************************************/
+
+#include <nuttx/config.h>
+#include "lpc313x_memorymap.h"
+
+/************************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************************/
+
+/* WDT register base address offset into the APB0 domain ****************************************/
+
+#define LPC313X_WDT_VBASE (LPC313X_APB0_VSECTION+LPC313X_APB0_WDT_OFFSET)
+#define LPC313X_WDT_PBASE (LPC313X_APB0_PSECTION+LPC313X_APB0_WDT_OFFSET)
+
+/* WDT register offsets (with respect to the WDT base) ******************************************/
+
+#define LPC313X_WDT_IR_OFFSET 0x000 /* Interrupt Register */
+#define LPC313X_WDT_TCR_OFFSET 0x004 /* Timer Control Register */
+#define LPC313X_WDT_TC_OFFSET 0x008 /* Timer Counter */
+#define LPC313X_WDT_PR_OFFSET 0x00c /* Timer Prescale Register */
+#define LPC313X_WDT_PC_OFFSET 0x010 /* Prescale Counter */
+#define LPC313X_WDT_MCR_OFFSET 0x014 /* Match Control Register */
+#define LPC313X_WDT_MR0_OFFSET 0x018 /* Match Register 0 */
+#define LPC313X_WDT_MR1_OFFSET 0x01c /* Match Register 1 */
+ /* 0x020-0x038: Reserved */
+#define LPC313X_WDT_EMR_OFFSET 0x03c /* External Match Register */
+
+/* WDT register (virtual) addresses *************************************************************/
+
+#define LPC313X_WDT_IR (LPC313X_WDT_VBASE+LPC313X_WDT_IR_OFFSET)
+#define LPC313X_WDT_TCR (LPC313X_WDT_VBASE+LPC313X_WDT_TCR_OFFSET)
+#define LPC313X_WDT_TC (LPC313X_WDT_VBASE+LPC313X_WDT_TC_OFFSET)
+#define LPC313X_WDT_PR (LPC313X_WDT_VBASE+LPC313X_WDT_PR_OFFSET)
+#define LPC313X_WDT_PC (LPC313X_WDT_VBASE+LPC313X_WDT_PC_OFFSET)
+#define LPC313X_WDT_MCR (LPC313X_WDT_VBASE+LPC313X_WDT_MCR_OFFSET)
+#define LPC313X_WDT_MR0 (LPC313X_WDT_VBASE+LPC313X_WDT_MR0_OFFSET)
+#define LPC313X_WDT_MR1 (LPC313X_WDT_VBASE+LPC313X_WDT_MR1_OFFSET)
+#define LPC313X_WDT_EMR (LPC313X_WDT_VBASE+LPC313X_WDT_EMR_OFFSET)
+
+/* WDT register bit definitions *****************************************************************/
+
+/* Interrupt Register (IR), address 0x13002400 */
+
+#define WDT_IR_INTRM1 (1 << 1) /* Bit 1: MR1 and TC match interrupt */
+#define WDT_IR_INTRM0 (1 << 0) /* Bit 0: MR0 and TC match interrupt */
+
+/* Timer Control Register (TCR), address 0x13002404 */
+
+#define WDT_TCR_RESET (1 << 1) /* Bit 1: Reset on the next WDOG_PCLK */
+#define WDT_TCR_ENABLE (1 << 0) /* Bit 0: Enable */
+
+/* Match Control Register (MCR), address 0x1300 2414 */
+
+#define WDT_MCR_MR1STOP (1 << 5) /* Bit 5: Stop counting when MR1=TC */
+#define WDT_MCR_MR1RESET (1 << 4) /* Bit 4: Reset TC if MR1=TC */
+#define WDT_MCR_MR1INT (1 << 3) /* Bit 3: System reset when MR1=TC */
+#define WDT_MCR_MR0STOP (1 << 2) /* Bit 2: Stop counting when MR0=TC */
+#define WDT_MCR_MR0RESET (1 << 1) /* Bit 1: Reset TC if MR0=TC */
+#define WDT_MCR_MR0INT (1 << 0) /* Bit 0: System reset when MR0=TC */
+
+/* External Match Registers (EMR), address 0x1300 243c */
+
+#define WDT_EMR_EXTMATCHCTRL1_SHIFT (6) /* Bits 6-7: Controls EXTMATCH1 when MR1=TC */
+#define WDT_EMR_EXTMATCHCTRL1_MASK (3 << WDT_EMR_EXTMATCHCTRL1_SHIFT)
+# define WDT_EMR_EXTMATCHCTRL1_NOTHING (0 << WDT_EMR_EXTMATCHCTRL1_SHIFT) /* Do Nothing */
+# define WDT_EMR_EXTMATCHCTRL1_SETLOW (1 << WDT_EMR_EXTMATCHCTRL1_SHIFT) /* Set LOW */
+# define WDT_EMR_EXTMATCHCTRL1_SETHIGH (2 << WDT_EMR_EXTMATCHCTRL1_SHIFT) /* Set HIGH */
+# define WDT_EMR_EXTMATCHCTRL1_TOGGLE (3 << WDT_EMR_EXTMATCHCTRL1_SHIFT) /* Toggle */
+#define WDT_EMR_EXTMATCHCTRL0_SHIFT (4) /* Bits 4-5: Controls EXTMATCH0 when MR0=TC */
+#define WDT_EMR_EXTMATCHCTRL0_MASK (3 << WDT_EMR_EXTMATCHCTRL0_SHIFT)
+# define WDT_EMR_EXTMATCHCTRL0_NOTHING (0 << WDT_EMR_EXTMATCHCTRL0_SHIFT) /* Do Nothing */
+# define WDT_EMR_EXTMATCHCTRL0_SETLOW (1 << WDT_EMR_EXTMATCHCTRL0_SHIFT) /* Set LOW */
+# define WDT_EMR_EXTMATCHCTRL0_SETHIGH (2 << WDT_EMR_EXTMATCHCTRL0_SHIFT) /* Set HIGH */
+# define WDT_EMR_EXTMATCHCTRL0_TOGGLE (3 << WDT_EMR_EXTMATCHCTRL0_SHIFT) /* Toggle */
+#define WDT_EMR_EXTMATCH1 (1 << 1) /* Bit 1: EXTMATCHCTRL1 controls behavior */
+#define WDT_EMR_EXTMATCH0 (1 << 0) /* Bit 0: EXTMATCHCTRL1 controls behavior */
+
+/************************************************************************************************
+ * Public Types
+ ************************************************************************************************/
+
+/************************************************************************************************
+ * Public Data
+ ************************************************************************************************/
+
+/************************************************************************************************
+ * Public Functions
+ ************************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC313X_WDT_H */