Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2850 dpurdie 1
/********************************************************************
2
*
3
* Standard register and bit definitions for the Texas Instruments
4
* MSP430 microcontroller.
5
*
6
* This file supports assembler and C development for
7
* MSP430x32x devices.
8
*
9
* Texas Instruments, Version 2.2
10
*
11
* Rev. 1.1, Changed definition of LPM4 bits (device effect not changed)
12
*           Corrected LPMx_EXIT to reference new intrinsic    _bic_SR_register_on_exit
13
*           The file contents were reordered
14
* Rev. 1.2, Enclose all #define statements with parentheses
15
* Rev. 1.3, Added sfrb for TCDAT and TCPLD
16
* Rev. 1.4, Removed incorrect label 'BTRESET'
17
* Rev. 2.1, Alignment of defintions in Users Guide and of version numbers
18
* Rev. 2.2, Removed definitions for BTRESET
19
*
20
********************************************************************/
21
 
22
#ifndef __msp430x32x
23
#define __msp430x32x
24
 
25
#ifdef __cplusplus
26
extern "C" {
27
#endif
28
 
29
 
30
/*----------------------------------------------------------------------------*/
31
/* PERIPHERAL FILE MAP                                                        */
32
/*----------------------------------------------------------------------------*/
33
 
34
/* External references resolved by a device-specific linker command file */
35
#define SFR_8BIT(address)   extern volatile unsigned char address
36
#define SFR_16BIT(address)  extern volatile unsigned int address
37
 
38
 
39
/************************************************************
40
* STANDARD BITS
41
************************************************************/
42
 
43
#define BIT0                   (0x0001)
44
#define BIT1                   (0x0002)
45
#define BIT2                   (0x0004)
46
#define BIT3                   (0x0008)
47
#define BIT4                   (0x0010)
48
#define BIT5                   (0x0020)
49
#define BIT6                   (0x0040)
50
#define BIT7                   (0x0080)
51
#define BIT8                   (0x0100)
52
#define BIT9                   (0x0200)
53
#define BITA                   (0x0400)
54
#define BITB                   (0x0800)
55
#define BITC                   (0x1000)
56
#define BITD                   (0x2000)
57
#define BITE                   (0x4000)
58
#define BITF                   (0x8000)
59
 
60
/************************************************************
61
* STATUS REGISTER BITS
62
************************************************************/
63
 
64
#define C                      (0x0001)
65
#define Z                      (0x0002)
66
#define N                      (0x0004)
67
#define V                      (0x0100)
68
#define GIE                    (0x0008)
69
#define CPUOFF                 (0x0010)
70
#define OSCOFF                 (0x0020)
71
#define SCG0                   (0x0040)
72
#define SCG1                   (0x0080)
73
 
74
/* Low Power Modes coded with Bits 4-7 in SR */
75
 
76
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
77
#define LPM0                   (CPUOFF)
78
#define LPM1                   (SCG0+CPUOFF)
79
#define LPM2                   (SCG1+CPUOFF)
80
#define LPM3                   (SCG1+SCG0+CPUOFF)
81
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
82
/* End #defines for assembler */
83
 
84
#else /* Begin #defines for C */
85
#define LPM0_bits              (CPUOFF)
86
#define LPM1_bits              (SCG0+CPUOFF)
87
#define LPM2_bits              (SCG1+CPUOFF)
88
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
89
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
90
 
91
#include "in430.h"
92
 
93
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
94
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
95
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
96
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
97
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
98
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
99
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
100
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
101
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
102
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
103
#endif /* End #defines for C */
104
 
105
/************************************************************
106
* PERIPHERAL FILE MAP
107
************************************************************/
108
 
109
/************************************************************
110
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
111
************************************************************/
112
 
113
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
114
#define WDTIE                  (0x01)
115
#define OFIE                   (0x02)
116
#define P0IE_0                 (0x04)
117
#define P0IE_1                 (0x08)
118
 
119
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
120
#define WDTIFG                 (0x01)
121
#define OFIFG                  (0x02)
122
#define P0IFG_0                (0x04)
123
#define P0IFG_1                (0x08)
124
#define NMIIFG                 (0x10)
125
 
126
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
127
#define ADIE                   (0x04)
128
#define TPIE                   (0x08)
129
#define BTIE                   (0x80)
130
 
131
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
132
#define ADIFG                  (0x04)
133
#define BTIFG                  (0x80)
134
 
135
/************************************************************
136
* WATCHDOG TIMER
137
************************************************************/
138
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
139
 
140
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
141
/* The bit names have been prefixed with "WDT" */
142
#define WDTIS0                 (0x0001)
143
#define WDTIS1                 (0x0002)
144
#define WDTSSEL                (0x0004)
145
#define WDTCNTCL               (0x0008)
146
#define WDTTMSEL               (0x0010)
147
#define WDTNMI                 (0x0020)
148
#define WDTNMIES               (0x0040)
149
#define WDTHOLD                (0x0080)
150
 
151
#define WDTPW                  (0x5A00)
152
 
153
/* WDT-interval times [1ms] coded with Bits 0-2 */
154
/* WDT is clocked by fSMCLK (assumed 1MHz) */
155
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
156
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
157
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
158
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
159
/* WDT is clocked by fACLK (assumed 32KHz) */
160
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
161
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
162
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
163
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
164
/* Watchdog mode -> reset after expired time */
165
/* WDT is clocked by fSMCLK (assumed 1MHz) */
166
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
167
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
168
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
169
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
170
/* WDT is clocked by fACLK (assumed 32KHz) */
171
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
172
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
173
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
174
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
175
 
176
/* INTERRUPT CONTROL */
177
/* These two bits are defined in the Special Function Registers */
178
/* #define WDTIE               0x01 */
179
/* #define WDTIFG              0x01 */
180
 
181
/************************************************************
182
* DIGITAL I/O PORT0
183
************************************************************/
184
#define __MSP430_HAS_PORT0__                  /* Definition to show that Module is available */
185
 
186
SFR_8BIT(P0IN);                               /* Port 0 Input */
187
#define P0IN_0                 (0x01)
188
#define P0IN_1                 (0x02)
189
#define P0IN_2                 (0x04)
190
#define P0IN_3                 (0x08)
191
#define P0IN_4                 (0x10)
192
#define P0IN_5                 (0x20)
193
#define P0IN_6                 (0x40)
194
#define P0IN_7                 (0x80)
195
 
196
SFR_8BIT(P0OUT);                              /* Port 0 Output */
197
#define P0OUT_0                (0x01)
198
#define P0OUT_1                (0x02)
199
#define P0OUT_2                (0x04)
200
#define P0OUT_3                (0x08)
201
#define P0OUT_4                (0x10)
202
#define P0OUT_5                (0x20)
203
#define P0OUT_6                (0x40)
204
#define P0OUT_7                (0x80)
205
 
206
SFR_8BIT(P0DIR);                              /* Port 0 Direction */
207
#define P0DIR_0                (0x01)
208
#define P0DIR_1                (0x02)
209
#define P0DIR_2                (0x04)
210
#define P0DIR_3                (0x08)
211
#define P0DIR_4                (0x10)
212
#define P0DIR_5                (0x20)
213
#define P0DIR_6                (0x40)
214
#define P0DIR_7                (0x80)
215
 
216
SFR_8BIT(P0IFG);                              /* Port 0 Interrupt Flag */
217
/* These two bits are defined in Interrupt Flag 1 */
218
/* #define P0IFG_0             0x01 */
219
/* #define P0IFG_1             0x02 */
220
#define P0IFG_2                (0x04)
221
#define P0IFG_3                (0x08)
222
#define P0IFG_4                (0x10)
223
#define P0IFG_5                (0x20)
224
#define P0IFG_6                (0x40)
225
#define P0IFG_7                (0x80)
226
 
227
SFR_8BIT(P0IES);                              /* Port 0 Interrupt Edge Select */
228
#define P0IES_0                (0x01)
229
#define P0IES_1                (0x02)
230
#define P0IES_2                (0x04)
231
#define P0IES_3                (0x08)
232
#define P0IES_4                (0x10)
233
#define P0IES_5                (0x20)
234
#define P0IES_6                (0x40)
235
#define P0IES_7                (0x80)
236
 
237
SFR_8BIT(P0IE);                               /* Port 0 Interrupt Enable */
238
/* These two bits are defined in Interrupt Enable 1 */
239
/* #define P0IE_0              0x01 */
240
/* #define P0IE_1              0x02 */
241
#define P0IE_2                 (0x04)
242
#define P0IE_3                 (0x08)
243
#define P0IE_4                 (0x10)
244
#define P0IE_5                 (0x20)
245
#define P0IE_6                 (0x40)
246
#define P0IE_7                 (0x80)
247
 
248
/************************************************************
249
* LCD REGISTER
250
************************************************************/
251
#define __MSP430_HAS_LCD__                    /* Definition to show that Module is available */
252
 
253
SFR_8BIT(LCDCTL);                             /* LCD Control */
254
/* the names of the mode bits are different from the spec */
255
#define LCDON                  (0x01)
256
#define LCDLOWR                (0x02)
257
#define LCDSON                 (0x04)
258
#define LCDMX0                 (0x08)
259
#define LCDMX1                 (0x10)
260
#define LCDP0                  (0x20)
261
#define LCDP1                  (0x40)
262
#define LCDP2                  (0x80)
263
/* Display modes coded with Bits 2-4 */
264
#define LCDSTATIC              (LCDSON)
265
#define LCD2MUX                (LCDMX0+LCDSON)
266
#define LCD3MUX                (LCDMX1+LCDSON)
267
#define LCD4MUX                (LCDMX1+LCDMX0+LCDSON)
268
/* Group select code with Bits 5-7                     Seg.lines   Dig.output */
269
#define LCDSG0                 (0x00)         /* S0  - S1    O2  - O29 (default) */
270
#define LCDSG0_1               (LCDP0)        /* S0  - S5    O6  - O29 */
271
#define LCDSG0_2               (LCDP1)        /* S0  - S9    O10 - O29 */
272
#define LCDSG0_3               (LCDP1+LCDP0)  /* S0  - S13   O14 - O29 */
273
#define LCDSG0_4               (LCDP2)        /* S0  - S17   O18 - O29 */
274
#define LCDSG0_5               (LCDP2+LCDP0)  /* S0  - S21   O22 - O29 */
275
#define LCDSG0_6               (LCDP2+LCDP1)  /* S0  - S25   O26 - O29 */
276
#define LCDSG0_7            (LCDP2+LCDP1+LCDP0)       /* S0  - S29   --------- */
277
/* NOTE: YOU CAN ONLY USE THE 'S' OR 'G' DECLARATIONS FOR A COMMAND */
278
/* MOV  #LCDSG0_3+LCDOG2_7,&LCDCTL ACTUALY MEANS MOV  #LCDP1,&LCDCTL! */
279
#define LCDOG1_7               (0x00)         /* S0  - S1    O2  - O29 (default) */
280
#define LCDOG2_7               (LCDP0)        /* S0  - S5    O6  - O29 */
281
#define LCDOG3_7               (LCDP1)        /* S0  - S9    O10 - O29 */
282
#define LCDOG4_7               (LCDP1+LCDP0)  /* S0  - S13   O14 - O29 */
283
#define LCDOG5_7               (LCDP2)        /* S0  - S17   O18 - O29 */
284
#define LCDOG6_7               (LCDP2+LCDP0)  /* S0  - S21   O22 - O29 */
285
#define LCDOG7                 (LCDP2+LCDP1)  /* S0  - S25   O26 - O29 */
286
#define LCDOGOFF            (LCDP2+LCDP1+LCDP0)       /* S0  - S29   --------- */
287
 
288
#define LCDMEM_                (0x0031)       /* LCD Memory */
289
#ifdef __ASM_HEADER__
290
#define LCDMEM                 (LCDMEM_)      /* LCD Memory (for assembler) */
291
#else
292
#define LCDMEM                 ((char*)       LCDMEM_) /* LCD Memory (for C) */
293
#endif
294
SFR_8BIT(LCDM1);                              /* LCD Memory 1 */
295
SFR_8BIT(LCDM2);                              /* LCD Memory 2 */
296
SFR_8BIT(LCDM3);                              /* LCD Memory 3 */
297
SFR_8BIT(LCDM4);                              /* LCD Memory 4 */
298
SFR_8BIT(LCDM5);                              /* LCD Memory 5 */
299
SFR_8BIT(LCDM6);                              /* LCD Memory 6 */
300
SFR_8BIT(LCDM7);                              /* LCD Memory 7 */
301
SFR_8BIT(LCDM8);                              /* LCD Memory 8 */
302
SFR_8BIT(LCDM9);                              /* LCD Memory 9 */
303
SFR_8BIT(LCDM10);                             /* LCD Memory 10 */
304
SFR_8BIT(LCDM11);                             /* LCD Memory 11 */
305
SFR_8BIT(LCDM12);                             /* LCD Memory 12 */
306
SFR_8BIT(LCDM13);                             /* LCD Memory 13 */
307
SFR_8BIT(LCDM14);                             /* LCD Memory 14 */
308
SFR_8BIT(LCDM15);                             /* LCD Memory 15 */
309
 
310
#define LCDMA                  (LCDM10)       /* LCD Memory A */
311
#define LCDMB                  (LCDM11)       /* LCD Memory B */
312
#define LCDMC                  (LCDM12)       /* LCD Memory C */
313
#define LCDMD                  (LCDM13)       /* LCD Memory D */
314
#define LCDME                  (LCDM14)       /* LCD Memory E */
315
#define LCDMF                  (LCDM15)       /* LCD Memory F */
316
 
317
/************************************************************
318
* BASIC TIMER
319
************************************************************/
320
#define __MSP430_HAS_BT__                     /* Definition to show that Module is available */
321
 
322
SFR_8BIT(BTCTL);                              /* Basic Timer Control */
323
/* The bit names have been prefixed with "BT" */
324
#define BTIP0                  (0x01)
325
#define BTIP1                  (0x02)
326
#define BTIP2                  (0x04)
327
#define BTFRFQ0                (0x08)
328
#define BTFRFQ1                (0x10)
329
#define BTDIV                  (0x20)         /* fCLK2 = ACLK:256 */
330
#define BTHOLD                 (0x40)         /* BT1 is held if this bit is set */
331
#define BTSSEL                 (0x80)         /* fBT = fMCLK (main clock) */
332
 
333
SFR_8BIT(BTCNT1);                             /* Basic Timer Count 1 */
334
SFR_8BIT(BTCNT2);                             /* Basic Timer Count 2 */
335
 
336
/* Frequency of the BTCNT2 coded with Bit 5 and 7 in BTCTL */
337
#define BT_fCLK2_ACLK          (0x00)
338
#define BT_fCLK2_ACLK_DIV256   (BTDIV)
339
#define BT_fCLK2_MCLK          (BTSSEL)
340
 
341
/* Interrupt interval time fINT coded with Bits 0-2 in BTCTL */
342
#define BT_fCLK2_DIV2          (0x00)         /* fINT = fCLK2:2 (default) */
343
#define BT_fCLK2_DIV4          (BTIP0)        /* fINT = fCLK2:4 */
344
#define BT_fCLK2_DIV8          (BTIP1)        /* fINT = fCLK2:8 */
345
#define BT_fCLK2_DIV16         (BTIP1+BTIP0)  /* fINT = fCLK2:16 */
346
#define BT_fCLK2_DIV32         (BTIP2)        /* fINT = fCLK2:32 */
347
#define BT_fCLK2_DIV64         (BTIP2+BTIP0)  /* fINT = fCLK2:64 */
348
#define BT_fCLK2_DIV128        (BTIP2+BTIP1)  /* fINT = fCLK2:128 */
349
#define BT_fCLK2_DIV256     (BTIP2+BTIP1+BTIP0)       /* fINT = fCLK2:256 */
350
/* Frequency of LCD coded with Bits 3-4 */
351
#define BT_fLCD_DIV32          (0x00)         /* fLCD = fACLK:32 (default) */
352
#define BT_fLCD_DIV64          (BTFRFQ0)      /* fLCD = fACLK:64 */
353
#define BT_fLCD_DIV128         (BTFRFQ1)      /* fLCD = fACLK:128 */
354
#define BT_fLCD_DIV256      (BTFRFQ1+BTFRFQ0)         /* fLCD = fACLK:256 */
355
/* LCD frequency values with fBT=fACLK */
356
#define BT_fLCD_1K             (0x00)         /* fACLK:32 (default) */
357
#define BT_fLCD_512            (BTFRFQ0)      /* fACLK:64 */
358
#define BT_fLCD_256            (BTFRFQ1)      /* fACLK:128 */
359
#define BT_fLCD_128         (BTFRFQ1+BTFRFQ0)         /* fACLK:256 */
360
/* LCD frequency values with fBT=fMCLK */
361
#define BT_fLCD_31K            (BTSSEL)       /* fMCLK:32 */
362
#define BT_fLCD_15_5K       (BTSSEL+BTFRFQ0)          /* fMCLK:64 */
363
#define BT_fLCD_7_8K        (BTSSEL+BTFRFQ1+BTFRFQ0)  /* fMCLK:256 */
364
/* with assumed vlues of fACLK=32KHz, fMCLK=1MHz */
365
/* fBT=fACLK is thought for longer interval times */
366
#define BT_ADLY_0_064          (0x00)         /* 0.064ms interval (default) */
367
#define BT_ADLY_0_125          (BTIP0)        /* 0.125ms    " */
368
#define BT_ADLY_0_25           (BTIP1)        /* 0.25ms     " */
369
#define BT_ADLY_0_5            (BTIP1+BTIP0)  /* 0.5ms      " */
370
#define BT_ADLY_1              (BTIP2)        /* 1ms        " */
371
#define BT_ADLY_2              (BTIP2+BTIP0)  /* 2ms        " */
372
#define BT_ADLY_4              (BTIP2+BTIP1)  /* 4ms        " */
373
#define BT_ADLY_8           (BTIP2+BTIP1+BTIP0)       /* 8ms        " */
374
#define BT_ADLY_16             (BTDIV)        /* 16ms       " */
375
#define BT_ADLY_32             (BTDIV+BTIP0)  /* 32ms       " */
376
#define BT_ADLY_64             (BTDIV+BTIP1)  /* 64ms       " */
377
#define BT_ADLY_125         (BTDIV+BTIP1+BTIP0)       /* 125ms      " */
378
#define BT_ADLY_250            (BTDIV+BTIP2)  /* 250ms      " */
379
#define BT_ADLY_500         (BTDIV+BTIP2+BTIP0)       /* 500ms      " */
380
#define BT_ADLY_1000        (BTDIV+BTIP2+BTIP1)       /* 1000ms     " */
381
#define BT_ADLY_2000        (BTDIV+BTIP2+BTIP1+BTIP0) /* 2000ms     " */
382
/* fCLK2=fMCLK (1MHz) is thought for short interval times */
383
/* the timing for short intervals is more precise than ACLK */
384
/* NOTE */
385
/* Be sure that the SCFQCTL-Register is set to 01Fh so that fMCLK=1MHz */
386
/* Too low interval time results in interrupts too frequent for the processor to handle! */
387
#define BT_MDLY_0_002          (BTSSEL)       /* 0.002ms interval       *** interval times */
388
#define BT_MDLY_0_004          (BTSSEL+BTIP0) /* 0.004ms    "           *** too short for */
389
#define BT_MDLY_0_008          (BTSSEL+BTIP1) /* 0.008ms    "           *** interrupt */
390
#define BT_MDLY_0_016       (BTSSEL+BTIP1+BTIP0)      /* 0.016ms    "           *** handling */
391
#define BT_MDLY_0_032          (BTSSEL+BTIP2) /* 0.032ms    " */
392
#define BT_MDLY_0_064       (BTSSEL+BTIP2+BTIP0)      /* 0.064ms    " */
393
#define BT_MDLY_0_125       (BTSSEL+BTIP2+BTIP1)      /* 0.125ms    " */
394
#define BT_MDLY_0_25        (BTSSEL+BTIP2+BTIP1+BTIP0)/* 0.25ms     " */
395
 
396
/* Reset/Hold coded with Bits 6-7 in BT(1)CTL */
397
/* this is for BT */
398
//#define BTRESET_CNT1        (BTRESET)           /* BTCNT1 is reset while BTRESET is set */
399
//#define BTRESET_CNT1_2      (BTRESET+BTDIV)     /* BTCNT1 .AND. BTCNT2 are reset while ~ is set */
400
/* this is for BT1 */
401
#define BTHOLD_CNT1            (BTHOLD)       /* BTCNT1 is held while BTHOLD is set */
402
#define BTHOLD_CNT1_2          (BTHOLD+BTDIV) /* BT1CNT1 .AND. BT1CNT2 are held while ~ is set */
403
 
404
/* INTERRUPT CONTROL BITS */
405
/* #define BTIE                0x80 */
406
/* #define BTIFG               0x80 */
407
 
408
/************************************************************
409
* SYSTEM CLOCK GENERATOR
410
************************************************************/
411
#define __MSP430_HAS_FLL__                    /* Definition to show that Module is available */
412
 
413
SFR_8BIT(SCFI0);                              /* System Clock Frequency Integrator 0 */
414
#define FN_2                   (0x04)
415
#define FN_3                   (0x08)
416
#define FN_4                   (0x10)
417
 
418
SFR_8BIT(SCFI1);                              /* System Clock Frequency Integrator 1 */
419
SFR_8BIT(SCFQCTL);                            /* System Clock Frequency Control */
420
/* System clock frequency values fMCLK coded with Bits 0-6 in SCFQCTL */
421
/* #define SCFQ_32K            0x00                        fMCLK=1*fACLK          only a range from */
422
/* #define SCFQ_64K            0x01                        fMCLK=2*fACLK          3+1 to 127+1 is possible */
423
#define SCFQ_128K              (0x03)         /* fMCLK=4*fACLK */
424
#define SCFQ_256K              (0x07)         /* fMCLK=8*fACLK */
425
#define SCFQ_512K              (0x0F)         /* fMCLK=16*fACLK */
426
#define SCFQ_1M                (0x1F)         /* fMCLK=32*fACLK */
427
#define SCFQ_2M                (0x3F)         /* fMCLK=64*fACLK */
428
#define SCFQ_4M                (0x7F)         /* fMCLK=128*fACLK        not possible for ICE */
429
 
430
SFR_8BIT(CBCTL);                              /* Crystal Buffer Control *** WRITE-ONLY *** */
431
#define CBE                    (0x01)
432
#define CBSEL0                 (0x02)
433
#define CBSEL1                 (0x04)
434
/* Source select of frequency at output pin XBUF coded with Bits 1-2 in CBCTL */
435
#define CBSEL_ACLK             (0x00)         /* source is ACLK         (default after POR) */
436
#define CBSEL_ACLK_DIV2        (CBSEL0)       /* source is ACLK/2 */
437
#define CBSEL_ACLK_DIV4        (CBSEL1)       /* source is ACLK/4 */
438
#define CBSEL_MCLK          (CBSEL1+CBSEL0)           /* source is MCLK */
439
 
440
/* INTERRUPT CONTROL BITS */
441
/* These two bits are defined in the Special Function Registers */
442
/* #define OFIFG               0x02 */
443
/* #define OFIE                0x02 */
444
 
445
/************************************************************
446
* 8BIT TIMER/COUNTER
447
************************************************************/
448
#define __MSP430_HAS_8BTC__                   /* Definition to show that Module is available */
449
 
450
SFR_8BIT(TCCTL);                              /* Timer/Counter Control */
451
/* The bit names have been prefixed with "TC" */
452
#define TCRXD                  (0x01)
453
#define TCTXD                  (0x02)
454
#define TCRXACT                (0x04)
455
#define TCENCNT                (0x08)
456
#define TCTXE                  (0x10)
457
#define TCISCTL                (0x20)
458
#define TCSSEL0                (0x40)
459
#define TCSSEL1                (0x80)
460
/* Source select of clock input coded with Bits 6-7 */
461
#define TCSSEL_P01             (0x00)         /* source is signal at pin P0.1 (default) */
462
#define TCSSEL_ACLK            (TCSSEL0)      /* source is ACLK */
463
#define TCSSEL_MCLK            (TCSSEL1)      /* source is MCLK */
464
#define TCSSEL_P01_MCLK     (TCSSEL1+TCSSEL0)         /* source is signal pin P0.1 .AND. MCLK */
465
 
466
SFR_8BIT(TCPLD);                              /* Timer/Counter Preload */
467
SFR_8BIT(TCDAT);                              /* Timer/Counter Data */
468
 
469
/************************************************************
470
* TIMER/PORT
471
************************************************************/
472
#define __MSP430_HAS_TP__                     /* Definition to show that Module is available */
473
 
474
SFR_8BIT(TPCTL);                              /* Timer/Port Control */
475
#define EN1FG                  (0x01)
476
#define RC1FG                  (0x02)
477
#define RC2FG                  (0x04)
478
#define EN1                    (0x08)
479
#define ENA                    (0x10)
480
#define ENB                    (0x20)
481
#define TPSSEL0                (0x40)
482
#define TPSSEL1                (0x80)
483
/* The EN1 signal of TPCNT1 is coded with with Bits 3-5 in TPCTL */
484
#define TPCNT1_EN_OFF          (0x00)         /* TPCNT1 is disabled */
485
#define TPCNT1_EN_ON           (ENA)          /*   "    is enabled */
486
#define TPCNT1_EN_nTPIN5       (ENB)          /*   "    is enabled with ~TPIN.5 */
487
#define TPCNT1_EN_TPIN5        (TPSSEL0+ENB)  /*   "    is enabled with TPIN.5 */
488
#define TPCNT1_EN_nCIN         (ENB+ENA)      /*   "    is enabled with ~CIN */
489
#define TPCNT1_EN_CIN        (TPSSEL0+ENB+ENA)       /*   "    is enabled with CIN */
490
 
491
/* Source select of clock input coded with Bits 6-7 in TPCTL */
492
#define TPSSEL_CLK1_CIN        (0x00)         /* CLK1 source is signal at CIN   (default) */
493
#define TPSSEL_CLK1_ACLK       (TPSSEL0)      /* CLK1 source is ACLK */
494
#define TPSSEL_CLK1_MCLK       (TPSSEL1)      /* CLK1 source is MCLK */
495
 
496
/* DATA REGISTER ADDRESSES */
497
SFR_8BIT(TPCNT1);                             /* Timer/Port Counter 1 */
498
SFR_8BIT(TPCNT2);                             /* Timer/Port Counter 2 */
499
 
500
SFR_8BIT(TPD);                                /* Timer/Port Data */
501
#define TPD_0                  (0x01)
502
#define TPD_1                  (0x02)
503
#define TPD_2                  (0x04)
504
#define TPD_3                  (0x08)
505
#define TPD_4                  (0x10)
506
#define TPD_5                  (0x20)
507
#define CPON                   (0x40)
508
#define B16                    (0x80)
509
 
510
SFR_8BIT(TPE);                                /* Timer/Port Enable */
511
#define TPE_0                  (0x01)
512
#define TPE_1                  (0x02)
513
#define TPE_2                  (0x04)
514
#define TPE_3                  (0x08)
515
#define TPE_4                  (0x10)
516
#define TPE_5                  (0x20)
517
#define TPSSEL2                (0x40)
518
#define TPSSEL3                (0x80)
519
/* Source select of clock input coded with Bits 6-7 in TPE
520
   NOTE: If the control bit B16 in TPD is set, TPSSEL2/3
521
         are 'don't care' and the clock source of counter
522
         TPCNT2 is the same as of the counter TPCNT1. */
523
#define TPSSEL_CLK2_TPIN5      (0x00)         /* CLK2 source is signal TPIN.5 (default) */
524
#define TPSSEL_CLK2_ACLK       (TPSSEL2)      /* CLK2 source is ACLK */
525
#define TPSSEL_CLK2_MCLK       (TPSSEL3)      /* CLK2 source is MCLK */
526
#define TPSSEL_CLK2_OFF     (TPSSEL3+TPSSEL2)/* CLK2 source is disabled  */
527
 
528
/************************************************************
529
* A/D CONVERTER 12 + 2
530
************************************************************/
531
#define __MSP430_HAS_ADC14__                  /* Definition to show that Module is available */
532
 
533
SFR_16BIT(AIN);                               /* ADC Input */
534
SFR_16BIT(AEN);                               /* ADC Input Enable */
535
 
536
SFR_16BIT(ACTL);                              /* ADC Control */
537
/* the names of the mode bits are different from the spec */
538
#define ADSOC                  (0x0001)
539
#define ADSVCC                 (0x0002)
540
#define ADIN0                  (0x0004)
541
#define ADIN1                  (0x0008)
542
#define ADIN2                  (0x0010)
543
#define ADINOFF                (0x0020)
544
#define ADCSRC0                (0x0040)
545
#define ADCSRC1                (0x0080)
546
#define ADCSRCOFF              (0x0100)
547
#define ADRNG0                 (0x0200)
548
#define ADRNG1                 (0x0400)
549
#define ADAUTO                 (0x0800)
550
#define ADPD                   (0x1000)
551
/* Channel select coded with Bits 2-5 */
552
#define ADIN_A0                (0x0000)       /* (default) */
553
#define ADIN_A1                (ADIN0)
554
#define ADIN_A2                (ADIN1)
555
#define ADIN_A3                (ADIN1+ADIN0)
556
#define ADIN_A4                (ADIN2)
557
#define ADIN_A5                (ADIN2+ADIN0)
558
#define ADIN_A6                (ADIN2+ADIN1)
559
#define ADIN_A7                (ADIN2+ADIN1+ADIN0)
560
/* Current source output select coded with Bits 6-8 */
561
#define ADCSRC_A0              (0x0000)       /* (default) */
562
#define ADCSRC_A1              (ADCSRC0)
563
#define ADCSRC_A2              (ADCSRC1)
564
#define ADCSRC_A3              (ADCSRC1+ADCSRC0)
565
/* Range select coded with Bits 9-11 */
566
#define ADRNG_A                (0x0000)       /* 0<=Vin<1/4Vref  (default) */
567
#define ADRNG_B                (ADRNG0)       /* 1/4 Vref<=Vin<1/2 Vref */
568
#define ADRNG_C                (ADRNG1)       /* 1/2 Vref<=Vin<3/4 Vref */
569
#define ADRNG_D             (ADRNG1+ADRNG0)           /* 3/4 Vref<=Vin<1   Vref */
570
#define ADRNG_AUTO             (ADAUTO)       /* 0<=Vin<1   Vref auto detect range */
571
 
572
/* DATA REGISTER ADDRESS */
573
SFR_16BIT(ADAT);                              /* ADC Data */
574
 
575
/************************************************************
576
* EPROM CONTROL
577
************************************************************/
578
#define __MSP430_HAS_EPROM__                  /* Definition to show that Module is available */
579
 
580
SFR_8BIT(EPCTL);                              /* EPROM Control */
581
#define EPEXE                  (0x01)
582
#define EPVPPS                 (0x02)
583
 
584
/************************************************************
585
* Interrupt Vectors (offset from 0xFFE0)
586
************************************************************/
587
 
588
#define VECTOR_NAME(name)       name##_ptr
589
#define EMIT_PRAGMA(x)          _Pragma(#x)
590
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
591
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
592
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
593
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
594
 
595
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
596
#define PORT0_VECTOR            ".int00"                    /* 0xFFE0 Port 0 Bits 2-7 [Lowest Priority] */
597
#else
598
#define PORT0_VECTOR            (0 * 1u)                     /* 0xFFE0 Port 0 Bits 2-7 [Lowest Priority] */
599
/*#define PORT0_ISR(func)         ISR_VECTOR(func, ".int00")  */ /* 0xFFE0 Port 0 Bits 2-7 [Lowest Priority] */ /* CCE V2 Style */
600
#endif
601
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
602
#define BASICTIMER_VECTOR       ".int01"                    /* 0xFFE2 Basic Timer */
603
#else
604
#define BASICTIMER_VECTOR       (1 * 1u)                     /* 0xFFE2 Basic Timer */
605
/*#define BASICTIMER_ISR(func)    ISR_VECTOR(func, ".int01")  */ /* 0xFFE2 Basic Timer */ /* CCE V2 Style */
606
#endif
607
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
608
#define TIMERPORT_VECTOR        ".int04"                    /* 0xFFE8 Timer/Port */
609
#else
610
#define TIMERPORT_VECTOR        (4 * 1u)                     /* 0xFFE8 Timer/Port */
611
/*#define TIMERPORT_ISR(func)     ISR_VECTOR(func, ".int04")  */ /* 0xFFE8 Timer/Port */ /* CCE V2 Style */
612
#endif
613
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
614
#define ADC_VECTOR              ".int05"                    /* 0xFFEA ADC */
615
#else
616
#define ADC_VECTOR              (5 * 1u)                     /* 0xFFEA ADC */
617
/*#define ADC_ISR(func)           ISR_VECTOR(func, ".int05")  */ /* 0xFFEA ADC */ /* CCE V2 Style */
618
#endif
619
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
620
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
621
#else
622
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
623
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
624
#endif
625
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
626
#define IO1_VECTOR              ".int12"                    /* 0xFFF8 Dedicated IO (P0.1) */
627
#else
628
#define IO1_VECTOR              (12 * 1u)                    /* 0xFFF8 Dedicated IO (P0.1) */
629
/*#define IO1_ISR(func)           ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Dedicated IO (P0.1) */ /* CCE V2 Style */
630
#endif
631
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
632
#define IO0_VECTOR              ".int13"                    /* 0xFFFA Dedicated IO (P0.0) */
633
#else
634
#define IO0_VECTOR              (13 * 1u)                    /* 0xFFFA Dedicated IO (P0.0) */
635
/*#define IO0_ISR(func)           ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Dedicated IO (P0.0) */ /* CCE V2 Style */
636
#endif
637
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
638
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
639
#else
640
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
641
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
642
#endif
643
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
644
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
645
#else
646
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
647
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
648
#endif
649
 
650
/************************************************************
651
* End of Modules
652
************************************************************/
653
 
654
#ifdef __cplusplus
655
}
656
#endif /* extern "C" */
657
 
658
#endif /* #ifndef __msp430x32x */
659