summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyles Watson <mylesgw@chromium.org>2014-12-04 16:27:00 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2014-12-31 00:01:25 +0000
commit741a2d45897d3d82462b065c790cf7eae6823d4e (patch)
tree51138418cec64a898dbe76051d9f1bd7ddb5fb67
parente3447708a4977036938416daef38ad7d0e8ed650 (diff)
downloadchrome-ec-741a2d45897d3d82462b065c790cf7eae6823d4e.tar.gz
nrf51: Add definitions for GPIOTE, the GPIO Tasks and Events.
Updated to use parameters for GPIOTE_OUT, GPIOTE_IN, and GPIOTE_CONFIG Updated with NRF51_GPIOTE_IN_COUNT to remove the magic number. BUG=chrome-os-partner:34477 BRANCH=none TEST=Configured IN[] events and PORT events and checked that they triggered events and wrote to the console. Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: I2021ecbee67c39571f277c97082378dce4de024f Reviewed-on: https://chromium-review.googlesource.com/234289 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
-rw-r--r--chip/nrf51/registers.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/chip/nrf51/registers.h b/chip/nrf51/registers.h
index dc0c060400..3e8180bd0a 100644
--- a/chip/nrf51/registers.h
+++ b/chip/nrf51/registers.h
@@ -267,6 +267,39 @@
#define NRF55_TWI1_TXDRDY_BIT ((0x11C - 0x100) / 4)
/*
+ * GPIOTE - GPIO Tasks and Events
+ */
+#define NRF51_GPIOTE_BASE 0x40006000
+/* Tasks */
+#define NRF51_GPIOTE_OUT(n) REG32(NRF51_GPIOTE_BASE + ((n) * 4))
+/* Events */
+#define NRF51_GPIOTE_IN(n) REG32(NRF51_GPIOTE_BASE + 0x100 + ((n) * 4))
+#define NRF51_GPIOTE_PORT REG32(NRF51_GPIOTE_BASE + 0x17C)
+/* Registers */
+#define NRF51_GPIOTE_INTENSET REG32(NRF51_GPIOTE_BASE + 0x304)
+#define NRF51_GPIOTE_INTENCLR REG32(NRF51_GPIOTE_BASE + 0x308)
+#define NRF51_GPIOTE_CONFIG(n) REG32(NRF51_GPIOTE_BASE + 0x510 + ((n) * 4))
+#define NRF51_GPIOTE_POWER REG32(NRF51_GPIOTE_BASE + 0xFFC)
+
+/* Number of IN events */
+#define NRF51_GPIOTE_IN_COUNT 4
+
+/* Bits */
+/* For GPIOTE.INTEN */
+#define NRF51_GPIOTE_IN_BIT(n) (n)
+#define NRF51_GPIOTE_PORT_BIT 31
+/* For GPIOTE.CONFIG */
+#define NRF51_GPIOTE_MODE_DISABLED (0<<0)
+#define NRF51_GPIOTE_MODE_EVENT (1<<0)
+#define NRF51_GPIOTE_MODE_TASK (3<<0)
+#define NRF51_GPIOTE_PSEL_POS (8)
+#define NRF51_GPIOTE_POLARITY_LOTOHI (1<<16)
+#define NRF51_GPIOTE_POLARITY_HITOLO (2<<16)
+#define NRF51_GPIOTE_POLARITY_TOGGLE (3<<16)
+#define NRF51_GPIOTE_OUTINIT_LOW (0<<20)
+#define NRF51_GPIOTE_OUTINIT_HIGH (1<<20)
+
+/*
* Timer / Counter
*/
#define NRF51_TIMER0_BASE 0x40008000