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 78

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: 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   P1IN,  0x0020
41
.set   P1OUT, 0x0021
42
.set   P1DIR, 0x0022
43
.set   P1IFG, 0x0023
44
.set   P1IES, 0x0024
45
.set   P1IE,  0x0025
46
.set   P1SEL, 0x0026
47
.set   P2IN,  0x0028
48
.set   P2OUT, 0x0029
49
.set   P2DIR, 0x002A
50
.set   P2IFG, 0x002B
51
.set   P2IES, 0x002C
52
.set   P2IE,  0x002D
53
.set   P2SEL, 0x002E
54
 
55
main:
56
        ; Disable interrupts
57
        dint
58
        mov.b #0x00, &P1IE
59
        mov.b #0x00, &P2IE
60
 
61
 
62
        /* -------------- PORT 1: TEST INTERRUPT FLAGS  --------------- */
63
 
64
 
65
        mov.b   #0x00, &P1IES       ;# TEST IF RISING EDGE ENABLED
66
 
67
        mov     #0x0200, r15        ;# Make sure rising edge is detected test 1
68
p1ifg_re_loop1:
69
        nop
70
        nop
71
        mov.b &P1IFG,  0(r15)
72
        mov.b   #0x00, &P1IFG
73
        inc      r15
74
        cmp     #0x0208, r15
75
        jne     p1ifg_re_loop1
76
 
77
        mov     #0x0210, r15        ;# Make sure falling edge is ignored
78
p1ifg_fe_loop1:
79
        nop
80
        nop
81
        mov.b &P1IFG,  0(r15)
82
        mov.b   #0x00, &P1IFG
83
        inc      r15
84
        cmp     #0x0218, r15
85
        jne     p1ifg_fe_loop1
86
 
87
        mov     #0x0220, r15        ;# Make sure rising edge is detected test 2
88
p1ifg_re_loop2:
89
        nop
90
        nop
91
        mov.b &P1IFG,  0(r15)
92
        inc      r15
93
        cmp     #0x0228, r15
94
        jne     p1ifg_re_loop2
95
        mov.b   #0x00, &P1IFG
96
 
97
 
98
 
99
        mov.b   #0xff, &P1IES       ;# TEST IF FALLING EDGE ENABLED
100
 
101
        mov     #0x0230, r15        ;# Make sure falling edge is detected test 1
102
p1ifg_fe_loop2:
103
        nop
104
        nop
105
        mov.b &P1IFG,  0(r15)
106
        mov.b   #0x00, &P1IFG
107
        inc      r15
108
        cmp     #0x0238, r15
109
        jne     p1ifg_fe_loop2
110
 
111
        mov     #0x0240, r15        ;# Make sure rising edge is ignored
112
p1ifg_re_loop3:
113
        nop
114
        nop
115
        mov.b &P1IFG,  0(r15)
116
        mov.b   #0x00, &P1IFG
117
        inc      r15
118
        cmp     #0x0248, r15
119
        jne     p1ifg_re_loop3
120
 
121
        mov     #0x0250, r15        ;# Make sure falling edge is detected test 2
122
p1ifg_fe_loop3:
123
        nop
124
        nop
125
        mov.b &P1IFG,  0(r15)
126
        inc      r15
127
        cmp     #0x0258, r15
128
        jne     p1ifg_fe_loop3
129
        mov.b   #0x00, &P1IFG
130
 
131
 
132
        /* -------------- PORT 2: TEST INTERRUPT FLAGS  --------------- */
133
 
134
 
135
        mov.b   #0x00, &P2IES       ;# TEST IF RISING EDGE ENABLED
136
 
137
        mov     #0x0200, r15        ;# Make sure rising edge is detected test 1
138
p2ifg_re_loop1:
139
        nop
140
        nop
141
        mov.b &P2IFG,  0(r15)
142
        mov.b   #0x00, &P2IFG
143
        inc      r15
144
        cmp     #0x0208, r15
145
        jne     p2ifg_re_loop1
146
 
147
        mov     #0x0210, r15        ;# Make sure falling edge is ignored
148
p2ifg_fe_loop1:
149
        nop
150
        nop
151
        mov.b &P2IFG,  0(r15)
152
        mov.b   #0x00, &P2IFG
153
        inc      r15
154
        cmp     #0x0218, r15
155
        jne     p2ifg_fe_loop1
156
 
157
        mov     #0x0220, r15        ;# Make sure rising edge is detected test 2
158
p2ifg_re_loop2:
159
        nop
160
        nop
161
        mov.b &P2IFG,  0(r15)
162
        inc      r15
163
        cmp     #0x0228, r15
164
        jne     p2ifg_re_loop2
165
        mov.b   #0x00, &P2IFG
166
 
167
 
168
 
169
        mov.b   #0xff, &P2IES       ;# TEST IF FALLING EDGE ENABLED
170
 
171
        mov     #0x0230, r15        ;# Make sure falling edge is detected test 1
172
p2ifg_fe_loop2:
173
        nop
174
        nop
175
        mov.b &P2IFG,  0(r15)
176
        mov.b   #0x00, &P2IFG
177
        inc      r15
178
        cmp     #0x0238, r15
179
        jne     p2ifg_fe_loop2
180
 
181
        mov     #0x0240, r15        ;# Make sure rising edge is ignored
182
p2ifg_re_loop3:
183
        nop
184
        nop
185
        mov.b &P2IFG,  0(r15)
186
        mov.b   #0x00, &P2IFG
187
        inc      r15
188
        cmp     #0x0248, r15
189
        jne     p2ifg_re_loop3
190
 
191
        mov     #0x0250, r15        ;# Make sure falling edge is detected test 2
192
p2ifg_fe_loop3:
193
        nop
194
        nop
195
        mov.b &P2IFG,  0(r15)
196
        inc      r15
197
        cmp     #0x0258, r15
198
        jne     p2ifg_fe_loop3
199
        mov.b   #0x00, &P2IFG
200
 
201
 
202
        /* --------------            CLEAR MEMORY        --------------- */
203
 
204
        mov     #0x0200, r5
205
mem_clear_loop:
206
        mov     #0x00,  0(r5)
207
        incd      r5
208
        cmp     #0x0260, r5
209
        jne     mem_clear_loop
210
 
211
 
212
        /* -------------- PORT 1: TEST INTERRUPT VECTOR  --------------- */
213
 
214
        mov     #0x0250, r1     ; Initialize stack
215
        eint                    ; Enable interrupts
216
 
217
        mov.b   #0x0001, r6
218
        mov.b        r6, &P1IE
219
        mov     #0x0200, r15;
220
p1_irq_loop:
221
        mov.b        r6, &P1IFG ; Generate soft interrupt
222
        nop
223
        nop
224
        nop
225
        rla          r6
226
        mov.b        r6, &P1IE
227
        inc         r15
228
        cmp     #0x0208, r15
229
        jne     p1_irq_loop
230
 
231
 
232
        /* -------------- PORT 2: TEST INTERRUPT VECTOR  --------------- */
233
 
234
        mov     #0x0250, r1     ; Initialize stack
235
        eint                    ; Enable interrupts
236
 
237
        mov.b   #0x0001, r6
238
        mov.b        r6, &P2IE
239
        mov     #0x0210, r15;
240
p2_irq_loop:
241
        mov.b        r6, &P2IFG ; Generate soft interrupt
242
        nop
243
        nop
244
        nop
245
        rla          r6
246
        mov.b        r6, &P2IE
247
        inc         r15
248
        cmp     #0x0218, r15
249
        jne     p2_irq_loop
250
 
251
 
252
        /* ----------------------         END OF TEST        --------------- */
253
end_of_test:
254
        nop
255
        br #0xffff
256
 
257
 
258
        /* ----------------------      INTERRUPT ROUTINES    --------------- */
259
 
260
PORT1_VECTOR:
261
        mov.b &P1IFG,  0(r15)
262
        mov.b  #0x00, &P1IFG
263
        reti
264
 
265
PORT2_VECTOR:
266
        mov.b &P2IFG,  0(r15)
267
        mov.b  #0x00, &P2IFG
268
        reti
269
 
270
 
271
 
272
        /* ----------------------         INTERRUPT VECTORS  --------------- */
273
 
274
.section .vectors, "a"
275
.word end_of_test  ; Interrupt  0 (lowest priority)    
276
.word end_of_test  ; Interrupt  1                      
277
.word PORT1_VECTOR ; Interrupt  2                      
278
.word PORT2_VECTOR ; Interrupt  3                      
279
.word end_of_test  ; Interrupt  4                      
280
.word end_of_test  ; Interrupt  5                      
281
.word end_of_test  ; Interrupt  6                      
282
.word end_of_test  ; Interrupt  7                      
283
.word end_of_test  ; Interrupt  8                      
284
.word end_of_test  ; Interrupt  9                      
285
.word end_of_test  ; Interrupt 10                      Watchdog timer
286
.word end_of_test  ; Interrupt 11                      
287
.word end_of_test  ; Interrupt 12                      
288
.word end_of_test  ; Interrupt 13                      
289
.word end_of_test  ; Interrupt 14                      NMI
290
.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.