1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 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 BLACKBOX_ADAPTER_H 17 #define BLACKBOX_ADAPTER_H 18 19 #include <stdio.h> 20 #include <stdlib.h> 21 22 #ifdef __cplusplus 23 #if __cplusplus 24 extern "C" { 25 #endif /* End of #if __cplusplus */ 26 #endif /* End of #ifdef __cplusplus */ 27 28 #ifndef WEAK 29 #define WEAK __attribute__((weak)) 30 #endif 31 32 /* The following functions need to be implemented by yourself */ 33 extern void SystemModuleDump(const char *logDir, struct ErrorInfo *info); 34 extern void SystemModuleReset(struct ErrorInfo *info); 35 extern int SystemModuleGetLastLogInfo(struct ErrorInfo *info); 36 extern int SystemModuleSaveLastLog(const char *logDir, struct ErrorInfo *info); 37 extern int FullWriteFile(const char *filePath, const char *buf, unsigned int bufSize, int isAppend); 38 extern char *GetFaultLogPath(void); 39 extern void RebootSystem(void); 40 41 /* The following functions have been implemented in the kernel */ 42 extern unsigned int LOS_BinarySemCreate(unsigned short count, unsigned int *semHandle); 43 extern unsigned int LOS_SemPend(unsigned int semHandle, unsigned int timeout); 44 extern unsigned int LOS_SemPost(unsigned int semHandle); 45 46 #ifdef __cplusplus 47 #if __cplusplus 48 } 49 #endif /* End of #if __cplusplus */ 50 #endif /* End of #ifdef __cplusplus */ 51 52 #endif /* End of #ifndef BLACKBOX_ADAPTER_H */