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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [tA_capture.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 the timer capture unit.                    */
28
/*===========================================================================*/
29
 
30
.global main
31
 
32
.set   TACTL,   0x0160
33
.set   TAR,     0x0170
34
.set   TACCTL0, 0x0162
35
.set   TACCR0,  0x0172
36
.set   TACCTL1, 0x0164
37
.set   TACCR1,  0x0174
38
.set   TACCTL2, 0x0166
39
.set   TACCR2,  0x0176
40
.set   TAIV,    0x012E
41
 
42
 
43
WAIT_FUNC:
44
        dec r14
45
        jnz WAIT_FUNC
46
        ret
47
 
48
main:
49
        mov  #0x0250, r1        ; # Initialize stack pointer
50
        mov  #0x0000, &0x0200
51
        mov  #0x0000, r15
52
 
53
       /* --------------   TIMER A TEST:  INPUT MUX (CCI) ----------------- */
54
 
55
        mov  #0x0200, &TACTL
56
        mov  #0x0000, &TACCTL0
57
        mov  #0x0000, &TACCTL1
58
        mov  #0x0000, &TACCTL2
59
        dint
60
 
61
                                ; # --------- Comparator 0 ----------
62
        mov  #0x0204, &TACTL
63
        mov  #0x0000, &TACCR0
64
        mov  #0x0000, &TACCTL0  ; # CCIxA
65
        mov  #0x0001, &0x0200
66
        mov &TACCTL0, &0x0202
67
        mov  #0x0002, &0x0200
68
        mov &TACCTL0, &0x0204
69
        mov  #0x0003, &0x0200
70
 
71
        mov  #0x1000, &TACCTL0  ; # CCIxB
72
        mov  #0x0004, &0x0200
73
        mov &TACCTL0, &0x0202
74
        mov  #0x0005, &0x0200
75
        mov &TACCTL0, &0x0204
76
        mov  #0x0006, &0x0200
77
 
78
        mov  #0x2000, &TACCTL0  ; # GND
79
        mov  #0x0007, &0x0200
80
        mov &TACCTL0, &0x0202
81
        mov  #0x0008, &0x0200
82
        mov &TACCTL0, &0x0204
83
        mov  #0x0009, &0x0200
84
 
85
        mov  #0x3000, &TACCTL0  ; # VDD
86
        mov  #0x000A, &0x0200
87
        mov &TACCTL0, &0x0202
88
        mov  #0x000B, &0x0200
89
        mov &TACCTL0, &0x0204
90
        mov  #0x000C, &0x0200
91
 
92
                                ; # --------- Comparator 1 ----------
93
        mov  #0x0204, &TACTL
94
        mov  #0x0000, &TACCR1
95
        mov  #0x0000, &TACCTL1  ; # CCIxA
96
        mov  #0x0011, &0x0200
97
        mov &TACCTL1, &0x0202
98
        mov  #0x0012, &0x0200
99
        mov &TACCTL1, &0x0204
100
        mov  #0x0013, &0x0200
101
 
102
        mov  #0x1000, &TACCTL1  ; # CCIxB
103
        mov  #0x0014, &0x0200
104
        mov &TACCTL1, &0x0202
105
        mov  #0x0015, &0x0200
106
        mov &TACCTL1, &0x0204
107
        mov  #0x0016, &0x0200
108
 
109
        mov  #0x2000, &TACCTL1  ; # GND
110
        mov  #0x0017, &0x0200
111
        mov &TACCTL1, &0x0202
112
        mov  #0x0018, &0x0200
113
        mov &TACCTL1, &0x0204
114
        mov  #0x0019, &0x0200
115
 
116
        mov  #0x3000, &TACCTL1  ; # VDD
117
        mov  #0x001A, &0x0200
118
        mov &TACCTL1, &0x0202
119
        mov  #0x001B, &0x0200
120
        mov &TACCTL1, &0x0204
121
        mov  #0x001C, &0x0200
122
 
123
                                ; # --------- Comparator 2 ----------
124
        mov  #0x0204, &TACTL
125
        mov  #0x0000, &TACCR2
126
        mov  #0x0000, &TACCTL2  ; # CCIxA
127
        mov  #0x0021, &0x0200
128
        mov &TACCTL2, &0x0202
129
        mov  #0x0022, &0x0200
130
        mov &TACCTL2, &0x0204
131
        mov  #0x0023, &0x0200
132
 
133
        mov  #0x1000, &TACCTL2  ; # CCIxB
134
        mov  #0x0024, &0x0200
135
        mov &TACCTL2, &0x0202
136
        mov  #0x0025, &0x0200
137
        mov &TACCTL2, &0x0204
138
        mov  #0x0026, &0x0200
139
 
140
        mov  #0x2000, &TACCTL2  ; # GND
141
        mov  #0x0027, &0x0200
142
        mov &TACCTL2, &0x0202
143
        mov  #0x0028, &0x0200
144
        mov &TACCTL2, &0x0204
145
        mov  #0x0029, &0x0200
146
 
147
        mov  #0x3000, &TACCTL2  ; # VDD
148
        mov  #0x002A, &0x0200
149
        mov &TACCTL2, &0x0202
150
        mov  #0x002B, &0x0200
151
        mov &TACCTL2, &0x0204
152
        mov  #0x002C, &0x0200
153
 
154
 
155
        dint
156
        mov  #0x0000, &0x0200
157
        mov  #0x1000, r15
158
 
159
       /* --------------   TIMER A TEST:  CAPTURE, EDGE SELECTION AND INTERRUPT ----------------- */
160
 
161
        mov  #0x0200, &TACTL
162
        mov  #0x0000, &TACCTL0
163
        mov  #0x0000, &TACCTL1
164
        mov  #0x0000, &TACCTL2
165
        dint
166
 
167
                                ; # --------- Comparator 0 ----------
168
        mov  #0x0204, &TACTL
169
        mov  #0x1234, &TAR
170
        mov  #0x0110, &TACCTL0  ; # No capture, Interrupt enable
171
        mov  #0x0000, &TACCR0
172
        mov  #0x0001, &0x0200
173
        nop
174
        nop
175
        mov  &TACCR0, &0x0202
176
        mov  #0x0110, &TACCTL0  ; # No capture, Interrupt enable
177
        mov  #0x0000, &TACCR0
178
        mov  #0x0002, &0x0200
179
        nop
180
        nop
181
        mov  &TACCR0, &0x0204
182
        mov  #0x0000, &TACCTL0
183
        mov  #0x0003, &0x0200
184
 
185
        mov  #0x0204, &TACTL
186
        mov  #0x1234, &TAR
187
        mov  #0x4110, &TACCTL0  ; # Rising edge, Interrupt enable
188
        mov  #0x0000, &TACCR0
189
        mov  #0x0004, &0x0200
190
        nop
191
        nop
192
        mov  &TACCR0, &0x0202
193
        mov  #0x4110, &TACCTL0  ; # Rising edge, Interrupt enable
194
        mov  #0x0000, &TACCR0
195
        mov  #0x0005, &0x0200
196
        nop
197
        nop
198
        mov  &TACCR0, &0x0204
199
        mov  #0x0000, &TACCTL0
200
        mov  #0x0006, &0x0200
201
 
202
        mov  #0x0204, &TACTL
203
        mov  #0x1234, &TAR
204
        mov  #0x8110, &TACCTL0  ; # Falling edge, Interrupt enable
205
        mov  #0x0000, &TACCR0
206
        mov  #0x0007, &0x0200
207
        nop
208
        nop
209
        mov  &TACCR0, &0x0202
210
        mov  #0x8110, &TACCTL0  ; # Falling edge, Interrupt enable
211
        mov  #0x0000, &TACCR0
212
        mov  #0x0008, &0x0200
213
        nop
214
        nop
215
        mov  &TACCR0, &0x0204
216
        mov  #0x0000, &TACCTL0
217
        mov  #0x0009, &0x0200
218
 
219
        mov  #0x0204, &TACTL
220
        mov  #0x1234, &TAR
221
        mov  #0xC110, &TACCTL0  ; # Rising/Falling edge, Interrupt enable
222
        mov  #0x0000, &TACCR0
223
        mov  #0x000A, &0x0200
224
        nop
225
        nop
226
        mov  &TACCR0, &0x0202
227
        mov  #0xC110, &TACCTL0  ; # Rising/Falling edge, Interrupt enable
228
        mov  #0x0000, &TACCR0
229
        mov  #0x000B, &0x0200
230
        nop
231
        nop
232
        mov  &TACCR0, &0x0204
233
        mov  #0x0000, &TACCTL0
234
        mov  #0x000C, &0x0200
235
 
236
 
237
                                ; # --------- Comparator 1 ----------
238
        mov  #0x0204, &TACTL
239
        mov  #0x1234, &TAR
240
        mov  #0x0110, &TACCTL1  ; # No capture, Interrupt enable
241
        mov  #0x0000, &TACCR1
242
        mov  #0x0001, &0x0200
243
        nop
244
        nop
245
        mov  &TACCR1, &0x0202
246
        mov  #0x0110, &TACCTL1  ; # No capture, Interrupt enable
247
        mov  #0x0000, &TACCR1
248
        mov  #0x0002, &0x0200
249
        nop
250
        nop
251
        mov  &TACCR1, &0x0204
252
        mov  #0x0000, &TACCTL1
253
        mov  #0x0003, &0x0200
254
 
255
        mov  #0x0204, &TACTL
256
        mov  #0x1234, &TAR
257
        mov  #0x4110, &TACCTL1  ; # Rising edge, Interrupt enable
258
        mov  #0x0000, &TACCR1
259
        mov  #0x0004, &0x0200
260
        nop
261
        nop
262
        mov  &TACCR1, &0x0202
263
        mov  #0x4110, &TACCTL1  ; # Rising edge, Interrupt enable
264
        mov  #0x0000, &TACCR1
265
        mov  #0x0005, &0x0200
266
        nop
267
        nop
268
        mov  &TACCR1, &0x0204
269
        mov  #0x0000, &TACCTL1
270
        mov  #0x0006, &0x0200
271
 
272
        mov  #0x0204, &TACTL
273
        mov  #0x1234, &TAR
274
        mov  #0x8110, &TACCTL1  ; # Falling edge, Interrupt enable
275
        mov  #0x0000, &TACCR1
276
        mov  #0x0007, &0x0200
277
        nop
278
        nop
279
        mov  &TACCR1, &0x0202
280
        mov  #0x8110, &TACCTL1  ; # Falling edge, Interrupt enable
281
        mov  #0x0000, &TACCR1
282
        mov  #0x0008, &0x0200
283
        nop
284
        nop
285
        mov  &TACCR1, &0x0204
286
        mov  #0x0000, &TACCTL1
287
        mov  #0x0009, &0x0200
288
 
289
        mov  #0x0204, &TACTL
290
        mov  #0x1234, &TAR
291
        mov  #0xC110, &TACCTL1  ; # Rising/Falling edge, Interrupt enable
292
        mov  #0x0000, &TACCR1
293
        mov  #0x000A, &0x0200
294
        nop
295
        nop
296
        mov  &TACCR1, &0x0202
297
        mov  #0xC110, &TACCTL1  ; # Rising/Falling edge, Interrupt enable
298
        mov  #0x0000, &TACCR1
299
        mov  #0x000B, &0x0200
300
        nop
301
        nop
302
        mov  &TACCR1, &0x0204
303
        mov  #0x0000, &TACCTL1
304
        mov  #0x000C, &0x0200
305
 
306
 
307
                                ; # --------- Comparator 2 ----------
308
        mov  #0x0204, &TACTL
309
        mov  #0x1234, &TAR
310
        mov  #0x0110, &TACCTL2  ; # No capture, Interrupt enable
311
        mov  #0x0000, &TACCR2
312
        mov  #0x0001, &0x0200
313
        nop
314
        nop
315
        mov  &TACCR2, &0x0202
316
        mov  #0x0110, &TACCTL2  ; # No capture, Interrupt enable
317
        mov  #0x0000, &TACCR2
318
        mov  #0x0002, &0x0200
319
        nop
320
        nop
321
        mov  &TACCR2, &0x0204
322
        mov  #0x0000, &TACCTL2
323
        mov  #0x0003, &0x0200
324
 
325
        mov  #0x0204, &TACTL
326
        mov  #0x1234, &TAR
327
        mov  #0x4110, &TACCTL2  ; # Rising edge, Interrupt enable
328
        mov  #0x0000, &TACCR2
329
        mov  #0x0004, &0x0200
330
        nop
331
        nop
332
        mov  &TACCR2, &0x0202
333
        mov  #0x4110, &TACCTL2  ; # Rising edge, Interrupt enable
334
        mov  #0x0000, &TACCR2
335
        mov  #0x0005, &0x0200
336
        nop
337
        nop
338
        mov  &TACCR2, &0x0204
339
        mov  #0x0000, &TACCTL2
340
        mov  #0x0006, &0x0200
341
 
342
        mov  #0x0204, &TACTL
343
        mov  #0x1234, &TAR
344
        mov  #0x8110, &TACCTL2  ; # Falling edge, Interrupt enable
345
        mov  #0x0000, &TACCR2
346
        mov  #0x0007, &0x0200
347
        nop
348
        nop
349
        mov  &TACCR2, &0x0202
350
        mov  #0x8110, &TACCTL2  ; # Falling edge, Interrupt enable
351
        mov  #0x0000, &TACCR2
352
        mov  #0x0008, &0x0200
353
        nop
354
        nop
355
        mov  &TACCR2, &0x0204
356
        mov  #0x0000, &TACCTL2
357
        mov  #0x0009, &0x0200
358
 
359
        mov  #0x0204, &TACTL
360
        mov  #0x1234, &TAR
361
        mov  #0xC110, &TACCTL2  ; # Rising/Falling edge, Interrupt enable
362
        mov  #0x0000, &TACCR2
363
        mov  #0x000A, &0x0200
364
        nop
365
        nop
366
        mov  &TACCR2, &0x0202
367
        mov  #0xC110, &TACCTL2  ; # Rising/Falling edge, Interrupt enable
368
        mov  #0x0000, &TACCR2
369
        mov  #0x000B, &0x0200
370
        nop
371
        nop
372
        mov  &TACCR2, &0x0204
373
        mov  #0x0000, &TACCTL2
374
        mov  #0x000C, &0x0200
375
 
376
 
377
        dint
378
        mov  #0x0000, &0x0200
379
        mov  #0x2000, r15
380
 
381
       /* --------------   TIMER A TEST:  CAPTURE OVERFLOW ----------------- */
382
 
383
        mov  #0x0200, &TACTL
384
        mov  #0x0000, &TACCTL0
385
        mov  #0x0000, &TACCTL1
386
        mov  #0x0000, &TACCTL2
387
        dint
388
 
389
                                ; # --------- Comparator 0 ----------
390
        mov  #0x0204, &TACTL
391
        mov  #0xC000, &TACCTL0  ; # Both edges:    No read -> overflow
392
        mov  #0x0001, &0x0200
393
        nop
394
        nop
395
        mov &TACCTL0, &0x0202
396
        mov  #0x0002, &0x0200
397
        nop
398
        nop
399
        mov &TACCTL0, &0x0204
400
        mov  #0x0000, &TACCTL0
401
        mov  #0x0003, &0x0200
402
 
403
        mov  #0x0204, &TACTL
404
        mov  #0xC000, &TACCTL0  ; # Both edges:    Read -> no overflow
405
        mov  #0x0004, &0x0200
406
        nop
407
        nop
408
        mov &TACCTL0, &0x0202
409
        mov  &TACCR0, r10       ; # Read
410
        mov  #0x0005, &0x0200
411
        nop
412
        nop
413
        mov &TACCTL0, &0x0204
414
        mov  #0x0000, &TACCTL0
415
        mov  #0x0006, &0x0200
416
 
417
                                ; # --------- Comparator 1 ----------
418
        mov  #0x0204, &TACTL
419
        mov  #0xC000, &TACCTL1  ; # Both edges:    No read -> overflow
420
        mov  #0x0001, &0x0200
421
        nop
422
        nop
423
        mov &TACCTL1, &0x0202
424
        mov  #0x0002, &0x0200
425
        nop
426
        nop
427
        mov &TACCTL1, &0x0204
428
        mov  #0x0000, &TACCTL1
429
        mov  #0x0003, &0x0200
430
 
431
        mov  #0x0204, &TACTL
432
        mov  #0xC000, &TACCTL1  ; # Both edges:    Read -> no overflow
433
        mov  #0x0004, &0x0200
434
        nop
435
        nop
436
        mov &TACCTL1, &0x0202
437
        mov  &TACCR1, r10       ; # Read
438
        mov  #0x0005, &0x0200
439
        nop
440
        nop
441
        mov &TACCTL1, &0x0204
442
        mov  #0x0000, &TACCTL1
443
        mov  #0x0006, &0x0200
444
 
445
                                ; # --------- Comparator 2 ----------
446
        mov  #0x0204, &TACTL
447
        mov  #0xC000, &TACCTL2  ; # Both edges:    No read -> overflow
448
        mov  #0x0001, &0x0200
449
        nop
450
        nop
451
        mov &TACCTL2, &0x0202
452
        mov  #0x0002, &0x0200
453
        nop
454
        nop
455
        mov &TACCTL2, &0x0204
456
        mov  #0x0000, &TACCTL2
457
        mov  #0x0003, &0x0200
458
 
459
        mov  #0x0204, &TACTL
460
        mov  #0xC000, &TACCTL2  ; # Both edges:    Read -> no overflow
461
        mov  #0x0004, &0x0200
462
        nop
463
        nop
464
        mov &TACCTL2, &0x0202
465
        mov  &TACCR2, r10       ; # Read
466
        mov  #0x0005, &0x0200
467
        nop
468
        nop
469
        mov &TACCTL2, &0x0204
470
        mov  #0x0000, &TACCTL2
471
        mov  #0x0006, &0x0200
472
 
473
        dint
474
        mov  #0x0000, &0x0200
475
        mov  #0x3000, r15
476
 
477
 
478
        /* ----------------------         END OF TEST        --------------- */
479
end_of_test:
480
        nop
481
        br #0xffff
482
 
483
 
484
        /* ----------------------      INTERRUPT ROUTINES    --------------- */
485
 
486
TIMERA_CCR0_VECTOR:
487
        inc  &0x0200
488
        reti
489
 
490
 
491
TIMERA_TAIV_VECTOR:
492
        mov     &TAR, &0x0204
493
        mov    &TAIV, &0x0206
494
        reti
495
 
496
 
497
        /* ----------------------         INTERRUPT VECTORS  --------------- */
498
 
499
.section .vectors, "a"
500
.word end_of_test        ; Interrupt  0 (lowest priority)    
501
.word end_of_test        ; Interrupt  1                      
502
.word end_of_test        ; Interrupt  2                      
503
.word end_of_test        ; Interrupt  3                      
504
.word end_of_test        ; Interrupt  4                      
505
.word end_of_test        ; Interrupt  5                      
506
.word end_of_test        ; Interrupt  6                      
507
.word end_of_test        ; Interrupt  7                      
508
.word TIMERA_TAIV_VECTOR ; Interrupt  8                      
509
.word TIMERA_CCR0_VECTOR ; Interrupt  9                      
510
.word end_of_test        ; Interrupt 10                      Watchdog timer
511
.word end_of_test        ; Interrupt 11                      
512
.word end_of_test        ; Interrupt 12                      
513
.word end_of_test        ; Interrupt 13                      
514
.word end_of_test        ; Interrupt 14                      NMI
515
.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.