summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2016-11-30 16:58:16 +0000
committerTomasz Kramkowski <tk@the-tk.com>2016-11-30 16:58:16 +0000
commitb5c347bba125d91a0c215f9d0edd33fefca2db51 (patch)
tree568f4def5231160d90eced5d699c142b0a8169d9 /lib
parent6bd06e042da524448dae7e48a7499517948be2b8 (diff)
downloadfmk-b5c347bba125d91a0c215f9d0edd33fefca2db51.tar.gz
fmk-b5c347bba125d91a0c215f9d0edd33fefca2db51.tar.xz
fmk-b5c347bba125d91a0c215f9d0edd33fefca2db51.zip
Add defines for PIT
Diffstat (limited to 'lib')
-rw-r--r--lib/reg.h2
-rw-r--r--lib/reg/pit.h26
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/reg.h b/lib/reg.h
index 1a10792..8d316e0 100644
--- a/lib/reg.h
+++ b/lib/reg.h
@@ -27,7 +27,7 @@
//#include <reg/vref.h>
//#include <reg/pdb.h>
//#include <reg/ftm.h>
-//#include <reg/pit.h>
+#include <reg/pit.h>
//#include <reg/lptmr.h>
//#include <reg/cmt.h>
//#include <reg/rtc.h>
diff --git a/lib/reg/pit.h b/lib/reg/pit.h
new file mode 100644
index 0000000..90587f6
--- /dev/null
+++ b/lib/reg/pit.h
@@ -0,0 +1,26 @@
+#ifndef LIB_REG_PIT_H
+#define LIB_REG_PIT_H
+
+#include "regdefs.h"
+
+#define PIT_MCR REG_32(0x40037000) // PIT Module Control Register
+#define MCR_MDIS 1
+#define MCR_FRZ 0
+
+#define PIT_LDVAL(n) REG_32(0x40037100 + 16 * (n)) // Timer Load Value Register
+#define LDVAL_TSV 0 // Timer Start Value
+#define LDVAL_TSV_M (uint32_t)BITS(32)
+
+#define PIT_CVAL(n) REG_32(0x40037104 + 16 * (n)) // Current Timer Value Register
+#define CVAL_TVL 0 // Current Timer Value
+#define CVAL_TVL_M (uint32_t)BITS(32)
+
+#define PIT_TCTRL(n) REG_32(0x40037108 + 16 * (n)) // Timer Control Register
+#define TCTRL_CHN 2 // Chain Mode
+#define TCTRL_TIE 1 // Timer Interrupt Enable
+#define TCTRL_TEN 0 // Timer Enable
+
+#define PIT_TFLG(n) REG_32(0x4003710C + 16 * (n)) // Timer Flag Register
+#define TFLG_TIF 0 // Timer Interrupt Flag
+
+#endif /* LIB_REG_PIT_H */