• 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  */
15 
16 #include "sal_cfg.h"
17 
18 #include <hi_early_debug.h>
19 #include <hi_nv.h>
20 #include <hi_sal.h>
21 #include <hi_sal_cfg.h>
22 #include <hi_watchdog.h>
23 
24 hi_u32 g_auto_wdg_rst_sys_timeout = PRODUCT_CFG_AUTO_WDG_RESET_SYSTEM_TIMEOUT;
25 
26 // #define CONFIG_HILINK_PKI_SUPPORT /* currently hilink not support PKI provision */
hi_tee_irq_handler(void)27 hi_void hi_tee_irq_handler(void)
28 {
29 #ifdef CONFIG_TEE_HUKS_SUPPORT
30 #if defined(CONFIG_FACTORY_TEST_MODE) && defined(CONFIG_HILINK) && defined(CONFIG_HILINK_PKI_SUPPORT)
31     hks_handle_secure_pki_provision();
32 #else
33     //hks_handle_secure_call();
34 #endif
35 #else
36     printf("receive tee irq\r\n");
37 #endif
38 }
39 
hi_get_rf_xtal_compesation_param(rf_cfg_xtal_compesation * xtal_param)40 hi_u32 hi_get_rf_xtal_compesation_param(rf_cfg_xtal_compesation *xtal_param)
41 {
42     if (xtal_param == HI_NULL) {
43         return HI_ERR_FAILURE;
44     }
45 
46     return hi_factory_nv_read(INIT_CONFIG_XTAL_COMPESATION, (hi_void *)xtal_param, sizeof(rf_cfg_xtal_compesation), 0);
47 }
48 
hi_diag_register_wifi_log()49 hi_void hi_diag_register_wifi_log()
50 {
51 #ifdef CONFIG_DIAG_SUPPORT
52     oam_log_hook_func log_hook = {
53         hi_diag_log_msg0,
54         hi_diag_log_msg1,
55         hi_diag_log_msg2,
56         hi_diag_log_msg3,
57         hi_diag_log_msg4,
58         hi_diag_log_msg_buffer
59     };
60     oam_log_register_hook_func(&log_hook);
61 #endif
62 }
63 
hi_watchdog_set_timeout(hi_u32 timeout_ms)64 hi_u32 hi_watchdog_set_timeout(hi_u32 timeout_ms)
65 {
66     if (timeout_ms < HI_WDG_MIN_TIMEOUT) {
67         return HI_ERR_FAILURE;
68     }
69     g_auto_wdg_rst_sys_timeout = timeout_ms;
70 
71     hi_sal_wdg_clear();
72     return HI_ERR_SUCCESS;
73 }
74 
75