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

Subversion Repositories openmsp430

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 134 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
/*                            CPU OPERATING MODES                            */
25
/*---------------------------------------------------------------------------*/
26
/* Test the CPU Operating modes:                                             */
27
/*                                 - CPUOFF (<=> R2[4]): turn off CPU.       */
28
/*                                 - OSCOFF (<=> R2[5]): turn off LFXT_CLK.  */
29
/*                                 - SCG0   (<=> R2[6]): turn off DCO.       */
30
/*                                 - SCG1   (<=> R2[7]): turn off SMCLK.     */
31
/*                                                                           */
32
/* Author(s):                                                                */
33
/*             - Olivier Girard,    olgirard@gmail.com                       */
34
/*                                                                           */
35
/*---------------------------------------------------------------------------*/
36
/* $Rev: 19 $                                                                */
37
/* $LastChangedBy: olivier.girard $                                          */
38
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $          */
39
/*===========================================================================*/
40
 
41 141 olivier.gi
.include "pmem_defs.asm"
42
 
43 134 olivier.gi
.global main
44
 
45
WAIT_FUNC:
46
        dec r14
47
        jnz WAIT_FUNC
48
        ret
49
 
50
main:
51
 
52
        ; Initialize stack and enable global interrupts
53
        mov   #DMEM_250, r1
54
        eint
55
 
56
        mov     #0x1000, r15
57
 
58
 
59
        /* -------------- SCG1   (<=> R2[7]): turn off SMCLK --------------- */
60
 
61
        mov.b  #0x00, &BCSCTL2  ; # Div /1
62
 
63
        mov    #0x0008, r2      ; # SCG1=0 (SMCLK on)
64
        mov    #0x1001, r15
65
        mov    #0x0030, r14
66
        call   #WAIT_FUNC
67
 
68
        mov    #0x0088, r2      ; # SCG1=1 (SMCLK off)
69
        mov    #0x1002, r15
70
        mov    #0x0030, r14
71
        call   #WAIT_FUNC
72
 
73
        mov    #0x1003, r15     ; # SCG1=1 (SMCLK off) with IRQ PORT2 (extiting power mode)
74
        mov    #0x0030, r14
75
        call   #WAIT_FUNC
76
 
77
        mov    #0x1004, r15     ; # SCG1=1 (SMCLK off) return from IRQ PORT2
78
        mov    #0x0030, r14
79
        call   #WAIT_FUNC
80
 
81
        mov    #0x0088, r2      ; # SCG1=1 (SMCLK off)
82
        mov    #0x1005, r15
83
        mov    #0x0030, r14
84
        call   #WAIT_FUNC
85
 
86
        mov    #0x1006, r15     ; # SCG1=1 (SMCLK off) with IRQ PORT1 (staying in power mode)
87
        mov    #0x0030, r14
88
        call   #WAIT_FUNC
89
 
90
        mov    #0x1007, r15     ; # SCG1=1 (SMCLK off) return from IRQ PORT1
91
        mov    #0x0030, r14
92
        call   #WAIT_FUNC
93
 
94
        mov    #0x0008, r2      ; # SCG1=0 (SMCLK on)
95
        mov    #0x1008, r15
96
        mov    #0x0030, r14
97
        call   #WAIT_FUNC
98
 
99
        mov     #0x2000, r15
100
 
101
 
102
        /* -------------- OSCOFF (<=> R2[5]): turn off LFXT1CLK --------------- */
103
 
104
        mov.b  #0x00, &BCSCTL1  ; # ACLK Div /1
105
 
106
        mov    #0x0008, r2      ; # OSCOFF=0 (ACLK on)
107
        mov    #0x2001, r15
108
        mov    #0x0060, r14
109
        call   #WAIT_FUNC
110
 
111
        mov    #0x0028, r2      ; # OSCOFF=1 (ACLK off)
112
        mov    #0x2002, r15
113
        mov    #0x0060, r14
114
        call   #WAIT_FUNC
115
 
116
        mov    #0x2003, r15     ; # OSCOFF=1 (ACLK off) with IRQ PORT2 (extiting power mode)
117
        mov    #0x0060, r14
118
        call   #WAIT_FUNC
119
 
120
        mov    #0x2004, r15     ; # OSCOFF=1 (ACLK off) return from IRQ PORT2
121
        mov    #0x0060, r14
122
        call   #WAIT_FUNC
123
 
124
        mov    #0x0028, r2      ; # OSCOFF=1 (ACLK off)
125
        mov    #0x2005, r15
126
        mov    #0x0060, r14
127
        call   #WAIT_FUNC
128
 
129
        mov    #0x2006, r15     ; # OSCOFF=1 (ACLK off) with IRQ PORT1 (staying in power mode)
130
        mov    #0x0060, r14
131
        call   #WAIT_FUNC
132
 
133
        mov    #0x2007, r15     ; # OSCOFF=1 (ACLK off) return from IRQ PORT1
134
        mov    #0x0060, r14
135
        call   #WAIT_FUNC
136
 
137
        mov    #0x0008, r2      ; # OSCOFF=0 (ACLK on)
138
        mov    #0x2008, r15
139
        mov    #0x0060, r14
140
        call   #WAIT_FUNC
141
 
142
 
143
        mov    #0x3000, r15
144
 
145
 
146
        /* -------------- CPUOFF (<=> R2[4]): turn off CPU    --------------- */
147
 
148
        mov.b  #0x00, &BCSCTL2  ; # Div /1 --> select DCOCLK
149
 
150
        mov    #0x3001, r15
151
        mov    #0x0008, r2      ; # CPUOFF=0 (CPU on)
152
        mov    #0x0060, r14
153
        call   #WAIT_FUNC
154
 
155
        mov    #0x3002, r15
156
        mov    #0x0018, r2      ; # CPUOFF=1 (CPU off)
157
        mov    #0x0060, r14
158
        call   #WAIT_FUNC
159
 
160
        mov    #0x3003, r15
161
        mov    #0x0008, r2      ; # CPUOFF=0 (CPU on)
162
        mov    #0x0060, r14
163
        call   #WAIT_FUNC
164
 
165
 
166
        mov    #0x4000, r15
167
 
168
 
169
        /* -------------- SCG0 (<=> R2[6]): turn off DCO oscillator  --------------- */
170
 
171
        mov.b  #0x00, &BCSCTL2  ; # Div /1 --> select DCOCLK
172
 
173
        mov    #0x4001, r15
174
        mov    #0x0008, r2      ; # SCG0=0 (DCO on)
175
        mov    #0x0060, r14
176
        call   #WAIT_FUNC
177
 
178
        mov    #0x4002, r15
179
        mov    #0x0048, r2      ; # SCG0=1 (DCO off)
180
        mov    #0x0060, r14
181
        call   #WAIT_FUNC
182
 
183
        mov    #0x4003, r15
184
        mov    #0x0008, r2      ; # SCG0=0 (DCO on)
185
        mov    #0x0060, r14
186
        call   #WAIT_FUNC
187
 
188
 
189
        mov    #0x5000, r15
190
 
191
 
192
        /* ----------------------         END OF TEST        --------------- */
193
end_of_test:
194
        nop
195
        br #0xffff
196
 
197
 
198
        /* ----------------------      INTERRUPT ROUTINES    --------------- */
199
 
200
PORT1_VECTOR:
201
        push       r13
202
        push       r14
203
        mov    #0x0060, r14
204
        call   #WAIT_FUNC
205
        mov    #0xaaaa, r13
206
        pop        r14
207
        pop        r13
208
        reti
209
 
210
PORT2_VECTOR:
211
        push       r13
212
        push       r14
213
        mov    #0x0060, r14
214
        call   #WAIT_FUNC
215
        mov    #0xbbbb, r13
216
        pop        r14
217
        pop        r13
218
        bic    #0xf0, 0(r1) ;exit all lowpower mode
219
        reti
220
 
221
 
222
        /* ----------------------         INTERRUPT VECTORS  --------------- */
223
 
224
.section .vectors, "a"
225
.word end_of_test  ; Interrupt  0 (lowest priority)    
226
.word end_of_test  ; Interrupt  1                      
227
.word PORT1_VECTOR ; Interrupt  2                      
228
.word PORT2_VECTOR ; Interrupt  3                      
229
.word end_of_test  ; Interrupt  4                      
230
.word end_of_test  ; Interrupt  5                      
231
.word end_of_test  ; Interrupt  6                      
232
.word end_of_test  ; Interrupt  7                      
233
.word end_of_test  ; Interrupt  8                      
234
.word end_of_test  ; Interrupt  9                      
235
.word end_of_test  ; Interrupt 10                      Watchdog timer
236
.word end_of_test  ; Interrupt 11                      
237
.word end_of_test  ; Interrupt 12                      
238
.word end_of_test  ; Interrupt 13                      
239
.word end_of_test  ; Interrupt 14                      NMI
240
.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.