Compare commits
35 Commits
master
...
OpenHarmon
Author | SHA1 | Date |
---|---|---|
|
e4ae10d163 | |
|
7bb53531de | |
|
740afd70b6 | |
|
9fcf128322 | |
|
d58d8042e6 | |
|
b9292feaa8 | |
|
800ca76df2 | |
|
0846a8a1db | |
|
a0b126246e | |
|
a598b64da0 | |
|
2a73894de0 | |
|
923c05cd89 | |
|
a55fd7c6d1 | |
|
df4557ff41 | |
|
73723d73ac | |
|
6b8290e37c | |
|
a4bea97b8b | |
|
d89faf63a2 | |
|
b035f5bf7c | |
|
b0d7e9fc04 | |
|
e21e3d5d1f | |
|
124dd73f79 | |
|
fef2e372ff | |
|
d46d13e655 | |
|
90d798ae8a | |
|
1ee52d1e1f | |
|
724e7fa786 | |
|
078adec486 | |
|
d0e0bb5934 | |
|
9e8ae74620 | |
|
0d5a1ce9be | |
|
2a7b31018f | |
|
54db6c8e7e | |
|
ef186b476e | |
|
72cb77e14f |
|
@ -0,0 +1,86 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
<oatconfig>
|
||||||
|
<licensefile></licensefile>
|
||||||
|
<policylist>
|
||||||
|
<policy name="projectPolicy" desc="">
|
||||||
|
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||||
|
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||||
|
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||||
|
</policy>
|
||||||
|
</policylist>
|
||||||
|
<filefilterlist>
|
||||||
|
<filefilter name="defaultFilter" desc="文件属于FreeBSD仓库软连接,本仓库屏蔽告警,在FreeBSD仓库进行处理">
|
||||||
|
<filteritem type="filepath" name="kernel/arch/risc-v/nuclei/gcc/nmsis/Library/.*" desc="文件属于三方芯片的二进制代码,属于社区贡献,不用提供额外的说明"/>
|
||||||
|
<filteritem type="filepath" name="targets/riscv_nuclei_demo_soc_gcc/.*" desc="文件属于nuclei三方芯片的源代码,文件头说明跟随liteos_m/LICENSE,不用额外说明"/>
|
||||||
|
<filteritem type="filepath" name="targets/riscv_nuclei_gd32vf103_soc_gcc/.*" desc="文件属于nuclei三方芯片的源代码,文件头说明跟随liteos_m/LICENSE,不用额外说明"/>
|
||||||
|
<filteritem type="filepath" name="NOTICE" desc="NOTICE文件"/>
|
||||||
|
<filteritem type="filepath" name="kernel/arch/risc-v/nuclei" desc="该文件的license为apache 2.0符合"/>
|
||||||
|
</filefilter>
|
||||||
|
<filefilter name="defaultFilter" desc="Files not to check">
|
||||||
|
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||||
|
</filefilter>
|
||||||
|
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
||||||
|
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||||
|
</filefilter>
|
||||||
|
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
|
||||||
|
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||||
|
</filefilter>
|
||||||
|
<filefilter name="licenseFileNamePolicyFilter" desc="Filters for LICENSE file policies">
|
||||||
|
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||||
|
</filefilter>
|
||||||
|
<filefilter name="readmeFileNamePolicyFilter" desc="Filters for README file policies">
|
||||||
|
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||||
|
</filefilter>
|
||||||
|
<filefilter name="readmeOpenSourcefileNamePolicyFilter" desc="Filters for README.OpenSource file policies">
|
||||||
|
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||||
|
</filefilter>
|
||||||
|
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||||
|
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||||
|
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||||
|
</filefilter>
|
||||||
|
|
||||||
|
</filefilterlist>
|
||||||
|
<licensematcherlist>
|
||||||
|
<!--licensematcher name="uvwxyz License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped.">
|
||||||
|
<licensetext name="
|
||||||
|
uvwxyz license textA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
" desc=""/>
|
||||||
|
<licensetext name="
|
||||||
|
uvwxyz license textB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
" desc=""/>
|
||||||
|
</licensematcher-->
|
||||||
|
</licensematcherlist>
|
||||||
|
</oatconfig>
|
||||||
|
</configuration>
|
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
#include "fs_operations.h"
|
#include "fs_operations.h"
|
||||||
#include "los_config.h"
|
#include "los_config.h"
|
||||||
#ifdef LOSCFG_SUPPORT_FATFS
|
#if (LOSCFG_SUPPORT_FATFS == 1)
|
||||||
#include "fatfs.h"
|
#include "fatfs.h"
|
||||||
#endif
|
#endif
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
|
@ -331,7 +331,7 @@ ssize_t read(int fd, void *buf, size_t nbyte)
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return FS_FAILURE;
|
return FS_FAILURE;
|
||||||
}
|
}
|
||||||
if (nbyte > 1024) {
|
if (nbyte > 1024) { /* 1024, max random_size */
|
||||||
nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */
|
nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */
|
||||||
}
|
}
|
||||||
struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte};
|
struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte};
|
||||||
|
@ -347,14 +347,15 @@ ssize_t read(int fd, void *buf, size_t nbyte)
|
||||||
return recv(fd, buf, nbyte, 0);
|
return recv(fd, buf, nbyte, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (g_fs->fsFops == NULL || g_fs->fsFops->Read == NULL) {
|
|
||||||
errno = ENOSYS;
|
|
||||||
return FS_FAILURE;
|
|
||||||
}
|
|
||||||
if (g_fs == NULL) {
|
if (g_fs == NULL) {
|
||||||
errno = ENODEV;
|
errno = ENODEV;
|
||||||
return FS_FAILURE;
|
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);
|
return g_fs->fsFops->Read(fd, buf, nbyte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,29 +40,29 @@ FileDirInfo g_lfsDir[LFS_MAX_OPEN_DIRS] = {0};
|
||||||
struct FileOpInfo g_fsOp[LOSCFG_LFS_MAX_MOUNT_SIZE] = {0};
|
struct FileOpInfo g_fsOp[LOSCFG_LFS_MAX_MOUNT_SIZE] = {0};
|
||||||
static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0};
|
static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0};
|
||||||
struct dirent g_nameValue;
|
struct dirent g_nameValue;
|
||||||
static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t g_fsLocalMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a","/b","/c"};
|
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a", "/b", "/c"};
|
||||||
|
|
||||||
LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd)
|
LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
|
for (int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
|
||||||
if (g_handle[i].useFlag == 0) {
|
if (g_handle[i].useFlag == 0) {
|
||||||
*fd = i;
|
*fd = i;
|
||||||
g_handle[i].useFlag = 1;
|
g_handle[i].useFlag = 1;
|
||||||
g_handle[i].pathName = strdup(fileName);
|
g_handle[i].pathName = strdup(fileName);
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return &(g_handle[i]);
|
return &(g_handle[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
*fd = INVALID_FD;
|
*fd = INVALID_FD;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LfsFreeFd(int fd)
|
static void LfsFreeFd(int fd)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
g_handle[fd].useFlag = 0;
|
g_handle[fd].useFlag = 0;
|
||||||
if (g_handle[fd].pathName != NULL) {
|
if (g_handle[fd].pathName != NULL) {
|
||||||
free((void *)g_handle[fd].pathName);
|
free((void *)g_handle[fd].pathName);
|
||||||
|
@ -72,21 +72,21 @@ static void LfsFreeFd(int fd)
|
||||||
if (g_handle[fd].lfsHandle != NULL) {
|
if (g_handle[fd].lfsHandle != NULL) {
|
||||||
g_handle[fd].lfsHandle = NULL;
|
g_handle[fd].lfsHandle = NULL;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CheckFileIsOpen(const char *fileName)
|
BOOL CheckFileIsOpen(const char *fileName)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
|
for (int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
|
||||||
if (g_handle[i].useFlag == 1) {
|
if (g_handle[i].useFlag == 1) {
|
||||||
if (strcmp(g_handle[i].pathName, fileName) == 0) {
|
if (strcmp(g_handle[i].pathName, fileName) == 0) {
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,22 +103,22 @@ static BOOL LfsFdIsValid(int fd)
|
||||||
|
|
||||||
FileDirInfo *GetFreeDir(const char *dirName)
|
FileDirInfo *GetFreeDir(const char *dirName)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
|
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
|
||||||
if (g_lfsDir[i].useFlag == 0) {
|
if (g_lfsDir[i].useFlag == 0) {
|
||||||
g_lfsDir[i].useFlag = 1;
|
g_lfsDir[i].useFlag = 1;
|
||||||
g_lfsDir[i].dirName = strdup(dirName);
|
g_lfsDir[i].dirName = strdup(dirName);
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return &(g_lfsDir[i]);
|
return &(g_lfsDir[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeDirInfo(const char *dirName)
|
void FreeDirInfo(const char *dirName)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
|
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
|
||||||
if (g_lfsDir[i].useFlag == 1 && strcmp(g_lfsDir[i].dirName, dirName) == 0) {
|
if (g_lfsDir[i].useFlag == 1 && strcmp(g_lfsDir[i].dirName, dirName) == 0) {
|
||||||
g_lfsDir[i].useFlag = 0;
|
g_lfsDir[i].useFlag = 0;
|
||||||
|
@ -126,24 +126,23 @@ void FreeDirInfo(const char *dirName)
|
||||||
free(g_lfsDir[i].dirName);
|
free(g_lfsDir[i].dirName);
|
||||||
g_lfsDir[i].dirName = NULL;
|
g_lfsDir[i].dirName = NULL;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CheckDirIsOpen(const char *dirName)
|
BOOL CheckDirIsOpen(const char *dirName)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
|
for (int i = 0; i < LFS_MAX_OPEN_DIRS; i++) {
|
||||||
if (g_lfsDir[i].useFlag == 1) {
|
if (g_lfsDir[i].useFlag == 1) {
|
||||||
if (strcmp(g_lfsDir[i].dirName, dirName) == 0) {
|
if (strcmp(g_lfsDir[i].dirName, dirName) == 0) {
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,35 +164,35 @@ BOOL CheckPathIsMounted(const char *pathName, struct FileOpInfo **fileOpInfo)
|
||||||
char tmpName[LITTLEFS_MAX_LFN_LEN] = {0};
|
char tmpName[LITTLEFS_MAX_LFN_LEN] = {0};
|
||||||
int len = GetFirstLevelPathLen(pathName);
|
int len = GetFirstLevelPathLen(pathName);
|
||||||
|
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
|
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
|
||||||
if (g_fsOp[i].useFlag == 1) {
|
if (g_fsOp[i].useFlag == 1) {
|
||||||
(void)strncpy_s(tmpName, LITTLEFS_MAX_LFN_LEN, pathName, len);
|
(void)strncpy_s(tmpName, LITTLEFS_MAX_LFN_LEN, pathName, len);
|
||||||
if (strcmp(tmpName, g_fsOp[i].dirName) == 0) {
|
if (strcmp(tmpName, g_fsOp[i].dirName) == 0) {
|
||||||
*fileOpInfo = &(g_fsOp[i]);
|
*fileOpInfo = &(g_fsOp[i]);
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FileOpInfo *AllocMountRes(const char* target, const struct FileOps *fileOps)
|
struct FileOpInfo *AllocMountRes(const char* target, const struct FileOps *fileOps)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
|
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
|
||||||
if (g_fsOp[i].useFlag == 0 && strcmp(target, g_littlefsMntName[i]) == 0) {
|
if (g_fsOp[i].useFlag == 0 && strcmp(target, g_littlefsMntName[i]) == 0) {
|
||||||
g_fsOp[i].useFlag = 1;
|
g_fsOp[i].useFlag = 1;
|
||||||
g_fsOp[i].fsVops = fileOps;
|
g_fsOp[i].fsVops = fileOps;
|
||||||
g_fsOp[i].dirName = strdup(target);
|
g_fsOp[i].dirName = strdup(target);
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return &(g_fsOp[i]);
|
return &(g_fsOp[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,26 +202,26 @@ int SetDefaultMountPath(int pathNameIndex, const char* target)
|
||||||
return VFS_ERROR;
|
return VFS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
g_littlefsMntName[pathNameIndex] = strdup(target);
|
g_littlefsMntName[pathNameIndex] = strdup(target);
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return VFS_OK;
|
return VFS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FileOpInfo *GetMountRes(const char *target, int *mountIndex)
|
struct FileOpInfo *GetMountRes(const char *target, int *mountIndex)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
|
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
|
||||||
if (g_fsOp[i].useFlag == 1) {
|
if (g_fsOp[i].useFlag == 1) {
|
||||||
if (g_fsOp[i].dirName && strcmp(target, g_fsOp[i].dirName) == 0) {
|
if (g_fsOp[i].dirName && strcmp(target, g_fsOp[i].dirName) == 0) {
|
||||||
*mountIndex = i;
|
*mountIndex = i;
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return &(g_fsOp[i]);
|
return &(g_fsOp[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,33 +231,33 @@ int FreeMountResByIndex(int mountIndex)
|
||||||
return VFS_ERROR;
|
return VFS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
if (g_fsOp[mountIndex].useFlag == 1 && g_fsOp[mountIndex].dirName != NULL) {
|
if (g_fsOp[mountIndex].useFlag == 1 && g_fsOp[mountIndex].dirName != NULL) {
|
||||||
g_fsOp[mountIndex].useFlag = 0;
|
g_fsOp[mountIndex].useFlag = 0;
|
||||||
free(g_fsOp[mountIndex].dirName);
|
free(g_fsOp[mountIndex].dirName);
|
||||||
g_fsOp[mountIndex].dirName = NULL;
|
g_fsOp[mountIndex].dirName = NULL;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
|
|
||||||
return VFS_OK;
|
return VFS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FreeMountRes(const char *target)
|
int FreeMountRes(const char *target)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
|
for (int i = 0; i < LOSCFG_LFS_MAX_MOUNT_SIZE; i++) {
|
||||||
if (g_fsOp[i].useFlag == 1) {
|
if (g_fsOp[i].useFlag == 1) {
|
||||||
if (g_fsOp[i].dirName && strcmp(target, g_fsOp[i].dirName) == 0) {
|
if (g_fsOp[i].dirName && strcmp(target, g_fsOp[i].dirName) == 0) {
|
||||||
g_fsOp[i].useFlag = 0;
|
g_fsOp[i].useFlag = 0;
|
||||||
free(g_fsOp[i].dirName);
|
free(g_fsOp[i].dirName);
|
||||||
g_fsOp[i].dirName = NULL;
|
g_fsOp[i].dirName = NULL;
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return VFS_OK;
|
return VFS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
return VFS_ERROR;
|
return VFS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +528,7 @@ struct dirent *LfsReaddir(DIR *dir)
|
||||||
|
|
||||||
ret = lfs_dir_read(dirInfo->lfsHandle, (lfs_dir_t *)(&(dirInfo->dir)), &lfsInfo);
|
ret = lfs_dir_read(dirInfo->lfsHandle, (lfs_dir_t *)(&(dirInfo->dir)), &lfsInfo);
|
||||||
if (ret == TRUE) {
|
if (ret == TRUE) {
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
(void)strncpy_s(g_nameValue.d_name, sizeof(g_nameValue.d_name), lfsInfo.name, strlen(lfsInfo.name) + 1);
|
(void)strncpy_s(g_nameValue.d_name, sizeof(g_nameValue.d_name), lfsInfo.name, strlen(lfsInfo.name) + 1);
|
||||||
if (lfsInfo.type == LFS_TYPE_DIR) {
|
if (lfsInfo.type == LFS_TYPE_DIR) {
|
||||||
g_nameValue.d_type = DT_DIR;
|
g_nameValue.d_type = DT_DIR;
|
||||||
|
@ -538,7 +537,7 @@ struct dirent *LfsReaddir(DIR *dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_nameValue.d_reclen = lfsInfo.size;
|
g_nameValue.d_reclen = lfsInfo.size;
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
|
|
||||||
return &g_nameValue;
|
return &g_nameValue;
|
||||||
}
|
}
|
||||||
|
@ -686,9 +685,9 @@ int LfsClose(int fd)
|
||||||
return VFS_ERROR;
|
return VFS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&g_FslocalMutex);
|
pthread_mutex_lock(&g_fsLocalMutex);
|
||||||
ret = lfs_file_close(g_handle[fd].lfsHandle, &(g_handle[fd].file));
|
ret = lfs_file_close(g_handle[fd].lfsHandle, &(g_handle[fd].file));
|
||||||
pthread_mutex_unlock(&g_FslocalMutex);
|
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||||
|
|
||||||
LfsFreeFd(fd);
|
LfsFreeFd(fd);
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ static void getifaddrs_internal(struct getifaddrs_arg *arg)
|
||||||
if_storage = new_ifaddrs_storage();
|
if_storage = new_ifaddrs_storage();
|
||||||
if (if_storage == NULL) {
|
if (if_storage == NULL) {
|
||||||
lwip_freeifaddrs(
|
lwip_freeifaddrs(
|
||||||
*(arg->ifap)); /* ifap is assigned to NULL in getifaddrs, so garbage value will not be there */
|
*(arg->ifap)); /* ifap is assigned to NULL in getifaddrs, so garbage value will not be there */
|
||||||
arg->ret = ENOMEM;
|
arg->ret = ENOMEM;
|
||||||
goto RETURN;
|
goto RETURN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,34 @@
|
||||||
/**********************************************************************************
|
/*
|
||||||
|
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific prior written
|
||||||
|
* permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
* Copyright (c) <2013-2015>, <Huawei Technologies Co., Ltd>
|
|
||||||
* All rights reserved.
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation and/or
|
|
||||||
* other materials provided with the distribution.
|
|
||||||
* Neither the name of the copyright holder nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
||||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
***********************************************************************************/
|
|
||||||
/**********************************************************************************
|
/**********************************************************************************
|
||||||
|
|
||||||
* Notice of Export Control Law
|
* Notice of Export Control Law
|
||||||
|
|
|
@ -1,28 +1,34 @@
|
||||||
/**********************************************************************************
|
/*
|
||||||
|
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific prior written
|
||||||
|
* permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
* Copyright (c) <2013-2015>, <Huawei Technologies Co., Ltd>
|
|
||||||
* All rights reserved.
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation and/or
|
|
||||||
* other materials provided with the distribution.
|
|
||||||
* Neither the name of the copyright holder nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
||||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
***********************************************************************************/
|
|
||||||
/**********************************************************************************
|
/**********************************************************************************
|
||||||
|
|
||||||
* Notice of Export Control Law
|
* Notice of Export Control Law
|
||||||
|
@ -47,11 +53,9 @@
|
||||||
#include "lwip/icmp.h"
|
#include "lwip/icmp.h"
|
||||||
#include "los_config.h"
|
#include "los_config.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "lwip/api_shell.h"
|
|
||||||
|
|
||||||
#include "shcmd.h"
|
#include "shcmd.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "los_timer_pri.h"
|
|
||||||
#include "los_debug.h"
|
#include "los_debug.h"
|
||||||
#include "los_task.h"
|
#include "los_task.h"
|
||||||
|
|
||||||
|
@ -104,10 +108,10 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
|
||||||
if (buf_len < 1) {
|
if (buf_len < 1) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if(netif->link_layer_type == LOOPBACK_IF){
|
if (netif->link_layer_type == LOOPBACK_IF) {
|
||||||
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s\t", netif->name);
|
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s\t", netif->name);
|
||||||
} else {
|
} else {
|
||||||
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s%u\t", netif->name, netif->num);
|
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s%u\t", netif->name, netif->num);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
||||||
|
@ -317,8 +321,7 @@ static int ping_kill = 0;
|
||||||
|
|
||||||
static void lwip_ping_usage(void)
|
static void lwip_ping_usage(void)
|
||||||
{
|
{
|
||||||
PRINTK("Usage:"\
|
PRINTK("Usage:\n ping [ip]\n");
|
||||||
"\n ping [ip]\n"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LWIP_STATIC int OsPingFunc(u32_t *parg)
|
LWIP_STATIC int OsPingFunc(u32_t *parg)
|
||||||
|
@ -332,11 +335,11 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
|
||||||
u32_t iecho_len;
|
u32_t iecho_len;
|
||||||
s16_t ip_hlen;
|
s16_t ip_hlen;
|
||||||
u32_t forever;
|
u32_t forever;
|
||||||
u32_t i = 0;
|
u32_t i;
|
||||||
u32_t succ_cnt = 0;
|
u32_t succ_cnt = 0;
|
||||||
u32_t failed_cnt = 0;
|
u32_t failed_cnt = 0;
|
||||||
struct timespec start, end;
|
struct timespec start, end;
|
||||||
long timout_ms = 0;
|
long timout_ms;
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
long rtt;
|
long rtt;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -597,7 +600,6 @@ u32_t OsShellPing(int argc, const char **argv)
|
||||||
stPingTask.uwArg = (UINTPTR)parg;
|
stPingTask.uwArg = (UINTPTR)parg;
|
||||||
ret = LOS_TaskCreate((UINT32 *)(&ping_taskid), &stPingTask);
|
ret = LOS_TaskCreate((UINT32 *)(&ping_taskid), &stPingTask);
|
||||||
if (ret != LOS_OK) {
|
if (ret != LOS_OK) {
|
||||||
free(parg);
|
|
||||||
PRINTK("ping_task create failed 0x%08x.\n", ret);
|
PRINTK("ping_task create failed 0x%08x.\n", ret);
|
||||||
count = LWIP_SHELL_CMD_PING_RETRY_TIMES;
|
count = LWIP_SHELL_CMD_PING_RETRY_TIMES;
|
||||||
} else {
|
} else {
|
||||||
|
@ -613,6 +615,8 @@ u32_t OsShellPing(int argc, const char **argv)
|
||||||
PRINTK("Ping cmd failed due some errors\n");
|
PRINTK("Ping cmd failed due some errors\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(parg);
|
||||||
|
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
ping_error:
|
ping_error:
|
||||||
lwip_ping_usage();
|
lwip_ping_usage();
|
||||||
|
|
|
@ -67,7 +67,7 @@ sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg,
|
||||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)thread;
|
task.pfnTaskEntry = (TSK_ENTRY_FUNC)thread;
|
||||||
task.uwStackSize = stackSize;
|
task.uwStackSize = stackSize;
|
||||||
task.pcName = (char *)name;
|
task.pcName = (char *)name;
|
||||||
task.usTaskPrio = prio;
|
task.usTaskPrio = (UINT16)prio;
|
||||||
task.uwArg = (UINTPTR)arg;
|
task.uwArg = (UINTPTR)arg;
|
||||||
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
task.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||||
ret = LOS_TaskCreate(&taskID, &task);
|
ret = LOS_TaskCreate(&taskID, &task);
|
||||||
|
|
|
@ -190,7 +190,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsCmdAscendingInsert(CmdItemNode *cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cmdItem = LOS_DL_LIST_ENTRY((&cmdInfo.cmdList.list)->pstPrev, CmdItemNode, list);
|
for (cmdItem = LOS_DL_LIST_ENTRY((&cmdInfo.cmdList.list)->pstPrev, CmdItemNode, list);
|
||||||
&cmdItem->list != &(cmdInfo.cmdList.list);) {
|
&cmdItem->list != &(cmdInfo.cmdList.list); ) {
|
||||||
cmdNext = LOS_DL_LIST_ENTRY(cmdItem->list.pstPrev, CmdItemNode, list);
|
cmdNext = LOS_DL_LIST_ENTRY(cmdItem->list.pstPrev, CmdItemNode, list);
|
||||||
if (&cmdNext->list != &(cmdInfo.cmdList.list)) {
|
if (&cmdNext->list != &(cmdInfo.cmdList.list)) {
|
||||||
if ((strncmp(cmdItem->cmd->cmdKey, cmd->cmd->cmdKey, strlen(cmd->cmd->cmdKey)) >= 0) &&
|
if ((strncmp(cmdItem->cmd->cmdKey, cmd->cmd->cmdKey, strlen(cmd->cmd->cmdKey)) >= 0) &&
|
||||||
|
|
|
@ -64,7 +64,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
|
||||||
{
|
{
|
||||||
unsigned int loop;
|
unsigned int loop;
|
||||||
const char *tmpStr = NULL;
|
const char *tmpStr = NULL;
|
||||||
bool quotes = FALSE;
|
BOOL quotes = FALSE;
|
||||||
char *cmdName = NULL;
|
char *cmdName = NULL;
|
||||||
if (cmdline == NULL) {
|
if (cmdline == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -78,7 +78,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
|
||||||
|
|
||||||
/* Scan the 'cmdline' string for command */
|
/* Scan the 'cmdline' string for command */
|
||||||
/* Notice: Command string must not have any special name */
|
/* Notice: Command string must not have any special name */
|
||||||
for (tmpStr = cmdline, loop = 0; (*tmpStr != '\0') && (loop < len);) {
|
for (tmpStr = cmdline, loop = 0; (*tmpStr != '\0') && (loop < len); ) {
|
||||||
/* If reach a double quotes, switch the quotes matching status */
|
/* If reach a double quotes, switch the quotes matching status */
|
||||||
if (*tmpStr == '\"') {
|
if (*tmpStr == '\"') {
|
||||||
SWITCH_QUOTES_STATUS(quotes);
|
SWITCH_QUOTES_STATUS(quotes);
|
||||||
|
@ -114,12 +114,10 @@ int ShellCmdExec(const char *msgName, const char *cmdString)
|
||||||
}
|
}
|
||||||
|
|
||||||
uintRet = ShellMsgTypeGet(&cmdParsed, msgName);
|
uintRet = ShellMsgTypeGet(&cmdParsed, msgName);
|
||||||
|
|
||||||
if (uintRet != LOS_OK) {
|
if (uintRet != LOS_OK) {
|
||||||
PRINTK("%s:command not found\n", msgName);
|
PRINTK("%s:command not found\n", msgName);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
(void)OsCmdExec(&cmdParsed, (char *)cmdString);
|
(void)OsCmdExec(&cmdParsed, (char *)cmdString);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -88,11 +88,11 @@ static char *StrNormalizePath(char *fullpath)
|
||||||
while (*src != '\0') {
|
while (*src != '\0') {
|
||||||
if (*src == '.') {
|
if (*src == '.') {
|
||||||
if (*(src + 1) == '/') {
|
if (*(src + 1) == '/') {
|
||||||
src += 2;
|
src += 2; /* 2, sizeof "./" */
|
||||||
continue;
|
continue;
|
||||||
} else if (*(src + 1) == '.') {
|
} else if (*(src + 1) == '.') {
|
||||||
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) {
|
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) { /* 2, 2, offset to check */
|
||||||
src += 2;
|
src += 2; /* 2, sizeof offset */
|
||||||
} else {
|
} else {
|
||||||
while ((*src != '\0') && (*src != '/')) {
|
while ((*src != '\0') && (*src != '/')) {
|
||||||
*dest++ = *src++;
|
*dest++ = *src++;
|
||||||
|
@ -174,7 +174,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
|
||||||
/* 2: The position of the path character: / and the end character /0 */
|
/* 2: The position of the path character: / and the end character /0 */
|
||||||
|
|
||||||
if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) {
|
if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) {
|
||||||
filename += 2;
|
filename += 2; /* 2, sizeof "./" */
|
||||||
}
|
}
|
||||||
|
|
||||||
fullpath = (char *)malloc(strlen(directory) + namelen + 2);
|
fullpath = (char *)malloc(strlen(directory) + namelen + 2);
|
||||||
|
@ -184,8 +184,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
|
||||||
return (char *)NULL;
|
return (char *)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* join path and file name */
|
/* 2, sizeof "./", join path and file name */
|
||||||
|
|
||||||
ret = snprintf_s(fullpath, strlen(directory) + namelen + 2, strlen(directory) + namelen + 1,
|
ret = snprintf_s(fullpath, strlen(directory) + namelen + 2, strlen(directory) + namelen + 1,
|
||||||
"%s/%s", directory, filename);
|
"%s/%s", directory, filename);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -213,7 +212,6 @@ static char *VfsNormalizeFullpath(const char *directory, const char *filename, c
|
||||||
/* it's a absolute path, use it directly */
|
/* it's a absolute path, use it directly */
|
||||||
|
|
||||||
fullpath = strdup(filename); /* copy string */
|
fullpath = strdup(filename); /* copy string */
|
||||||
|
|
||||||
if (fullpath == NULL) {
|
if (fullpath == NULL) {
|
||||||
*pathname = NULL;
|
*pathname = NULL;
|
||||||
SetErrno(ENOMEM);
|
SetErrno(ENOMEM);
|
||||||
|
@ -246,8 +244,7 @@ int VfsNormalizePath(const char *directory, const char *filename, char **pathnam
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2: The position of the path character: / and the end character /0 */
|
/* 2, The position of the path character: / and the end character /0 */
|
||||||
|
|
||||||
if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) {
|
if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) {
|
||||||
return -ENAMETOOLONG;
|
return -ENAMETOOLONG;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,6 @@ LITE_OS_SEC_TEXT_MINOR STATIC VOID OsShellCmdTskInfoData(const LosTaskCB *allTas
|
||||||
{
|
{
|
||||||
const LosTaskCB *taskCB = NULL;
|
const LosTaskCB *taskCB = NULL;
|
||||||
UINT32 loop;
|
UINT32 loop;
|
||||||
UINT32 semId;
|
|
||||||
|
|
||||||
for (loop = 0; loop < g_taskMaxNum; ++loop) {
|
for (loop = 0; loop < g_taskMaxNum; ++loop) {
|
||||||
taskCB = allTaskArray + loop;
|
taskCB = allTaskArray + loop;
|
||||||
|
@ -97,12 +96,10 @@ LITE_OS_SEC_TEXT_MINOR STATIC VOID OsShellCmdTskInfoData(const LosTaskCB *allTas
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
semId = OsGetSemID(taskCB);
|
|
||||||
|
|
||||||
PRINTK("%-23s%-20p0x%-5x", taskCB->taskName, taskCB->taskEntry, taskCB->taskID);
|
PRINTK("%-23s%-20p0x%-5x", taskCB->taskName, taskCB->taskEntry, taskCB->taskID);
|
||||||
PRINTK("%-11u%-13s0x%-11x 0x%-8x 0x%-10x ", taskCB->priority,
|
PRINTK("%-11u%-13s0x%-11x 0x%-8x 0x%-10x ", taskCB->priority,
|
||||||
OsShellCmdConvertTskStatus(taskCB->taskStatus), taskCB->stackSize,
|
OsShellCmdConvertTskStatus(taskCB->taskStatus), taskCB->stackSize,
|
||||||
taskCB->stackPointer, taskCB->topOfStack, semId);
|
taskCB->stackPointer, taskCB->topOfStack);
|
||||||
PRINTK("\n");
|
PRINTK("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ int OsShellCmdCat(int argc, const char **argv)
|
||||||
char *fullpath = NULL;
|
char *fullpath = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
CHAR buf[CAT_BUF_SIZE];
|
CHAR buf[CAT_BUF_SIZE];
|
||||||
size_t size;
|
ssize_t size;
|
||||||
|
|
||||||
char *shellWorkingDirectory = OsShellGetWorkingDirtectory();
|
char *shellWorkingDirectory = OsShellGetWorkingDirtectory();
|
||||||
|
|
||||||
|
@ -276,13 +276,14 @@ int OsShellCmdCat(int argc, const char **argv)
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
free(fullpath);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
(void)memset_s(buf, sizeof(buf), 0, CAT_BUF_SIZE);
|
(void)memset_s(buf, sizeof(buf), 0, CAT_BUF_SIZE);
|
||||||
size = read(fd, buf, CAT_BUF_SIZE - 1);
|
size = read(fd, buf, CAT_BUF_SIZE - 1);
|
||||||
if ((int)size < 0) {
|
if (size < 0) {
|
||||||
free(fullpath);
|
free(fullpath);
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -384,7 +385,7 @@ static int OsShellCmdDoCp(const char *srcFilePath, const char *dstFileName)
|
||||||
char *dstFilePath = NULL;
|
char *dstFilePath = NULL;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
const char *filename = NULL;
|
const char *filename = NULL;
|
||||||
size_t rdSize, wrSize;
|
ssize_t rdSize, wrSize;
|
||||||
int srcFd = -1;
|
int srcFd = -1;
|
||||||
int dstFd = -1;
|
int dstFd = -1;
|
||||||
struct stat statBuf;
|
struct stat statBuf;
|
||||||
|
|
|
@ -33,10 +33,11 @@ declare_args() {
|
||||||
enable_ohos_kernel_liteos_m_exchook = true
|
enable_ohos_kernel_liteos_m_exchook = true
|
||||||
enable_ohos_kernel_liteos_m_kal = true
|
enable_ohos_kernel_liteos_m_kal = true
|
||||||
enable_ohos_kernel_liteos_m_fs = true
|
enable_ohos_kernel_liteos_m_fs = true
|
||||||
enable_ohos_kernel_liteos_m_shell = false
|
enable_ohos_kernel_liteos_m_shell = true
|
||||||
enable_ohos_kernel_liteos_m_backtrace = true
|
enable_ohos_kernel_liteos_m_backtrace = true
|
||||||
enable_ohos_kernel_liteos_m_test = false
|
enable_ohos_kernel_liteos_m_test = false
|
||||||
enable_ohos_kernel_liteos_m_pm = true
|
enable_ohos_kernel_liteos_m_pm = true
|
||||||
enable_ohos_kernel_liteos_m_lwip = false
|
enable_ohos_kernel_liteos_m_lwip = false
|
||||||
|
enable_ohos_kernel_liteos_m_tz = false
|
||||||
ohos_kernel_liteos_m_lwip_path = "components/net/lwip-2.1:lwip"
|
ohos_kernel_liteos_m_lwip_path = "components/net/lwip-2.1:lwip"
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,10 @@ extern "C" {
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/** The timer is not allowed to wake up the RTOS. */
|
/** The timer is not allowed to wake up the RTOS. */
|
||||||
osTimerRousesIgnore = 0,
|
osTimerRousesIgnore = 0,
|
||||||
/** The timer is allowed to wake up the RTOS. */
|
/** The timer is allowed to wake up the RTOS. */
|
||||||
osTimerRousesAllow = 1
|
osTimerRousesAllow = 1
|
||||||
} osTimerRouses_t;
|
} osTimerRouses_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,10 +61,10 @@ typedef enum {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/** The timer ignores alignment. */
|
/** The timer ignores alignment. */
|
||||||
osTimerAlignIgnore = 0,
|
osTimerAlignIgnore = 0,
|
||||||
/** The timer allows alignment. */
|
/** The timer allows alignment. */
|
||||||
osTimerAlignAllow = 1
|
osTimerAlignAllow = 1
|
||||||
} osTimerAlign_t;
|
} osTimerAlign_t;
|
||||||
|
|
||||||
osTimerId_t osTimerExtNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr,
|
osTimerId_t osTimerExtNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr,
|
||||||
|
|
|
@ -384,7 +384,7 @@ int OsMqGetAttr(mqd_t personal, struct mq_attr *mqAttr)
|
||||||
|
|
||||||
mqueueCB = privateMqPersonal->mq_posixdes;
|
mqueueCB = privateMqPersonal->mq_posixdes;
|
||||||
mqAttr->mq_maxmsg = mqueueCB->mqcb->queueLen;
|
mqAttr->mq_maxmsg = mqueueCB->mqcb->queueLen;
|
||||||
mqAttr->mq_msgsize = mqueueCB->mqcb->queueSize - sizeof(UINT32);
|
mqAttr->mq_msgsize = (long)(mqueueCB->mqcb->queueSize - sizeof(UINT32));
|
||||||
mqAttr->mq_curmsgs = mqueueCB->mqcb->readWriteableCnt[OS_QUEUE_READ];
|
mqAttr->mq_curmsgs = mqueueCB->mqcb->readWriteableCnt[OS_QUEUE_READ];
|
||||||
mqAttr->mq_flags = privateMqPersonal->mq_flags;
|
mqAttr->mq_flags = privateMqPersonal->mq_flags;
|
||||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||||
|
|
|
@ -144,7 +144,7 @@ int pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *par
|
||||||
}
|
}
|
||||||
|
|
||||||
*policy = SCHED_RR;
|
*policy = SCHED_RR;
|
||||||
param->sched_priority = prio;
|
param->sched_priority = (int)prio;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,6 +205,7 @@ void pthread_exit(void *retVal)
|
||||||
|
|
||||||
int pthread_setname_np(pthread_t thread, const char *name)
|
int pthread_setname_np(pthread_t thread, const char *name)
|
||||||
{
|
{
|
||||||
|
errno_t ret;
|
||||||
char *taskName = LOS_TaskNameGet((UINT32)thread);
|
char *taskName = LOS_TaskNameGet((UINT32)thread);
|
||||||
if (taskName == NULL || !IsPthread(thread)) {
|
if (taskName == NULL || !IsPthread(thread)) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
@ -212,13 +213,16 @@ int pthread_setname_np(pthread_t thread, const char *name)
|
||||||
if (strnlen(name, PTHREAD_NAMELEN) >= PTHREAD_NAMELEN) {
|
if (strnlen(name, PTHREAD_NAMELEN) >= PTHREAD_NAMELEN) {
|
||||||
return ERANGE;
|
return ERANGE;
|
||||||
}
|
}
|
||||||
(void)strcpy_s(taskName, PTHREAD_NAMELEN, name);
|
ret = strcpy_s(taskName, PTHREAD_NAMELEN, name);
|
||||||
|
if (ret != EOK) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pthread_getname_np(pthread_t thread, char *buf, size_t buflen)
|
int pthread_getname_np(pthread_t thread, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
int ret;
|
errno_t ret;
|
||||||
|
|
||||||
const char *name = LOS_TaskNameGet((UINT32)thread);
|
const char *name = LOS_TaskNameGet((UINT32)thread);
|
||||||
if (name == NULL || !IsPthread(thread)) {
|
if (name == NULL || !IsPthread(thread)) {
|
||||||
|
@ -226,7 +230,7 @@ int pthread_getname_np(pthread_t thread, char *buf, size_t buflen)
|
||||||
}
|
}
|
||||||
if (buflen > strlen(name)) {
|
if (buflen > strlen(name)) {
|
||||||
ret = strcpy_s(buf, buflen, name);
|
ret = strcpy_s(buf, buflen, name);
|
||||||
if (ret == 0) {
|
if (ret == EOK) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,3 +231,23 @@ int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stackSize)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sched_get_priority_min(int policy)
|
||||||
|
{
|
||||||
|
if (policy != SCHED_RR) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LOS_TASK_PRIORITY_LOWEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sched_get_priority_max(int policy)
|
||||||
|
{
|
||||||
|
if (policy != SCHED_RR) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LOS_TASK_PRIORITY_HIGHEST;
|
||||||
|
}
|
||||||
|
|
|
@ -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,
|
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||||
const struct timespec *absTime)
|
const struct timespec *ts)
|
||||||
{
|
{
|
||||||
UINT32 absTicks;
|
|
||||||
INT32 ret;
|
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;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CondInitCheck(cond)) {
|
if (CondInitCheck(cond)) {
|
||||||
ret = pthread_cond_init(cond, NULL);
|
ret = pthread_cond_init(cond, NULL);
|
||||||
if (ret != ENOERR) {
|
if (ret != 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,22 +226,30 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||||
cond->count++;
|
cond->count++;
|
||||||
(VOID)pthread_mutex_unlock(cond->mutex);
|
(VOID)pthread_mutex_unlock(cond->mutex);
|
||||||
|
|
||||||
if ((absTime->tv_sec == 0) && (absTime->tv_nsec == 0)) {
|
if (!ValidTimeSpec(ts)) {
|
||||||
return ETIMEDOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ValidTimeSpec(absTime)) {
|
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
absTicks = OsTimeSpec2Tick(absTime);
|
clock_gettime(CLOCK_REALTIME, &tp);
|
||||||
if (pthread_mutex_unlock(mutex) != ENOERR) {
|
currTime = (UINT64)tp.tv_sec * OS_SYS_NS_PER_SECOND + (UINT64)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__);
|
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__);
|
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#define OS_SYS_NS_PER_MSECOND 1000000
|
#define OS_SYS_NS_PER_MSECOND 1000000
|
||||||
#define OS_SYS_NS_PER_SECOND 1000000000
|
#define OS_SYS_NS_PER_SECOND 1000000000
|
||||||
|
#define OS_UINT_MAX (~0U)
|
||||||
|
|
||||||
static inline int MapError(UINT32 err)
|
static inline int MapError(UINT32 err)
|
||||||
{
|
{
|
||||||
|
@ -99,8 +100,7 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
|
||||||
int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *absTimeout)
|
int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *absTimeout)
|
||||||
{
|
{
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
UINT32 timeout;
|
INT64 timeoutMs;
|
||||||
UINT64 timeoutNs;
|
|
||||||
struct timespec curTime = {0};
|
struct timespec curTime = {0};
|
||||||
if ((mutex->magic != _MUX_MAGIC) || (absTimeout->tv_nsec < 0) || (absTimeout->tv_nsec >= OS_SYS_NS_PER_SECOND)) {
|
if ((mutex->magic != _MUX_MAGIC) || (absTimeout->tv_nsec < 0) || (absTimeout->tv_nsec >= OS_SYS_NS_PER_SECOND)) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
@ -115,12 +115,13 @@ int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *absTi
|
||||||
if (ret != LOS_OK) {
|
if (ret != LOS_OK) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
timeoutNs = (absTimeout->tv_sec - curTime.tv_sec) * OS_SYS_NS_PER_SECOND + (absTimeout->tv_nsec - curTime.tv_nsec);
|
timeoutMs = (absTimeout->tv_sec - curTime.tv_sec) * OS_SYS_MS_PER_SECOND +
|
||||||
if (timeoutNs <= 0) {
|
(absTimeout->tv_nsec - curTime.tv_nsec) / OS_SYS_NS_PER_MSECOND;
|
||||||
return ETIMEDOUT;
|
if (timeoutMs < 0 || timeoutMs >= OS_UINT_MAX) {
|
||||||
|
return EINVAL;
|
||||||
}
|
}
|
||||||
timeout = (timeoutNs + (OS_SYS_NS_PER_MSECOND - 1)) / OS_SYS_NS_PER_MSECOND;
|
|
||||||
ret = LOS_MuxPend(mutex->handle, timeout);
|
ret = LOS_MuxPend(mutex->handle, (UINT32)timeoutMs);
|
||||||
return MapError(ret);
|
return MapError(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "los_swtmr.h"
|
#include "los_swtmr.h"
|
||||||
#include "los_tick.h"
|
#include "los_tick.h"
|
||||||
#include "los_context.h"
|
#include "los_context.h"
|
||||||
|
#include "los_interrupt.h"
|
||||||
|
|
||||||
/* accumulative time delta from discontinuous modify */
|
/* accumulative time delta from discontinuous modify */
|
||||||
STATIC struct timespec g_accDeltaFromSet;
|
STATIC struct timespec g_accDeltaFromSet;
|
||||||
|
@ -249,8 +250,8 @@ STATIC VOID OsGetHwTime(struct timespec *hwTime)
|
||||||
UINT64 nowNsec = (cycle / OS_SYS_CLOCK) * OS_SYS_NS_PER_SECOND +
|
UINT64 nowNsec = (cycle / OS_SYS_CLOCK) * OS_SYS_NS_PER_SECOND +
|
||||||
(cycle % OS_SYS_CLOCK) * OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK;
|
(cycle % OS_SYS_CLOCK) * OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK;
|
||||||
|
|
||||||
hwTime->tv_sec = nowNsec / OS_SYS_NS_PER_SECOND;
|
hwTime->tv_sec = (time_t)(nowNsec / OS_SYS_NS_PER_SECOND);
|
||||||
hwTime->tv_nsec = nowNsec % OS_SYS_NS_PER_SECOND;
|
hwTime->tv_nsec = (long)(nowNsec % OS_SYS_NS_PER_SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC VOID OsGetRealTime(struct timespec *realTime)
|
STATIC VOID OsGetRealTime(struct timespec *realTime)
|
||||||
|
@ -353,7 +354,7 @@ int clock_getres(clockid_t clockID, struct timespec *tp)
|
||||||
case CLOCK_REALTIME:
|
case CLOCK_REALTIME:
|
||||||
case CLOCK_MONOTONIC_COARSE:
|
case CLOCK_MONOTONIC_COARSE:
|
||||||
case CLOCK_REALTIME_COARSE:
|
case CLOCK_REALTIME_COARSE:
|
||||||
tp->tv_nsec = OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK;
|
tp->tv_nsec = (long)(OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK);
|
||||||
tp->tv_sec = 0;
|
tp->tv_sec = 0;
|
||||||
return 0;
|
return 0;
|
||||||
case CLOCK_THREAD_CPUTIME_ID:
|
case CLOCK_THREAD_CPUTIME_ID:
|
||||||
|
@ -659,5 +660,5 @@ unsigned sleep(unsigned seconds)
|
||||||
|
|
||||||
specTime.tv_sec = (time_t)(nanoseconds / OS_SYS_NS_PER_SECOND);
|
specTime.tv_sec = (time_t)(nanoseconds / OS_SYS_NS_PER_SECOND);
|
||||||
specTime.tv_nsec = (long)(nanoseconds % OS_SYS_NS_PER_SECOND);
|
specTime.tv_nsec = (long)(nanoseconds % OS_SYS_NS_PER_SECOND);
|
||||||
return nanosleep(&specTime, NULL);
|
return (unsigned)nanosleep(&specTime, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
import("../config.gni")
|
||||||
|
|
||||||
static_library("kernel") {
|
static_library("kernel") {
|
||||||
sources = [
|
sources = [
|
||||||
"src/los_event.c",
|
"src/los_event.c",
|
||||||
|
@ -61,7 +63,11 @@ static_library("kernel") {
|
||||||
} else if ("$board_cpu" == "cortex-m7") {
|
} else if ("$board_cpu" == "cortex-m7") {
|
||||||
deps = [ "arch/arm/cortex-m7/gcc/:arch" ]
|
deps = [ "arch/arm/cortex-m7/gcc/:arch" ]
|
||||||
} else if ("$board_cpu" == "cortex-m33") {
|
} else if ("$board_cpu" == "cortex-m33") {
|
||||||
deps = [ "arch/arm/cortex-m33/gcc/:arch" ]
|
if (enable_ohos_kernel_liteos_m_tz == true) {
|
||||||
|
deps = [ "arch/arm/cortex-m33/gcc/TZ:arch" ]
|
||||||
|
} else {
|
||||||
|
deps = [ "arch/arm/cortex-m33/gcc/NTZ:arch" ]
|
||||||
|
}
|
||||||
} else if ("$board_cpu" == "") {
|
} else if ("$board_cpu" == "") {
|
||||||
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
|
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
|
||||||
deps = [ "arch/risc-v/riscv32/gcc:arch" ]
|
deps = [ "arch/risc-v/riscv32/gcc:arch" ]
|
||||||
|
|
|
@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
|
||||||
VOID HalExcMemFault(VOID);
|
VOID HalExcMemFault(VOID);
|
||||||
VOID HalExcBusFault(VOID);
|
VOID HalExcBusFault(VOID);
|
||||||
VOID HalExcUsageFault(VOID);
|
VOID HalExcUsageFault(VOID);
|
||||||
VOID HalExcSvcCall(VOID);
|
VOID HalSVCHandler(VOID);
|
||||||
VOID HalHwiInit();
|
VOID HalHwiInit();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
.global HalExcMemFault
|
.global HalExcMemFault
|
||||||
.global HalExcBusFault
|
.global HalExcBusFault
|
||||||
.global HalExcUsageFault
|
.global HalExcUsageFault
|
||||||
.global HalExcSvcCall
|
.global HalSVCHandler
|
||||||
|
|
||||||
.extern HalExcHandleEntry
|
.extern HalExcHandleEntry
|
||||||
.extern g_uwExcTbl
|
.extern g_uwExcTbl
|
||||||
|
@ -148,9 +148,9 @@ osHFExcCommonBMU:
|
||||||
B osExcDispatch
|
B osExcDispatch
|
||||||
.fnend
|
.fnend
|
||||||
|
|
||||||
.type HalExcSvcCall, %function
|
.type HalSVCHandler, %function
|
||||||
.global HalExcSvcCall
|
.global HalSVCHandler
|
||||||
HalExcSvcCall:
|
HalSVCHandler:
|
||||||
.fnstart
|
.fnstart
|
||||||
.cantunwind
|
.cantunwind
|
||||||
TST LR, #0x4
|
TST LR, #0x4
|
||||||
|
|
|
@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
|
||||||
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
|
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
|
||||||
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
|
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
|
||||||
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
|
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
|
||||||
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
|
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
|
||||||
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
|
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
|
||||||
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
|
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,11 @@ static_library("arch") {
|
||||||
"non_secure/los_interrupt.c",
|
"non_secure/los_interrupt.c",
|
||||||
"non_secure/los_timer.c",
|
"non_secure/los_timer.c",
|
||||||
"non_secure/los_trustzone.c",
|
"non_secure/los_trustzone.c",
|
||||||
"secure/los_secure_context.c",
|
|
||||||
"secure/los_secure_context_asm.S",
|
|
||||||
"secure/los_secure_heap.c",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
include_dirs = [
|
include_dirs = [
|
||||||
|
"./non_secure",
|
||||||
|
"./secure",
|
||||||
"../../../../../../kernel/arch/include",
|
"../../../../../../kernel/arch/include",
|
||||||
"../../../../../../kernel/arch/include",
|
"../../../../../../kernel/arch/include",
|
||||||
"../../../../../../kernel/include",
|
"../../../../../../kernel/include",
|
||||||
|
|
|
@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
|
||||||
VOID HalExcMemFault(VOID);
|
VOID HalExcMemFault(VOID);
|
||||||
VOID HalExcBusFault(VOID);
|
VOID HalExcBusFault(VOID);
|
||||||
VOID HalExcUsageFault(VOID);
|
VOID HalExcUsageFault(VOID);
|
||||||
VOID HalExcSvcCall(VOID);
|
VOID HalSVCHandler(VOID);
|
||||||
VOID HalHwiInit();
|
VOID HalHwiInit();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,6 @@
|
||||||
.type HalStartFirstTask, %function
|
.type HalStartFirstTask, %function
|
||||||
.global HalStartFirstTask
|
.global HalStartFirstTask
|
||||||
HalStartFirstTask:
|
HalStartFirstTask:
|
||||||
.fnstart
|
|
||||||
.cantunwind
|
|
||||||
MOV R0, #2
|
MOV R0, #2
|
||||||
MSR CONTROL, R0
|
MSR CONTROL, R0
|
||||||
|
|
||||||
|
@ -77,7 +75,6 @@ __DisabledFPU1:
|
||||||
MSR PSP, R12
|
MSR PSP, R12
|
||||||
CPSIE I
|
CPSIE I
|
||||||
BX R3
|
BX R3
|
||||||
.fnend
|
|
||||||
|
|
||||||
.type HalIntLock, %function
|
.type HalIntLock, %function
|
||||||
.global HalIntLock
|
.global HalIntLock
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
.global HalExcMemFault
|
.global HalExcMemFault
|
||||||
.global HalExcBusFault
|
.global HalExcBusFault
|
||||||
.global HalExcUsageFault
|
.global HalExcUsageFault
|
||||||
.global HalExcSvcCall
|
|
||||||
|
|
||||||
.extern HalExcHandleEntry
|
.extern HalExcHandleEntry
|
||||||
.extern g_uwExcTbl
|
.extern g_uwExcTbl
|
||||||
|
@ -148,21 +147,6 @@ osHFExcCommonBMU:
|
||||||
B osExcDispatch
|
B osExcDispatch
|
||||||
.fnend
|
.fnend
|
||||||
|
|
||||||
.type HalExcSvcCall, %function
|
|
||||||
.global HalExcSvcCall
|
|
||||||
HalExcSvcCall:
|
|
||||||
.fnstart
|
|
||||||
.cantunwind
|
|
||||||
TST LR, #0x4
|
|
||||||
ITE EQ
|
|
||||||
MRSEQ R0, MSP
|
|
||||||
MRSNE R0, PSP
|
|
||||||
LDR R1, [R0,#24]
|
|
||||||
LDRB R0, [R1,#-2]
|
|
||||||
MOV R1, #0
|
|
||||||
B osExcDispatch
|
|
||||||
.fnend
|
|
||||||
|
|
||||||
.type HalExcBusFault, %function
|
.type HalExcBusFault, %function
|
||||||
.global HalExcBusFault
|
.global HalExcBusFault
|
||||||
HalExcBusFault:
|
HalExcBusFault:
|
||||||
|
|
|
@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
|
||||||
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
|
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
|
||||||
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
|
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
|
||||||
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
|
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
|
||||||
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
|
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
|
||||||
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
|
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
|
||||||
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
|
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "los_secure_context.h"
|
#include "los_secure_context.h"
|
||||||
#include "los_debug.h"
|
#include "los_debug.h"
|
||||||
#include "los_arch_context.h"
|
#include "los_arch_context.h"
|
||||||
|
#include "los_interrupt.h"
|
||||||
|
|
||||||
OsSecureContext *g_secureContext = NULL;
|
OsSecureContext *g_secureContext = NULL;
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ VOID LOS_SecureContextAlloc(UINT32 secureStackSize)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOS_ASSERT((__get_IPSR() == 0) && (__get_PRIMASK() == 0));
|
||||||
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
|
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
|
||||||
HalSVCSecureContextAlloc(secureStackSize);
|
HalSVCSecureContextAlloc(secureStackSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ HalSecureContextSaveAsm:
|
||||||
MOV R0, #0
|
MOV R0, #0
|
||||||
MSR PSPLIM, R0 /* No PSPLIM for the current task. */
|
MSR PSPLIM, R0 /* No PSPLIM for the current task. */
|
||||||
MSR PSP, R0 /* No secure stack for the current task. */
|
MSR PSP, R0 /* No secure stack for the current task. */
|
||||||
|
.fnend
|
||||||
|
|
||||||
__ThreadMode:
|
__ThreadMode:
|
||||||
BX LR
|
BX LR
|
||||||
.fnend
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "los_config.h"
|
#include "los_config.h"
|
||||||
#include "los_list.h"
|
#include "los_list.h"
|
||||||
|
|
||||||
STATIC UINT8 g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
|
STATIC UINT8 __attribute__((aligned(0x4)))g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
|
||||||
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};
|
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};
|
||||||
|
|
||||||
struct OsSecureHeapNode {
|
struct OsSecureHeapNode {
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "los_secure_context.h"
|
#include "los_secure_context.h"
|
||||||
#include "los_debug.h"
|
#include "los_debug.h"
|
||||||
#include "los_arch_context.h"
|
#include "los_arch_context.h"
|
||||||
|
#include "los_interrupt.h"
|
||||||
|
|
||||||
OsSecureContext *g_secureContext = NULL;
|
OsSecureContext *g_secureContext = NULL;
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ VOID LOS_SecureContextAlloc(UINT32 secureStackSize)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOS_ASSERT((__get_IPSR() == 0) && (__get_PRIMASK() == 0));
|
||||||
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
|
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
|
||||||
HalSVCSecureContextAlloc(secureStackSize);
|
HalSVCSecureContextAlloc(secureStackSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "los_config.h"
|
#include "los_config.h"
|
||||||
#include "los_list.h"
|
#include "los_list.h"
|
||||||
|
|
||||||
|
#pragma data_alignment=0x4
|
||||||
STATIC UINT8 g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
|
STATIC UINT8 g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
|
||||||
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};
|
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#define _LOS_CONTEXT_H
|
#define _LOS_CONTEXT_H
|
||||||
|
|
||||||
#include "los_compiler.h"
|
#include "los_compiler.h"
|
||||||
|
#include "los_interrupt.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
extern VOID HalHwiInit(VOID);
|
extern VOID HalHwiInit(VOID);
|
||||||
|
|
||||||
#define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL)
|
#define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL)
|
||||||
|
|
||||||
#define ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
|
#define ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -71,13 +71,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
|
||||||
HWI_PROC_FUNC handler,
|
HWI_PROC_FUNC handler,
|
||||||
HWI_ARG_T arg)
|
HWI_ARG_T arg)
|
||||||
{
|
{
|
||||||
if (hwiNum > SOC_INT_MAX){
|
if (hwiNum > SOC_INT_MAX) {
|
||||||
return OS_ERRNO_HWI_NUM_INVALID;
|
return OS_ERRNO_HWI_NUM_INVALID;
|
||||||
}
|
}
|
||||||
if (mode > ECLIC_VECTOR_INTERRUPT){
|
if (mode > ECLIC_VECTOR_INTERRUPT) {
|
||||||
return OS_ERRNO_HWI_MODE_INVALID;
|
return OS_ERRNO_HWI_MODE_INVALID;
|
||||||
}
|
}
|
||||||
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER){
|
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER) {
|
||||||
return OS_ERRNO_HWI_ARG_INVALID;
|
return OS_ERRNO_HWI_ARG_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ extern "C" {
|
||||||
extern UINT32 g_taskScheduled;
|
extern UINT32 g_taskScheduled;
|
||||||
typedef BOOL (*SchedScan)(VOID);
|
typedef BOOL (*SchedScan)(VOID);
|
||||||
|
|
||||||
|
VOID OsSchedResetSchedResponseTime(UINT64 responseTime);
|
||||||
|
|
||||||
VOID OsSchedUpdateSchedTimeBase(VOID);
|
VOID OsSchedUpdateSchedTimeBase(VOID);
|
||||||
|
|
||||||
UINT64 OsGetCurrSchedTimeCycle(VOID);
|
UINT64 OsGetCurrSchedTimeCycle(VOID);
|
||||||
|
|
|
@ -69,6 +69,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsMuxInit(VOID)
|
||||||
for (index = 0; index < LOSCFG_BASE_IPC_MUX_LIMIT; index++) {
|
for (index = 0; index < LOSCFG_BASE_IPC_MUX_LIMIT; index++) {
|
||||||
muxNode = ((LosMuxCB *)g_allMux) + index;
|
muxNode = ((LosMuxCB *)g_allMux) + index;
|
||||||
muxNode->muxID = index;
|
muxNode->muxID = index;
|
||||||
|
muxNode->owner = (LosTaskCB *)NULL;
|
||||||
muxNode->muxStat = OS_MUX_UNUSED;
|
muxNode->muxStat = OS_MUX_UNUSED;
|
||||||
LOS_ListTailInsert(&g_unusedMuxList, &muxNode->muxList);
|
LOS_ListTailInsert(&g_unusedMuxList, &muxNode->muxList);
|
||||||
}
|
}
|
||||||
|
@ -274,6 +275,11 @@ LITE_OS_SEC_TEXT UINT32 LOS_MuxPost(UINT32 muxHandle)
|
||||||
OS_RETURN_ERROR(LOS_ERRNO_MUX_INVALID);
|
OS_RETURN_ERROR(LOS_ERRNO_MUX_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OS_INT_ACTIVE) {
|
||||||
|
LOS_IntRestore(intSave);
|
||||||
|
OS_RETURN_ERROR(LOS_ERRNO_MUX_PEND_INTERR);
|
||||||
|
}
|
||||||
|
|
||||||
runningTask = (LosTaskCB *)g_losTask.runTask;
|
runningTask = (LosTaskCB *)g_losTask.runTask;
|
||||||
if ((muxPosted->muxCount == 0) || (muxPosted->owner != runningTask)) {
|
if ((muxPosted->muxCount == 0) || (muxPosted->owner != runningTask)) {
|
||||||
LOS_IntRestore(intSave);
|
LOS_IntRestore(intSave);
|
||||||
|
@ -304,6 +310,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_MuxPost(UINT32 muxHandle)
|
||||||
OsHookCall(LOS_HOOK_TYPE_MUX_POST, muxPosted);
|
OsHookCall(LOS_HOOK_TYPE_MUX_POST, muxPosted);
|
||||||
LOS_Schedule();
|
LOS_Schedule();
|
||||||
} else {
|
} else {
|
||||||
|
muxPosted->owner = NULL;
|
||||||
LOS_IntRestore(intSave);
|
LOS_IntRestore(intSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,13 @@ UINT32 OsSchedRealSleepTimeSet(VOID (*func)(UINT64))
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID OsSchedResetSchedResponseTime(UINT64 responseTime)
|
||||||
|
{
|
||||||
|
if (responseTime <= g_schedResponseTime) {
|
||||||
|
g_schedResponseTime = OS_SCHED_MAX_RESPONSE_TIME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
||||||
STATIC UINT64 g_schedTimerBase;
|
STATIC UINT64 g_schedTimerBase;
|
||||||
|
|
||||||
|
@ -497,6 +504,10 @@ BOOL OsSchedTaskSwitch(VOID)
|
||||||
} else {
|
} else {
|
||||||
endTime = OS_SCHED_MAX_RESPONSE_TIME - OS_CYCLE_PER_TICK;
|
endTime = OS_SCHED_MAX_RESPONSE_TIME - OS_CYCLE_PER_TICK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_schedResponseID == runTask->taskID) {
|
||||||
|
g_schedResponseTime = OS_SCHED_MAX_RESPONSE_TIME;
|
||||||
|
}
|
||||||
OsSchedSetNextExpireTime(newTask->startTime, newTask->taskID, endTime, TRUE);
|
OsSchedSetNextExpireTime(newTask->startTime, newTask->taskID, endTime, TRUE);
|
||||||
|
|
||||||
return isTaskSwitch;
|
return isTaskSwitch;
|
||||||
|
|
|
@ -155,6 +155,7 @@ VOID OsDeleteSortLink(SortLinkList *node, SortLinkType type)
|
||||||
|
|
||||||
intSave = LOS_IntLock();
|
intSave = LOS_IntLock();
|
||||||
if (node->responseTime != OS_SORT_LINK_INVALID_TIME) {
|
if (node->responseTime != OS_SORT_LINK_INVALID_TIME) {
|
||||||
|
OsSchedResetSchedResponseTime(node->responseTime);
|
||||||
OsDeleteNodeSortLink(sortLinkHeader, node);
|
OsDeleteNodeSortLink(sortLinkHeader, node);
|
||||||
}
|
}
|
||||||
LOS_IntRestore(intSave);
|
LOS_IntRestore(intSave);
|
||||||
|
|
|
@ -1,4 +1,32 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import("//build/lite/config/component/lite_component.gni")
|
import("//build/lite/config/component/lite_component.gni")
|
||||||
|
|
||||||
config("include") {
|
config("include") {
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
static_library("test_event") {
|
static_library("test_event") {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
static_library("test_hwi") {
|
static_library("test_hwi") {
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific prior written
|
||||||
|
* permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "osTest.h"
|
#include "osTest.h"
|
||||||
#include "it_los_hwi.h"
|
#include "it_los_hwi.h"
|
||||||
|
|
|
@ -1,3 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific prior written
|
||||||
|
* permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "osTest.h"
|
#include "osTest.h"
|
||||||
#include "it_los_hwi.h"
|
#include "it_los_hwi.h"
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
static_library("test_mem") {
|
static_library("test_mem") {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
static_library("test_mux") {
|
static_library("test_mux") {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
static_library("test_queue") {
|
static_library("test_queue") {
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific prior written
|
||||||
|
* permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "It_los_queue.h"
|
#include "It_los_queue.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define LOS_MEMBOX_MAGIC_SIZE 4
|
#define LOS_MEMBOX_MAGIC_SIZE 4
|
||||||
static UINT32 g_uwQueueID122 = 0;
|
static UINT32 g_uwQueueID122 = 0;
|
||||||
static unsigned char g_aucMailBoxPool[40 + LOS_MEMBOX_MAGIC_SIZE] = {0};
|
static unsigned char g_aucMailBoxPool[40 + LOS_MEMBOX_MAGIC_SIZE] = {0};
|
||||||
|
|
|
@ -1,8 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific prior written
|
||||||
|
* permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "It_los_queue.h"
|
#include "It_los_queue.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static VOID TaskF01(VOID)
|
static VOID TaskF01(VOID)
|
||||||
{
|
{
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
static_library("test_sem") {
|
static_library("test_sem") {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
static_library("test_swtmr") {
|
static_library("test_swtmr") {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
static_library("test_task") {
|
static_library("test_task") {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue