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

Subversion Repositories openmsp430

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

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
/*                            DIGITAL I/O                                    */
25
/*---------------------------------------------------------------------------*/
26
/* Test the Digital I/O interface:                                           */
27
/*                                   - Interrupts.                           */
28 18 olivier.gi
/*                                                                           */
29
/* Author(s):                                                                */
30
/*             - Olivier Girard,    olgirard@gmail.com                       */
31
/*                                                                           */
32
/*---------------------------------------------------------------------------*/
33 19 olivier.gi
/* $Rev: 141 $                                                                */
34
/* $LastChangedBy: olivier.girard $                                          */
35
/* $LastChangedDate: 2012-05-05 23:22:06 +0200 (Sat, 05 May 2012) $          */
36 2 olivier.gi
/*===========================================================================*/
37
 
38 141 olivier.gi
.include "pmem_defs.asm"
39
 
40 2 olivier.gi
.global main
41
 
42
main:
43
        ; Disable interrupts
44
        dint
45
        mov.b #0x00, &P1IE
46
        mov.b #0x00, &P2IE
47
 
48
 
49
        /* -------------- PORT 1: TEST INTERRUPT FLAGS  --------------- */
50
 
51
 
52
        mov.b   #0x00, &P1IES       ;# TEST IF RISING EDGE ENABLED
53
 
54 111 olivier.gi
        mov     #DMEM_200, r15        ;# Make sure rising edge is detected test 1
55 2 olivier.gi
p1ifg_re_loop1:
56
        nop
57
        nop
58
        mov.b &P1IFG,  0(r15)
59
        mov.b   #0x00, &P1IFG
60
        inc      r15
61 111 olivier.gi
        cmp     #DMEM_208, r15
62 2 olivier.gi
        jne     p1ifg_re_loop1
63
 
64 111 olivier.gi
        mov     #DMEM_210, r15        ;# Make sure falling edge is ignored
65 2 olivier.gi
p1ifg_fe_loop1:
66
        nop
67
        nop
68
        mov.b &P1IFG,  0(r15)
69
        mov.b   #0x00, &P1IFG
70
        inc      r15
71 111 olivier.gi
        cmp     #DMEM_218, r15
72 2 olivier.gi
        jne     p1ifg_fe_loop1
73
 
74 111 olivier.gi
        mov     #DMEM_220, r15        ;# Make sure rising edge is detected test 2
75 2 olivier.gi
p1ifg_re_loop2:
76
        nop
77
        nop
78
        mov.b &P1IFG,  0(r15)
79
        inc      r15
80 111 olivier.gi
        cmp     #DMEM_228, r15
81 2 olivier.gi
        jne     p1ifg_re_loop2
82
        mov.b   #0x00, &P1IFG
83
 
84
 
85
 
86
        mov.b   #0xff, &P1IES       ;# TEST IF FALLING EDGE ENABLED
87
 
88 111 olivier.gi
        mov     #DMEM_230, r15        ;# Make sure falling edge is detected test 1
89 2 olivier.gi
p1ifg_fe_loop2:
90
        nop
91
        nop
92
        mov.b &P1IFG,  0(r15)
93
        mov.b   #0x00, &P1IFG
94
        inc      r15
95 111 olivier.gi
        cmp     #DMEM_238, r15
96 2 olivier.gi
        jne     p1ifg_fe_loop2
97
 
98 111 olivier.gi
        mov     #DMEM_240, r15        ;# Make sure rising edge is ignored
99 2 olivier.gi
p1ifg_re_loop3:
100
        nop
101
        nop
102
        mov.b &P1IFG,  0(r15)
103
        mov.b   #0x00, &P1IFG
104
        inc      r15
105 111 olivier.gi
        cmp     #DMEM_248, r15
106 2 olivier.gi
        jne     p1ifg_re_loop3
107
 
108 111 olivier.gi
        mov     #DMEM_250, r15        ;# Make sure falling edge is detected test 2
109 2 olivier.gi
p1ifg_fe_loop3:
110
        nop
111
        nop
112
        mov.b &P1IFG,  0(r15)
113
        inc      r15
114 111 olivier.gi
        cmp     #DMEM_258, r15
115 2 olivier.gi
        jne     p1ifg_fe_loop3
116
        mov.b   #0x00, &P1IFG
117
 
118
 
119
        /* -------------- PORT 2: TEST INTERRUPT FLAGS  --------------- */
120
 
121
 
122
        mov.b   #0x00, &P2IES       ;# TEST IF RISING EDGE ENABLED
123
 
124 111 olivier.gi
        mov     #DMEM_200, r15        ;# Make sure rising edge is detected test 1
125 2 olivier.gi
p2ifg_re_loop1:
126
        nop
127
        nop
128
        mov.b &P2IFG,  0(r15)
129
        mov.b   #0x00, &P2IFG
130
        inc      r15
131 111 olivier.gi
        cmp     #DMEM_208, r15
132 2 olivier.gi
        jne     p2ifg_re_loop1
133
 
134 111 olivier.gi
        mov     #DMEM_210, r15        ;# Make sure falling edge is ignored
135 2 olivier.gi
p2ifg_fe_loop1:
136
        nop
137
        nop
138
        mov.b &P2IFG,  0(r15)
139
        mov.b   #0x00, &P2IFG
140
        inc      r15
141 111 olivier.gi
        cmp     #DMEM_218, r15
142 2 olivier.gi
        jne     p2ifg_fe_loop1
143
 
144 111 olivier.gi
        mov     #DMEM_220, r15        ;# Make sure rising edge is detected test 2
145 2 olivier.gi
p2ifg_re_loop2:
146
        nop
147
        nop
148
        mov.b &P2IFG,  0(r15)
149
        inc      r15
150 111 olivier.gi
        cmp     #DMEM_228, r15
151 2 olivier.gi
        jne     p2ifg_re_loop2
152
        mov.b   #0x00, &P2IFG
153
 
154
 
155
 
156
        mov.b   #0xff, &P2IES       ;# TEST IF FALLING EDGE ENABLED
157
 
158 111 olivier.gi
        mov     #DMEM_230, r15        ;# Make sure falling edge is detected test 1
159 2 olivier.gi
p2ifg_fe_loop2:
160
        nop
161
        nop
162
        mov.b &P2IFG,  0(r15)
163
        mov.b   #0x00, &P2IFG
164
        inc      r15
165 111 olivier.gi
        cmp     #DMEM_238, r15
166 2 olivier.gi
        jne     p2ifg_fe_loop2
167
 
168 111 olivier.gi
        mov     #DMEM_240, r15        ;# Make sure rising edge is ignored
169 2 olivier.gi
p2ifg_re_loop3:
170
        nop
171
        nop
172
        mov.b &P2IFG,  0(r15)
173
        mov.b   #0x00, &P2IFG
174
        inc      r15
175 111 olivier.gi
        cmp     #DMEM_248, r15
176 2 olivier.gi
        jne     p2ifg_re_loop3
177
 
178 111 olivier.gi
        mov     #DMEM_250, r15        ;# Make sure falling edge is detected test 2
179 2 olivier.gi
p2ifg_fe_loop3:
180
        nop
181
        nop
182
        mov.b &P2IFG,  0(r15)
183
        inc      r15
184 111 olivier.gi
        cmp     #DMEM_258, r15
185 2 olivier.gi
        jne     p2ifg_fe_loop3
186
        mov.b   #0x00, &P2IFG
187
 
188
 
189
        /* --------------            CLEAR MEMORY        --------------- */
190
 
191 111 olivier.gi
        mov     #DMEM_200, r5
192 2 olivier.gi
mem_clear_loop:
193
        mov     #0x00,  0(r5)
194
        incd      r5
195 111 olivier.gi
        cmp     #DMEM_260, r5
196 2 olivier.gi
        jne     mem_clear_loop
197
 
198
 
199
        /* -------------- PORT 1: TEST INTERRUPT VECTOR  --------------- */
200
 
201 111 olivier.gi
        mov     #DMEM_250, r1     ; Initialize stack
202 2 olivier.gi
        eint                    ; Enable interrupts
203
 
204
        mov.b   #0x0001, r6
205
        mov.b        r6, &P1IE
206 111 olivier.gi
        mov     #DMEM_200, r15;
207 2 olivier.gi
p1_irq_loop:
208
        mov.b        r6, &P1IFG ; Generate soft interrupt
209
        nop
210
        nop
211
        nop
212
        rla          r6
213
        mov.b        r6, &P1IE
214
        inc         r15
215 111 olivier.gi
        cmp     #DMEM_208, r15
216 2 olivier.gi
        jne     p1_irq_loop
217
 
218
 
219
        /* -------------- PORT 2: TEST INTERRUPT VECTOR  --------------- */
220
 
221 111 olivier.gi
        mov     #DMEM_250, r1     ; Initialize stack
222 2 olivier.gi
        eint                    ; Enable interrupts
223
 
224
        mov.b   #0x0001, r6
225
        mov.b        r6, &P2IE
226 111 olivier.gi
        mov     #DMEM_210, r15;
227 2 olivier.gi
p2_irq_loop:
228
        mov.b        r6, &P2IFG ; Generate soft interrupt
229
        nop
230
        nop
231
        nop
232
        rla          r6
233
        mov.b        r6, &P2IE
234
        inc         r15
235 111 olivier.gi
        cmp     #DMEM_218, r15
236 2 olivier.gi
        jne     p2_irq_loop
237
 
238
 
239
        /* ----------------------         END OF TEST        --------------- */
240
end_of_test:
241
        nop
242
        br #0xffff
243
 
244
 
245
        /* ----------------------      INTERRUPT ROUTINES    --------------- */
246
 
247
PORT1_VECTOR:
248
        mov.b &P1IFG,  0(r15)
249
        mov.b  #0x00, &P1IFG
250
        reti
251
 
252
PORT2_VECTOR:
253
        mov.b &P2IFG,  0(r15)
254
        mov.b  #0x00, &P2IFG
255
        reti
256
 
257
 
258
 
259
        /* ----------------------         INTERRUPT VECTORS  --------------- */
260
 
261
.section .vectors, "a"
262
.word end_of_test  ; Interrupt  0 (lowest priority)    
263
.word end_of_test  ; Interrupt  1                      
264
.word PORT1_VECTOR ; Interrupt  2                      
265
.word PORT2_VECTOR ; Interrupt  3                      
266
.word end_of_test  ; Interrupt  4                      
267
.word end_of_test  ; Interrupt  5                      
268
.word end_of_test  ; Interrupt  6                      
269
.word end_of_test  ; Interrupt  7                      
270
.word end_of_test  ; Interrupt  8                      
271
.word end_of_test  ; Interrupt  9                      
272
.word end_of_test  ; Interrupt 10                      Watchdog timer
273
.word end_of_test  ; Interrupt 11                      
274
.word end_of_test  ; Interrupt 12                      
275
.word end_of_test  ; Interrupt 13                      
276
.word end_of_test  ; Interrupt 14                      NMI
277
.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.