blob: d22653cb643d291b3a31161df2566e31d759b799 [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/**
55 * \brief Reads asset's data from asset referenced by asset handler.
56 *
57 * \param[in] asset_handle Asset handler
58 * \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store
59 * data, size and offset
60 *
61 * \return Returns error code as specified in \ref tfm_sst_err_t
62 */
63enum tfm_sst_err_t tfm_sst_read(uint32_t asset_handle,
64 struct tfm_sst_buf_t* data);
65
66/**
67 * \brief Writes data into an asset referenced by asset handler.
68 *
69 * \param[in] asset_handle Asset handler
70 * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
71 * contains the data to write
72 *
73 * \return Returns error code as specified in \ref tfm_sst_err_t
74 */
75enum tfm_sst_err_t tfm_sst_write(uint32_t asset_handle,
76 struct tfm_sst_buf_t* data);
77
78/**
79 * \brief Deletes the asset referenced by the asset handler.
80 *
81 * \param[in] asset_handle Asset handler
82 *
83 * \return Returns error code as specified in \ref tfm_sst_err_t
84 */
85enum tfm_sst_err_t tfm_sst_delete(uint32_t asset_handle);
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif /* __TFM_SST_API__ */