1 // Copyright (C) 2022 Beken Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include <driver/prro_types.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 /** 24 * @brief Init the PRRO driver 25 * 26 * This API init the resoure common: 27 * - Init PRRO driver control memory 28 * 29 * @attention 1. This API should be called before any other PRRO APIs. 30 * 31 * @return 32 * - BK_OK: succeed 33 * - others: other errors. 34 */ 35 bk_err_t bk_prro_driver_init(void); 36 37 /** 38 * @brief Deinit the PRRO driver 39 * 40 * This API free all resource related to PRRO. 41 * 42 * @return 43 * - BK_OK: succeed 44 * - others: other errors. 45 */ 46 bk_err_t bk_prro_driver_deinit(void); 47 48 /** 49 * @brief Set peripherals privilege attribute 50 * 51 * @param dev the peripherals 52 * @param privilege_type the privilege type, with each element must be PRRO_UNPRIVILEGED or PRRO_PRIVILEGED 53 * 54 * @return 55 * - BK_OK: succeed 56 * - BK_ERR_MPC_DRIVER_NOT_INIT: MPC driver is not init 57 */ 58 bk_err_t bk_prro_set_privilege_attribute(prro_dev_t dev, prro_privilege_type_t privilege_type); 59 60 /** 61 * @brief Set peripherals secure attribute 62 * 63 * @param dev the peripherals 64 * @param secure_type the secure type, with each element must be PRRO_SECURE or PRRO_NON_SECURE 65 * 66 * @return 67 * - BK_OK: succeed 68 * - BK_ERR_MPC_DRIVER_NOT_INIT: MPC driver is not init 69 */ 70 bk_err_t bk_prro_set_secure_attribute(prro_dev_t dev, prro_secure_type_t secure_type); 71 72 #ifdef __cplusplus 73 } 74 #endif 75 76