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