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 2

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
/*===========================================================================*/
29
 
30
.global main
31
 
32
.set   BCSCTL1, 0x0057
33
.set   BCSCTL2, 0x0058
34
 
35
 
36
WAIT_FUNC:
37
        dec r14
38
        jnz WAIT_FUNC
39
        ret
40
 
41
main:
42
        mov  #0x0250, r1        ; # Initialize stack pointer
43
        mov  #0x0000, &0x0200
44
        mov  #0x0000, r15
45
 
46
       /* --------------                ACLK GENERATION             ----------------- */
47
 
48
        mov.b  #0x00, &BCSCTL1  ; # Div /1
49
        mov    #0x0001, r15
50
        mov    #0x0130, r14
51
        call   #WAIT_FUNC
52
 
53
        mov.b  #0x10, &BCSCTL1  ; # Div /2
54
        mov    #0x0002, r15
55
        mov    #0x0130, r14
56
        call   #WAIT_FUNC
57
 
58
        mov.b  #0x20, &BCSCTL1  ; # Div /4
59
        mov    #0x0003, r15
60
        mov    #0x0130, r14
61
        call   #WAIT_FUNC
62
 
63
        mov.b  #0x30, &BCSCTL1  ; # Div /8
64
        mov    #0x0004, r15
65
        mov    #0x0130, r14
66
        call   #WAIT_FUNC
67
 
68
        mov  #0x1000, r15
69
 
70
 
71
       /* --------------      SMCLK GENERATION - LFXT_CLK INPUT    ----------------- */
72
 
73
        mov.b  #0x08, &BCSCTL2  ; # Div /1
74
        mov    #0x1001, r15
75
        mov    #0x0130, r14
76
        call   #WAIT_FUNC
77
 
78
        mov.b  #0x0A, &BCSCTL2  ; # Div /2
79
        mov    #0x1002, r15
80
        mov    #0x0130, r14
81
        call   #WAIT_FUNC
82
 
83
        mov.b  #0x0C, &BCSCTL2  ; # Div /4
84
        mov    #0x1003, r15
85
        mov    #0x0130, r14
86
        call   #WAIT_FUNC
87
 
88
        mov.b  #0x0E, &BCSCTL2  ; # Div /8
89
        mov    #0x1004, r15
90
        mov    #0x0130, r14
91
        call   #WAIT_FUNC
92
 
93
        mov  #0x2000, r15
94
 
95
 
96
       /* --------------      SMCLK GENERATION - DCO_CLK INPUT     ----------------- */
97
 
98
        mov.b  #0x00, &BCSCTL2  ; # Div /1
99
        mov    #0x2001, r15
100
        mov    #0x0130, r14
101
        call   #WAIT_FUNC
102
 
103
        mov.b  #0x02, &BCSCTL2  ; # Div /2
104
        mov    #0x2002, r15
105
        mov    #0x0130, r14
106
        call   #WAIT_FUNC
107
 
108
        mov.b  #0x04, &BCSCTL2  ; # Div /4
109
        mov    #0x2003, r15
110
        mov    #0x0130, r14
111
        call   #WAIT_FUNC
112
 
113
        mov.b  #0x06, &BCSCTL2  ; # Div /8
114
        mov    #0x2004, r15
115
        mov    #0x0130, r14
116
        call   #WAIT_FUNC
117
 
118
        mov  #0x3000, r15
119
 
120
 
121
        /* ----------------------         END OF TEST        --------------- */
122
end_of_test:
123
        nop
124
        br #0xffff
125
 
126
 
127
        /* ----------------------         INTERRUPT VECTORS  --------------- */
128
 
129
.section .vectors, "a"
130
.word end_of_test        ; Interrupt  0 (lowest priority)    
131
.word end_of_test        ; Interrupt  1                      
132
.word end_of_test        ; Interrupt  2                      
133
.word end_of_test        ; Interrupt  3                      
134
.word end_of_test        ; Interrupt  4                      
135
.word end_of_test        ; Interrupt  5                      
136
.word end_of_test        ; Interrupt  6                      
137
.word end_of_test        ; Interrupt  7                      
138
.word end_of_test        ; Interrupt  8                      
139
.word end_of_test        ; Interrupt  9                      
140
.word end_of_test        ; Interrupt 10                      Watchdog timer
141
.word end_of_test        ; Interrupt 11                      
142
.word end_of_test        ; Interrupt 12                      
143
.word end_of_test        ; Interrupt 13                      
144
.word end_of_test        ; Interrupt 14                      NMI
145
.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.