ff: nordic: Add IPC calls for FF target

Add IPC calls from non-secure to secure side for Firmware Framework tests

Signed-off-by: Andreas Vibeto <andreas.vibeto@nordicsemi.no>
diff --git a/api-tests/platform/targets/tgt_ff_tfm_nrf_common/nspe/pal_driver_ipc_intf.c b/api-tests/platform/targets/tgt_ff_tfm_nrf_common/nspe/pal_driver_ipc_intf.c
index 821588c..be8ae93 100644
--- a/api-tests/platform/targets/tgt_ff_tfm_nrf_common/nspe/pal_driver_ipc_intf.c
+++ b/api-tests/platform/targets/tgt_ff_tfm_nrf_common/nspe/pal_driver_ipc_intf.c
@@ -21,9 +21,7 @@
 #include "pal_common.h"
 #include "pal_nvmem.h"
 
-
 extern int tfm_log_printf(const char *, ...);
-extern int32_t tfm_platform_system_reset(void);
 
 /* Initialize the timer with the given number of ticks. */
 extern void pal_timer_init_ns(uint32_t ticks);
@@ -44,14 +42,21 @@
 **/
 int pal_uart_init_ns(uint32_t uart_base_addr)
 {
-    psa_handle_t            print_handle = 0;
     psa_status_t            status_of_call = PSA_SUCCESS;
     uart_fn_type_t          uart_fn = UART_INIT;
 
     psa_invec data[3] = {{&uart_fn, sizeof(uart_fn)},
                          {&uart_base_addr, sizeof(uart_base_addr)},
-                         {NULL, 0} };
+                         {NULL, 0}};
 
+#if STATELESS_ROT == 1
+    status_of_call = psa_call(DRIVER_UART_HANDLE, 0, data, 3, NULL, 0);
+    if (status_of_call != PSA_SUCCESS)
+        return PAL_STATUS_ERROR;
+
+    return PAL_STATUS_SUCCESS;
+#else
+    psa_handle_t            print_handle = 0;
     print_handle = psa_connect(DRIVER_UART_SID, DRIVER_UART_VERSION);
     if (PSA_HANDLE_IS_VALID(print_handle))
     {
@@ -66,6 +71,7 @@
     {
         return PAL_STATUS_ERROR;
     }
+#endif
 }
 
 /**
@@ -90,9 +96,39 @@
 **/
 int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
 {
-    (void)base_addr;
-    pal_timer_init_ns(time_us * timer_tick_us);
+    wd_param_t              wd_param;
+    psa_status_t            status_of_call = PSA_SUCCESS;
+
+    wd_param.wd_fn_type = WD_INIT_SEQ;
+    wd_param.wd_base_addr = base_addr;
+    wd_param.wd_time_us = time_us;
+    wd_param.wd_timer_tick_us = timer_tick_us;
+    psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
+
+#if STATELESS_ROT == 1
+    status_of_call = psa_call(DRIVER_WATCHDOG_HANDLE, 0, invec, 1, NULL, 0);
+    if (status_of_call != PSA_SUCCESS)
+        return PAL_STATUS_ERROR;
+
     return PAL_STATUS_SUCCESS;
+#else
+
+    psa_handle_t            handle = 0;
+    handle = psa_connect(DRIVER_WATCHDOG_SID, DRIVER_WATCHDOG_VERSION);
+    if (PSA_HANDLE_IS_VALID(handle))
+    {
+        status_of_call = psa_call(handle, 0, invec, 1, NULL, 0);
+        psa_close(handle);
+        if (status_of_call != PSA_SUCCESS)
+            return PAL_STATUS_ERROR;
+
+        return PAL_STATUS_SUCCESS;
+    }
+    else
+    {
+        return PAL_STATUS_ERROR;
+    }
+#endif
 }
 
 /**
@@ -102,10 +138,38 @@
 **/
 int pal_wd_timer_enable_ns(addr_t base_addr)
 {
-    (void)base_addr;
-    pal_timer_start_ns();
-    return PAL_STATUS_SUCCESS;
+    wd_param_t              wd_param;
+    psa_status_t            status_of_call = PSA_SUCCESS;
 
+    wd_param.wd_fn_type = WD_ENABLE_SEQ;
+    wd_param.wd_base_addr = base_addr;
+    wd_param.wd_time_us = 0;
+    wd_param.wd_timer_tick_us = 0;
+    psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
+
+#if STATELESS_ROT == 1
+    status_of_call = psa_call(DRIVER_WATCHDOG_HANDLE, 0, invec, 1, NULL, 0);
+    if (status_of_call != PSA_SUCCESS)
+        return PAL_STATUS_ERROR;
+
+    return PAL_STATUS_SUCCESS;
+#else
+    psa_handle_t            handle = 0;
+    handle = psa_connect(DRIVER_WATCHDOG_SID, DRIVER_WATCHDOG_VERSION);
+    if (PSA_HANDLE_IS_VALID(handle))
+    {
+        status_of_call = psa_call(handle, 0, invec, 1, NULL, 0);
+        psa_close(handle);
+        if (status_of_call != PSA_SUCCESS)
+            return PAL_STATUS_ERROR;
+
+        return PAL_STATUS_SUCCESS;
+    }
+    else
+    {
+        return PAL_STATUS_ERROR;
+    }
+#endif
 }
 
 /**
@@ -115,9 +179,38 @@
 **/
 int pal_wd_timer_disable_ns(addr_t base_addr)
 {
-    (void)base_addr;
-    pal_timer_stop_ns();
+    wd_param_t              wd_param;
+    psa_status_t            status_of_call = PSA_SUCCESS;
+
+    wd_param.wd_fn_type = WD_DISABLE_SEQ;
+    wd_param.wd_base_addr = base_addr;
+    wd_param.wd_time_us = 0;
+    wd_param.wd_timer_tick_us = 0;
+    psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
+#if STATELESS_ROT == 1
+    status_of_call = psa_call(DRIVER_WATCHDOG_HANDLE, 0, invec, 1, NULL, 0);
+    if (status_of_call != PSA_SUCCESS)
+        return PAL_STATUS_ERROR;
+
     return PAL_STATUS_SUCCESS;
+#else
+    psa_handle_t            handle = 0;
+
+    handle = psa_connect(DRIVER_WATCHDOG_SID, DRIVER_WATCHDOG_VERSION);
+    if (PSA_HANDLE_IS_VALID(handle))
+    {
+        status_of_call = psa_call(handle, 0, invec, 1, NULL, 0);
+        psa_close(handle);
+        if (status_of_call != PSA_SUCCESS)
+            return PAL_STATUS_ERROR;
+
+        return PAL_STATUS_SUCCESS;
+    }
+    else
+    {
+        return PAL_STATUS_ERROR;
+    }
+#endif
 }
 
 /**
@@ -173,13 +266,3 @@
         __asm volatile("WFI");
     }
 }
-
-/**
- *   @brief    - Resets the system.
- *   @param    - void
- *   @return   - SUCCESS/FAILURE
-**/
-int pal_system_reset(void)
-{
-    return tfm_platform_system_reset();
-}