• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "sys_driver.h"
16 #include "sys_driver_common.h"
17 #if CONFIG_DUAL_CORE
18 #include "amp_lock_api.h"
19 #endif
20 
21 #if CONFIG_DUAL_CORE
22 #define SYSTEM_REG_LOCK_WAIT_TIME_MS  10
23 #endif
24 
sys_amp_res_acquire()25 uint32_t sys_amp_res_acquire()
26 {
27 #if CONFIG_DUAL_CORE
28 	uint32_t ret_val = SYS_DRV_FAILURE;
29 	ret_val = amp_res_acquire(AMP_RES_ID_SYS_REG, SYSTEM_REG_LOCK_WAIT_TIME_MS);
30 	return ret_val;
31 #endif
32 	return SYS_DRV_SUCCESS;
33 }
34 
sys_amp_res_release()35 uint32_t sys_amp_res_release()
36 {
37 #if CONFIG_DUAL_CORE
38 	uint32_t ret_val = SYS_DRV_FAILURE;
39 	ret_val = amp_res_release(AMP_RES_ID_SYS_REG);
40 	return ret_val;
41 #endif
42 	return SYS_DRV_SUCCESS;
43 }
44 
sys_amp_res_init()45 uint32_t sys_amp_res_init()
46 {
47 #if CONFIG_DUAL_CORE
48 	uint32_t ret_val = SYS_DRV_FAILURE;
49 	ret_val = amp_res_init(AMP_RES_ID_SYS_REG);
50 	return ret_val;
51 #endif
52 	return SYS_DRV_SUCCESS;
53 }
54 
55