BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
msp430.h
Go to the documentation of this file.
1 
27 *
28 /* ============================================================================ */
29 /* Copyright 2012, Texas Instruments Incorporated */
30 /* All rights reserved. */
31 /* */
32 /* Redistribution and use in source and binary forms, with or without */
33 /* modification, are permitted provided that the following conditions */
34 /* are met: */
35 /* */
36 /* * Redistributions of source code must retain the above copyright */
37 /* notice, this list of conditions and the following disclaimer. */
38 /* */
39 /* * Redistributions in binary form must reproduce the above copyright */
40 /* notice, this list of conditions and the following disclaimer in the */
41 /* documentation and/or other materials provided with the distribution. */
42 /* */
43 /* * Neither the name of Texas Instruments Incorporated nor the names of */
44 /* its contributors may be used to endorse or promote products derived */
45 /* from this software without specific prior written permission. */
46 /* */
47 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */
48 /* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */
49 /* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
50 /* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
51 /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
52 /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
53 /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */
54 /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */
55 /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
56 /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
57 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
58 /* ============================================================================ */
59 
60 /********************************************************************
61 *
62 * Standard register and bit definitions for the Texas Instruments
63 * MSP430 microcontroller.
64 *
65 * This file supports assembler and C development for
66 * msp430XGENERIC device.
67 *
68 * Texas Instruments, Version 1.0 draft
69 *
70 * Rev. 1.0, Setup
71 *
72 *
73 ********************************************************************/
74 
75 /************************************************************
76 * STANDARD BITS
77 ************************************************************/
78 
79 #define BIT0 (0x0001)
80 #define BIT1 (0x0002)
81 #define BIT2 (0x0004)
82 #define BIT3 (0x0008)
83 #define BIT4 (0x0010)
84 #define BIT5 (0x0020)
85 #define BIT6 (0x0040)
86 #define BIT7 (0x0080)
87 #define BIT8 (0x0100)
88 #define BIT9 (0x0200)
89 #define BITA (0x0400)
90 #define BITB (0x0800)
91 #define BITC (0x1000)
92 #define BITD (0x2000)
93 #define BITE (0x4000)
94 #define BITF (0x8000)
96 /************************************************************
97 * STATUS REGISTER BITS
98 ************************************************************/
99 
102 #define C (0x0001)
103 
105 #define Z (0x0002)
106 
108 #define N (0x0004)
109 
111 #define V (0x0100)
112 
114 #define GIE (0x0008)
115 
116 #define CPUOFF (0x0010)
117 
119 #define OSCOFF (0x0020)
120 
123 #define SCG0 (0x0040)
124 
127 #define SCG1 (0x0080)
128 
129 /* Low Power Modes coded with Bits 4-7 in SR */
130 
132 #define LPM0_bits (CPUOFF)
133 
134 #define LPM1_bits (SCG0|CPUOFF)
135 
136 #define LPM2_bits (SCG1|CPUOFF)
137 
138 #define LPM3_bits (SCG1|SCG0|CPUOFF)
139 
140 #define LPM4_bits (SCG1|SCG0|OSCOFF|CPUOFF)
141 
142 /************************************************************
143 * CPU
144 ************************************************************/
149 #define __MSP430_HAS_MSP430XV2_CPU__
150 
151 /* Make sure nobody can accidently reference these values */
152 #if defined(BSP430_DOXYGEN)
153 #define MC_0 (0x0000)
154 #define MC_1 (0x0010)
155 #define MC_2 (0x0020)
156 #define MC_3 (0x0030)
157 #define ID_0 (0x0000)
158 #define ID_1 (0x0040)
159 #define ID_2 (0x0080)
160 #define ID_3 (0x00C0)
161 #define CCIS_0 (0x0000)
162 #define CCIS_1 (0x1000)
163 #define CCIS_2 (0x2000)
164 #define CCIS_3 (0x3000)
165 #define CM_0 (0x0000)
166 #define CM_1 (0x4000)
167 #define CM_2 (0x8000)
168 #define CM_3 (0xC000)
170 /* TAxCCTLx Control Bits */
171 #define CM1 (0x8000)
172 #define CM0 (0x4000)
173 #define CCIS1 (0x2000)
174 #define CCIS0 (0x1000)
175 #define SCS (0x0800)
176 #define SCCI (0x0400)
177 #define CAP (0x0100)
178 #define OUTMOD2 (0x0080)
179 #define OUTMOD1 (0x0040)
180 #define OUTMOD0 (0x0020)
181 #define CCIE (0x0010)
182 #define CCI (0x0008)
183 #define OUT (0x0004)
184 #define COV (0x0002)
185 #define CCIFG (0x0001)
187 #define SCS (0x0800)
188 #define SCCI (0x0400)
189 #define CAP (0x0100)
191 #define SELA_0 (0x0000)
192 #define SELA_1 (0x0100)
193 #define SELA_2 (0x0200)
194 #define SELA_3 (0x0300)
195 #define SELA_4 (0x0400)
196 #define SELA_5 (0x0500)
197 #define SELA_6 (0x0600)
198 #define SELA_7 (0x0700)
200 #define LFXT1S_0 (0x00)
201 #define LFXT1S_1 (0x10)
202 #define LFXT1S_2 (0x20)
203 #define LFXT1S_3 (0x30)
205 #define UCBUSY (0x01)
207 #define UCPEN (0x80)
208 #define UCCKPH (0x80)
209 #define UCA10 (0x80)
210 #define UCPAR (0x40)
211 #define UCCKPL (0x40)
212 #define UCSLA10 (0x40)
213 #define UCMSB (0x20)
214 #define UCMM (0x20)
215 #define UC7BIT (0x10)
216 #define UCSPB (0x08)
217 #define UCMST (0x08)
219 #define UCSYNC (0x01)
221 // I2C-Mode Bits
222 //#define res (0x10) /* reserved */
223 #define UCMODE_0 (0x00)
224 #define UCMODE_1 (0x02)
225 #define UCMODE_2 (0x04)
226 #define UCMODE_3 (0x06)
228 // UART-Mode Bits
229 #define UCRXEIE (0x20)
230 #define UCBRKIE (0x10)
231 #define UCTR (0x10)
232 #define UCDORM (0x08)
233 #define UCTXNACK (0x08)
234 #define UCTXADDR (0x04)
235 #define UCTXSTP (0x04)
236 #define UCTXBRK (0x02)
237 #define UCTXSTT (0x02)
239 #define UCSWRST (0x01)
241 #define UCSSEL_0 (0x00)
242 #define UCSSEL_1 (0x40)
243 #define UCSSEL_2 (0x80)
244 #define UCSSEL_3 (0xC0)
246 /* PMMCTL0 Control Bits */
247 
248 #define PMMCOREV_0 (0x0000)
249 #define PMMCOREV_1 (0x0001)
250 #define PMMCOREV_2 (0x0002)
251 #define PMMCOREV_3 (0x0003)
253 /* PM5CTL0 Power Mode 5 Control Bits */
254 #define LOCKLPM5 (0x0001)
256 extern unsigned int SVSMHCTL;
257 extern unsigned int SVSMLCTL;
258 #define SVSMHRRL1 (0x0002)
259 #define SVSMHRRL2 (0x0004)
260 #define SVSMHDLYST (0x0008)
261 #define SVSHMD (0x0010)
262 #define SVSMHEVM (0x0040)
263 #define SVSMHACE (0x0080)
264 #define SVSHRVL0 (0x0100)
265 #define SVSHRVL1 (0x0200)
266 #define SVSHE (0x0400)
267 #define SVSHFP (0x0800)
268 #define SVMHOVPE (0x1000)
269 #define SVMHE (0x4000)
270 #define SVMHFP (0x8000)
271 #define SVSMLRRL0 (0x0001)
272 #define SVSMLRRL1 (0x0002)
273 #define SVSMLRRL2 (0x0004)
274 #define SVSMLDLYST (0x0008)
275 #define SVSLMD (0x0010)
276 #define SVSMLEVM (0x0040)
277 #define SVSMLACE (0x0080)
278 #define SVSLRVL0 (0x0100)
279 #define SVSLRVL1 (0x0200)
280 #define SVSLE (0x0400)
281 #define SVSLFP (0x0800)
282 #define SVMLOVPE (0x1000)
283 #define SVMLE (0x4000)
284 #define SVMLFP (0x8000)
286 /* TLV-related offsets and constants */
287 
288 #define TLV_START (0x1A08)
289 #define TLV_END (0x1AFF)
291 #define TLV_LDTAG (0x01)
292 #define TLV_PDTAG (0x02)
293 #define TLV_BLANK (0x05)
294 #define TLV_DIERECORD (0x08)
295 #define TLV_ADCCAL (0x11)
296 #define TLV_ADC12CAL (0x11)
297 #define TLV_ADC10CAL (0x13)
298 #define TLV_REFCAL (0x12)
299 #define TLV_TAGEXT (0xFE)
301 #define TAG_DCO_30 (0x01)
302 #define TAG_ADC10_1 (0x08)
303 #define TAG_ADC12_1 (0x08)
304 #define TAG_EMPTY (0xFE)
306 /* FLASH-related information */
307 #define LOCKA (0x0040)
308 #define LOCKINFO (0x0080)
310 /* SYSRSTIV aggregated candidate names */
311 #define SYSRSTIV_BOR (0x0002)
312 #define SYSRSTIV_RSTNMI (0x0004)
313 #define SYSRSTIV_SVMBOR (0x0004)
314 #define SYSRSTIV_DOBOR (0x0006)
315 #define SYSRSTIV_RSTNMI (0x0006)
316 #define SYSRSTIV_DOBOR (0x0008)
317 #define SYSRSTIV_LPM5WU (0x0008)
318 #define SYSRSTIV_SECYV (0x000A)
319 #define SYSRSTIV_DOPOR (0x000C)
320 #define SYSRSTIV_SVSL (0x000C)
321 #define SYSRSTIV_SVSLIFG (0x000C)
322 #define SYSRSTIV_SVSH (0x000E)
323 #define SYSRSTIV_SVSHIFG (0x000E)
324 #define SYSRSTIV_WDTTO (0x000E)
325 #define SYSRSTIV_SVML_OVP (0x0010)
326 #define SYSRSTIV_WDTKEY (0x0010)
327 #define SYSRSTIV_CCSKEY (0x0012)
328 #define SYSRSTIV_SVMH_OVP (0x0012)
329 #define SYSRSTIV_DOPOR (0x0014)
330 #define SYSRSTIV_PMMKEY (0x0014)
331 #define SYSRSTIV_WDTTO (0x0016)
332 #define SYSRSTIV_PERF (0x0016)
333 #define SYSRSTIV_WDTKEY (0x0018)
334 #define SYSRSTIV_FRCTLPW (0x001A)
335 #define SYSRSTIV_KEYV (0x001A)
336 #define SYSRSTIV_FLLUL (0x001C)
337 #define SYSRSTIV_DBDIFG (0x001C)
338 #define SYSRSTIV_UBDIFG (0x001C)
339 #define SYSRSTIV_PLLUL (0x001C)
340 #define SYSRSTIV_PERF (0x001E)
341 #define SYSRSTIV_PSSKEY (0x0020)
342 #define SYSRSTIV_PMMPW (0x0020)
343 #define SYSRSTIV_PMMKEY (0x0020)
344 #define SYSRSTIV_MPUPW (0x0022)
345 #define SYSRSTIV_MPUKEY (0x0022)
346 #define SYSRSTIV_CSPW (0x0024)
347 #define SYSRSTIV_CSKEY (0x0024)
348 #define SYSRSTIV_MPUSEGIIFG (0x0026)
349 #define SYSRSTIV_MPUSEGPIFG (0x0026)
350 #define SYSRSTIV_MPUSEG1IFG (0x0028)
351 #define SYSRSTIV_MPUSEG2IFG (0x002A)
352 #define SYSRSTIV_MPUSEG3IFG (0x002C)
354 #define SELREF_0 (0x0000)
355 #define SELREF_1 (0x0010)
356 #define SELREF_2 (0x0020)
357 #define SELREF_3 (0x0030)
358 #define SELREF_4 (0x0040)
359 #define SELREF_5 (0x0050)
360 #define SELREF_6 (0x0060)
361 #define SELREF_7 (0x0070)
362 #define SELREF__XT1CLK (0x0000)
363 #define SELREF__REFOCLK (0x0020)
364 #define SELREF__XT2CLK (0x0050)
366 #define XCAP_0 (0x00)
367 #define XCAP_1 (0x04)
368 #define XCAP_2 (0x08)
369 #define XCAP_3 (0x0C)
371 #define XCAP0PF (0x00)
372 #define XCAP10PF (0x10)
373 #define XCAP14PF (0x20)
374 #define XCAP18PF (0x30)
376 #endif /* BSP430_DOXYGEN */
377 
379 /************************************************************
380 * ADC10_A
381 ************************************************************/
382 #define __MSP430_HAS_ADC10_A__
383 #define __MSP430_HAS_ADC10_B__
385 /************************************************************
386 * ADC12 PLUS
387 ************************************************************/
388 #define __MSP430_HAS_ADC12_PLUS__
389 /************************************************************
390 * ADC12_B
391 ************************************************************/
392 #define __MSP430_HAS_ADC12_B__
393 /************************************************************
394 * AES256 Accelerator
395 ************************************************************/
396 #define __MSP430_HAS_AES256__
397 /*************************************************************
398 * Backup RAM Module
399 *************************************************************/
400 #define __MSP430_HAS_BACKUP_RAM__
401 /*************************************************************
402 * Battery Charger Module
403 *************************************************************/
404 #define __MSP430_HAS_BATTERY_CHARGER__
405 /************************************************************
406 * CapSence_IO 0
407 ************************************************************/
408 #define __MSP430_HAS_CAP_SENSE_IO_0__
409 /************************************************************
410 * CapSence_IO 1
411 ************************************************************/
412 #define __MSP430_HAS_CAP_SENSE_IO_1__
413 /************************************************************
414 * Comparator B
415 ************************************************************/
416 #define __MSP430_HAS_COMPB__
417 /************************************************************
418 * Comparator D
419 ************************************************************/
420 #define __MSP430_HAS_COMPD__
421 /*************************************************************
422 * CRC Module
423 *************************************************************/
424 #define __MSP430_HAS_CRC__
425 /************************************************************
426 * CLOCK SYSTEM
427 ************************************************************/
428 #define __MSP430_HAS_CS__
429 /************************************************************
430 * CLOCK SYSTEM
431 ************************************************************/
432 #define __MSP430_HAS_CS_A__
433 #define DCOFSEL2 (0x0008)
434 /************************************************************
435 * DAC12
436 ************************************************************/
437 #define __MSP430_HAS_DAC12_2__
438 /************************************************************
439 * DMA_X
440 ************************************************************/
441 #define __MSP430_HAS_DMAX_3__
442 /************************************************************
443 * DMA_X
444 ************************************************************/
445 #define __MSP430_HAS_DMAX_6__
446 /*************************************************************
447 * Flash Memory
448 *************************************************************/
449 #define __MSP430_HAS_FLASH__
450 /*************************************************************
451 * FRAM Memory
452 *************************************************************/
453 #define __MSP430_HAS_FRAM_FR5XX__
454 /*************************************************************
455 * FRAM Memory
456 *************************************************************/
457 #define __MSP430_HAS_FRAM__
458 /************************************************************
459 * Memory Protection Unit
460 ************************************************************/
461 #define __MSP430_HAS_MPU__
462 /************************************************************
463 * Memory Protection Unit A
464 ************************************************************/
465 #define __MSP430_HAS_MPU_A__
466 /************************************************************
467 * LCD_B
468 ************************************************************/
469 #define __MSP430_HAS_LCD_B__
470 /************************************************************
471 * HARDWARE MULTIPLIER 32Bit
472 ************************************************************/
473 #define __MSP430_HAS_MPY32__
474 /************************************************************
475 * DIGITAL I/O Port1/2 Pull up / Pull down Resistors
476 ************************************************************/
477 #define __MSP430_HAS_PORT1_R__
478 #define __MSP430_HAS_PORT2_R__
479 #define __MSP430_HAS_PORTA_R__
480 /************************************************************
481 * DIGITAL I/O Port3/4 Pull up / Pull down Resistors
482 ************************************************************/
483 #define __MSP430_HAS_PORT3_R__
484 #define __MSP430_HAS_PORT4_R__
485 #define __MSP430_HAS_PORTB_R__
486 /************************************************************
487 * DIGITAL I/O Port5/6 Pull up / Pull down Resistors
488 ************************************************************/
489 #define __MSP430_HAS_PORT5_R__
490 #define __MSP430_HAS_PORT6_R__
491 #define __MSP430_HAS_PORTC_R__
492 /************************************************************
493 * DIGITAL I/O Port7/8 Pull up / Pull down Resistors
494 ************************************************************/
495 #define __MSP430_HAS_PORT7_R__
496 #define __MSP430_HAS_PORT8_R__
497 #define __MSP430_HAS_PORTD_R__
498 /************************************************************
499 * DIGITAL I/O Port9/10 Pull up / Pull down Resistors
500 ************************************************************/
501 #define __MSP430_HAS_PORT9_R__
502 #define __MSP430_HAS_PORT10_R__
503 #define __MSP430_HAS_PORTE_R__
504 /************************************************************
505 * DIGITAL I/O Port11 Pull up / Pull down Resistors
506 ************************************************************/
507 #define __MSP430_HAS_PORT11_R__
508 #define __MSP430_HAS_PORTF_R__
509 /************************************************************
510 * DIGITAL I/O PortJ Pull up / Pull down Resistors
511 ************************************************************/
512 #define __MSP430_HAS_PORTJ_R__
513 /************************************************************
514 * PORT MAPPING CONTROLLER
515 ************************************************************/
516 #define __MSP430_HAS_PORT_MAPPING__
517 /************************************************************
518 * PORT 2 MAPPING CONTROLLER
519 ************************************************************/
520 #define __MSP430_HAS_PORT2_MAPPING__
521 /************************************************************
522 * PMM - Power Management System
523 ************************************************************/
524 #define __MSP430_HAS_PMM__
525 /************************************************************
526 * PMM - Power Management System
527 ************************************************************/
528 #define __MSP430_HAS_PMM_FR5xx__
529 /************************************************************
530 * PMM - Power Management System for FRAM
531 ************************************************************/
532 #define __MSP430_HAS_PMM_FRAM__
533 /************************************************************
534 * Port U
535 ************************************************************/
536 #define __MSP430_HAS_PU__
537 /*************************************************************
538 * RAM Control Module
539 *************************************************************/
540 #define __MSP430_HAS_RC__
541 /************************************************************
542 * Shared Reference
543 ************************************************************/
544 #define __MSP430_HAS_REF__
545 /************************************************************
546 * Shared Reference
547 ************************************************************/
548 #define __MSP430_HAS_REF_A__
549 /************************************************************
550 * Real Time Clock
551 ************************************************************/
552 #define __MSP430_HAS_RTC__
553 /************************************************************
554 * Real Time Clock
555 ************************************************************/
556 #define __MSP430_HAS_RTC_B__
557 /************************************************************
558 * Real Time Clock
559 ************************************************************/
560 #define __MSP430_HAS_RTC_C__
561 /************************************************************
562 * Real Time Clock
563 ************************************************************/
564 #define __MSP430_HAS_RTC_CE__
565 /************************************************************
566 * SFR - Special Function Register Module
567 ************************************************************/
568 #define __MSP430_HAS_SFR__
569 /************************************************************
570 * SYS - System Module
571 ************************************************************/
572 #define __MSP430_HAS_SYS__
573 /************************************************************
574 * Timerx_A7
575 ************************************************************/
576 #define __MSP430_HAS_TxA7__
577 /************************************************************
578 * Timerx_B3
579 ************************************************************/
580 #define __MSP430_HAS_TxB7__
581 /************************************************************
582 * Timerx_D7
583 ************************************************************/
584 #define __MSP430_HAS_TxD7__
585 /************************************************************
586 * UNIFIED CLOCK SYSTEM
587 ************************************************************/
588 #define __MSP430_HAS_UCS__
589 /************************************************************
590 * USB
591 ************************************************************/
592 #define __MSP430_HAS_USB__
593 /************************************************************
594 * USCI Ax
595 ************************************************************/
596 #define __MSP430_HAS_USCI_Ax__
597 /************************************************************
598 * USCI Ax
599 ************************************************************/
600 #define __MSP430_HAS_EUSCI_Ax__
601 /************************************************************
602 * WATCHDOG TIMER A
603 ************************************************************/
604 #define __MSP430_HAS_WDT_A__
605 /************************************************************
606 * TLV Descriptors
607 ************************************************************/
608 #define __MSP430_HAS_TLV__