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 #ifndef __HI_SAL_H__ 17 #define __HI_SAL_H__ 18 #include <hi_types.h> 19 #include <hi_ft_nv.h> 20 #include <hi_reset.h> 21 #include <watchdog.h> 22 #include <hi_sal_cfg.h> 23 #include <hi_time.h> 24 #include <hi_stdlib.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 #define WDG_TIMEOUT 6500 31 #define MS_PER_SEC 1000 32 #define MS_PER_MIN (60 * 1000) 33 34 #define HI_WDT_FLAG_REG GLB_CTL_GP_REG1_REG 35 36 #define HI_MONITOR_INTERVAL_MS 1000 37 #define HI_MONITOR_INTERVAL_SEC (HI_MONITOR_INTERVAL_MS / 1000) 38 39 HI_EXTERN hi_u32 g_auto_wdg_rst_sys_timeout; 40 #define check_wd_timerout_enable() (g_auto_wdg_rst_sys_timeout > 0) 41 HI_EXTERN hi_u32 g_cpu_clock; 42 HI_EXTERN hi_u32 g_flash_prot_sem; 43 44 hi_void watchdog_feed(hi_void); 45 hi_u32 hi_sal_timer_init(hi_void); 46 hi_u32 hi_sal_timer_suspend(hi_void); 47 hi_u32 hi_sal_timer_resume(hi_void); 48 hi_void hi_sal_init(hi_void); 49 hi_void hi_sal_wdg_clear(hi_void); 50 51 hi_bool hi_diag_is_init(hi_void); 52 hi_bool hi_get_shell_init(hi_void); 53 54 /** 55 * @ingroup hct_reset_save 56 * @brief save crash messsage into flash. CNcomment:存储crash信息到flash。CNend 57 * 58 * @par 描述: 59 * save crash messsage into flash. CNcomment:存储crash信息到flash。CNend 60 * 61 * @attention 无。 62 * @param data [IN] type #hi_pvoid ,Exception information pointer.CNcomment:异常信息指针。CNend 63 * @param str [IN] type #hi_char * ,Exception description. CNcomment:异常描述。CNend 64 * 65 * @retval None. 66 * @par 依赖: 67 * @li hi_crash.h:文件用于描述异常存储接口。 68 * @see hi_syserr_store_crash_info。 69 */ 70 hi_void hi_syserr_store_crash_info(hi_pvoid data); 71 72 #ifdef __cplusplus 73 } 74 #endif 75 76 #endif /* __HI_SAL_H__ */ 77