blob: a45cd979e15189ab1c9ff80da3a50456ee8ba1ec [file] [log] [blame]
Mate Toth-Pal3956a8a2018-08-03 17:18:47 +02001/*
Hugues de Valon32547602019-02-19 14:46:56 +00002 * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
Mate Toth-Pal3956a8a2018-08-03 17:18:47 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include <stdio.h>
9#include <cmsis_compiler.h>
10
11#ifndef __TFM_NS_SVC_H__
12#define __TFM_NS_SVC_H__
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/**
19 * \brief Include all the SVC handler headers
20 */
21#include "tfm_nspm_svc_handler.h"
22
23/**
24 * \brief Macro to encode an svc instruction
25 *
26 */
27#define SVC(code) __ASM("svc %0" : : "I" (code))
28
29/**
30 * \def LIST_SVC_NSPM
31 *
32 * \brief This is an X macro which lists
33 * the SVC interface exposed by TF-M
34 * for the NS OS.
35 *
36 */
37#define LIST_SVC_NSPM \
38 X(SVC_TFM_NSPM_REGISTER_CLIENT_ID, tfm_nspm_svc_register_client_id) \
39
40/**
41 * \brief Numbers associated to each SVC available
42 *
43 * \details Start from 1 as 0 is reserved by RTX
44 */
45enum tfm_svc_num {
46 SVC_INVALID = 0,
47
48#define X(SVC_ENUM, SVC_HANDLER) SVC_ENUM,
49
50 /* SVC API for Services */
Miklos Balint16a9ffb2018-11-19 11:35:49 +010051#ifdef TFM_NS_CLIENT_IDENTIFICATION
Mate Toth-Pal3956a8a2018-08-03 17:18:47 +020052 LIST_SVC_NSPM
Miklos Balint16a9ffb2018-11-19 11:35:49 +010053#endif
Mate Toth-Pal3956a8a2018-08-03 17:18:47 +020054
55#undef X
56
57 /* add all the new entries above this line */
58 SVC_TFM_MAX,
59};
60
61/* number of user SVC functions */
Hugues de Valon32547602019-02-19 14:46:56 +000062#define USER_SVC_COUNT ((uint32_t)SVC_TFM_MAX - 1)
Mate Toth-Pal3956a8a2018-08-03 17:18:47 +020063
64#ifdef __cplusplus
65}
66#endif
67
68#endif /* __TFM_NS_SVC_H__ */