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 #ifndef _amp_lock_api_h_ 16 #define _amp_lock_api_h_ 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #include <common/bk_typedef.h> 23 #include <common/bk_err.h> 24 25 enum 26 { 27 AMP_RES_ID_DMA = 0, 28 AMP_RES_ID_GPIO, 29 AMP_RES_ID_SYS_REG, 30 31 AMP_RES_ID_MAX, 32 }; 33 34 bk_err_t amp_res_lock_acquire(u16 res_id, u32 timeout_ms, const char * func_name, int line_no); 35 bk_err_t amp_res_lock_release(u16 res_id, const char * func_name, int line_no); 36 bk_err_t amp_res_lock_init(u16 res_id); 37 38 #define amp_res_acquire(res_id, timeout_ms) amp_res_lock_acquire(res_id, timeout_ms, __FUNCTION__, __LINE__) 39 #define amp_res_release(res_id) amp_res_lock_release(res_id, __FUNCTION__, __LINE__) 40 #define amp_res_init(res_id) amp_res_lock_init(res_id) 41 42 #ifdef __cplusplus 43 } 44 #endif 45 46 #endif /* _amp_lock_api_h_ */ 47 48