blob: 808c0eacc1da644e216831b75ce863afd0c60b03 [file] [log] [blame]
Ashutosh Singhf4d88672017-11-29 13:35:43 +00001/*
2 * Copyright (c) 2017, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __TFM_SST_SVC_HANDLER_H__
9#define __TFM_SST_SVC_HANDLER_H__
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include "tfm_sst_defs.h"
16
17/**
18 * \brief SVC funtion to get handler for the given asset UUID. If an asset is
19 * deleted, the linked asset handle reference is no longer valid and
20 * will give TFM_SST_ERR_ASSET_REF_INVALID if used.
21 *
22 * \param[in] asset_uuid Asset UUID
23 * \param[out] hdl Pointer to store the asset's handler
24 *
25 * \return Returns TFM_SST_ERR_SUCCESS if asset is found. Otherwise, error code
26 * as specified in \ref tfm_sst_err_t
27 */
28enum tfm_sst_err_t tfm_sst_svc_get_handle(uint16_t asset_uuid,
29 uint32_t* hdl);
30
31/**
32 * \brief SVC funtion to allocate space for the asset, referenced by asset
33 * handler, without setting any data in the asset.
34 *
35 * \param[in] asset_uuid Asset UUID
36 *
37 * \return Returns an TFM_SST_ERR_SUCCESS if asset is created correctly.
38 * Otherwise, error code as specified in \ref tfm_sst_err_t
39 */
40enum tfm_sst_err_t tfm_sst_svc_create(uint16_t asset_uuid);
41
42/**
43 * \brief SVC funtion to get asset's attributes referenced by asset handler.
44 * Uses cached metadata to return the size and write offset of an asset.
45 *
46 * \param[in] asset_handle Asset handler
47 * \param[out] attrib_struct Pointer to store asset's attribute
48 *
49 * \return Returns error code as specified in \ref tfm_sst_err_t
50 */
51enum tfm_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_handle,
52 struct tfm_sst_attribs_t* attrib_struct);
53
54/**
55 * \brief SVC funtion to read asset's data from asset referenced by asset
56 * handler.
57 *
58 * \param[in] asset_handle Asset handler
59 * \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store
60 * data, size and offset
61 *
62 * \return Returns error code as specified in \ref tfm_sst_err_t
63 */
64enum tfm_sst_err_t tfm_sst_svc_read(uint32_t asset_handle,
65 struct tfm_sst_buf_t* data);
66
67/**
68 * \brief SVC funtion to write data into an asset referenced by asset handler.
69 *
70 * \param[in] asset_handle Asset handler
71 * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
72 * contains the data to write
73 *
74 * \return Returns error code as specified in \ref tfm_sst_err_t
75 */
76enum tfm_sst_err_t tfm_sst_svc_write(uint32_t asset_handle,
77 struct tfm_sst_buf_t* data);
78
79/**
80 * \brief SVC funtion to delete the asset referenced by the asset handler.
81 *
82 * \param[in] asset_handle Asset handler
83 *
84 * \return Returns error code as specified in \ref tfm_sst_err_t
85 */
86enum tfm_sst_err_t tfm_sst_svc_delete(uint32_t asset_handle);
87
88#ifdef __cplusplus
89}
90#endif
91
92#endif /* __TFM_SST_SVC_HANDLER_H__ */