Compare commits

...

28 Commits

Author SHA1 Message Date
openharmony_ci
887a845874 !724 fix: 修复系统时间比RTC时间过快的问题
Merge pull request !724 from zhushengle/tick_3.0.0
2022-06-25 10:12:26 +00:00
zhushengle
8ee33a771b fix: 修复系统时间比RTC时间过快的问题
1.标记在时间接口中更新base后在中断中不再更新base
2.优化tick计算

Close #I5DCRB

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I525e6e996fd40890b52c1c749ef0bad20c8136d8
2022-06-25 09:45:45 +08:00
openharmony_ci
c182540a92 !716 fix:ping命令访问野指针及内存泄漏问题修复
Merge pull request !716 from Zhaotianyu/0617ping_fix
2022-06-18 10:06:29 +00:00
arvinzzz
d837ed3e9d fix: ping命令内访问野指针及内存泄漏
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
2022-06-17 16:54:51 +08:00
openharmony_ci
a2371f1b27 !706 【3.0-LTS】 littlefs接口缺乏锁的保护
Merge pull request !706 from Far/OpenHarmony-3.0-LTS
2022-06-13 07:53:29 +00:00
Far
8245cd5cd0 fix: 修复littlefs适配层锁的问题
littlefs适配lfs_api.c中调用littlefs原生接口未用锁保护,修复之

Close #I5BVO3

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I18e99d2be27c9de86acd1610b58168d9190203bd
2022-06-13 14:04:44 +08:00
openharmony_ci
b9311b9aa0 !696 FatFs升级r0.14a版本同步3.0分支
Merge pull request !696 from wangchen/05_31_up_m
2022-06-02 07:43:02 +00:00
wangchen
8cf75d80fd fix: FatFs升级r0.14a版本同步3.0分支
【背景】FatFs升级r0.14a版本同步3.0分支

【修改方案】
将三方库FatFs升级至r0.14a版本
主要修改点为:
适配f_mkfs接口更新
【影响】
对现有的产品编译不会有影响。
re #I5A7AS
Signed-off-by: wangchen <wangchen64@huawei.com>

Change-Id: I571f458a19d04520c86ab0ed63edcabb25d80e5e
2022-05-31 09:00:54 +00:00
openharmony_ci
4491d561c7 !679 内核codex清零
Merge pull request !679 from Kiita/0421_codex
2022-04-25 04:36:10 +00:00
zhangyan
1bf61bb4b0 内核codex告警清零
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: Ie510061dd37e4bafcb208e08311f43ef3119040c
2022-04-24 09:05:50 +00:00
openharmony_ci
b62463abc5 !594 处理M核编译告警
Merge pull request !594 from yinjiaming/OpenHarmony-3.0-LTS
2022-02-15 01:21:53 +00:00
yinjiaming
6ffea886d3 fix: 编译告警清零
【背景】

3.0 LTS 告警清零

【修改方案】
添加了安全函数的检查,将不安全的函数改写为安全函数

【影响】
对现有的产品编译不会有影响。

re #I4TM2U

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I4479172e755821916aa6f299607fdceac763d468
2022-02-14 12:41:52 +00:00
openharmony_ci
9de6f57cda !549 挑单 pthread_create创建的线程未设置detach属性,主动退出后,OsGetAllTskInfo调用后,相关的任务名为乱码
Merge pull request !549 from wangchen/exit_3
2022-01-18 03:54:25 +00:00
openharmony_ci
307ab396a5 !548 挑单 L0 pthread_cond_timedwait接口存在计算溢出
Merge pull request !548 from wangchen/cond_3
2022-01-18 03:53:40 +00:00
wangchen
96b2eaeab6 fix: thread_create创建的线程未设置detach属性,主动退出后,OsGetAllTskInfo调用后,相关的任务名为乱码
【背景】thread_create创建的线程未设置detach属性,主动退出后,OsGetAllTskInfo调用后,相关的任务名为乱码

【修改方案】
修改线程退出流程
【影响】
对现有的产品编译不会有影响。

re #I4R4D3
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-01-17 08:02:20 +00:00
wangchen
58e67dde3b fix: L0 pthread_cond_timedwait接口实现存在的几个问题
【背景】L0 pthread_cond_timedwait接口存在计算溢出

【修改方案】
1,新增abstick 相关修改,先判断再转成32位,避免截断
2,LOS_Event相关函数返回值的处理已存在,无需处理
【影响】
对现有的产品编译不会有影响。

re #I4R4A5
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-01-17 07:14:09 +00:00
openharmony_ci
f74067b24f !519 chore: shell体验优化
Merge pull request !519 from huangshan/cherry-pick-1640932575
2022-01-07 03:21:00 +00:00
huangshan
86bc68744d fixed 57cff79 from https://gitee.com/uhamc/kernel_liteos_m/pulls/386
chore: shell完善帮助信息,特殊处理不可见字符

Signed-off-by: huangshan <huangshan9@huawei.com>
Change-Id: I3cbc559c388b5d5a524783c1f55c1e569a44465c
2021-12-31 06:36:18 +00:00
openharmony_ci
39db69b6bf !478 添加bundle.json
Merge pull request !478 from pjscc/OpenHarmony-3.0-LTS
2021-12-31 03:13:18 +00:00
openharmony_ci
87c6e9476d !500 【fix】api_shell.c 宏修改
Merge pull request !500 from pef/lts_sync
2021-12-30 08:20:32 +00:00
openharmony_ci
94537e17ae !507 fix:在非静态初始化条件下pthread_mutex_lock,没有经过init初始化就可以对已销毁的锁进行加锁 挑单到3.0分支
Merge pull request !507 from x_xiny/fix_pthread_mutex_lock
2021-12-29 07:21:32 +00:00
openharmony_ci
9717eafff7 !514 fix the compile warning
Merge pull request !514 from laojr1/OpenHarmony-3.0-LTS
2021-12-29 06:23:04 +00:00
老家荣
0712c2df56 chore: 解决 cmsis_liteos2.c:115:23: warning 编译告警
Signed-off-by: laojr1 <laojr1@midea.com>
2021-12-29 14:11:44 +08:00
pjscc
50b4e91f91 feat: 添加bundle.json作为hpm包管理描述文件
Signed-off-by: pjscc <pangjiashuai@huawei.com>
2021-12-29 10:33:46 +08:00
openharmony_ci
443d9deb9b !483 fix: 修复los_interrupt.c文件中HalHwiInit函数里未使能未对齐异常问题
Merge pull request !483 from kenneth/cherry-pick-1640158553
2021-12-29 00:54:26 +00:00
kenneth
caa28225a8 fixed d32e25f from https://gitee.com/rtos_yuan/kernel_liteos_m/pulls/362
fix: 修复los_interrupt.c文件中HalHwiInit函数里未使能未对齐异常问题

修复los_interrupt.c文件中HalHwiInit函数里未使能未对齐异常问题

close #I4EJGR

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-12-28 09:13:14 +08:00
x-xiny
2332f34a79 fix:在非静态初始化条件下pthread_mutex_lock,没有经过init初始化就可以对已销毁的锁进行加锁
【背景】
 在非静态初始化条件下pthread_mutex_lock,没有经过init初始化就可以对已销毁的锁进行加锁

【修改方案】
 在pthread_mutex_destroy中将mutex的magic标记字段清除

 re #I4I7OA

 Signed-off-by: x-xiny <1301913191@qq.com>

Change-Id: I5d4cceff852e20e659a7cd06acf27cc6f381962c
2021-12-27 06:23:22 +00:00
pef
314af71a48 fix: 将未定义小写"true","false"改为"TRUE","FALSE"。
【背景】
api_shell.c文件使用小写的true和false 却没有定义
[OHOS ERROR] ../../../kernel/liteos_m/components/net/lwip-2.1/porting/src/api_shell.c:342:25: error: 'false' undeclared (first use in this function)
[OHOS ERROR]      BOOL timeout_flag = false;
编译报错。
【修改方案】
1. 将未定义的 true,false改为已定义的宏TRUE,FALSE。

【影响】
对现有的产品编译不会有影响。

re #I43D20

Change-Id: If66adab35f2315d0caca2a487960be887567126b
Signed-off-by: pef <cyd1997@126.com>
2021-12-27 09:55:08 +08:00
37 changed files with 467 additions and 224 deletions

59
bundle.json Normal file
View File

@@ -0,0 +1,59 @@
{
"name": "@ohos/kernel_liteos_m",
"version": "",
"description": "liteos-m内核",
"homePage": "https://gitee.com/openharmony",
"license": "BSD 3-clause",
"repository": "https://gitee.com/openharmony/kernel_liteos_m",
"domain": "os",
"language": "",
"publishAs": "code-segment",
"private": false,
"scripts": {},
"tags": [
"kernel"
],
"keywords": [
"kernel",
"liteos-m"
],
"envs": [],
"dirs": [],
"author": {
"name": "",
"email": "",
"url": ""
},
"contributors": [
{
"name": "",
"email": "",
"url": ""
}
],
"segment": {
"destPath": "kernel/liteos_m"
},
"component": {
"name": "liteos-m",
"subsystem": "liteos_m",
"syscap": [
"SystemCapability.Kernel.liteos-m"
],
"features": [],
"adapted_system_type": [
"mini"
],
"rom": "",
"ram": "",
"deps": {
"components": [],
"third_party": []
},
"build": {
"sub_component": [],
"inner_kits": [],
"test": []
}
}
}

View File

@@ -151,7 +151,7 @@ STATIC INLINE UINT32 OsStackAddrGet(UINTPTR *stackStart, UINTPTR *stackEnd, UINT
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
*stackEnd = (UINTPTR)taskCB->topOfStack + taskCB->stackSize;
if ((*stackStart < (UINTPTR)taskCB->topOfStack) || (*stackStart >= *stackEnd)) {
PRINT_ERR("psp stack [0x%x, 0x%x], cur sp(0x%x) is overflow, cur task id is %d!\n",
PRINT_ERR("psp stack [0x%x, 0x%x], cur sp(0x%x) is overflow, cur task id is %u!\n",
taskCB->topOfStack, *stackEnd, *stackStart, taskID);
return LOS_NOK;
}
@@ -413,7 +413,7 @@ VOID LOS_BackTrace(VOID)
if (LR[index] == 0) {
break;
}
PRINTK("traceback %d -- lr = 0x%x\r\n", index, LR[index]);
PRINTK("traceback %u -- lr = 0x%x\r\n", index, LR[index]);
}
PRINTK("----- traceback end -----\r\n");
}

View File

@@ -481,7 +481,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E
PRINTK("\nSysCpuUsage in <1s: ");
}
ret = LOS_HistorySysCpuUsage(mode);
PRINTK("%d.%d", ret / LOS_CPUP_PRECISION_MULT, ret % LOS_CPUP_PRECISION_MULT);
PRINTK("%u.%u", ret / LOS_CPUP_PRECISION_MULT, ret % LOS_CPUP_PRECISION_MULT);
break;
case TASK_CPU_USAGE:
@@ -495,11 +495,11 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E
return OS_ERROR;
}
if (mode == CPUP_IN_10S) {
PRINTK("\nCPUusage of taskID %d in 10s: ", taskID);
PRINTK("\nCPUusage of taskID %u in 10s: ", taskID);
} else if (mode == CPUP_IN_1S) {
PRINTK("\nCPUusage of taskID %d in 1s: ", taskID);
PRINTK("\nCPUusage of taskID %u in 1s: ", taskID);
} else {
PRINTK("\nCPUusage of taskID %d in <1s: ", taskID);
PRINTK("\nCPUusage of taskID %u in <1s: ", taskID);
}
ret = LOS_HistoryTaskCpuUsage(taskID, mode);
PRINTK("%u.%u", ret / LOS_CPUP_PRECISION_MULT, ret % LOS_CPUP_PRECISION_MULT);

View File

@@ -1432,6 +1432,7 @@ int fatfs_format(const char *dev, int sectors, int option)
INT32 index;
FRESULT res;
INT32 ret;
MKFS_PARM opt = {0};
if (dev == NULL) {
errno = EFAULT;
@@ -1458,7 +1459,9 @@ int fatfs_format(const char *dev, int sectors, int option)
goto OUT;
}
res = f_mkfs(dev, option, sectors, g_workBuffer, FF_MAX_SS);
opt.n_sect = sectors;
opt.fmt = (BYTE)option;
res = f_mkfs(dev, &opt, g_workBuffer, FF_MAX_SS);
if (res != FR_OK) {
errno = FatfsErrno(res);
ret = FS_FAILURE;

View File

@@ -32,6 +32,8 @@
#define _GNU_SOURCE 1
#include "lfs_api.h"
#include "los_config.h"
#include "los_mux.h"
#include "los_debug.h"
#include "securec.h"
lfs_t g_lfs;
@@ -40,29 +42,41 @@ FileDirInfo g_lfsDir[LFS_MAX_OPEN_DIRS] = {0};
struct FileOpInfo g_fsOp[LOSCFG_LFS_MAX_MOUNT_SIZE] = {0};
static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0};
struct dirent g_nameValue;
static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER;
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a", "/b", "/c"};
#define LFS_MUTEX_UNINIT (-1)
static UINT32 g_lfsMutex = LFS_MUTEX_UNINIT;
static int LfsLock(void)
{
if (LOS_MuxPend(g_lfsMutex, LOS_WAIT_FOREVER) != LOS_OK) {
PRINT_ERR("LfsLock failed!");
return LOS_NOK;
}
return LOS_OK;
}
static void LfsUnlock(void)
{
(void)LOS_MuxPost(g_lfsMutex);
}
LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd)
{
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
if (g_handle[i].useFlag == 0) {
*fd = i;
g_handle[i].useFlag = 1;
g_handle[i].pathName = strdup(fileName);
pthread_mutex_unlock(&g_FslocalMutex);
return &(g_handle[i]);
}
}
pthread_mutex_unlock(&g_FslocalMutex);
*fd = INVALID_FD;
return NULL;
}
static void LfsFreeFd(int fd)
{
pthread_mutex_lock(&g_FslocalMutex);
g_handle[fd].useFlag = 0;
if (g_handle[fd].pathName != NULL) {
free((void *)g_handle[fd].pathName);
@@ -72,21 +86,17 @@ static void LfsFreeFd(int fd)
if (g_handle[fd].lfsHandle != NULL) {
g_handle[fd].lfsHandle = NULL;
}
pthread_mutex_unlock(&g_FslocalMutex);
}
BOOL CheckFileIsOpen(const char *fileName)
{
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
if (g_handle[i].useFlag == 1) {
if (strcmp(g_handle[i].pathName, fileName) == 0) {
pthread_mutex_unlock(&g_FslocalMutex);
return TRUE;
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
return FALSE;
}
@@ -103,22 +113,18 @@ static BOOL LfsFdIsValid(int fd)
FileDirInfo *GetFreeDir(const char *dirName)
{
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
if (g_lfsDir[i].useFlag == 0) {
g_lfsDir[i].useFlag = 1;
g_lfsDir[i].dirName = strdup(dirName);
pthread_mutex_unlock(&g_FslocalMutex);
return &(g_lfsDir[i]);
}
}
pthread_mutex_unlock(&g_FslocalMutex);
return NULL;
}
void FreeDirInfo(const char *dirName)
{
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
if (g_lfsDir[i].useFlag == 1 && strcmp(g_lfsDir[i].dirName, dirName) == 0) {
g_lfsDir[i].useFlag = 0;
@@ -126,24 +132,19 @@ void FreeDirInfo(const char *dirName)
free(g_lfsDir[i].dirName);
g_lfsDir[i].dirName = NULL;
}
pthread_mutex_unlock(&g_FslocalMutex);
}
}
pthread_mutex_unlock(&g_FslocalMutex);
}
BOOL CheckDirIsOpen(const char *dirName)
{
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
if (g_lfsDir[i].useFlag == 1) {
if (strcmp(g_lfsDir[i].dirName, dirName) == 0) {
pthread_mutex_unlock(&g_FslocalMutex);
return TRUE;
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
return FALSE;
}
@@ -165,35 +166,29 @@ BOOL CheckPathIsMounted(const char *pathName, struct FileOpInfo **fileOpInfo)
char tmpName[LITTLEFS_MAX_LFN_LEN] = {0};
int len = GetFirstLevelPathLen(pathName);
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
if (g_fsOp[i].useFlag == 1) {
(void)strncpy_s(tmpName, LITTLEFS_MAX_LFN_LEN, pathName, len);
if (strcmp(tmpName, g_fsOp[i].dirName) == 0) {
*fileOpInfo = &(g_fsOp[i]);
pthread_mutex_unlock(&g_FslocalMutex);
return TRUE;
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
return FALSE;
}
struct FileOpInfo *AllocMountRes(const char* target, const struct FileOps *fileOps)
{
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
if (g_fsOp[i].useFlag == 0 && strcmp(target, g_littlefsMntName[i]) == 0) {
g_fsOp[i].useFlag = 1;
g_fsOp[i].fsVops = fileOps;
g_fsOp[i].dirName = strdup(target);
pthread_mutex_unlock(&g_FslocalMutex);
return &(g_fsOp[i]);
}
}
pthread_mutex_unlock(&g_FslocalMutex);
return NULL;
}
@@ -203,26 +198,21 @@ int SetDefaultMountPath(int pathNameIndex, const char* target)
return VFS_ERROR;
}
pthread_mutex_lock(&g_FslocalMutex);
g_littlefsMntName[pathNameIndex] = strdup(target);
pthread_mutex_unlock(&g_FslocalMutex);
return VFS_OK;
}
struct FileOpInfo *GetMountRes(const char *target, int *mountIndex)
{
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
if (g_fsOp[i].useFlag == 1) {
if (g_fsOp[i].dirName && strcmp(target, g_fsOp[i].dirName) == 0) {
*mountIndex = i;
pthread_mutex_unlock(&g_FslocalMutex);
return &(g_fsOp[i]);
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
return NULL;
}
@@ -232,33 +222,28 @@ int FreeMountResByIndex(int mountIndex)
return VFS_ERROR;
}
pthread_mutex_lock(&g_FslocalMutex);
if (g_fsOp[mountIndex].useFlag == 1 && g_fsOp[mountIndex].dirName != NULL) {
g_fsOp[mountIndex].useFlag = 0;
free(g_fsOp[mountIndex].dirName);
g_fsOp[mountIndex].dirName = NULL;
}
pthread_mutex_unlock(&g_FslocalMutex);
return VFS_OK;
}
int FreeMountRes(const char *target)
{
pthread_mutex_lock(&g_FslocalMutex);
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
if (g_fsOp[i].useFlag == 1) {
if (g_fsOp[i].dirName && strcmp(target, g_fsOp[i].dirName) == 0) {
g_fsOp[i].useFlag = 0;
free(g_fsOp[i].dirName);
g_fsOp[i].dirName = NULL;
pthread_mutex_unlock(&g_FslocalMutex);
return VFS_OK;
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
return VFS_ERROR;
}
@@ -330,6 +315,18 @@ int LfsMount(const char *source, const char *target, const char *fileSystemType,
int ret;
struct FileOpInfo *fileOpInfo = NULL;
if (g_lfsMutex == LFS_MUTEX_UNINIT) {
if (LOS_MuxCreate(&g_lfsMutex) != LOS_OK) {
errno = EBUSY;
return VFS_ERROR;
}
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (target == NULL || fileSystemType == NULL || data == NULL) {
errno = EFAULT;
ret = VFS_ERROR;
@@ -370,6 +367,7 @@ int LfsMount(const char *source, const char *target, const char *fileSystemType,
}
errout:
LfsUnlock();
return ret;
}
@@ -384,9 +382,15 @@ int LfsUmount(const char *target)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
fileOpInfo = GetMountRes(target, &mountIndex);
if (fileOpInfo == NULL) {
errno = ENOENT;
LfsUnlock();
return VFS_ERROR;
}
@@ -397,6 +401,7 @@ int LfsUmount(const char *target)
}
(void)FreeMountResByIndex(mountIndex);
LfsUnlock();
return ret;
}
@@ -410,8 +415,14 @@ int LfsUnlink(const char *fileName)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (CheckPathIsMounted(fileName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
errno = ENOENT;
LfsUnlock();
return VFS_ERROR;
}
@@ -421,6 +432,7 @@ int LfsUnlink(const char *fileName)
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -434,8 +446,14 @@ int LfsMkdir(const char *dirName, mode_t mode)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (CheckPathIsMounted(dirName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
errno = ENOENT;
LfsUnlock();
return VFS_ERROR;
}
@@ -445,6 +463,7 @@ int LfsMkdir(const char *dirName, mode_t mode)
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -459,8 +478,14 @@ int LfsRmdir(const char *dirName)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (CheckPathIsMounted(dirName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
errno = ENOENT;
LfsUnlock();
return VFS_ERROR;
}
@@ -470,6 +495,7 @@ int LfsRmdir(const char *dirName)
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -480,9 +506,14 @@ DIR *LfsOpendir(const char *dirName)
if (dirName == NULL) {
errno = EFAULT;
goto errout;
return NULL;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return NULL;
}
if (CheckPathIsMounted(dirName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
errno = ENOENT;
goto errout;
@@ -509,9 +540,11 @@ DIR *LfsOpendir(const char *dirName)
dirInfo->lfsHandle = &(fileOpInfo->lfsInfo);
LfsUnlock();
return (DIR *)dirInfo;
errout:
LfsUnlock();
return NULL;
}
@@ -527,9 +560,13 @@ struct dirent *LfsReaddir(DIR *dir)
return NULL;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return NULL;
}
ret = lfs_dir_read(dirInfo->lfsHandle, (lfs_dir_t *)(&(dirInfo->dir)), &lfsInfo);
if (ret == TRUE) {
pthread_mutex_lock(&g_FslocalMutex);
(void)strncpy_s(g_nameValue.d_name, sizeof(g_nameValue.d_name), lfsInfo.name, strlen(lfsInfo.name) + 1);
if (lfsInfo.type == LFS_TYPE_DIR) {
g_nameValue.d_type = DT_DIR;
@@ -538,8 +575,7 @@ struct dirent *LfsReaddir(DIR *dir)
}
g_nameValue.d_reclen = lfsInfo.size;
pthread_mutex_unlock(&g_FslocalMutex);
LfsUnlock();
return &g_nameValue;
}
@@ -547,6 +583,7 @@ struct dirent *LfsReaddir(DIR *dir)
errno = LittlefsErrno(ret);
}
LfsUnlock();
return NULL;
}
@@ -560,6 +597,11 @@ int LfsClosedir(DIR *dir)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
ret = lfs_dir_close(dirInfo->lfsHandle, (lfs_dir_t *)(&(dirInfo->dir)));
FreeDirInfo(dirInfo->dirName);
@@ -569,6 +611,7 @@ int LfsClosedir(DIR *dir)
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -581,9 +624,14 @@ int LfsOpen(const char *pathName, int openFlag, int mode)
if (pathName == NULL) {
errno = EFAULT;
goto errout;
return INVALID_FD;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (CheckPathIsMounted(pathName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
errno = ENOENT;
goto errout;
@@ -609,9 +657,11 @@ int LfsOpen(const char *pathName, int openFlag, int mode)
}
g_handle[fd].lfsHandle = &(fileOpInfo->lfsInfo);
LfsUnlock();
return fd;
errout:
LfsUnlock();
return INVALID_FD;
}
@@ -624,8 +674,14 @@ int LfsRead(int fd, void *buf, unsigned int len)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (LfsFdIsValid(fd) == FALSE) {
errno = EBADF;
LfsUnlock();
return VFS_ERROR;
}
@@ -634,6 +690,7 @@ int LfsRead(int fd, void *buf, unsigned int len)
errno = LittlefsErrno(ret);
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -646,8 +703,14 @@ int LfsWrite(int fd, const void *buf, unsigned int len)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (LfsFdIsValid(fd) == FALSE) {
errno = EBADF;
LfsUnlock();
return VFS_ERROR;
}
@@ -656,6 +719,7 @@ int LfsWrite(int fd, const void *buf, unsigned int len)
errno = LittlefsErrno(ret);
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -663,8 +727,14 @@ off_t LfsSeek(int fd, off_t offset, int whence)
{
off_t ret;
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (LfsFdIsValid(fd) == FALSE) {
errno = EBADF;
LfsUnlock();
return VFS_ERROR;
}
@@ -674,6 +744,7 @@ off_t LfsSeek(int fd, off_t offset, int whence)
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -681,14 +752,18 @@ int LfsClose(int fd)
{
int ret;
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (LfsFdIsValid(fd) == FALSE) {
errno = EBADF;
LfsUnlock();
return VFS_ERROR;
}
pthread_mutex_lock(&g_FslocalMutex);
ret = lfs_file_close(g_handle[fd].lfsHandle, &(g_handle[fd].file));
pthread_mutex_unlock(&g_FslocalMutex);
LfsFreeFd(fd);
@@ -696,7 +771,7 @@ int LfsClose(int fd)
errno = LittlefsErrno(ret);
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -710,8 +785,14 @@ int LfsRename(const char *oldName, const char *newName)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (CheckPathIsMounted(oldName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
errno = ENOENT;
LfsUnlock();
return VFS_ERROR;
}
@@ -721,6 +802,7 @@ int LfsRename(const char *oldName, const char *newName)
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -735,8 +817,14 @@ int LfsStat(const char *path, struct stat *buf)
return VFS_ERROR;
}
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (CheckPathIsMounted(path, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
errno = ENOENT;
LfsUnlock();
return VFS_ERROR;
}
@@ -752,7 +840,7 @@ int LfsStat(const char *path, struct stat *buf)
errno = LittlefsErrno(ret);
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}
@@ -760,8 +848,14 @@ int LfsFsync(int fd)
{
int ret;
if (LfsLock() != LOS_OK) {
errno = EAGAIN;
return VFS_ERROR;
}
if (LfsFdIsValid(fd) == FALSE) {
errno = EBADF;
LfsUnlock();
return VFS_ERROR;
}
@@ -770,5 +864,6 @@ int LfsFsync(int fd)
errno = LittlefsErrno(ret);
ret = VFS_ERROR;
}
LfsUnlock();
return ret;
}

View File

@@ -42,7 +42,6 @@
#include "lfs.h"
#include "lfs_util.h"
#include "memory.h"
#include "pthread.h"
#define INVALID_FD (-1)

View File

@@ -333,7 +333,7 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
int ret = 0;
u32_t intrvl;
char *data_buf = NULL;
BOOL timeout_flag = false;
BOOL timeout_flag = FALSE;
char buf[50];
u32_t destip = parg[0];
@@ -398,14 +398,14 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
do {
pfd.events = POLLIN;
pfd.revents = 0;
timeout_flag = false;
timeout_flag = FALSE;
ret = poll(&pfd, 1, LWIP_SHELL_CMD_PING_TIMEOUT);
if (ret < 0) {
perror("Ping: poll\n");
goto FAILURE;
} else if (ret == 0) {
/* first type timeout event */
timeout_flag = true;
timeout_flag = TRUE;
break;
}
@@ -445,7 +445,7 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
} while (timout_ms >= 0);
/* all timeout events are true timeout */
if ((timout_ms < 0) || (timeout_flag == true)) {
if ((timout_ms < 0) || (timeout_flag == TRUE)) {
failed_cnt++;
i++;
PRINTK("\nPing: destination unreachable ...");
@@ -588,7 +588,6 @@ u32_t OsShellPing(int argc, const char **argv)
stPingTask.uwArg = (UINTPTR)parg;
ret = LOS_TaskCreate((UINT32 *)(&ping_taskid), &stPingTask);
if (ret != LOS_OK) {
free(parg);
PRINTK("ping_task create failed 0x%08x.\n", ret);
count = LWIP_SHELL_CMD_PING_RETRY_TIMES;
} else {
@@ -604,6 +603,8 @@ u32_t OsShellPing(int argc, const char **argv)
PRINTK("Ping cmd failed due some errors\n");
}
free(parg);
return LOS_OK;
ping_error:
lwip_ping_usage();

View File

@@ -42,6 +42,8 @@
EVENT_CB_S g_shellInputEvent;
#define SHELL_CMD_MAX_SIZE 64
#define VISIABLE_CHAR(ch) ((ch) > 0x1F && (ch) < 0x7F)
UINT32 ShellMsgTypeGet(CmdParsed *cmdParsed, const CHAR *cmdType)
{
CmdItemNode *curCmdItem = (CmdItemNode *)NULL;
@@ -136,6 +138,9 @@ UINT32 PreHandleCmdline(const CHAR *input, CHAR **output, UINT32 *outputlen)
UINT32 ret;
const CHAR *cmdBuf = input;
UINT32 cmdBufLen = strlen(cmdBuf);
if ((cmdBufLen + 1) > SHELL_CMD_MAX_SIZE) {
return SH_NOK;
}
CHAR *shiftStr = (CHAR *)malloc(cmdBufLen + 1);
if (shiftStr == NULL) {
@@ -232,9 +237,17 @@ VOID ShellTaskEntry(VOID)
CHAR buf[SHELL_CMD_MAX_SIZE] = {0};
CHAR *ptr = buf;
PRINTK("OHOS # ");
while(1) {
while (1) {
(VOID)LOS_EventRead(&g_shellInputEvent, 0x1, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
while((*ptr = (UINT8)UartGetc()) != 0 && *ptr != 13) {
while ((*ptr = (UINT8)UartGetc()) != 0 && *ptr != 13) {
if (*ptr == '\x03') { /* ctrl + c */
PRINTK("^C\n\rOHOS # ", *ptr);
ptr = buf;
break;
}
if (!VISIABLE_CHAR(*ptr)) {
break;
}
PRINTK("%c", *ptr);
if ((ptr - buf) == (sizeof(buf) - 1)) {
break;
@@ -243,14 +256,13 @@ VOID ShellTaskEntry(VOID)
}
if (ptr != buf) {
if (*ptr == 13 || ((ptr - buf) == (sizeof(buf) - 1))) {
PRINTK("%c", *ptr);
*ptr = '\0';
ptr = buf;
PRINTK("\n\r", buf);
PRINTK("\n\r");
ExecCmdline(buf);
PRINTK("OHOS # ");
}
} else {
} else if (*ptr == 13) {
PRINTK("\n\rOHOS # ");
}
}

View File

@@ -31,6 +31,10 @@
#include "shcmd.h"
#define DEFAULT_SCREEN_WIDTH 80
#define MAX_CMD_KEY_WIDTH 8
#define CMD_ITEM_PER_LINE (DEFAULT_SCREEN_WIDTH / (MAX_CMD_KEY_WIDTH + 1))
INT32 OsShellCmdHelp(INT32 argc, const CHAR **argv)
{
UINT32 loop = 0;
@@ -45,10 +49,10 @@ INT32 OsShellCmdHelp(INT32 argc, const CHAR **argv)
PRINTK("*******************shell commands:*************************\n");
LOS_DL_LIST_FOR_EACH_ENTRY(curCmdItem, &(cmdInfo->cmdList.list), CmdItemNode, list) {
if ((loop & (8 - 1)) == 0) { /* 8 - 1:just align print */
if ((loop % CMD_ITEM_PER_LINE) == 0) { /* just align print */
PRINTK("\n");
}
PRINTK("%-12s ", curCmdItem->cmd->cmdKey);
PRINTK("%-8s ", curCmdItem->cmd->cmdKey);
loop++;
}

View File

@@ -523,7 +523,10 @@ static int OsShellCmdDoRmdir(const char *pathname)
char *fullpath = NULL;
int ret;
(void)memset_s(&statInfo, sizeof(statInfo), 0, sizeof(struct stat));
ret = memset_s(&statInfo, sizeof(struct stat), 0, sizeof(struct stat));
if (ret != 0) {
return -1;
}
if (stat(pathname, &statInfo) != 0) {
return -1;
}

View File

@@ -112,7 +112,7 @@ osStatus_t osKernelGetInfo(osVersion_t *version, char *id_buf, uint32_t id_size)
}
uwRet = memcpy_s(id_buf, id_size, KERNEL_ID, id_size);
if (uwRet != EOK) {
PRINT_ERR("%s[%d] memcpy failed, error type = %u\n", __FUNCTION__, __LINE__, uwRet);
PRINT_ERR("%s[%d] memcpy failed, error type = %lu\n", __FUNCTION__, __LINE__, uwRet);
return osError;
}
}

View File

@@ -38,6 +38,8 @@
#include "los_config.h"
#include "los_task.h"
#define PTHREAD_DEFAULT_NAME "pthread"
#define PTHREAD_DEFAULT_NAME_LEN 8
#define PTHREAD_NAMELEN 16
typedef struct {
@@ -51,7 +53,7 @@ static void *PthreadEntry(UINT32 param)
PthreadData *pthreadData = (PthreadData *)(UINTPTR)param;
void *(*startRoutine)(void *) = pthreadData->startRoutine;
void *ret = startRoutine(pthreadData->param);
free(pthreadData);
pthread_exit(ret);
return ret;
}
@@ -69,7 +71,8 @@ static int PthreadCreateAttrInit(const pthread_attr_t *attr, void *(*startRoutin
INT32 policy = 0;
pthread_attr_t attrTmp;
INT32 ret;
errno_t error;
if (!attr) {
(VOID)pthread_attr_init(&attrTmp);
threadAttr = &attrTmp;
@@ -97,6 +100,11 @@ static int PthreadCreateAttrInit(const pthread_attr_t *attr, void *(*startRoutin
return ENOMEM;
}
error = memcpy_s(pthreadData->name, PTHREAD_NAMELEN, PTHREAD_DEFAULT_NAME, PTHREAD_DEFAULT_NAME_LEN);
if (error != EOK) {
free(pthreadData);
return error;
}
pthreadData->startRoutine = startRoutine;
pthreadData->param = arg;
taskInitParam->pcName = pthreadData->name;
@@ -129,9 +137,6 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
return EINVAL;
}
/* set pthread default name */
(void)sprintf_s(taskInitParam.pcName, PTHREAD_NAMELEN, "pthread%u", taskID);
(void)LOS_TaskResume(taskID);
*thread = (pthread_t)taskID;
@@ -219,9 +224,16 @@ int pthread_detach(pthread_t thread)
void pthread_exit(void *retVal)
{
UINT32 intSave;
LosTaskCB *tcb = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
tcb->joinRetval = (UINTPTR)retVal;
free((PthreadData *)(UINTPTR)tcb->arg);
PthreadData *pthreadData = (PthreadData *)(UINTPTR)tcb->arg;
intSave = LOS_IntLock();
tcb->taskName = PTHREAD_DEFAULT_NAME;
LOS_IntRestore(intSave);
free(pthreadData);
(void)LOS_TaskDelete(tcb->taskID);
}
@@ -240,6 +252,11 @@ int pthread_setname_np(pthread_t thread, const char *name)
taskCB = OS_TCB_FROM_TID((UINT32)thread);
intSave = LOS_IntLock();
if (taskCB->taskStatus & OS_TASK_STATUS_EXIT) {
LOS_IntRestore(intSave);
return EINVAL;
}
if (taskCB->taskEntry == PthreadEntry) {
(void)strcpy_s(taskName, PTHREAD_NAMELEN, name);
} else {

View File

@@ -205,7 +205,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec *ts)
{
INT32 ret;
UINT32 absTicks;
UINT64 absTicks;
const UINT32 nsPerTick = OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND;
struct timespec tp;
UINT64 nseconds;
@@ -246,7 +246,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
}
(VOID)LOS_EventClear(&(cond->event), 0);
(VOID)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, absTicks);
ret = (INT32)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, (UINT32)absTicks);
if (pthread_mutex_lock(mutex) != 0) {
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);

View File

@@ -93,6 +93,7 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
return MapError(ret);
}
mutex->handle = _MUX_INVALID_HANDLE;
mutex->magic = 0;
return 0;
}

View File

@@ -49,7 +49,7 @@
#define OS_INT_STATUS_ADDR (OS_INT_REG_BASE + 12)
#define OS_INT_ENABLE(num) (*((volatile UINT32 *)OS_INT_ENABLE_ADDR) |= (1U << (num)))
#define OS_INT_DISABLE(num) (*((volatile UINT32 *)OS_INT_ENABLE_ADDR ) &= ~(1U << (num)))
#define OS_INT_DISABLE(num) (*((volatile UINT32 *)OS_INT_ENABLE_ADDR) &= ~(1U << (num)))
#define OS_INSTR_SET_MASK 0x01000020U
#define OS_ARM_INSTR_LEN 4
@@ -123,7 +123,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 HalIntNumGet(VOID)
UINT32 status;
READ_UINT32(status, OS_INT_STATUS_ADDR);
return (31 - CLZ(status));
return (31 - CLZ(status)); /* 31 bit map of int */
}
inline UINT32 HalIsIntActive(VOID)
@@ -140,8 +140,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -272,8 +271,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -284,7 +283,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = 0x%x\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -328,7 +327,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -354,15 +353,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);

View File

@@ -133,8 +133,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -273,6 +272,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
@@ -331,8 +331,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -343,7 +343,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -389,7 +389,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -415,15 +415,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
@@ -520,8 +520,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -123,8 +123,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -263,6 +262,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
@@ -321,8 +321,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -333,7 +333,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -379,7 +379,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -405,15 +405,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
@@ -510,8 +510,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -123,8 +123,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -263,6 +262,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
@@ -321,8 +321,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -333,7 +333,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -379,7 +379,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -405,15 +405,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
@@ -488,7 +488,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = 0; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) {
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2 Default hw handler stack start from index 2 */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
@@ -510,8 +510,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -123,8 +123,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -263,6 +262,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
@@ -321,8 +321,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -333,7 +333,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -379,7 +379,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -405,15 +405,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
@@ -488,7 +488,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = 0; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) {
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
@@ -510,8 +510,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -130,8 +130,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -330,8 +329,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -342,7 +341,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -388,7 +387,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -414,15 +413,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);

View File

@@ -130,8 +130,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -330,8 +329,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -342,7 +341,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -388,7 +387,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -414,15 +413,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);

View File

@@ -133,8 +133,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -273,6 +272,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
@@ -331,8 +331,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -343,7 +343,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -389,7 +389,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -415,15 +415,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
@@ -530,8 +530,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -134,8 +134,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -276,6 +275,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
@@ -334,8 +334,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -346,7 +346,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -392,7 +392,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -418,15 +418,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
@@ -523,8 +523,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -123,8 +123,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -263,6 +262,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
@@ -321,8 +321,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -333,7 +333,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -379,7 +379,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -405,15 +405,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
@@ -510,8 +510,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -130,8 +130,7 @@ inline UINT32 HalIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HalIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HalIntNumGet());
while (1) {}
}
@@ -272,6 +271,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
@@ -330,8 +330,8 @@ STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Type = %u\n", excInfo->type);
PRINTK("ThrdPid = %u\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
@@ -342,7 +342,7 @@ STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task ID = %u\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
@@ -388,7 +388,7 @@ STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
PRINTK("backtrace %u -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
@@ -414,15 +414,15 @@ STATIC VOID OsExcMemPoolCheckInfo(VOID)
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool num = %u\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool blkNum = %u\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
PRINTK("pool error node owner = %u\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
@@ -519,8 +519,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -338,8 +338,12 @@ __STATIC_FORCEINLINE q31_t riscv_nn_requantize(const q31_t val, const q31_t mult
__STATIC_FORCEINLINE q31_t riscv_nn_read_q15x2_ia(const q15_t **in_q15)
{
q31_t val;
int ret;
memcpy(&val, *in_q15, 4);
ret = memcpy_s(&val, sizeof(q31_t), *in_q15, 4); // 4: data offset
if (ret != 0) {
return 0;
}
*in_q15 += 2;
return (val);
@@ -353,7 +357,10 @@ __STATIC_FORCEINLINE q31_t riscv_nn_read_q15x2_ia(const q15_t **in_q15)
__STATIC_FORCEINLINE q31_t riscv_nn_read_q7x4_ia(const q7_t **in_q7)
{
q31_t val;
memcpy(&val, *in_q7, 4);
int ret = memcpy_s(&val, sizeof(q31_t), *in_q7, 4); // 4: data offset
if (ret != 0) {
return 0;
}
*in_q7 += 4;
return (val);

View File

@@ -130,6 +130,10 @@ extern UINT64 LOS_SysCycleGet(VOID);
#define OS_SYS_NS_TO_CYCLE(time, freq) (((time) / OS_SYS_NS_PER_SECOND) * (freq) + \
(time % OS_SYS_NS_PER_SECOND) * (freq) / OS_SYS_NS_PER_SECOND)
#define OS_SYS_TICK_TO_CYCLE(ticks) (((UINT64)(ticks) * g_sysClock) / LOSCFG_BASE_CORE_TICK_PER_SECOND)
#define OS_SYS_CYCLE_TO_TICK(cycle) ((((UINT64)(cycle)) * LOSCFG_BASE_CORE_TICK_PER_SECOND) / g_sysClock)
/**
* @ingroup los_tick
* System time basic function error code: Null pointer.

View File

@@ -127,7 +127,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
OsRegister();
ret = OsMemSystemInit();
if (ret != LOS_OK) {
PRINT_ERR("OsMemSystemInit error %d\n", ret);
PRINT_ERR("OsMemSystemInit error %u\n", ret);
return ret;
}

View File

@@ -243,7 +243,7 @@ static INLINE VOID OsQueueBufferOperate(LosQueueCB *queueCB, UINT32 operateType,
msgDataSize = *((UINT32 *)(UINTPTR)((queueNode + queueCB->queueSize) - sizeof(UINT32)));
rc = memcpy_s((VOID *)bufferAddr, *bufferSize, (VOID *)queueNode, msgDataSize);
if (rc != EOK) {
PRINT_ERR("%s[%d] memcpy failed, error type = %u\n", __FUNCTION__, __LINE__, rc);
PRINT_ERR("%s[%d] memcpy failed, error type = %d\n", __FUNCTION__, __LINE__, rc);
return;
}
@@ -252,7 +252,7 @@ static INLINE VOID OsQueueBufferOperate(LosQueueCB *queueCB, UINT32 operateType,
*((UINT32 *)(UINTPTR)((queueNode + queueCB->queueSize) - sizeof(UINT32))) = *bufferSize;
rc = memcpy_s((VOID *)queueNode, queueCB->queueSize, (VOID *)bufferAddr, *bufferSize);
if (rc != EOK) {
PRINT_ERR("%s[%d] memcpy failed, error type = %u\n", __FUNCTION__, __LINE__, rc);
PRINT_ERR("%s[%d] memcpy failed, error type = %d\n", __FUNCTION__, __LINE__, rc);
return;
}
}

View File

@@ -92,13 +92,17 @@ VOID OsSchedResetSchedResponseTime(UINT64 responseTime)
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
STATIC UINT64 g_schedTimerBase;
STATIC BOOL g_tickTimerBaseUpdate = FALSE;
VOID OsSchedUpdateSchedTimeBase(VOID)
{
UINT32 period = 0;
(VOID)HalGetTickCycle(&period);
g_schedTimerBase += period;
if (g_tickTimerBaseUpdate == FALSE) {
(VOID)HalGetTickCycle(&period);
g_schedTimerBase += period;
}
g_tickTimerBaseUpdate = FALSE;
}
VOID OsSchedTimerBaseReset(UINT64 currTime)
@@ -124,6 +128,7 @@ UINT64 OsGetCurrSysTimeCycle(VOID)
/* Turn the timer count */
g_schedTimerBase += period;
schedTime = g_schedTimerBase + time;
g_tickTimerBaseUpdate = TRUE;
}
LOS_ASSERT(schedTime >= oldSchedTime);
@@ -145,22 +150,11 @@ STATIC INLINE VOID OsTimeSliceUpdate(LosTaskCB *taskCB, UINT64 currTime)
taskCB->startTime = currTime;
}
STATIC INLINE VOID OsSchedTickReload(UINT64 nextResponseTime, UINT32 responseID, BOOL isTimeSlice, BOOL timeUpdate)
STATIC INLINE VOID OsSchedTickReload(UINT64 currTime, UINT64 nextResponseTime, UINT32 responseID,
BOOL isTimeSlice, BOOL timeUpdate)
{
UINT64 currTime, nextExpireTime;
UINT32 usedTime;
currTime = OsGetCurrSchedTimeCycle();
if (g_tickStartTime != 0) {
usedTime = currTime - g_tickStartTime;
g_tickStartTime = 0;
} else {
usedTime = 0;
}
if ((nextResponseTime > usedTime) && ((nextResponseTime - usedTime) > OS_TICK_RESPONSE_PRECISION)) {
nextResponseTime -= usedTime;
} else {
UINT64 nextExpireTime;
if (nextResponseTime < OS_TICK_RESPONSE_PRECISION) {
nextResponseTime = OS_TICK_RESPONSE_PRECISION;
}
@@ -190,8 +184,10 @@ STATIC INLINE VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID,
UINT64 nextExpireTime;
UINT64 nextResponseTime = 0;
BOOL isTimeSlice = FALSE;
(VOID)startTime;
nextExpireTime = OsGetNextExpireTime(startTime);
UINT64 currTime = OsGetCurrSchedTimeCycle();
nextExpireTime = OsGetNextExpireTime(currTime);
/* The response time of the task time slice is aligned to the next response time in the delay queue */
if ((nextExpireTime > taskEndTime) && ((nextExpireTime - taskEndTime) > OS_SCHED_MINI_PERIOD)) {
nextExpireTime = taskEndTime;
@@ -200,7 +196,7 @@ STATIC INLINE VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID,
if ((g_schedResponseTime > nextExpireTime) &&
((g_schedResponseTime - nextExpireTime) >= OS_TICK_RESPONSE_PRECISION)) {
nextResponseTime = nextExpireTime - startTime;
nextResponseTime = nextExpireTime - currTime;
if (nextResponseTime > OS_TICK_RESPONSE_TIME_MAX) {
if (SchedRealSleepTimeSet != NULL) {
SchedRealSleepTimeSet(nextResponseTime);
@@ -217,7 +213,7 @@ STATIC INLINE VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID,
return;
}
OsSchedTickReload(nextResponseTime, responseID, isTimeSlice, timeUpdate);
OsSchedTickReload(currTime, nextResponseTime, responseID, isTimeSlice, timeUpdate);
}
VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate)

View File

@@ -115,7 +115,7 @@ VOID OsAdd2SortLink(SortLinkList *node, UINT64 startTime, UINT32 waitTicks, Sort
}
intSave = LOS_IntLock();
SET_SORTLIST_VALUE(node, startTime + (UINT64)waitTicks * OS_CYCLE_PER_TICK);
SET_SORTLIST_VALUE(node, startTime + OS_SYS_TICK_TO_CYCLE(waitTicks));
OsAddNode2SortLink(sortLinkHeader, node);
LOS_IntRestore(intSave);
}

View File

@@ -88,7 +88,7 @@ LITE_OS_SEC_TEXT VOID OsSwtmrTask(VOID)
tick = LOS_TickCountGet() - tick;
if (tick >= SWTMR_MAX_RUNNING_TICKS) {
PRINT_WARN("timer_handler(%p) cost too many ms(%d)\n",
PRINT_WARN("timer_handler(%p) cost too many ms(%u)\n",
swtmrHandle.handler,
(UINT32)((tick * OS_SYS_MS_PER_SECOND) / LOSCFG_BASE_CORE_TICK_PER_SECOND));
}
@@ -123,8 +123,8 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsSwtmrTaskCreate(VOID)
STATIC UINT64 OsSwtmrCalcStartTime(UINT64 currTime, SWTMR_CTRL_S *swtmr, const SWTMR_CTRL_S *alignSwtmr)
{
UINT64 usedTime, startTime;
UINT64 alignEnd = (UINT64)alignSwtmr->uwInterval * OS_CYCLE_PER_TICK;
UINT64 swtmrTime = (UINT64)swtmr->uwInterval * OS_CYCLE_PER_TICK;
UINT64 alignEnd = OS_SYS_TICK_TO_CYCLE(alignSwtmr->uwInterval);
UINT64 swtmrTime = OS_SYS_TICK_TO_CYCLE(swtmr->uwInterval);
UINT64 remainTime = OsSortLinkGetRemainTime(currTime, &alignSwtmr->stSortList);
if (remainTime == 0) {
startTime = GET_SORTLIST_VALUE(&alignSwtmr->stSortList);

View File

@@ -343,7 +343,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
continue;
}
PRINTK("%d %d %s 0x%x 0x%x 0x%x 0x%x 0x%x ",
PRINTK("%u %u %s 0x%x 0x%x 0x%x 0x%x 0x%x ",
taskCB->taskID, taskCB->priority, OsConvertTskStatus(taskCB->taskStatus),
taskCB->stackSize, OsGetTaskWaterLine(taskCB->taskID),
(UINT32)(UINTPTR)taskCB->stackPointer, taskCB->topOfStack, taskCB->eventMask);
@@ -352,7 +352,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
PRINTK("0x%x ", semID);
#if (LOSCFG_BASE_CORE_CPUP == 1)
PRINTK("%d.%d %d.%d %d.%d ",
PRINTK("%u.%u %u.%u %u.%u ",
cpuLessOneSec[taskCB->taskID].uwUsage / LOS_CPUP_PRECISION_MULT,
cpuLessOneSec[taskCB->taskID].uwUsage % LOS_CPUP_PRECISION_MULT,
cpuTenSec[taskCB->taskID].uwUsage / LOS_CPUP_PRECISION_MULT,
@@ -498,7 +498,7 @@ LITE_OS_SEC_TEXT CHAR *LOS_CurTaskNameGet(VOID)
*****************************************************************************/
LITE_OS_SEC_TEXT STATIC VOID OsHandleRunTaskStackOverflow(VOID)
{
PRINT_ERR("CURRENT task ID: %s:%d stack overflow!\n",
PRINT_ERR("CURRENT task ID: %s:%u stack overflow!\n",
g_losTask.runTask->taskName, g_losTask.runTask->taskID);
OsDoExcHook(EXC_STACKOVERFLOW);
}
@@ -514,7 +514,7 @@ LITE_OS_SEC_TEXT STATIC VOID OsHandleNewTaskStackOverflow(VOID)
{
LosTaskCB *tmp = NULL;
PRINT_ERR("HIGHEST task ID: %s:%d SP error!\n",
PRINT_ERR("HIGHEST task ID: %s:%u SP error!\n",
g_losTask.newTask->taskName, g_losTask.newTask->taskID);
PRINT_ERR("HIGHEST task StackPointer: 0x%x TopOfStack: 0x%x\n",
(UINT32)(UINTPTR)(g_losTask.newTask->stackPointer), g_losTask.newTask->topOfStack);
@@ -633,7 +633,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsTaskEntry(UINT32 taskID)
taskCB->joinRetval = (UINTPTR)taskCB->taskEntry(taskCB->arg);
retVal = LOS_TaskDelete(taskCB->taskID);
if (retVal != LOS_OK) {
PRINT_ERR("Delete Task[TID: %d] Failed!\n", taskCB->taskID);
PRINT_ERR("Delete Task[TID: %u] Failed!\n", taskCB->taskID);
}
}

View File

@@ -72,7 +72,7 @@ Return : current tick
*****************************************************************************/
LITE_OS_SEC_TEXT_MINOR UINT64 LOS_TickCountGet(VOID)
{
return OsGetCurrSchedTimeCycle() / OS_CYCLE_PER_TICK;
return OS_SYS_CYCLE_TO_TICK(OsGetCurrSchedTimeCycle());
}
/*****************************************************************************

View File

@@ -952,7 +952,7 @@ UINT32 LOS_MemInit(VOID *pool, UINT32 size)
if (((UINTPTR)pool & (OS_MEM_ALIGN_SIZE - 1)) || \
(size & (OS_MEM_ALIGN_SIZE - 1))) {
PRINT_ERR("LiteOS heap memory address or size configured not aligned:address:0x%x,size:0x%x, alignsize:%d\n", \
PRINT_ERR("LiteOS heap memory address or size configured not aligned:address:0x%x,size:0x%x, alignsize:%u\n", \
(UINTPTR)pool, size, OS_MEM_ALIGN_SIZE);
return OS_ERROR;
}
@@ -1788,8 +1788,8 @@ STATIC VOID OsMemIntegrityCheckError(struct OsMemPoolHead *pool,
PRINTK("The prev node is free\n");
}
MEM_UNLOCK(pool, intSave);
PRINT_ERR("cur node: 0x%x, pre node: 0x%x, pre node was allocated by task: %d, %s\n",
tmpNode, preNode, taskCB->taskID, taskCB->taskName);
PRINT_ERR("cur node: 0x%x, pre node: 0x%x, pre node was allocated by task: %u, %s\n",
(UINTPTR)tmpNode, (UINTPTR)preNode, taskCB->taskID, taskCB->taskName);
LOS_Panic("Memory integrity check error!\n");
#else
MEM_UNLOCK(pool, intSave);

View File

@@ -34,6 +34,7 @@
#if (LOSCFG_MEM_MUL_REGIONS == 1)
#define MEMGAP_SIZE 16
// simulate two non-continuous memory regions
STATIC UINT8 g_memPool_TC46_01[0x200];
STATIC UINT8 g_memGap_TC46[0x10];
@@ -57,7 +58,7 @@ static UINT32 TestCase(VOID)
// p points to the start address of the gap node between g_memPool_TC46_01 and g_memPool_TC46_02
p = g_memPool_TC46_01 + 0x200;
(void)memset_s(g_memGap_TC46, 0x10, 1, 0x10);
(void)memset_s(g_memGap_TC46, MEMGAP_SIZE, 1, MEMGAP_SIZE);
ret = LOS_MemFree(m_aucSysMem0, p);
ICUNIT_GOTO_EQUAL(ret, LOS_NOK, ret, EXIT);

View File

@@ -73,7 +73,11 @@ static uint32_t RegexFuzz(void)
heartbeatPrint(i);
string1 = DT_SetGetString(&g_element[NUM_0_INDEX], initStrLen, maxStrLen, "CHN");
(void)strncpy_s(str1, MAX_STR_BUF_LEN, string1, maxStrLen);
ret = strncpy_s(str1, MAX_STR_BUF_LEN, string1, maxStrLen);
if (ret != 0) {
printf("strncpy_s failure in %s[%d], i = %d\n", __FUCTION__, __LINE__, i);
return 1;
}
str1[MAX_STR_BUF_LEN - 1] = '\0';
string2 = DT_SetGetString(&g_element[NUM_1_INDEX], initStrLen, maxStrLen, "CHN");
(void)strncpy_s(str2, MAX_STR_BUF_LEN, string2, maxStrLen);