]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/cg_src/r_cg_cgc.h
FreeRTOS source:
[freertos] / FreeRTOS / Demo / RX200_RX231-RSK_Renesas_e2studio / src / cg_src / r_cg_cgc.h
1 /***********************************************************************************************************************\r
2 * DISCLAIMER\r
3 * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.\r
4 * No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all\r
5 * applicable laws, including copyright laws. \r
6 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED\r
7 * OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
8 * NON-INFRINGEMENT.  ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY\r
9 * LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,\r
10 * INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR\r
11 * ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
12 * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability \r
13 * of this software. By using this software, you agree to the additional terms and conditions found by accessing the \r
14 * following link:\r
15 * http://www.renesas.com/disclaimer\r
16 *\r
17 * Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved.\r
18 ***********************************************************************************************************************/\r
19 \r
20 /***********************************************************************************************************************\r
21 * File Name    : r_cg_cgc.h\r
22 * Version      : Code Generator for RX231 V1.00.00.03 [10 Jul 2015]\r
23 * Device(s)    : R5F52318AxFP\r
24 * Tool-Chain   : CCRX\r
25 * Description  : This file implements device driver for CGC module.\r
26 * Creation Date: 23/09/2015\r
27 ***********************************************************************************************************************/\r
28 #ifndef CGC_H\r
29 #define CGC_H\r
30 \r
31 /***********************************************************************************************************************\r
32 Macro definitions (Register bit)\r
33 ***********************************************************************************************************************/\r
34 /*\r
35     System Clock Control Register (SCKCR)\r
36 */\r
37 /* Peripheral Module Clock D (PCLKD) */\r
38 #define _00000000_CGC_PCLKD_DIV_1           (0x00000000UL) /* x1 */\r
39 #define _00000001_CGC_PCLKD_DIV_2           (0x00000001UL) /* x1/2 */\r
40 #define _00000002_CGC_PCLKD_DIV_4           (0x00000002UL) /* x1/4 */\r
41 #define _00000003_CGC_PCLKD_DIV_8           (0x00000003UL) /* x1/8 */\r
42 #define _00000004_CGC_PCLKD_DIV_16          (0x00000004UL) /* x1/16 */\r
43 #define _00000005_CGC_PCLKD_DIV_32          (0x00000005UL) /* x1/32 */\r
44 #define _00000006_CGC_PCLKD_DIV_64          (0x00000006UL) /* x1/64 */\r
45 /* Peripheral Module Clock B (PCLKB) */\r
46 #define _00000000_CGC_PCLKB_DIV_1           (0x00000000UL) /* x1 */\r
47 #define _00000100_CGC_PCLKB_DIV_2           (0x00000100UL) /* x1/2 */\r
48 #define _00000200_CGC_PCLKB_DIV_4           (0x00000200UL) /* x1/4 */\r
49 #define _00000300_CGC_PCLKB_DIV_8           (0x00000300UL) /* x1/8 */\r
50 #define _00000400_CGC_PCLKB_DIV_16          (0x00000400UL) /* x1/16 */\r
51 #define _00000500_CGC_PCLKB_DIV_32          (0x00000500UL) /* x1/32 */\r
52 #define _00000600_CGC_PCLKB_DIV_64          (0x00000600UL) /* x1/64 */\r
53 /* Peripheral Module Clock A (PCLKA) */\r
54 #define _00000000_CGC_PCLKA_DIV_1           (0x00000000UL) /* x1 */\r
55 #define _00001000_CGC_PCLKA_DIV_2           (0x00001000UL) /* x1/2 */\r
56 #define _00002000_CGC_PCLKA_DIV_4           (0x00002000UL) /* x1/4 */\r
57 #define _00003000_CGC_PCLKA_DIV_8           (0x00003000UL) /* x1/8 */\r
58 #define _00004000_CGC_PCLKA_DIV_16          (0x00004000UL) /* x1/16 */\r
59 #define _00005000_CGC_PCLKA_DIV_32          (0x00005000UL) /* x1/32 */\r
60 #define _00006000_CGC_PCLKA_DIV_64          (0x00006000UL) /* x1/64 */\r
61 /* External Bus Clock (BCLK) */\r
62 #define _00000000_CGC_BCLK_DIV_1            (0x00000000UL) /* x1 */\r
63 #define _00010000_CGC_BCLK_DIV_2            (0x00010000UL) /* x1/2 */\r
64 #define _00020000_CGC_BCLK_DIV_4            (0x00020000UL) /* x1/4 */\r
65 #define _00030000_CGC_BCLK_DIV_8            (0x00030000UL) /* x1/8 */\r
66 #define _00040000_CGC_BCLK_DIV_16           (0x00040000UL) /* x1/16 */\r
67 #define _00050000_CGC_BCLK_DIV_32           (0x00050000UL) /* x1/32 */\r
68 #define _00060000_CGC_BCLK_DIV_64           (0x00060000UL) /* x1/64 */\r
69 /* System Clock (ICLK) */\r
70 #define _00000000_CGC_ICLK_DIV_1            (0x00000000UL) /* x1 */\r
71 #define _01000000_CGC_ICLK_DIV_2            (0x01000000UL) /* x1/2 */\r
72 #define _02000000_CGC_ICLK_DIV_4            (0x02000000UL) /* x1/4 */\r
73 #define _03000000_CGC_ICLK_DIV_8            (0x03000000UL) /* x1/8 */\r
74 #define _04000000_CGC_ICLK_DIV_16           (0x04000000UL) /* x1/16 */\r
75 #define _05000000_CGC_ICLK_DIV_32           (0x05000000UL) /* x1/32 */\r
76 #define _06000000_CGC_ICLK_DIV_64           (0x06000000UL) /* x1/64 */\r
77 /* System Clock (FCLK) */\r
78 #define _00000000_CGC_FCLK_DIV_1            (0x00000000UL) /* x1 */\r
79 #define _10000000_CGC_FCLK_DIV_2            (0x10000000UL) /* x1/2 */\r
80 #define _20000000_CGC_FCLK_DIV_4            (0x20000000UL) /* x1/4 */\r
81 #define _30000000_CGC_FCLK_DIV_8            (0x30000000UL) /* x1/8 */\r
82 #define _40000000_CGC_FCLK_DIV_16           (0x40000000UL) /* x1/16 */\r
83 #define _50000000_CGC_FCLK_DIV_32           (0x50000000UL) /* x1/32 */\r
84 #define _60000000_CGC_FCLK_DIV_64           (0x60000000UL) /* x1/64 */\r
85 \r
86 /*\r
87     System Clock Control Register 3 (SCKCR3)\r
88 */\r
89 #define _0000_CGC_CLOCKSOURCE_LOCO          (0x0000U) /* LOCO */\r
90 #define _0100_CGC_CLOCKSOURCE_HOCO          (0x0100U) /* HOCO */\r
91 #define _0200_CGC_CLOCKSOURCE_MAINCLK       (0x0200U) /* Main clock oscillator */\r
92 #define _0300_CGC_CLOCKSOURCE_SUBCLK        (0x0300U) /* Sub-clock oscillator */\r
93 #define _0400_CGC_CLOCKSOURCE_PLL           (0x0400U) /* PLL circuit */\r
94 \r
95 /*\r
96     PLL Control Register (PLLCR)\r
97 */\r
98 /* PLL Input Frequency Division Ratio Select (PLIDIV[1:0]) */\r
99 #define _0000_CGC_PLL_FREQ_DIV_1            (0x0000U) /* x1 */\r
100 #define _0001_CGC_PLL_FREQ_DIV_2            (0x0001U) /* x1/2 */\r
101 #define _0002_CGC_PLL_FREQ_DIV_4            (0x0002U) /* x1/4 */\r
102 /* Frequency Multiplication Factor Select (STC[5:0]) */\r
103 #define _0700_CGC_PLL_FREQ_MUL_4_0          (0x0700U) /* x4 */\r
104 #define _0800_CGC_PLL_FREQ_MUL_4_5          (0x0800U) /* x4.5 */\r
105 #define _0900_CGC_PLL_FREQ_MUL_5_0          (0x0900U) /* x5 */\r
106 #define _0A00_CGC_PLL_FREQ_MUL_5_5          (0x0A00U) /* x5.5 */\r
107 #define _0B00_CGC_PLL_FREQ_MUL_6_0          (0x0B00U) /* x6 */\r
108 #define _0C00_CGC_PLL_FREQ_MUL_6_5          (0x0C00U) /* x6.5 */\r
109 #define _0D00_CGC_PLL_FREQ_MUL_7_0          (0x0D00U) /* x7 */\r
110 #define _0E00_CGC_PLL_FREQ_MUL_7_5          (0x0E00U) /* x7.5 */\r
111 #define _0F00_CGC_PLL_FREQ_MUL_8_0          (0x0F00U) /* x8 */\r
112 #define _1000_CGC_PLL_FREQ_MUL_8_5          (0x1000U) /* x8.5 */\r
113 #define _1100_CGC_PLL_FREQ_MUL_9_0          (0x1100U) /* x9 */\r
114 #define _1200_CGC_PLL_FREQ_MUL_9_5          (0x1200U) /* x9.5 */\r
115 #define _1300_CGC_PLL_FREQ_MUL_10_0         (0x1300U) /* x10 */\r
116 #define _1400_CGC_PLL_FREQ_MUL_10_5         (0x1400U) /* x10.5 */\r
117 #define _1500_CGC_PLL_FREQ_MUL_11_0         (0x1500U) /* x11 */\r
118 #define _1600_CGC_PLL_FREQ_MUL_11_5         (0x1600U) /* 11.5 */\r
119 #define _1700_CGC_PLL_FREQ_MUL_12_0         (0x1700U) /* x12 */\r
120 #define _1800_CGC_PLL_FREQ_MUL_12_5         (0x1800U) /* x12.5 */\r
121 #define _1900_CGC_PLL_FREQ_MUL_13_0         (0x1900U) /* x13 */\r
122 #define _1A00_CGC_PLL_FREQ_MUL_13_5         (0x1A00U) /* x13.5 */\r
123 /*\r
124     USB-dedicated PLL Control Register (UPLLCR)\r
125 */\r
126 /* USB-dedicated PLL Input Frequency Division Ratio Select (UPLIDIV[1:0]) */\r
127 #define _0000_CGC_UPLL_DIV_1                (0x0000U) /* x1 */\r
128 #define _0001_CGC_UPLL_DIV_2                (0x0001U) /* x1/2 */\r
129 #define _0002_CGC_UPLL_DIV_4                (0x0002U) /* x1/4 */\r
130 /* UCLK Source USB-Dedicated PLL Select (UCKUPLLSEL) */\r
131 #define _0000_CGC_UCLK_SYSCLK               (0x0000U) /* System clock is selected as UCLK */\r
132 #define _0010_CGC_UCLK_USBPLL               (0x0010U) /* USB-dedicated PLL is selected as UCLK */\r
133 /* Frequency Multiplication Factor Select (USTC[5:0]) */\r
134 #define _0700_CGC_UPLL_MUL_4                (0x0700U) /* x4 */\r
135 #define _0B00_CGC_UPLL_MUL_6                (0x0B00U) /* x6 */\r
136 #define _0F00_CGC_UPLL_MUL_8                (0x0F00U) /* x8 */\r
137 #define _1700_CGC_UPLL_MUL_12               (0x1700U) /* x12 */\r
138 \r
139 /*\r
140     High-Speed On-Chip Oscillator Control Register 2 (HOCOCR2)\r
141 */\r
142 /* HOCO Frequency Setting (HCFRQ[1:0]) */\r
143 #define _00_CGC_HOCO_CLK_32                 (0x00U) /* 32 MHz */\r
144 #define _03_CGC_HOCO_CLK_54                 (0x03U) /* 54 MHz */\r
145 \r
146 /*\r
147     Oscillation Stop Detection Control Register (OSTDCR)\r
148 */\r
149 /* Oscillation Stop Detection Interrupt Enable (OSTDIE) */\r
150 #define _00_CGC_OSC_STOP_INT_DISABLE        (0x00U) /* The oscillation stop detection interrupt is disabled */\r
151 #define _01_CGC_OSC_STOP_INT_ENABLE         (0x01U) /* The oscillation stop detection interrupt is enabled */\r
152 /* Oscillation Stop Detection Function Enable (OSTDE) */\r
153 #define _00_CGC_OSC_STOP_DISABLE            (0x00U) /* Oscillation stop detection function is disabled */\r
154 #define _80_CGC_OSC_STOP_ENABLE             (0x80U) /* Oscillation stop detection function is enabled */\r
155 \r
156 /*\r
157     Main Clock Oscillator Wait Control Register (MOSCWTCR)\r
158 */\r
159 /* Main Clock Oscillator Wait Time (MSTS[4:0]) */\r
160 #define _00_CGC_OSC_WAIT_CYCLE_2            (0x00U) /* Wait time = 2 cycles */\r
161 #define _01_CGC_OSC_WAIT_CYCLE_1024         (0x01U) /* Wait time = 1024 cycles */\r
162 #define _02_CGC_OSC_WAIT_CYCLE_2048         (0x02U) /* Wait time = 2048 cycles */\r
163 #define _03_CGC_OSC_WAIT_CYCLE_4096         (0x03U) /* Wait time = 4096 cycles */\r
164 #define _04_CGC_OSC_WAIT_CYCLE_8192         (0x04U) /* Wait time = 8192 cycles */\r
165 #define _05_CGC_OSC_WAIT_CYCLE_16384        (0x05U) /* Wait time = 16384 cycles */\r
166 #define _06_CGC_OSC_WAIT_CYCLE_32768        (0x06U) /* Wait time = 32768 cycles */\r
167 #define _07_CGC_OSC_WAIT_CYCLE_65536        (0x07U) /* Wait time = 65536 cycles */\r
168 \r
169 /*\r
170     Clock Output Control Register (CKOCR)\r
171 */\r
172 /* Clock Output Source Select (CKOSEL[2:0]) */\r
173 #define _0000_CGC_CLKOUT_LOCO               (0x0000U) /* LOCO */\r
174 #define _0100_CGC_CLKOUT_HOCO               (0x0100U) /* HOCO */\r
175 #define _0200_CGC_CLKOUT_MAINCLK            (0x0200U) /* Main clock oscillator */\r
176 #define _0300_CGC_CLKOUT_SUBCLK             (0x0300U) /* Sub-clock oscillator */\r
177 #define _0400_CGC_CLKOUT_PLLCLK             (0x0400U) /* PLL clock oscillator */\r
178 /* Clock Output Division Ratio Select (CKODIV[2:0]) */\r
179 #define _0000_CGC_CLKOUT_DIV_1              (0x0000U) /* x1 */\r
180 #define _1000_CGC_CLKOUT_DIV_2              (0x1000U) /* x1/2 */\r
181 #define _2000_CGC_CLKOUT_DIV_4              (0x2000U) /* x1/4 */\r
182 #define _3000_CGC_CLKOUT_DIV_8              (0x3000U) /* x1/8 */\r
183 #define _4000_CGC_CLKOUT_DIV_16             (0x4000U) /* x1/16 */\r
184 /* Clock Output Control (CKOSTP) */\r
185 #define _0000_CGC_CLKOUT_ENABLE             (0x0000U) /* CLKOUT pin output is operating */\r
186 #define _8000_CGC_CLKOUT_DISABLE            (0x8000U) /* CLKOUT pin output is stopped (fixed at low level) */\r
187 \r
188 /*\r
189     Main Clock Oscillator Forced Oscillation Control Register (MOFCR)\r
190 */\r
191 /* Main Oscillator Drive Capability Switch (MODRV21) */\r
192 #define _00_CGC_MAINOSC_UNDER10M            (0x00U) /* 1 MHz to 10 MHz */\r
193 #define _20_CGC_MAINOSC_OVER10M             (0x20U) /* 10 MHz to 20 MHz */\r
194 /* Main Clock Oscillator Switch (MOSEL) */\r
195 #define _00_CGC_MAINOSC_RESONATOR           (0x00U) /* Resonator */\r
196 #define _40_CGC_MAINOSC_EXTERNAL            (0x40U) /* External oscillator input */\r
197 \r
198 /*\r
199     Low-power timer control register 1 (LPTCR1)\r
200 */\r
201 /* Low-Power Timer Clock Division Ratio Select (LPCNTPSSEL[2:0]) */\r
202 #define _01_CGC_LPT_CLK_DIV_2               (0x01U) /* x1/2 */\r
203 #define _02_CGC_LPT_CLK_DIV_4               (0x02U) /* x1/4 */\r
204 #define _03_CGC_LPT_CLK_DIV_8               (0x03U) /* x1/8 */\r
205 #define _04_CGC_LPT_CLK_DIV_16              (0x04U) /* x1/16 */\r
206 #define _05_CGC_LPT_CLK_DIV_32              (0x05U) /* x1/32 */\r
207 /* Low-Power Timer Clock Source Select (LPCNTCKSEL) */\r
208 #define _00_CGC_LPT_SOURCE_SUB              (0x00U) /* Sub-clock */\r
209 #define _10_CGC_LPT_SOURCE_IWDT             (0x10U) /* IWDT-dedicated on-chip */\r
210 \r
211 \r
212 /***********************************************************************************************************************\r
213 Macro definitions\r
214 ***********************************************************************************************************************/\r
215 \r
216 /***********************************************************************************************************************\r
217 Typedef definitions\r
218 ***********************************************************************************************************************/\r
219 \r
220 /***********************************************************************************************************************\r
221 Global functions\r
222 ***********************************************************************************************************************/\r
223 void R_CGC_Create(void);\r
224 \r
225 /* Start user code for function. Do not edit comment generated here */\r
226 /* End user code. Do not edit comment generated here */\r
227 #endif