diff options
Diffstat (limited to 'fdl/ch573/systick.fdl')
-rw-r--r-- | fdl/ch573/systick.fdl | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/fdl/ch573/systick.fdl b/fdl/ch573/systick.fdl new file mode 100644 index 0000000..8e05685 --- /dev/null +++ b/fdl/ch573/systick.fdl @@ -0,0 +1,72 @@ +import "ch573/common.fdl"; + +/** Package for SYSTICK (system counter). */ +package ch573.systick { + location systick_base = 0xE000F000; + + using ch573.common; + + type systick_t : struct { + reg cfg(32) @0x0 : struct { + /** Enable the systick. */ + rw enabled : enable_t; + + /** Enable the systick interrupt. */ + rw interrupt_enable : enable_t; + + /** Clock source for the systick. */ + rw clock_source : enum(1) { + [[ c: unqualified ]] + SYSTICK_CLOCK_SOURCE_HCLK = 1, + + [[ c: unqualified ]] + SYSTICK_CLOCK_SOURCE_HCLK_DIV_8 = 0, + }; + + reserved(5); + + /** Write 1 to reload the systick. */ + wo st_reload : (1); + reserved(23); + }; + + assert_pos(0x4); + union { + struct { + /** Lower 32 bits of the systick count. */ + reg count_low(32); + assert_pos(0x8); + + /** Upper 32 bits of the systick count. */ + reg count_high(32); + }; + /** Full 64 bits of the systick count. */ + reg count(64); + }; + + assert_pos(0xC); + union { + struct { + /** Lower 32 bits of the systick reload value. */ + reg reload_low(32); + assert_pos(0x10); + /** Upper 32 bits of the systick reload value. */ + reg reload_high(32); + }; + /** Full 64-bit systick reload value. */ + reg reload(64); + }; + + reg (32) @0x14 : struct { + /** Software interrupt happened. (Set to 1 to trigger a software + * interrupt.) */ + software_interrupt_flag : (1); + + /** Counter interrupt happened. */ + counter_interrupt_flag : (1); + reserved(30); + }; + }; + + instance systick at systick_base : systick_t; +}; |