Compare commits
18 Commits
OpenHarmon
...
OpenHarmon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b62463abc5 | ||
|
|
6ffea886d3 | ||
|
|
9de6f57cda | ||
|
|
307ab396a5 | ||
|
|
96b2eaeab6 | ||
|
|
58e67dde3b | ||
|
|
f74067b24f | ||
|
|
86bc68744d | ||
|
|
39db69b6bf | ||
|
|
87c6e9476d | ||
|
|
94537e17ae | ||
|
|
9717eafff7 | ||
|
|
0712c2df56 | ||
|
|
50b4e91f91 | ||
|
|
443d9deb9b | ||
|
|
caa28225a8 | ||
|
|
2332f34a79 | ||
|
|
314af71a48 |
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": []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 ...");
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -523,7 +523,10 @@ static int OsShellCmdDoRmdir(const char *pathname)
|
||||
char *fullpath = NULL;
|
||||
int ret;
|
||||
|
||||
(void)memset_s(&statInfo, sizeof(statInfo), 0, sizeof(struct stat));
|
||||
ret = memset_s(&statInfo, sizeof(struct stat), 0, sizeof(struct stat));
|
||||
if (ret != 0) {
|
||||
return -1;
|
||||
}
|
||||
if (stat(pathname, &statInfo) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -205,7 +205,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
const struct timespec *ts)
|
||||
{
|
||||
INT32 ret;
|
||||
UINT32 absTicks;
|
||||
UINT64 absTicks;
|
||||
const UINT32 nsPerTick = OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND;
|
||||
struct timespec tp;
|
||||
UINT64 nseconds;
|
||||
@@ -246,7 +246,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
}
|
||||
|
||||
(VOID)LOS_EventClear(&(cond->event), 0);
|
||||
(VOID)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, absTicks);
|
||||
ret = (INT32)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, (UINT32)absTicks);
|
||||
|
||||
if (pthread_mutex_lock(mutex) != 0) {
|
||||
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -273,6 +273,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};
|
||||
@@ -520,8 +521,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;
|
||||
}
|
||||
|
||||
@@ -263,6 +263,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};
|
||||
@@ -510,8 +511,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;
|
||||
}
|
||||
|
||||
@@ -263,6 +263,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};
|
||||
@@ -510,8 +511,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;
|
||||
}
|
||||
|
||||
@@ -263,6 +263,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};
|
||||
@@ -510,8 +511,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;
|
||||
}
|
||||
|
||||
@@ -273,6 +273,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};
|
||||
@@ -530,8 +531,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;
|
||||
}
|
||||
|
||||
@@ -276,6 +276,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};
|
||||
@@ -523,8 +524,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;
|
||||
}
|
||||
|
||||
@@ -263,6 +263,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};
|
||||
@@ -510,8 +511,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;
|
||||
}
|
||||
|
||||
@@ -272,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};
|
||||
@@ -519,8 +520,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
|
||||
|
||||
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
|
||||
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
|
||||
|
||||
/* Enable DIV 0 and unaligned exception */
|
||||
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
|
||||
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
|
||||
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
|
||||
#else
|
||||
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -73,7 +73,11 @@ static uint32_t RegexFuzz(void)
|
||||
heartbeatPrint(i);
|
||||
|
||||
string1 = DT_SetGetString(&g_element[NUM_0_INDEX], initStrLen, maxStrLen, "CHN");
|
||||
(void)strncpy_s(str1, MAX_STR_BUF_LEN, string1, maxStrLen);
|
||||
ret = strncpy_s(str1, MAX_STR_BUF_LEN, string1, maxStrLen);
|
||||
if (ret != 0) {
|
||||
printf("strncpy_s failure in %s[%d], i = %d\n", __FUCTION__, __LINE__, i);
|
||||
return 1;
|
||||
}
|
||||
str1[MAX_STR_BUF_LEN - 1] = '\0';
|
||||
string2 = DT_SetGetString(&g_element[NUM_1_INDEX], initStrLen, maxStrLen, "CHN");
|
||||
(void)strncpy_s(str2, MAX_STR_BUF_LEN, string2, maxStrLen);
|
||||
|
||||
Reference in New Issue
Block a user