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 141

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: 141 $                                                                */
36
/* $LastChangedBy: olivier.girard $                                          */
37
/* $LastChangedDate: 2012-05-05 23:22:06 +0200 (Sat, 05 May 2012) $          */
38 2 olivier.gi
/*===========================================================================*/
39
 
40 141 olivier.gi
.include "pmem_defs.asm"
41
 
42 2 olivier.gi
.global main
43
 
44
WAIT_FUNC:
45
        dec r14
46
        jnz WAIT_FUNC
47
        ret
48
 
49
main:
50 111 olivier.gi
        mov  #DMEM_250, r1      ; # Initialize stack pointer
51
        mov  #0x0000, &DMEM_200
52 2 olivier.gi
 
53
       /* --------------   TIMER A TEST:  RD/WR ACCESS    --------------- */
54
 
55
        mov  #0xaaaa, &TACTL	; # TACTL
56 111 olivier.gi
        mov   &TACTL, &DMEM_200
57 2 olivier.gi
        mov  #0x5555, &TACTL
58 111 olivier.gi
        mov   &TACTL, &DMEM_202
59 2 olivier.gi
        mov  #0x0000, &TACTL
60 111 olivier.gi
        mov   &TACTL, &DMEM_204
61 2 olivier.gi
        mov  #0x0000, &TACTL
62 111 olivier.gi
        mov   &TACTL, &DMEM_206
63 2 olivier.gi
 
64
        mov  #0xaaaa, &TAR	; # TAR
65 111 olivier.gi
        mov     &TAR, &DMEM_208
66 2 olivier.gi
        mov  #0x5555, &TAR
67 111 olivier.gi
        mov     &TAR, &DMEM_20A
68 2 olivier.gi
        mov  #0x0000, &TAR
69 111 olivier.gi
        mov     &TAR, &DMEM_20C
70 2 olivier.gi
 
71
        mov  #0xaaaa, &TACCTL0	; # TACCTL0
72 111 olivier.gi
        mov &TACCTL0, &DMEM_210
73 2 olivier.gi
        mov  #0x5555, &TACCTL0
74 111 olivier.gi
        mov &TACCTL0, &DMEM_212
75 2 olivier.gi
        mov  #0x0000, &TACCTL0
76 111 olivier.gi
        mov &TACCTL0, &DMEM_214
77 2 olivier.gi
 
78
        mov  #0xaaaa, &TACCR0	; # TACCR0
79 111 olivier.gi
        mov  &TACCR0, &DMEM_216
80 2 olivier.gi
        mov  #0x5555, &TACCR0
81 111 olivier.gi
        mov  &TACCR0, &DMEM_218
82 2 olivier.gi
        mov  #0x0000, &TACCR0
83 111 olivier.gi
        mov  &TACCR0, &DMEM_21A
84 2 olivier.gi
 
85
        mov  #0xaaaa, &TACCTL1	; # TACCTL1
86 111 olivier.gi
        mov &TACCTL1, &DMEM_220
87 2 olivier.gi
        mov  #0x5555, &TACCTL1
88 111 olivier.gi
        mov &TACCTL1, &DMEM_222
89 2 olivier.gi
        mov  #0x0000, &TACCTL1
90 111 olivier.gi
        mov &TACCTL1, &DMEM_224
91 2 olivier.gi
 
92
        mov  #0xaaaa, &TACCR1	; # TACCR1
93 111 olivier.gi
        mov  &TACCR1, &DMEM_226
94 2 olivier.gi
        mov  #0x5555, &TACCR1
95 111 olivier.gi
        mov  &TACCR1, &DMEM_228
96 2 olivier.gi
        mov  #0x0000, &TACCR1
97 111 olivier.gi
        mov  &TACCR1, &DMEM_22A
98 2 olivier.gi
 
99
        mov  #0xaaaa, &TACCTL2	; # TACCTL2
100 111 olivier.gi
        mov &TACCTL2, &DMEM_230
101 2 olivier.gi
        mov  #0x5555, &TACCTL2
102 111 olivier.gi
        mov &TACCTL2, &DMEM_232
103 2 olivier.gi
        mov  #0x0000, &TACCTL2
104 111 olivier.gi
        mov &TACCTL2, &DMEM_234
105 2 olivier.gi
 
106
        mov  #0xaaaa, &TACCR2	; # TACCR2
107 111 olivier.gi
        mov  &TACCR2, &DMEM_236
108 2 olivier.gi
        mov  #0x5555, &TACCR2
109 111 olivier.gi
        mov  &TACCR2, &DMEM_238
110 2 olivier.gi
        mov  #0x0000, &TACCR2
111 111 olivier.gi
        mov  &TACCR2, &DMEM_23A
112 2 olivier.gi
 
113
        mov  #0xaaaa, &TAIV	; # TAIV
114 111 olivier.gi
        mov    &TAIV, &DMEM_240
115 2 olivier.gi
        mov  #0x5555, &TAIV
116 111 olivier.gi
        mov    &TAIV, &DMEM_242
117 2 olivier.gi
        mov  #0x0000, &TAIV
118 111 olivier.gi
        mov    &TAIV, &DMEM_244
119 2 olivier.gi
 
120
        mov  #0x1000, r15
121
 
122
       /* --------------   TIMER A TEST:  INPUT DIVIDER   --------------- */
123
 
124
        mov  #0x0200, &TACTL
125
        mov  #0x0000, &TACCTL0
126
        eint
127
 
128
        mov  #0x0200, &TACTL
129
        mov  #0x0020, &TACCR0
130
        mov  #0x0216, &TACTL 	; # /1
131 111 olivier.gi
        mov  #0x0001, &DMEM_200
132 2 olivier.gi
        mov  #0x0010, r14
133
        call #WAIT_FUNC
134
 
135
        mov  #0x0200, &TACTL
136
        mov  #0x0010, &TACCR0
137
        mov  #0x0256, &TACTL 	; # /2
138 111 olivier.gi
        mov  #0x0002, &DMEM_200
139 2 olivier.gi
        mov  #0x0010, r14
140
        call #WAIT_FUNC
141
 
142
        mov  #0x0200, &TACTL
143
        mov  #0x0008, &TACCR0
144
        mov  #0x0296, &TACTL 	; # /4
145 111 olivier.gi
        mov  #0x0003, &DMEM_200
146 2 olivier.gi
        mov  #0x0010, r14
147
        call #WAIT_FUNC
148
 
149
        mov  #0x0200, &TACTL
150
        mov  #0x0004, &TACCR0
151
        mov  #0x02D6, &TACTL 	; # /8
152 111 olivier.gi
        mov  #0x0004, &DMEM_200
153 2 olivier.gi
        mov  #0x0010, r14
154
        call #WAIT_FUNC
155
 
156
        dint
157 111 olivier.gi
        mov  #0x0000, &DMEM_200
158 2 olivier.gi
        mov  #0x2000, r15
159
 
160
 
161
       /* --------------   TIMER A TEST:  UP MODE   ----------------- */
162
 
163
        mov  #0x0200, &TACTL
164
        mov  #0x0000, &TACCTL0
165
        eint
166
 
167
        mov  #0x0200, &TACTL
168
        mov  #0x0000, &TACCTL0
169
        mov  #0x0012, &TACCR0   ; # Check timing for period = 0x12 +1
170
        mov  #0x0256, &TACTL
171 111 olivier.gi
        mov  #0x0001, &DMEM_200
172 2 olivier.gi
        mov  #0x0010, r14
173
        call #WAIT_FUNC
174
 
175
        mov  #0x0200, &TACTL
176
        mov  #0x0000, &TACCTL0
177
        mov  #0x001E, &TACCR0   ; # Check timing for period = 0x1E +1
178
        mov  #0x0256, &TACTL
179 111 olivier.gi
        mov  #0x0002, &DMEM_200
180 2 olivier.gi
        mov  #0x0020, r14
181
        call #WAIT_FUNC
182
 
183
        mov  #0x0200, &TACTL
184
        mov  #0x0000, &TACCTL0
185
        mov  #0x0012, &TACCR0   ; # Check timing for period = 0x12 +1
186
        mov  #0x0254, &TACTL
187
        mov  #0x0010, &TACCTL0
188 111 olivier.gi
        mov  #0x0003, &DMEM_200
189 2 olivier.gi
        mov  #0x0010, r14
190
        call #WAIT_FUNC
191
 
192
        mov  #0x0200, &TACTL
193
        mov  #0x0000, &TACCTL0
194
        mov  #0x001E, &TACCR0   ; # Check timing for period = 0x1E +1
195
        mov  #0x0254, &TACTL
196
        mov  #0x0010, &TACCTL0
197 111 olivier.gi
        mov  #0x0004, &DMEM_200
198 2 olivier.gi
        mov  #0x0020, r14
199
        call #WAIT_FUNC
200
 
201
        dint
202 111 olivier.gi
        mov  #0x0000, &DMEM_200
203 2 olivier.gi
        mov  #0x3000, r15
204
 
205
 
206
       /* --------------   TIMER A TEST:  CONTINUOUS MODES   ----------------- */
207
 
208
        mov  #0x0200, &TACTL
209
        mov  #0x0000, &TACCTL0
210
        eint
211
 
212
        mov  #0x0200, &TACTL
213
        mov  #0x0000, &TACCTL0
214
        mov  #0xfff0, &TAR      ; # Continuous mode
215
        mov  #0x0262, &TACTL
216 111 olivier.gi
        mov  #0x0001, &DMEM_200
217 2 olivier.gi
        mov  #0x0020, r14
218
        call #WAIT_FUNC
219
 
220
        dint
221 111 olivier.gi
        mov  #0x0000, &DMEM_200
222 2 olivier.gi
        mov  #0x4000, r15
223
 
224
 
225
       /* --------------   TIMER A TEST:  UP-DOWN MODE   ----------------- */
226
 
227
        mov  #0x0200, &TACTL
228
        mov  #0x0000, &TACCTL0
229
        eint
230
 
231
        mov  #0x0200, &TACTL
232
        mov  #0x0000, &TACCTL0
233
        mov  #0x0031, &TACCR0   ; # Up-Down mode - timing 1
234
        mov  #0x0000, &TAR
235
        mov  #0x0236, &TACTL
236
        mov  #0x0010, &TACCTL0
237 111 olivier.gi
        mov  #0x0001, &DMEM_200
238 2 olivier.gi
        mov  #0x0050, r14
239
        call #WAIT_FUNC
240 111 olivier.gi
        mov  #0x0002, &DMEM_200
241 2 olivier.gi
 
242
 
243
        dint
244
        mov  #0x0200, &TACTL
245
        mov  #0x0000, &TACCTL0
246 111 olivier.gi
        mov  #0x0000, &DMEM_200
247 2 olivier.gi
        mov  #0x5000, r15
248
 
249
 
250
 
251
        /* ----------------------         END OF TEST        --------------- */
252
end_of_test:
253
        nop
254
        br #0xffff
255
 
256
 
257
        /* ----------------------      INTERRUPT ROUTINES    --------------- */
258
 
259
TIMERA_CCR0_VECTOR:
260 111 olivier.gi
        mov     &TAR, &DMEM_204
261 2 olivier.gi
        reti
262
 
263
 
264
TIMERA_TAIV_VECTOR:
265 111 olivier.gi
        mov     &TAR, &DMEM_202
266 2 olivier.gi
        bic  #0x0001, &TACTL
267
        reti
268
 
269
 
270
        /* ----------------------         INTERRUPT VECTORS  --------------- */
271
 
272
.section .vectors, "a"
273
.word end_of_test        ; Interrupt  0 (lowest priority)    
274
.word end_of_test        ; Interrupt  1                      
275
.word end_of_test        ; Interrupt  2                      
276
.word end_of_test        ; Interrupt  3                      
277
.word end_of_test        ; Interrupt  4                      
278
.word end_of_test        ; Interrupt  5                      
279
.word end_of_test        ; Interrupt  6                      
280
.word end_of_test        ; Interrupt  7                      
281
.word TIMERA_TAIV_VECTOR ; Interrupt  8                      
282
.word TIMERA_CCR0_VECTOR ; Interrupt  9                      
283
.word end_of_test        ; Interrupt 10                      Watchdog timer
284
.word end_of_test        ; Interrupt 11                      
285
.word end_of_test        ; Interrupt 12                      
286
.word end_of_test        ; Interrupt 13                      
287
.word end_of_test        ; Interrupt 14                      NMI
288
.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.