[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_1_eng / packages / ti / boot / sbl / board / idkAM572x / sbl_main.c
1 /**
2 * \file sbl_main.c
3 *
4 * \brief This file contain main function, call the Board Initialization
5 * functions & slave core boot-up functions in sequence.
6 *
7 */
9 /*
10 * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 *
19 * Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the
22 * distribution.
23 *
24 * Neither the name of Texas Instruments Incorporated nor the names of
25 * its contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 */
42 /* TI RTOS header files */
43 #include <ti/csl/cslr_device.h>
44 #include <ti/board/board.h>
45 #include <ti/drv/uart/UART.h>
46 #include <ti/drv/uart/src/UART_osal.h>
47 #include <ti/drv/uart/UART_stdio.h>
48 #include <ti/csl/tistdtypes.h>
49 #include <ti/csl/csl_a15.h>
51 #include "sbl_image_copy.h"
52 #include "sbl_slave_core_boot.h"
53 #include "sbl_avs_config.h"
55 /**********************************************************************
56 ************************** Macros ************************************
57 **********************************************************************/
59 /**********************************************************************
60 ************************** Internal functions ************************
61 **********************************************************************/
63 /**********************************************************************
64 ************************** Global Variables **************************
65 **********************************************************************/
66 sblEntryPoint_t idkAM572xEntry;
68 typedef void (*EntryFunPtr_t)(void);
70 int main()
71 {
72 void (*func_ptr)(void);
73 Board_initCfg boardCfg;
74 uint32_t oppMode = OPP_MODE_NOM;
76 #if defined(OPP_HIGH)
77 boardCfg = BOARD_INIT_PLL_OPP_HIGH;
78 oppMode = OPP_MODE_HIGH;
79 #elif defined(OPP_OD)
80 boardCfg = BOARD_INIT_PLL_OPP_OD;
81 oppMode = OPP_MODE_OD;
82 #elif defined(OPP_NOM)
83 boardCfg = BOARD_INIT_PLL_OPP_NOM;
84 oppMode = OPP_MODE_NOM;
85 #endif
87 boardCfg |= BOARD_INIT_UNLOCK_MMR |
88 BOARD_INIT_MODULE_CLOCK |
89 BOARD_INIT_PINMUX_CONFIG |
90 BOARD_INIT_DDR |
91 BOARD_INIT_UART_STDIO |
92 BOARD_INIT_WATCHDOG_DISABLE;
94 /* Configure AVS voltage for the selected OPP to the voltage rails. */
95 SBL_Configure_AVS(oppMode);
97 /* Board Library Init. */
98 Board_init(boardCfg);
100 /* enable clocks for slave core modules. */
101 SBL_SlaveCorePrcmEnable();
103 UART_printf("**** PDK SBL ****\n");
105 UART_printf("**** Copying Application Image to DDR ****\n");
107 /* Image Copy */
108 SBL_ImageCopy(&idkAM572xEntry);
110 /* Release the DSP1 core out of reset */
111 SBL_DSP1_BringUp(idkAM572xEntry.entryPoint_DSP1);
113 /* Release the DSP2 core out of reset */
114 SBL_DSP2_BringUp(idkAM572xEntry.entryPoint_DSP2);
116 /* Release the IPU1 core out of reset and set the Entry point */
117 SBL_IPU1_CPU0_BringUp(idkAM572xEntry.entryPoint_IPU1_CPU0);
118 SBL_IPU1_CPU1_BringUp(idkAM572xEntry.entryPoint_IPU1_CPU1);
120 /* Release the IPU2 core out of reset and set the Entry point */
121 SBL_IPU2_CPU0_BringUp(idkAM572xEntry.entryPoint_IPU2_CPU0);
122 SBL_IPU2_CPU1_BringUp(idkAM572xEntry.entryPoint_IPU2_CPU1);
124 /* Clean the data Cache. */
125 CSL_a15WbAllDataCache();
127 /*Jump to MPU CPU0 APP*/
128 if (idkAM572xEntry.entryPoint_MPU_CPU0 != 0)
129 {
130 UART_printf("Jumping to MPU CPU0 Application...\r\n\n");
131 func_ptr = (EntryFunPtr_t) idkAM572xEntry.entryPoint_MPU_CPU0;
132 func_ptr();
133 }
134 else
135 {
136 while(1);
137 }
139 return 0;
140 }