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

Subversion Repositories openmsp430

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

Go to most recent revision | 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
/*                               CLOCK MODULE                                */
25
/*---------------------------------------------------------------------------*/
26
/* Test the clock module:                                                    */
27
/*                        - Check the MCLK clock generation.                 */
28
/*                                                                           */
29
/* Author(s):                                                                */
30
/*             - Olivier Girard,    olgirard@gmail.com                       */
31
/*                                                                           */
32
/*---------------------------------------------------------------------------*/
33
/* $Rev: 19 $                                                                */
34
/* $LastChangedBy: olivier.girard $                                          */
35
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $          */
36
/*===========================================================================*/
37
 
38
.global main
39
 
40
.set   DMEM_BASE, (__data_start     )
41
.set   DMEM_200,  (__data_start+0x00)
42
.set   DMEM_250,  (__data_start+0x50)
43
 
44
.set   BCSCTL1, 0x0057
45
.set   BCSCTL2, 0x0058
46
 
47
 
48
WAIT_FUNC:
49
        dec r14
50
        jnz WAIT_FUNC
51
        ret
52
 
53
main:
54
        mov #DMEM_250, r1       ; # Initialize stack pointer
55
        mov   #0x0000, &DMEM_200
56
        mov   #0x0000, r15
57
 
58
 
59
      /* --------------      MCLK GENERATION - LFXT_CLK INPUT    ----------------- */
60
 
61
        mov.b  #0x80, &BCSCTL2  ; # Div /1
62
        mov    #0x0001, r15
63
        mov    #0x000A, r14
64
        call   #WAIT_FUNC
65
 
66
        mov.b  #0x90, &BCSCTL2  ; # Div /2
67
        mov    #0x0002, r15
68
        mov    #0x000A, r14
69
        call   #WAIT_FUNC
70
 
71
        mov.b  #0xA0, &BCSCTL2  ; # Div /4
72
        mov    #0x0003, r15
73
        mov    #0x000A, r14
74
        call   #WAIT_FUNC
75
 
76
        mov.b  #0xB0, &BCSCTL2  ; # Div /8
77
        mov    #0x0004, r15
78
        mov    #0x000A, r14
79
        call   #WAIT_FUNC
80
 
81
        mov    #0x1000, r15
82
 
83
       /* --------------      MCLK GENERATION - DCO_CLK INPUT     ----------------- */
84
 
85
        mov.b  #0x00, &BCSCTL2  ; # Div /1
86
        mov    #0x1001, r15
87
        mov    #0x000A, r14
88
        call   #WAIT_FUNC
89
 
90
        mov.b  #0x10, &BCSCTL2  ; # Div /2
91
        mov    #0x1002, r15
92
        mov    #0x000A, r14
93
        call   #WAIT_FUNC
94
 
95
        mov.b  #0x20, &BCSCTL2  ; # Div /4
96
        mov    #0x1003, r15
97
        mov    #0x000A, r14
98
        call   #WAIT_FUNC
99
 
100
        mov.b  #0x30, &BCSCTL2  ; # Div /8
101
        mov    #0x1004, r15
102
        mov    #0x000A, r14
103
        call   #WAIT_FUNC
104
 
105
        mov    #0x2000, r15
106
 
107
 
108
      /* --------------      MCLK GENERATION - LFXT_CLK INPUT    ----------------- */
109
 
110
        mov.b  #0x80, &BCSCTL2  ; # Div /1
111
        mov    #0x2001, r15
112
        mov    #0x000A, r14
113
        call   #WAIT_FUNC
114
 
115
        mov.b  #0x90, &BCSCTL2  ; # Div /2
116
        mov    #0x2002, r15
117
        mov    #0x000A, r14
118
        call   #WAIT_FUNC
119
 
120
        mov.b  #0xA0, &BCSCTL2  ; # Div /4
121
        mov    #0x2003, r15
122
        mov    #0x000A, r14
123
        call   #WAIT_FUNC
124
 
125
        mov.b  #0xB0, &BCSCTL2  ; # Div /8
126
        mov    #0x2004, r15
127
        mov    #0x000A, r14
128
        call   #WAIT_FUNC
129
 
130
        mov    #0x3000, r15
131
 
132
       /* --------------      MCLK GENERATION - DCO_CLK INPUT     ----------------- */
133
 
134
        mov.b  #0x00, &BCSCTL2  ; # Div /1
135
        mov    #0x3001, r15
136
        mov    #0x000A, r14
137
        call   #WAIT_FUNC
138
 
139
        mov.b  #0x10, &BCSCTL2  ; # Div /2
140
        mov    #0x3002, r15
141
        mov    #0x000A, r14
142
        call   #WAIT_FUNC
143
 
144
        mov.b  #0x20, &BCSCTL2  ; # Div /4
145
        mov    #0x3003, r15
146
        mov    #0x000A, r14
147
        call   #WAIT_FUNC
148
 
149
        mov.b  #0x30, &BCSCTL2  ; # Div /8
150
        mov    #0x3004, r15
151
        mov    #0x000A, r14
152
        call   #WAIT_FUNC
153
 
154
        mov    #0x4000, r15
155
 
156
 
157
 
158
        /* ----------------------         END OF TEST        --------------- */
159
end_of_test:
160
        nop
161
        br #0xffff
162
 
163
 
164
        /* ----------------------         INTERRUPT VECTORS  --------------- */
165
 
166
.section .vectors, "a"
167
.word end_of_test        ; Interrupt  0 (lowest priority)    
168
.word end_of_test        ; Interrupt  1                      
169
.word end_of_test        ; Interrupt  2                      
170
.word end_of_test        ; Interrupt  3                      
171
.word end_of_test        ; Interrupt  4                      
172
.word end_of_test        ; Interrupt  5                      
173
.word end_of_test        ; Interrupt  6                      
174
.word end_of_test        ; Interrupt  7                      
175
.word end_of_test        ; Interrupt  8                      
176
.word end_of_test        ; Interrupt  9                      
177
.word end_of_test        ; Interrupt 10                      Watchdog timer
178
.word end_of_test        ; Interrupt 11                      
179
.word end_of_test        ; Interrupt 12                      
180
.word end_of_test        ; Interrupt 13                      
181
.word end_of_test        ; Interrupt 14                      NMI
182
.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.