Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 1 | /* |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame^] | 2 | * Copyright (c) 2017-2018, Arm Limited. All rights reserved. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 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 |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
Antonio de Angelis | eba14e1 | 2018-03-27 11:03:20 +0100 | [diff] [blame] | 15 | #include "tfm_sst_defs.h" |
| 16 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 17 | /** |
| 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 | */ |
| 28 | enum 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 | */ |
| 40 | enum tfm_sst_err_t tfm_sst_create(uint16_t asset_uuid); |
| 41 | |
| 42 | /** |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame^] | 43 | * \brief Gets asset's information referenced by asset handler. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 44 | * |
| 45 | * \param[in] asset_handle Asset handler |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame^] | 46 | * \param[out] info Pointer to store the asset's information |
| 47 | * \ref tfm_sst_asset_info_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 48 | * |
| 49 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 50 | */ |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame^] | 51 | enum tfm_sst_err_t tfm_sst_get_info(uint32_t asset_handle, |
| 52 | struct tfm_sst_asset_info_t *info); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 53 | |
| 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 | */ |
| 63 | enum 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 | */ |
| 75 | enum 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 | */ |
| 85 | enum tfm_sst_err_t tfm_sst_delete(uint32_t asset_handle); |
| 86 | |
| 87 | #ifdef __cplusplus |
| 88 | } |
| 89 | #endif |
| 90 | |
| 91 | #endif /* __TFM_SST_API__ */ |