1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "platform/include/tfm_platform_system.h"
8 #include "cmsis.h"
9 #include "tfm_platform_hal_ioctl.h"
10 #include "tfm_ioctl_core_api.h"
11 
tfm_platform_hal_system_reset(void)12 void tfm_platform_hal_system_reset(void)
13 {
14 	/* Reset the system */
15 	NVIC_SystemReset();
16 }
17 
tfm_platform_hal_ioctl(tfm_platform_ioctl_req_t request,psa_invec * in_vec,psa_outvec * out_vec)18 enum tfm_platform_err_t tfm_platform_hal_ioctl(tfm_platform_ioctl_req_t request,
19 					       psa_invec  *in_vec,
20 					       psa_outvec *out_vec)
21 {
22 	/* Core IOCTL services */
23 	switch (request) {
24 	case TFM_PLATFORM_IOCTL_READ_SERVICE:
25 		return tfm_platform_hal_read_service(in_vec, out_vec);
26 #if defined(GPIO_PIN_CNF_MCUSEL_Msk)
27 	case TFM_PLATFORM_IOCTL_GPIO_SERVICE:
28 		return tfm_platform_hal_gpio_service(in_vec, out_vec);
29 #endif /* defined(GPIO_PIN_CNF_MCUSEL_Msk) */
30 
31 
32 	/* Board specific IOCTL services */
33 
34 	/* Not a supported IOCTL service.*/
35 	default:
36 		return TFM_PLATFORM_ERR_NOT_SUPPORTED;
37 	}
38 }
39