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

Subversion Repositories openmsp430

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

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
/*                            WATCHDOG TIMER                                 */
25
/*---------------------------------------------------------------------------*/
26
/* Test the Watdog timer:                                                    */
27
/*                        - Clock source selection.                          */
28 18 olivier.gi
/*                                                                           */
29
/* Author(s):                                                                */
30
/*             - Olivier Girard,    olgirard@gmail.com                       */
31
/*                                                                           */
32
/*---------------------------------------------------------------------------*/
33 19 olivier.gi
/* $Rev: 134 $                                                                */
34
/* $LastChangedBy: olivier.girard $                                          */
35
/* $LastChangedDate: 2012-03-22 21:31:06 +0100 (Thu, 22 Mar 2012) $          */
36 2 olivier.gi
/*===========================================================================*/
37
 
38
.global main
39
 
40 111 olivier.gi
.set   DMEM_BASE, (__data_start     )
41
.set   DMEM_200,  (__data_start+0x00)
42
.set   DMEM_250,  (__data_start+0x50)
43
 
44 2 olivier.gi
.set   BCSCTL1, 0x0057
45
.set   BCSCTL2, 0x0058
46
 
47
.set   IE1,    0x0000
48
.set   IFG1,   0x0002
49
.set   WDTCTL, 0x0120
50
 
51
WAIT_FUNC:
52
        dec r14
53
        jnz WAIT_FUNC
54
        ret
55
 
56
main:
57
 
58
        /* -------   WATCHDOG TEST INTERVAL MODE /64 - SMCLK /2      ------ */
59
 
60 111 olivier.gi
        mov   #DMEM_250, r1       ;# Initialize stack & Enable interrupts
61 2 olivier.gi
        eint
62
        bis.b   #0x01,   &IE1
63
 
64
        mov.b   #0x02, &BCSCTL2	  ;# SMCLK = MCLK/2
65
        mov   #0x5a1b, &WDTCTL	  ;# Enable interval mode /64 & clear counter
66
        mov   #0x0001, r15
67
 
68 134 olivier.gi
        mov   #0x0470, r14
69 2 olivier.gi
        call  #WAIT_FUNC
70
 
71
        mov   #0x1000, r15
72 134 olivier.gi
        mov.b   #0x00, &BCSCTL2	  ;# SMCLK = MCLK
73 2 olivier.gi
 
74
 
75
        /* -------   WATCHDOG TEST INTERVAL MODE /64 - ACLK        ------ */
76
 
77 111 olivier.gi
        mov   #DMEM_250, r1       ;# Initialize stack & Enable interrupts
78 2 olivier.gi
        eint
79
        bis.b   #0x01,   &IE1
80
 
81
        mov.b   #0x00, &BCSCTL1	  ;# ACLK = LFXTCLK/1
82
        mov   #0x5a1f, &WDTCTL	  ;# Enable interval mode /64 & clear counter
83
        mov   #0x1001, r15
84
 
85
        mov   #0x1000, r14
86
        call  #WAIT_FUNC
87
 
88
        mov   #0x2000, r15
89
 
90
 
91
 
92
        /* ----------------------         END OF TEST        --------------- */
93
end_of_test:
94
        nop
95
        br #0xffff
96
 
97
 
98
        /* ----------------------      INTERRUPT ROUTINES    --------------- */
99
 
100
WDOG_VECTOR:
101
        xor  #0x0001, r5        ; # Toggle r5[0] for testbench stimulus check
102
        reti
103
 
104
 
105
        /* ----------------------         INTERRUPT VECTORS  --------------- */
106
 
107
.section .vectors, "a"
108
.word end_of_test  ; Interrupt  0 (lowest priority)    
109
.word end_of_test  ; Interrupt  1                      
110
.word end_of_test  ; Interrupt  2                      
111
.word end_of_test  ; Interrupt  3                      
112
.word end_of_test  ; Interrupt  4                      
113
.word end_of_test  ; Interrupt  5                      
114
.word end_of_test  ; Interrupt  6                      
115
.word end_of_test  ; Interrupt  7                      
116
.word end_of_test  ; Interrupt  8                      
117
.word end_of_test  ; Interrupt  9                      
118
.word WDOG_VECTOR  ; Interrupt 10                      Watchdog timer
119
.word end_of_test  ; Interrupt 11                      
120
.word end_of_test  ; Interrupt 12                      
121
.word end_of_test  ; Interrupt 13                      
122
.word end_of_test  ; Interrupt 14                      NMI
123
.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.