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 18

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