aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-05-17 18:15:14 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-05-19 15:03:21 -0400
commit984fd3f3a6a594e921804eef66d915a33b2e67cb (patch)
tree9818eaf2a7050d20c23064325d7cb1c45e07f22e
parent2da333ded84dc2c1881fb6e18213ff347dfb2c02 (diff)
downloadlibrambutan-984fd3f3a6a594e921804eef66d915a33b2e67cb.tar.gz
librambutan-984fd3f3a6a594e921804eef66d915a33b2e67cb.zip
bkp.h: Adding missing register bit definitions
-rw-r--r--libmaple/bkp.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/libmaple/bkp.h b/libmaple/bkp.h
index 97edd2a..e8b82e9 100644
--- a/libmaple/bkp.h
+++ b/libmaple/bkp.h
@@ -109,6 +109,51 @@ typedef struct bkp_dev {
/** Backup device. */
extern const bkp_dev *BKP;
+/*
+ * Register bit definitions
+ */
+
+/* Data Registers */
+
+#define BKP_DR_D 0xFFFF
+
+/* RTC Clock Calibration Register */
+
+#define BKP_RTCCR_ASOS_BIT 9
+#define BKP_RTCCR_ASOE_BIT 8
+#define BKP_RTCCR_CCO_BIT 7
+
+#define BKP_RTCCR_ASOS BIT(BKP_RTCCR_ASOS_BIT)
+#define BKP_RTCCR_ASOE BIT(BKP_RTCCR_ASOE_BIT)
+#define BKP_RTCCR_CCO BIT(BKP_RTCCR_CCO_BIT)
+#define BKP_RTCCR_CAL 0x7F
+
+/* Backup control register */
+
+#define BKP_CR_TPAL_BIT 1
+#define BKP_CR_TPE_BIT 0
+
+#define BKP_CR_TPAL BIT(BKP_CR_TPAL_BIT)
+#define BKP_CR_TPE BIT(BKP_CR_TPE_BIT)
+
+/* Backup control/status register */
+
+#define BKP_CSR_TIF_BIT 9
+#define BKP_CSR_TEF_BIT 8
+#define BKP_CSR_TPIE_BIT 2
+#define BKP_CSR_CTI_BIT 1
+#define BKP_CSR_CTE_BIT 0
+
+#define BKP_CSR_TIF BIT(BKP_CSR_TIF_BIT)
+#define BKP_CSR_TEF BIT(BKP_CSR_TEF_BIT)
+#define BKP_CSR_TPIE BIT(BKP_CSR_TPIE_BIT)
+#define BKP_CSR_CTI BIT(BKP_CSR_CTI_BIT)
+#define BKP_CSR_CTE BIT(BKP_CSR_CTE_BIT)
+
+/*
+ * Convenience functions
+ */
+
void bkp_init(void);
void bkp_enable_writes(void);
void bkp_disable_writes(void);