1 /* --------------------------------------------------------------------------
2 * Copyright (c) 2013-2019 Arm Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 * Purpose: Example function callable from the non-secure domain
21 *---------------------------------------------------------------------------*/
24 #include "secure_port_macros.h" // ARM.FreeRTOS::RTOS:TrustZone
26 #include "library_nsc.h" // Non-secure callable function definition
28 /* Non-secure function pointer type */
29 typedef void (*NS_Func_t) (void) __attribute__((cmse_nonsecure_call));
33 static uint32_t Count_S = 0U;
35 /* Function that can be called from the non-secure application */
36 secureportNON_SECURE_CALLABLE uint32_t Func_NSC (Callback_t callback) {
37 NS_Func_t ns_callback;
39 /* Create function pointer to call back non-secure domain */
40 ns_callback = (NS_Func_t)cmse_nsfptr_create(callback);
42 /* Execute callback function */
47 /* Return secure counter value */