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_res_lock_h_ 16 #define _amp_res_lock_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 #ifdef CONFIG_DUAL_CORE 26 27 typedef struct 28 { 29 u16 self_req_cnt; 30 u16 others_req_cnt; 31 } amp_res_req_cnt_t; 32 33 #if CONFIG_MASTER_CORE 34 35 /* call this API in interrupt disabled state. */ 36 bk_err_t amp_res_acquire_cnt(u16 res_id, u16 cpu_id, amp_res_req_cnt_t *cnt_list); 37 38 /* call this API in interrupt disabled state. */ 39 bk_err_t amp_res_release_cnt(u16 res_id, u16 cpu_id, amp_res_req_cnt_t *cnt_list); 40 41 #endif 42 43 /* Apps can't call this API, it's for IPC isr only. */ 44 bk_err_t amp_res_available(u16 res_id); 45 46 #endif 47 48 #ifdef __cplusplus 49 } 50 #endif 51 52 #endif /* _amp_res_lock_h_ */ 53 54