]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX113-RSK_Renesas_e2studio/src/cg_src/r_cg_cgc.h
6a32749c48a8c846a278a98b02422f212a80e1d1
[freertos] / FreeRTOS / Demo / RX113-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 RX113 V1.02.01.02 [28 May 2015]\r
23 * Device(s)    : R5F51138AxFP\r
24 * Tool-Chain   : CCRX\r
25 * Description  : This file implements device driver for CGC module.\r
26 * Creation Date: 21/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 /* System Clock (ICLK) */\r
54 #define _00000000_CGC_ICLK_DIV_1            (0x00000000UL) /* x1 */\r
55 #define _01000000_CGC_ICLK_DIV_2            (0x01000000UL) /* x1/2 */\r
56 #define _02000000_CGC_ICLK_DIV_4            (0x02000000UL) /* x1/4 */\r
57 #define _03000000_CGC_ICLK_DIV_8            (0x03000000UL) /* x1/8 */\r
58 #define _04000000_CGC_ICLK_DIV_16           (0x04000000UL) /* x1/16 */\r
59 #define _05000000_CGC_ICLK_DIV_32           (0x05000000UL) /* x1/32 */\r
60 #define _06000000_CGC_ICLK_DIV_64           (0x06000000UL) /* x1/64 */\r
61 /* System Clock (FCLK) */\r
62 #define _00000000_CGC_FCLK_DIV_1            (0x00000000UL) /* x1 */\r
63 #define _10000000_CGC_FCLK_DIV_2            (0x10000000UL) /* x1/2 */\r
64 #define _20000000_CGC_FCLK_DIV_4            (0x20000000UL) /* x1/4 */\r
65 #define _30000000_CGC_FCLK_DIV_8            (0x30000000UL) /* x1/8 */\r
66 #define _40000000_CGC_FCLK_DIV_16           (0x40000000UL) /* x1/16 */\r
67 #define _50000000_CGC_FCLK_DIV_32           (0x50000000UL) /* x1/32 */\r
68 #define _60000000_CGC_FCLK_DIV_64           (0x60000000UL) /* x1/64 */\r
69 \r
70 /*\r
71     System Clock Control Register 3 (SCKCR3)\r
72 */\r
73 #define _0000_CGC_CLOCKSOURCE_LOCO          (0x0000U) /* LOCO */\r
74 #define _0100_CGC_CLOCKSOURCE_HOCO          (0x0100U) /* HOCO */\r
75 #define _0200_CGC_CLOCKSOURCE_MAINCLK       (0x0200U) /* Main clock oscillator */\r
76 #define _0300_CGC_CLOCKSOURCE_SUBCLK        (0x0300U) /* Sub-clock oscillator */\r
77 #define _0400_CGC_CLOCKSOURCE_PLL           (0x0400U) /* PLL circuit */\r
78 \r
79 /*\r
80     PLL Control Register (PLLCR)\r
81 */\r
82 /* PLL Input Frequency Division Ratio Select (PLIDIV[1:0]) */\r
83 #define _0000_CGC_PLL_FREQ_DIV_1            (0x0000U) /* x1 */\r
84 #define _0001_CGC_PLL_FREQ_DIV_2            (0x0001U) /* x1/2 */\r
85 #define _0002_CGC_PLL_FREQ_DIV_4            (0x0002U) /* x1/4 */\r
86 /* Frequency Multiplication Factor Select (STC[5:0]) */\r
87 #define _0B00_CGC_PLL_FREQ_MUL_6            (0x0B00U) /* x6 */\r
88 #define _0F00_CGC_PLL_FREQ_MUL_8            (0x0F00U) /* x8 */\r
89 \r
90 /*\r
91     USB-dedicated PLL Control Register (UPLLCR)\r
92 */\r
93 /* USB-dedicated PLL Input Frequency Division Ratio Select (UPLIDIV[1:0]) */\r
94 #define _0000_CGC_PLL_UPLIDIV_1             (0x0000U) /* x1 */\r
95 #define _0001_CGC_PLL_UPLIDIV_2             (0x0001U) /* x1/2 */\r
96 #define _0002_CGC_PLL_UPLIDIV_4             (0x0002U) /* x1/4 */\r
97 /* UCLK Source USB-Dedicated PLL Select (UCKUPLLSEL) */\r
98 #define _0000_CGC_UCLK_SYSCLK               (0x0000U) /* System clock is selected as UCLK */\r
99 #define _0010_CGC_UCLK_USBPLL               (0x0010U) /* USB-dedicated PLL is selected as UCLK */\r
100 /* Frequency Multiplication Factor Select (USTC[5:0]) */\r
101 #define _0B00_CGC_PLL_USTC_6                (0x0B00U) /* x6 */\r
102 #define _0F00_CGC_PLL_USTC_8                (0x0F00U) /* x8 */\r
103 \r
104 /*\r
105     Oscillation Stop Detection Control Register (OSTDCR)\r
106 */\r
107 /* Oscillation Stop Detection Interrupt Enable (OSTDIE) */\r
108 #define _00_CGC_OSC_STOP_INT_DISABLE        (0x00U) /* The oscillation stop detection interrupt is disabled */\r
109 #define _01_CGC_OSC_STOP_INT_ENABLE         (0x01U) /* The oscillation stop detection interrupt is enabled */\r
110 /* Oscillation Stop Detection Function Enable (OSTDE) */\r
111 #define _00_CGC_OSC_STOP_DISABLE            (0x00U) /* Oscillation stop detection function is disabled */\r
112 #define _80_CGC_OSC_STOP_ENABLE             (0x80U) /* Oscillation stop detection function is enabled */\r
113 \r
114 /*\r
115     Main Clock Oscillator Wait Control Register (MOSCWTCR)\r
116 */\r
117 /* Main Clock Oscillator Wait Time (MSTS[4:0]) */\r
118 #define _00_CGC_OSC_WAIT_CYCLE_2            (0x00U) /* Wait time = 2 cycles */\r
119 #define _01_CGC_OSC_WAIT_CYCLE_1024         (0x01U) /* Wait time = 1024 cycles */\r
120 #define _02_CGC_OSC_WAIT_CYCLE_2048         (0x02U) /* Wait time = 2048 cycles */\r
121 #define _03_CGC_OSC_WAIT_CYCLE_4096         (0x03U) /* Wait time = 4096 cycles */\r
122 #define _04_CGC_OSC_WAIT_CYCLE_8192         (0x04U) /* Wait time = 8192 cycles */\r
123 #define _05_CGC_OSC_WAIT_CYCLE_16384        (0x05U) /* Wait time = 16384 cycles */\r
124 #define _06_CGC_OSC_WAIT_CYCLE_32768        (0x06U) /* Wait time = 32768 cycles */\r
125 #define _07_CGC_OSC_WAIT_CYCLE_65536        (0x07U) /* Wait time = 65536 cycles */\r
126 \r
127 /*\r
128     HOCO Wait Control Register (HOCOWTCR)\r
129 */\r
130 /* HOCO Wait Time (HOCOWTCR) */\r
131 #define _05_CGC_HOCO_WAIT_CYCLE_138         (0x05U) /* Wait time = 138 cycles (34.5us) */\r
132 #define _06_CGC_HOCO_WAIT_CYCLE_266         (0x06U) /* Wait time = 266 cycles (66.5us) */\r
133 \r
134 /*\r
135     Clock Output Control Register (CKOCR)\r
136 */\r
137 /* Clock Output Source Select (CKOSEL[2:0]) */\r
138 #define _0000_CGC_CLKOUT_LOCO               (0x0000U) /* LOCO */\r
139 #define _0100_CGC_CLKOUT_HOCO               (0x0100U) /* HOCO */\r
140 #define _0200_CGC_CLKOUT_MAINCLK            (0x0200U) /* Main clock oscillator */\r
141 #define _0300_CGC_CLKOUT_SUBCLK             (0x0300U) /* Sub-clock oscillator */\r
142 /* Clock Output Division Ratio Select (CKODIV[2:0]) */\r
143 #define _0000_CGC_CLKOUT_DIV_1              (0x0000U) /* x1 */\r
144 #define _1000_CGC_CLKOUT_DIV_2              (0x1000U) /* x1/2 */\r
145 #define _2000_CGC_CLKOUT_DIV_4              (0x2000U) /* x1/4 */\r
146 #define _3000_CGC_CLKOUT_DIV_8              (0x3000U) /* x1/8 */\r
147 #define _4000_CGC_CLKOUT_DIV_16             (0x4000U) /* x1/16 */\r
148 /* Clock Output Control (CKOSTP) */\r
149 #define _0000_CGC_CLKOUT_ENABLE             (0x0000U) /* CLKOUT pin output is operating */\r
150 #define _8000_CGC_CLKOUT_DISABLE            (0x8000U) /* CLKOUT pin output is stopped (fixed at low level) */\r
151 \r
152 /*\r
153     Main Clock Oscillator Forced Oscillation Control Register (MOFCR)\r
154 */\r
155 /* Main Oscillator Drive Capability Switch (MODRV21) */\r
156 #define _00_CGC_MAINOSC_UNDER10M            (0x00U) /* 1 MHz to 10 MHz */\r
157 #define _20_CGC_MAINOSC_OVER10M             (0x20U) /* 10 MHz to 20 MHz */\r
158 /* Main Clock Oscillator Switch (MOSEL) */\r
159 #define _00_CGC_MAINOSC_RESONATOR           (0x00U) /* Resonator */\r
160 #define _40_CGC_MAINOSC_EXTERNAL            (0x40U) /* External oscillator input */\r
161 \r
162 /*\r
163     LCD Source Clock Control Register (LCDSCLKCR)\r
164 */\r
165 /* LCD Source Clock Select (LCDSCLKSEL[2:0]) */\r
166 #define _00_CGC_LCDSCLKSEL_LOCO             (0x00U) /* LOCO */\r
167 #define _01_CGC_LCDSCLKSEL_HOCO             (0x01U) /* HOCO */\r
168 #define _02_CGC_LCDSCLKSEL_MAINCLK          (0x02U) /* Main clock oscillator */\r
169 #define _03_CGC_LCDSCLKSEL_SUBCLK           (0x03U) /* Sub-clock oscillator */\r
170 #define _04_CGC_LCDSCLKSEL_IWDT             (0x04U) /* IWDT-dedicated on-chip oscillator */\r
171 \r
172 \r
173 /***********************************************************************************************************************\r
174 Macro definitions\r
175 ***********************************************************************************************************************/\r
176 #define _007B_CGC_SUBSTPWT_WAIT             (0x007BU) /* Wait time for 5 sub clock cycles */\r
177 #define _00061A81_CGC_SUBOSCWT_WAIT         (0x00061A81U) /* Wait time for sub clock stable */\r
178 \r
179 /***********************************************************************************************************************\r
180 Typedef definitions\r
181 ***********************************************************************************************************************/\r
182 \r
183 /***********************************************************************************************************************\r
184 Global functions\r
185 ***********************************************************************************************************************/\r
186 void R_CGC_Create(void);\r
187 \r
188 /* Start user code for function. Do not edit comment generated here */\r
189 /* End user code. Do not edit comment generated here */\r
190 #endif