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 111

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