Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1186 savelij 1
		ifndef	__stm8lrtcinc	; avoid multiple inclusion
2
__stm8lrtcinc	equ	1
3
 
4
		save
5
		listing	off		; no listing over this file
6
 
7
;****************************************************************************
8
;*                                                                          *
9
;*   AS 1.42 - File RTC.INC                                                 *
10
;*                                                                          *
11
;*   contains SFR and Bit Definitions for STM8L RTC                         *
12
;*                                                                          *
13
;****************************************************************************
14
 
15
__defrtc	macro	Base
16
RTC_TR1		label	Base+$00	; RTC Time register 1
17
RTC_ST		bfield	RTC_TR1,4,3	;  Second tens in BCD format
18
RTC_SU		bfield	RTC_TR1,0,4	;  Second units in BCD format
19
RTC_TR2		label	Base+$01	; RTC Time register 2
20
RTC_MNT		bfield	RTC_TR2,4,3	;  Minute tens in BCD format
21
RTC_MNU		bfield	RTC_TR2,0,4	;  Minute units in BCD format
22
RTC_TR3		label	Base+$02	; RTC Time register 3
23
RTC_PM		bit	RTC_TR3,7	;  AM/PM notation
24
RTC_HT		bfield	RTC_TR3,4,2	;  Hour tens in BCD format
25
RTC_HU		bfield	RTC_TR3,0,4	;  Hour units in BCD format
26
RTC_DR1		label	Base+$04	; RTC Date register 1
27
RTC_DT		bfield	RTC_DR1,4,2	;  Date tens in BCD format
28
RTC_DU		bfield	RTC_DR1,0,4	;  Date units in BCD format
29
RTC_DR2		label	Base+$05	; RTC Date register 2
30
RTC_WDU		bfield	RTC_DR2,5,3	;  Week day units
31
RTC_MT		bit	RTC_DR2,4	;  Month tens in BCD format
32
RTC_MU		bfield	RTC_DR2,0,4	;  Month units in BCD format
33
RTC_DR3		label	Base+$06	; RTC Date register 3
34
RTC_YT		bfield	RTC_DR3,4,4	;  Year tens in BCD format
35
RTC_YU		bfield	RTC_DR3,0,4	;  Year units in BCD format
36
RTC_CR1		label	Base+$08	; RTC Control register 1
37
RTC_FMT		bit	RTC_CR1,6	;  Hour format
38
RTC_RATIO	bit	RTC_CR1,5	;  System clock (SYSCLK) versus RTCCLK ratio
39
RTC_BYPSHAD	bit	RTC_CR1,4	;  Bypass the shadow registers
40
RTC_WUCKSEL	bfield	RTC_CR1,0,3	;  Wakeup clock selection
41
RTC_CR2		label	Base+$09	; RTC Control register 2
42
RTC_WUTIE	bit	RTC_CR2,6	;  Wakeup timer interrupt enable
43
RTC_ALRAIE	bit	RTC_CR2,4	;  Alarm A interrupt enable
44
RTC_WUTE	bit	RTC_CR2,2	;  Wakeup timer enable
45
RTC_ALRAE	bit	RTC_CR2,0	;  Alarm A enable
46
RTC_CR3		label	Base+$0a	; RTC Control register 3
47
RTC_COE		bit	RTC_CR3,7	;  Calibration output enable
48
RTC_OSEL	bfield	RTC_CR3,5	;  Output selection
49
RTC_POL		bit	RTC_CR3,4	;  Output polarity
50
RTC_COSEL	bit	RTC_CR3,3	;  Calibration output selection
51
RTC_BCK		bit	RTC_CR3,2	;  Backup
52
RTC_SUB1H	bit	RTC_CR3,1	;  Subtract 1 hour (winter time change)
53
RTC_ADD1H	bit	RTC_CR3,0	;  Add 1 hour (summer time change)
54
RTC_ISR1	label	Base+$0c	; RTC Initialization and status register 1
55
RTC_INIT	bit	RTC_ISR1,7	;  Initialization mode
56
RTC_INITF	bit	RTC_ISR1,6	;  Initialization flag
57
RTC_RSF		bit	RTC_ISR1,5	;  Registers synchronization flag
58
RTC_INITS	bit	RTC_ISR1,4	;  Initialization status flag
59
RTC_SHPF	bit	RTC_ISR1,3	;  Shift operation pending
60
RTC_WUTWF	bit	RTC_ISR1,2	;  Wakeup timer write flag
61
RTC_RECALPF	bit	RTC_ISR1,1	;  Recalibration pending Flag
62
RTC_ALRAWF	bit	RTC_ISR1,0	;  Alarm A write flag
63
RTC_ISR2	label	Base+$0d	; RTC Initialization and Status register 2
64
RTC_TAMP3F	bit	RTC_ISR2,7	;  TAMPER3 detection flag
65
RTC_TAMP2F	bit	RTC_ISR2,6	;  TAMPER2 detection flag
66
RTC_TAMP1F	bit	RTC_ISR2,5	;  TAMPER1 detection flag
67
RTC_WUTF	bit	RTC_ISR2,2	;  Periodic wakeup flag
68
RTC_ALRAF	bit	RTC_ISR2,0	;  Alarm A Flag
69
RTC_SPRERH	label	Base+$10	; RTC Synchronous prescaler register high
70
RTC_SPRERL	label	Base+$11	; RTC Synchronous prescaler register low
71
RTC_APRER	label	Base+$12	; RTC Asynchronous prescaler register
72
RTC_WUTRH	label	Base+$14	; RTC Wakeup timer register high
73
RTC_WUTRL	label	Base+$15	; RTC Wakeup timer register low
74
RTC_SSRL	label	Base+$17	; RTC Subsecond register low
75
RTC_SSRH	label	Base+$18	; RTC Subsecond register high
76
RTC_WPR		label	Base+$19	; RTC Write protection register
77
RTC_SHIFTRH	label	Base+$1a	; RTC Shift register high
78
RTC_ADD1S	bit	RTC_SHIFTRH,7	;  Add one second
79
RTC_SHIFTRL	label	Base+$1b	; RTC Shift register low
80
RTC_ALRMAR1	label	Base+$1c	; RTC Alarm A register 1
81
RTC_MSK1	bit	RTC_ALRMAR1,7	;  Alarm A Seconds mask
82
RTC_AL_ST	bfield	RTC_ALRMAR1,4,3	;  Second tens in BCD format
83
RTC_AL_SU	bfield	RTC_ALRMAR1,0,4	;  Second units in BCD format
84
RTC_ALRMAR2	label	Base+$1d	; RTC Alarm A register 2
85
RTC_MSK2	bit	RTC_ALRMAR2,7	;  Alarm A minutes mask
86
RTC_AL_MNT	bfield	RTC_ALRMAR2,4,3	;  Minute tens in BCD format
87
RTC_AL_MNU	bfield	RTC_ALRMAR2,0,4	;  Minute units in BCD format
88
RTC_ALRMAR3	label	Base+$1e	; RTC Alarm A register 3
89
RTC_MSK3	bit	RTC_ALRMAR3,7	;  Alarm A hours mask
90
RTC_AL_PM	bit	RTC_ALRMAR3,6	;  AM/PM notation
91
RTC_AL_HT	bfield	RTC_ALRMAR3,4,2	;  Hour tens in BCD format
92
RTC_AL_HU	bfield	RTC_ALRMAR3,0,4	;  Hour units in BCD format
93
RTC_ALRMAR4	label	Base+$1f	; RTC Alarm A register 4
94
RTC_MSK4	bit	RTC_ALRMAR4,7	;  Alarm A Date mask
95
RTC_WDSEL	bit	RTC_ALRMAR4,6	;  Week day selection
96
RTC_AL1_DT	bfield	RTC_ALRMAR4,4,2	;  Date tens in BCD format
97
RTC_AL1_DU	bfield	RTC_ALRMAR4,0,4	;  Date units or Day in BCD format
98
RTC_ALRMASSRH	label	Base+$24	; RTC Alarm A subsecond register high
99
RTC_ALRMASSRL	label	Base+$25	; RTC Alarm A subsecond register low
100
RTC_ALRMASSMSKR	label	Base+$26	; RTC Alarm A masking register
101
RTC_CALRH	label	Base+$2a	; RTC Calibration register high
102
RTC_CALP	bit	RTC_CALRH,7	;  Increase of RTC frequency by 488.5 ppm
103
RTC_CALW8	bit	RTC_CALRH,6	;  Use an 8-second calibration cycle period
104
RTC_CALW16	bit	RTC_CALRH,5	;  Use a16-second calibration cycle period
105
RTC_CALRL	label	Base+$2b	; RTC Calibration register low
106
RTC_TCR1	label	Base+$2c	; RTC Tamper control register 1
107
RTC_TAMP3TRG	bit	RTC_TCR1,6	;  Active level for tamper input 3
108
RTC_TAMP3E	bit	RTC_TCR1,5	;  Tamper detection enable for tamper input 3
109
RTC_TAMP2TRG	bit	RTC_TCR1,4	;  Active level for tamper input 2
110
RTC_TAMP2E	bit	RTC_TCR1,3	;  Tamper detection enable for tamper input 2
111
RTC_TAMP1TRG	bit	RTC_TCR1,2	;  Active level for tamper 1
112
RTC_TAMP1E	bit	RTC_TCR1,1	;  Tamper detection enable for tamper input 1
113
RTC_TAMPIE	bit	RTC_TCR1,0	;  Tamper interrupt enable
114
RTC_TCR2	label	Base+$2d	; RTC Tamper control register 2
115
RTC_TTAMPPUDIS	bit	RTC_TCR2,7	;  TAMPER pull-up disable
116
RTC_TTAMPPRCH	bfield	RTC_TCR2,5,2	;  Tamper precharge duration
117
RTC_TTAMPFLT	bfield	RTC_TCR2,3,2	;  Tamper filter count
118
RTC_TTAMPFREQ	bfield	RTC_TCR2,0,2	;  Tamper sampling frequency
119
CSSLSE_CSR	label	Base+$50	; CSS on LSE control and status register
120
SWITCHF		bit	CSSLSE_CSR,4	;  RTC clock switch flag
121
CSSF		bit	CSSLSE_CSR,3	;  CSS on LSE flag
122
CSSIE		bit	CSSLSE_CSR,2	;  Clock security system on LSE interrupt enable
123
SWITCHEN	bit	CSSLSE_CSR,1	;  RTC clock switch to LSI in case of LSE failure enable
124
LSE_CSSEN	bit	CSSLSE_CSR,0	;  Clock security system on LSE enable
125
		endm
126
 
127
		restore
128
		endif			; __stm8lrtcinc