更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_blackbox_core.c 文件参考

浏览源代码.

结构体

struct  BBoxOps
 

类型定义

typedef struct BBoxOps BBoxOps
 

函数

static LOS_DL_LIST_HEAD (g_opsList)
 
static void FormatErrorInfo (struct ErrorInfo *info, const char event[EVENT_MAX_LEN], const char module[MODULE_MAX_LEN], const char errorDesc[ERROR_DESC_MAX_LEN])
 
static void WaitForLogPart (void)
 
static bool FindModuleOps (struct ErrorInfo *info, BBoxOps **ops)
 
static void InvokeModuleOps (struct ErrorInfo *info, const BBoxOps *ops)
 
static void SaveLastLog (const char *logDir)
 
static void SaveLogWithoutReset (struct ErrorInfo *info)
 
static void SaveTempErrorLog (void)
 
static void SaveLogWithReset (struct ErrorInfo *info)
 
static void SaveTempErrorInfo (const char event[EVENT_MAX_LEN], const char module[MODULE_MAX_LEN], const char errorDesc[ERROR_DESC_MAX_LEN])
 
static int SaveErrorLog (UINTPTR uwParam1, UINTPTR uwParam2, UINTPTR uwParam3, UINTPTR uwParam4)
 
static void PrintModuleOps (void)
 
int BBoxRegisterModuleOps (struct ModuleOps *ops)
 
int BBoxNotifyError (const char event[EVENT_MAX_LEN], const char module[MODULE_MAX_LEN], const char errorDesc[ERROR_DESC_MAX_LEN], int needSysReset)
 
int OsBBoxDriverInit (void)
 
 LOS_MODULE_INIT (OsBBoxDriverInit, LOS_INIT_LEVEL_ARCH)
 

变量

static bool g_bboxInitSucc = FALSE
 
static UINT32 g_opsListSem = 0
 
static UINT32 g_tempErrInfoSem = 0
 
static UINT32 g_tempErrLogSaveSem = 0
 
struct ErrorInfog_tempErrInfo
 

类型定义说明

◆ BBoxOps

typedef struct BBoxOps BBoxOps

函数说明

◆ BBoxNotifyError()

int BBoxNotifyError ( const char  event[EVENT_MAX_LEN],
const char  module[MODULE_MAX_LEN],
const char  errorDesc[ERROR_DESC_MAX_LEN],
int  needSysReset 
)

在文件 los_blackbox_core.c397 行定义.

401{
402 if (event == NULL || module == NULL || errorDesc == NULL) {
403 BBOX_PRINT_ERR("event: %p, module: %p, errorDesc: %p!\n", event, module, errorDesc);
404 return -1;
405 }
406 if (!g_bboxInitSucc) {
407 BBOX_PRINT_ERR("BlackBox isn't initialized successfully!\n");
408 return -1;
409 }
410
411 if (needSysReset == 0) {
412 SaveTempErrorInfo(event, module, errorDesc);
414 } else {
415 struct ErrorInfo *info = LOS_MemAlloc(m_aucSysMem1, sizeof(struct ErrorInfo));
416 if (info == NULL) {
417 BBOX_PRINT_ERR("LOS_MemAlloc failed!\n");
418 return -1;
419 }
421 SaveLogWithReset(info);
423 }
424
425 return 0;
426}
VOID * LOS_MemAlloc(VOID *pool, UINT32 size)
从指定内存池中申请size长度的内存,注意这可不是从内核堆空间中申请内存
Definition: los_memory.c:1123
UINT8 * m_aucSysMem1
系统动态内存池地址的起始地址 @note_thinking 能否不要用 0,1来命名核心变量 ???
Definition: los_memory.c:108
UINT32 LOS_MemFree(VOID *pool, VOID *ptr)
释放从指定动态内存中申请的内存
Definition: los_memory.c:1369
LITE_OS_SEC_TEXT UINT32 LOS_SemPost(UINT32 semHandle)
对外接口 释放指定的信号量
Definition: los_sem.c:315
static void SaveLogWithReset(struct ErrorInfo *info)
static void SaveTempErrorInfo(const char event[EVENT_MAX_LEN], const char module[MODULE_MAX_LEN], const char errorDesc[ERROR_DESC_MAX_LEN])
static void FormatErrorInfo(struct ErrorInfo *info, const char event[EVENT_MAX_LEN], const char module[MODULE_MAX_LEN], const char errorDesc[ERROR_DESC_MAX_LEN])
static UINT32 g_tempErrLogSaveSem
static bool g_bboxInitSucc
char errorDesc[ERROR_DESC_MAX_LEN]
Definition: los_blackbox.h:64
char module[MODULE_MAX_LEN]
Definition: los_blackbox.h:63
char event[EVENT_MAX_LEN]
Definition: los_blackbox.h:62
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 void
函数调用图:
这是这个函数的调用关系图:

◆ BBoxRegisterModuleOps()

int BBoxRegisterModuleOps ( struct ModuleOps ops)

在文件 los_blackbox_core.c340 行定义.

341{
342 BBoxOps *newOps = NULL;
343 BBoxOps *temp = NULL;
344
345 if (!g_bboxInitSucc) {
346 BBOX_PRINT_ERR("BlackBox isn't initialized successfully!\n");
347 return -1;
348 }
349 if (ops == NULL) {
350 BBOX_PRINT_ERR("ops is NULL!\n");
351 return -1;
352 }
353
354 newOps = LOS_MemAlloc(m_aucSysMem1, sizeof(*newOps));
355 if (newOps == NULL) {
356 BBOX_PRINT_ERR("LOS_MemAlloc failed!\n");
357 return -1;
358 }
359 (void)memset_s(newOps, sizeof(*newOps), 0, sizeof(*newOps));
360 if (memcpy_s(&newOps->ops, sizeof(newOps->ops), ops, sizeof(*ops)) != EOK) {
361 BBOX_PRINT_ERR("newOps->ops is not enough or memcpy_s failed!\n");
362 (void)LOS_MemFree(m_aucSysMem1, newOps);
363 return -1;
364 }
365 if (LOS_SemPend(g_opsListSem, LOS_WAIT_FOREVER) != LOS_OK) {
366 BBOX_PRINT_ERR("Request g_opsListSem failed!\n");
367 (void)LOS_MemFree(m_aucSysMem1, newOps);
368 return -1;
369 }
370 if (LOS_ListEmpty(&g_opsList)) {
371 goto __out;
372 }
373
374 LOS_DL_LIST_FOR_EACH_ENTRY(temp, &g_opsList, BBoxOps, opsList) {
375 if (temp == NULL) {
376 continue;
377 }
378 if (strcmp(temp->ops.module, ops->module) == 0) {
379 BBOX_PRINT_ERR("module [%s] has been registered!\n", ops->module);
381 (void)LOS_MemFree(m_aucSysMem1, newOps);
382 return -1;
383 }
384 }
385
386__out:
387 LOS_ListTailInsert(&g_opsList, &newOps->opsList);
389 BBOX_PRINT_INFO("module [%s] is registered successfully!\n", ops->module);
390#ifdef LOSCFG_BLACKBOX_DEBUG
392#endif
393
394 return 0;
395}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListTailInsert(LOS_DL_LIST *list, LOS_DL_LIST *node)
Insert a node to the tail of a doubly linked list.
Definition: los_list.h:244
LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty(LOS_DL_LIST *list)
Identify whether a specified doubly linked list is empty. | 判断链表是否为空
Definition: los_list.h:321
LITE_OS_SEC_TEXT UINT32 LOS_SemPend(UINT32 semHandle, UINT32 timeout)
对外接口 申请指定的信号量,并设置超时时间
Definition: los_sem.c:226
static UINT32 g_opsListSem
static void PrintModuleOps(void)
LOS_DL_LIST opsList
struct ModuleOps ops
char module[MODULE_MAX_LEN]
Definition: los_blackbox.h:68
函数调用图:
这是这个函数的调用关系图:

◆ FindModuleOps()

static bool FindModuleOps ( struct ErrorInfo info,
BBoxOps **  ops 
)
static

在文件 los_blackbox_core.c117 行定义.

118{
119 bool found = false;
120
121 if (info == NULL || ops == NULL) {
122 BBOX_PRINT_ERR("info: %p, ops: %p!\n", info, ops);
123 return found;
124 }
125
126 LOS_DL_LIST_FOR_EACH_ENTRY(*ops, &g_opsList, BBoxOps, opsList) {
127 if (*ops != NULL && strcmp((*ops)->ops.module, info->module) == 0) {
128 found = true;
129 break;
130 }
131 }
132 if (!found) {
133 BBOX_PRINT_ERR("[%s] hasn't been registered!\n", info->module);
134 }
135
136 return found;
137}
这是这个函数的调用关系图:

◆ FormatErrorInfo()

static void FormatErrorInfo ( struct ErrorInfo info,
const char  event[EVENT_MAX_LEN],
const char  module[MODULE_MAX_LEN],
const char  errorDesc[ERROR_DESC_MAX_LEN] 
)
static

在文件 los_blackbox_core.c72 行定义.

76{
77 if (info == NULL || event == NULL || module == NULL || errorDesc == NULL) {
78 BBOX_PRINT_ERR("info: %p, event: %p, module: %p, errorDesc: %p!\n", info, event, module, errorDesc);
79 return;
80 }
81
82 (void)memset_s(info, sizeof(*info), 0, sizeof(*info));
83 if (strncpy_s(info->event, sizeof(info->event), event, Min(strlen(event), sizeof(info->event) - 1)) != EOK) {
84 BBOX_PRINT_ERR("info->event is not enough or strncpy_s failed!\n");
85 }
86 if (strncpy_s(info->module, sizeof(info->module), module, Min(strlen(module), sizeof(info->module) - 1)) != EOK) {
87 BBOX_PRINT_ERR("info->module is not enough or strncpy_s failed!\n");
88 }
89 if (strncpy_s(info->errorDesc, sizeof(info->errorDesc), errorDesc,
90 Min(strlen(errorDesc), sizeof(info->errorDesc) - 1)) != EOK) {
91 BBOX_PRINT_ERR("info->errorDesc is not enough or strncpy_s failed!\n");
92 }
93}
这是这个函数的调用关系图:

◆ InvokeModuleOps()

static void InvokeModuleOps ( struct ErrorInfo info,
const BBoxOps ops 
)
static

在文件 los_blackbox_core.c139 行定义.

140{
141 if (info == NULL || ops == NULL) {
142 BBOX_PRINT_ERR("info: %p, ops: %p!\n", info, ops);
143 return;
144 }
145
146 if (ops->ops.Dump != NULL) {
147 BBOX_PRINT_INFO("[%s] starts dumping log!\n", ops->ops.module);
148 ops->ops.Dump(LOSCFG_BLACKBOX_LOG_ROOT_PATH, info);
149 BBOX_PRINT_INFO("[%s] ends dumping log!\n", ops->ops.module);
150 }
151 if (ops->ops.Reset != NULL) {
152 BBOX_PRINT_INFO("[%s] starts resetting!\n", ops->ops.module);
153 ops->ops.Reset(info);
154 BBOX_PRINT_INFO("[%s] ends resetting!\n", ops->ops.module);
155 }
156}
void(* Reset)(struct ErrorInfo *info)
Definition: los_blackbox.h:70
void(* Dump)(const char *logDir, struct ErrorInfo *info)
Definition: los_blackbox.h:69
这是这个函数的调用关系图:

◆ LOS_DL_LIST_HEAD()

static LOS_DL_LIST_HEAD ( g_opsList  )
static

◆ LOS_MODULE_INIT()

LOS_MODULE_INIT ( OsBBoxDriverInit  ,
LOS_INIT_LEVEL_ARCH   
)

◆ OsBBoxDriverInit()

int OsBBoxDriverInit ( void  )

在文件 los_blackbox_core.c428 行定义.

429{
430 UINT32 taskID;
431 TSK_INIT_PARAM_S taskParam;
432
433 if (LOS_BinarySemCreate(1, &g_opsListSem) != LOS_OK) {
434 BBOX_PRINT_ERR("Create g_opsListSem failed!\n");
435 return LOS_NOK;
436 }
437 if (LOS_BinarySemCreate(1, &g_tempErrInfoSem) != LOS_OK) {
438 BBOX_PRINT_ERR("Create g_tempErrInfoSem failed!\n");
439 goto __err;
440 }
441 if (LOS_BinarySemCreate(0, &g_tempErrLogSaveSem) != LOS_OK) {
442 BBOX_PRINT_ERR("Create g_tempErrLogSaveSem failed!\n");
443 goto __err;
444 }
445 LOS_ListInit(&g_opsList);
447 if (g_tempErrInfo == NULL) {
448 BBOX_PRINT_ERR("LOS_MemAlloc failed!\n");
449 goto __err;
450 }
451 (void)memset_s(g_tempErrInfo, sizeof(*g_tempErrInfo), 0, sizeof(*g_tempErrInfo));
452 (void)memset_s(&taskParam, sizeof(taskParam), 0, sizeof(taskParam));
453 taskParam.auwArgs[0] = (UINTPTR)LOSCFG_BLACKBOX_LOG_ROOT_PATH;
455 taskParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
456 taskParam.pcName = "SaveErrorLog";
457 taskParam.usTaskPrio = LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO;
458 taskParam.uwResved = LOS_TASK_STATUS_DETACHED;
459#ifdef LOSCFG_KERNEL_SMP
460 taskParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid());
461#endif
462 (void)LOS_TaskCreate(&taskID, &taskParam);
463 g_bboxInitSucc = TRUE;
464 return LOS_OK;
465
466__err:
467 if (g_opsListSem != 0) {
469 }
470 if (g_tempErrInfoSem != 0) {
472 }
473 if (g_tempErrLogSaveSem != 0) {
475 }
476 return LOS_NOK;
477}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list)
Definition: los_list.h:104
LITE_OS_SEC_TEXT_INIT UINT32 LOS_BinarySemCreate(UINT16 count, UINT32 *semHandle)
对外接口 创建二值信号量,其计数值最大为1,可以当互斥锁用
Definition: los_sem.c:182
LITE_OS_SEC_TEXT_INIT UINT32 LOS_SemDelete(UINT32 semHandle)
对外接口 删除指定的信号量,参数就是 semID
Definition: los_sem.c:187
LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreate(UINT32 *taskID, TSK_INIT_PARAM_S *initParam)
创建任务,并使该任务进入ready状态,如果就绪队列中没有更高优先级的任务,则运行该任务
Definition: los_task.c:718
VOID *(* TSK_ENTRY_FUNC)(UINTPTR param1, UINTPTR param2, UINTPTR param3, UINTPTR param4)
Define the type of a task entrance function.
Definition: los_task.h:480
struct ErrorInfo * g_tempErrInfo
static UINT32 g_tempErrInfoSem
static int SaveErrorLog(UINTPTR uwParam1, UINTPTR uwParam2, UINTPTR uwParam3, UINTPTR uwParam4)
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
Definition: los_hw_cpu.h:168
unsigned long UINTPTR
Definition: los_typedef.h:68
unsigned int UINT32
Definition: los_typedef.h:57
UINT16 usTaskPrio
Definition: los_task.h:505
UINTPTR auwArgs[4]
Definition: los_task.h:507
UINT16 usCpuAffiMask
Definition: los_task.h:511
UINT32 uwStackSize
Definition: los_task.h:508
CHAR * pcName
Definition: los_task.h:509
TSK_ENTRY_FUNC pfnTaskEntry
Definition: los_task.h:504
UINT32 uwResved
Definition: los_task.h:513
函数调用图:

◆ PrintModuleOps()

static void PrintModuleOps ( void  )
static

在文件 los_blackbox_core.c325 行定义.

326{
327 struct BBoxOps *ops = NULL;
328
329 BBOX_PRINT_INFO("The following modules have been registered!\n");
330 LOS_DL_LIST_FOR_EACH_ENTRY(ops, &g_opsList, BBoxOps, opsList) {
331 if (ops == NULL) {
332 continue;
333 }
334 BBOX_PRINT_INFO("module: %s, Dump: %p, Reset: %p, GetLastLogInfo: %p, SaveLastLog: %p\n",
335 ops->ops.module, ops->ops.Dump, ops->ops.Reset, ops->ops.GetLastLogInfo, ops->ops.SaveLastLog);
336 }
337}
int(* SaveLastLog)(const char *logDir, struct ErrorInfo *info)
Definition: los_blackbox.h:72
int(* GetLastLogInfo)(struct ErrorInfo *info)
Definition: los_blackbox.h:71
这是这个函数的调用关系图:

◆ SaveErrorLog()

static int SaveErrorLog ( UINTPTR  uwParam1,
UINTPTR  uwParam2,
UINTPTR  uwParam3,
UINTPTR  uwParam4 
)
static

在文件 los_blackbox_core.c303 行定义.

304{
305 const char *logDir = (const char *)uwParam1;
306 (void)uwParam2;
307 (void)uwParam3;
308 (void)uwParam4;
309
310#ifdef LOSCFG_FS_VFS
312#endif
313 SaveLastLog(logDir);
314 while (1) {
315 if (LOS_SemPend(g_tempErrLogSaveSem, LOS_WAIT_FOREVER) != LOS_OK) {
316 BBOX_PRINT_ERR("Request g_tempErrLogSaveSem failed!\n");
317 continue;
318 }
320 }
321 return 0;
322}
static void SaveTempErrorLog(void)
static void SaveLastLog(const char *logDir)
static void WaitForLogPart(void)
函数调用图:
这是这个函数的调用关系图:

◆ SaveLastLog()

static void SaveLastLog ( const char *  logDir)
static

在文件 los_blackbox_core.c158 行定义.

159{
160 struct ErrorInfo *info = NULL;
161 BBoxOps *ops = NULL;
162
163 info = LOS_MemAlloc(m_aucSysMem1, sizeof(*info));
164 if (info == NULL) {
165 BBOX_PRINT_ERR("LOS_MemAlloc failed!\n");
166 return;
167 }
168
169 if (LOS_SemPend(g_opsListSem, LOS_WAIT_FOREVER) != LOS_OK) {
170 BBOX_PRINT_ERR("Request g_opsListSem failed!\n");
172 return;
173 }
174 if (CreateLogDir(LOSCFG_BLACKBOX_LOG_ROOT_PATH) != 0) {
177 BBOX_PRINT_ERR("Create log dir [%s] failed!\n", LOSCFG_BLACKBOX_LOG_ROOT_PATH);
178 return;
179 }
180 LOS_DL_LIST_FOR_EACH_ENTRY(ops, &g_opsList, BBoxOps, opsList) {
181 if (ops == NULL) {
182 BBOX_PRINT_ERR("ops: NULL, please check it!\n");
183 continue;
184 }
185 if (ops->ops.GetLastLogInfo != NULL && ops->ops.SaveLastLog != NULL) {
186 (void)memset_s(info, sizeof(*info), 0, sizeof(*info));
187 if (ops->ops.GetLastLogInfo(info) != 0) {
188 BBOX_PRINT_ERR("[%s] failed to get log info!\n", ops->ops.module);
189 continue;
190 }
191 BBOX_PRINT_INFO("[%s] starts saving log!\n", ops->ops.module);
192 if (ops->ops.SaveLastLog(logDir, info) != 0) {
193 BBOX_PRINT_ERR("[%s] failed to save log!\n", ops->ops.module);
194 } else {
195 BBOX_PRINT_INFO("[%s] ends saving log!\n", ops->ops.module);
196 BBOX_PRINT_INFO("[%s] starts uploading event [%s]\n", info->module, info->event);
197#ifdef LOSCFG_FS_VFS
198 (void)UploadEventByFile(KERNEL_FAULT_LOG_PATH);
199#else
200 BBOX_PRINT_INFO("LOSCFG_FS_VFS isn't defined!\n");
201#endif
202 BBOX_PRINT_INFO("[%s] ends uploading event [%s]\n", info->module, info->event);
203 }
204 } else {
205 BBOX_PRINT_ERR("module [%s], GetLastLogInfo: %p, SaveLastLog: %p!\n",
206 ops->ops.module, ops->ops.GetLastLogInfo, ops->ops.SaveLastLog);
207 }
208 }
211}
int CreateLogDir(const char *dirPath)
int UploadEventByFile(const char *filePath)
函数调用图:
这是这个函数的调用关系图:

◆ SaveLogWithoutReset()

static void SaveLogWithoutReset ( struct ErrorInfo info)
static

在文件 los_blackbox_core.c213 行定义.

214{
215 BBoxOps *ops = NULL;
216
217 if (info == NULL) {
218 BBOX_PRINT_ERR("info is NULL!\n");
219 return;
220 }
221
222 if (LOS_SemPend(g_opsListSem, LOS_WAIT_FOREVER) != LOS_OK) {
223 BBOX_PRINT_ERR("Request g_opsListSem failed!\n");
224 return;
225 }
226 if (!FindModuleOps(info, &ops)) {
228 return;
229 }
230 if (CreateLogDir(LOSCFG_BLACKBOX_LOG_ROOT_PATH) != 0) {
232 BBOX_PRINT_ERR("Create log dir [%s] failed!\n", LOSCFG_BLACKBOX_LOG_ROOT_PATH);
233 return;
234 }
235 if (ops->ops.Dump == NULL && ops->ops.Reset == NULL) {
237 if (SaveBasicErrorInfo(USER_FAULT_LOG_PATH, info) == 0) {
238 BBOX_PRINT_INFO("[%s] starts uploading event [%s]\n", info->module, info->event);
239#ifdef LOSCFG_FS_VFS
240 (void)UploadEventByFile(USER_FAULT_LOG_PATH);
241#else
242 BBOX_PRINT_INFO("LOSCFG_FS_VFS isn't defined!\n");
243#endif
244 BBOX_PRINT_INFO("[%s] ends uploading event [%s]\n", info->module, info->event);
245 }
246 return;
247 }
248 InvokeModuleOps(info, ops);
250}
int SaveBasicErrorInfo(const char *filePath, const struct ErrorInfo *info)
static bool FindModuleOps(struct ErrorInfo *info, BBoxOps **ops)
static void InvokeModuleOps(struct ErrorInfo *info, const BBoxOps *ops)
函数调用图:
这是这个函数的调用关系图:

◆ SaveLogWithReset()

static void SaveLogWithReset ( struct ErrorInfo info)
static

在文件 los_blackbox_core.c269 行定义.

270{
271 int ret;
272 BBoxOps *ops = NULL;
273
274 if (info == NULL) {
275 BBOX_PRINT_ERR("info is NULL!\n");
276 return;
277 }
278
279 if (!FindModuleOps(info, &ops)) {
280 return;
281 }
282 InvokeModuleOps(info, ops);
283 ret = SysReboot(0, 0, RB_AUTOBOOT);
284 BBOX_PRINT_INFO("SysReboot, ret: %d\n", ret);
285}
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 ARG_NUM_0 ARG_NUM_2 ARG_NUM_1 ARG_NUM_2 ARG_NUM_3 ARG_NUM_7 ARG_NUM_2 ARG_NUM_3 ARG_NUM_2 ARG_NUM_4 ARG_NUM_5 ARG_NUM_6 ARG_NUM_3 ARG_NUM_5 ARG_NUM_7 ARG_NUM_1 ARG_NUM_4 ARG_NUM_5 ARG_NUM_4 ARG_NUM_7 ARG_NUM_2 ARG_NUM_3 ARG_NUM_7 ARG_NUM_7 ARG_NUM_3 ARG_NUM_3 ARG_NUM_3 ARG_NUM_7 ARG_NUM_3 ARG_NUM_2 char ARG_NUM_2 ARG_NUM_1 ARG_NUM_0 ARG_NUM_0 SysReboot
函数调用图:
这是这个函数的调用关系图:

◆ SaveTempErrorInfo()

static void SaveTempErrorInfo ( const char  event[EVENT_MAX_LEN],
const char  module[MODULE_MAX_LEN],
const char  errorDesc[ERROR_DESC_MAX_LEN] 
)
static

在文件 los_blackbox_core.c287 行定义.

290{
291 if (event == NULL || module == NULL || errorDesc == NULL) {
292 BBOX_PRINT_ERR("event: %p, module: %p, errorDesc: %p!\n", event, module, errorDesc);
293 return;
294 }
295 if (LOS_SemPend(g_tempErrInfoSem, LOS_NO_WAIT) != LOS_OK) {
296 BBOX_PRINT_ERR("Request g_tempErrInfoSem failed!\n");
297 return;
298 }
299 FormatErrorInfo(g_tempErrInfo, event, module, errorDesc);
301}
函数调用图:
这是这个函数的调用关系图:

◆ SaveTempErrorLog()

static void SaveTempErrorLog ( void  )
static

在文件 los_blackbox_core.c252 行定义.

253{
254 if (LOS_SemPend(g_tempErrInfoSem, LOS_WAIT_FOREVER) != LOS_OK) {
255 BBOX_PRINT_ERR("Request g_tempErrInfoSem failed!\n");
256 return;
257 }
258 if (g_tempErrInfo == NULL) {
259 BBOX_PRINT_ERR("g_tempErrInfo is NULL!\n");
261 return;
262 }
263 if (strlen(g_tempErrInfo->event) != 0) {
265 }
267}
static void SaveLogWithoutReset(struct ErrorInfo *info)
函数调用图:
这是这个函数的调用关系图:

◆ WaitForLogPart()

static void WaitForLogPart ( void  )
static

在文件 los_blackbox_core.c96 行定义.

97{
98 BBOX_PRINT_INFO("wait for log part [%s] begin!\n", LOSCFG_BLACKBOX_LOG_PART_MOUNT_POINT);
99 while (!IsLogPartReady()) {
100 LOS_Msleep(LOG_PART_WAIT_TIME);
101 }
102 BBOX_PRINT_INFO("wait for log part [%s] end!\n", LOSCFG_BLACKBOX_LOG_PART_MOUNT_POINT);
103}
LITE_OS_SEC_TEXT_MINOR VOID LOS_Msleep(UINT32 msecs)
Sleep the current task.
Definition: los_misc.c:44
bool IsLogPartReady(void)
函数调用图:
这是这个函数的调用关系图:

变量说明

◆ g_bboxInitSucc

bool g_bboxInitSucc = FALSE
static

在文件 los_blackbox_core.c64 行定义.

◆ g_opsListSem

UINT32 g_opsListSem = 0
static

在文件 los_blackbox_core.c65 行定义.

◆ g_tempErrInfo

struct ErrorInfo* g_tempErrInfo

在文件 los_blackbox_core.c69 行定义.

◆ g_tempErrInfoSem

UINT32 g_tempErrInfoSem = 0
static

在文件 los_blackbox_core.c66 行定义.

◆ g_tempErrLogSaveSem

UINT32 g_tempErrLogSaveSem = 0
static

在文件 los_blackbox_core.c67 行定义.