OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [actel_m1a3pl_dev_kit/] [software/] [spacewar/] [omsp_system.h] - Blame information for rev 212

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 143 olivier.gi
/*===========================================================================*/
2
/* Copyright (C) 2001 Authors                                                */
3
/*                                                                           */
4
/* This source file may be used and distributed without restriction provided */
5
/* that this copyright statement is not removed from the file and that any   */
6
/* derivative work contains the original copyright notice and the associated */
7
/* disclaimer.                                                               */
8
/*                                                                           */
9
/* This source file is free software; you can redistribute it and/or modify  */
10
/* it under the terms of the GNU Lesser General Public License as published  */
11
/* by the Free Software Foundation; either version 2.1 of the License, or    */
12
/* (at your option) any later version.                                       */
13
/*                                                                           */
14
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
15
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     */
16
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public       */
17
/* License for more details.                                                 */
18
/*                                                                           */
19
/* You should have received a copy of the GNU Lesser General Public License  */
20
/* along with this source; if not, write to the Free Software Foundation,    */
21
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA        */
22
/*                                                                           */
23
/*===========================================================================*/
24
/*                          OMSP_SYSTEM HEADER FILE                          */
25
/*---------------------------------------------------------------------------*/
26
/*                                                                           */
27
/* Author(s):                                                                */
28
/*             - Olivier Girard,    olgirard@gmail.com                       */
29
/*                                                                           */
30
/*---------------------------------------------------------------------------*/
31
/* $Rev: 19 $                                                                */
32
/* $LastChangedBy: olivier.girard $                                          */
33
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $          */
34
/*===========================================================================*/
35
 
36
#include <in430.h>
37
 
38
//=============================================================================
39
// STATUS REGISTER BITS
40
//=============================================================================
41
 
42
// Flags
43
#define C             (0x0001)
44
#define Z             (0x0002)
45
#define N             (0x0004)
46
#define V             (0x0100)
47
#define GIE           (0x0008)
48
#define CPUOFF        (0x0010)
49
#define OSCOFF        (0x0020)
50
#define SCG0          (0x0040)
51
#define SCG1          (0x0080)
52
 
53
// Low Power Modes coded with Bits 4-7 in SR
54
#define LPM0_bits     (CPUOFF)
55
#define LPM1_bits     (SCG0+CPUOFF)
56
#define LPM2_bits     (SCG1+CPUOFF)
57
#define LPM3_bits     (SCG1+SCG0+CPUOFF)
58
#define LPM4_bits     (SCG1+SCG0+OSCOFF+CPUOFF)
59
 
60
#define LPM0          _BIS_SR(LPM0_bits)       // Enter Low Power Mode 0
61
#define LPM0_EXIT     _BIC_SR_IRQ(LPM0_bits)   // Exit  Low Power Mode 0
62
#define LPM1          _BIS_SR(LPM1_bits)       // Enter Low Power Mode 1
63
#define LPM1_EXIT     _BIC_SR_IRQ(LPM1_bits)   // Exit  Low Power Mode 1
64
#define LPM2          _BIS_SR(LPM2_bits)       // Enter Low Power Mode 2
65
#define LPM2_EXIT     _BIC_SR_IRQ(LPM2_bits)   // Exit  Low Power Mode 2
66
#define LPM3          _BIS_SR(LPM3_bits)       // Enter Low Power Mode 3
67
#define LPM3_EXIT     _BIC_SR_IRQ(LPM3_bits)   // Exit  Low Power Mode 3
68
#define LPM4          _BIS_SR(LPM4_bits)       // Enter Low Power Mode 4
69
#define LPM4_EXIT     _BIC_SR_IRQ(LPM4_bits)   // Exit  Low Power Mode 4
70
 
71
 
72
//=============================================================================
73
// PERIPHERALS REGISTER DEFINITIONS
74
//=============================================================================
75
 
76
//----------------------------------------------------------
77
// CUSTOM DAC INTERFACE FOR SPACEWAR GAME
78
//----------------------------------------------------------
79
#define MY_DAC_X      (*(volatile unsigned int  *) 0x0190)
80
#define MY_DAC_X_STAT (*(volatile unsigned int  *) 0x0192)
81
#define MY_CNTRL1     (*(volatile unsigned int  *) 0x0194)
82
#define MY_CNTRL2     (*(volatile unsigned int  *) 0x0196)
83
#define MY_DAC_Y      (*(volatile unsigned int  *) 0x01A0)
84
#define MY_DAC_Y_STAT (*(volatile unsigned int  *) 0x01A2)
85
 
86
 
87
//----------------------------------------------------------
88
// SPECIAL FUNCTION REGISTERS
89
//----------------------------------------------------------
90 212 olivier.gi
#define  IE1_set_wdtie()   __asm__ __volatile__ ("bis.b #0x01, &0x0000")
91
//#define  IE1         (*(volatile unsigned char *) 0x0000)
92 143 olivier.gi
#define  IFG1        (*(volatile unsigned char *) 0x0002)
93
 
94
#define  CPU_ID_LO   (*(volatile unsigned char *) 0x0004)
95
#define  CPU_ID_HI   (*(volatile unsigned char *) 0x0006)
96
 
97
 
98
//----------------------------------------------------------
99
// GPIOs
100
//----------------------------------------------------------
101
#define  P1IN        (*(volatile unsigned char *) 0x0020)
102
#define  P1OUT       (*(volatile unsigned char *) 0x0021)
103
#define  P1DIR       (*(volatile unsigned char *) 0x0022)
104
#define  P1IFG       (*(volatile unsigned char *) 0x0023)
105
#define  P1IES       (*(volatile unsigned char *) 0x0024)
106
#define  P1IE        (*(volatile unsigned char *) 0x0025)
107
#define  P1SEL       (*(volatile unsigned char *) 0x0026)
108
 
109
#define  P2IN        (*(volatile unsigned char *) 0x0028)
110
#define  P2OUT       (*(volatile unsigned char *) 0x0029)
111
#define  P2DIR       (*(volatile unsigned char *) 0x002A)
112
#define  P2IFG       (*(volatile unsigned char *) 0x002B)
113
#define  P2IES       (*(volatile unsigned char *) 0x002C)
114
#define  P2IE        (*(volatile unsigned char *) 0x002D)
115
#define  P2SEL       (*(volatile unsigned char *) 0x002E)
116
 
117
#define  P3IN        (*(volatile unsigned char *) 0x0018)
118
#define  P3OUT       (*(volatile unsigned char *) 0x0019)
119
#define  P3DIR       (*(volatile unsigned char *) 0x001A)
120
#define  P3SEL       (*(volatile unsigned char *) 0x001B)
121
 
122
#define  P4IN        (*(volatile unsigned char *) 0x001C)
123
#define  P4OUT       (*(volatile unsigned char *) 0x001D)
124
#define  P4DIR       (*(volatile unsigned char *) 0x001E)
125
#define  P4SEL       (*(volatile unsigned char *) 0x001F)
126
 
127
#define  P5IN        (*(volatile unsigned char *) 0x0030)
128
#define  P5OUT       (*(volatile unsigned char *) 0x0031)
129
#define  P5DIR       (*(volatile unsigned char *) 0x0032)
130
#define  P5SEL       (*(volatile unsigned char *) 0x0033)
131
 
132
#define  P6IN        (*(volatile unsigned char *) 0x0034)
133
#define  P6OUT       (*(volatile unsigned char *) 0x0035)
134
#define  P6DIR       (*(volatile unsigned char *) 0x0036)
135
#define  P6SEL       (*(volatile unsigned char *) 0x0037)
136
 
137
 
138
//----------------------------------------------------------
139
// BASIC CLOCK MODULE
140
//----------------------------------------------------------
141
#define  DCOCTL      (*(volatile unsigned char *) 0x0056)
142
#define  BCSCTL1     (*(volatile unsigned char *) 0x0057)
143
#define  BCSCTL2     (*(volatile unsigned char *) 0x0058)
144
 
145
 
146
//----------------------------------------------------------
147
// WATCHDOG TIMER
148
//----------------------------------------------------------
149
 
150
// Addresses
151
#define  WDTCTL      (*(volatile unsigned int  *) 0x0120)
152
 
153
// Bit masks
154
#define  WDTIS0      (0x0001)
155
#define  WDTIS1      (0x0002)
156
#define  WDTSSEL     (0x0004)
157
#define  WDTCNTCL    (0x0008)
158
#define  WDTTMSEL    (0x0010)
159
#define  WDTNMI      (0x0020)
160
#define  WDTNMIES    (0x0040)
161
#define  WDTHOLD     (0x0080)
162
#define  WDTPW       (0x5A00)
163
 
164
 
165
//----------------------------------------------------------
166
// HARDWARE MULTIPLIER
167
//----------------------------------------------------------
168
#define  OP1_MPY     (*(volatile unsigned int  *) 0x0130)
169
#define  OP1_MPYS    (*(volatile unsigned int  *) 0x0132)
170
#define  OP1_MAC     (*(volatile unsigned int  *) 0x0134)
171
#define  OP1_MACS    (*(volatile unsigned int  *) 0x0136)
172
#define  OP2         (*(volatile unsigned int  *) 0x0138)
173
 
174
#define  RESLO       (*(volatile unsigned int  *) 0x013A)
175
#define  RESHI       (*(volatile unsigned int  *) 0x013C)
176
#define  SUMEXT      (*(volatile unsigned int  *) 0x013E)
177
 
178
 
179
//----------------------------------------------------------
180
// TIMER A
181
//----------------------------------------------------------
182
#define  TACTL       (*(volatile unsigned int  *) 0x0160)
183
#define  TAR         (*(volatile unsigned int  *) 0x0170)
184
#define  TACCTL0     (*(volatile unsigned int  *) 0x0162)
185
#define  TACCR0      (*(volatile unsigned int  *) 0x0172)
186
#define  TACCTL1     (*(volatile unsigned int  *) 0x0164)
187
#define  TACCR1      (*(volatile unsigned int  *) 0x0174)
188
#define  TACCTL2     (*(volatile unsigned int  *) 0x0166)
189
#define  TACCR2      (*(volatile unsigned int  *) 0x0176)
190
#define  TAIV        (*(volatile unsigned int  *) 0x012E)
191
 
192
// Alternate register names
193
#define CCTL0        TACCTL0
194
#define CCTL1        TACCTL1
195
#define CCR0         TACCR0
196
#define CCR1         TACCR1
197
 
198
// Bit-masks
199
#define MC_0                (0x0000)  /* Timer A mode control: 0 - Stop */
200
#define MC_1                (0x0010)  /* Timer A mode control: 1 - Up to CCR0 */
201
#define MC_2                (0x0020)  /* Timer A mode control: 2 - Continous up */
202
#define MC_3                (0x0030)  /* Timer A mode control: 3 - Up/Down */
203
#define ID_0                (0x0000)  /* Timer A input divider: 0 - /1 */
204
#define ID_1                (0x0040)  /* Timer A input divider: 1 - /2 */
205
#define ID_2                (0x0080)  /* Timer A input divider: 2 - /4 */
206
#define ID_3                (0x00C0)  /* Timer A input divider: 3 - /8 */
207
#define TASSEL_0            (0x0000) /* Timer A clock source select: 0 - TACLK */
208
#define TASSEL_1            (0x0100) /* Timer A clock source select: 1 - ACLK  */
209
#define TASSEL_2            (0x0200) /* Timer A clock source select: 2 - SMCLK */
210
#define TASSEL_3            (0x0300) /* Timer A clock source select: 3 - INCLK */
211
 
212
#define CM1                 (0x8000)  /* Capture mode 1 */
213
#define CM0                 (0x4000)  /* Capture mode 0 */
214
#define CCIS1               (0x2000)  /* Capture input select 1 */
215
#define CCIS0               (0x1000)  /* Capture input select 0 */
216
#define SCS                 (0x0800)  /* Capture sychronize */
217
#define SCCI                (0x0400)  /* Latched capture signal (read) */
218
#define CAP                 (0x0100)  /* Capture mode: 1 /Compare mode : 0 */
219
#define OUTMOD2             (0x0080)  /* Output mode 2 */
220
#define OUTMOD1             (0x0040)  /* Output mode 1 */
221
#define OUTMOD0             (0x0020)  /* Output mode 0 */
222
#define CCIE                (0x0010)  /* Capture/compare interrupt enable */
223
#define CCI                 (0x0008)  /* Capture input signal (read) */
224
#define OUT                 (0x0004)  /* PWM Output signal if output mode 0 */
225
#define COV                 (0x0002)  /* Capture/compare overflow flag */
226
#define CCIFG               (0x0001)  /* Capture/compare interrupt flag */
227
 
228
 
229
//=============================================================================
230
// INTERRUPT VECTORS
231
//=============================================================================
232
#define interrupt(x) void __attribute__((interrupt (x)))
233
#define eint()  __eint()
234
#define dint()  __dint()
235
 
236 212 olivier.gi
// Vector definition for RedHat/TI toolchain
237
#ifdef PFX_MSP430_ELF
238
   #define RESET_VECTOR        ("reset")   // Vector 15  (0xFFFE) - Reset              -  [Highest Priority]
239
   #define NMI_VECTOR          (15)        // Vector 14  (0xFFFC) - Non-maskable       -
240
   #define UNUSED_13_VECTOR    (14)        // Vector 13  (0xFFFA) -                    -
241
   #define UNUSED_12_VECTOR    (13)        // Vector 12  (0xFFF8) -                    -
242
   #define UNUSED_11_VECTOR    (12)        // Vector 11  (0xFFF6) -                    -
243
   #define WDT_VECTOR          (11)        // Vector 10  (0xFFF4) - Watchdog Timer     -
244
   #define TIMERA0_VECTOR      (10)        // Vector  9  (0xFFF2) - Timer A CC0        -
245
   #define TIMERA1_VECTOR      (9)         // Vector  8  (0xFFF0) - Timer A CC1-2, TA  -
246
   #define UNUSED_07_VECTOR    (8)         // Vector  7  (0xFFEE) -                    -
247
   #define UNUSED_06_VECTOR    (7)         // Vector  6  (0xFFEC) -                    -
248
   #define UNUSED_05_VECTOR    (6)         // Vector  5  (0xFFEA) -                    -
249
   #define UNUSED_04_VECTOR    (5)         // Vector  4  (0xFFE8) -                    -
250
   #define UNUSED_03_VECTOR    (4)         // Vector  4  (0xFFE8) -                    -
251
   #define PORT1_VECTOR        (3)         // Vector  2  (0xFFE4) - Port 1             -
252
   #define UNUSED_01_VECTOR    (2)         // Vector  1  (0xFFE2) -                    -
253
   #define UNUSED_00_VECTOR    (1)         // Vector  0  (0xFFE0) -                    -  [Lowest Priority]
254
 
255
// Vector definition for MSPGCC toolchain
256
#else
257
   #define RESET_VECTOR        (0x001E)    // Vector 15  (0xFFFE) - Reset              -  [Highest Priority]
258
   #define NMI_VECTOR          (0x001C)    // Vector 14  (0xFFFC) - Non-maskable       -
259
   #define UNUSED_13_VECTOR    (0x001A)    // Vector 13  (0xFFFA) -                    -
260
   #define UNUSED_12_VECTOR    (0x0018)    // Vector 12  (0xFFF8) -                    -
261
   #define UNUSED_11_VECTOR    (0x0016)    // Vector 11  (0xFFF6) -                    -
262
   #define WDT_VECTOR          (0x0014)    // Vector 10  (0xFFF4) - Watchdog Timer     -
263
   #define TIMERA0_VECTOR      (0x0012)    // Vector  9  (0xFFF2) - Timer A CC0        -
264
   #define TIMERA1_VECTOR      (0x0010)    // Vector  8  (0xFFF0) - Timer A CC1-2, TA  -
265
   #define UNUSED_07_VECTOR    (0x000E)    // Vector  7  (0xFFEE) -                    -
266
   #define UNUSED_06_VECTOR    (0x000C)    // Vector  6  (0xFFEC) -                    -
267
   #define UNUSED_05_VECTOR    (0x000A)    // Vector  5  (0xFFEA) -                    -
268
   #define UNUSED_04_VECTOR    (0x0008)    // Vector  4  (0xFFE8) -                    -
269
   #define UNUSED_03_VECTOR    (0x0006)    // Vector  3  (0xFFE6) -                    -
270
   #define PORT1_VECTOR        (0x0004)    // Vector  2  (0xFFE4) - Port 1             -
271
   #define UNUSED_01_VECTOR    (0x0002)    // Vector  1  (0xFFE2) -                    -
272
   #define UNUSED_00_VECTOR    (0x0000)    // Vector  0  (0xFFE0) -                    -  [Lowest Priority]
273
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.