blob: beab20d6cdf5e134ec80e56baa5f34a5baaa4b3e [file] [log] [blame]
Ashutosh Singhf4d88672017-11-29 13:35:43 +00001/*
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +01002 * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
Ashutosh Singhf4d88672017-11-29 13:35:43 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include <string.h>
9#include "tfm_ns_svc.h"
10#include "tfm_sst_veneers.h"
11#include "tfm_id_mngr.h"
12
13/* SVC function implementations */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010014enum tfm_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid)
Ashutosh Singhf4d88672017-11-29 13:35:43 +000015{
16 uint32_t app_id;
17
18 app_id = tfm_sst_get_cur_id();
19
20 return tfm_sst_veneer_create(app_id, asset_uuid);
21}
22
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010023enum tfm_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010024 struct tfm_sst_asset_info_t *info)
Ashutosh Singhf4d88672017-11-29 13:35:43 +000025{
26 uint32_t app_id;
27
28 app_id = tfm_sst_get_cur_id();
29
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010030 return tfm_sst_veneer_get_info(app_id, asset_uuid, info);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000031}
32
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010033enum tfm_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010034 struct tfm_sst_asset_attrs_t *attrs)
35{
36 uint32_t app_id;
37
38 app_id = tfm_sst_get_cur_id();
39
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010040 return tfm_sst_veneer_get_attributes(app_id, asset_uuid, attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010041}
42
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010043enum tfm_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010044 const struct tfm_sst_asset_attrs_t *attrs)
45{
46 uint32_t app_id;
47
48 app_id = tfm_sst_get_cur_id();
49
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010050 return tfm_sst_veneer_set_attributes(app_id, asset_uuid, attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010051}
52
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010053enum tfm_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
Ashutosh Singhf4d88672017-11-29 13:35:43 +000054 struct tfm_sst_buf_t* data)
55{
56 uint32_t app_id;
57
58 app_id = tfm_sst_get_cur_id();
59
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010060 return tfm_sst_veneer_read(app_id, asset_uuid, data);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000061}
62
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010063enum tfm_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
Ashutosh Singhf4d88672017-11-29 13:35:43 +000064 struct tfm_sst_buf_t* data)
65{
66 uint32_t app_id;
67
68 app_id = tfm_sst_get_cur_id();
69
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010070 return tfm_sst_veneer_write(app_id, asset_uuid, data);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000071}
72
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010073enum tfm_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid)
Ashutosh Singhf4d88672017-11-29 13:35:43 +000074{
75 uint32_t app_id;
76
77 app_id = tfm_sst_get_cur_id();
78
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010079 return tfm_sst_veneer_delete(app_id, asset_uuid);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000080}