[processor-sdk/pdk.git] / packages / ti / boot / sbl / example / tpr12MulticoreApp / sbl_smp_multicore.c
1 /*
2 * Copyright (c) 2018, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
33 #include <string.h>
34 #include <ti/board/board.h>
35 #include <ti/drv/uart/UART_stdio.h>
36 #include "sbl_slave_core_boot.h"
37 #include "sbl_soc_cfg.h"
38 #include "sbl_soc.h"
39 #include <ti/csl/arch/csl_arch.h>
40 #include <ti/osal/osal.h>
41 #include <ti/osal/CacheP.h>
43 #define DSP_CORE_UP_PATTERN 0xC0FFEE
45 #ifdef BUILD_C66X_1
46 #define DSP_POKE_MEM_ADDR ((volatile int *)0xC0200000)
47 #else
48 #ifdef BUILD_MCU1_0
49 #define DSP_POKE_MEM_ADDR ((volatile int *)0x10200000)
50 #endif
51 #endif
54 #ifdef BUILD_C66X_1
55 int main()
56 {
57 CacheP_Inv((const void *)DSP_POKE_MEM_ADDR,sizeof(int));
59 *(DSP_POKE_MEM_ADDR) = DSP_CORE_UP_PATTERN;
60 CacheP_wbInv((const void *)DSP_POKE_MEM_ADDR,sizeof(int));
61 return 0;
62 }
63 #endif
65 #if defined (BUILD_MCU1_0)
67 int main()
68 {
69 #if !defined(tpr12_qt)
70 Board_initCfg boardCfg;
72 boardCfg = BOARD_INIT_PINMUX_CONFIG |
73 BOARD_INIT_MODULE_CLOCK |
74 BOARD_INIT_UART_STDIO;
75 /* Board Init UART for logging. */
76 Board_init(boardCfg);
77 UART_printf("MPU SMP boot test\r\n");
78 #endif
80 CacheP_Inv((const void *)DSP_POKE_MEM_ADDR,sizeof(int));
81 while (*(DSP_POKE_MEM_ADDR) != DSP_CORE_UP_PATTERN)
82 {
83 CacheP_Inv((const void *)DSP_POKE_MEM_ADDR,sizeof(int));
84 }
86 /* Check if MPUs have run in AMP mode */
87 if (*(DSP_POKE_MEM_ADDR) != DSP_CORE_UP_PATTERN)
88 {
89 #if !defined(tpr12_qt)
90 UART_printf("Some tests have failed\r\n");
91 #else
92 printf("Some tests have failed\r\n");
93 #endif
94 }
95 else
96 {
97 #if !defined(tpr12_qt)
98 UART_printf("All tests have passed\r\n");
99 #else
100 printf("All tests have passed\r\n");
101 #endif
102 }
103 return 0;
104 }
105 #endif