Compare commits

...

35 Commits

Author SHA1 Message Date
openharmony_ci e4ae10d163
!717 fix:ping命令访问野指针及内存泄漏问题修复
Merge pull request !717 from Zhaotianyu/cherry-pick-1655456538
2022-06-20 06:47:35 +00:00
arvinzzz 7bb53531de fixed d837ed3 from https://gitee.com/arvinzzz/kernel_liteos_m/pulls/716
fix: ping命令内访问野指针及内存泄漏

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
2022-06-17 09:02:18 +00:00
openharmony_ci 740afd70b6
!677 beta2分支检视问题修复
Merge pull request !677 from wangchen/0412_b2
2022-04-21 08:23:57 +00:00
wangchen 9fcf128322 fix: beta2分支检视问题修复
【背景】beta2分支检视问题修复

【修改方案】
1,对部分检视问题进行整改

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

Signed-off-by: wangchen <wangchen64@huawei.com>
https://gitee.com/openharmony/kernel_liteos_m/issues/I53TC9
2022-04-21 03:14:32 +00:00
openharmony_ci d58d8042e6
!584 主干告警清零
Merge pull request !584 from yinjiaming/OpenHarmony-2.2-Beta2
2022-02-07 11:23:28 +00:00
yinjiaming b9292feaa8 fix: 主干告警清零
【背景】
主干中存在告警需要处理

【修改方案】
在有符号数与无符号数混用的地方使用了强制类型转换

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

re #I4SPC0

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I76c13c2aa33e84208f0b890e71dc23e633479b00
2022-02-07 07:57:47 +00:00
openharmony_ci 800ca76df2
!580 告警清零
Merge pull request !580 from LeonChan/OpenHarmony-2.2-Beta2
2022-01-30 04:22:56 +00:00
yinjiaming 0846a8a1db fix: 主干告警清零
【背景】
主干告警清零

【修改方案】
在有符号数与无符号数混用的地方添加了强制类型转换

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

re #I4SBQE

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I70b4613726706ff28bd852f05a411ba729cea72c
2022-01-27 03:53:02 +00:00
openharmony_ci a0b126246e !475 挑单 同步pthread_cond修改到 2.2分支
Merge pull request !475 from wangchen/cond
2021-12-20 10:40:42 +00:00
wangchen a598b64da0 fix: pthread_cond_timedwait接口入参不规范
【背景】pthread_cond_timedwait函数的入参时间应该是绝对时间

【修改方案】
1,修改为相对时间
2,每次等待事件前清理

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

re #I4NB5C
Signed-off-by: wangchen <253227059@qq.com>
2021-12-20 08:26:58 +00:00
openharmony_ci 2a73894de0 !382 修复 codex告警。
Merge pull request !382 from pef/oh2.2-beta2
2021-11-08 01:27:27 +00:00
pef 923c05cd89 修复codex告警。
【背景】
1.components\fs\fs.c,g_fs判空顺序错误
2.components\shell\src\cmds\task_shellcmd.c,参数多余
3.components\shell\src\cmds\vfs_shellcmd.c,遗漏内存释放
4.kal\posix\src\pthread_mutex.c,timeout计算可能溢出

【修改方案】
1.调换g_fs判空顺序
2.去掉多余的参数
3.return前添加free函数
4.修改timeout计算方法防止溢出

【影响】
无

Change-Id: Ib6d56c92a0be01ca49222148c341db18afe72544
Signed-off-by: pef <cyd1997@126.com>
2021-11-06 08:02:41 +00:00
openharmony_ci a55fd7c6d1 !284 M核编译配置修改同步
Merge pull request !284 from wangchen/gn_beta2
2021-08-24 07:05:51 +00:00
wangchen df4557ff41 fix: 完善M核编译配置选项同步
【背景】同步主线修改

【修改方案】
1,同步主线修改

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

re #I46Y1G
Signed-off-by: wangchen <253227059@qq.com>
2021-08-24 10:54:08 +08:00
openharmony_ci 73723d73ac !280 M33平台GCC环境下TZ增加默认选项适配(同步master修改至beta2)
Merge pull request !280 from wangchen/tz_beta2
2021-08-23 06:17:06 +00:00
wangchen 6b8290e37c 【背景】M33平台GCC环境下TZ默认开启TZ。
【修改方案】
1,在M33平台下增加默认选项及开关
2,删除build.gn编译tz的部分,该部分由使用者编译在安全态
3,修改tz初始化的一个问题

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

re #I46R1C
Signed-off-by: wangchen <253227059@qq.com>
2021-08-23 10:44:30 +08:00
openharmony_ci a4bea97b8b !276 fix: 删除延时节点后,存在时间无法有效刷新的场景
Merge pull request !276 from zhushengle/OpenHarmony-2.2-Beta2
2021-08-23 02:14:39 +00:00
openharmony_ci d89faf63a2 !274 解决中断操作等接口头文件位置变更,引入的编译问题
Merge pull request !274 from JerryH/cherry-pick-1629421054
2021-08-20 06:37:50 +00:00
zhushengle b035f5bf7c fix: 删除延时节点后,存在时间无法有效刷新的场景
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I0ce80252db6fd6ff8621ee87df0a7ecb12a1843f
2021-08-20 09:12:11 +08:00
JerryH b0d7e9fc04 fixed 013a953 from https://gitee.com/JerryH1011/kernel_liteos_m/pulls/270
fix: 修复中断操作接口头文件位置变更,导致的编译错误

close #I4665Z

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I5596179dea198dfe571420a7640abb00587abee1
2021-08-20 00:57:34 +00:00
openharmony_ci e21e3d5d1f !262 宏LOSCFG_SUPPORT_FATFS在fs.c中存在使用问题,导致无fatfs的情况下,编译出错
Merge pull request !262 from zhangfanfan2/cherry-pick-1628674821
2021-08-12 02:00:14 +00:00
zhangfanfan2 124dd73f79 fixed c1614ce from https://gitee.com/zhangfanfan2/kernel_liteos_m/pulls/261
fix: 宏LOSCFG_SUPPORT_FATFS在fs.c中存在使用问题,导致无fatfs的情况下,编译出错

代码中使用#ifdef LOSCFG_SUPPORT_FATFS控制业务逻辑,但LOSCFG_SUPPORT_FATFS的
默认定义为:#define LOSCFG_SUPPORT_FATFS 0,这样#ifdef LOSCFG_SUPPORT_FATFS控制
的逻辑一定会被编译。修改方式:使用的地方统一为#if的形式

close: #I44XNR

Signed-off-by: zff <zhangfanfan2@huawei.com>
2021-08-11 09:40:22 +00:00
openharmony_ci fef2e372ff !255 新增OAT配置文件,用作oat扫描
Merge pull request !255 from SimonLi/cherry-pick-1628506091
2021-08-09 10:58:34 +00:00
openharmony_ci d46d13e655 !255 新增OAT配置文件,用作oat扫描
Merge pull request !255 from SimonLi/cherry-pick-1628506091
2021-08-09 10:58:34 +00:00
SimonLi 90d798ae8a fixed f644571 from https://gitee.com/kkup180/kernel_liteos_m/pulls/252
chore(oat): 新增OAT配置文件,用作oat扫描

Signed-off-by: SimonLi <likailong@huawei.com>
2021-08-09 10:48:12 +00:00
openharmony_ci 1ee52d1e1f !254 license修复挑单到2.2beta2
Merge pull request !254 from lnlan/tobeta2.2_0809
2021-08-09 08:49:31 +00:00
openharmony_ci 724e7fa786 !254 license修复挑单到2.2beta2
Merge pull request !254 from lnlan/tobeta2.2_0809
2021-08-09 08:49:30 +00:00
lnlan 078adec486 style:修改 liteos_a unittest 测试文件的 licence 注释
【背景】解除告警
【修改方案】
 格式化修改告警文件的文件头注释格式

re #I44497

Signed-off-by: lanleinan <lanleinan@163.com>
Change-Id: Id2d61deb9d9a14d5e29b915c3a64c75e11e12eda
2021-08-09 08:20:47 +00:00
openharmony_ci d0e0bb5934 !248 同步master到beta2.2
Merge pull request !248 from lnlan/to_beta2.2
2021-08-04 08:53:22 +00:00
silen 9e8ae74620 fix: timer qemu 头文件缺失
Change-Id: I763ee6f0d013d84f36da9a7cb6d369f3d02e6c45
Signed-off-by: silen <wuyunjie@huawei.com>
2021-08-04 07:59:33 +00:00
wangchen 0d5a1ce9be fix: M核代码告警清零
【背景】定期M核代码告警清零。

【修改方案】
根据工具扫描结果,对代码告警进行更改。

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

re #I4386N
Signed-off-by: wangchen <253227059@qq.com>
2021-08-04 07:59:25 +00:00
silen 2a7b31018f fix: open shell & fix qemu compile
Change-Id: Ia7488c02db7a41e0f681d008882b7c2721e6b207
Signed-off-by: silen <wuyunjie@huawei.com>
2021-08-04 07:59:17 +00:00
wangchen 54db6c8e7e fix: trustzone 中断适配
【背景】当前无法使用 trustzone。

【修改方案】
由于tz需要使用svc中断,因此删除之前使用的HalExcSvcCall的地方,改为HalSVCHandler

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

re #I42TFV
Signed-off-by: wangchen <253227059@qq.com>
2021-08-04 07:59:07 +00:00
lnlan ef186b476e feat(kernel): 补充获取最高、最低优先级接口
【背景】
补充获取最高、最低优先级接口
【修改方案】
pthread补充这两个接口
int sched_get_priority_min(int policy)
int sched_get_priority_max(int policy)
【影响】
对现有的产品编译不会有影响。

re #I42HM7

Signed-off-by: lnlanc <lanleinan@163.com>
Change-Id: Id2ffc07e606ad497e8036f45dab1fa6a5ba981b3
2021-08-04 07:58:58 +00:00
silen 72cb77e14f fix: ping cmd compile fail
Change-Id: I692de82275b8da03ac51b493b2f74148c96574d0
Signed-off-by: silen <wuyunjie@huawei.com>
2021-08-04 07:58:16 +00:00
55 changed files with 714 additions and 216 deletions

86
OAT.xml Normal file
View File

@ -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 compatibilitylicense 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>

View File

@ -30,7 +30,7 @@
*/
#include "fs_operations.h"
#include "los_config.h"
#ifdef LOSCFG_SUPPORT_FATFS
#if (LOSCFG_SUPPORT_FATFS == 1)
#include "fatfs.h"
#endif
#include "dirent.h"
@ -331,7 +331,7 @@ ssize_t read(int fd, void *buf, size_t nbyte)
errno = EINVAL;
return FS_FAILURE;
}
if (nbyte > 1024) {
if (nbyte > 1024) { /* 1024, max random_size */
nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */
}
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);
}
#endif
if (g_fs->fsFops == NULL || g_fs->fsFops->Read == NULL) {
errno = ENOSYS;
return FS_FAILURE;
}
if (g_fs == NULL) {
errno = ENODEV;
return FS_FAILURE;
}
if (g_fs->fsFops == NULL || g_fs->fsFops->Read == NULL) {
errno = ENOSYS;
return FS_FAILURE;
}
return g_fs->fsFops->Read(fd, buf, nbyte);
}

View File

@ -40,29 +40,29 @@ FileDirInfo g_lfsDir[LFS_MAX_OPEN_DIRS] = {0};
struct FileOpInfo g_fsOp[LOSCFG_LFS_MAX_MOUNT_SIZE] = {0};
static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0};
struct dirent g_nameValue;
static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER;
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a","/b","/c"};
static pthread_mutex_t g_fsLocalMutex = PTHREAD_MUTEX_INITIALIZER;
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a", "/b", "/c"};
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++) {
if (g_handle[i].useFlag == 0) {
*fd = i;
g_handle[i].useFlag = 1;
g_handle[i].pathName = strdup(fileName);
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return &(g_handle[i]);
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
*fd = INVALID_FD;
return NULL;
}
static void LfsFreeFd(int fd)
{
pthread_mutex_lock(&g_FslocalMutex);
pthread_mutex_lock(&g_fsLocalMutex);
g_handle[fd].useFlag = 0;
if (g_handle[fd].pathName != NULL) {
free((void *)g_handle[fd].pathName);
@ -72,21 +72,21 @@ static void LfsFreeFd(int fd)
if (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)
{
pthread_mutex_lock(&g_FslocalMutex);
pthread_mutex_lock(&g_fsLocalMutex);
for (int i = 0; i < LITTLE_FS_MAX_OPEN_FILES; i++) {
if (g_handle[i].useFlag == 1) {
if (strcmp(g_handle[i].pathName, fileName) == 0) {
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return TRUE;
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return FALSE;
}
@ -103,22 +103,22 @@ static BOOL LfsFdIsValid(int fd)
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++) {
if (g_lfsDir[i].useFlag == 0) {
g_lfsDir[i].useFlag = 1;
g_lfsDir[i].dirName = strdup(dirName);
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return &(g_lfsDir[i]);
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return NULL;
}
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++) {
if (g_lfsDir[i].useFlag == 1 && strcmp(g_lfsDir[i].dirName, dirName) == 0) {
g_lfsDir[i].useFlag = 0;
@ -126,24 +126,23 @@ void FreeDirInfo(const char *dirName)
free(g_lfsDir[i].dirName);
g_lfsDir[i].dirName = NULL;
}
pthread_mutex_unlock(&g_FslocalMutex);
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
}
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++) {
if (g_lfsDir[i].useFlag == 1) {
if (strcmp(g_lfsDir[i].dirName, dirName) == 0) {
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return TRUE;
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return FALSE;
}
@ -165,35 +164,35 @@ BOOL CheckPathIsMounted(const char *pathName, struct FileOpInfo **fileOpInfo)
char tmpName[LITTLEFS_MAX_LFN_LEN] = {0};
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++) {
if (g_fsOp[i].useFlag == 1) {
(void)strncpy_s(tmpName, LITTLEFS_MAX_LFN_LEN, pathName, len);
if (strcmp(tmpName, g_fsOp[i].dirName) == 0) {
*fileOpInfo = &(g_fsOp[i]);
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return TRUE;
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return FALSE;
}
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++) {
if (g_fsOp[i].useFlag == 0 && strcmp(target, g_littlefsMntName[i]) == 0) {
g_fsOp[i].useFlag = 1;
g_fsOp[i].fsVops = fileOps;
g_fsOp[i].dirName = strdup(target);
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return &(g_fsOp[i]);
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return NULL;
}
@ -203,26 +202,26 @@ int SetDefaultMountPath(int pathNameIndex, const char* target)
return VFS_ERROR;
}
pthread_mutex_lock(&g_FslocalMutex);
pthread_mutex_lock(&g_fsLocalMutex);
g_littlefsMntName[pathNameIndex] = strdup(target);
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return VFS_OK;
}
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++) {
if (g_fsOp[i].useFlag == 1) {
if (g_fsOp[i].dirName && strcmp(target, g_fsOp[i].dirName) == 0) {
*mountIndex = i;
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return &(g_fsOp[i]);
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return NULL;
}
@ -232,33 +231,33 @@ int FreeMountResByIndex(int mountIndex)
return VFS_ERROR;
}
pthread_mutex_lock(&g_FslocalMutex);
pthread_mutex_lock(&g_fsLocalMutex);
if (g_fsOp[mountIndex].useFlag == 1 && g_fsOp[mountIndex].dirName != NULL) {
g_fsOp[mountIndex].useFlag = 0;
free(g_fsOp[mountIndex].dirName);
g_fsOp[mountIndex].dirName = NULL;
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return VFS_OK;
}
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++) {
if (g_fsOp[i].useFlag == 1) {
if (g_fsOp[i].dirName && strcmp(target, g_fsOp[i].dirName) == 0) {
g_fsOp[i].useFlag = 0;
free(g_fsOp[i].dirName);
g_fsOp[i].dirName = NULL;
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return VFS_OK;
}
}
}
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return VFS_ERROR;
}
@ -529,7 +528,7 @@ struct dirent *LfsReaddir(DIR *dir)
ret = lfs_dir_read(dirInfo->lfsHandle, (lfs_dir_t *)(&(dirInfo->dir)), &lfsInfo);
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);
if (lfsInfo.type == LFS_TYPE_DIR) {
g_nameValue.d_type = DT_DIR;
@ -538,7 +537,7 @@ struct dirent *LfsReaddir(DIR *dir)
}
g_nameValue.d_reclen = lfsInfo.size;
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
return &g_nameValue;
}
@ -686,9 +685,9 @@ int LfsClose(int fd)
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));
pthread_mutex_unlock(&g_FslocalMutex);
pthread_mutex_unlock(&g_fsLocalMutex);
LfsFreeFd(fd);

View File

@ -242,7 +242,7 @@ static void getifaddrs_internal(struct getifaddrs_arg *arg)
if_storage = new_ifaddrs_storage();
if (if_storage == NULL) {
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;
goto RETURN;
}

View File

@ -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

View File

@ -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
@ -47,11 +53,9 @@
#include "lwip/icmp.h"
#include "los_config.h"
#include <string.h>
#include "lwip/api_shell.h"
#include "shcmd.h"
#include "shell.h"
#include "los_timer_pri.h"
#include "los_debug.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) {
goto out;
}
if(netif->link_layer_type == LOOPBACK_IF){
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s\t", netif->name);
if (netif->link_layer_type == LOOPBACK_IF) {
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s\t", netif->name);
} 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))
@ -317,8 +321,7 @@ static int ping_kill = 0;
static void lwip_ping_usage(void)
{
PRINTK("Usage:"\
"\n ping [ip]\n"
PRINTK("Usage:\n ping [ip]\n");
}
LWIP_STATIC int OsPingFunc(u32_t *parg)
@ -332,11 +335,11 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
u32_t iecho_len;
s16_t ip_hlen;
u32_t forever;
u32_t i = 0;
u32_t i;
u32_t succ_cnt = 0;
u32_t failed_cnt = 0;
struct timespec start, end;
long timout_ms = 0;
long timout_ms;
struct pollfd pfd;
long rtt;
int ret = 0;
@ -597,7 +600,6 @@ u32_t OsShellPing(int argc, const char **argv)
stPingTask.uwArg = (UINTPTR)parg;
ret = LOS_TaskCreate((UINT32 *)(&ping_taskid), &stPingTask);
if (ret != LOS_OK) {
free(parg);
PRINTK("ping_task create failed 0x%08x.\n", ret);
count = LWIP_SHELL_CMD_PING_RETRY_TIMES;
} else {
@ -613,6 +615,8 @@ u32_t OsShellPing(int argc, const char **argv)
PRINTK("Ping cmd failed due some errors\n");
}
free(parg);
return LOS_OK;
ping_error:
lwip_ping_usage();

View File

@ -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.uwStackSize = stackSize;
task.pcName = (char *)name;
task.usTaskPrio = prio;
task.usTaskPrio = (UINT16)prio;
task.uwArg = (UINTPTR)arg;
task.uwResved = LOS_TASK_STATUS_DETACHED;
ret = LOS_TaskCreate(&taskID, &task);

View File

@ -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);
&cmdItem->list != &(cmdInfo.cmdList.list);) {
&cmdItem->list != &(cmdInfo.cmdList.list); ) {
cmdNext = LOS_DL_LIST_ENTRY(cmdItem->list.pstPrev, CmdItemNode, list);
if (&cmdNext->list != &(cmdInfo.cmdList.list)) {
if ((strncmp(cmdItem->cmd->cmdKey, cmd->cmd->cmdKey, strlen(cmd->cmd->cmdKey)) >= 0) &&

View File

@ -64,7 +64,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
{
unsigned int loop;
const char *tmpStr = NULL;
bool quotes = FALSE;
BOOL quotes = FALSE;
char *cmdName = NULL;
if (cmdline == NULL) {
return NULL;
@ -78,7 +78,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
/* Scan the 'cmdline' string for command */
/* 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 (*tmpStr == '\"') {
SWITCH_QUOTES_STATUS(quotes);
@ -114,12 +114,10 @@ int ShellCmdExec(const char *msgName, const char *cmdString)
}
uintRet = ShellMsgTypeGet(&cmdParsed, msgName);
if (uintRet != LOS_OK) {
PRINTK("%s:command not found\n", msgName);
return -EFAULT;
} else {
(void)OsCmdExec(&cmdParsed, (char *)cmdString);
}
return 0;

View File

@ -88,11 +88,11 @@ static char *StrNormalizePath(char *fullpath)
while (*src != '\0') {
if (*src == '.') {
if (*(src + 1) == '/') {
src += 2;
src += 2; /* 2, sizeof "./" */
continue;
} else if (*(src + 1) == '.') {
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) {
src += 2;
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) { /* 2, 2, offset to check */
src += 2; /* 2, sizeof offset */
} else {
while ((*src != '\0') && (*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 */
if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) {
filename += 2;
filename += 2; /* 2, sizeof "./" */
}
fullpath = (char *)malloc(strlen(directory) + namelen + 2);
@ -184,8 +184,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
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,
"%s/%s", directory, filename);
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 */
fullpath = strdup(filename); /* copy string */
if (fullpath == NULL) {
*pathname = NULL;
SetErrno(ENOMEM);
@ -246,8 +244,7 @@ int VfsNormalizePath(const char *directory, const char *filename, char **pathnam
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)) {
return -ENAMETOOLONG;
}

View File

@ -89,7 +89,6 @@ LITE_OS_SEC_TEXT_MINOR STATIC VOID OsShellCmdTskInfoData(const LosTaskCB *allTas
{
const LosTaskCB *taskCB = NULL;
UINT32 loop;
UINT32 semId;
for (loop = 0; loop < g_taskMaxNum; ++loop) {
taskCB = allTaskArray + loop;
@ -97,12 +96,10 @@ LITE_OS_SEC_TEXT_MINOR STATIC VOID OsShellCmdTskInfoData(const LosTaskCB *allTas
continue;
}
semId = OsGetSemID(taskCB);
PRINTK("%-23s%-20p0x%-5x", taskCB->taskName, taskCB->taskEntry, taskCB->taskID);
PRINTK("%-11u%-13s0x%-11x 0x%-8x 0x%-10x ", taskCB->priority,
OsShellCmdConvertTskStatus(taskCB->taskStatus), taskCB->stackSize,
taskCB->stackPointer, taskCB->topOfStack, semId);
taskCB->stackPointer, taskCB->topOfStack);
PRINTK("\n");
}
}

View File

@ -259,7 +259,7 @@ int OsShellCmdCat(int argc, const char **argv)
char *fullpath = NULL;
int ret;
CHAR buf[CAT_BUF_SIZE];
size_t size;
ssize_t size;
char *shellWorkingDirectory = OsShellGetWorkingDirtectory();
@ -276,13 +276,14 @@ int OsShellCmdCat(int argc, const char **argv)
if (fd == -1) {
ret = -1;
free(fullpath);
return ret;
}
do {
(void)memset_s(buf, sizeof(buf), 0, CAT_BUF_SIZE);
size = read(fd, buf, CAT_BUF_SIZE - 1);
if ((int)size < 0) {
if (size < 0) {
free(fullpath);
close(fd);
return -1;
@ -384,7 +385,7 @@ static int OsShellCmdDoCp(const char *srcFilePath, const char *dstFileName)
char *dstFilePath = NULL;
char *buf = NULL;
const char *filename = NULL;
size_t rdSize, wrSize;
ssize_t rdSize, wrSize;
int srcFd = -1;
int dstFd = -1;
struct stat statBuf;

3
config.gni Normal file → Executable file
View File

@ -33,10 +33,11 @@ declare_args() {
enable_ohos_kernel_liteos_m_exchook = true
enable_ohos_kernel_liteos_m_kal = 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_test = false
enable_ohos_kernel_liteos_m_pm = true
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"
}

View File

@ -50,10 +50,10 @@ extern "C" {
* @version 1.0
*/
typedef enum {
/** The timer is not allowed to wake up the RTOS. */
osTimerRousesIgnore = 0,
/** The timer is allowed to wake up the RTOS. */
osTimerRousesAllow = 1
/** The timer is not allowed to wake up the RTOS. */
osTimerRousesIgnore = 0,
/** The timer is allowed to wake up the RTOS. */
osTimerRousesAllow = 1
} osTimerRouses_t;
/**
@ -61,10 +61,10 @@ typedef enum {
*
*/
typedef enum {
/** The timer ignores alignment. */
osTimerAlignIgnore = 0,
/** The timer allows alignment. */
osTimerAlignAllow = 1
/** The timer ignores alignment. */
osTimerAlignIgnore = 0,
/** The timer allows alignment. */
osTimerAlignAllow = 1
} osTimerAlign_t;
osTimerId_t osTimerExtNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr,

View File

@ -384,7 +384,7 @@ int OsMqGetAttr(mqd_t personal, struct mq_attr *mqAttr)
mqueueCB = privateMqPersonal->mq_posixdes;
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_flags = privateMqPersonal->mq_flags;
(VOID)pthread_mutex_unlock(&g_mqueueMutex);

View File

@ -144,7 +144,7 @@ int pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *par
}
*policy = SCHED_RR;
param->sched_priority = prio;
param->sched_priority = (int)prio;
return 0;
}
@ -205,6 +205,7 @@ void pthread_exit(void *retVal)
int pthread_setname_np(pthread_t thread, const char *name)
{
errno_t ret;
char *taskName = LOS_TaskNameGet((UINT32)thread);
if (taskName == NULL || !IsPthread(thread)) {
return EINVAL;
@ -212,13 +213,16 @@ int pthread_setname_np(pthread_t thread, const char *name)
if (strnlen(name, PTHREAD_NAMELEN) >= PTHREAD_NAMELEN) {
return ERANGE;
}
(void)strcpy_s(taskName, PTHREAD_NAMELEN, name);
ret = strcpy_s(taskName, PTHREAD_NAMELEN, name);
if (ret != EOK) {
return ret;
}
return 0;
}
int pthread_getname_np(pthread_t thread, char *buf, size_t buflen)
{
int ret;
errno_t ret;
const char *name = LOS_TaskNameGet((UINT32)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)) {
ret = strcpy_s(buf, buflen, name);
if (ret == 0) {
if (ret == EOK) {
return 0;
}
}

View File

@ -231,3 +231,23 @@ int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stackSize)
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;
}

View File

@ -202,18 +202,22 @@ STATIC INT32 ProcessReturnVal(pthread_cond_t *cond, INT32 val)
}
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec *absTime)
const struct timespec *ts)
{
UINT32 absTicks;
INT32 ret;
UINT64 absTicks;
const UINT32 nsPerTick = OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND;
struct timespec tp;
UINT64 nseconds;
UINT64 currTime;
if ((cond == NULL) || (mutex == NULL) || (absTime == NULL)) {
if ((cond == NULL) || (mutex == NULL) || (ts == NULL)) {
return EINVAL;
}
if (CondInitCheck(cond)) {
ret = pthread_cond_init(cond, NULL);
if (ret != ENOERR) {
if (ret != 0) {
return ret;
}
}
@ -222,22 +226,30 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
cond->count++;
(VOID)pthread_mutex_unlock(cond->mutex);
if ((absTime->tv_sec == 0) && (absTime->tv_nsec == 0)) {
return ETIMEDOUT;
}
if (!ValidTimeSpec(absTime)) {
if (!ValidTimeSpec(ts)) {
return EINVAL;
}
absTicks = OsTimeSpec2Tick(absTime);
if (pthread_mutex_unlock(mutex) != ENOERR) {
clock_gettime(CLOCK_REALTIME, &tp);
currTime = (UINT64)tp.tv_sec * OS_SYS_NS_PER_SECOND + (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__);
}
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__);
}

View File

@ -38,6 +38,7 @@
#define OS_SYS_NS_PER_MSECOND 1000000
#define OS_SYS_NS_PER_SECOND 1000000000
#define OS_UINT_MAX (~0U)
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)
{
UINT32 ret;
UINT32 timeout;
UINT64 timeoutNs;
INT64 timeoutMs;
struct timespec curTime = {0};
if ((mutex->magic != _MUX_MAGIC) || (absTimeout->tv_nsec < 0) || (absTimeout->tv_nsec >= OS_SYS_NS_PER_SECOND)) {
return EINVAL;
@ -115,12 +115,13 @@ int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *absTi
if (ret != LOS_OK) {
return EINVAL;
}
timeoutNs = (absTimeout->tv_sec - curTime.tv_sec) * OS_SYS_NS_PER_SECOND + (absTimeout->tv_nsec - curTime.tv_nsec);
if (timeoutNs <= 0) {
return ETIMEDOUT;
timeoutMs = (absTimeout->tv_sec - curTime.tv_sec) * OS_SYS_MS_PER_SECOND +
(absTimeout->tv_nsec - curTime.tv_nsec) / OS_SYS_NS_PER_MSECOND;
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);
}

View File

@ -42,6 +42,7 @@
#include "los_swtmr.h"
#include "los_tick.h"
#include "los_context.h"
#include "los_interrupt.h"
/* accumulative time delta from discontinuous modify */
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 +
(cycle % OS_SYS_CLOCK) * OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK;
hwTime->tv_sec = nowNsec / OS_SYS_NS_PER_SECOND;
hwTime->tv_nsec = nowNsec % OS_SYS_NS_PER_SECOND;
hwTime->tv_sec = (time_t)(nowNsec / OS_SYS_NS_PER_SECOND);
hwTime->tv_nsec = (long)(nowNsec % OS_SYS_NS_PER_SECOND);
}
STATIC VOID OsGetRealTime(struct timespec *realTime)
@ -353,7 +354,7 @@ int clock_getres(clockid_t clockID, struct timespec *tp)
case CLOCK_REALTIME:
case CLOCK_MONOTONIC_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;
return 0;
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_nsec = (long)(nanoseconds % OS_SYS_NS_PER_SECOND);
return nanosleep(&specTime, NULL);
return (unsigned)nanosleep(&specTime, NULL);
}

View File

@ -27,6 +27,8 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("../config.gni")
static_library("kernel") {
sources = [
"src/los_event.c",
@ -61,7 +63,11 @@ static_library("kernel") {
} else if ("$board_cpu" == "cortex-m7") {
deps = [ "arch/arm/cortex-m7/gcc/:arch" ]
} 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" == "") {
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
deps = [ "arch/risc-v/riscv32/gcc:arch" ]

View File

@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit();

View File

@ -41,7 +41,7 @@
.global HalExcMemFault
.global HalExcBusFault
.global HalExcUsageFault
.global HalExcSvcCall
.global HalSVCHandler
.extern HalExcHandleEntry
.extern g_uwExcTbl
@ -148,9 +148,9 @@ osHFExcCommonBMU:
B osExcDispatch
.fnend
.type HalExcSvcCall, %function
.global HalExcSvcCall
HalExcSvcCall:
.type HalSVCHandler, %function
.global HalSVCHandler
HalSVCHandler:
.fnstart
.cantunwind
TST LR, #0x4

View File

@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
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[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;

View File

@ -35,12 +35,11 @@ static_library("arch") {
"non_secure/los_interrupt.c",
"non_secure/los_timer.c",
"non_secure/los_trustzone.c",
"secure/los_secure_context.c",
"secure/los_secure_context_asm.S",
"secure/los_secure_heap.c",
]
include_dirs = [
"./non_secure",
"./secure",
"../../../../../../kernel/arch/include",
"../../../../../../kernel/arch/include",
"../../../../../../kernel/include",

View File

@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit();

View File

@ -48,8 +48,6 @@
.type HalStartFirstTask, %function
.global HalStartFirstTask
HalStartFirstTask:
.fnstart
.cantunwind
MOV R0, #2
MSR CONTROL, R0
@ -77,7 +75,6 @@ __DisabledFPU1:
MSR PSP, R12
CPSIE I
BX R3
.fnend
.type HalIntLock, %function
.global HalIntLock

View File

@ -41,7 +41,6 @@
.global HalExcMemFault
.global HalExcBusFault
.global HalExcUsageFault
.global HalExcSvcCall
.extern HalExcHandleEntry
.extern g_uwExcTbl
@ -148,21 +147,6 @@ osHFExcCommonBMU:
B osExcDispatch
.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
.global HalExcBusFault
HalExcBusFault:

View File

@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
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[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;

View File

@ -34,6 +34,7 @@
#include "los_secure_context.h"
#include "los_debug.h"
#include "los_arch_context.h"
#include "los_interrupt.h"
OsSecureContext *g_secureContext = NULL;
@ -69,6 +70,7 @@ VOID LOS_SecureContextAlloc(UINT32 secureStackSize)
return;
}
LOS_ASSERT((__get_IPSR() == 0) && (__get_PRIMASK() == 0));
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
HalSVCSecureContextAlloc(secureStackSize);
}

View File

@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
#endif /* __cplusplus */
#endif

View File

@ -94,7 +94,7 @@ HalSecureContextSaveAsm:
MOV R0, #0
MSR PSPLIM, R0 /* No PSPLIM for the current task. */
MSR PSP, R0 /* No secure stack for the current task. */
.fnend
__ThreadMode:
BX LR
.fnend

View File

@ -34,7 +34,7 @@
#include "los_config.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};
struct OsSecureHeapNode {

View File

@ -34,6 +34,7 @@
#include "los_secure_context.h"
#include "los_debug.h"
#include "los_arch_context.h"
#include "los_interrupt.h"
OsSecureContext *g_secureContext = NULL;
@ -69,6 +70,7 @@ VOID LOS_SecureContextAlloc(UINT32 secureStackSize)
return;
}
LOS_ASSERT((__get_IPSR() == 0) && (__get_PRIMASK() == 0));
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
HalSVCSecureContextAlloc(secureStackSize);
}

View File

@ -34,6 +34,7 @@
#include "los_config.h"
#include "los_list.h"
#pragma data_alignment=0x4
STATIC UINT8 g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};

View File

@ -38,6 +38,7 @@
#define _LOS_CONTEXT_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@ -29,7 +29,6 @@
extern VOID HalHwiInit(VOID);
#define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL)
#define ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
#ifdef __cplusplus

View File

@ -71,13 +71,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
if (hwiNum > SOC_INT_MAX){
if (hwiNum > SOC_INT_MAX) {
return OS_ERRNO_HWI_NUM_INVALID;
}
if (mode > ECLIC_VECTOR_INTERRUPT){
if (mode > ECLIC_VECTOR_INTERRUPT) {
return OS_ERRNO_HWI_MODE_INVALID;
}
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER){
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER) {
return OS_ERRNO_HWI_ARG_INVALID;
}

View File

@ -47,6 +47,8 @@ extern "C" {
extern UINT32 g_taskScheduled;
typedef BOOL (*SchedScan)(VOID);
VOID OsSchedResetSchedResponseTime(UINT64 responseTime);
VOID OsSchedUpdateSchedTimeBase(VOID);
UINT64 OsGetCurrSchedTimeCycle(VOID);

View File

@ -69,6 +69,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsMuxInit(VOID)
for (index = 0; index < LOSCFG_BASE_IPC_MUX_LIMIT; index++) {
muxNode = ((LosMuxCB *)g_allMux) + index;
muxNode->muxID = index;
muxNode->owner = (LosTaskCB *)NULL;
muxNode->muxStat = OS_MUX_UNUSED;
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);
}
if (OS_INT_ACTIVE) {
LOS_IntRestore(intSave);
OS_RETURN_ERROR(LOS_ERRNO_MUX_PEND_INTERR);
}
runningTask = (LosTaskCB *)g_losTask.runTask;
if ((muxPosted->muxCount == 0) || (muxPosted->owner != runningTask)) {
LOS_IntRestore(intSave);
@ -304,6 +310,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_MuxPost(UINT32 muxHandle)
OsHookCall(LOS_HOOK_TYPE_MUX_POST, muxPosted);
LOS_Schedule();
} else {
muxPosted->owner = NULL;
LOS_IntRestore(intSave);
}

View File

@ -69,6 +69,13 @@ UINT32 OsSchedRealSleepTimeSet(VOID (*func)(UINT64))
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)
STATIC UINT64 g_schedTimerBase;
@ -497,6 +504,10 @@ BOOL OsSchedTaskSwitch(VOID)
} else {
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);
return isTaskSwitch;

View File

@ -155,6 +155,7 @@ VOID OsDeleteSortLink(SortLinkList *node, SortLinkType type)
intSave = LOS_IntLock();
if (node->responseTime != OS_SORT_LINK_INVALID_TIME) {
OsSchedResetSchedResponseTime(node->responseTime);
OsDeleteNodeSortLink(sortLinkHeader, node);
}
LOS_IntRestore(intSave);

View File

@ -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")
config("include") {

View File

@ -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") {

View File

@ -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") {

View File

@ -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 "it_los_hwi.h"

View File

@ -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 "it_los_hwi.h"

View File

@ -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") {

View File

@ -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") {

View File

@ -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") {

View File

@ -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"
#define LOS_MEMBOX_MAGIC_SIZE 4
static UINT32 g_uwQueueID122 = 0;
static unsigned char g_aucMailBoxPool[40 + LOS_MEMBOX_MAGIC_SIZE] = {0};

View File

@ -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"
static VOID TaskF01(VOID)
{
UINT32 ret;

View File

@ -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") {

View File

@ -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") {

View File

@ -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") {