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_VENEERS_H__ |
| 9 | #define __TFM_SST_VENEERS_H__ |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | #include "tfm_sst_defs.h" |
| 16 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 17 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 18 | * \brief Allocates space for the asset, referenced by asset UUID, |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 19 | * without setting any data in the asset. |
| 20 | * |
| 21 | * \param[in] app_id Application ID |
| 22 | * \param[in] asset_uuid Asset UUID |
| 23 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 24 | * \return Returns TFM_SST_ERR_SUCCESS if the asset has been created correctly. |
| 25 | * If SST area is not prepared, it returns |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 26 | * TFM_SST_ERR_ASSET_NOT_PREPARED. If SST area is full, it returns |
| 27 | * TFM_SST_ERR_STORAGE_SYSTEM_FULL. If application id doesn't have the |
| 28 | * write rights, it returns TFM_SST_ERR_PERMS_NOT_ALLOWED. |
| 29 | */ |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 30 | enum tfm_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint32_t asset_uuid); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 31 | |
| 32 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 33 | * \brief Gets asset's information referenced by asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 34 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 35 | * \param[in] app_id Application ID |
| 36 | * \param[in] asset_uuid Asset UUID |
| 37 | * \param[out] info Pointer to store the asset's information |
| 38 | * \ref tfm_sst_asset_info_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 39 | * |
| 40 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 41 | */ |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 42 | enum tfm_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid, |
| 43 | struct tfm_sst_asset_info_t *info); |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 44 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 45 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 46 | * \brief Gets asset's attributes referenced by asset UUID. |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 47 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 48 | * \param[in] app_id Application ID |
| 49 | * \param[in] asset_uuid Asset UUID |
| 50 | * \param[out] attrs Pointer to store the asset's attributes |
| 51 | * \ref tfm_sst_asset_attrs_t |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 52 | * |
| 53 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 54 | */ |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 55 | enum tfm_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id, |
| 56 | uint32_t asset_uuid, |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 57 | struct tfm_sst_asset_attrs_t *attrs); |
| 58 | |
| 59 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 60 | * \brief Sets asset's attributes referenced by asset UUID. |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 61 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 62 | * \param[in] app_id Application ID |
| 63 | * \param[in] asset_uuid Asset UUID |
| 64 | * \param[in] attrs Pointer to new the asset's attributes |
| 65 | * \ref tfm_sst_asset_attrs_t |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 66 | * |
| 67 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 68 | */ |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 69 | enum tfm_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id, |
| 70 | uint32_t asset_uuid, |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 71 | const struct tfm_sst_asset_attrs_t *attrs); |
| 72 | |
| 73 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 74 | * \brief Reads asset's data from asset referenced by asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 75 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 76 | * \param[in] app_id Application ID |
| 77 | * \param[in] asset_uuid Asset UUID |
| 78 | * \param[in/out] data Pointer to data vector \ref tfm_sst_buf_t to |
| 79 | * store data, size and offset |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 80 | * |
| 81 | * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t |
| 82 | * value |
| 83 | */ |
| 84 | enum tfm_sst_err_t tfm_sst_veneer_read(uint32_t app_id, |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 85 | uint32_t asset_uuid, |
Antonio de Angelis | eba14e1 | 2018-03-27 11:03:20 +0100 | [diff] [blame] | 86 | struct tfm_sst_buf_t *data); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 87 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 88 | * \brief Writes data into an asset referenced by asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 89 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 90 | * \param[in] app_id Application ID |
| 91 | * \param[in] asset_uuid Asset UUID |
| 92 | * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which |
| 93 | * contains the data to write |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 94 | * |
| 95 | * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t |
| 96 | * value |
| 97 | */ |
| 98 | enum tfm_sst_err_t tfm_sst_veneer_write(uint32_t app_id, |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 99 | uint32_t asset_uuid, |
Antonio de Angelis | eba14e1 | 2018-03-27 11:03:20 +0100 | [diff] [blame] | 100 | struct tfm_sst_buf_t *data); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 101 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 102 | * \brief Deletes the asset referenced by the asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 103 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 104 | * \param[in] app_id Application ID |
| 105 | * \param[in] asset_uuid Asset UUID |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 106 | * |
| 107 | * \return Returns TFM_SST_ERR_PERMS_NOT_ALLOWED if the asset can't be deleted |
| 108 | * to by this app ID. Returns TFM_SST_ERR_ASSET_REF_INVALID, if asset |
| 109 | * no longer exists. Otherwise, TFM_SST_ERR_SUCCESS. |
| 110 | */ |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 111 | enum tfm_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_uuid); |
| 112 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 113 | #ifdef __cplusplus |
| 114 | } |
| 115 | #endif |
| 116 | |
| 117 | #endif /* __TFM_SST_VENEERS_H__ */ |