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