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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [sh/] [sh4/] [current/] [include/] [mod_regs_cpg.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//=============================================================================
2
//
3
//      mod_regs_cpg.h
4
//
5
//      CPG (clock pulse generator) Module register definitions
6
//
7
//=============================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//=============================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):   jskov
43
// Contributors:jskov, nickg
44
// Date:        2000-10-30
45
//              
46
//####DESCRIPTIONEND####
47
//
48
//=============================================================================
49
 
50
//--------------------------------------------------------------------------
51
// Oscillator control registers
52
#define CYGARC_REG_FRQCR                0xFFC00000
53
#define CYGARC_REG_STBCR                0xFFC00004
54
#define CYGARC_REG_WTCNT                0xFFC00008 // read 8bit, write 16bit
55
#define CYGARC_REG_WTCSR                0xFFC0000C // read 8bit, write 16bit
56
#define CYGARC_REG_STBCR2               0xFFC00010
57
 
58
#ifdef CYGPKG_HAL_SH_202
59
#define CYGARC_REG_FRQCR3               0xFE0A0018
60
#endif
61
 
62
#define CYGARC_REG_WTCNT_WRITE          0x5a00     // top 8bit value for write
63
 
64
#define CYGARC_REG_WTCSR_WRITE          0xa500     // top 8bit value for write
65
#define CYGARC_REG_WTCSR_TME            0x80       // timer enable
66
#define CYGARC_REG_WTCSR_WT_IT          0x40       // watchdog(1)/interval(0)
67
#define CYGARC_REG_WTCSR_RSTS           0x20       // manual(1)/poweron(0)
68
#define CYGARC_REG_WTCSR_WOVF           0x10       // watchdog overflow
69
#define CYGARC_REG_WTCSR_IOVF           0x08       // interval overflow
70
#define CYGARC_REG_WTCSR_CKS2           0x04       // clock select 2
71
#define CYGARC_REG_WTCSR_CKS1           0x02       // clock select 1
72
#define CYGARC_REG_WTCSR_CKS0           0x01       // clock select 0
73
#define CYGARC_REG_WTCSR_CKSx_MASK      0x07       // clock select mask
74
// This is the period (in us) between watchdog reset and overflow.
75
// Note: We use max timeout delay for now.
76
#define CYGARC_REG_WTCSR_CKSx_SETTING   0x07       // max delay
77
 
78
#define CYGARC_REG_WTCSR_PERIOD         ((1000000000/(CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/4096))*256)
79
 
80
// Translate various CDL clock configurations to register equivalents
81
// for the various CPG versions
82
#if   (CYGARC_SH_MOD_CPG == 1) // ---------------------------- V1
83
 
84
// PLL1
85
#if   (CYGHWR_HAL_SH_OOC_PLL_1 == 0)
86
# define CYGARC_REG_FRQCR_INIT_PLL1 0x0000
87
#elif (CYGHWR_HAL_SH_OOC_PLL_1 == 4)
88
# define CYGARC_REG_FRQCR_INIT_PLL1 0x0400
89
#elif (CYGHWR_HAL_SH_OOC_PLL_1 == 6)
90
# define CYGARC_REG_FRQCR_INIT_PLL1 0x0400
91
#elif (CYGHWR_HAL_SH_OOC_PLL_1 == 8)
92
# define CYGARC_REG_FRQCR_INIT_PLL1 0x0400
93
#elif (CYGHWR_HAL_SH_OOC_PLL_1 == 12)
94
# define CYGARC_REG_FRQCR_INIT_PLL1 0x0400
95
#else
96
# error "Unsupported PLL1 setting"
97
#endif
98
 
99
// PLL2
100
#if   (CYGHWR_HAL_SH_OOC_PLL_2 == 0)
101
# define CYGARC_REG_FRQCR_INIT_PLL2 0x0000
102
#elif (CYGHWR_HAL_SH_OOC_PLL_2 == 1)
103
# define CYGARC_REG_FRQCR_INIT_PLL2 0x0200
104
#else
105
# error "Unsupported PLL2 setting"
106
#endif
107
 
108
// Divider IFC
109
#if   (CYGHWR_HAL_SH_OOC_DIVIDER_IFC == 1)
110
# define CYGARC_REG_FRQCR_INIT_DIVIDER_IFC 0x0000
111
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_IFC == 2)
112
# define CYGARC_REG_FRQCR_INIT_DIVIDER_IFC 0x0040
113
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_IFC == 3)
114
# define CYGARC_REG_FRQCR_INIT_DIVIDER_IFC 0x0080
115
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_IFC == 4)
116
# define CYGARC_REG_FRQCR_INIT_DIVIDER_IFC 0x00c0
117
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_IFC == 6)
118
# define CYGARC_REG_FRQCR_INIT_DIVIDER_IFC 0x0100
119
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_IFC == 8)
120
# define CYGARC_REG_FRQCR_INIT_DIVIDER_IFC 0x0140
121
#else
122
# error "Unsupported Divider IFC setting"
123
#endif
124
 
125
// Divider BFC
126
#if   (CYGHWR_HAL_SH_OOC_DIVIDER_BFC == 1)
127
# define CYGARC_REG_FRQCR_INIT_DIVIDER_BFC 0x0000
128
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_BFC == 2)
129
# define CYGARC_REG_FRQCR_INIT_DIVIDER_BFC 0x0008
130
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_BFC == 3)
131
# define CYGARC_REG_FRQCR_INIT_DIVIDER_BFC 0x0010
132
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_BFC == 4)
133
# define CYGARC_REG_FRQCR_INIT_DIVIDER_BFC 0x0018
134
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_BFC == 6)
135
# define CYGARC_REG_FRQCR_INIT_DIVIDER_BFC 0x0020
136
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_BFC == 8)
137
# define CYGARC_REG_FRQCR_INIT_DIVIDER_BFC 0x0028
138
#else
139
# error "Unsupported Divider BFC setting"
140
#endif
141
 
142
// Divider PFC
143
#if (CYGHWR_HAL_SH_OOC_DIVIDER_PFC == 2)
144
# define CYGARC_REG_FRQCR_INIT_DIVIDER_PFC 0x0000
145
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_PFC == 3)
146
# define CYGARC_REG_FRQCR_INIT_DIVIDER_PFC 0x0001
147
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_PFC == 4)
148
# define CYGARC_REG_FRQCR_INIT_DIVIDER_PFC 0x0002
149
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_PFC == 6)
150
# define CYGARC_REG_FRQCR_INIT_DIVIDER_PFC 0x0003
151
#elif (CYGHWR_HAL_SH_OOC_DIVIDER_PFC == 8)
152
# define CYGARC_REG_FRQCR_INIT_DIVIDER_PFC 0x0004
153
#else
154
# error "Unsupported Divider PFC setting"
155
#endif
156
 
157
 
158
// CKOEN
159
#ifdef CYGHWR_HAL_SH_OOC_CKIO
160
# define CYGARC_REG_FRQCR_INIT_CKOEN 0x0800
161
#else
162
# define CYGARC_REG_FRQCR_INIT_CKOEN 0x0000
163
#endif
164
 
165
#else
166
 
167
# error "Unsupported CPG version"
168
 
169
#endif
170
 
171
// Init value
172
#define CYGARC_REG_FRQCR_INIT (CYGARC_REG_FRQCR_INIT_PLL1|CYGARC_REG_FRQCR_INIT_PLL2|CYGARC_REG_FRQCR_INIT_DIVIDER_IFC|CYGARC_REG_FRQCR_INIT_DIVIDER_BFC|CYGARC_REG_FRQCR_INIT_DIVIDER_PFC|CYGARC_REG_FRQCR_INIT_CKOEN)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.