From a02bcecaec7048173b47d56edd8d96fea597ac15 Mon Sep 17 00:00:00 2001 From: Steins7 Date: Tue, 16 Jul 2024 22:21:05 +0200 Subject: [PATCH] Implement RTC module's registers --- drv/rtc_regs.h | 125 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 drv/rtc_regs.h diff --git a/drv/rtc_regs.h b/drv/rtc_regs.h new file mode 100644 index 0000000..de83d87 --- /dev/null +++ b/drv/rtc_regs.h @@ -0,0 +1,125 @@ +/** @file rtc_regs.h + * Module defining the Real-Time Clock (RTC) registers. + * + * Mainly made to be used by the rtc module. It is recommanded to go through + * the functions provided by that module instead of directly using the registers + * defined here. + */ + +#ifndef _RTC_REGS_H_ +#define _RTC_REGS_H_ + +//--includes-------------------------------------------------------------------- + +#include "stdint.h" + + +//--type definitions------------------------------------------------------------ + +#define RTC_BASE_ADDRESS 0x40002800 + +union RTC_CRH { + struct { + uint32_t SECIE:1; + uint32_t ALRIE:1; + uint32_t OWIE:1; + uint32_t reserved1:29; + }; + uint32_t word; +}; + +union RTC_CRL { + struct { + uint32_t SECF:1; + uint32_t ALRF:1; + uint32_t OWF:1; + uint32_t RSF:1; + uint32_t CNF:1; + uint32_t RTOFF:1; + uint32_t reserved1:26; + }; + uint32_t word; +}; + +union RTC_PRLH { + struct { + uint32_t PRL:4; + uint32_t reserved1:28; + }; + uint32_t word; +}; + +union RTC_PRLL { + struct { + uint32_t PRL:16; + uint32_t reserved1:16; + }; + uint32_t word; +}; + +union RTC_DIVH { + struct { + uint32_t RTC_DIV:4; + uint32_t reserved1:28; + }; + uint32_t word; +}; + +union RTC_DIVL { + struct { + uint32_t RTC_DIV:16; + uint32_t reserved1:16; + }; + uint32_t word; +}; + +union RTC_CNTH { + struct { + uint32_t RTC_CNT:16; + uint32_t reserved1:16; + }; + uint32_t word; +}; + +union RTC_CNTL { + struct { + uint32_t RTC_CNT:16; + uint32_t reserved1:16; + }; + uint32_t word; +}; + +union RTC_ALRH { + struct { + uint32_t RTC_ALR:16; + uint32_t reserved1:16; + }; + uint32_t word; +}; + +union RTC_ALRL { + struct { + uint32_t RTC_ALR:16; + uint32_t reserved1:16; + }; + uint32_t word; +}; + +struct RTC { + union RTC_CRH CRH; + union RTC_CRL CRL; + union RTC_PRLH PRLH; + union RTC_PRLL PRLL; + union RTC_DIVH DIVH; + union RTC_DIVL DIVL; + union RTC_CNTH CNTH; + union RTC_CNTL CNTL; + union RTC_ALRH ALRH; + union RTC_ALRL ALRL; +}; + + +//--functions------------------------------------------------------------------- + +#endif //_RTC_REGS_H_ +