1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 * Description: OS Abstract Layer. 15 */ 16 17 /** 18 * @defgroup osal_drvbox osal_drvbox 19 */ 20 #ifndef __OSAL_DRVBOX_H__ 21 #define __OSAL_DRVBOX_H__ 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif 28 29 /** 30 * @ingroup osal_drvbox 31 * @brief Switch region from usr box to driver box. 32 * 33 * @par Description: 34 * This API is used to switch executing region from usr box to driver box, and change pmp/mpu configuration respectivly. 35 * 36 * @attention 37 * This api can only be invoked in common usr lib. 38 * 39 * @param drv_id [in] used to check the invoking permission of the driver. 40 * 41 * @retval DRV_BOX_INVALID_SWITCH No need to do the switching process due to the limitation. 42 * @retval DRV_BOX_SWITCH_FAIL Permission rejected. 43 * @retval LOS_OK Box region switching success. 44 * 45 * @par Support System: 46 * seliteos. 47 */ 48 unsigned int osal_drvmgr_switch_to_drvbox(unsigned int drv_id); 49 50 /** 51 * @ingroup osal_drvbox 52 * @brief Switch region from driver box to usr box. 53 * 54 * @par Description: 55 * This API is used to switch box running region from driver box to usr box, 56 * and change pmp/mpu configuration respectivly. 57 * 58 * @attention 59 * This api can only be invoked in common usr lib space. 60 * 61 * @par Support System: 62 * seliteos. 63 */ 64 void osal_drvmgr_switch_to_usrbox(void); 65 66 #ifdef __cplusplus 67 #if __cplusplus 68 } 69 #endif 70 #endif 71 #endif /* __OSAL_DRVBOX_H__ */