iLLD_TC27xD  1.0
IfxCpu_CStart1.c
Go to the documentation of this file.
1 /**
2  * \file IfxCpu_Cstart1.c
3  * \brief This file contains the Core startup sequence for Cpu1.
4  * \version iLLD_1_0_0_11_0
5  * \copyright Copyright (c) 2012 Infineon Technologies AG. All rights reserved.
6  *
7  *
8  *
9  * IMPORTANT NOTICE
10  *
11  *
12  * Infineon Technologies AG (Infineon) is supplying this file for use
13  * exclusively with Infineon's microcontroller products. This file can be freely
14  * distributed within development tools that are supporting such microcontroller
15  * products.
16  *
17  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
18  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
20  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
21  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
22  *
23  *
24  */
25 /*******************************************************************************
26 ** Includes **
27 *******************************************************************************/
28 #include "Ifx_Cfg.h"
29 #ifndef IFX_CFG_USE_COMPILER_DEFAULT_LINKER
30 #include "Scu/Std/IfxScuWdt.h"
31 #include "Cpu/Std/IfxCpu.h"
33 #include "IfxScu_reg.h"
34 #include "IfxCpu_reg.h"
35 
36 /******************************************************************************/
37 /* Macros */
38 /******************************************************************************/
39 /** \brief Configuration for cache enable.
40  *
41  */
42 #ifndef IFX_CFG_CPU_CSTART_ENABLE_TRICORE1_PCACHE
43 # define IFX_CFG_CPU_CSTART_ENABLE_TRICORE1_PCACHE (1) /**< Program Cache enabled by default*/
44 #endif
45 #ifndef IFX_CFG_CPU_CSTART_ENABLE_TRICORE1_DCACHE
46 # define IFX_CFG_CPU_CSTART_ENABLE_TRICORE1_DCACHE (1) /**< Data Cache enabled by default*/
47 #endif
48 /*******************************************************************************
49 ** Imported Function Declarations **
50 *******************************************************************************/
53 
54 IFX_EXTERN void core1_main(void);
55 #if defined(__TASKING__)
56 __asm("\t .extern core1_main");
57 #endif
58 
59 /*******************************************************************************
60 ** Private Constant Definitions **
61 *******************************************************************************/
62 #define IFXCSTART1_PSW_DEFAULT (0x00000980u)
63 #define IFXCSTART1_PCX_O_S_DEFAULT (0xfff00000u)
64 
65 /*********************************************************************************
66 * - startup code
67 *********************************************************************************/
68 void _Core1_start(void)
69 {
70  uint32 pcxi;
71  uint16 wdtPassword = IfxScuWdt_getCpuWatchdogPasswordInline(&MODULE_SCU.WDTCPU[1]);
72 
73  IFX_CFG_CPU_CSTART_PRE_C_INIT_HOOK(1); /*Test Stack, CSA and Cache */
74 
75  /* Load user stack pointer */
76  __setareg(sp, __USTACK(1));
77  __dsync();
78 
79  /* Set the PSW to its reset value in case of a warm start,clear PSW.IS */
80  __mtcr(CPU_PSW, IFXCSTART1_PSW_DEFAULT); /* 0x00000980 */
81 
82  /* Set the PCXS and PCXO to its reset value in case of a warm start */
83  pcxi = __mfcr(CPU_PCXI);
84  pcxi &= IFXCSTART1_PCX_O_S_DEFAULT; /*0xfff00000; */
85  __mtcr(CPU_PCXI, pcxi);
86 
87  /*enable program cache */
89 
90  /*enable data cache */
92 
93  /* Clear the ENDINIT bit in the WDT_CON0 register, inline funtion */
94  IfxScuWdt_clearCpuEndinitInline(&MODULE_SCU.WDTCPU[1], wdtPassword);
95 
96  /* Load Base Address of Trap Vector Table. */
97  __mtcr(CPU_BTV, (uint32)__TRAPTAB(1));
98 
99  /* Load Base Address of Interrupt Vector Table. we will do this later in the program */
100  __mtcr(CPU_BIV, (uint32)__INTTAB(1));
101 
102  /* Load interupt stack pointer. */
103  __mtcr(CPU_ISP, (uint32)__ISTACK(1));
104 
105  IfxScuWdt_setCpuEndinitInline(&MODULE_SCU.WDTCPU[1], wdtPassword);
106 
107  /* initialize SDA base pointers */
108  __setareg(a0, __SDATA1(1));
109  __setareg(a1, __SDATA2(1));
110 
111  /* These to be un commented if A8 and A9 are required to be initialised */
112  __setareg(a8, __SDATA3(1));
113  __setareg(a9, __SDATA4(1));
114 
116 
117  /*Call main function of Cpu0 */
119 }
120 
121 
122 #endif /*#ifndef IFX_CFG_USE_COMPILER_DEFAULT_LINKER */