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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [tA_modes.s43] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 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
/*                                  TIMER A                                  */
25
/*---------------------------------------------------------------------------*/
26
/* Test the timer A:                                                         */
27
/*                        - Check RD/WR register access.                     */
28
/*                        - Check the clock divider.                         */
29
/*                        - Check the timer modes.                           */
30
/*===========================================================================*/
31
 
32
.global main
33
 
34
.set   TACTL,   0x0160
35
.set   TAR,     0x0170
36
.set   TACCTL0, 0x0162
37
.set   TACCR0,  0x0172
38
.set   TACCTL1, 0x0164
39
.set   TACCR1,  0x0174
40
.set   TACCTL2, 0x0166
41
.set   TACCR2,  0x0176
42
.set   TAIV,    0x012E
43
 
44
 
45
WAIT_FUNC:
46
        dec r14
47
        jnz WAIT_FUNC
48
        ret
49
 
50
main:
51
        mov  #0x0250, r1        ; # Initialize stack pointer
52
        mov  #0x0000, &0x0200
53
 
54
       /* --------------   TIMER A TEST:  RD/WR ACCESS    --------------- */
55
 
56
        mov  #0xaaaa, &TACTL	; # TACTL
57
        mov   &TACTL, &0x0200
58
        mov  #0x5555, &TACTL
59
        mov   &TACTL, &0x0202
60
        mov  #0x0000, &TACTL
61
        mov   &TACTL, &0x0204
62
        mov  #0x0000, &TACTL
63
        mov   &TACTL, &0x0206
64
 
65
        mov  #0xaaaa, &TAR	; # TAR
66
        mov     &TAR, &0x0208
67
        mov  #0x5555, &TAR
68
        mov     &TAR, &0x020A
69
        mov  #0x0000, &TAR
70
        mov     &TAR, &0x020C
71
 
72
        mov  #0xaaaa, &TACCTL0	; # TACCTL0
73
        mov &TACCTL0, &0x0210
74
        mov  #0x5555, &TACCTL0
75
        mov &TACCTL0, &0x0212
76
        mov  #0x0000, &TACCTL0
77
        mov &TACCTL0, &0x0214
78
 
79
        mov  #0xaaaa, &TACCR0	; # TACCR0
80
        mov  &TACCR0, &0x0216
81
        mov  #0x5555, &TACCR0
82
        mov  &TACCR0, &0x0218
83
        mov  #0x0000, &TACCR0
84
        mov  &TACCR0, &0x021A
85
 
86
        mov  #0xaaaa, &TACCTL1	; # TACCTL1
87
        mov &TACCTL1, &0x0220
88
        mov  #0x5555, &TACCTL1
89
        mov &TACCTL1, &0x0222
90
        mov  #0x0000, &TACCTL1
91
        mov &TACCTL1, &0x0224
92
 
93
        mov  #0xaaaa, &TACCR1	; # TACCR1
94
        mov  &TACCR1, &0x0226
95
        mov  #0x5555, &TACCR1
96
        mov  &TACCR1, &0x0228
97
        mov  #0x0000, &TACCR1
98
        mov  &TACCR1, &0x022A
99
 
100
        mov  #0xaaaa, &TACCTL2	; # TACCTL2
101
        mov &TACCTL2, &0x0230
102
        mov  #0x5555, &TACCTL2
103
        mov &TACCTL2, &0x0232
104
        mov  #0x0000, &TACCTL2
105
        mov &TACCTL2, &0x0234
106
 
107
        mov  #0xaaaa, &TACCR2	; # TACCR2
108
        mov  &TACCR2, &0x0236
109
        mov  #0x5555, &TACCR2
110
        mov  &TACCR2, &0x0238
111
        mov  #0x0000, &TACCR2
112
        mov  &TACCR2, &0x023A
113
 
114
        mov  #0xaaaa, &TAIV	; # TAIV
115
        mov    &TAIV, &0x0240
116
        mov  #0x5555, &TAIV
117
        mov    &TAIV, &0x0242
118
        mov  #0x0000, &TAIV
119
        mov    &TAIV, &0x0244
120
 
121
        mov  #0x1000, r15
122
 
123
       /* --------------   TIMER A TEST:  INPUT DIVIDER   --------------- */
124
 
125
        mov  #0x0200, &TACTL
126
        mov  #0x0000, &TACCTL0
127
        eint
128
 
129
        mov  #0x0200, &TACTL
130
        mov  #0x0020, &TACCR0
131
        mov  #0x0216, &TACTL 	; # /1
132
        mov  #0x0001, &0x0200
133
        mov  #0x0010, r14
134
        call #WAIT_FUNC
135
 
136
        mov  #0x0200, &TACTL
137
        mov  #0x0010, &TACCR0
138
        mov  #0x0256, &TACTL 	; # /2
139
        mov  #0x0002, &0x0200
140
        mov  #0x0010, r14
141
        call #WAIT_FUNC
142
 
143
        mov  #0x0200, &TACTL
144
        mov  #0x0008, &TACCR0
145
        mov  #0x0296, &TACTL 	; # /4
146
        mov  #0x0003, &0x0200
147
        mov  #0x0010, r14
148
        call #WAIT_FUNC
149
 
150
        mov  #0x0200, &TACTL
151
        mov  #0x0004, &TACCR0
152
        mov  #0x02D6, &TACTL 	; # /8
153
        mov  #0x0004, &0x0200
154
        mov  #0x0010, r14
155
        call #WAIT_FUNC
156
 
157
        dint
158
        mov  #0x0000, &0x0200
159
        mov  #0x2000, r15
160
 
161
 
162
       /* --------------   TIMER A TEST:  UP MODE   ----------------- */
163
 
164
        mov  #0x0200, &TACTL
165
        mov  #0x0000, &TACCTL0
166
        eint
167
 
168
        mov  #0x0200, &TACTL
169
        mov  #0x0000, &TACCTL0
170
        mov  #0x0012, &TACCR0   ; # Check timing for period = 0x12 +1
171
        mov  #0x0256, &TACTL
172
        mov  #0x0001, &0x0200
173
        mov  #0x0010, r14
174
        call #WAIT_FUNC
175
 
176
        mov  #0x0200, &TACTL
177
        mov  #0x0000, &TACCTL0
178
        mov  #0x001E, &TACCR0   ; # Check timing for period = 0x1E +1
179
        mov  #0x0256, &TACTL
180
        mov  #0x0002, &0x0200
181
        mov  #0x0020, r14
182
        call #WAIT_FUNC
183
 
184
        mov  #0x0200, &TACTL
185
        mov  #0x0000, &TACCTL0
186
        mov  #0x0012, &TACCR0   ; # Check timing for period = 0x12 +1
187
        mov  #0x0254, &TACTL
188
        mov  #0x0010, &TACCTL0
189
        mov  #0x0003, &0x0200
190
        mov  #0x0010, r14
191
        call #WAIT_FUNC
192
 
193
        mov  #0x0200, &TACTL
194
        mov  #0x0000, &TACCTL0
195
        mov  #0x001E, &TACCR0   ; # Check timing for period = 0x1E +1
196
        mov  #0x0254, &TACTL
197
        mov  #0x0010, &TACCTL0
198
        mov  #0x0004, &0x0200
199
        mov  #0x0020, r14
200
        call #WAIT_FUNC
201
 
202
        dint
203
        mov  #0x0000, &0x0200
204
        mov  #0x3000, r15
205
 
206
 
207
       /* --------------   TIMER A TEST:  CONTINUOUS MODES   ----------------- */
208
 
209
        mov  #0x0200, &TACTL
210
        mov  #0x0000, &TACCTL0
211
        eint
212
 
213
        mov  #0x0200, &TACTL
214
        mov  #0x0000, &TACCTL0
215
        mov  #0xfff0, &TAR      ; # Continuous mode
216
        mov  #0x0262, &TACTL
217
        mov  #0x0001, &0x0200
218
        mov  #0x0020, r14
219
        call #WAIT_FUNC
220
 
221
        dint
222
        mov  #0x0000, &0x0200
223
        mov  #0x4000, r15
224
 
225
 
226
       /* --------------   TIMER A TEST:  UP-DOWN MODE   ----------------- */
227
 
228
        mov  #0x0200, &TACTL
229
        mov  #0x0000, &TACCTL0
230
        eint
231
 
232
        mov  #0x0200, &TACTL
233
        mov  #0x0000, &TACCTL0
234
        mov  #0x0031, &TACCR0   ; # Up-Down mode - timing 1
235
        mov  #0x0000, &TAR
236
        mov  #0x0236, &TACTL
237
        mov  #0x0010, &TACCTL0
238
        mov  #0x0001, &0x0200
239
        mov  #0x0050, r14
240
        call #WAIT_FUNC
241
        mov  #0x0002, &0x0200
242
 
243
 
244
        dint
245
        mov  #0x0200, &TACTL
246
        mov  #0x0000, &TACCTL0
247
        mov  #0x0000, &0x0200
248
        mov  #0x5000, r15
249
 
250
 
251
 
252
        /* ----------------------         END OF TEST        --------------- */
253
end_of_test:
254
        nop
255
        br #0xffff
256
 
257
 
258
        /* ----------------------      INTERRUPT ROUTINES    --------------- */
259
 
260
TIMERA_CCR0_VECTOR:
261
        mov     &TAR, &0x0204
262
        reti
263
 
264
 
265
TIMERA_TAIV_VECTOR:
266
        mov     &TAR, &0x0202
267
        bic  #0x0001, &TACTL
268
        reti
269
 
270
 
271
        /* ----------------------         INTERRUPT VECTORS  --------------- */
272
 
273
.section .vectors, "a"
274
.word end_of_test        ; Interrupt  0 (lowest priority)    
275
.word end_of_test        ; Interrupt  1                      
276
.word end_of_test        ; Interrupt  2                      
277
.word end_of_test        ; Interrupt  3                      
278
.word end_of_test        ; Interrupt  4                      
279
.word end_of_test        ; Interrupt  5                      
280
.word end_of_test        ; Interrupt  6                      
281
.word end_of_test        ; Interrupt  7                      
282
.word TIMERA_TAIV_VECTOR ; Interrupt  8                      
283
.word TIMERA_CCR0_VECTOR ; Interrupt  9                      
284
.word end_of_test        ; Interrupt 10                      Watchdog timer
285
.word end_of_test        ; Interrupt 11                      
286
.word end_of_test        ; Interrupt 12                      
287
.word end_of_test        ; Interrupt 13                      
288
.word end_of_test        ; Interrupt 14                      NMI
289
.word main               ; Interrupt 15 (highest priority)   RESET

powered by: WebSVN 2.1.0

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