]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR_ARM/src/cg_src/r_cg_systeminit.c
Initial RZ/T port and demo - work in progress, currently only the tick interrupt...
[freertos] / FreeRTOS / Demo / CORTEX_R4F_RZ_T_GCC_IAR_ARM / src / cg_src / r_cg_systeminit.c
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_systeminit.c\r
22 * Version      : Code Generator for RZ/T1 V1.00.00.09 [02 Mar 2015]\r
23 * Device(s)    : R7S910018CBG\r
24 * Tool-Chain   : GCCARM\r
25 * Description  : This file implements system initializing function.\r
26 * Creation Date: 22/04/2015\r
27 ***********************************************************************************************************************/\r
28 \r
29 /***********************************************************************************************************************\r
30 Pragma directive\r
31 ***********************************************************************************************************************/\r
32 /* Start user code for pragma. Do not edit comment generated here */\r
33 /* End user code. Do not edit comment generated here */\r
34 \r
35 /***********************************************************************************************************************\r
36 Includes\r
37 ***********************************************************************************************************************/\r
38 #include "r_cg_macrodriver.h"\r
39 #include "r_cg_cgc.h"\r
40 #include "r_cg_icu.h"\r
41 #include "r_cg_port.h"\r
42 #include "r_cg_tpu.h"\r
43 #include "r_cg_cmt.h"\r
44 #include "r_cg_scifa.h"\r
45 #include "r_cg_rspi.h"\r
46 #include "r_cg_s12ad.h"\r
47 #include "r_cg_mpc.h"\r
48 /* Start user code for include. Do not edit comment generated here */\r
49 /* End user code. Do not edit comment generated here */\r
50 #include "r_cg_userdefine.h"\r
51 \r
52 /***********************************************************************************************************************\r
53 Global variables and functions\r
54 ***********************************************************************************************************************/\r
55 /* Start user code for global. Do not edit comment generated here */\r
56 \r
57 void R_Systeminit(void);\r
58 \r
59 /* End user code. Do not edit comment generated here */\r
60 \r
61 extern void r_set_exception_handler(void);\r
62 /***********************************************************************************************************************\r
63 * Function Name: R_Systeminit\r
64 * Description  : This function initializes every macro.\r
65 * Arguments    : None\r
66 * Return Value : None\r
67 ***********************************************************************************************************************/\r
68 void R_Systeminit(void)\r
69 {\r
70     DI();\r
71 \r
72     /* Enable writing to registers related to operating modes, LPC, CGC and ATCM */\r
73     SYSTEM.PRCR.LONG = 0x0000A50BU; \r
74 \r
75     /* Enable writing to MPC pin function control registers */\r
76     MPC.PWPR.BIT.B0WI = 0U;\r
77     MPC.PWPR.BIT.PFSWE = 1U;\r
78 \r
79     r_set_exception_handler();\r
80 \r
81     /* Set peripheral settings */\r
82     R_CGC_Create();\r
83     R_ICU_Create();\r
84     R_PORT_Create();\r
85     R_TPU_Create();\r
86     R_CMT4_Create();\r
87     R_CMT5_Create();\r
88     R_SCIFA2_Create();\r
89     R_RSPI1_Create();\r
90     R_S12AD0_Create();\r
91     R_MPC_Create();\r
92 \r
93     /* Disable writing to MPC pin function control registers */\r
94     MPC.PWPR.BIT.PFSWE = 0U;    \r
95     MPC.PWPR.BIT.B0WI = 1U;     \r
96 \r
97     /* Enable protection */\r
98     SYSTEM.PRCR.LONG = 0x0000A500U;\r
99     EI();\r
100 }\r
101 \r
102 /* Start user code for adding. Do not edit comment generated here */\r
103 /* End user code. Do not edit comment generated here */\r