Compare commits
66 Commits
OpenHarmon
...
OpenHarmon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
887a845874 | ||
|
|
8ee33a771b | ||
|
|
c182540a92 | ||
|
|
d837ed3e9d | ||
|
|
a2371f1b27 | ||
|
|
8245cd5cd0 | ||
|
|
b9311b9aa0 | ||
|
|
8cf75d80fd | ||
|
|
4491d561c7 | ||
|
|
1bf61bb4b0 | ||
|
|
b62463abc5 | ||
|
|
6ffea886d3 | ||
|
|
9de6f57cda | ||
|
|
307ab396a5 | ||
|
|
96b2eaeab6 | ||
|
|
58e67dde3b | ||
|
|
f74067b24f | ||
|
|
86bc68744d | ||
|
|
39db69b6bf | ||
|
|
87c6e9476d | ||
|
|
94537e17ae | ||
|
|
9717eafff7 | ||
|
|
0712c2df56 | ||
|
|
50b4e91f91 | ||
|
|
443d9deb9b | ||
|
|
caa28225a8 | ||
|
|
fdb12dbe31 | ||
|
|
8ebfe352f5 | ||
|
|
2332f34a79 | ||
|
|
314af71a48 | ||
|
|
2ef5ff366e | ||
|
|
5acd9b36ff | ||
|
|
314102c234 | ||
|
|
b31437fe27 | ||
|
|
a2852d8bce | ||
|
|
0ce46a3989 | ||
|
|
b5db6ee2d4 | ||
|
|
f0ed09be65 | ||
|
|
802e01de21 | ||
|
|
d95a1523f2 | ||
|
|
0a1df72f7e | ||
|
|
48484444ce | ||
|
|
6240af2522 | ||
|
|
b1b46451e7 | ||
|
|
54936c19bd | ||
|
|
7a6242549f | ||
|
|
07ef35ccdf | ||
|
|
08e3025ec5 | ||
|
|
ae2c3c5823 | ||
|
|
d32fea7096 | ||
|
|
915e5b9517 | ||
|
|
6e665e6771 | ||
|
|
a338ba8f69 | ||
|
|
81d02b4fea | ||
|
|
bd607c8922 | ||
|
|
f23481e041 | ||
|
|
792b131d55 | ||
|
|
3969fbfac8 | ||
|
|
33e2b5e085 | ||
|
|
79099bb28c | ||
|
|
11e8e895d3 | ||
|
|
a562b67f90 | ||
|
|
fafd3b66d4 | ||
|
|
5e3a29dd97 | ||
|
|
d1d19e088d | ||
|
|
2c85b0ec6d |
8
BUILD.gn
8
BUILD.gn
@@ -29,9 +29,17 @@
|
||||
|
||||
import("config.gni")
|
||||
|
||||
LITEOS_LOS_CONFIG_H = rebase_path("$LITEOSTOPDIR/kernel/include/los_config.h")
|
||||
|
||||
config("los_config") {
|
||||
cflags = [ "-Werror" ]
|
||||
|
||||
asmflags = [
|
||||
"-DCLZ=CLZ",
|
||||
"-imacros",
|
||||
"$LITEOS_LOS_CONFIG_H",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"//kernel/liteos_m/kernel/include",
|
||||
"//kernel/liteos_m/kernel/arch/include",
|
||||
|
||||
59
bundle.json
Normal file
59
bundle.json
Normal 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": []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "los_cppsupport.h"
|
||||
|
||||
|
||||
typedef VOID (*InitFunc)(VOID);
|
||||
|
||||
INT32 LOS_CppSystemInit(UINTPTR initArrayStart, UINTPTR initArrayEnd)
|
||||
@@ -39,12 +38,10 @@ INT32 LOS_CppSystemInit(UINTPTR initArrayStart, UINTPTR initArrayEnd)
|
||||
UINTPTR *start;
|
||||
InitFunc initFunc = NULL;
|
||||
|
||||
for (start = (UINTPTR *)initArrayStart; start < (UINTPTR *)initArrayEnd; start++){
|
||||
for (start = (UINTPTR *)initArrayStart; start < (UINTPTR *)initArrayEnd; start++) {
|
||||
initFunc = (InitFunc)(*start);
|
||||
initFunc();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -347,14 +347,14 @@ ssize_t read(int fd, void *buf, size_t nbyte)
|
||||
return recv(fd, buf, nbyte, 0);
|
||||
}
|
||||
#endif
|
||||
if (g_fs->fsFops == NULL || g_fs->fsFops->Read == NULL) {
|
||||
errno = ENOSYS;
|
||||
return FS_FAILURE;
|
||||
}
|
||||
if (g_fs == NULL) {
|
||||
errno = ENODEV;
|
||||
return FS_FAILURE;
|
||||
}
|
||||
if (g_fs->fsFops == NULL || g_fs->fsFops->Read == NULL) {
|
||||
errno = ENOSYS;
|
||||
return FS_FAILURE;
|
||||
}
|
||||
return g_fs->fsFops->Read(fd, buf, nbyte);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "lfs.h"
|
||||
#include "lfs_util.h"
|
||||
#include "memory.h"
|
||||
#include "pthread.h"
|
||||
|
||||
#define INVALID_FD (-1)
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ static_library("lwip") {
|
||||
|
||||
sources = LWIP_PORTING_FILES + LWIPNOAPPSFILES
|
||||
|
||||
sources -= [ "$LWIPDIR/api/sockets.c" ]
|
||||
|
||||
configs += [ ":lwip_depends" ]
|
||||
|
||||
deps = [ "//kernel/liteos_m/kal/posix" ]
|
||||
|
||||
@@ -105,6 +105,5 @@ extern void LwipLogPrintf(const char *fmt, ...);
|
||||
|
||||
#define init_waitqueue_head(...)
|
||||
#define poll_check_waiters(...)
|
||||
#define IOCTL_CMD_CASE_HANDLER()
|
||||
|
||||
#endif /* _LWIP_PORTING_CC_H_ */
|
||||
|
||||
@@ -43,9 +43,6 @@
|
||||
(ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
|
||||
|
||||
/* directly map this to the lwip internal functions */
|
||||
#define inet_addr(cp) ipaddr_addr(cp)
|
||||
#define inet_aton(cp, addr) ip4addr_aton(cp, (ip4_addr_t*)addr)
|
||||
#define inet_ntoa(addr) ip4addr_ntoa((const ip4_addr_t*)&(addr))
|
||||
#define inet_ntoa_r(addr, buf, buflen) ip4addr_ntoa_r((const ip4_addr_t*)&(addr), buf, buflen)
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
#define LWIP_NETIF_LOOPBACK 1
|
||||
#define LWIP_POSIX_SOCKETS_IO_NAMES 0
|
||||
#define LWIP_RAW 1
|
||||
#define LWIP_SOCKET_OFFSET FAT_MAX_OPEN_FILES
|
||||
#define LWIP_SOCKET_OFFSET 0
|
||||
#define LWIP_SO_RCVBUF 1
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
#define LWIP_SO_SNDTIMEO 1
|
||||
@@ -220,75 +220,11 @@
|
||||
#undef LWIP_NETIF_PROMISC
|
||||
#define LWIP_NETIF_PROMISC 0
|
||||
|
||||
#undef LWIP_ICMP
|
||||
#define LWIP_ICMP 0
|
||||
|
||||
#undef LWIP_DHCP
|
||||
#define LWIP_DHCP 1
|
||||
|
||||
#undef LWIP_IGMP
|
||||
#define LWIP_IGMP 0
|
||||
#define MEMP_MEM_MALLOC 1
|
||||
|
||||
#undef LWIP_IPV6
|
||||
#define LWIP_IPV6 0
|
||||
|
||||
#undef LWIP_IPV6_DHCP6
|
||||
#define LWIP_IPV6_DHCP6 0
|
||||
|
||||
#undef TCP_SND_BUF
|
||||
#define TCP_SND_BUF (65535 / 3)
|
||||
|
||||
#undef TCP_WND
|
||||
#define TCP_WND ((TCP_SND_BUF * 2) / 3)
|
||||
|
||||
#undef TCP_SND_QUEUELEN
|
||||
#define TCP_SND_QUEUELEN (2 * (TCP_SND_BUF / TCP_MSS))
|
||||
|
||||
#undef MEMP_NUM_NETDB
|
||||
#define MEMP_NUM_NETDB 1
|
||||
|
||||
#undef MEMP_NUM_ARP_QUEUE
|
||||
#define MEMP_NUM_ARP_QUEUE 4
|
||||
|
||||
#undef MEMP_NUM_NETBUF
|
||||
#define MEMP_NUM_NETBUF 32
|
||||
|
||||
#undef MEMP_NUM_NETCONN
|
||||
#define MEMP_NUM_NETCONN 32
|
||||
|
||||
#undef MEMP_NUM_PBUF
|
||||
#define MEMP_NUM_PBUF 0
|
||||
|
||||
#undef PBUF_POOL_SIZE
|
||||
#define PBUF_POOL_SIZE 0
|
||||
|
||||
#undef MEMP_NUM_RAW_PCB
|
||||
#define MEMP_NUM_RAW_PCB 8
|
||||
|
||||
#undef MEMP_NUM_REASSDATA
|
||||
#define MEMP_NUM_REASSDATA 12
|
||||
|
||||
#undef MEMP_NUM_TCPIP_MSG_API
|
||||
#define MEMP_NUM_TCPIP_MSG_API 32
|
||||
|
||||
#undef MEMP_NUM_TCPIP_MSG_INPKT
|
||||
#define MEMP_NUM_TCPIP_MSG_INPKT 32
|
||||
|
||||
#undef MEMP_NUM_TCP_PCB
|
||||
#define MEMP_NUM_TCP_PCB 8
|
||||
|
||||
#undef MEMP_NUM_TCP_PCB_LISTEN
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 4
|
||||
|
||||
#undef MEMP_NUM_TCP_SEG
|
||||
#define MEMP_NUM_TCP_SEG 64
|
||||
|
||||
#undef MEMP_NUM_UDP_PCB
|
||||
#define MEMP_NUM_UDP_PCB 4
|
||||
|
||||
#undef TCPIP_THREAD_STACKSIZE
|
||||
#define TCPIP_THREAD_STACKSIZE 0x1000
|
||||
|
||||
#undef LWIP_SOCKET_SELECT
|
||||
#define LWIP_SOCKET_SELECT 1
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include_next <lwip/sockets.h>
|
||||
#include <fatfs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -29,8 +29,9 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/priv/tcpip_priv.h"
|
||||
#include "lwip/priv/sockets_priv.h"
|
||||
#include <lwip/sockets.h>
|
||||
|
||||
#if !LWIP_COMPAT_SOCKETS
|
||||
#if LWIP_SOCKET
|
||||
@@ -160,6 +161,27 @@ int inet_pton(int af, const char *src, void *dst)
|
||||
return lwip_inet_pton(af, src, dst);
|
||||
}
|
||||
|
||||
#ifndef LWIP_INET_ADDR_FUNC
|
||||
in_addr_t inet_addr(const char *cp)
|
||||
{
|
||||
return ipaddr_addr(cp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef LWIP_INET_NTOA_FUNC
|
||||
char *inet_ntoa(struct in_addr addr)
|
||||
{
|
||||
return ip4addr_ntoa((const ip4_addr_t*)&(addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef LWIP_INET_ATON_FUNC
|
||||
int inet_aton(const char *cp, struct in_addr *addr)
|
||||
{
|
||||
return ip4addr_aton(cp, (ip4_addr_t*)addr);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ioctlsocket(int s, long cmd, void *argp)
|
||||
{
|
||||
return lwip_ioctl(s, cmd, argp);
|
||||
@@ -185,4 +207,81 @@ unsigned int if_nametoindex(const char *ifname)
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* !LWIP_COMPAT_SOCKETS */
|
||||
#endif /* !LWIP_COMPAT_SOCKETS */
|
||||
|
||||
#define IOCTL_CMD_CASE_HANDLER() do { \
|
||||
err_t err; \
|
||||
struct lwip_ioctl_apimsg msg; \
|
||||
msg.sock = sock; \
|
||||
msg.cmd = cmd; \
|
||||
msg.argp = argp; \
|
||||
\
|
||||
err = tcpip_api_call(lwip_do_ioctl_impl, &msg.call); \
|
||||
if (err != ENOSYS) { \
|
||||
sock_set_errno(sock, err); \
|
||||
done_socket(sock); \
|
||||
return -(err != ERR_OK); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
struct lwip_ioctl_apimsg {
|
||||
struct tcpip_api_call_data call;
|
||||
struct lwip_sock *sock;
|
||||
long cmd;
|
||||
void *argp;
|
||||
};
|
||||
|
||||
static err_t lwip_do_ioctl_impl(struct tcpip_api_call_data *call);
|
||||
|
||||
#include "../api/sockets.c"
|
||||
|
||||
static u8_t lwip_ioctl_internal_SIOCGIFBRDADDR(struct ifreq *ifr)
|
||||
{
|
||||
struct netif *netif = NULL;
|
||||
struct sockaddr_in *sock_in = NULL;
|
||||
|
||||
/* get netif subnet broadcast addr */
|
||||
netif = netif_find(ifr->ifr_name);
|
||||
if (netif == NULL) {
|
||||
return ENODEV;
|
||||
}
|
||||
if (ip4_addr_isany_val(*(ip_2_ip4(&netif->netmask)))) {
|
||||
return ENXIO;
|
||||
}
|
||||
sock_in = (struct sockaddr_in *)&ifr->ifr_addr;
|
||||
sock_in->sin_family = AF_INET;
|
||||
sock_in->sin_addr.s_addr = (ip_2_ip4(&((netif)->ip_addr))->addr | ~(ip_2_ip4(&netif->netmask)->addr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u8_t lwip_ioctl_impl(const struct lwip_sock *sock, long cmd, void *argp)
|
||||
{
|
||||
u8_t err = 0;
|
||||
struct ifreq *ifr = (struct ifreq *)argp;
|
||||
bool is_ipv6 = 0;
|
||||
|
||||
/* allow it only on IPv6 sockets... */
|
||||
is_ipv6 = NETCONNTYPE_ISIPV6((unsigned int)(sock->conn->type));
|
||||
|
||||
switch ((u32_t)cmd) {
|
||||
case SIOCGIFBRDADDR:
|
||||
if (is_ipv6 != 0) {
|
||||
err = EINVAL;
|
||||
} else {
|
||||
err = lwip_ioctl_internal_SIOCGIFBRDADDR(ifr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
err = ENOSYS;
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_ioctl(UNIMPL: 0x%lx)\n", cmd));
|
||||
break;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static err_t lwip_do_ioctl_impl(struct tcpip_api_call_data *call)
|
||||
{
|
||||
struct lwip_ioctl_apimsg *msg = (struct lwip_ioctl_apimsg *)(void *)call;
|
||||
return lwip_ioctl_impl(msg->sock, msg->cmd, msg->argp);
|
||||
}
|
||||
@@ -42,7 +42,6 @@
|
||||
#define OS_PM_SYS_EARLY 1
|
||||
#define OS_PM_SYS_DEVICE_EARLY 2
|
||||
|
||||
typedef UINT32 (*SysSuspend)(VOID);
|
||||
typedef UINT32 (*Suspend)(UINT32 mode);
|
||||
|
||||
typedef struct {
|
||||
@@ -70,9 +69,24 @@ typedef struct {
|
||||
#define PM_EVENT_LOCK_RELEASE 0x1
|
||||
STATIC EVENT_CB_S g_pmEvent;
|
||||
STATIC LosPmCB g_pmCB;
|
||||
STATIC LosPmSysctrl *g_sysctrl = NULL;
|
||||
STATIC LosPmSysctrl g_sysctrl;
|
||||
STATIC UINT64 g_pmSleepTime;
|
||||
|
||||
STATIC VOID OsPmSysctrlInit(VOID)
|
||||
{
|
||||
/* Default handler functions, which are implemented by the product */
|
||||
g_sysctrl.early = NULL;
|
||||
g_sysctrl.late = NULL;
|
||||
g_sysctrl.normalSuspend = HalEnterSleep;
|
||||
g_sysctrl.normalResume = NULL;
|
||||
g_sysctrl.lightSuspend = HalEnterSleep;
|
||||
g_sysctrl.lightResume = NULL;
|
||||
g_sysctrl.deepSuspend = HalEnterSleep;
|
||||
g_sysctrl.deepResume = NULL;
|
||||
g_sysctrl.shutdownSuspend = NULL;
|
||||
g_sysctrl.shutdownResume = NULL;
|
||||
}
|
||||
|
||||
STATIC VOID OsPmTickTimerStart(LosPmCB *pm)
|
||||
{
|
||||
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
||||
@@ -147,26 +161,20 @@ STATIC VOID OsPmCpuResume(LosPmCB *pm)
|
||||
}
|
||||
}
|
||||
|
||||
STATIC SysSuspend OsPmCpuSuspend(LosPmCB *pm)
|
||||
STATIC VOID OsPmCpuSuspend(LosPmCB *pm)
|
||||
{
|
||||
SysSuspend sysSuspend = NULL;
|
||||
|
||||
/* cpu enter low power mode */
|
||||
LOS_ASSERT(pm->sysctrl != NULL);
|
||||
|
||||
if (pm->sysMode == LOS_SYS_NORMAL_SLEEP) {
|
||||
sysSuspend = pm->sysctrl->normalSuspend;
|
||||
pm->sysctrl->normalSuspend();
|
||||
} else if (pm->sysMode == LOS_SYS_LIGHT_SLEEP) {
|
||||
sysSuspend = pm->sysctrl->lightSuspend;
|
||||
pm->sysctrl->lightSuspend();
|
||||
} else if (pm->sysMode == LOS_SYS_DEEP_SLEEP) {
|
||||
sysSuspend = pm->sysctrl->deepSuspend;
|
||||
pm->sysctrl->deepSuspend();
|
||||
} else {
|
||||
sysSuspend = pm->sysctrl->shutdownSuspend;
|
||||
pm->sysctrl->shutdownSuspend();
|
||||
}
|
||||
|
||||
LOS_ASSERT(sysSuspend != NULL);
|
||||
|
||||
return sysSuspend;
|
||||
}
|
||||
|
||||
STATIC VOID OsPmResumePrepare(LosPmCB *pm, UINT32 mode, UINT32 prepare)
|
||||
@@ -230,7 +238,6 @@ STATIC UINT32 OsPmSuspendSleep(LosPmCB *pm)
|
||||
LOS_SysSleepEnum mode;
|
||||
UINT32 prepare = 0;
|
||||
BOOL tickTimerStop = FALSE;
|
||||
SysSuspend sysSuspend;
|
||||
UINT64 currTime;
|
||||
|
||||
ret = OsPmSuspendCheck(pm, &sysSuspendEarly, &deviceSuspend, &mode);
|
||||
@@ -258,14 +265,7 @@ STATIC UINT32 OsPmSuspendSleep(LosPmCB *pm)
|
||||
OsSchedUpdateExpireTime(currTime, TRUE);
|
||||
}
|
||||
|
||||
sysSuspend = OsPmCpuSuspend(pm);
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
if (!pm->isWake) {
|
||||
ret = sysSuspend();
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
OsPmCpuSuspend(pm);
|
||||
|
||||
OsPmCpuResume(pm);
|
||||
|
||||
@@ -284,16 +284,13 @@ STATIC VOID OsPmNormalSleep(VOID)
|
||||
{
|
||||
UINT32 intSave;
|
||||
LosPmCB *pm = &g_pmCB;
|
||||
SysSuspend sysSuspend = NULL;
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
sysSuspend = OsPmCpuSuspend(pm);
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
(VOID)sysSuspend();
|
||||
OsPmCpuSuspend(pm);
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
OsPmCpuResume(pm);
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
}
|
||||
|
||||
@@ -338,16 +335,38 @@ STATIC UINT32 OsPmTickTimerRegister(LosPmCB *pm, LosPmTickTimer *tickTimer)
|
||||
|
||||
STATIC UINT32 OsPmSysctrlRegister(LosPmCB *pm, LosPmSysctrl *sysctrl)
|
||||
{
|
||||
UINT32 intSave;
|
||||
|
||||
if (sysctrl->normalSuspend == NULL) {
|
||||
return LOS_ERRNO_PM_INVALID_PARAM;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
if (sysctrl->early != NULL) {
|
||||
pm->sysctrl->early = sysctrl->early;
|
||||
}
|
||||
if (sysctrl->late != NULL) {
|
||||
pm->sysctrl->late = sysctrl->late;
|
||||
}
|
||||
if (sysctrl->normalSuspend != NULL) {
|
||||
pm->sysctrl->normalSuspend = sysctrl->normalSuspend;
|
||||
}
|
||||
if (sysctrl->normalResume != NULL) {
|
||||
pm->sysctrl->normalResume = sysctrl->normalResume;
|
||||
}
|
||||
if (sysctrl->lightSuspend != NULL) {
|
||||
pm->sysctrl->lightSuspend = sysctrl->lightSuspend;
|
||||
}
|
||||
if (sysctrl->lightResume != NULL) {
|
||||
pm->sysctrl->lightResume = sysctrl->lightResume;
|
||||
}
|
||||
if (sysctrl->deepSuspend != NULL) {
|
||||
pm->sysctrl->deepSuspend = sysctrl->deepSuspend;
|
||||
}
|
||||
if (sysctrl->deepResume != NULL) {
|
||||
pm->sysctrl->deepResume = sysctrl->deepResume;
|
||||
}
|
||||
if (sysctrl->shutdownSuspend != NULL) {
|
||||
pm->sysctrl->shutdownSuspend = sysctrl->shutdownSuspend;
|
||||
}
|
||||
if (sysctrl->shutdownResume != NULL) {
|
||||
pm->sysctrl->shutdownResume = sysctrl->shutdownResume;
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
pm->sysctrl = sysctrl;
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
@@ -409,27 +428,13 @@ STATIC UINT32 OsPmTickTimerUnregister(LosPmCB *pm, LosPmTickTimer *tickTimer)
|
||||
|
||||
STATIC UINT32 OsPmSysctrlUnregister(LosPmCB *pm, LosPmSysctrl *sysctrl)
|
||||
{
|
||||
UINT32 intSave;
|
||||
VOID *freeNode = NULL;
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
if (pm->sysctrl == sysctrl) {
|
||||
if (pm->sysctrl == g_sysctrl) {
|
||||
freeNode = (VOID *)pm->sysctrl;
|
||||
g_sysctrl = NULL;
|
||||
}
|
||||
|
||||
pm->sysctrl = NULL;
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
if (freeNode != NULL) {
|
||||
(VOID)LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, freeNode);
|
||||
}
|
||||
return LOS_OK;
|
||||
}
|
||||
(VOID)sysctrl;
|
||||
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
OsPmSysctrlInit();
|
||||
pm->pmMode = LOS_SYS_NORMAL_SLEEP;
|
||||
LOS_IntRestore(intSave);
|
||||
return LOS_ERRNO_PM_INVALID_NODE;
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
UINT32 LOS_PmUnregister(LOS_PmNodeType type, VOID *node)
|
||||
@@ -740,7 +745,7 @@ UINT32 LOS_PmReadLock(VOID)
|
||||
{
|
||||
UINT32 ret = LOS_EventRead(&g_pmEvent, PM_EVENT_LOCK_MASK, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
|
||||
if (ret > PM_EVENT_LOCK_MASK) {
|
||||
PRINT_ERR("%s event read failed! ERROR: 0x%x\n", ret);
|
||||
PRINT_ERR("%s event read failed! ERROR: 0x%x\n", __FUNCTION__, ret);
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
@@ -791,20 +796,8 @@ UINT32 OsPmInit(VOID)
|
||||
return ret;
|
||||
}
|
||||
|
||||
g_sysctrl = (LosPmSysctrl *)LOS_MemAlloc((VOID *)OS_SYS_MEM_ADDR, sizeof(LosPmSysctrl));
|
||||
if (g_sysctrl == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
(VOID)memset_s(g_sysctrl, sizeof(LosPmSysctrl), 0, sizeof(LosPmSysctrl));
|
||||
g_sysctrl->normalSuspend = HalEnterSleep;
|
||||
|
||||
ret = LOS_PmRegister(LOS_PM_TYPE_SYSCTRL, (VOID *)g_sysctrl);
|
||||
if (ret != LOS_OK) {
|
||||
(VOID)LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, g_sysctrl);
|
||||
g_sysctrl = NULL;
|
||||
}
|
||||
|
||||
OsPmSysctrlInit();
|
||||
pm->sysctrl = &g_sysctrl;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -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 # ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ LITE_OS_SEC_TEXT_MINOR STATIC VOID OsShellCmdTskInfoData(const LosTaskCB *allTas
|
||||
{
|
||||
const LosTaskCB *taskCB = NULL;
|
||||
UINT32 loop;
|
||||
UINT32 semId;
|
||||
|
||||
#if (LOSCFG_TASK_MEM_USED == 1)
|
||||
UINT32 arraySize = sizeof(UINT32) * (LOSCFG_BASE_CORE_TSK_LIMIT + 1);
|
||||
@@ -93,17 +92,15 @@ LITE_OS_SEC_TEXT_MINOR STATIC VOID OsShellCmdTskInfoData(const LosTaskCB *allTas
|
||||
continue;
|
||||
}
|
||||
|
||||
semId = OsGetSemID(taskCB);
|
||||
|
||||
PRINTK("%-23s%-20p0x%-5x", taskCB->taskName, taskCB->taskEntry, taskCB->taskID);
|
||||
#if (LOSCFG_TASK_MEM_USED == 1)
|
||||
PRINTK("%-11u%-13s0x%-11x 0x%-11x 0x%-8x 0x%-10x ", taskCB->priority,
|
||||
OsConvertTskStatus(taskCB->taskStatus), getUsedSizeArray[loop], taskCB->stackSize,
|
||||
taskCB->stackPointer, taskCB->topOfStack, semId);
|
||||
taskCB->stackPointer, taskCB->topOfStack);
|
||||
#else
|
||||
PRINTK("%-11u%-13s0x%-11x 0x%-8x 0x%-10x ", taskCB->priority,
|
||||
OsConvertTskStatus(taskCB->taskStatus), taskCB->stackSize,
|
||||
taskCB->stackPointer, taskCB->topOfStack, semId);
|
||||
taskCB->stackPointer, taskCB->topOfStack);
|
||||
#endif
|
||||
PRINTK("\n");
|
||||
}
|
||||
|
||||
@@ -276,6 +276,7 @@ int OsShellCmdCat(int argc, const char **argv)
|
||||
|
||||
if (fd == -1) {
|
||||
ret = -1;
|
||||
free(fullpath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -522,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;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ STATIC VOID LOS_TraceSwtmrExpired(const SWTMR_CTRL_S *swtmr)
|
||||
|
||||
STATIC VOID LOS_TraceSwtmrStart(const SWTMR_CTRL_S *swtmr)
|
||||
{
|
||||
LOS_TRACE(SWTMR_START, swtmr->usTimerID, swtmr->ucMode, swtmr->uwCount, swtmr->uwInterval, 0);
|
||||
LOS_TRACE(SWTMR_START, swtmr->usTimerID, swtmr->ucMode, swtmr->uwInterval);
|
||||
}
|
||||
|
||||
STATIC VOID LOS_TraceSwtmrStop(const SWTMR_CTRL_S *swtmr)
|
||||
|
||||
@@ -240,7 +240,7 @@ STATIC UINT32 OsCreateTraceAgentTask(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
|
||||
UINT32 OsTraceInit(VOID)
|
||||
{
|
||||
UINT32 intSave;
|
||||
UINT32 ret;
|
||||
@@ -267,10 +267,15 @@ UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = OsTraceBufInit(buf, size);
|
||||
#if (LOSCFG_RECORDER_MODE_OFFLINE == 1)
|
||||
ret = OsTraceBufInit(LOSCFG_TRACE_BUFFER_SIZE);
|
||||
if (ret != LOS_OK) {
|
||||
goto LOS_RELEASE;
|
||||
#if (LOSCFG_TRACE_CONTROL_AGENT == 1)
|
||||
(VOID)LOS_TaskDelete(g_traceTaskId);
|
||||
#endif
|
||||
goto LOS_ERREND;
|
||||
}
|
||||
#endif
|
||||
|
||||
OsTraceHookInstall();
|
||||
OsTraceCnvInit();
|
||||
@@ -286,10 +291,6 @@ UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
|
||||
#endif
|
||||
TRACE_UNLOCK(intSave);
|
||||
return LOS_OK;
|
||||
LOS_RELEASE:
|
||||
#if (LOSCFG_TRACE_CONTROL_AGENT == 1)
|
||||
LOS_TaskDelete(g_traceTaskId);
|
||||
#endif
|
||||
LOS_ERREND:
|
||||
TRACE_UNLOCK(intSave);
|
||||
return ret;
|
||||
|
||||
@@ -320,7 +320,7 @@ extern TRACE_EVENT_HOOK g_traceEventHook;
|
||||
#define TASK_RESUME_PARAMS(taskId, taskStatus, prio) taskId, taskStatus, prio
|
||||
#define TASK_SIGNAL_PARAMS(taskId, signal, schedFlag) // taskId, signal, schedFlag
|
||||
|
||||
#define SWTMR_START_PARAMS(swtmrId, mode, overrun, interval, expiry) swtmrId, mode, overrun, interval, expiry
|
||||
#define SWTMR_START_PARAMS(swtmrId, mode, interval) swtmrId, mode, interval
|
||||
#define SWTMR_DELETE_PARAMS(swtmrId) swtmrId
|
||||
#define SWTMR_EXPIRED_PARAMS(swtmrId) swtmrId
|
||||
#define SWTMR_STOP_PARAMS(swtmrId) swtmrId
|
||||
@@ -434,33 +434,6 @@ extern TRACE_EVENT_HOOK g_traceEventHook;
|
||||
#define LOS_TRACE_EASY(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_trace
|
||||
* @brief Intialize the trace when the system startup.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to intilize the trace for system level.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This API can be called only after the memory is initialized. Otherwise, the Trace Init will be fail.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param buf [IN] Type #VOID *. The ptr is trace buffer address, if ptr is NULL, system will malloc a new one in
|
||||
* trace offline mode.
|
||||
* @param size [IN] Type #UINT32. The trace buffer's size.
|
||||
*
|
||||
* @retval #LOS_ERRNO_TRACE_ERROR_STATUS 0x02001400: The trace status is not TRACE_UNINIT.
|
||||
* @retval #LOS_ERRNO_TRACE_NO_MEMORY 0x02001401: The memory is not enough for initilize.
|
||||
* @retval #LOS_ERRNO_TRACE_BUF_TOO_SMALL 0x02001402: Trace buf size not enough.
|
||||
* @retval #LOS_ERRNO_TSK_TCB_UNAVAILABLE 0x02000211: No free task control block is available.
|
||||
* @retval #LOS_ERRNO_TSK_MP_SYNC_RESOURCE 0x02000225: Mp sync resource create failed
|
||||
* @retval #LOS_OK 0x00000000: The intialization is successful.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_trace.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_TraceInit
|
||||
*/
|
||||
extern UINT32 LOS_TraceInit(VOID *buf, UINT32 size);
|
||||
|
||||
/**
|
||||
* @ingroup los_trace
|
||||
* @brief Start trace.
|
||||
|
||||
@@ -119,10 +119,10 @@ typedef struct {
|
||||
OfflineHead *head;
|
||||
} TraceOfflineHeaderInfo;
|
||||
|
||||
extern UINT32 OsTraceInit(VOID);
|
||||
extern UINT32 OsTraceGetMaskTid(UINT32 taskId);
|
||||
extern VOID OsTraceSetObj(ObjData *obj, const LosTaskCB *tcb);
|
||||
extern VOID OsTraceWriteOrSendEvent(const TraceEventFrame *frame);
|
||||
extern UINT32 OsTraceBufInit(VOID *buf, UINT32 size);
|
||||
extern VOID OsTraceObjAdd(UINT32 eventType, UINT32 taskId);
|
||||
extern BOOL OsTraceIsEnable(VOID);
|
||||
extern OfflineHead *OsTraceRecordGet(VOID);
|
||||
@@ -145,6 +145,7 @@ extern VOID OsTraceSendNotify(UINT32 type, UINT32 value);
|
||||
#define OsTraceReset()
|
||||
#define OsTraceRecordDump(toClient)
|
||||
#else
|
||||
extern UINT32 OsTraceBufInit(UINT32 size);
|
||||
extern VOID OsTraceReset(VOID);
|
||||
extern VOID OsTraceRecordDump(BOOL toClient);
|
||||
#define OsTraceNotifyStart()
|
||||
|
||||
@@ -49,21 +49,19 @@ UINT32 OsTraceGetMaskTid(UINT32 tid)
|
||||
return tid | ((tid < LOSCFG_BASE_CORE_TSK_LIMIT) ? g_tidMask[tid] << BITS_NUM_FOR_TASK_ID : 0); /* tid < 65535 */
|
||||
}
|
||||
|
||||
UINT32 OsTraceBufInit(VOID *buf, UINT32 size)
|
||||
UINT32 OsTraceBufInit(UINT32 size)
|
||||
{
|
||||
UINT32 headSize;
|
||||
|
||||
VOID *buf = NULL;
|
||||
headSize = sizeof(OfflineHead) + sizeof(ObjData) * LOSCFG_TRACE_OBJ_MAX_NUM;
|
||||
if (size <= headSize) {
|
||||
TRACE_ERROR("trace buf size not enough than 0x%x\n", headSize);
|
||||
return LOS_ERRNO_TRACE_BUF_TOO_SMALL;
|
||||
}
|
||||
|
||||
buf = LOS_MemAlloc(m_aucSysMem0, size);
|
||||
if (buf == NULL) {
|
||||
buf = LOS_MemAlloc(m_aucSysMem0, size);
|
||||
if (buf == NULL) {
|
||||
return LOS_ERRNO_TRACE_NO_MEMORY;
|
||||
}
|
||||
return LOS_ERRNO_TRACE_NO_MEMORY;
|
||||
}
|
||||
|
||||
(VOID)memset_s(buf, size, 0, size);
|
||||
|
||||
@@ -44,13 +44,6 @@ UINT32 OsTraceGetMaskTid(UINT32 taskId)
|
||||
return taskId;
|
||||
}
|
||||
|
||||
UINT32 OsTraceBufInit(VOID *buf, UINT32 size)
|
||||
{
|
||||
(VOID)buf;
|
||||
(VOID)size;
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID OsTraceSendHead(VOID)
|
||||
{
|
||||
TraceBaseHeaderInfo head = {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -202,18 +202,22 @@ STATIC INT32 ProcessReturnVal(pthread_cond_t *cond, INT32 val)
|
||||
}
|
||||
|
||||
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
const struct timespec *absTime)
|
||||
const struct timespec *ts)
|
||||
{
|
||||
UINT32 absTicks;
|
||||
INT32 ret;
|
||||
UINT64 absTicks;
|
||||
const UINT32 nsPerTick = OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND;
|
||||
struct timespec tp;
|
||||
UINT64 nseconds;
|
||||
UINT64 currTime;
|
||||
|
||||
if ((cond == NULL) || (mutex == NULL) || (absTime == NULL)) {
|
||||
if ((cond == NULL) || (mutex == NULL) || (ts == NULL)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (CondInitCheck(cond)) {
|
||||
ret = pthread_cond_init(cond, NULL);
|
||||
if (ret != ENOERR) {
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -222,22 +226,29 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
cond->count++;
|
||||
(VOID)pthread_mutex_unlock(cond->mutex);
|
||||
|
||||
if ((absTime->tv_sec == 0) && (absTime->tv_nsec == 0)) {
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
|
||||
if (!ValidTimeSpec(absTime)) {
|
||||
if (!ValidTimeSpec(ts)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
absTicks = OsTimeSpec2Tick(absTime);
|
||||
if (pthread_mutex_unlock(mutex) != ENOERR) {
|
||||
clock_gettime(CLOCK_REALTIME, &tp);
|
||||
currTime = (UINT64)tp.tv_sec * OS_SYS_NS_PER_SECOND + tp.tv_nsec;
|
||||
nseconds = (UINT64)ts->tv_sec * OS_SYS_NS_PER_SECOND + ts->tv_nsec;
|
||||
if (currTime >= nseconds) {
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
absTicks = ((nseconds - currTime) + nsPerTick - 1) / nsPerTick + 1;
|
||||
if (absTicks >= UINT32_MAX) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(mutex) != 0) {
|
||||
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
ret = (INT32)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, absTicks);
|
||||
(VOID)LOS_EventClear(&(cond->event), 0);
|
||||
ret = (INT32)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, (UINT32)absTicks);
|
||||
|
||||
if (pthread_mutex_lock(mutex) != ENOERR) {
|
||||
if (pthread_mutex_lock(mutex) != 0) {
|
||||
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,9 +63,6 @@ STATIC const UINT8 g_montbl[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,
|
||||
*/
|
||||
long timezone = -8 * 60 * 60; // defaults to CST: 8 hours east of the Prime Meridian
|
||||
|
||||
/* internal shared struct tm object for localtime and gmtime */
|
||||
static struct tm g_tm;
|
||||
|
||||
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
{
|
||||
UINT64 nseconds;
|
||||
@@ -508,7 +505,8 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result)
|
||||
|
||||
struct tm *gmtime(const time_t *timer)
|
||||
{
|
||||
return gmtime_r(timer, &g_tm);
|
||||
static struct tm tm;
|
||||
return gmtime_r(timer, &tm);
|
||||
}
|
||||
|
||||
struct tm *localtime_r(const time_t *timep, struct tm *result)
|
||||
@@ -526,7 +524,8 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
|
||||
|
||||
struct tm *localtime(const time_t *timer)
|
||||
{
|
||||
return localtime_r(timer, &g_tm);
|
||||
static struct tm tm;
|
||||
return localtime_r(timer, &tm);
|
||||
}
|
||||
|
||||
static time_t ConvertUtc2Secs(struct tm *tm)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -195,10 +195,10 @@ _hwiActiveCheck
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as pid
|
||||
|
||||
_ExcInMSP
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -85,10 +85,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -268,7 +268,7 @@ _hwiActiveCheck:
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as pid
|
||||
.fnend
|
||||
|
||||
.type _ExcInMSP, %function
|
||||
@@ -276,16 +276,13 @@ _hwiActiveCheck:
|
||||
_ExcInMSP:
|
||||
.fnstart
|
||||
.cantunwind
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
MRS R12, PRIMASK // store message-->exc: disable int?
|
||||
PUSH {R4-R12} // store message-->exc: {R4-R12}
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
VPUSH {D8-D15}
|
||||
#endif
|
||||
B _handleEntry
|
||||
.fnend
|
||||
|
||||
@@ -341,10 +338,7 @@ _hwiActiveCheckNext:
|
||||
|
||||
MRS R12, PRIMASK
|
||||
PUSH {R4-R12}
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
VPUSH {D8-D15}
|
||||
#endif
|
||||
|
||||
// copy auto saved task register
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -252,7 +252,7 @@ _hwiActiveCheck:
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as pid
|
||||
.fnend
|
||||
|
||||
.type _ExcInMSP, %function
|
||||
@@ -260,16 +260,13 @@ _hwiActiveCheck:
|
||||
_ExcInMSP:
|
||||
.fnstart
|
||||
.cantunwind
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
MRS R12, PRIMASK // store message-->exc: disable int?
|
||||
PUSH {R4-R12} // store message-->exc: {R4-R12}
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
VPUSH {D8-D15}
|
||||
#endif
|
||||
B _handleEntry
|
||||
.fnend
|
||||
|
||||
@@ -325,10 +322,7 @@ _hwiActiveCheckNext:
|
||||
|
||||
MRS R12, PRIMASK
|
||||
PUSH {R4-R12}
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
VPUSH {D8-D15}
|
||||
#endif
|
||||
|
||||
// copy auto saved task register
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -268,7 +268,7 @@ _hwiActiveCheck:
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as pid
|
||||
.fnend
|
||||
|
||||
.type _ExcInMSP, %function
|
||||
@@ -276,16 +276,13 @@ _hwiActiveCheck:
|
||||
_ExcInMSP:
|
||||
.fnstart
|
||||
.cantunwind
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
MRS R12, PRIMASK // store message-->exc: disable int?
|
||||
PUSH {R4-R12} // store message-->exc: {R4-R12}
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
VPUSH {D8-D15}
|
||||
#endif
|
||||
B _handleEntry
|
||||
.fnend
|
||||
|
||||
@@ -341,10 +338,7 @@ _hwiActiveCheckNext:
|
||||
|
||||
MRS R12, PRIMASK
|
||||
PUSH {R4-R12}
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
VPUSH {D8-D15}
|
||||
#endif
|
||||
|
||||
// copy auto saved task register
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -198,7 +198,7 @@ _hwiActiveCheck
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as uwPid
|
||||
|
||||
_ExcInMSP
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINTPTR intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -184,10 +184,10 @@ _hwiActiveCheck
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as pid
|
||||
|
||||
_ExcInMSP
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINTPTR intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -267,7 +267,7 @@ _hwiActiveCheck:
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as pid
|
||||
.fnend
|
||||
|
||||
.type _ExcInMSP, %function
|
||||
@@ -275,7 +275,7 @@ _hwiActiveCheck:
|
||||
_ExcInMSP:
|
||||
.fnstart
|
||||
.cantunwind
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -85,10 +85,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -195,10 +195,10 @@ _hwiActiveCheck
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as pid
|
||||
|
||||
_ExcInMSP
|
||||
CMP LR, #0xFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -85,10 +85,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -268,7 +268,7 @@ _hwiActiveCheck:
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as pid
|
||||
.fnend
|
||||
|
||||
.type _ExcInMSP, %function
|
||||
@@ -276,16 +276,13 @@ _hwiActiveCheck:
|
||||
_ExcInMSP:
|
||||
.fnstart
|
||||
.cantunwind
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
MRS R12, PRIMASK // store message-->exc: disable int?
|
||||
PUSH {R4-R12} // store message-->exc: {R4-R12}
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
VPUSH {D8-D15}
|
||||
#endif
|
||||
B _handleEntry
|
||||
.fnend
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -521,25 +521,6 @@ typedef struct TagExcContext {
|
||||
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
|
||||
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* @brief: Exception initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure the exception function vector table.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param uwArraySize [IN] Memory size of exception.
|
||||
*
|
||||
* @retval: None
|
||||
* @par Dependency:
|
||||
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID OsExcInit(VOID);
|
||||
|
||||
VOID HalExcNMI(VOID);
|
||||
VOID HalExcHardFault(VOID);
|
||||
VOID HalExcMemFault(VOID);
|
||||
|
||||
@@ -195,10 +195,10 @@ _hwiActiveCheck
|
||||
RBIT R2, R3
|
||||
CLZ R2, R2
|
||||
AND R12, R12, #1
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as uwPid
|
||||
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as pid
|
||||
|
||||
_ExcInMSP
|
||||
CMP LR, #0XFFFFFFED
|
||||
CMP LR, #0xFFFFFFE9
|
||||
BNE _NoFloatInMsp
|
||||
ADD R3, R13, #104
|
||||
PUSH {R3}
|
||||
|
||||
@@ -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);
|
||||
@@ -491,7 +491,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, U
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
|
||||
{
|
||||
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
|
||||
UINT32 index;
|
||||
@@ -519,8 +519,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;
|
||||
}
|
||||
|
||||
@@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -187,9 +187,9 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
ret = LOS_TraceInit(NULL, LOSCFG_TRACE_BUFFER_SIZE);
|
||||
ret = OsTraceInit(LOSCFG_TRACE_BUFFER_SIZE);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("LOS_TraceInit error\n");
|
||||
PRINT_ERR("OsTraceInit error\n");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
@@ -203,11 +203,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_TEST == 1)
|
||||
//ret = los_TestInit();
|
||||
//if (ret != LOS_OK) {
|
||||
// PRINT_ERR("los_TestInit error\n");
|
||||
// return ret;
|
||||
//}
|
||||
ret = los_TestInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("los_TestInit error\n");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -578,8 +574,6 @@ UINT64 LOS_SchedTickTimeoutNsGet(VOID)
|
||||
|
||||
VOID LOS_SchedTickHandler(VOID)
|
||||
{
|
||||
BOOL needSched = FALSE;
|
||||
|
||||
if (!g_taskScheduled) {
|
||||
return;
|
||||
}
|
||||
@@ -589,19 +583,21 @@ VOID LOS_SchedTickHandler(VOID)
|
||||
if (g_schedResponseID == OS_INVALID) {
|
||||
g_tickIntLock++;
|
||||
if (g_swtmrScan != NULL) {
|
||||
needSched = g_swtmrScan();
|
||||
(VOID)g_swtmrScan();
|
||||
}
|
||||
|
||||
needSched |= OsSchedScanTimerList();
|
||||
(VOID)OsSchedScanTimerList();
|
||||
g_tickIntLock--;
|
||||
}
|
||||
|
||||
OsTimeSliceUpdate(g_losTask.runTask, g_tickStartTime);
|
||||
g_losTask.runTask->startTime = OsGetCurrSchedTimeCycle();
|
||||
|
||||
g_schedResponseTime = OS_SCHED_MAX_RESPONSE_TIME;
|
||||
if (needSched && LOS_CHECK_SCHEDULE) {
|
||||
if (LOS_CHECK_SCHEDULE) {
|
||||
HalTaskSchedule();
|
||||
} else {
|
||||
OsTimeSliceUpdate(g_losTask.runTask, g_tickStartTime);
|
||||
OsSchedUpdateExpireTime(g_tickStartTime, TRUE);
|
||||
OsSchedUpdateExpireTime(g_losTask.runTask->startTime, TRUE);
|
||||
}
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -232,6 +232,8 @@ LITE_OS_SEC_TEXT UINT32 LOS_SemPend(UINT32 semHandle, UINT32 timeout)
|
||||
goto ERROR_SEM_PEND;
|
||||
}
|
||||
|
||||
runningTask = (LosTaskCB *)g_losTask.runTask;
|
||||
|
||||
if (semPended->semCount > 0) {
|
||||
semPended->semCount--;
|
||||
LOS_IntRestore(intSave);
|
||||
@@ -244,7 +246,6 @@ LITE_OS_SEC_TEXT UINT32 LOS_SemPend(UINT32 semHandle, UINT32 timeout)
|
||||
goto ERROR_SEM_PEND;
|
||||
}
|
||||
|
||||
runningTask = (LosTaskCB *)g_losTask.runTask;
|
||||
runningTask->taskSem = (VOID *)semPended;
|
||||
OsSchedTaskWait(&semPended->semList, timeout);
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1033,6 +1033,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDetach(UINT32 taskID)
|
||||
return LOS_ERRNO_TSK_NOT_CREATED;
|
||||
}
|
||||
|
||||
if (taskCB->taskStatus & OS_TASK_STATUS_EXIT) {
|
||||
LOS_IntRestore(intSave);
|
||||
return LOS_TaskJoin(taskID, NULL);
|
||||
}
|
||||
|
||||
ret = OsTaskSetDetachUnsafe(taskCB);
|
||||
LOS_IntRestore(intSave);
|
||||
return ret;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -176,7 +176,7 @@ $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
||||
$(AS) -c $(CFLAGS) $< -o $@
|
||||
$(AS) -c $(CFLAGS) $(ASFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile $(LDSCRIPT)
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
|
||||
@@ -36,9 +36,11 @@ C_INCLUDES += -I. \
|
||||
-I$(LITEOSTOPDIR)/kernel/arch/include \
|
||||
-I$(LITEOSTOPDIR)/kernel/arch/risc-v/nuclei/gcc
|
||||
|
||||
ASFLAGS += -imacros $(LITEOSTOPDIR)/kernel/include/los_config.h -DCLZ=CLZ
|
||||
|
||||
# list of ASM .S program objects
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASMS_SOURCES:.S=.o)))
|
||||
vpath %.S $(sort $(dir $(ASMS_SOURCES)))
|
||||
|
||||
$(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
$(CC) -c $(CFLAGS) $(ASFLAGS) $< -o $@
|
||||
|
||||
@@ -178,7 +178,7 @@ $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
||||
$(AS) -c $(CFLAGS) $< -o $@
|
||||
$(AS) -c $(CFLAGS) $(ASFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile $(LDSCRIPT)
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
|
||||
@@ -36,9 +36,11 @@ C_INCLUDES += -I. \
|
||||
-I$(LITEOSTOPDIR)/kernel/arch/include \
|
||||
-I$(LITEOSTOPDIR)/kernel/arch/risc-v/nuclei/gcc
|
||||
|
||||
ASFLAGS += -imacros $(LITEOSTOPDIR)/kernel/include/los_config.h -DCLZ=CLZ
|
||||
|
||||
# list of ASM .S program objects
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASMS_SOURCES:.S=.o)))
|
||||
vpath %.S $(sort $(dir $(ASMS_SOURCES)))
|
||||
|
||||
$(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
$(CC) -c $(CFLAGS) $(ASFLAGS) $< -o $@
|
||||
|
||||
@@ -337,6 +337,7 @@ extern VOID ItSuiteLosHwi(void);
|
||||
extern VOID ItSuiteLosMem(void);
|
||||
extern VOID ItSuiteLosDynlink(void);
|
||||
extern VOID ItSuite_Los_FatFs(void);
|
||||
extern VOID ItSuiteLosPm(void);
|
||||
|
||||
extern VOID ItSuite_Cmsis_Lostask(void);
|
||||
extern VOID ItSuite_Cmsis_Lostask_add(void);
|
||||
|
||||
@@ -47,7 +47,6 @@ UINT32 g_testTaskIdHwi = 0xFFFF;
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 2;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
@@ -67,7 +66,6 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
LOS_TaskDelete(g_testTaskIdHwi);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
|
||||
@@ -62,10 +62,4 @@ static_library("test_mem") {
|
||||
]
|
||||
|
||||
configs += [ "//kernel/liteos_m/testsuits:include" ]
|
||||
|
||||
defines = [
|
||||
"LOS_RECORD_LR_CNT=3",
|
||||
"LOS_DLNK_NODE_HEAD_SIZE=0",
|
||||
"MIN_DLNK_POOL_SIZE=0",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ extern "C" {
|
||||
|
||||
#define OS_MEM_WATERLINE YES
|
||||
|
||||
#define LOS_DLNK_NODE_HEAD_SIZE 0
|
||||
#define MIN_DLNK_POOL_SIZE 0
|
||||
|
||||
#ifdef OS_MEM_WATERLINE
|
||||
#define TEST_MEM_MINIUSE (LOS_DLNK_HEAD_SIZE + LOS_DLNK_NODE_HEAD_SIZE + sizeof(LOS_MEM_POOL_INFO))
|
||||
#endif
|
||||
@@ -84,7 +87,7 @@ struct TestMemNodeHead {
|
||||
UINT32 magic;
|
||||
#endif
|
||||
#if (LOSCFG_MEM_LEAKCHECK == 1)
|
||||
UINTPTR linkReg[LOS_RECORD_LR_CNT];
|
||||
UINTPTR linkReg[LOSCFG_MEM_RECORD_LR_CNT];
|
||||
#endif
|
||||
union {
|
||||
struct TestMemNodeHead *prev; /* The prev is used for current node points to the previous node */
|
||||
|
||||
@@ -63,8 +63,10 @@ static UINT32 TestCase(VOID)
|
||||
ICUNIT_GOTO_NOT_EQUAL(p0, NULL, 0, EXIT);
|
||||
d[i] = p0;
|
||||
}
|
||||
if (!((UINT32)(UINTPTR)g_memPool < (UINT32)(UINTPTR)d[0] < (UINT32)(UINTPTR)d[1] < (UINT32)(UINTPTR)p[1]))
|
||||
if (!(((UINT32)(UINTPTR)g_memPool < (UINT32)(UINTPTR)d[0]) && ((UINT32)(UINTPTR)d[0] < (UINT32)(UINTPTR)d[1]) &&
|
||||
((UINT32)(UINTPTR)d[1] < (UINT32)(UINTPTR)p[1]))) {
|
||||
ICUNIT_GOTO_EQUAL(1, 0, 0, EXIT);
|
||||
}
|
||||
|
||||
EXIT:
|
||||
MemFree();
|
||||
|
||||
@@ -58,7 +58,7 @@ static UINT32 TestCase(VOID)
|
||||
f0 = LOS_MemAlloc(g_memPool, size / 4); // 4, The reallocated memory size is a quarter of its previous size.
|
||||
ICUNIT_GOTO_NOT_EQUAL(f0, NULL, f0, EXIT);
|
||||
|
||||
if (!((UINT32)(UINTPTR)p[0] < (UINT32)(UINTPTR)f0 < (UINT32)(UINTPTR)p[1])) {
|
||||
if (!(((UINT32)(UINTPTR)p[0] < (UINT32)(UINTPTR)f0) && ((UINT32)(UINTPTR)f0 < (UINT32)(UINTPTR)p[1]))) {
|
||||
ICUNIT_GOTO_EQUAL(1, 0, 0, EXIT);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -40,7 +40,7 @@ void MemStart(void)
|
||||
g_testPool = LOS_MemAlloc(LOSCFG_SYS_HEAP_ADDR, TEST_POOL_SIZE);
|
||||
|
||||
if ((g_memPool == NULL) || (g_testPool == NULL)) {
|
||||
PRINT_ERR("alloc failed , mem TestCase would be failed!!!!%x !!! %x", g_memPool, g_testPool);
|
||||
PRINT_ERR("alloc failed , mem TestCase would be failed!!!!%p !!! %p", g_memPool, g_testPool);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,8 +152,8 @@ static UINT32 TestCase(VOID)
|
||||
ret = LOS_PmUnregister(LOS_PM_TYPE_TICK_TIMER, &g_tickTimer);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_PmRegister(LOS_PM_TYPE_SYSCTRL, &g_sysctrl);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_PM_INVALID_PARAM, ret);
|
||||
ret = LOS_PmUnregister(LOS_PM_TYPE_SYSCTRL, &g_sysctrl);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_PmUnregister(LOS_PM_TYPE_DEVICE, &g_device1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "osTest.h"
|
||||
#include "It_los_pm.h"
|
||||
#include "los_timer.h"
|
||||
#include "los_sched.h"
|
||||
|
||||
#define myprintf // printf
|
||||
#define TEST_LOOP 5
|
||||
@@ -98,7 +99,6 @@ static UINT32 SystemPmEarly(UINT32 mode)
|
||||
static VOID SystemPmLate(UINT32 mode)
|
||||
{
|
||||
UINT32 ret;
|
||||
LosTaskCB *taskCB = NULL;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL_VOID(mode, LOS_SYS_LIGHT_SLEEP, mode);
|
||||
|
||||
@@ -154,12 +154,12 @@ static void TaskSampleEntry2(void)
|
||||
while (1) {
|
||||
if (g_testSample2Count == TEST_FLAGS) {
|
||||
g_testSample2Count = 0;
|
||||
LOS_PmLockRequest("TaskSampleEntry2");
|
||||
(VOID)LOS_PmLockRequest("TaskSampleEntry2");
|
||||
myprintf("%s request pm lock\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
myprintf("TaskSampleEntry2 running...count: %u\n\r", g_testSample2Count);
|
||||
LOS_TaskDelay(20); /* sleep 20 ticks */
|
||||
(VOID)LOS_TaskDelay(20); /* sleep 20 ticks */
|
||||
|
||||
if (g_testSample2Count <= TEST_TASK1_LOOP) { /* */
|
||||
g_testSample2Count++;
|
||||
@@ -174,7 +174,7 @@ static void TaskSampleEntry2(void)
|
||||
}
|
||||
}
|
||||
|
||||
LOS_PmLockRelease("TaskSampleEntry2");
|
||||
(VOID)LOS_PmLockRelease("TaskSampleEntry2");
|
||||
myprintf("TaskSampleEntry2 exit\n");
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ static void TaskSampleEntry1(void)
|
||||
|
||||
while (1) {
|
||||
if (g_testSample1Count == 0) {
|
||||
LOS_PmLockRequest("TaskSampleEntry1");
|
||||
(VOID)LOS_PmLockRequest("TaskSampleEntry1");
|
||||
myprintf("%s request pm lock\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ static void TaskSampleEntry1(void)
|
||||
}
|
||||
}
|
||||
|
||||
LOS_PmLockRelease("TaskSampleEntry1");
|
||||
(VOID)LOS_PmLockRelease("TaskSampleEntry1");
|
||||
myprintf("TaskSampleEntry1 exit\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "osTest.h"
|
||||
#include "It_los_pm.h"
|
||||
#include "los_timer.h"
|
||||
#include "los_sched.h"
|
||||
|
||||
#define TEST_LOOP 5
|
||||
static EVENT_CB_S g_pmTestEvent;
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
*/
|
||||
|
||||
#include "It_los_queue.h"
|
||||
#include "los_membox.h"
|
||||
|
||||
#define LOS_MEMBOX_MAGIC_SIZE 4
|
||||
static UINT32 g_uwQueueID122 = 0;
|
||||
static unsigned char g_aucMailBoxPool[40 + LOS_MEMBOX_MAGIC_SIZE] = {0};
|
||||
static VOID *g_pMailBox = NULL;
|
||||
static BOOL g_bTaskFinish1 = FALSE;
|
||||
static BOOL g_bTaskFinish2 = FALSE;
|
||||
|
||||
@@ -61,7 +61,6 @@ EXIT:
|
||||
|
||||
static VOID StTaskAllocNoWait(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
VOID *memBox = NULL;
|
||||
|
||||
memBox = OsQueueMailAlloc(g_uwQueueID122, (VOID *)g_aucMailBoxPool, LOS_NO_WAIT);
|
||||
@@ -139,5 +138,3 @@ VOID LltLosQueue003(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("LltLosQueue003", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user