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

Subversion Repositories openmsp430

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

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
/*                               CLOCK MODULE                                */
25
/*---------------------------------------------------------------------------*/
26
/* Test the clock module:                                                    */
27
/*                        - Check the ACLK and SMCLK clock generation.       */
28 18 olivier.gi
/*                                                                           */
29
/* Author(s):                                                                */
30
/*             - Olivier Girard,    olgirard@gmail.com                       */
31
/*                                                                           */
32
/*---------------------------------------------------------------------------*/
33 19 olivier.gi
/* $Rev: 106 $                                                                */
34
/* $LastChangedBy: olivier.girard $                                          */
35
/* $LastChangedDate: 2011-03-25 23:01:03 +0100 (Fri, 25 Mar 2011) $          */
36 2 olivier.gi
/*===========================================================================*/
37
 
38
.global main
39
 
40
.set   BCSCTL1, 0x0057
41
.set   BCSCTL2, 0x0058
42
 
43
 
44
WAIT_FUNC:
45
        dec r14
46
        jnz WAIT_FUNC
47
        ret
48
 
49
main:
50
        mov  #0x0250, r1        ; # Initialize stack pointer
51
        mov  #0x0000, &0x0200
52
        mov  #0x0000, r15
53
 
54
       /* --------------                ACLK GENERATION             ----------------- */
55
 
56
        mov.b  #0x00, &BCSCTL1  ; # Div /1
57
        mov    #0x0001, r15
58
        mov    #0x0130, r14
59
        call   #WAIT_FUNC
60
 
61
        mov.b  #0x10, &BCSCTL1  ; # Div /2
62
        mov    #0x0002, r15
63
        mov    #0x0130, r14
64
        call   #WAIT_FUNC
65
 
66
        mov.b  #0x20, &BCSCTL1  ; # Div /4
67
        mov    #0x0003, r15
68
        mov    #0x0130, r14
69
        call   #WAIT_FUNC
70
 
71
        mov.b  #0x30, &BCSCTL1  ; # Div /8
72
        mov    #0x0004, r15
73
        mov    #0x0130, r14
74
        call   #WAIT_FUNC
75
 
76
        mov  #0x1000, r15
77
 
78
 
79
       /* --------------      SMCLK GENERATION - LFXT_CLK INPUT    ----------------- */
80
 
81
        mov.b  #0x08, &BCSCTL2  ; # Div /1
82
        mov    #0x1001, r15
83
        mov    #0x0130, r14
84
        call   #WAIT_FUNC
85
 
86
        mov.b  #0x0A, &BCSCTL2  ; # Div /2
87
        mov    #0x1002, r15
88
        mov    #0x0130, r14
89
        call   #WAIT_FUNC
90
 
91
        mov.b  #0x0C, &BCSCTL2  ; # Div /4
92
        mov    #0x1003, r15
93
        mov    #0x0130, r14
94
        call   #WAIT_FUNC
95
 
96
        mov.b  #0x0E, &BCSCTL2  ; # Div /8
97
        mov    #0x1004, r15
98
        mov    #0x0130, r14
99
        call   #WAIT_FUNC
100
 
101
        mov  #0x2000, r15
102
 
103
 
104
       /* --------------      SMCLK GENERATION - DCO_CLK INPUT     ----------------- */
105
 
106
        mov.b  #0x00, &BCSCTL2  ; # Div /1
107
        mov    #0x2001, r15
108
        mov    #0x0130, r14
109
        call   #WAIT_FUNC
110
 
111
        mov.b  #0x02, &BCSCTL2  ; # Div /2
112
        mov    #0x2002, r15
113
        mov    #0x0130, r14
114
        call   #WAIT_FUNC
115
 
116
        mov.b  #0x04, &BCSCTL2  ; # Div /4
117
        mov    #0x2003, r15
118
        mov    #0x0130, r14
119
        call   #WAIT_FUNC
120
 
121
        mov.b  #0x06, &BCSCTL2  ; # Div /8
122
        mov    #0x2004, r15
123
        mov    #0x0130, r14
124
        call   #WAIT_FUNC
125
 
126
        mov  #0x3000, r15
127
 
128 106 olivier.gi
 
129
        /* --------------      CPU ENABLE - CPU_EN INPUT     ----------------- */
130
 
131
        mov    #0x0800, r14
132
        call   #WAIT_FUNC
133
 
134
        mov  #0x4000, r15
135
 
136 2 olivier.gi
 
137
        /* ----------------------         END OF TEST        --------------- */
138
end_of_test:
139
        nop
140
        br #0xffff
141
 
142
 
143
        /* ----------------------         INTERRUPT VECTORS  --------------- */
144
 
145
.section .vectors, "a"
146
.word end_of_test        ; Interrupt  0 (lowest priority)    
147
.word end_of_test        ; Interrupt  1                      
148
.word end_of_test        ; Interrupt  2                      
149
.word end_of_test        ; Interrupt  3                      
150
.word end_of_test        ; Interrupt  4                      
151
.word end_of_test        ; Interrupt  5                      
152
.word end_of_test        ; Interrupt  6                      
153
.word end_of_test        ; Interrupt  7                      
154
.word end_of_test        ; Interrupt  8                      
155
.word end_of_test        ; Interrupt  9                      
156
.word end_of_test        ; Interrupt 10                      Watchdog timer
157
.word end_of_test        ; Interrupt 11                      
158
.word end_of_test        ; Interrupt 12                      
159
.word end_of_test        ; Interrupt 13                      
160
.word end_of_test        ; Interrupt 14                      NMI
161
.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.