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 101

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