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_SVC_HANDLER_H__ |
| 9 | #define __TFM_SST_SVC_HANDLER_H__ |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | #include "tfm_sst_defs.h" |
| 16 | |
| 17 | /** |
| 18 | * \brief SVC funtion to get handler for the given asset UUID. If an asset is |
| 19 | * deleted, the linked asset handle reference is no longer valid and |
| 20 | * will give 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_svc_get_handle(uint16_t asset_uuid, |
| 29 | uint32_t* hdl); |
| 30 | |
| 31 | /** |
| 32 | * \brief SVC funtion to allocate space for the asset, referenced by asset |
| 33 | * handler, 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_svc_create(uint16_t asset_uuid); |
| 41 | |
| 42 | /** |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 43 | * \brief SVC funtion to get 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_svc_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 | /** |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame^] | 55 | * \brief SVC funtion to get asset's attributes referenced by asset |
| 56 | * handler. |
| 57 | * |
| 58 | * \param[in] asset_handle Asset handler |
| 59 | * \param[out] attrs Pointer to store the asset's attributes |
| 60 | * \ref tfm_sst_asset_attrs_t |
| 61 | * |
| 62 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 63 | */ |
| 64 | enum tfm_sst_err_t tfm_sst_svc_get_attributes( |
| 65 | uint32_t asset_handle, |
| 66 | struct tfm_sst_asset_attrs_t *attrs); |
| 67 | |
| 68 | /** |
| 69 | * \brief SVC funtion to set asset's attributes referenced by asset |
| 70 | * handler. |
| 71 | * |
| 72 | * \param[in] asset_handle Asset handler |
| 73 | * \param[in] attrs Pointer to new the asset's attributes |
| 74 | * \ref tfm_sst_asset_attrs_t |
| 75 | * |
| 76 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 77 | */ |
| 78 | enum tfm_sst_err_t tfm_sst_svc_set_attributes( |
| 79 | uint32_t asset_handle, |
| 80 | const struct tfm_sst_asset_attrs_t *attrs); |
| 81 | |
| 82 | /** |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 83 | * \brief SVC funtion to read asset's data from asset referenced by asset |
| 84 | * handler. |
| 85 | * |
| 86 | * \param[in] asset_handle Asset handler |
| 87 | * \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store |
| 88 | * data, size and offset |
| 89 | * |
| 90 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 91 | */ |
| 92 | enum tfm_sst_err_t tfm_sst_svc_read(uint32_t asset_handle, |
| 93 | struct tfm_sst_buf_t* data); |
| 94 | |
| 95 | /** |
| 96 | * \brief SVC funtion to write data into an asset referenced by asset handler. |
| 97 | * |
| 98 | * \param[in] asset_handle Asset handler |
| 99 | * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which |
| 100 | * contains the data to write |
| 101 | * |
| 102 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 103 | */ |
| 104 | enum tfm_sst_err_t tfm_sst_svc_write(uint32_t asset_handle, |
| 105 | struct tfm_sst_buf_t* data); |
| 106 | |
| 107 | /** |
| 108 | * \brief SVC funtion to delete the asset referenced by the asset handler. |
| 109 | * |
| 110 | * \param[in] asset_handle Asset handler |
| 111 | * |
| 112 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 113 | */ |
| 114 | enum tfm_sst_err_t tfm_sst_svc_delete(uint32_t asset_handle); |
| 115 | |
| 116 | #ifdef __cplusplus |
| 117 | } |
| 118 | #endif |
| 119 | |
| 120 | #endif /* __TFM_SST_SVC_HANDLER_H__ */ |