3 /*******************************************************************************
\r
5 * This software is supplied by Renesas Electronics Corporation and is only
\r
6 * intended for use with Renesas products. No other uses are authorized. This
\r
7 * software is owned by Renesas Electronics Corporation and is protected under
\r
8 * all applicable laws, including copyright laws.
\r
9 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
\r
10 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
\r
11 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
\r
12 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
\r
13 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
\r
14 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
\r
15 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
\r
16 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
\r
17 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
\r
18 * Renesas reserves the right, without notice, to make changes to this software
\r
19 * and to discontinue the availability of this software. By using this software,
\r
20 * you agree to the additional terms and conditions found by accessing the
\r
22 * http://www.renesas.com/disclaimer
\r
23 *******************************************************************************/
\r
29 * Created on: 01 Oct 2011
\r
31 * Reneses Electronics Europe Ltd
\r
38 /******************************************************************************
\r
40 ******************************************************************************/
\r
44 /*****************************************************************************/
\r
46 /* Set the CGC (Clock Generation Circuit of the RX630 using the */
\r
47 /* following 7 STEPS */
\r
49 /*****************************************************************************/
\r
52 /*****************************************************************************/
\r
54 /* STEP 1: System Clock Options */
\r
56 /* Enter one of the CLK_SOURCE_ options into the */
\r
58 /* #define CLK_SOURCE ( xxx ) */
\r
60 /* This will be the clock source that the device will switch to as part of */
\r
61 /* HardwareSetup() */
\r
62 /* Extra clocks can be enabled in STEP 3. */
\r
65 /* #define CLK_SOURCE (CLK_SOURCE_MAIN) */
\r
67 /*****************************************************************************/
\r
68 #define CLK_SOURCE_LOCO 0x0000
\r
69 #define CLK_SOURCE_HOCO 0x0100
\r
70 #define CLK_SOURCE_MAIN 0x0200
\r
71 #define CLK_SOURCE_SUB 0x0300
\r
72 #define CLK_SOURCE_PLL 0x0400
\r
74 #define CLK_SOURCE (CLK_SOURCE_PLL)
\r
77 /*****************************************************************************/
\r
79 /* STEP 2: External XTAL values */
\r
81 /* If using the CLK_SOURCE_MAIN, CLK_SOURCE_SUB, CLK_SOURCE_PLL */
\r
82 /* enter the MAIN XTAL and SUB XTAL values here. */
\r
84 /* If using the PLL, enter the PLL multiplier and PLL frequency divder */
\r
85 /* Use the divider so that the input frequency into the PLL is in */
\r
86 /* the range of 4 MHz to 16 MHz. */
\r
88 /* Use the multiplier so that the output frequency of the PLL is in */
\r
89 /* the range of 104MHz to 200Mhz */
\r
91 /* The PLL frequency divider values are: */
\r
93 /* The PLL muliplier values are: */
\r
94 /* x8, x10, x12, x16, x20, x24, x25, x50 */
\r
98 /* PLL Divider = 1 */
\r
100 /* Therefore, input into PLL = 12M / 1 */
\r
102 /* PLL Multipler = 16 */
\r
104 /* Therefore, ouput of PLL = 12M x 16 */
\r
107 /* NOTE: The maximum XTAL is 20MHz */
\r
108 /*****************************************************************************/
\r
109 #define XTAL_FREQUENCY (12000000L)
\r
110 #define PLL_MUL (16)
\r
111 #define PLL_INPUT_FREQ_DIV (1)
\r
113 #define SUB_FREQUENCY (32768L)
\r
116 /*****************************************************************************/
\r
118 /* STEP 3: Enable the chosen clock source and any extra clock sources */
\r
119 /* Remeber to enable the clock source chosen in STEP 1. */
\r
120 /* Foe example, if CLK_SOURCE_PLL has been chosen, set */
\r
121 /* #define ENABLE_PLL (1) */
\r
123 /*****************************************************************************/
\r
124 #define ENABLE_HOCO (1)
\r
125 #define ENABLE_SUB (0)
\r
126 #define ENABLE_MAIN (0)
\r
127 #define ENABLE_PLL (1)
\r
131 /*****************************************************************************/
\r
134 /* Enter the Clock Divders for */
\r
135 /* - FCLK_DIV, ICLK_DIV, BCLK_DIV, PCLKA_DIV, PCLKB_DIV */
\r
136 /* Valid values are 1, 2, 4, 8, 16, 32 and 64 */
\r
138 /* The Clock Value being divided is: */
\r
139 /* If LOCO, 125kHz */
\r
140 /* If HOCO, 50MHz */
\r
141 /* If SUB, the value of SUB specified in STEP 2 */
\r
142 /* If MAIN, the value of XTAL specified in STEP 2 */
\r
143 /* If PLL, the result of the XTAL, PLL Div, PLL Mul specified in STEP 2 */
\r
144 /*****************************************************************************/
\r
145 #define FCLK_DIV (4)
\r
146 #define ICLK_DIV (2)
\r
147 #define BCLK_DIV (4)
\r
148 #define PCLK1215_DIV (2) /* Do not change this */
\r
149 #define PCLKB_DIV (4)
\r
150 #define PCLK47_DIV (2) /* Do not change this */
\r
151 #define PCLK03_DIV (2) /* Do not change this */
\r
154 /*****************************************************************************/
\r
157 /* Enter the Clock Divder for */
\r
159 /* Valid values are 2, 4, 6, 8, 16, 32 and 64 */
\r
161 /* The Clock Value being divided is: */
\r
162 /* If LOCO, 125kHz */
\r
163 /* If HOCO, 50MHz */
\r
164 /* If SUB, the value of SUB specified in STEP 2 */
\r
165 /* If MAIN, the value of XTAL specified in STEP 2 */
\r
166 /* If PLL, the result of the XTAL, PLL Div, PLL Mul specified in STEP 2 */
\r
167 /*****************************************************************************/
\r
168 #define IEBCK_DIV (2)
\r
171 /*****************************************************************************/
\r
174 /* Enter the Clock Divder for */
\r
176 /* Valid values are 3, 4 */
\r
178 /* The Clock Value being divided is: */
\r
179 /* If LOCO, 125kHz */
\r
180 /* If HOCO, 50MHz */
\r
181 /* If SUB, the value of SUB specified in STEP 2 */
\r
182 /* If MAIN, the value of XTAL specified in STEP 2 */
\r
183 /* If PLL, the result of the XTAL, PLL Div, PLL Mul specified in STEP 2 */
\r
184 /*****************************************************************************/
\r
185 #define UCK_DIV (3)
\r
188 /*****************************************************************************/
\r
191 /* Specify the use of BCLK pin */
\r
192 /* To ENABLE, set to (0) */
\r
193 /* To DISABLE, set to (1) */
\r
195 /*****************************************************************************/
\r
196 #define BCLK_PIN (1)
\r
199 /*****************************************************************************/
\r
200 /* Clock configuration is now complete. */
\r
201 /*****************************************************************************/
\r
202 #include "cgc_set.h"
\r
203 #include "cgc_error.h"
\r