You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.1 KiB
1.1 KiB
Programming Example
Example Description
The following functions are demonstrated:
- Registering the hook function for error handling
- Executing the function for error handling
Example Code
The code is as follows:
#include "los_err.h"
#include "los_typedef.h"
#include <stdio.h>
void Test_ErrHandle(CHAR *fileName, UINT32 lineNo, UINT32 errorNo, UINT32 paraLen, VOID *para)
{
printf("err handle ok\n");
}
static UINT32 TestCase(VOID)
{
UINT32 errNo = 0;
UINT32 ret;
UINT32 errLine = 16;
LOS_RegErrHandle(Test_ErrHandle);
ret = LOS_ErrHandle("os_unspecific_file", errLine, errNo, 0, NULL);
if (ret != LOS_OK) {
return LOS_NOK;
}
return LOS_OK;
}
Verification
The verification result is as follows:
Huawei LiteOS # err handle ok