OSDN Git Service

modified >NUMBER without Hardware MPY
[fast-forth/master.git] / MSP430FR5738.inc
1 ; MSP430fr5738.inc
2 ; MSP430FR5738 minimal declarations for FastForth usage
3 DEVICE = "MSP430FR5738"
4
5
6 ; ----------------------------------------------
7 ; MSP430FR5738 MEMORY MAP
8 ; ----------------------------------------------
9 ; 0000-0FFF = peripherals (4 KB)
10 ; 1000-17FF = ROM bootstrap loader BSL0..3 (4x512 B)
11 ; 1800-187F = info B (FRAM 128 B)
12 ; 1880-18FF = info A (FRAM 128 B)
13 ; 1900-19FF = N/A (mirrored into info A/B)
14 ; 1A00-1A7F = TLV device descriptor info (FRAM 128 B)
15 ; 1A80-1BFF = unused (385 B)
16 ; 1C00-1FFF = RAM (1 KB)
17 ; 2000-C1FF = unused (41472 B)
18 ; C200-FF7F = code memory (FRAM 15743 B)
19 ; FF80-FFFF = interrupt vectors (FRAM 127 B)
20 ; ----------------------------------------------
21 PAGESIZE        .equ 512         ; MPU unit
22 ; ----------------------------------------------
23 ; FRAM                          ; INFO B, A, TLV
24 ; ----------------------------------------------
25 INFO_ORG        .equ 01800h
26 INFO_LEN        .equ 00100h
27 INFOB_ORG       .equ 01800h
28 INFOB_LEN       .equ 00080h
29 INFOA_ORG       .equ 01880h
30 INFOA_LEN       .equ 00080h
31 ; ----------------------------------------------
32 TLV_ORG         .equ 01A00h      ; Device Descriptor Info (Tag-Lenght-Value)
33 TLV_LEN         .equ 00080h      ;
34 ; ----------------------------------------------
35 ; RAM
36 ; ----------------------------------------------
37 RAM_ORG         .equ 01C00h
38 RAM_LEN         .equ 00400h
39 ; ----------------------------------------------
40 ; FRAM
41 ; ----------------------------------------------
42 MAIN_ORG        .equ 0C200h      ; Code space start
43 SIGNATURES      .equ 0FF80h      ; JTAG/BSL signatures
44 JTAG_SIG1       .equ 0FF80h      ; if 0 (electronic fuse=0) enable JTAG/SBW; must be reset by wipe.
45 JTAG_SIG2       .equ 0FF82h      ; if JTAG_SIG1=0xAAAA, length of password string @ JTAG_PASSWORD
46 BSL_SIG1        .equ 0FF84h      ;
47 BSL_SIG2        .equ 0FF86h      ;
48 JTAG_PASSWORD   .equ 0FF88h      ; 256 bits
49 VECT_ORG        .equ 0FFCEh      ; FFCE-FFFF
50 VECT_LEN        .equ 32h
51 BSL_PASSWORD    .equ 0FFE0h      ; 256 bits
52 ; ----------------------------------------------
53
54
55
56 ; ----------------------------------------------
57 ; Interrupt Vectors and signatures - MSP430FR57xx
58 ; ----------------------------------------------
59
60 ;    .org    SIGNATURES
61 ;;Start of JTAG and BSL signatures
62 ;        .word   0           ; JTAG signature 1
63 ;        .word   0           ; JTAG signature 2
64 ;        .word   0 ; 5555h   ; BSL signature 1 ; disable BSL
65 ;        .word   0           ; BSL signature 2
66 ;
67 ;    .org JTAG_PASSWORD     ;Start of JTAG PASSWORD
68 ;
69 ;    .org    VECT_ORG         ; FFCE-FFFF 24 vectors + reset
70 ;        .word  reset        ; $FFCE  -  RTC_B
71 ;        .word  reset        ; $FFD0  -  I/O Port 4
72 ;        .word  reset        ; $FFD2  -  I/O Port 3
73 ;        .word  reset        ; $FFD4  -  TB2_1
74 ;        .word  reset        ; $FFD6  -  TB2_0
75 ;        .word  reset        ; $FFD8  -  I/O Port 2
76 ;        .word  reset        ; $FFDA  -  TB1_1
77 ;        .word  reset        ; $FFDC  -  TB1_0
78 ;        .word  reset        ; $FFDE  -  I/O Port 1
79 ;;   .org BSL_PASSWORD       ;Start of BSL PASSWORD
80 ;        .word  reset        ; $FFE0  -  TA1_1
81 ;        .word  reset        ; $FFE2  -  TA1_0
82 ;        .word  reset        ; $FFE4  -  DMA
83 ;        .word  reset        ; $FFE8  -  TA0_1
84 ;        .word  reset        ; $FFEA  -  TA0_0
85 ;        .word  reset        ; $FFEC  -  ADC10_B
86 ;        .word  reset        ; $FFEE  -  eUSCI_B0
87 ;        .word  reset        ; $FFF0  -  eUSCI_A0
88 ;        .word  reset        ; $FFF2  -  Watchdog
89 ;        .word  reset        ; $FFF4  -  TB0_1
90 ;        .word  reset        ; $FFF6  -  TB0_0
91 ;        .word  reset        ; $FFF8  -  COMP_D
92 ;        .word  reset        ; $FFFA  -  userNMI
93 ;        .word  reset        ; $FFFC  -  sysNMI
94 ;        .word  reset        ; $FFFE  -  reset
95
96
97
98 ; ----------------------------------------------------------------------
99 ; MSP430FR5739 Peripheral File Map
100 ; ----------------------------------------------------------------------
101 SFR_SFR         .equ 0100h           ; Special function
102 PMM_SFR         .equ 0120h           ; PMM
103 FRAM_SFR        .equ 0140h           ; FRAM control
104 CRC16_SFR       .equ 0150h   
105 WDT_A_SFR       .equ 015Ch           ; Watchdog
106 CS_SFR          .equ 0160h
107 SYS_SFR         .equ 0180h           ; SYS 
108 REF_SFR         .equ 01B0h           ; REF
109 PA_SFR          .equ 0200h           ; PORT1/2
110 PJ_SFR          .equ 0320h           ; PORTJ
111 TA0_SFR         .equ 0340h
112 TA1_SFR         .equ 0380h
113 TB0_SFR         .equ 03C0h
114 TB1_SFR         .equ 0400h
115 TB2_SFR         .equ 0440h
116 RTC_B_SFR       .equ 04A0h
117 MPY_SFR         .equ 04C0h
118 DMA_CTRL_SFR    .equ 0500h
119 DMA_CHN0_SFR    .equ 0510h
120 DMA_CHN1_SFR    .equ 0520h
121 DMA_CHN2_SFR    .equ 0530h
122 MPU_SFR         .equ 05A0h           ; memory protect unit
123 eUSCI_A0_SFR    .equ 05C0h           ; eUSCI_A0
124 eUSCI_B0_SFR    .equ 0640h           ; eUSCI_B0
125 ADC10_B_SFR     .equ 0700h
126 COMP_D_SFR      .equ 08C0h
127
128 ; ----------------------------------------------------------------------
129 ; POWER ON RESET AND INITIALIZATION : LOCK I/O as high impedance state
130 ; ----------------------------------------------------------------------
131 PMMCTL0     .equ PMM_SFR
132 PMMSWBOR    .equ 4
133
134 PM5CTL0     .equ PMM_SFR + 10h    ; Power mode 5 control register 0
135 LOCKLPM5    .equ 1
136
137 ; ----------------------------------------------------------------------
138 ; POWER ON RESET AND INITIALIZATION : WATCHDOG TIMER A
139 ; ----------------------------------------------------------------------
140
141 WDTCTL      .equ WDT_A_SFR + 00h    ; Watchdog Timer Control */
142
143 ; WDTCTL Control Bits
144 WDTPW       .equ 5A00h
145 WDTHOLD     .equ 0080h  ; WDT - Timer hold
146 WDTCNTCL    .equ 0008h  ; WDT timer counter clear
147
148 ; ----------------------------------------------------------------------
149 ; POWER ON RESET AND INITIALIZATION : CLOCK SYSTEM
150 ; ----------------------------------------------------------------------
151
152 CSCTL0          .equ CS_SFR + 00h       ; CS Control Register 0
153 CSCTL0_H        .equ CS_SFR + 01h       ; CS Control Register 0 high byte
154 CSCTL1          .equ CS_SFR + 02h       ; CS Control Register 1
155 CSCTL2          .equ CS_SFR + 04h       ; CS Control Register 2
156 CSCTL3          .equ CS_SFR + 06h       ; CS Control Register 3
157
158 ; CSCTL0 Control Bits
159 CSKEY           .equ 0A5h            ; CS Password
160 ; CSCTL1 Control Bits
161 DCORSEL         .equ 0080h
162 DCOFSEL0        .equ 0002h           ; DCO frequency select Bit: 0
163 DCOFSEL1        .equ 0004h           ; DCO frequency select Bit: 1
164 ; CSCTL2 Control Bits
165 ; SELA_LFXCLK     .equ 0000h           ; 0 : ACLK Source Select LFXCLK
166 SELA_LFXCLK     .equ 0000h           ; 0 : ACLK Source Select LFXCLK
167 SELA_VLOCLK     .equ 0100h           ; 1 ACLK Source Select VLOCLK 10kHz
168 SELS_DCOCLK     .equ 0030h           ; 3 SMCLK Source Select DCOCLK
169 SELM_DCOCLK     .equ 0003h           ; 3 MCLK Source Select DCOCLK
170 ; CSCTL3 Control Bits
171 DIVA_0          .equ 0000h           ; ACLK Source Divider 0
172 DIVS_0          .equ 0000h           ; SMCLK Source Divider 0
173 DIVM_0          .equ 0000h           ; MCLK Source Divider 0
174 DIVA_2          .equ 0100h           ; ACLK Source Divider 0
175 DIVS_2          .equ 0010h           ; SMCLK Source Divider 0
176 DIVM_2          .equ 0001h           ; MCLK Source Divider 0
177 DIVA_4          .equ 0200h           ; ACLK Source Divider 0
178 DIVS_4          .equ 0020h           ; SMCLK Source Divider 0
179 DIVM_4          .equ 0002h           ; MCLK Source Divider 0
180 DIVA_8          .equ 0300h           ; ACLK Source Divider 0
181 DIVS_8          .equ 0030h           ; SMCLK Source Divider 0
182 DIVM_8          .equ 0003h           ; MCLK Source Divider 0
183 DIVA_16         .equ 0400h           ; ACLK Source Divider 0
184 DIVS_16         .equ 0040h           ; SMCLK Source Divider 0
185 DIVM_16         .equ 0004h           ; MCLK Source Divider 0
186 DIVA_32         .equ 0500h           ; ACLK Source Divider 0
187 DIVS_32         .equ 0050h           ; SMCLK Source Divider 0
188 DIVM_32         .equ 0005h           ; MCLK Source Divider 0
189
190 ; ----------------------------------------------------------------------
191 ; POWER ON RESET AND INITIALIZATION : SYS REGISTERS
192 ; ----------------------------------------------------------------------
193
194 SYSRSTIV    .equ SYS_SFR + 001Eh
195
196
197 ; ----------------------------------------------------------------------
198 ; POWER ON RESET AND INITIALIZATION : REF
199 ; ----------------------------------------------------------------------
200
201 REFCTL      .equ REF_SFR + 00h       ; REF Shared Reference control register 0
202
203 ; REFCTL0 Control Bits
204 REFON       .equ 0001h               ; REF Reference On
205 REFTCOFF    .equ 0008h               ; REF Temp.Sensor off
206
207 ; ----------------------------------------------------------------------
208 ; POWER ON RESET AND INITIALIZATION PAIN=PORT2:PORT1
209 ; ----------------------------------------------------------------------
210
211 PAIN        .equ PA_SFR + 00h    ; Port A INput
212 PAOUT       .equ PA_SFR + 02h    ; Port A OUTput
213 PADIR       .equ PA_SFR + 04h    ; Port A DIRection
214 PAREN       .equ PA_SFR + 06h    ; Port A Resistor ENable
215 PASEL0      .equ PA_SFR + 0Ah    ; Port A SELection 0
216 PASEL1      .equ PA_SFR + 0Ch    ; Port A SELection 1
217 PASELC      .equ PA_SFR + 16h    ; Port A SELection Complement
218 PAIES       .equ PA_SFR + 18h    ; Port A Interrupt Edge Select
219 PAIE        .equ PA_SFR + 1Ah    ; Port A Interrupt Enable
220 PAIFG       .equ PA_SFR + 1Ch    ; Port A Interrupt FlaG
221
222 P1IN        .equ PA_SFR + 00h    ; Port 1 INput
223 P1OUT       .equ PA_SFR + 02h    ; Port 1 OUTput
224 P1DIR       .equ PA_SFR + 04h    ; Port 1 DIRection
225 P1REN       .equ PA_SFR + 06h    ; Port 1 Resistor ENable
226 P1SEL0      .equ PA_SFR + 0Ah    ; Port 1 SELection 0
227 P1SEL1      .equ PA_SFR + 0Ch    ; Port 1 SELection 1
228 P1IV        .equ PA_SFR + 0Eh    ; Port 1 Interrupt Vector word 
229 P1SELC      .equ PA_SFR + 16h    ; Port 1 SELection Complement
230 P1IES       .equ PA_SFR + 18h    ; Port 1 Interrupt Edge Select
231 P1IE        .equ PA_SFR + 1Ah    ; Port 1 Interrupt Enable
232 P1IFG       .equ PA_SFR + 1Ch    ; Port 1 Interrupt FlaG
233
234 P2IN        .equ PA_SFR + 01h    ; Port 2 INput
235 P2OUT       .equ PA_SFR + 03h    ; Port 2 OUTput
236 P2DIR       .equ PA_SFR + 05h    ; Port 2 DIRection
237 P2REN       .equ PA_SFR + 07h    ; Port 2 Resistor ENable
238 P2SEL0      .equ PA_SFR + 0Bh    ; Port 2 SELection 0
239 P2SEL1      .equ PA_SFR + 0Dh    ; Port 2 SELection 1
240 P2SELC      .equ PA_SFR + 17h    ; Port 2 SELection Complement
241 P2IES       .equ PA_SFR + 19h    ; Port 2 Interrupt Edge Select
242 P2IE        .equ PA_SFR + 1Bh    ; Port 2 Interrupt Enable
243 P2IFG       .equ PA_SFR + 1Dh    ; Port 2 Interrupt Flag
244 P2IV        .equ PA_SFR + 1Eh    ; Port 2 Interrupt Vector word 
245
246 ; ----------------------------------------------------------------------
247 ; POWER ON RESET AND INITIALIZATION : PORTJ
248 ; ----------------------------------------------------------------------
249
250 PJIN        .set PJ_SFR + 00h    ; Port B Input
251 PJOUT       .set PJ_SFR + 02h    ; Port B Output
252 PJDIR       .set PJ_SFR + 04h    ; Port B Direction
253 PJREN       .set PJ_SFR + 06h    ; Port B Resistor Enable
254 PJSEL0      .set PJ_SFR + 0Ah    ; Port B Selection 0
255 PJSEL1      .set PJ_SFR + 0Ch    ; Port B Selection 1
256 PJSELC      .set PJ_SFR + 16h    ; Port B Complement Selection
257
258
259 ; ----------------------------------------------------------------------
260 RTC_B
261 ; ----------------------------------------------------------------------
262 RTCCTL01      .equ RTC_B_SFR + 00h
263 RTCCTL0       .equ RTC_B_SFR + 00h
264 RTCCTL1       .equ RTC_B_SFR + 01h
265 RTCCTL23      .equ RTC_B_SFR + 02h
266 RTCPS0CTL     .equ RTC_B_SFR + 08h
267 RTCPS1CTL     .equ RTC_B_SFR + 0Ah
268 RTCPS         .equ RTC_B_SFR + 0Ch
269 RTCIV         .equ RTC_B_SFR + 0Eh
270 RTCSEC        .equ RTC_B_SFR + 10h
271 RTCMIN        .equ RTC_B_SFR + 11h
272 RTCHOUR       .equ RTC_B_SFR + 12h
273 RTCDOW        .equ RTC_B_SFR + 13h
274 RTCDAY        .equ RTC_B_SFR + 14h
275 RTCMON        .equ RTC_B_SFR + 15h
276 RTCYEAR       .equ RTC_B_SFR + 16h
277
278 RTCHOLD       .equ 40h
279 RTCRDY        .equ 10h
280
281
282 ; ----------------------------------------------------------------------
283 MPY_32
284 ; ----------------------------------------------------------------------
285
286 MPY       .equ MPY_SFR + 00h    ; Multiply16 Unsigned/Operand 1 */
287 MPYS      .equ MPY_SFR + 02h    ; Multiply16 signed/Operand 1
288 MAC       .equ MPY_SFR + 04h    ; MultiplyAccumulate16 Unsigned/Operand 1 */
289 MACS      .equ MPY_SFR + 06h    ; MultiplyAccumulate16 signed/Operand 1
290 OP2       .equ MPY_SFR + 08h    ; Operand2_16 */
291 RESLO     .equ MPY_SFR + 0Ah    ; 16x16-bit result low - least significant word */
292 RESHI     .equ MPY_SFR + 0Ch    ; 16x16-bit result high */
293 SUMEXT    .equ MPY_SFR + 0Eh    ; 16x16-bit sum extension register
294 MPY32L    .equ MPY_SFR + 10h    ; Multiply32 Unsigned/Operand 1
295 MPY32H    .equ MPY_SFR + 12h    ; Multiply32 Unsigned/Operand 1
296 MPYS32L   .equ MPY_SFR + 14h    ; Multiply32 signed/Operand 1
297 MPYS32H   .equ MPY_SFR + 16h    ; Multiply32 signed/Operand 1
298 MAC32L    .equ MPY_SFR + 18h    ; MultiplyAccumulate32 Unsigned/Operand 1
299 MAC32H    .equ MPY_SFR + 1Ah    ; MultiplyAccumulate32 Unsigned/Operand 1
300 MACS32L   .equ MPY_SFR + 1Ch    ; MultiplyAccumulate32 signed/Operand 1
301 MACS32H   .equ MPY_SFR + 1Eh    ; MultiplyAccumulate32 signed/Operand 1
302 OP2L      .equ MPY_SFR + 20h    ; Multiply32 Operand 2
303 OP2H      .equ MPY_SFR + 22h    ; Multiply32 Operand 2
304 RES0      .equ MPY_SFR + 24h    ; 32x32-bit result 0 - least significant word */
305 RES1      .equ MPY_SFR + 26h    ; 32x32-bit result 1 */
306 RES2      .equ MPY_SFR + 28h    ; 32x32-bit result 2 */
307 RES3      .equ MPY_SFR + 2Ah    ; 32x32-bit result 3 */
308 MPY32CTL0 .equ MPY_SFR + 2Ch    ; MPY32 control register 0
309
310
311 UCSWRST         .equ 1  ; eUSCI Software Reset
312 UCTXIE          .equ 2  ; eUSCI Transmit Interrupt Enable
313 UCRXIE          .equ 1  ; eUSCI Receive Interrupt Enable
314 UCTXIFG         .equ 2  ; eUSCI Transmit Interrupt Flag
315 UCRXIFG         .equ 1  ; eUSCI Receive Interrupt Flag
316
317
318 ; ----------------------------------------------------------------------
319 ; eUSCI_A0
320 ; ----------------------------------------------------------------------
321
322     .IFDEF UCA0_TERM
323 TERMCTLW0       .equ eUSCI_A0_SFR + 00h    ; eUSCI_A0 Control Word Register 0
324 TERMBRW         .equ eUSCI_A0_SFR + 06h    ; eUSCI_A0 Baud Word Rate 0
325 TERMMCTLW       .equ eUSCI_A0_SFR + 08h    ; eUSCI_A0 Modulation Control
326 TERMRXBUF       .equ eUSCI_A0_SFR + 0Ch    ; eUSCI_A0 Receive Buffer
327 TERMTXBUF       .equ eUSCI_A0_SFR + 0Eh    ; eUSCI_A0 Transmit Buffer
328 TERMIE          .equ eUSCI_A0_SFR + 1Ah    ; eUSCI_A0 Interrupt Enable Register
329 TERMIFG         .equ eUSCI_A0_SFR + 1Ch    ; eUSCI_A0 Interrupt Flags Register
330 TERMVEC         .equ 0FFF0h      ; interrupt vector for  eUSCI_A0
331     .ENDIF ;UCA0_TERM
332
333 ; ----------------------------------------------------------------------
334 ; eUSCI_B0
335 ; ----------------------------------------------------------------------
336     .IFDEF UCB0_SD
337 SD_CTLW0       .equ eUSCI_B0_SFR + 00h    ; USCI_B0 Control Word Register 0
338 SD_BRW         .equ eUSCI_B0_SFR + 06h    ; USCI_B0 Baud Word Rate 0
339 SD_RXBUF       .equ eUSCI_B0_SFR + 0Ch    ; USCI_B0 Receive Buffer 8
340 SD_TXBUF       .equ eUSCI_B0_SFR + 0Eh    ; USCI_B0 Transmit Buffer 8
341 SD_IFG         .equ eUSCI_B0_SFR + 2Ch    ; USCI_B0 Interrupt Flags Register
342     .ENDIF ;UCB0_SD
343
344 UCB0STATW       .equ eUSCI_B0_SFR + 08h     ; eUSCI_B0 Status words
345