blob: 3cdb64efa2d4c1b6122b98e79335915a1b732893 [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_API__
9#define __TFM_SST_API__
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15/**
16 * \brief Gets handler for the given asset UUID. If an asset is deleted, the
17 * linked asset handle reference is no longer valid and will give
18 * TFM_SST_ERR_ASSET_REF_INVALID if used.
19 *
20 * \param[in] asset_uuid Asset UUID
21 * \param[out] hdl Pointer to store the asset's handler
22 *
23 * \return Returns TFM_SST_ERR_SUCCESS if asset is found. Otherwise, error code
24 * as specified in \ref tfm_sst_err_t
25 */
26enum tfm_sst_err_t tfm_sst_get_handle(uint16_t asset_uuid,
27 uint32_t* hdl);
28
29/**
30 * \brief Allocates space for the asset, referenced by asset handler,
31 * without setting any data in the asset.
32 *
33 * \param[in] asset_uuid Asset UUID
34 *
35 * \return Returns an TFM_SST_ERR_SUCCESS if asset is created correctly.
36 * Otherwise, error code as specified in \ref tfm_sst_err_t
37 */
38enum tfm_sst_err_t tfm_sst_create(uint16_t asset_uuid);
39
40/**
41 * \brief Gets asset's attributes referenced by asset handler.
42 * Uses cached metadata to return the size and write offset of an asset.
43 *
44 * \param[in] asset_handle Asset handler
45 * \param[out] attrib_struct Pointer to store the asset's attribute
46 *
47 * \return Returns error code as specified in \ref tfm_sst_err_t
48 */
49enum tfm_sst_err_t tfm_sst_get_attributes(uint32_t asset_handle,
50 struct tfm_sst_attribs_t* attrib_struct);
51
52/**
53 * \brief Reads asset's data from asset referenced by asset handler.
54 *
55 * \param[in] asset_handle Asset handler
56 * \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store
57 * data, size and offset
58 *
59 * \return Returns error code as specified in \ref tfm_sst_err_t
60 */
61enum tfm_sst_err_t tfm_sst_read(uint32_t asset_handle,
62 struct tfm_sst_buf_t* data);
63
64/**
65 * \brief Writes data into an asset referenced by asset handler.
66 *
67 * \param[in] asset_handle Asset handler
68 * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
69 * contains the data to write
70 *
71 * \return Returns error code as specified in \ref tfm_sst_err_t
72 */
73enum tfm_sst_err_t tfm_sst_write(uint32_t asset_handle,
74 struct tfm_sst_buf_t* data);
75
76/**
77 * \brief Deletes the asset referenced by the asset handler.
78 *
79 * \param[in] asset_handle Asset handler
80 *
81 * \return Returns error code as specified in \ref tfm_sst_err_t
82 */
83enum tfm_sst_err_t tfm_sst_delete(uint32_t asset_handle);
84
85#ifdef __cplusplus
86}
87#endif
88
89#endif /* __TFM_SST_API__ */