更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
System configuration items

类型定义

typedef VOID(* log_read_write_fn) (UINT32 startAddr, UINT32 space, UINT32 rwFlag, CHAR *buf)
 define the type of functions for reading or writing exception information. 更多...
 

函数

VOID LOS_ExcInfoRegHook (UINT32 startAddr, UINT32 space, CHAR *buf, log_read_write_fn hook)
 Register recording exception information function. 更多...
 

变量

CHAR __int_stack_start
 运行系统函数栈的开始地址 值来自于 liteos.ld中的 __int_stack_start = .; 更多...
 
UINT32 g_sysClock
 系统时钟,是绝大部分部件工作的时钟源,也是其他所有外设的时钟的来源 更多...
 
UINT32 g_tickPerSecond
 每秒Tick数,鸿蒙默认是每秒100次,即:10ms 更多...
 

详细描述

类型定义说明

◆ log_read_write_fn

typedef VOID(* log_read_write_fn) (UINT32 startAddr, UINT32 space, UINT32 rwFlag, CHAR *buf)

define the type of functions for reading or writing exception information.

Description:
  • This defination is used to declare the type of functions for reading or writing exception information
注意
  • "startAddr" must be left to save the exception address space, the size of "buf" is "space"
参数
startAddr[IN] Address of storage ,its must be left to save the exception address space
space[IN] size of storage.its is also the size of "buf"
rwFlag[IN] writer-read flag, 0 for writing,1 for reading, other number is to do nothing.
buf[IN] the buffer of storing data.
返回值
none.
Dependency:
  • los_config.h: the header file that contains the type defination.
参见

在文件 los_config.h435 行定义.

函数说明

◆ LOS_ExcInfoRegHook()

VOID LOS_ExcInfoRegHook ( UINT32  startAddr,
UINT32  space,
CHAR buf,
log_read_write_fn  hook 
)

Register recording exception information function.

Description:
  • This API is used to Register recording exception information function, and specify location and space and size
注意
  • "startAddr" must be left to save the exception address space, the size of "buf" is "space", the space of "buf" is malloc or free in user's code
参数
startAddr[IN] Address of storage, it must be left to save the exception address space
space[IN] size of storage space, it is also the size of "buf"
buf[IN] the buffer of storing exception information, the space of "buf" is malloc or free in user's code
hook[IN] the function for reading or writing exception information.
返回值
none.
Dependency:
  • los_config.h: the header file that contains the API declaration.
参见
此API用于注册记录异常信息函数,并指定位置、空间和大小 startAddr: 保存发送异常的地址信息的启始地址 space: buf的大小 buf: 缓存区 hook: 读写异常信息的函数

Register recording exception information function.

在文件 los_excinfo.c122 行定义.

123{
124 if ((hook == NULL) || (buf == NULL)) {
125 PRINT_ERR("Buf or hook is null.\n");
126 return;
127 }
128
129 g_recordAddr = startAddr;
130 g_recordSpace = space;
131 g_excInfoBuf = buf;
132 g_excInfoRW = hook;
133
134#ifdef LOSCFG_FS_VFS
135 los_vfs_init();//初始化虚拟文件系统
136#endif
137}
void los_vfs_init(void)
Initializes the vfs filesystem
Definition: vfs_init.c:70
STATIC UINT32 g_recordSpace
Definition: los_excinfo.c:47
STATIC CHAR * g_excInfoBuf
Definition: los_excinfo.c:44
STATIC UINT32 g_recordAddr
Definition: los_excinfo.c:46
STATIC log_read_write_fn g_excInfoRW
Definition: los_excinfo.c:43
函数调用图:
这是这个函数的调用关系图:

变量说明

◆ __int_stack_start

CHAR __int_stack_start
extern

运行系统函数栈的开始地址 值来自于 liteos.ld中的 __int_stack_start = .;

int stack start addr | 值在链接时赋予,详见liteos.ld文件

◆ g_sysClock

UINT32 g_sysClock
extern

系统时钟,是绝大部分部件工作的时钟源,也是其他所有外设的时钟的来源

system clock

在文件 los_tick.c40 行定义.

◆ g_tickPerSecond

UINT32 g_tickPerSecond
extern

每秒Tick数,鸿蒙默认是每秒100次,即:10ms

ticks per second

在文件 los_tick.c41 行定义.