drv_sspcc.c 918 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #include "rtthread.h"
  13. #if defined(BSP_USING_SSPCC)
  14. #include "drv_common.h"
  15. rt_err_t nu_sspcc_init(void)
  16. {
  17. int i, j;
  18. /* Enable SSPCC clock. */
  19. CLK->APBCLK2 |= CLK_APBCLK2_SSPCCEN_Msk;
  20. /* Assign all SRAM1 capacity to TZNS. */
  21. SSPCC->SRAMSB = 0;
  22. /* Set all GPIO security set to TZNS. */
  23. for (i = 0; i < 16; i++)
  24. {
  25. for (j = 0; j < 14; j++)
  26. {
  27. SSPCC_SetRealm_GPIO(GPIO_BASE + (j * 0x40), i, SSPCC_SSET_TZNS);
  28. }
  29. }
  30. return RT_EOK;
  31. }
  32. #endif //#if defined(BSP_USING_SSPCC)