]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/RenesasFiles/drivers/common/userdef/bsc_userdef.c
Add missing +TCP code.
[freertos] / FreeRTOS / Demo / CORTEX_A9_RZ_R7S72100_IAR_DS-5 / Source / RenesasFiles / drivers / common / userdef / bsc_userdef.c
1 /*******************************************************************************\r
2 * DISCLAIMER\r
3 * This software is supplied by Renesas Electronics Corporation and is only\r
4 * intended for use with Renesas products. No other uses are authorized. This\r
5 * software is owned by Renesas Electronics Corporation and is protected under\r
6 * all applicable laws, including copyright laws.\r
7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING\r
8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT\r
9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE\r
10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.\r
11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS\r
12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE\r
13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR\r
14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE\r
15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
16 * Renesas reserves the right, without notice, to make changes to this software\r
17 * and to discontinue the availability of this software. By using this software,\r
18 * you agree to the additional terms and conditions found by accessing the\r
19 * following link:\r
20 * http://www.renesas.com/disclaimer\r
21 *\r
22 * Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.\r
23 *******************************************************************************/\r
24 /*******************************************************************************\r
25 * File Name    : bsc_userdef.c\r
26 * $Rev: 17531 $\r
27 * $Date:: 2013-04-10 12:58:44 +0100#$\r
28 * Device(s)    : Aragon\r
29 * Tool-Chain   : DS-5 Ver 5.8\r
30 *              : ARM Complier\r
31 * OS           :\r
32 * H/W Platform : Aragon CPU Board\r
33 * Description  : Aragon Sample Program - Common driver (User define function)\r
34 * Operation    :\r
35 * Limitations  :\r
36 *******************************************************************************/\r
37 \r
38 \r
39 /******************************************************************************\r
40 Includes   <System Includes> , "Project Includes"\r
41 ******************************************************************************/\r
42 #include "r_typedefs.h"\r
43 #include "dev_drv.h"            /* Device Driver common header */\r
44 #include "devdrv_common.h"      /* Common Driver Header */\r
45 #include "iodefine.h"\r
46 \r
47 /* Do not include the following pragmas when compiling with IAR. */\r
48 #ifndef __ICCARM__\r
49         #pragma arm section code   = "CODE_RESET"\r
50         #pragma arm section rodata = "CONST_RESET"\r
51         #pragma arm section rwdata = "DATA_RESET"\r
52         #pragma arm section zidata = "BSS_RESET"\r
53 #endif\r
54 \r
55 /******************************************************************************\r
56 Typedef definitions\r
57 ******************************************************************************/\r
58 \r
59 \r
60 /******************************************************************************\r
61 Macro definitions\r
62 ******************************************************************************/\r
63 /* The address when writing in a SDRAM mode register */\r
64 #define SDRAM_MODE_CS2    (*(volatile uint16_t *)(0x3FFFD040))\r
65 #define SDRAM_MODE_CS3    (*(volatile uint16_t *)(0x3FFFE040))\r
66 \r
67 /******************************************************************************\r
68 Imported global variables and functions (from other files)\r
69 ******************************************************************************/\r
70 \r
71 \r
72 /******************************************************************************\r
73 Exported global variables and functions (to be accessed by other files)\r
74 ******************************************************************************/\r
75 \r
76 \r
77 /******************************************************************************\r
78 Private global variables and functions\r
79 ******************************************************************************/\r
80 \r
81 \r
82 /******************************************************************************\r
83 * Function Name: Userdef_BSC_CS0Init\r
84 * Description  :\r
85 * Arguments    : none\r
86 * Return Value : none\r
87 ******************************************************************************/\r
88 void Userdef_BSC_CS0Init(void)\r
89 {\r
90     /* ---- CS0BCR settings ---- */\r
91     BSC.CS0BCR.LONG = 0x10000C00ul;\r
92                                     /* Idle Cycles between Write-read Cycles    */\r
93                                     /*  and Write-write Cycles : 1 idle cycle   */\r
94                                     /* Data Bus Size: 16-bit                    */\r
95 \r
96     /* ---- CS0WCR settings ----  */\r
97     BSC.CS0WCR.NORMAL.LONG = 0x00000B40ul;\r
98                                     /* Number of Delay Cycles from Address,     */\r
99                                     /*  CS0# Assertion to RD#,WEn Assertion     */\r
100                                     /*  : 1.5 cycles                            */\r
101                                     /* Number of Access Wait Cycles: 6 cycles   */\r
102                                     /* Delay Cycles from RD,WEn# negation to    */\r
103                                     /*  Address,CSn# negation: 0.5 cycles       */\r
104 }\r
105 \r
106 /******************************************************************************\r
107 * Function Name: Userdef_BSC_CS1Init\r
108 * Description  :\r
109 * Arguments    : none\r
110 * Return Value : none\r
111 ******************************************************************************/\r
112 void Userdef_BSC_CS1Init(void)\r
113 {\r
114     /* ---- CS1BCR settings ---- */\r
115     BSC.CS1BCR.LONG = 0x10000C00ul;\r
116                                     /* Idle Cycles between Write-read Cycles    */\r
117                                     /*  and Write-write Cycles : 1 idle cycle   */\r
118                                     /* Data Bus Size: 16-bit                    */\r
119 \r
120     /* ---- CS1WCR settings ----  */\r
121     BSC.CS1WCR.LONG = 0x00000B40ul;\r
122                                     /* Number of Delay Cycles from Address,     */\r
123                                     /*  CS0# Assertion to RD#,WEn Assertion     */\r
124                                     /*  : 1.5 cycles                            */\r
125                                     /* Number of Access Wait Cycles: 6 cycles   */\r
126                                     /* Delay Cycles from RD,WEn# negation to    */\r
127                                     /*  Address,CSn# negation: 0.5 cycles       */\r
128 }\r
129 \r
130 /******************************************************************************\r
131 * Function Name: Userdef_BSC_CS2Init\r
132 * Description  :\r
133 * Arguments    : none\r
134 * Return Value : none\r
135 ******************************************************************************/\r
136 void Userdef_BSC_CS2Init(void)\r
137 {\r
138     /* ==== CS2BCR settings ==== */\r
139     BSC.CS2BCR.LONG = 0x00004C00ul;\r
140                                 /* Idle Cycles between Write-read Cycles  */\r
141                                 /* and Write-write Cycles : 0 idle cycles */\r
142                                 /* Memory type :SDRAM                     */\r
143                                 /* Data Bus Size : 16-bit                 */\r
144 \r
145     /* ==== CS2WCR settings ==== */\r
146     BSC.CS2WCR.SDRAM.LONG = 0x00000480ul;\r
147                                 /* CAS latency for Area 2 : 2 cycles */\r
148 \r
149 \r
150     /* ==== Written in SDRAM Mode Register ==== */\r
151     SDRAM_MODE_CS2 = 0;\r
152                                 /* The writing data is arbitrary            */\r
153                                 /* SDRAM mode register setting CS2 space    */\r
154                                 /* Burst read (burst length 1)./Burst write */\r
155 }\r
156 \r
157 /******************************************************************************\r
158 * Function Name: Userdef_BSC_CS3Init\r
159 * Description  :\r
160 * Arguments    : none\r
161 * Return Value : none\r
162 ******************************************************************************/\r
163 void Userdef_BSC_CS3Init(void)\r
164 {\r
165     volatile int32_t cnt;\r
166 \r
167     cnt = 150;\r
168     while (cnt-- > 0)\r
169     {\r
170         /* wait */\r
171     }\r
172 \r
173     /* ==== CS3BCR settings ==== */\r
174     BSC.CS3BCR.LONG = 0x00004C00ul;\r
175                                 /* Idle Cycles between Write-read Cycles  */\r
176                                 /* and Write-write Cycles : 0 idle cycles */\r
177                                 /* Memory type :SDRAM                     */\r
178                                 /* Data Bus Size : 16-bit                 */\r
179 \r
180     /* ==== CS3WCR settings ==== */\r
181     BSC.CS3WCR.SDRAM.LONG = 0x00002492ul;\r
182                                 /* Precharge completion wait cycles: 1 cycle     */\r
183                                 /* Wait cycles between ACTV command              */\r
184                                 /* and READ(A)/WRITE(A) command : 1 cycles       */\r
185                                 /* CAS latency for Area 3 : 2 cycles             */\r
186                                 /* Auto-precharge startup wait cycles : 2 cycles */\r
187                                 /* Idle cycles from REF command/self-refresh     */\r
188                                 /* Release to ACTV/REF/MRS command : 5 cycles    */\r
189 \r
190     /* ==== SDCR settings ==== */\r
191     BSC.SDCR.LONG = 0x00120812ul;\r
192                                 /* Row address for Area 2 : 13-bit    */\r
193                                 /* Column Address for Area 2 : 10-bit */\r
194                                 /* Refresh Control :Refresh           */\r
195                                 /* RMODE :Auto-refresh is performed   */\r
196                                 /* BACTV :Auto-precharge mode         */\r
197                                 /* Row address for Area 3 : 13-bit    */\r
198                                 /* Column Address for Area 3 : 10-bit */\r
199 \r
200     /* ==== RTCOR settings ==== */\r
201     BSC.RTCOR.LONG = 0xA55A0020ul;\r
202                                 /* 7.813usec /240nsec            */\r
203                                 /*   = 32(0x20)cycles per refresh */\r
204 \r
205     /* ==== RTCSR settings ==== */\r
206     BSC.RTCSR.LONG = 0xA55A0010ul;\r
207                                 /* Initialization sequence start */\r
208                                 /* Clock select B-phy/16         */\r
209                                 /* Refresh count :Once           */\r
210 \r
211     /* ==== Written in SDRAM Mode Register ==== */\r
212     SDRAM_MODE_CS3 = 0;\r
213                                 /* The writing data is arbitrary            */\r
214                                 /* SDRAM mode register setting CS3 space    */\r
215                                 /* Burst read (burst length 1)./Burst write */\r
216 }\r
217 \r
218 /******************************************************************************\r
219 * Function Name: Userdef_BSC_CS4Init\r
220 * Description  :\r
221 * Arguments    : none\r
222 * Return Value : none\r
223 ******************************************************************************/\r
224 void Userdef_BSC_CS4Init(void)\r
225 {\r
226 }\r
227 \r
228 /******************************************************************************\r
229 * Function Name: Userdef_BSC_CS5Init\r
230 * Description  :\r
231 * Arguments    : none\r
232 * Return Value : none\r
233 ******************************************************************************/\r
234 void Userdef_BSC_CS5Init(void)\r
235 {\r
236 }\r
237 \r
238 \r
239 /* End of File */\r
240 \r