1 /**************************************************************************//**
2 *
3 * @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Change Logs:
8 * Date            Author       Notes
9 * 2022-10-20      Wayne        First version
10 *
11 ******************************************************************************/
12 
13 #include "rtthread.h"
14 
15 #if defined(BSP_USING_SSPCC)
16 
17 #include "drv_common.h"
18 
nu_sspcc_init(void)19 rt_err_t nu_sspcc_init(void)
20 {
21     int i, j;
22 
23     /* Enable SSPCC clock. */
24     CLK->APBCLK2 |= CLK_APBCLK2_SSPCCEN_Msk;
25 
26     /* Assign all SRAM1 capacity to TZNS. */
27     SSPCC->SRAMSB = 0;
28 
29     /* Set all GPIO security set to TZNS. */
30     for (i = 0; i < 16; i++)
31     {
32         for (j = 0; j < 14; j++)
33         {
34             SSPCC_SetRealm_GPIO(GPIO_BASE + (j * 0x40), i, SSPCC_SSET_TZNS);
35         }
36     }
37 
38     return RT_EOK;
39 }
40 
41 #endif //#if defined(BSP_USING_SSPCC)
42