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

Subversion Repositories openmsp430

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

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 output unit.                     */
28 18 olivier.gi
/*                                                                           */
29
/* Author(s):                                                                */
30
/*             - Olivier Girard,    olgirard@gmail.com                       */
31
/*                                                                           */
32
/*---------------------------------------------------------------------------*/
33 19 olivier.gi
/* $Rev: 19 $                                                                */
34
/* $LastChangedBy: olivier.girard $                                          */
35
/* $LastChangedDate: 2009-08-04 23:47:15 +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
 
60
 
61
       /* --------------   TIMER A TEST:  COMPARATOR 0   ----------------- */
62
 
63
        mov  #0x0200, &TACTL
64
        mov  #0x0000, &TACCTL0
65
        mov  #0x0000, &TACCTL1
66
        mov  #0x0000, &TACCTL2
67
        dint
68
 
69
                                ; # --------- Output       (mode 0) ----------
70
        mov  #0x0204, &TACTL
71
        mov  #0x0000, &TACCR0
72
        mov  #0x0000, &TACCTL0
73
        mov  #0x0200, &TACTL
74
        mov  #0x0004, &TACCTL0  ; # Set to 1
75
        mov  #0x0001, &0x0200
76
        mov  #0x0000, &TACCTL0  ; # Set to 0
77
        mov  #0x0002, &0x0200
78
 
79
                                ; # --------- Set          (mode 1) ----------
80
        mov  #0x0204, &TACTL
81
        mov  #0x0015, &TACCR0   ; # Period = (0x15+1)*2
82
        mov  #0x0020, &TACCTL0  ; # Compare mode, set mode
83
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
84
        mov  #0x0003, &0x0200
85
        mov  #0x0020, r14
86
        call #WAIT_FUNC
87
        mov  #0x0204, &TACTL
88
        mov  #0x0004, &0x0200
89
 
90
                                ; # --------- Toggle       (mode 4) ----------
91
        mov  #0x0204, &TACTL
92
        mov  #0x0015, &TACCR0   ; # Period = (0x15+1)*2
93
        mov  #0x0080, &TACCTL0  ; # Compare mode, Toggle mode
94
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
95
        mov  #0x0005, &0x0200
96
        mov  #0x0020, r14
97
        call #WAIT_FUNC
98
 
99
                                ; # --------- Reset        (mode 5) ----------
100
        mov  #0x0204, &TACTL
101
        mov  #0x0015, &TACCR0   ; # Period = (0x15+1)*2
102
        mov  #0x0004, &TACCTL0  ; # Compare mode, Output mode (initialize to 1)
103
        mov  #0x00A0, &TACCTL0  ; # Compare mode, Reset mode
104
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
105
        mov  #0x0006, &0x0200
106
        mov  #0x0020, r14
107
        call #WAIT_FUNC
108
 
109
 
110
        dint
111
        mov  #0x0000, &0x0200
112
        mov  #0x1000, r15
113
 
114
 
115
       /* --------------   TIMER A TEST:  COMPARATOR 1   ----------------- */
116
 
117
        mov  #0x0200, &TACTL
118
        mov  #0x0000, &TACCTL0
119
        mov  #0x0000, &TACCTL1
120
        mov  #0x0000, &TACCTL2
121
        dint
122
 
123
                                ; # --------- Output       (mode 0) ----------
124
        mov  #0x0000, &TACCTL1
125
        mov  #0x0204, &TACTL
126
        mov  #0x0000, &TACCR0
127
        mov  #0x0000, &TACCTL0
128
        mov  #0x0200, &TACTL
129
        mov  #0x0004, &TACCTL1  ; # Set to 1
130
        mov  #0x0001, &0x0200
131
        mov  #0x0000, &TACCTL1  ; # Set to 0
132
        mov  #0x0002, &0x0200
133
 
134
                                ; # --------- Set          (mode 1) ----------
135
        mov  #0x0000, &TACCTL1
136
        mov  #0x0204, &TACTL
137
        mov  #0x0020, &TACCR0
138
        mov  #0x0000, &TACCTL0
139
        mov  #0x0015, &TACCR1
140
        mov  #0x0020, &TACCTL1  ; # Compare mode, set mode
141
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
142
        mov  #0x0003, &0x0200
143
        mov  #0x0030, r14
144
        call #WAIT_FUNC
145
        mov  #0x0204, &TACTL
146
        mov  #0x0004, &0x0200
147
 
148
                                ; # --------- Toggle/Reset (mode 2) ----------
149
        mov  #0x0000, &TACCTL1
150
        mov  #0x0204, &TACTL
151
        mov  #0x0020, &TACCR0
152
        mov  #0x0000, &TACCTL0
153
        mov  #0x0015, &TACCR1
154
        mov  #0x0040, &TACCTL1  ; # Compare mode, toggle/reset mode
155
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
156
        mov  #0x0005, &0x0200
157
        mov  #0x0020, r14
158
        call #WAIT_FUNC
159
        mov  #0x0204, &TACTL
160
        mov  #0x0020, &TACCR0
161
        mov  #0x0000, &TACCTL0
162
        mov  #0x0015, &TACCR1
163
        mov  #0x0004, &TACCTL1  ; # Init to 1
164
        mov  #0x0040, &TACCTL1  ; # Compare mode, toggle/reset mode
165
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
166
        mov  #0x0006, &0x0200
167
        mov  #0x0020, r14
168
        call #WAIT_FUNC
169
 
170
                                ; # --------- Set/Reset    (mode 3) ----------
171
        mov  #0x0000, &TACCTL1
172
        mov  #0x0204, &TACTL
173
        mov  #0x0020, &TACCR0
174
        mov  #0x0000, &TACCTL0
175
        mov  #0x0015, &TACCR1
176
        mov  #0x0060, &TACCTL1  ; # Compare mode, set/reset mode
177
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
178
        mov  #0x0007, &0x0200
179
        mov  #0x0020, r14
180
        call #WAIT_FUNC
181
        mov  #0x0000, &TACCTL1
182
        mov  #0x0204, &TACTL
183
        mov  #0x0020, &TACCR0
184
        mov  #0x0000, &TACCTL0
185
        mov  #0x0015, &TACCR1
186
        mov  #0x0004, &TACCTL1  ; # Init to 1
187
        mov  #0x0060, &TACCTL1  ; # Compare mode, set/reset mode
188
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
189
        mov  #0x0008, &0x0200
190
        mov  #0x0020, r14
191
        call #WAIT_FUNC
192
 
193
                                ; # --------- Toggle       (mode 4) ----------
194
        mov  #0x0000, &TACCTL1
195
        mov  #0x0204, &TACTL
196
        mov  #0x0020, &TACCR0
197
        mov  #0x0000, &TACCTL0
198
        mov  #0x0015, &TACCR1   ; # Period = (0x15+1)*2
199
        mov  #0x0080, &TACCTL1  ; # Compare mode, Toggle mode
200
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
201
        mov  #0x0009, &0x0200
202
        mov  #0x0030, r14
203
        call #WAIT_FUNC
204
 
205
                                ; # --------- Reset        (mode 5) ----------
206
        mov  #0x0000, &TACCTL1
207
        mov  #0x0204, &TACTL
208
        mov  #0x0020, &TACCR0
209
        mov  #0x0000, &TACCTL0
210
        mov  #0x0015, &TACCR1   ; # Period = (0x15+1)*2
211
        mov  #0x0004, &TACCTL1  ; # Compare mode, Output mode (initialize to 1)
212
        mov  #0x00A0, &TACCTL1  ; # Compare mode, Reset mode
213
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
214
        mov  #0x000A, &0x0200
215
        mov  #0x0030, r14
216
        call #WAIT_FUNC
217
 
218
                                ; # --------- Toggle/Set   (mode 6) ----------
219
        mov  #0x0000, &TACCTL1
220
        mov  #0x0204, &TACTL
221
        mov  #0x0020, &TACCR0
222
        mov  #0x0000, &TACCTL0
223
        mov  #0x0015, &TACCR1
224
        mov  #0x00C0, &TACCTL1  ; # Compare mode, toggle/set mode
225
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
226
        mov  #0x000B, &0x0200
227
        mov  #0x0020, r14
228
        call #WAIT_FUNC
229
        mov  #0x0204, &TACTL
230
        mov  #0x0020, &TACCR0
231
        mov  #0x0000, &TACCTL0
232
        mov  #0x0015, &TACCR1
233
        mov  #0x0004, &TACCTL1  ; # Init to 1
234
        mov  #0x00C0, &TACCTL1  ; # Compare mode, toggle/set mode
235
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
236
        mov  #0x000C, &0x0200
237
        mov  #0x0020, r14
238
        call #WAIT_FUNC
239
 
240
                                ; # --------- Reset/Set    (mode 7) ----------
241
        mov  #0x0000, &TACCTL1
242
        mov  #0x0204, &TACTL
243
        mov  #0x0020, &TACCR0
244
        mov  #0x0000, &TACCTL0
245
        mov  #0x0015, &TACCR1
246
        mov  #0x00E0, &TACCTL1  ; # Compare mode, reset/set mode
247
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
248
        mov  #0x000D, &0x0200
249
        mov  #0x0020, r14
250
        call #WAIT_FUNC
251
        mov  #0x0000, &TACCTL1
252
        mov  #0x0204, &TACTL
253
        mov  #0x0020, &TACCR0
254
        mov  #0x0000, &TACCTL0
255
        mov  #0x0015, &TACCR1
256
        mov  #0x0004, &TACCTL1  ; # Init to 1
257
        mov  #0x00E0, &TACCTL1  ; # Compare mode, reset/set mode
258
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
259
        mov  #0x000E, &0x0200
260
        mov  #0x0020, r14
261
        call #WAIT_FUNC
262
 
263
        dint
264
        mov  #0x0000, &0x0200
265
        mov  #0x2000, r15
266
 
267
 
268
       /* --------------   TIMER A TEST:  COMPARATOR 2   ----------------- */
269
 
270
        mov  #0x0200, &TACTL
271
        mov  #0x0000, &TACCTL0
272
        mov  #0x0000, &TACCTL1
273
        mov  #0x0000, &TACCTL2
274
        dint
275
 
276
                                ; # --------- Output       (mode 0) ----------
277
        mov  #0x0000, &TACCTL2
278
        mov  #0x0204, &TACTL
279
        mov  #0x0000, &TACCR0
280
        mov  #0x0000, &TACCTL0
281
        mov  #0x0200, &TACTL
282
        mov  #0x0004, &TACCTL2  ; # Set to 1
283
        mov  #0x0001, &0x0200
284
        mov  #0x0000, &TACCTL2  ; # Set to 0
285
        mov  #0x0002, &0x0200
286
 
287
                                ; # --------- Set          (mode 1) ----------
288
        mov  #0x0000, &TACCTL2
289
        mov  #0x0204, &TACTL
290
        mov  #0x0020, &TACCR0
291
        mov  #0x0000, &TACCTL0
292
        mov  #0x0015, &TACCR2
293
        mov  #0x0020, &TACCTL2  ; # Compare mode, set mode
294
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
295
        mov  #0x0003, &0x0200
296
        mov  #0x0030, r14
297
        call #WAIT_FUNC
298
        mov  #0x0204, &TACTL
299
        mov  #0x0004, &0x0200
300
 
301
                                ; # --------- Toggle/Reset (mode 2) ----------
302
        mov  #0x0000, &TACCTL2
303
        mov  #0x0204, &TACTL
304
        mov  #0x0020, &TACCR0
305
        mov  #0x0000, &TACCTL0
306
        mov  #0x0015, &TACCR2
307
        mov  #0x0040, &TACCTL2  ; # Compare mode, toggle/reset mode
308
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
309
        mov  #0x0005, &0x0200
310
        mov  #0x0020, r14
311
        call #WAIT_FUNC
312
        mov  #0x0204, &TACTL
313
        mov  #0x0020, &TACCR0
314
        mov  #0x0000, &TACCTL0
315
        mov  #0x0015, &TACCR2
316
        mov  #0x0004, &TACCTL2  ; # Init to 1
317
        mov  #0x0040, &TACCTL2  ; # Compare mode, toggle/reset mode
318
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
319
        mov  #0x0006, &0x0200
320
        mov  #0x0020, r14
321
        call #WAIT_FUNC
322
 
323
                                ; # --------- Set/Reset    (mode 3) ----------
324
        mov  #0x0000, &TACCTL2
325
        mov  #0x0204, &TACTL
326
        mov  #0x0020, &TACCR0
327
        mov  #0x0000, &TACCTL0
328
        mov  #0x0015, &TACCR2
329
        mov  #0x0060, &TACCTL2  ; # Compare mode, set/reset mode
330
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
331
        mov  #0x0007, &0x0200
332
        mov  #0x0020, r14
333
        call #WAIT_FUNC
334
        mov  #0x0000, &TACCTL2
335
        mov  #0x0204, &TACTL
336
        mov  #0x0020, &TACCR0
337
        mov  #0x0000, &TACCTL0
338
        mov  #0x0015, &TACCR2
339
        mov  #0x0004, &TACCTL2  ; # Init to 1
340
        mov  #0x0060, &TACCTL2  ; # Compare mode, set/reset mode
341
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
342
        mov  #0x0008, &0x0200
343
        mov  #0x0020, r14
344
        call #WAIT_FUNC
345
 
346
                                ; # --------- Toggle       (mode 4) ----------
347
        mov  #0x0000, &TACCTL2
348
        mov  #0x0204, &TACTL
349
        mov  #0x0020, &TACCR0
350
        mov  #0x0000, &TACCTL0
351
        mov  #0x0015, &TACCR2   ; # Period = (0x15+1)*2
352
        mov  #0x0080, &TACCTL2  ; # Compare mode, Toggle mode
353
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
354
        mov  #0x0009, &0x0200
355
        mov  #0x0030, r14
356
        call #WAIT_FUNC
357
 
358
                                ; # --------- Reset        (mode 5) ----------
359
        mov  #0x0000, &TACCTL2
360
        mov  #0x0204, &TACTL
361
        mov  #0x0020, &TACCR0
362
        mov  #0x0000, &TACCTL0
363
        mov  #0x0015, &TACCR2   ; # Period = (0x15+1)*2
364
        mov  #0x0004, &TACCTL2  ; # Compare mode, Output mode (initialize to 1)
365
        mov  #0x00A0, &TACCTL2  ; # Compare mode, Reset mode
366
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
367
        mov  #0x000A, &0x0200
368
        mov  #0x0030, r14
369
        call #WAIT_FUNC
370
 
371
                                ; # --------- Toggle/Set   (mode 6) ----------
372
        mov  #0x0000, &TACCTL2
373
        mov  #0x0204, &TACTL
374
        mov  #0x0020, &TACCR0
375
        mov  #0x0000, &TACCTL0
376
        mov  #0x0015, &TACCR2
377
        mov  #0x00C0, &TACCTL2  ; # Compare mode, toggle/set mode
378
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
379
        mov  #0x000B, &0x0200
380
        mov  #0x0020, r14
381
        call #WAIT_FUNC
382
        mov  #0x0204, &TACTL
383
        mov  #0x0020, &TACCR0
384
        mov  #0x0000, &TACCTL0
385
        mov  #0x0015, &TACCR2
386
        mov  #0x0004, &TACCTL2  ; # Init to 1
387
        mov  #0x00C0, &TACCTL2  ; # Compare mode, toggle/set mode
388
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
389
        mov  #0x000C, &0x0200
390
        mov  #0x0020, r14
391
        call #WAIT_FUNC
392
 
393
                                ; # --------- Reset/Set    (mode 7) ----------
394
        mov  #0x0000, &TACCTL2
395
        mov  #0x0204, &TACTL
396
        mov  #0x0020, &TACCR0
397
        mov  #0x0000, &TACCTL0
398
        mov  #0x0015, &TACCR2
399
        mov  #0x00E0, &TACCTL2  ; # Compare mode, reset/set mode
400
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
401
        mov  #0x000D, &0x0200
402
        mov  #0x0020, r14
403
        call #WAIT_FUNC
404
        mov  #0x0000, &TACCTL2
405
        mov  #0x0204, &TACTL
406
        mov  #0x0020, &TACCR0
407
        mov  #0x0000, &TACCTL0
408
        mov  #0x0015, &TACCR2
409
        mov  #0x0004, &TACCTL2  ; # Init to 1
410
        mov  #0x00E0, &TACCTL2  ; # Compare mode, reset/set mode
411
        mov  #0x0254, &TACTL    ; # Up-mode & clk/2
412
        mov  #0x000E, &0x0200
413
        mov  #0x0020, r14
414
        call #WAIT_FUNC
415
 
416
        dint
417
        mov  #0x0000, &0x0200
418
        mov  #0x3000, r15
419
 
420
 
421
        /* ----------------------         END OF TEST        --------------- */
422
end_of_test:
423
        nop
424
        br #0xffff
425
 
426
 
427
        /* ----------------------      INTERRUPT ROUTINES    --------------- */
428
 
429
TIMERA_CCR0_VECTOR:
430
        mov     &TAR, &0x0202
431
        reti
432
 
433
 
434
TIMERA_TAIV_VECTOR:
435
        mov     &TAR, &0x0204
436
        mov    &TAIV, &0x0206
437
        reti
438
 
439
 
440
        /* ----------------------         INTERRUPT VECTORS  --------------- */
441
 
442
.section .vectors, "a"
443
.word end_of_test        ; Interrupt  0 (lowest priority)    
444
.word end_of_test        ; Interrupt  1                      
445
.word end_of_test        ; Interrupt  2                      
446
.word end_of_test        ; Interrupt  3                      
447
.word end_of_test        ; Interrupt  4                      
448
.word end_of_test        ; Interrupt  5                      
449
.word end_of_test        ; Interrupt  6                      
450
.word end_of_test        ; Interrupt  7                      
451
.word TIMERA_TAIV_VECTOR ; Interrupt  8                      
452
.word TIMERA_CCR0_VECTOR ; Interrupt  9                      
453
.word end_of_test        ; Interrupt 10                      Watchdog timer
454
.word end_of_test        ; Interrupt 11                      
455
.word end_of_test        ; Interrupt 12                      
456
.word end_of_test        ; Interrupt 13                      
457
.word end_of_test        ; Interrupt 14                      NMI
458
.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.