]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX100-RSK_IAR/Renesas_Files/r_bsp/r_bsp_config.h
Commit 3 RX100 low power demos.
[freertos] / FreeRTOS / Demo / RX100-RSK_IAR / Renesas_Files / r_bsp / r_bsp_config.h
1 /***********************************************************************************************************************\r
2 * DISCLAIMER\r
3 * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No\r
4 * 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 WARRANTIES REGARDING\r
7 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,\r
8 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM\r
9 * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES\r
10 * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS\r
11 * SOFTWARE, EVEN IF RENESAS OR 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 of\r
13 * 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) 2012 Renesas Electronics Corporation. All rights reserved.\r
18 ***********************************************************************************************************************/\r
19 /***********************************************************************************************************************\r
20 * File Name    : r_bsp_config_reference.c\r
21 * Device(s)    : RX111\r
22 * Description  : The file r_bsp_config.h is used to configure your BSP. r_bsp_config.h should be included\r
23 *                somewhere in your package so that the r_bsp code has access to it. This file (r_bsp_config_reference.h)\r
24 *                is just a reference file that the user can use to make their own r_bsp_config.h file.\r
25 ************************************************************************************************************************\r
26 * History : DD.MM.YYYY Version Description\r
27 *         : 07.11.2012 0.01    Beta Release\r
28 ***********************************************************************************************************************/\r
29 #ifndef R_BSP_CONFIG_REF_HEADER_FILE\r
30 #define R_BSP_CONFIG_REF_HEADER_FILE\r
31 \r
32 /***********************************************************************************************************************\r
33 Configuration Options\r
34 ***********************************************************************************************************************/\r
35 /* Enter the product part number for your MCU. This information will be used to obtain information about your MCU such\r
36    as package and memory size.\r
37    To help parse this information, the part number will be defined using multiple macros.\r
38    R 5 F 51 11 5 A D FM\r
39    | | | |  |  | | | |  Macro Name              Description\r
40    | | | |  |  | | | |__MCU_PART_PACKAGE      = Package type, number of pins, and pin pitch\r
41    | | | |  |  | | |____not used              = Products with wide temperature range (D: -40 to 85C G: -40 to 105C)\r
42    | | | |  |  | |______not used              = Blank\r
43    | | | |  |  |________MCU_PART_MEMORY_SIZE  = ROM, RAM, and Data Flash Capacity\r
44    | | | |  |___________MCU_PART_GROUP        = Group name\r
45    | | | |______________MCU_PART_SERIES       = Series name\r
46    | | |________________MCU_PART_MEMORY_TYPE  = Type of memory (Flash)\r
47    | |__________________not used              = Renesas MCU\r
48    |____________________not used              = Renesas semiconductor product.\r
49    */\r
50 \r
51 /* Package type. Set the macro definition based on values below:\r
52    Character(s) = Value for macro = Package Type/Number of Pins/Pin Pitch\r
53    FM           = 0x0             = LFQFP/64/0.50\r
54    FK           = 0x1             = LQFP/64/0.80\r
55    LF           = 0x2             = TFLGA/64/0.50\r
56    FL           = 0x3             = LFQFP/48/0.50\r
57    NE           = 0x4             = VQFN/48/0.50\r
58    NC           = 0x5             = HWQFN/36/0.50\r
59    LM           = 0x6             = WFLGA/36/0.50\r
60    SB           = 0x7             = SSOP/36/0.80\r
61 */\r
62 #define MCU_PART_PACKAGE        (0x0)\r
63 \r
64 /* ROM, RAM, and Data Flash Capacity.\r
65    Character(s) = Value for macro = ROM Size/Ram Size/Data Flash Size\r
66    5            = 0x5             = 128KB/16KB/8KB\r
67    4            = 0x4             = 96KB/16KB/8KB\r
68    3            = 0x3             = 64KB/10KB/8KB\r
69    1            = 0x1             = 32KB/10KB/8KB\r
70    J            = 0x0             = 16KB/8KB/8KB\r
71 */\r
72 #define MCU_PART_MEMORY_SIZE    (0x5)\r
73 \r
74 /* Group name.\r
75    Character(s) = Value for macro = Description\r
76    10           = 0x0             = RX110 Group\r
77    11           = 0x1             = RX111 Group\r
78 */\r
79 #define MCU_PART_GROUP          (0x1)\r
80 \r
81 /* Series name.\r
82    Character(s) = Value for macro = Description\r
83    51           = 0x0             = RX100 Series\r
84 */\r
85 #define MCU_PART_SERIES         (0x0)\r
86 \r
87 /* Memory type.\r
88    Character(s) = Value for macro = Description\r
89    F            = 0x0             = Flash memory version\r
90 */\r
91 #define MCU_PART_MEMORY_TYPE    (0x0)\r
92 \r
93 /* The 'BSP_DECLARE_STACK' macro is checked so that the stack is only declared in one place (resetprg.c). Every time a\r
94    '#pragma stacksize' is encountered, the stack size is increased. This prevents multiplication of stack size. */\r
95 #if defined(BSP_DECLARE_STACK)\r
96 /* User Stack size in bytes. The Renesas RX toolchain sets the stack size using the #pragma stacksize directive. */\r
97 #pragma stacksize su=0x400\r
98 /* Interrupt Stack size in bytes. The Renesas RX toolchain sets the stack size using the #pragma stacksize directive. */\r
99 #pragma stacksize si=0x100\r
100 #endif\r
101 \r
102 /* Heap size in bytes. */\r
103 #define HEAP_BYTES              (0x001)\r
104 \r
105 /* After reset MCU will operate in Supervisor mode. To switch to User mode, set this macro to '1'. For more information\r
106    on the differences between these 2 modes see the CPU >> Processor Mode section of your MCU's hardware manual.\r
107    0 = Stay in Supervisor mode.\r
108    1 = Switch to User mode.\r
109 */\r
110 #define RUN_IN_USER_MODE        (0)\r
111 \r
112 \r
113 /* This macro lets other modules no if a RTOS is being used.\r
114    0 = RTOS is not used.\r
115    1 = RTOS is used.\r
116 */\r
117 #define RTOS_USED               (0)\r
118 \r
119 /* Clock source select (CKSEL).\r
120    0 = Low Speed On-Chip Oscillator  (LOCO)\r
121    1 = High Speed On-Chip Oscillator (HOCO)\r
122    2 = Main Clock Oscillator\r
123    3 = Sub-Clock Oscillator\r
124    4 = PLL Circuit\r
125 */\r
126 #define CLOCK_SOURCE            (4)     // GI org 4\r
127 \r
128 /* Clock configuration options.\r
129    The input clock frequency is specified and then the system clocks are set by specifying the multipliers used. The\r
130    multiplier settings are used to set the clock registers in resetprg.c. If a 16MHz clock is used and the\r
131    ICLK is 24MHz, PCLKB is 24MHz, FCLK is 24MHz, PCLKD is 24MHz, and CKO is 1MHz then the\r
132    settings would be:\r
133 \r
134    XTAL_HZ = 16000000\r
135    PLL_DIV = 2\r
136    PLL_MUL = 6 (16MHz x 3 = 48MHz)\r
137    ICK_DIV =  2      : System Clock (ICLK)        = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / ICK_DIV)  = 24MHz\r
138    PCKB_DIV = 2      : Peripheral Clock B (PCLKB) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKB_DIV) = 24MHz\r
139    PCKD_DIV = 2      : Peripheral Clock D (PCLKD) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKD_DIV) = 24MHz\r
140    FCK_DIV =  2      : Flash IF Clock (FCLK)      = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / FCK_DIV)  = 24MHz\r
141 */\r
142 /* XTAL - Input clock frequency in Hz */\r
143 #define XTAL_HZ                 (16000000)\r
144 /* PLL Input Frequency Divider Select (PLIDIV).\r
145    Available divisors = /1 (no division), /2, /4\r
146 */\r
147 #define PLL_DIV                 (2)             // GI org 2\r
148 /* PLL Frequency Multiplication Factor Select (STC).\r
149    Available multipliers = x6, x8\r
150 */\r
151 #define PLL_MUL                 (6)             // GI org 6\r
152 /* System Clock Divider (ICK).\r
153    Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64\r
154 */\r
155 #define ICK_DIV                 (2)             // NOTE: ICLK CANNOT BE SLOWER THAN PCLK!\r
156 /* Peripheral Module Clock B Divider (PCKB).\r
157    Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64\r
158 */\r
159 #define PCKB_DIV                (2)             // GI org 2\r
160 /* Peripheral Module Clock D Divider (PCKD).\r
161    Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64\r
162 */\r
163 #define PCKD_DIV                (2)\r
164 /* Flash IF Clock Divider (FCK).\r
165    Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64\r
166 */\r
167 #define FCK_DIV                 (2)\r
168 \r
169 /* Below are callback functions that can be used for detecting MCU exceptions, undefined interrupt sources, and\r
170    bus errors. If the user wishes to be alerted of these events then they will need to define the macro as a\r
171    function to be called when the event occurs. For example, if the user wanted the function\r
172    excep_undefined_instr_isr() to be called when an undefined interrupt source ISR is triggered then they would\r
173    do the following:\r
174    #define UNDEFINED_INT_ISR_CALLBACK   undefined_interrupt_cb\r
175    If the user does not wish to be alerted of these events then they should comment out the macros.\r
176 \r
177    NOTE: When a callback function is called it will be called from within a ISR. This means that the function\r
178          will essentially be an interrupt and will hold off other interrupts that occur in the system while it\r
179          is executing. For this reason, it is recommended to keep these callback functions short as to not\r
180          decrease the real-time response of your system.\r
181 */\r
182 /* Callback for Supervisor Instruction Violation Exception. */\r
183 //#define EXCEP_SUPERVISOR_ISR_CALLBACK           supervisor_instr_cb\r
184 \r
185 /* Callback for Undefined Instruction Exception. */\r
186 //#define EXCEP_UNDEFINED_INSTR_ISR_CALLBACK      undefined_instr_cb\r
187 \r
188 /* Callback for Non-maskable Interrupt. */\r
189 //#define NMI_ISR_CALLBACK                        nmi_cb\r
190 \r
191 /* Callback for all undefined interrupt vectors. User can set a breakpoint in this function to determine which source\r
192    is creating unwanted interrupts. */\r
193 //#define UNDEFINED_INT_ISR_CALLBACK              undefined_interrupt_cb\r
194 \r
195 /* Callback for Bus Error Interrupt. */\r
196 //#define BUS_ERROR_ISR_CALLBACK                  bus_error_cb\r
197 \r
198 /* The user has the option of separately choosing little or big endian for the User Application Area */\r
199 \r
200 /* Endian mode for User Application.\r
201    0    = Big Endian\r
202    Else = Little Endian (Default)\r
203 */\r
204 #define USER_APP_ENDIAN     (1)\r
205 \r
206 \r
207 /* Configure WDT and IWDT settings.\r
208    OFS0 - Option Function Select Register 0\r
209        OFS0 - Option Function Select Register 0\r
210        b31:b15 Reserved (set to 1)\r
211        b14     IWDTSLCSTP - IWDT Sleep Mode Count Stop Control - (0=can't stop count, 1=stop w/some low power modes)\r
212        b13     Reserved (set to 1)\r
213        b12     IWDTRSTIRQS - IWDT Reset Interrupt Request - What to do on underflow (0=take interrupt, 1=reset MCU)\r
214        b11:b10 IWDTRPSS - IWDT Window Start Position Select - (0=25%, 1=50%, 2=75%, 3=100%,don't use)\r
215        b9:b8   IWDTRPES - IWDT Window End Position Select - (0=75%, 1=50%, 2=25%, 3=0%,don't use)\r
216        b7:b4   IWDTCKS - IWDT Clock Frequency Division Ratio - (0=none, 2=/16, 3 = /32, 4=/64, 0xF=/128, 5=/256)\r
217        b3:b2   IWDTTOPS - IWDT Timeout Period Select - (0=128 cycles, 1=512, 2=1024, 3=2048)\r
218        b1      IWDTSTRT - IWDT Start Mode Select - (0=auto-start after reset, 1=halt after reset)\r
219        b0      Reserved (set to 1) */\r
220 #define OFS0_REG_VALUE  (0xFFFFFFFF) //Disable by default\r
221 \r
222 /* Configure whether voltage detection 1 circuit and HOCO are enabled after reset.\r
223        OFS1 - Option Function Select Register 1\r
224        b31:b9 Reserved (set to 1)\r
225        b8     HOCOEN - Enable/disable HOCO oscillation after a reset (0=enable, 1=disable)\r
226        b7:b4  STUPLVD1LVL - Startup Voltage Monitoring 1 Reset Detection Level Select\r
227                 0 1 0 0: 3.10 V\r
228                                 0 1 0 1: 3.00 V\r
229                                 0 1 1 0: 2.90 V\r
230                                 0 1 1 1: 2.79 V\r
231                                 1 0 0 0: 2.68 V\r
232                                 1 0 0 1: 2.58 V\r
233                                 1 0 1 0: 2.48 V\r
234                                 1 0 1 1: 2.06 V\r
235                                 1 1 0 0: 1.96 V\r
236                                 1 1 0 1: 1.86 V\r
237        b3:b2  Reserved (set to 1)\r
238        b2     STUPLVD1REN - Startup Voltage Monitoring 1 Reset Enable (1=monitoring disabled)\r
239        b0     FASTSTUP - Power-On Fast Startup Time (1=normal; read only) */\r
240 #define OFS1_REG_VALUE  (0xFFFFFFFF) //Disable by default\r
241 \r
242 /* Initializes C input & output library functions.\r
243    0 = Disable I/O library initialization in resetprg.c. If you are not using stdio then use this value.\r
244    1 = Enable I/O library initialization in resetprg.c. This is default and needed if you are using stdio. */\r
245 #define IO_LIB_ENABLE           (0)\r
246 \r
247 #endif /* R_BSP_CONFIG_REF_HEADER_FILE */\r
248 \r
249 \r
250 \r