blob: 1ce8261ad25bb5485aa0435387d1878db93d76ed [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#ifndef __TFM_SST_API__
9#define __TFM_SST_API__
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
Antonio de Angeliseba14e12018-03-27 11:03:20 +010015#include "tfm_sst_defs.h"
16
Ashutosh Singhf4d88672017-11-29 13:35:43 +000017/**
18 * \brief Gets handler for the given asset UUID. If an asset is deleted, the
19 * linked asset handle reference is no longer valid and will give
20 * 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_get_handle(uint16_t asset_uuid,
29 uint32_t* hdl);
30
31/**
32 * \brief Allocates space for the asset, referenced by asset handler,
33 * 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_create(uint16_t asset_uuid);
41
42/**
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010043 * \brief Gets asset's information referenced by asset handler.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000044 *
45 * \param[in] asset_handle Asset handler
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010046 * \param[out] info Pointer to store the asset's information
47 * \ref tfm_sst_asset_info_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000048 *
49 * \return Returns error code as specified in \ref tfm_sst_err_t
50 */
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010051enum tfm_sst_err_t tfm_sst_get_info(uint32_t asset_handle,
52 struct tfm_sst_asset_info_t *info);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000053
54/**
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010055 * \brief Gets asset's attributes referenced by asset handler.
56 *
57 * \param[in] asset_handle Asset handler
58 * \param[out] attrs Pointer to store the asset's attributes
59 * \ref tfm_sst_asset_attrs_t
60 *
61 *
62 * \return Returns error code as specified in \ref tfm_sst_err_t
63 */
64enum tfm_sst_err_t tfm_sst_get_attributes(uint32_t asset_handle,
65 struct tfm_sst_asset_attrs_t *attrs);
66
67/**
68 * \brief Sets asset's attributes referenced by asset handler.
69 *
70 * \param[in] asset_handle Asset handler
71 * \param[in] attrs Pointer to new the asset's attributes
72 * \ref tfm_sst_asset_attrs_t
73 *
74 * \return Returns error code as specified in \ref tfm_sst_err_t
75 */
76enum tfm_sst_err_t tfm_sst_set_attributes(uint32_t asset_handle,
77 const struct tfm_sst_asset_attrs_t *attrs);
78
79/**
Ashutosh Singhf4d88672017-11-29 13:35:43 +000080 * \brief Reads asset's data from asset referenced by asset handler.
81 *
82 * \param[in] asset_handle Asset handler
83 * \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store
84 * data, size and offset
85 *
86 * \return Returns error code as specified in \ref tfm_sst_err_t
87 */
88enum tfm_sst_err_t tfm_sst_read(uint32_t asset_handle,
89 struct tfm_sst_buf_t* data);
90
91/**
92 * \brief Writes data into an asset referenced by asset handler.
93 *
94 * \param[in] asset_handle Asset handler
95 * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
96 * contains the data to write
97 *
98 * \return Returns error code as specified in \ref tfm_sst_err_t
99 */
100enum tfm_sst_err_t tfm_sst_write(uint32_t asset_handle,
101 struct tfm_sst_buf_t* data);
102
103/**
104 * \brief Deletes the asset referenced by the asset handler.
105 *
106 * \param[in] asset_handle Asset handler
107 *
108 * \return Returns error code as specified in \ref tfm_sst_err_t
109 */
110enum tfm_sst_err_t tfm_sst_delete(uint32_t asset_handle);
111
112#ifdef __cplusplus
113}
114#endif
115
116#endif /* __TFM_SST_API__ */