• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: BT CPU UTILS Module Header
15  * Author:
16  * Create:
17  */
18 #ifndef CPU_UTILS_H
19 #define CPU_UTILS_H
20 
21 #include "non_os_reboot.h"
22 #ifdef SUPPORT_PARTITION_INFO
23 #include "partition.h"
24 #endif
25 
26 /**
27  * @defgroup connectivity_libs_cpu_utils CPU Utils
28  * @ingroup  connectivity_libs
29  * @{
30  */
31 typedef void (*cpu_utils_reboot_cb)(int32_t);
32 
33 /**
34  * @brief  Resets the entire chip, and logging information
35  * @param  core The core to request reboot
36  * @param  cause The reboot reason
37  */
38 void cpu_utils_reset_chip_with_log(cores_t core, reboot_cause_t cause);
39 
40 /**
41  * @brief  Reset the entire chip with reboot cause
42  */
43 void cpu_utils_reset_chip_with_cause(reboot_cause_t cause);
44 
45 /**
46  * @brief  Registers the IPC action for the core reboot
47  */
48 void cpu_utils_init(void);
49 
50 /**
51  * @brief  Return the core associated with a given core image
52  * @param  cimage core image
53  * @return physical core associated with core_images_e
54  */
55 cores_t cpu_utils_core_images_to_cores(core_images_e cimage);
56 
57 /**
58  * @brief  set reboot cause & set reboot magic
59  * @param  cause reboot cause
60  */
61 void cpu_utils_set_system_status_by_cause(reboot_cause_t cause);
62 
63 /**
64  * @brief  Registers the call back for the Bt core reboot
65  * @param  cb callback function
66  */
67 void cpu_utils_set_mcu_callback(cpu_utils_reboot_cb cb);
68 
69 #ifdef SUPPORT_PARTITION_INFO
70 /**
71  * @brief  Return the partition id associated with a given core image
72  * @param  cimage core image
73  * @return partition id associated with core_images_e
74  */
75 partition_ids_t cpu_utils_core_iamge_to_partition_id(core_images_e cimage);
76 #endif
77 
78 /**
79  * @}
80  */
81 #endif
82