@GNU AS
@.CharSet         CP1251 (Cyrillic)
@.desc type=module
@ +------------------------------------------------------------------+
@ |                     Базовые константы RTC                        |
@ |                stm32f401xB/C   stm32f401xD/E                     |                    |
@ +------------------------------------------------------------------+
@.enddesc

.include   "/src/inc/base.inc"

@.item     APB2PERIPH_BASE
.EQU  RTC_BASE           , APB1PERIPH_BASE + 0x2800
.EQU  RTC                , PERIPH_BASE + RTC_BASE
@.end

@.item     RTC_BASE
.EQU  RTC_TR             , 0x00          @ RTC time register
.EQU  RTC_DR             , 0x04          @ RTC date register
.EQU  RTC_CR             , 0x08          @ RTC control register
.EQU  RTC_ISR            , 0x0C          @ RTC initialization and status register
.EQU  RTC_PRER           , 0x10          @ RTC prescaler register
.EQU  RTC_WUTR           , 0x14          @ RTC wakeup timer register
.EQU  RTC_CALIBR         , 0x18          @ RTC calibration register
.EQU  RTC_ALRMAR         , 0x1C          @ RTC alarm A register
.EQU  RTC_ALRMBR         , 0x20          @ RTC alarm B register
.EQU  RTC_WPR            , 0x24          @ RTC write protection register
.EQU  RTC_SSR            , 0x28          @ RTC sub second register
.EQU  RTC_TSTR           , 0x30          @ RTC time stamp time register
.EQU  RTC_TSSSR          , 0x38          @ RTC time-stamp sub second register
.EQU  RTC_CALR           , 0x3C          @ RTC calibration register
.EQU  RTC_TAFCR          , 0x40          @ RTC tamper and alternate function configuration register
.EQU  RTC_ALRMASSR       , 0x44          @ RTC alarm A sub second register
.EQU  RTC_ALRMBSSR       , 0x48          @ RTC alarm B sub second register
.EQU  RTC_BKP0R          , 0x50          @ RTC backup register 1
.EQU  RTC_BKP1R          , 0x54          @ RTC backup register 1
.EQU  RTC_BKP2R          , 0x58          @ RTC backup register 2
.EQU  RTC_BKP3R          , 0x5C          @ RTC backup register 3
.EQU  RTC_BKP4R          , 0x60          @ RTC backup register 4
.EQU  RTC_BKP5R          , 0x64          @ RTC backup register 5
.EQU  RTC_BKP6R          , 0x68          @ RTC backup register 6
.EQU  RTC_BKP7R          , 0x6C          @ RTC backup register 7
.EQU  RTC_BKP8R          , 0x70          @ RTC backup register 8
.EQU  RTC_BKP9R          , 0x74          @ RTC backup register 9
.EQU  RTC_BKP10R         , 0x78          @ RTC backup register 10
.EQU  RTC_BKP11R         , 0x7C          @ RTC backup register 11
.EQU  RTC_BKP12R         , 0x80          @ RTC backup register 12
.EQU  RTC_BKP13R         , 0x84          @ RTC backup register 13
.EQU  RTC_BKP14R         , 0x88          @ RTC backup register 14
.EQU  RTC_BKP15R         , 0x8C          @ RTC backup register 15
.EQU  RTC_BKP16R         , 0x90          @ RTC backup register 16
.EQU  RTC_BKP17R         , 0x94          @ RTC backup register 17
.EQU  RTC_BKP18R         , 0x98          @ RTC backup register 18
.EQU  RTC_BKP19R         , 0x9C          @ RTC backup register 19
@.end

@ Описание битов настройки регистра RTC_TR
@.item     RTC_TR
.EQU  RTC_TR_PM          , 1 << 22       @ Bit 22 PM: AM/PM@ PM
.EQU  RTC_TR_HT_N        , 20            @  Bits 21:20 HT[1:0]: Hour tens in BCD format
.EQU  RTC_TR_HT_0        , 1 << 20
.EQU  RTC_TR_HT_1        , 2 << 20
.EQU  RTC_TR_HU_N        , 16            @  Bits 19:16 HU[3:0]: Hour units in BCD format
.EQU  RTC_TR_HU_0        , 1 << 16
.EQU  RTC_TR_HU_1        , 2 << 16
.EQU  RTC_TR_HU_2        , 4 << 16
.EQU  RTC_TR_HU_3        , 8 << 16
.EQU  RTC_TR_MNT_N       , 12            @ Bits 14:12 MNT[2:0]: Minute tens in BCD format
.EQU  RTC_TR_MNT_0       , 1 << 12
.EQU  RTC_TR_MNT_1       , 2 << 12
.EQU  RTC_TR_MNT_2       , 4 << 12
.EQU  RTC_TR_MNU_N       , 8             @ Bit 11:8 MNU[3:0]: Minute units in BCD format
.EQU  RTC_TR_MNU_0       , 1 << 8
.EQU  RTC_TR_MNU_1       , 2 << 8
.EQU  RTC_TR_MNU_2       , 4 << 8
.EQU  RTC_TR_MNU_3       , 8 << 8
.EQU  RTC_TR_ST_N        , 4             @  Bits 6:4 ST[2:0]: Second tens in BCD format
.EQU  RTC_TR_ST_0        , 1 << 4
.EQU  RTC_TR_ST_1        , 2 << 4
.EQU  RTC_TR_ST_2        , 4 << 4
.EQU  RTC_TR_SU_N        , 0             @  Bits 3:0 SU[3:0]: Second units in BCD format
.EQU  RTC_TR_SU_0        , 0x00000001
.EQU  RTC_TR_SU_1        , 0x00000002
.EQU  RTC_TR_SU_2        , 0x00000004
.EQU  RTC_TR_SU_3        , 0x00000008
@.end

@ Описание битов настройки регистра  RTC_DR
@.item  RTC_DR
.EQU  RTC_DR_YT_N        , 20            @ Bits 23:20 YT[3:0]: Year tens in BCD format
.EQU  RTC_DR_YT_0        , 1 << 20
.EQU  RTC_DR_YT_1        , 2 << 20
.EQU  RTC_DR_YT_2        , 4 << 20
.EQU  RTC_DR_YT_3        , 8 << 20
.EQU  RTC_DR_YU_N        , 16            @ Bits 19:16 YU[3:0]: Year units in BCD format
.EQU  RTC_DR_YU_0        , 1 << 16
.EQU  RTC_DR_YU_1        , 2 << 16
.EQU  RTC_DR_YU_2        , 4 << 16
.EQU  RTC_DR_YU_3        , 8 << 16
.EQU  RTC_DR_WDU_N       , 13            @ Bits 15:13 WDU[2:0]: Week day units
.EQU  RTC_DR_WDU_0       , 1 << 13
.EQU  RTC_DR_WDU_1       , 2 << 13
.EQU  RTC_DR_WDU_2       , 4 << 13
.EQU  RTC_DR_MT_N        , 12            @ Bit 12 MT: Month tens in BCD format
.EQU  RTC_DR_MT          , 1 << 12
.EQU  RTC_DR_MU_N        , 8             @ Bits 11:8 MU: Month units in BCD format
.EQU  RTC_DR_MU_0        , 1 << 8
.EQU  RTC_DR_MU_1        , 2 << 8
.EQU  RTC_DR_MU_2        , 4 << 8
.EQU  RTC_DR_MU_3        , 8 << 8
.EQU  RTC_DR_DT_N        , 4             @ Bits 5:4 DT[1:0]: Date tens in BCD format
.EQU  RTC_DR_DT_0        , 1 << 4
.EQU  RTC_DR_DT_1        , 2 << 4
.EQU  RTC_DR_DU_N        , 0             @  Bits 3:0 DU[3:0]: Date units in BCD format
.EQU  RTC_DR_DU_0        , 0x00000001
.EQU  RTC_DR_DU_1        , 0x00000002
.EQU  RTC_DR_DU_2        , 0x00000004
.EQU  RTC_DR_DU_3        , 0x00000008
@.end

@ Описание битов настройки регистра  RTC_CR
@.item  RTC_CR
.EQU  RTC_CR_COE_1       , 1 << 23       @  1: Calibration output enabled
.EQU  RTC_CR_OSEL_N      , 21            @  Bits 22:21 OSEL[1:0]: Output selection
.EQU  RTC_CR_OSEL_0      , 1 << 21       @  01: Alarm A output enabled
.EQU  RTC_CR_OSEL_1      , 2 << 21       @  10:Alarm B output enabled
.EQU  RTC_CR_POL         , 1 << 20       @ Bit 20 POL: Output polarity of RTC_ALARM output
.EQU  RTC_CR_COSEL       , 1 << 19       @ it 19 COSEL: Calibration output selection
.EQU  RTC_CR_BKP         , 1 << 18       @ Bit 18 BKP: Backup
.EQU  RTC_CR_SUB1H       , 1 << 17       @ Bit 17 SUB1H: Subtract 1 hour (winter time change)
.EQU  RTC_CR_ADD1H       , 1 << 16       @  Bit 16 ADD1H: Add 1 hour (summer time change)
.EQU  RTC_CR_TSIE        , 1 << 15       @ Bit 15 TSIE: Timestamp interrupt enable
.EQU  RTC_CR_WUTIE       , 1 << 14       @ Bit 14 WUTIE: Wakeup timer interrupt enable
.EQU  RTC_CR_ALRBIE      , 1 << 13       @ Bit 13 ALRBIE: Alarm B interrupt enable
.EQU  RTC_CR_ALRAIE      , 1 << 12       @ Bit 12 ALRAIE: Alarm A interrupt enable
.EQU  RTC_CR_TSE         , 1 << 11       @ Bit 11 TSE: Time stamp enable
.EQU  RTC_CR_WUTE        , 1 << 10       @  Bit 10 WUTE: Wakeup timer enable
.EQU  RTC_CR_ALRBE       , 1 << 9        @  Bit 9 ALRBE : Alarm B enable
.EQU  RTC_CR_ALRAE       , 1 << 8        @  Bit 8 ALRAE: Alarm A enable
.EQU  RTC_CR_DCE         , 1 << 7        @  Bit 7 DCE: Coarse digital calibration enable
.EQU  RTC_CR_FMT         , 1 << 6        @  Bit 6 FMT: Hour format
.EQU  RTC_CR_BYPSHAD     , 1 << 5        @  Bit 5 BYPSHAD: Bypass the shadow registers
.EQU  RTC_CR_REFCKON     , 1 << 4        @  Bit 4 REFCKON: Reference clock detection enable (50 or 60 Hz)
.EQU  RTC_CR_TSEDGE      , 1 << 3        @  Bit 3 TSEDGE: Timestamp event active edge
.EQU  RTC_CR_WUCKSEL_N   , 0             @   Bits 2:0 WUCKSEL[2:0]: Wakeup clock selection
.EQU  RTC_CR_WUCKSEL_0   , 0x00000001
.EQU  RTC_CR_WUCKSEL_1   , 0x00000002
.EQU  RTC_CR_WUCKSEL_2   , 0x00000004
@.end

@ Описание битов настройки регистра  RTC_ISR
@.item  RTC_ISR
.EQU  RTC_ISR_RECALPF    , 1 << 16       @ Bit 16 RECALPF: Recalibration pending Flag
.EQU  RTC_ISR_TAMP1F     , 1 << 13       @ Bit 13 TAMP1F: Tamper detection flag
.EQU  RTC_ISR_TSOVF      , 1 << 12       @ Bit 12 TSOVF: Timestamp overflow flag
.EQU  RTC_ISR_TSF        , 1 << 11       @ Bit 11 TSF: Timestamp flag
.EQU  RTC_ISR_WUTF       , 1 << 10       @ Bit 10 WUTF: Wakeup timer flag
.EQU  RTC_ISR_ALRBF      , 1 << 9        @ Bit 9 ALRBF: Alarm B flag
.EQU  RTC_ISR_ALRAF      , 1 << 8        @ Bit 8 ALRAF: Alarm A flag
.EQU  RTC_ISR_INIT       , 1 << 7        @ Bit 7 INIT: Initialization modei
.EQU  RTC_ISR_INITF      , 1 << 6        @ Bit 6 INITF: Initialization flag
.EQU  RTC_ISR_RSF        , 1 << 5        @ Bit 5 RSF: Registers synchronization flag
.EQU  RTC_ISR_INITS      , 1 << 4        @ Bit 5 RSF: Registers synchronization flag
.EQU  RTC_ISR_SHPF       , 1 << 3        @ Bit 3 SHPF: Shift operation pending
.EQU  RTC_ISR_WUTWF      , 1 << 2        @ Bit 2 WUTWF: Wakeup timer write flag
.EQU  RTC_ISR_ALRBWF     , 1 << 1        @ Bit 1 ALRBWF: Alarm B write flag
.EQU  RTC_ISR_ALRAWF     , 1 << 0        @ Bit 0 ALRAWF: Alarm A write flag
@.END

@ Описание битов настройки регистра RTC_PRER
@.ITEM     RTC_PRER
.EQU  RTC_PRER_PREDIV_A_M, 0x007F0000    @   Bits 22:16 PREDIV_A[6:0]: Asynchronous prescaler factor
.EQU  RTC_PRER_PREDIV_A_N, 16
.EQU  RTC_PRER_PREDIV_S_M, 0x00001FFF    @  Bits 14:0 PREDIV_S[14:0]: Synchronous prescaler factor
.EQU  RTC_PRER_PREDIV_S_N, 0
@.END

@ Описание битов настройки регистра RTC_WUTR
@.ITEM     RTC_WUTR
.EQU  RTC_WUTR_WUT_M     , 0x0000FFFF    @  Bits 15:0 WUT[15:0]: Wakeup auto-reload value bits
.EQU  RTC_WUTR_WUT_N     , 0
@.END

@ Описание битов настройки регистра RTC_CALIBR
@.item  RTC_CALIBR
.EQU  RTC_CALIBR_DCS_N   , 7             @  Bit 7 DCS: Digital calibration sign
.EQU  RTC_CALIBR_DCS     , 1 << 7        @  1: Negative calibration: calendar update frequency is decreased
.EQU  RTC_CALIBR_DC_M    , 0x0000001F    @  Bits 4:0 DC[4:0]: Digital calibration
.EQU  RTC_CALIBR_DC_N    , 0
@.END

@ Описание битов настройки регистра RTC_ALRMAR
@.item     RTC_ALRMAR
.EQU  RTC_ALRMAR_MSK4    , 1 << 31       @ Bit 31 MSK4: Alarm A date mask
.EQU  RTC_ALRMAR_WDSEL   , 1 << 30       @  Bit 30 WDSEL: Week day selection
.EQU  RTC_ALRMAR_DT_N    , 28            @  Bits 29:28 DT[1:0]: Date tens in BCD format.
.EQU  RTC_ALRMAR_DT_M    , 0x30000000
.EQU  RTC_ALRMAR_DT_0    , 1 << 28       @ Bits 29:28 DT[1:0]: Date tens in BCD format.
.EQU  RTC_ALRMAR_DT_1    , 1 << 29       @
.EQU  RTC_ALRMAR_DU_M    , 0x0F000000    @  Bits 27:24 DU[3:0]: Date units or day in BCD format.
.EQU  RTC_ALRMAR_DU_N    , 24
.EQU  RTC_ALRMAR_DU_0    , 1 << 24
.EQU  RTC_ALRMAR_DU_1    , 2 << 24
.EQU  RTC_ALRMAR_DU_2    , 4 << 24
.EQU  RTC_ALRMAR_DU_3    , 8 << 24
.EQU  RTC_ALRMAR_MSK3    , 1 << 23       @  Bit 23 MSK3: Alarm A hours mask
.EQU  RTC_ALRMAR_PM      , 1 << 22       @  Bit 22 PM: AM/PM notation
.EQU  RTC_ALRMAR_HT      , 20            @ Bits 21:20 HT[1:0]: Hour tens in BCD format.
.EQU  RTC_ALRMAR_HT_0    , 1 << 20
.EQU  RTC_ALRMAR_HT_1    , 2 << 20
.EQU  RTC_ALRMAR_HU_M    , 0x000F0000    @ Bits 19:16 HU[3:0]: Hour units in BCD format.
.EQU  RTC_ALRMAR_HU_N    , 16
.EQU  RTC_ALRMAR_HU_0    , 1 << 16
.EQU  RTC_ALRMAR_HU_1    , 2 << 16
.EQU  RTC_ALRMAR_HU_2    , 4 << 16
.EQU  RTC_ALRMAR_HU_3    , 8 << 16
.EQU  RTC_ALRMAR_MSK2    , 1 << 15       @  Bit 15 MSK2: Alarm A minutes mask
.EQU  RTC_ALRMAR_MNT_M   , 0x00007000    @  Bits 14:12 MNT[2:0]: Minute tens in BCD format.
.EQU  RTC_ALRMAR_MNT_N   , 12            @
.EQU  RTC_ALRMAR_MNT_0   , 1 << 12
.EQU  RTC_ALRMAR_MNT_1   , 2 << 12
.EQU  RTC_ALRMAR_MNT_2   , 4 << 12
.EQU  RTC_ALRMAR_MNU_M   , 0x00000F00    @  Bits 11:8 MNU[3:0]: Minute units in BCD format.
.EQU  RTC_ALRMAR_MNU_N   , 8
.EQU  RTC_ALRMAR_MNU_0   , 1 << 8
.EQU  RTC_ALRMAR_MNU_1   , 2 << 8
.EQU  RTC_ALRMAR_MNU_2   , 4 << 8
.EQU  RTC_ALRMAR_MNU_3   , 8 << 8
.EQU  RTC_ALRMAR_MSK1    , 1 << 7        @  Bit 7 MSK1: Alarm A seconds mask
.EQU  RTC_ALRMAR_ST_M    , 0x00000070    @  Bits 6:4 ST[2:0]: Second tens in BCD format.
.EQU  RTC_ALRMAR_ST_N    , 4             @
.EQU  RTC_ALRMAR_ST_0    , 1 << 4
.EQU  RTC_ALRMAR_ST_1    , 2 << 4
.EQU  RTC_ALRMAR_ST_2    , 4 << 4
.EQU  RTC_ALRMAR_SU_M    , 0x0000000F    @  Bits 3:0 SU[3:0]: Second units in BCD format.
.EQU  RTC_ALRMAR_SU_N    , 0
.EQU  RTC_ALRMAR_SU_0    , 0x00000001
.EQU  RTC_ALRMAR_SU_1    , 0x00000002
.EQU  RTC_ALRMAR_SU_2    , 0x00000004
.EQU  RTC_ALRMAR_SU_3    , 0x00000008
@.END

@ Описание битов настройки регистра RTC_ALRMBR
@.item     RTC_ALRMBR
.EQU  RTC_ALRMBR_MSK4    , 1 << 31       @  Bit 31 MSK4: Alarm B date mask
.EQU  RTC_ALRMBR_WDSEL   , 1 << 30       @  Bit 30 WDSEL: Week day selection
.EQU  RTC_ALRMBR_DT_N    , 28            @  Bits 29:28 DT[1:0]: Date tens in BCD format.
.EQU  RTC_ALRMBR_DT_M    , 0x30000000
.EQU  RTC_ALRMBR_DT_0    , 1 << 28       @ Bits 29:28 DT[1:0]: Date tens in BCD format.
.EQU  RTC_ALRMBR_DT_1    , 1 << 29       @
.EQU  RTC_ALRMBR_DU_M    , 0x0F000000    @  Bits 27:24 DU[3:0]: Date units or day in BCD format.
.EQU  RTC_ALRMBR_DU_N    , 24
.EQU  RTC_ALRMBR_DU_0    , 1 << 24
.EQU  RTC_ALRMBR_DU_1    , 2 << 24
.EQU  RTC_ALRMBR_DU_2    , 4 << 24
.EQU  RTC_ALRMBR_DU_3    , 8 << 24
.EQU  RTC_ALRMBR_MSK3    , 1 << 23       @  Bit 23 MSK3: Alarm A hours mask
.EQU  RTC_ALRMBR_PM      , 1 << 22       @  Bit 22 PM: AM/PM notation
.EQU  RTC_ALRMBR_HT      , 20            @ Bits 21:20 HT[1:0]: Hour tens in BCD format.
.EQU  RTC_ALRMBR_HT_0    , 1 << 20
.EQU  RTC_ALRMBR_HT_1    , 2 << 20
.EQU  RTC_ALRMBR_HU_M    , 0x000F0000    @ Bits 19:16 HU[3:0]: Hour units in BCD format.
.EQU  RTC_ALRMBR_HU_N    , 16
.EQU  RTC_ALRMBR_HU_0    , 1 << 16
.EQU  RTC_ALRMBR_HU_1    , 2 << 16
.EQU  RTC_ALRMBR_HU_2    , 4 << 16
.EQU  RTC_ALRMBR_HU_3    , 8 << 16
.EQU  RTC_ALRMBR_MSK2    , 1 << 15       @  Bit 15 MSK2: Alarm A minutes mask
.EQU  RTC_ALRMBR_MNT_M   , 0x00007000    @  Bits 14:12 MNT[2:0]: Minute tens in BCD format.
.EQU  RTC_ALRMBR_MNT_N   , 12            @
.EQU  RTC_ALRMBR_MNT_0   , 1 << 12
.EQU  RTC_ALRMBR_MNT_1   , 2 << 12
.EQU  RTC_ALRMBR_MNT_2   , 4 << 12
.EQU  RTC_ALRMBR_MNU_M   , 0x00000F00    @  Bits 11:8 MNU[3:0]: Minute units in BCD format.
.EQU  RTC_ALRMBR_MNU_N   , 8
.EQU  RTC_ALRMBR_MNU_0   , 1 << 8
.EQU  RTC_ALRMBR_MNU_1   , 2 << 8
.EQU  RTC_ALRMBR_MNU_2   , 4 << 8
.EQU  RTC_ALRMBR_MNU_3   , 8 << 8
.EQU  RTC_ALRMBR_MSK1    , 1 << 7        @  Bit 7 MSK1: Alarm A seconds mask
.EQU  RTC_ALRMBR_ST_M    , 0x00000070    @  Bits 6:4 ST[2:0]: Second tens in BCD format.
.EQU  RTC_ALRMBR_ST_N    , 4             @
.EQU  RTC_ALRMBR_ST_0    , 1 << 4
.EQU  RTC_ALRMBR_ST_1    , 2 << 4
.EQU  RTC_ALRMBR_ST_2    , 4 << 4
.EQU  RTC_ALRMBR_SU_M    , 0x0000000F    @  Bits 3:0 SU[3:0]: Second units in BCD format.
.EQU  RTC_ALRMBR_SU_N    , 0
.EQU  RTC_ALRMBR_SU_0    , 0x00000001
.EQU  RTC_ALRMBR_SU_1    , 0x00000002
.EQU  RTC_ALRMBR_SU_2    , 0x00000004
.EQU  RTC_ALRMBR_SU_3    , 0x00000008
@.END

@ Описание битов настройки регистра RTC_WPR
@.item     RTC_WPR
.EQU  RTC_WPR_KEY_M      , 0x000000FF
@.end

@ Описание битов настройки регистра RTC_SSR
@.item     RTC_SSR
.EQU  RTC_SSR_SS_M       , 0x0000FFFF
@.end

@ Описание битов настройки регистра RTC_SHIFTR
@.item     RTC_SHIFTR
.EQU  RTC_SHIFTR_SUBFS_M , 0x00007FFF    @ Bits 14:0 SUBFS: Subtract a fraction of a second
.EQU  RTC_SHIFTR_ADD1S   , 0x80000000    @ Bit 31 ADD1S: Add one second
@.END

@ Описание битов настройки регистра RTC_TSTR
@.item     RTC_TSTR
.EQU  RTC_TSTR_PM        , 1 << 22       @ it 22 PM: AM/PM notation
.EQU  RTC_TSTR_HT_M      , 0x00300000    @  Bits 21:20 HT[1:0]: Hour tens in BCD format.
.EQU  RTC_TSTR_HT_N      , 20            @
.EQU  RTC_TSTR_HT_0      , 1 << 20
.EQU  RTC_TSTR_HT_1      , 2 << 20
.EQU  RTC_TSTR_HU_M      , 0x000F0000    @  Bits 19:16 HU[3:0]: Hour units in BCD format.
.EQU  RTC_TSTR_HU_N      , 16            @
.EQU  RTC_TSTR_HU_0      , 1 << 16
.EQU  RTC_TSTR_HU_1      , 2 << 16
.EQU  RTC_TSTR_HU_2      , 4 << 16
.EQU  RTC_TSTR_HU_3      , 8 << 16
.EQU  RTC_TSTR_MNT       , 0x00007000    @  Bits 14:12 MNT[2:0]: Minute tens in BCD format.
.EQU  RTC_TSTR_MNT       , 12            @
.EQU  RTC_TSTR_MNT_0     , 1 << 12
.EQU  RTC_TSTR_MNT_1     , 2 << 12
.EQU  RTC_TSTR_MNT_2     , 4 << 12
.EQU  RTC_TSTR_MNU_M     , 0x00000F00    @   Bits 11:8 MNU[3:0]: Minute units in BCD format.
.EQU  RTC_TSTR_MNU_N     , 8             @
.EQU  RTC_TSTR_MNU_0     , 1 << 8
.EQU  RTC_TSTR_MNU_1     , 2 << 8
.EQU  RTC_TSTR_MNU_2     , 4 << 8
.EQU  RTC_TSTR_MNU_3     , 8 << 8
.EQU  RTC_TSTR_ST_M      , 0x00000070    @  Bits 6:4 ST[2:0]: Second tens in BCD format.
.EQU  RTC_TSTR_ST_N      , 4             @
.EQU  RTC_TSTR_ST_0      , 1 << 4
.EQU  RTC_TSTR_ST_1      , 2 << 4
.EQU  RTC_TSTR_ST_2      , 4 << 4
.EQU  RTC_TSTR_SU_M      , 0x0000000F    @  Bits 3:0 SU[3:0]: Second units in BCD format.
.EQU  RTC_TSTR_SU_N      , 0             @
.EQU  RTC_TSTR_SU_0      , 0x00000001
.EQU  RTC_TSTR_SU_1      , 0x00000002
.EQU  RTC_TSTR_SU_2      , 0x00000004
.EQU  RTC_TSTR_SU_3      , 0x00000008
@.end

@ Описание битов настройки регистра RTC_TSDR
@.item     RTC_TSDR
.EQU  RTC_TSDR_WDU       , 0x0000E000    @  Bits 15:13 WDU[1:0]: Week day units
.EQU  RTC_TSDR_WDU_N     , 13            @
.EQU  RTC_TSDR_WDU_0     , 2 << 13
.EQU  RTC_TSDR_WDU_1     , 4 << 13
.EQU  RTC_TSDR_WDU_2     , 8 << 13
.EQU  RTC_TSDR_MT        , 1 << 12       @  Bit 12 MT: Month tens in BCD format
.EQU  RTC_TSDR_MU_M      , 0x00000F00    @  Bits 11:8 MU[3:0]: Month units in BCD format
.EQU  RTC_TSDR_MU_N      , 8             @
.EQU  RTC_TSDR_MU_0      , 1 << 8
.EQU  RTC_TSDR_MU_1      , 2 << 8
.EQU  RTC_TSDR_MU_2      , 4 << 8
.EQU  RTC_TSDR_MU_3      , 8 << 8
.EQU  RTC_TSDR_DT_M      , 0x00000030    @  Bits 5:4 DT[1:0]: Date tens in BCD format
.EQU  RTC_TSDR_DT_N      , 4             @
.EQU  RTC_TSDR_DT_0      , 1 << 4
.EQU  RTC_TSDR_DT_1      , 2 << 4
.EQU  RTC_TSDR_DU_M      , 0x0000000F    @  Bit 3:0 DU[3:0]: Date units in BCD format
.EQU  RTC_TSDR_DU_N      , 0             @
.EQU  RTC_TSDR_DU_0      , 0x00000001
.EQU  RTC_TSDR_DU_1      , 0x00000002
.EQU  RTC_TSDR_DU_2      , 0x00000004
.EQU  RTC_TSDR_DU_3      , 0x00000008
@.end

@ Описание битов настройки регистра RTC_TSSSR
@.item     RTC_TSSSR
.EQU  RTC_TSSSR_SS       , 0x0000FFFF
@.end

@ Описание битов настройки регистра RTC_CALR
@.item     RTC_CALR
.EQU  RTC_CALR_CALP      , 1 << 15       @ Bit 15 CALP: Increase frequency of RTC by 488.5 ppm
.EQU  RTC_CALR_CALW8     , 1 << 14       @ Bit 14 CALW8: Use an 8-second calibration cycle period
.EQU  RTC_CALR_CALW16    , 1 << 13       @ Bit 13 CALW16: Use a 16-second calibration cycle period
.EQU  RTC_CALR_CALM_M    , 0x000001FF    @  Bits 8:0 CALM[8:0]: Calibration minus
.EQU  RTC_CALR_CALM_0    , 0x00000001
.EQU  RTC_CALR_CALM_1    , 0x00000002
.EQU  RTC_CALR_CALM_2    , 0x00000004
.EQU  RTC_CALR_CALM_3    , 0x00000008
.EQU  RTC_CALR_CALM_4    , 0x00000010
.EQU  RTC_CALR_CALM_5    , 0x00000020
.EQU  RTC_CALR_CALM_6    , 0x00000040
.EQU  RTC_CALR_CALM_7    , 0x00000080
.EQU  RTC_CALR_CALM_8    , 0x00000100
@.END

@ Описание битов настройки регистра RTC_TAFCR
@.item     RTC_TAFCR
.EQU  RTC_TAFCR_ALARMOUTTYPE, 1 << 18    @  Bit 18 ALARMOUTTYPE: RTC_ALARM output type
.EQU  RTC_TAFCR_TSINSEL  , 1 << 17       @  Bit 17 TSINSEL: TIMESTAMP mapping
.EQU  RTC_TAFCR_TAMPINSEL, 1 << 16       @  Bit 16 TAMP1INSEL: TAMPER1 mapping
.EQU  RTC_TAFCR_TAMPPUDIS, 1 << 15       @  Bit 15 TAMPPUDIS: TAMPER pull-up disable
.EQU  RTC_TAFCR_TAMPPRCH_M, 0x00006000   @ Bits 14:13 TAMPPRCH[1:0]: Tamper precharge duration
.EQU  RTC_TAFCR_TAMPPRCH_N, 13           @
.EQU  RTC_TAFCR_TAMPPRCH_0, 1 << 13
.EQU  RTC_TAFCR_TAMPPRCH_1, 2 << 13
.EQU  RTC_TAFCR_TAMPFLT_M, 0x00001800    @ Bits 12:11 TAMPFLT[1:0]: Tamper filter count
.EQU  RTC_TAFCR_TAMPFLT_N, 11            @
.EQU  RTC_TAFCR_TAMPFLT_0, 1 << 11
.EQU  RTC_TAFCR_TAMPFLT_1, 2 << 11
.EQU  RTC_TAFCR_TAMPFREQ_M, 0x00000700   @ Bits 10:8 TAMPFREQ[2:0]: Tamper sampling frequency
.EQU  RTC_TAFCR_TAMPFREQ_N, 8            @
.EQU  RTC_TAFCR_TAMPFREQ_0, 1 << 8
.EQU  RTC_TAFCR_TAMPFREQ_1, 2 << 8
.EQU  RTC_TAFCR_TAMPFREQ_2, 4 << 8
.EQU  RTC_TAFCR_TAMPTS   , 0x00000008    @ Bit 7 TAMPTS: Activate timestamp on tamper detection event
.EQU  RTC_TAFCR_TAMPIE   , 0x00000004    @ Bit 2 TAMPIE: Tamper interrupt enable
.EQU  RTC_TAFCR_TAMP1TRG , 0x00000002    @ Bit 1 TAMP1TRG: Active level for tamper 1
.EQU  RTC_TAFCR_TAMP1E   , 0x00000001    @ Bit 0 TAMP1E: Tamper 1 detection enable
@.end

@ Описание битов настройки регистра RTC_ALRMASSR
@.item     RTC_ALRMASSR
.EQU  RTC_ALRMASSR_MASKSS_M, x0F000000   @  Bits 27:24 MASKSS[3:0]: Mask the most-significant bits starting at this bit
.EQU  RTC_ALRMASSR_MASKSS_N, 24          @
.EQU  RTC_ALRMASSR_MASKSS_0, 1 << 24
.EQU  RTC_ALRMASSR_MASKSS_1, 2 << 24
.EQU  RTC_ALRMASSR_MASKSS_2, 4 << 24
.EQU  RTC_ALRMASSR_MASKSS_3, 8 << 24
.EQU  RTC_ALRMASSR_SS    , 0x00007FFF    @  Bits 14:0 SS[14:0]: Sub seconds value
@.end

@ Описание битов настройки регистра RTC_ALRMBSSR
@.item     RTC_ALRMBSSR
.EQU  RTC_ALRMBSSR_MASKSS_M, x0F000000   @  Bits 27:24 MASKSS[3:0]: Mask the most-significant bits starting at this bit
.EQU  RTC_ALRMBSSR_MASKSS_N, 24          @
.EQU  RTC_ALRMBSSR_MASKSS_0, 1 << 24
.EQU  RTC_ALRMBSSR_MASKSS_1, 2 << 24
.EQU  RTC_ALRMBSSR_MASKSS_2, 4 << 24
.EQU  RTC_ALRMBSSR_MASKSS_3, 8 << 24
.EQU  RTC_ALRMBSSR_SS    , 0x00007FFF    @  Bits 14:0 SS[14:0]: Sub seconds value
@.END

