Compare commits

...

168 Commits

Author SHA1 Message Date
openharmony_ci
11c5e52d22 !1033 Fix : 修复 LWIP_IPV6 相关的编译错误 挑单到monthly_20221018
Merge pull request !1033 from yinjiaming/cherry-pick-1677658640
2023-03-02 02:02:58 +00:00
yinjiaming
4398713789 fixed d058b64 from https://gitee.com/hgbveiu743/kernel_liteos_m/pulls/1029
fix:打开LWIP_IPV6时有编译错误
更改了出错的参与算数运算的指针的数据类型

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I6891797cd1afa801faeecf1bfb891f0ac7db7f68
2023-03-01 08:17:27 +00:00
openharmony_ci
5b1ae297be !1028 【回合monthly1018】Panic支持ExcHook
Merge pull request !1028 from zhangdengyu/cherry-pick-1677047148
2023-02-22 11:45:24 +00:00
zhangdengyu
4722d95fb9 fixed 809db71 from https://gitee.com/zhangdengyu/kernel_liteos_m/pulls/1027
feat:Panic支持ExcHook

方案描述:
1、在EXC_TYPE枚举中添加EXC_PANIC成员用于Panic支持ExcHook
2、在LOS_Panic接口执行异常处理钩子函数

BREAKING CHANGE:
无

Close: #I6GR6G

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I99d293622ff6ddbc49348c692512e5b7780460e6
2023-02-22 06:25:49 +00:00
openharmony_ci
a5dffd7cdb !1024 【回合monthly_1018】fix: pthread_create时序调整
Merge pull request !1024 from Zhaotianyu/cherry-pick-1676023301
2023-02-11 08:03:47 +00:00
arvinzzz
90c71e3e42 fixed f038492 from https://gitee.com/arvinzzz/kernel_liteos_m/pulls/1023
fix: pthread_create内部逻辑时序调整

在线程创建成功后,pthread_create内部先将函数返回值设置好,再进行TaskResume就绪调度状态

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I795c115da612123b67f34cdc57e85eac955bbc08
2023-02-10 10:01:41 +00:00
openharmony_ci
4176459693 !1014 Fix : OsLs内存问题修复挑单到monthly_20221018
Merge pull request !1014 from yinjiaming/cherry-pick-1673836500
2023-01-17 09:30:24 +00:00
openharmony_ci
44e7c46e5b !1013 Fix : statfs函数问题修复挑单到monthly_20221018
Merge pull request !1013 from yinjiaming/cherry-pick-1673836173
2023-01-17 08:57:17 +00:00
yinjiaming
cd8237fb5e fixed 9a4e967 from https://gitee.com/hgbveiu743/kernel_liteos_m/pulls/1009
fix:修复OsLs函数内存泄漏问题
当d = NULL时,path没有释放,现释放path所指向的内存

close #I6A07U

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Iee9fd8d2171c6fdcf353a48e7af385bbd1660520
2023-01-16 02:35:00 +00:00
yinjiaming
a9cdef1cd4 fixed 2f2a0b7 from https://gitee.com/hgbveiu743/kernel_liteos_m/pulls/1006
fix:修复statfs函数内部判断错误

修复函数调用的是statfs却用stat!=NULL来判断,当文件系统是little_fs时导致死机的问题。

close #I69BXB

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ib9784c017f4260433c3f12e352470108ea83ec19
2023-01-16 02:29:37 +00:00
openharmony_ci
47103b943a !1011 告警清理
Merge pull request !1011 from 乔克叔叔/cherry-pick-1673590318
2023-01-13 06:57:20 +00:00
liuwenxin
b4e2c8a8e2 fixed 705bfbd from https://gitee.com/wenxin-liu_admin/kernel_liteos_m/pulls/1010
fix:release告警清理

release分支告警清理

close:#I6AD15

Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-01-13 06:11:59 +00:00
openharmony_ci
5e5acfd04f !1003 【同步到monthly_20221018分支】mutex trace中ArchLRGet等接口改变实现方式
Merge pull request !1003 from zhangdengyu/cherry-pick-1673256956
2023-01-10 12:10:29 +00:00
zhangdengyu
0b4895cca6 fixed 84d1c20 from https://gitee.com/zhangdengyu/kernel_liteos_m/pulls/1000
fix:mutex trace中ArchLRGet接口改变实现方式

方案描述:
将ArchLRGet接口的实现方式由内联函数修改为宏,
防止产品添加--no_inline等编译选项导致函数无法在调用点展开,
造成由于函数调用过程中函数栈帧的变化带来的LR寄存器中存储的值的变化。

Close #I69D9N

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: If417bc2ec9febf064c63da198faf4ac000d70c52
2023-01-10 14:33:02 +08:00
openharmony_ci
3d7e94ea57 !984 修复codecheck告警同步至monthly_20221018
Merge pull request !984 from 夏不白/cherry-pick-1672373774
2023-01-03 03:08:21 +00:00
xiacong
911e736dab fixed 07091c5 from https://gitee.com/xia-bubai/kernel_liteos_m/pulls/983
fix:修复codecheck告警
1、修复空格、空行使用错误告警;
2、将超过10行的inline函数去除内联符号

fix #I685E3

Signed-off-by: xiacong <xiacong4@huawei.com>
2022-12-30 04:16:14 +00:00
openharmony_ci
f109218089 !981 【回合monthly1018】fix: mktime获取的时间缺少时区信息
Merge pull request !981 from Zhaotianyu/cherry-pick-1672302591
2022-12-29 12:48:05 +00:00
arvinzzz
bd4d9ffb58 fixed 2a4282f from https://gitee.com/arvinzzz/kernel_liteos_m/pulls/979
fix: The tm struct obtained by mktime lacks timezone information

BREAKING CHANGE:
The tm struct obtained by mktime lacks timezone information
变更API:
time_t mktime(struct tm *tmptr)
原先mktime从入参中获取时区信息进行计算,变更后tm结构体和返回值time_t的计算使用系统g_timezone时区环境变量。

Close I67UIA

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I766cffbff3c1a25bb33cbd245225ee117909af3a
2022-12-29 08:29:51 +00:00
openharmony_ci
015c79a5a9 !976 【monthly_20221018】VfsMpFind接口优化
Merge pull request !976 from Far/monthly_20221018
2022-12-26 02:04:03 +00:00
Far
46bad48e12 fix: VfsMpFind optimize
1. provide VfsMpFind which doesn't support mounting recursively;
2. provide a macro to set whether supporting recursive-mount or not.
3. adding path length checking

BREAKING CHANGE:
new config option:
LOSCFG_FS_SUPPORT_MOUNT_TARGET_RECURSIVE

fix #I677ZT
Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I92a752fe2bcdd2b036630b5e4e8d7df1562629e0
2022-12-24 10:45:01 +08:00
openharmony_ci
18ffbf44ee !975 【回合monthly1018】fix: misc_config中defines未初始化导致编译失败
Merge pull request !975 from Zhaotianyu/cherry-pick-1671695812
2022-12-23 09:04:20 +00:00
arvinzzz
690e15682b fixed b817c49 from https://gitee.com/arvinzzz/kernel_liteos_m/pulls/974
fix: 修复misc_config中defines未初始化的错误

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I4eecfc1af2b0cdc39922a8ce299eb8ab6b7c6e8c
2022-12-22 07:56:53 +00:00
openharmony_ci
84d34eafe1 !967 【monthly_20221018】修复文件系统不合理的锁操作
Merge pull request !967 from Far/monthly_20221018_lock
2022-12-22 06:33:10 +00:00
Far
819833072f fix: 修复文件系统不合理的锁操作
1. 移除了fatfs和littlefs中冗余的加锁操作。
2. 增加了配置选项FS_LOCK_TIMEOUT(宏LOSCFG_FS_LOCK_TIMEOUT),提供文件
   系统锁超时判定能力。
3. 新增对外接口LOS_FsLock()和LOS_FsUnlock()接口,提供HAL层与文件系统的
   互斥操作。

BREAKING CHANGE:
修复文件系统不合理的锁操作
新增API:
los_fs.h:
int LOS_FsLock(void)
int LOS_FsUnlock(void)
新增配置项:
LOSCFG_FS_LOCK_TIMEOUT(menuconfig FS_LOCK_TIMEOUT)

fix #I66A1M

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I2d7b67a209049162cd69f8ef3611ab0431df4d4a
2022-12-22 10:40:30 +08:00
openharmony_ci
8541f81c1e !970 【回合monthly_1018】open接口内存泄漏优化
Merge pull request !970 from wangchen/1217_1018
2022-12-19 07:02:08 +00:00
openharmony_ci
bddda6dcf7 !964 【monthly_20221018】修复文件系统close中的不合理操作
Merge pull request !964 from Far/monthly_20221018
2022-12-19 03:05:37 +00:00
wangchen
2bc508bdd3 fix: 回合1018 open接口内存泄漏修复
方案描述:
1, 修改路径正确时打开失败可能的异常

fix #I66KHK
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-12-17 08:23:19 +00:00
Far
77e204ab62 fix: 修复close接口中无法正常关闭文件的问题
1. close未考虑保留描述符0、1和2,导致fd合法性判断出现错误,这会导致
上限附近的fd不能被正常的关闭
2. 释放file结构体时未在锁的保护中进行,可能存在问题

fix #I66F6I

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I084c7e0e9cfc51a123ebad07d0c94f47e544baa6
2022-12-17 16:06:02 +08:00
arvinzzz
852181749d refactor: vfs opt
1. vfs重构优化,统一fs模块的对外接口,减少不必要的冗余调用,由fs组件直接提供posix对外接口
  2. vfs与libc关系整理
  3. fs接口实现规范化

BREAKING CHANGE:
删除API:
int LOS_Open(const char *path, int flags, ...);
int LOS_Close(int fd);
ssize_t LOS_Read(int fd, void *buff, size_t bytes);
ssize_t LOS_Write(int fd, const void *buff, size_t bytes);
off_t LOS_Lseek(int fd, off_t off, int whence);
int LOS_Stat(const char *path, struct stat *stat);
int LOS_Statfs(const char *path, struct statfs *buf);
int LOS_Unlink(const char *path);
int LOS_Rename(const char *oldpath, const char *newpath);
int LOS_Fsync(int fd);
DIR *LOS_Opendir(const char *path);
struct dirent *LOS_Readdir(DIR *dir);
int LOS_Closedir(DIR *dir);
int LOS_Mkdir(const char *path, mode_t mode);
int LOS_Rmdir(const char *path);
int LOS_Lstat(const char *path, struct stat *buffer);
int LOS_Fstat(int fd, struct stat *buf);
int LOS_Fcntl(int fd, int cmd, ...);
int LOS_Ioctl(int fd, int req, ...);
ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt);
ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt);
ssize_t LOS_Pread(int fd, void *buff, size_t bytes, off_t off);
ssize_t LOS_Pwrite(int fd, const void *buff, size_t bytes, off_t off);
int LOS_Isatty(int fd);
int LOS_Access(const char *path, int amode);
int LOS_Ftruncate(int fd, off_t length);
int LOS_FsUmount(const char *target);
int LOS_FsUmount2(const char *target, int flag);
int LOS_FsMount(const char *source, const char *target,
                const char *fsType, unsigned long mountflags,
                const void *data);
int OsFcntl(int fd, int cmd, va_list ap);
int OsIoctl(int fd, int req, va_list ap);

Close #I66F6I

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
2022-12-16 10:26:19 +08:00
openharmony_ci
eb08c1744d !961 【同步到monthly_20221018分支】feat:支持mutex trace
Merge pull request !961 from zhangdengyu/monthly_20221018
2022-12-09 00:56:50 +00:00
openharmony_ci
2a68a0e6d4 !956 【挑单】优化CPUP计算方式, 解耦系统调频
Merge pull request !956 from zhushengle/cherry-pick-1670312099
2022-12-08 14:49:17 +00:00
zhangdengyu
2eb0da90fe feat: 同步:新增mutex trace
方案描述:
1. 新增mutex trace

Close: I5ZMML

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
2022-12-08 16:38:04 +08:00
openharmony_ci
da29e90bca !959 fix: monthly_20221018 对外提供CONFIG_NFILE_DESCRIPTORS宏表示最大可打开fd数量
Merge pull request !959 from Hongjin Li/cherry-pick-1670397258
2022-12-07 07:49:48 +00:00
openharmony_ci
20cd0e4fde !951 合入monthly_20221018:添加LOSCFG_MAX_OPEN_DIRS标识最大可打开dir数量
Merge pull request !951 from Hongjin Li/monthly_20221018
2022-12-07 07:31:58 +00:00
Hongjin Li
0c39af1d9b fixed a3ce436 from https://gitee.com/hongjin-li/kernel_liteos_m/pulls/934
fix: 提供CONFIG_NFILE_DESCRIPTORS宏标识最大可打开fd数量

提供CONFIG_NFILE_DESCRIPTORS宏,标识最大可打开fd数量。
提供FAT_MAX_OPEN_FILES宏,标识FAT文件系统中最大可打开fd数量。

如果只有FAT文件系统,那么CONFIG_NFILE_DESCRIPTORS等于FAT_MAX_OPEN_FILES。
如果有多个文件系统,比如fat+little+yaffs,那么CONFIG_NFILE_DESCRIPTORS应该定义为多个文件系统可打开fd数量之和。

BREAKING CHANGE:

对外提供的CONFIG_NFILE_DESCRIPTORS宏,用来标识最大可打开fd数量。

开发者可以在target_config.h中自定义CONFIG_NFILE_DESCRIPTORS和FAT_MAX_OPEN_FILES宏。

Close #I62WDU

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2022-12-07 07:14:18 +00:00
openharmony_ci
9cac5041f2 !954 【monthly_20221018】对内核模块暴露OsMemNodeHead/OsMemPoolHead等结构体
Merge pull request !954 from Far/monthly_20221018
2022-12-06 13:57:37 +00:00
openharmony_ci
02ad24988b !936 feat: 挑单 fs增加注册接口 到1030
Merge pull request !936 from wangchen/1124_1030
2022-12-06 09:17:09 +00:00
openharmony_ci
9e4b228f3b !946 挑单 vfs 分区逻辑修改 到 monthly_20221018
Merge pull request !946 from wangchen/1129_x_partit
2022-12-06 09:03:20 +00:00
zhushengle
2fad9065c8 fixed 974182d from https://gitee.com/zhushengle/kernel_liteos_m/pulls/955
feat: 优化CPUP计算方式, 解耦系统调频

Close #I5R9XG

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I07cb388732b1190943374802f792d32bd666c06e
2022-12-06 07:35:00 +00:00
Far
c23f36940d feat: 对内核模块暴露OsMemNodeHead/OsMemPoolHead
对内核其他模块暴露OsMemNodeHead/OsMemPoolHead等结构体,
以便于对堆内存管理的调测及管理。

fix #I64OVX

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I603188722beaf67ba65e26ed93168617485e770a
2022-12-05 17:10:58 +08:00
wangchen
83198b9a6c feat: 挑单 fs增加注册接口 到1030
方案描述:
增加注册机制, 并增加重复注册判断

BREAKING CHANGE:
挑单 fs增加注册接口 到1030
新增API:
int LOS_FsRegister(const char *fsType, const struct MountOps *fsMops,
                   const struct FileOps *fsFops, const struct FsManagement *fsMgt);

fix #I62WMS
Signed-off-by: wangchen <wangchen240@huawei.com>
https://gitee.com/openharmony/kernel_liteos_m/issues/I62WMS
2022-12-01 02:49:05 +00:00
Hongjin Li
ee66077ec6 fix: 添加LOSCFG_MAX_OPEN_DIRS标识最大可打开dir数量
提供LOSCFG_MAX_OPEN_DIRS宏定义,标识最大可打开dir数量。新增g_dirNum静态变量,标识已打开的dir数量。
在opendir成功时g_dirNum++,在closedir成功时g_dirNum--。

BREAKING CHANGE:
新增LOSCFG_MAX_OPEN_DIRS宏定义,标识最大可打开dir数量。

Close #I641DZ

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2022-12-01 10:03:51 +08:00
wangchen
bbbf0b857c fix: 挑单 vfs 分区逻辑修改 到 1018
方案描述:
1,删除fat分区时调用的adddevice的动作

fix #I63QXK
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-11-29 09:06:04 +00:00
openharmony_ci
af5fcc0e6c !942 【monthly_20221018】文件系统提供动态内存分配器钩子
Merge pull request !942 from Far/monthly_20221018
2022-11-29 03:53:36 +00:00
Far
e004ca9783 feat: 文件系统提供动态内存分配器钩子
增加LOS_FS_MALLOC/LOS_FS_FREE宏以提供用户配置动态内存分配器的能力。
用户只需要在components/fs/vfs/los_fs.h中修改对应的函数即可。

BREAKING CHANGE:
文件系统提供动态内存分配器钩子
新增宏:
LOS_FS_MALLOC
LOS_FS_FREE

fix #I63IZ8

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: Ia18cbf907709dbfaa1bbc4e779537ec8e659a0ec
2022-11-28 20:01:36 +08:00
openharmony_ci
257364f873 !931 Fix : 内核告警清理挑单
Merge pull request !931 from yinjiaming/cherry-pick-1669172283
2022-11-23 11:07:51 +00:00
yinjiaming
86ee9aff2e fixed a4087a6 from https://gitee.com/hgbveiu743/kernel_liteos_m/pulls/930
Fix: 内核告警清理
消除了多余的空格

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ibe90fcf8c46ef9a60c0a8f4dbba07d399e139b8c
2022-11-23 02:58:04 +00:00
openharmony_ci
e709718fdc !926 告警清理
Merge pull request !926 from 乔克叔叔/cherry-pick-1669000234
2022-11-23 01:46:38 +00:00
openharmony_ci
34fcef1bf1 !924 告警清理
Merge pull request !924 from 乔克叔叔/cherry-pick-1668998063
2022-11-21 14:06:09 +00:00
liuwenxin
f5833a19ce fixed 2806c4a from https://gitee.com/wenxin-liu_admin/kernel_liteos_m/pulls/892
Fix:m核告警清理

Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2022-11-21 16:43:48 +08:00
liuwenxin
5b65d5d0f3 fixed fa6f0c3 from https://gitee.com/wenxin-liu_admin/kernel_liteos_m/pulls/917
fix:告警清理

Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2022-11-21 02:34:24 +00:00
openharmony_ci
1a525b1f0f !920 告警清理 合入monthly_20221018
Merge pull request !920 from Hongjin Li/cherry-pick-1668687992
2022-11-19 07:08:11 +00:00
openharmony_ci
780227205d !923 挑单 其他分区已mount时会引起格式化失败至monthly_20221018
Merge pull request !923 from wangchen/1118_1030_m
2022-11-18 10:21:09 +00:00
wangchen
171ffc4f4b fix: 挑单 其他分区已mount时会引起格式化失败至monthly_20221018
【背景】其他分区已mount时会引起格式化失败至monthly_20221018

【修改方案】
1, 格式化时判断方式修改为路径

【影响】
对现有的产品编译不会有影响。
re #I61W0J
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-11-18 06:58:29 +00:00
Hongjin Li
87e957c6a6 fixed 2dc3998 from https://gitee.com/hongjin-li/kernel_liteos_m/pulls/919
fix: add space after comma

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2022-11-17 12:26:32 +00:00
openharmony_ci
03a72de3ed !914 【monthly_20221018】修复mount接口对MS_REMOUNT的支持
Merge pull request !914 from Far/cherry-pick-1668503371
2022-11-17 04:56:30 +00:00
Far
ed3ad6e65f fixed 64d15df from https://gitee.com/yesiyuanjim/kernel_liteos_m/pulls/909
fix: fix the MS_REMOUNT support

The mount interface can't deal with MS_REMOUNT flag now, fix it.

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: Id0960c8d92ce767b8d8ef98b3ba2e1d1ab7db15d
2022-11-15 09:09:32 +00:00
openharmony_ci
48b116bebb !883 【回合monthly1018】feat: 提供死机场景下dump文件能力
Merge pull request !883 from Zhaotianyu/cherry-pick-1667647264
2022-11-14 02:23:37 +00:00
openharmony_ci
d4cbd3b563 !888 cortex-m4支持iar编译器的gn适配
Merge pull request !888 from yiweiniunan/cherry-pick-1667812780
2022-11-07 11:15:42 +00:00
yiweiniunan
787eaac712 fixed 62cd8fe from https://gitee.com/yiweiniunan/kernel_liteos_m/pulls/886
cortex-m4支持iar编译器的gn适配

Signed-off-by: yiweiniunan <michael.likai@huawei.com>
2022-11-07 09:19:40 +00:00
openharmony_ci
de6e3829b2 !872 挑单 解决部分平台ping失败
Merge pull request !872 from wangchen/1103_net
2022-11-07 01:37:53 +00:00
arvinzzz
9c0ea618df fixed 4742015 from https://gitee.com/arvinzzz/kernel_liteos_m/pulls/881
feat: 提供死机场景下dump文件的能力

死机场景下,vfs层锁会放开,提供dump文件的能力

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Id8c9e63fbf011dbc6690b9b4557bd3370353bf21
2022-11-05 11:21:05 +00:00
openharmony_ci
6fdbdf18cb !876 挑单-pm idle控制选项添加到menuconfig中至monthly_20221018
Merge pull request !876 from zhushengle/cherry-pick-1667528978
2022-11-04 09:38:11 +00:00
zhushengle
9454dd8bda fixed 98d20e9 from https://gitee.com/zhushengle/kernel_liteos_m/pulls/874
feat: pm idle添加到menuconfig中

Close #I5ZD5L
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ibdedff3043a0902aa3cd9539497ef97fb6a1ce6c
2022-11-04 02:29:38 +00:00
wangchen
291cb06744 fix: 挑单 解决部分平台ping失败
【背景】挑单 解决部分平台ping失败

【修改方案】
挑单 解决部分平台ping失败

【影响】
对现有的产品编译不会有影响。
re #I5Z9TP
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-11-03 07:18:47 +00:00
openharmony_ci
e268ef95a9 !851 清除一些静态检查工具发现的问题
Merge pull request !851 from Far/master
2022-10-17 01:38:58 +00:00
Far
296a546bcd fix: 修复一些静态扫描工具发现的问题
Change-Id: I4890de0066f33bf44e913b550edfa3639bce7caf
Signed-off-by: Far <yesiyuan2@huawei.com>
2022-10-15 17:36:26 +08:00
openharmony_ci
a7135e252d !838 fix: 测试用例修复
Merge pull request !838 from Zhaotianyu/20220925iccarm_test_fix
2022-10-13 12:58:17 +00:00
openharmony_ci
e76dd685c2 !845 Fix : POSIX测试用例补充
Merge pull request !845 from yinjiaming/test-2
2022-10-10 11:28:30 +00:00
yinjiaming
54a5365a25 fix: POSIX 测试用例后续补充
【背景】
POSIX 测试用例不完善

【修改方案】
继续将 A 核posix 相关的测试用例移植一部分到M核

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

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I9a7fff077c5bc00609e51ba9121d93dc67895656
2022-10-10 17:14:45 +08:00
openharmony_ci
2d1160fdc4 !844 Fix : POSIX测试用例补充
Merge pull request !844 from yinjiaming/test-1
2022-10-10 09:10:10 +00:00
yinjiaming
f3d606b6dd fix: POSIX测试用例后续补充
【背景】
posix 测试用例补充

【修改方案】
继续将A核 相关POSIX测试用例移植到 M核

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

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I91f996a4b4db47a417c9f32c9e04924cc264afbb
2022-10-10 11:46:07 +08:00
openharmony_ci
392e4c2cec !843 Fix : POSIX测试用例补充
Merge pull request !843 from yinjiaming/test
2022-10-09 08:23:53 +00:00
yinjiaming
b334658723 fix: POSIX测试用例补充
【背景】
POSIX测试用例需要补充

【修改方案】
此次修改将部分A核的测试用例移植到M核, 补充到testsuites/sample/posix/pthread
目录下

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

re #I5TIRQ

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: If4c45ca18dec53be809f6309ef1cfb1b9ac0eb20
2022-10-09 10:49:10 +08:00
openharmony_ci
2b1f2d554e !833 解决网络模块封装的ioctl等接口重定义
Merge pull request !833 from wangchen/0923_up_net
2022-09-27 10:54:02 +00:00
wangchen
2cf290bb7c fix: 删除网络模块封装的ioctl等接口
【背景】删除网络模块封装的ioctl等接口

【修改方案】
1, 删除网络模块封装的ioctl等接口

【影响】
对现有的产品编译不会有影响。
re #I5SRE6
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-09-27 09:28:07 +00:00
openharmony_ci
8fc9852e34 !830 lfs_mount 不能多实例
Merge pull request !830 from wangchen/0922_m
2022-09-26 13:09:18 +00:00
openharmony_ci
816d03f5c1 !832 LOS_FsMount 接口存在多处功能问题
Merge pull request !832 from wangchen/0923_m
2022-09-26 13:02:50 +00:00
openharmony_ci
61877ec97a !831 fix: 修复内核低功耗模式调整后同步问题
Merge pull request !831 from zhushengle/pm
2022-09-26 09:40:24 +00:00
arvinzzz
0f952132c0 fix: iccarm test's problem fix
close: #I5T02Y

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I29385bb25f487adafa2dbc064310817790d831bb
2022-09-25 18:54:03 +08:00
openharmony_ci
f94d3ee119 !835 内核告警清理:修复内存泄漏、空指针未判断等问题
Merge pull request !835 from 夏不白/fix_tscan
2022-09-25 08:24:10 +00:00
xiacong
784429d0dc <fix>
修复报警信息,为以下修复点
1、修复空指针未判断
2、修复open后未及时close 导致内存泄露
3、修复strdup后未free
4、修复赋值后未使用等问题
5、修复编码中判断条件中无符号变量小于零的情况

Signed-off-by: xiacong <xiacong4@huawei.com>
Change-Id: I13d046141afeb8a116e6a04304a3793bf8e12bee
Signed-off-by: xiacong <xiacong4@huawei.com>
2022-09-24 22:11:27 +08:00
openharmony_ci
1a764df92a !816 fix:trace模块编译修复
Merge pull request !816 from Zhaotianyu/20220902trace_fix
2022-09-23 09:39:15 +00:00
wangchen
cf50cde1b7 fix: lfs_mount 不能多实例
【背景】最后一个调用lfs_mount()的分区是有效的,前面的会被冲掉

【修改方案】
1, 增加一个存放cfg的空间, 每个mount点有独自的配置存储空间

【影响】
对现有的产品编译不会有影响。
re #I5RIGH
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-09-23 06:44:53 +00:00
wangchen
bfef7bfb2e fix: LOS_FsMount 接口存在多处功能问题
【背景】LOS_FsMount 接口存在多处功能问题

【修改方案】
1, 修改goto逻辑
2,把过长的函数重新封装

【影响】
对现有的产品编译不会有影响。
re #I5SP1I
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-09-23 03:45:18 +00:00
zhushengle
5bae8b58c6 fix: 修复内核低功耗模式调整后同步问题
Close #I5SNYA
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4df212bbf3e522ea371b5340848ba5adf2668ad7
2022-09-23 09:32:32 +08:00
openharmony_ci
044cf59583 !825 M核用例编译问题修复, 内核补充fcntl
Merge pull request !825 from wangchen/0917_m
2022-09-22 09:06:20 +00:00
wangchen
0adbafb9c2 \fix: M核用例编译问题修复
【背景】M核用例编译问题修复

【修改方案】
1, 添加musl缺失的fcntl
2,删除musl下对fcntl和ioctl的依赖
3,修改fs和vfs种fcntl入参的处理

【影响】
对现有的产品编译不会有影响。
re #I5PKBJ
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-09-21 07:20:12 +00:00
openharmony_ci
3398937b1b !822 Fix : 内核告警清理
Merge pull request !822 from yinjiaming/fix
2022-09-21 04:42:39 +00:00
openharmony_ci
3c010b4717 !828 【轻量级 PR】:【OpenHarmony开源贡献者计划2022】fix warning: 'return' with a value, in function returning void
Merge pull request !828 from wangziyi0929/N/A
2022-09-21 03:09:31 +00:00
yinjiaming
c237ff63fa fix: 内核告警修复
【背景】
内核代码经扫描工具检测发现有可以修改的
告警

【修改方案】
1. 对只有单一语句的if, while等添加括号使之符合编程规范
2. 将C 风格的类型转换变为 C++ 风格的

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

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I0b7659882eec777cade3ee21e76a42a86e2ce822
2022-09-21 10:30:30 +08:00
wangziyi0929
3508110f6d fix warning: 'return' with a value, in function returning void
Signed-off-by: wangziyi0929 <915619048@qq.com>
2022-09-19 07:55:05 +00:00
openharmony_ci
ffa868a81c !827 M核对公共基础类库路径依赖修改
Merge pull request !827 from wangchen/0919_m
2022-09-19 07:06:17 +00:00
wangchen
7d391c9bbf fix: M核对公共基础类库路径依赖修改
【背景】M核对公共基础类库路径依赖修改

【修改方案】
1, 修改lwip依赖的路径

【影响】
对现有的产品编译不会有影响。
re #I5RSMC
Signed-off-by: wangchen <wangchen240@huawei.com>
https://gitee.com/openharmony/kernel_liteos_m/issues/I5RSMC
2022-09-19 06:28:16 +00:00
openharmony_ci
e4a1c18d40 !826 【OpenHarmony开源贡献者计划2022】 删除未初始化的变量ret
Merge pull request !826 from 刘淦/master
2022-09-19 02:38:00 +00:00
liugan
83790f4f9b remove unused variable ret
Signed-off-by: liugan <liugan_public@163.com>
2022-09-17 17:16:17 +08:00
arvinzzz
6377f98e9e fix: trace模块编译修复
close: #I5PD6D

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I727ddaa78c5ca7b6626347659f584f54191efabe
2022-09-02 11:37:42 +08:00
openharmony_ci
b8f8ab5a36 !807 非安全函数告警清理
Merge pull request !807 from xuxinyu/function_s
2022-08-26 04:45:26 +00:00
xuxinyu
a0b776a709 非安全函数告警清理
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: I45bbaa3568be3679b34b1e8b072d19d878fdbf02
2022-08-25 20:50:48 +08:00
openharmony_ci
f5f18ca669 !812 fix:iccarm下fs的编译错误
Merge pull request !812 from Zhaotianyu/20220824iccarm_fs_fix
2022-08-24 10:49:19 +00:00
arvinzzz
5756d45e84 fix: 修复fs在iccarm下的编译错误
close: #I5NXFL

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
2022-08-24 16:59:42 +08:00
openharmony_ci
8a25f31aa4 !809 unittest关联issue
Merge pull request !809 from Hongjin Li/dev2
2022-08-24 06:36:20 +00:00
Hongjin Li
f7cc6ff14e test: unittest 关联 issue number
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I0a735c85c004ef3171eb170effacc034e3c8cd1a
2022-08-24 11:31:55 +08:00
openharmony_ci
bf9e0c9e2b !805 补充unittest用例描述
Merge pull request !805 from Hongjin Li/dev1
2022-08-23 14:03:19 +00:00
Hongjin Li
e9de74a94a test: testcase description
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I1f8067dfbde2c12c092d5c9570f6ad45430f58ef

Change-Id: Ifad39593d943a29771691b6c23289d9774f5dfab
2022-08-23 21:20:54 +08:00
openharmony_ci
b38f135242 !795 低功耗增加idle选项
Merge pull request !795 from zhushengle/pm
2022-08-23 13:06:03 +00:00
openharmony_ci
0cb50baa55 !801 编译构建规范优化
Merge pull request !801 from Hongjin Li/dev
2022-08-23 12:26:15 +00:00
Hongjin Li
565049f1eb style: string format in python
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I0d6ffb978bf4f96fd546868a6dd5f20d2cefbfd6
2022-08-23 18:52:42 +08:00
zhushengle
9add4b4b92 feat: 低功耗增加idle选项
Close #I5N9J2

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I066ff415709145e585f1eb94e70263361d3d71af
2022-08-22 17:04:08 +08:00
openharmony_ci
5992506c75 !796 feature:允许device_path指向vendor
Merge pull request !796 from Zhaotianyu/20220820build.gn
2022-08-20 08:38:20 +00:00
arvinzzz
d4db5a5a75 feature: BUILD.gn中device_path允许指向vendor
close: #I5N9NC

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: If6a05871a0c78a92d6370b73528674e411642e20
2022-08-20 15:54:44 +08:00
openharmony_ci
fe8b68826a !792 fix: iccarm fatfs编译问题修复
Merge pull request !792 from Zhaotianyu/20220818iccarm_fatfs
2022-08-18 11:38:21 +00:00
arvinzzz
99640e9977 fix: fatfs iccarm编译修复
close: #I5MZ62

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ie3882e443406d5055ff58c780cd376ddd6054bbf
2022-08-18 17:47:34 +08:00
openharmony_ci
0dc3c7ae9e !782 【轻量级 PR】:删除未使用的ret变量
Merge pull request !782 from fanhonglin/N/A
2022-08-17 06:11:28 +00:00
openharmony_ci
699bb81fc3 !721 完善文件系统vfs层初始化函数
Merge pull request !721 from LeonChan/oh
2022-08-17 04:35:45 +00:00
leonchan5
f2c4b59773 feat: liteos-m文件系统初始化函数支持littlefs
VFS初始化函数LOS_DiskPartition及LfsFormat支持littlefs,支持对flash设备进行分区和格式化操作
1,VFS层记录Fat/littlefs设备名称、分区等信息,后续在本层做处理
2,flash设备的相关配置及驱动操作接口通过LOS_DiskPartition配置,产品不用直接面向具体文件系统

close: #I5CYKI

Signed-off-by: leonchan5 <chenwei26@huawei.com>
2022-08-16 18:55:53 +08:00
openharmony_ci
b656553c5c !786 【OpenHarmony开源贡献者计划2022】change LOS_IntLock() to (VOID)LOS_IntLock()
Merge pull request !786 from chianqi/LOS_IntLock
2022-08-16 01:21:18 +00:00
openharmony_ci
7653bd8da1 !780 【OpenHarmony开源贡献者计划2022】remove unnecessary extern "C"
Merge pull request !780 from 宋晓丽/cpp
2022-08-16 01:14:55 +00:00
openharmony_ci
1275ecbc8a !778 【OpenHarmony开源贡献者计划2022】+ store拼写不对
Merge pull request !778 from 虚竹/master
2022-08-16 01:13:02 +00:00
openharmony_ci
ebc57397f0 !785 【OpenHarmony开源贡献者计划2022】change memset to (VOID)memset when not handling the return value
Merge pull request !785 from qian8888/lms
2022-08-16 01:12:07 +00:00
anqi
cce6365f4f change LOS_IntLock() to (VOID)LOS_IntLock()
Signed-off-by: anqi <anqi@liuxiuhai.cn>
2022-08-15 20:51:29 +08:00
zq
04f391d814 change memset to (VOID)memset when not handling the return value
Signed-off-by: zq <zhangqian@liuxiuhai.cn>
2022-08-15 19:56:39 +08:00
openharmony_ci
14e64fc89b !783 修改littlefs readdir在完全读完后,会设置错误码EBADF
Merge pull request !783 from wangchen/0812_m
2022-08-12 09:44:29 +00:00
wangchen
2ce5ce9397 fix: littlefs readdir在完全读完后,会设置错误码EBADF
【背景】littlefs readdir在完全读完后,会设置错误码EBADF

【修改方案】
1,  fsFops->readdir 执行返回非0时,有可能是正常情况,因此删除else赋值错误码

【影响】
对现有的产品编译不会有影响。
re #I5M1OE
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-08-12 09:25:20 +00:00
openharmony_ci
eb40e4a068 !775 【OpenHarmony开源贡献者计划2022】void TcpIpPortingInit()无参数时需要修改为(void)
Merge pull request !775 from sinall/master
2022-08-12 03:50:54 +00:00
openharmony_ci
dc5feb9e19 !774 【OpenHarmony开源贡献者计划2022】fix mempry to memory、satck to stack
Merge pull request !774 from rtos_ding/typo
2022-08-12 02:28:07 +00:00
openharmony_ci
7a61f8d836 !781 【OpenHarmony开源贡献者计划2022】change uwtimeout to timeout
Merge pull request !781 from 红叶电脑/timeout
2022-08-12 02:27:15 +00:00
openharmony_ci
330760dbb3 !779 【OpenHarmony开源贡献者计划2022】+ release拼写错误
Merge pull request !779 from 王小二/master
2022-08-12 02:24:20 +00:00
openharmony_ci
2739a00c55 !777 【OpenHarmony开源贡献者计划2022】+ 信号量 应该是 semaphore
Merge pull request !777 from 哈哈哈/master
2022-08-12 02:23:42 +00:00
openharmony_ci
7f14b060d4 !776 【OpenHarmony开源贡献者计划2022】修复一些规范小问题
Merge pull request !776 from VinceCarter123/void
2022-08-12 02:20:06 +00:00
fanhonglin
8be6e129fc 删除未使用的ret变量
Signed-off-by: fanhonglin <1064581928@qq.com>
2022-08-12 01:34:32 +00:00
wx880216
f465c15d7a change uwtimeout to timeout
Signed-off-by: wx880216 <wx880216@liuxiuhai.cn>
2022-08-12 01:15:13 +08:00
songxiaoli4790
0af2577498 remove unnecessary extern "C"
Signed-off-by: songxiaoli4790 <songxiaoli4790@liuxiuhai.cn>
2022-08-12 00:54:29 +08:00
王小二
238ff396b8 release拼写错误
Signed-off-by: 王小二 <x1234567890801@126.com>

Signed-off-by: 王小二 <x1234567890801@126.com>
2022-08-11 15:33:34 +00:00
虚竹
5917c4b01b store拼写不对
Signed-off-by: 虚竹 <x18919883794@163.com>

Signed-off-by: 虚竹 <x18919883794@163.com>
2022-08-11 15:23:12 +00:00
哈哈哈
5c4edb9b1a 信号量单词不合适
Signed-off-by:哈哈哈 <x16739329869@163.com>

Signed-off-by: 哈哈哈 <x16739329869@163.com>
2022-08-11 15:13:36 +00:00
danhao
ce176e77e6 add VOID to swtmr test function parameter list
Signed-off-by: danhao <danhao@liuxiuhai.cn>
2022-08-11 22:54:14 +08:00
Gao Rui
8ef012bdad Fix TcpIpPortingInit() to TcpIpPortingInit(void)
Signed-off-by: Gao Rui <gaoruinan@163.com>
2022-08-11 22:00:22 +08:00
juan
933efffba7 fix mempry to memory、satck to stack
Signed-off-by: juan <juan@liuxiuhai.cn>
2022-08-11 21:23:46 +08:00
openharmony_ci
ae692bfbc4 !768 feature: C库补充access、remove接口
Merge pull request !768 from Zhaotianyu/20220806fs_add
2022-08-11 11:05:50 +00:00
arvinzzz
ab46b9c836 feature: C库补充fs接口
close: #I5J5YD

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I21c11106b24b6e050d4061a98ad69b2b10a5a318
2022-08-11 15:43:02 +08:00
openharmony_ci
b83d17039e !771 补充cmsis queue测试用例
Merge pull request !771 from xuxinyu/CmsisTestCase
2022-08-11 06:42:40 +00:00
xuxinyu
08404f3252 补充cmsis queue测试用例
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Ic717514a92c5b98f247ad7185122722878d16506
2022-08-11 11:43:12 +08:00
openharmony_ci
8b19c3cbe4 !770 新增静态队列用例
Merge pull request !770 from xuxinyu/StaticQueueTest
2022-08-09 11:38:03 +00:00
xuxinyu
192a2a6e61 新增静态队列用例
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Ib07ab22ee884475d5bc4de54fb43c89eed2c1305
2022-08-09 16:47:27 +08:00
openharmony_ci
2ec2c369e7 !755 内核告警清理
Merge pull request !755 from yinjiaming/fix
2022-08-09 08:37:39 +00:00
openharmony_ci
f2b280bdbd !769 feature:支持queue地址外部部署共功能及queue名字设置
Merge pull request !769 from xuxinyu/static_by_id
2022-08-08 15:34:36 +00:00
xuxinyu
c09b3a8774 feature:支持queue地址外部部署共功能及queue名字设置
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: I1984014956a92d61d65b68f79279b2aa593a72e1
2022-08-08 23:11:11 +08:00
openharmony_ci
04cded2f0a !765 Fix : 修复了OsTraceInit() 参数错误问题
Merge pull request !765 from yinjiaming/dev
2022-08-05 10:16:12 +00:00
openharmony_ci
ddfb363675 !766 fix: iccarm编译修复
Merge pull request !766 from Zhaotianyu/20220801iccarm_fix
2022-08-02 01:47:08 +00:00
arvinzzz
d0c50a4af0 fix: iccarm编译修复
close: #I5JXMJ

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I3fbaf459ad4807a44396f319a4d53d3cc1e7700c
2022-08-01 16:53:18 +08:00
yinjiaming
6affe19d5a fix: OsTraceInit参数错误修正
【背景】
los_init.c 中存在 OsTraceInit()参数不正确的
错误

【修改方案】
修改OsTraceInit()参数错误的地方, 并包含了相应的头文件

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

re #I5H4UT

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I112067819d1850003ba0b36bd344b4ab9a8878d5
2022-07-30 09:17:23 +00:00
yinjiaming
a36d5d9058 fix: 内核告警修复
【背景】
内核代码经代码扫描工具发现存在一些关于代码格式的告警,
现经修改解除掉告警。

【修改方案】
修改了代码中格式不规范的地方,修改的点有:
1.代码中一行过长
2.没有合理的添加空格和空行
3.没有按照规范进行缩进
4.括号的格式没有按照规范
5.注释的格式不对以及存在魔数字
6.函数的声明与定义的格式不一致
并更新了修改文件的版权头时间

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

re #I5H6F5
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id8eb0450d03fae537ea4c73190fdadb76b29253d
2022-07-29 08:30:38 +00:00
openharmony_ci
63bf098b0f !758 refactor:Kconfig选项解耦
Merge pull request !758 from Zhaotianyu/20220723Kconfig
2022-07-27 09:11:40 +00:00
openharmony_ci
252052f024 !757 M核time模块支持调用RTC接口
Merge pull request !757 from wangchen/0722_m
2022-07-26 15:05:28 +00:00
wangchen
8c46636052 fix: M核time模块支持调用RTC接口
【背景】M核time模块支持调用RTC接口

【修改方案】
1, 增加注册接口
2, 读写时间时判断是否有rtc

【影响】
对现有的产品编译不会有影响。
re #I5IKMN
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-07-26 14:23:08 +00:00
openharmony_ci
6ff615b9ca !756 拼写错误修正
Merge pull request !756 from yinjiaming/dev
2022-07-25 11:06:31 +00:00
arvinzzz
732a346399 refactor: Kconfig选项解耦
close: #I5I7LX

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ieaf3bc6bf0c345a7d7945abb9133bd40fbe9d5b8
2022-07-23 21:21:59 +08:00
yinjiaming
2931dc6013 fix: 拼写错误修正
【背景】
代码中存在拼写错误

【修改方案】
修改存在拼写错误的地方

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

re #I5IA7P

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Iba87369fef7dbcbcd974e07d4cb279874ff697fb
2022-07-21 11:18:24 +00:00
openharmony_ci
df30bc4e0a !753 M4 qemu newlibc与musl差异用例隔离
Merge pull request !753 from wangchen/0712_m
2022-07-18 06:18:00 +00:00
openharmony_ci
1599669290 !748 Use rv32i substring as RISC-V architecture selector
Merge pull request !748 from Dmytro Kosmii/master
2022-07-18 02:15:55 +00:00
wangchen
d8104f6290 fix: M4 qemu 开启newlibc编译报错
【背景】M4 qemu 开启newlibc编译报错

【修改方案】
删除musl依赖路径

【影响】
对现有的产品编译不会有影响。
re #I5GIAR
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-07-16 10:47:21 +00:00
Dmytro Kosmii
3a190a1a1b Added missed includes.
Signed-off-by: Dmytro Kosmii <dmytro.kosmii@telink-semi.com>
Change-Id: I172a68a1ad6ca194399a6d47d46c54ebcfbd9338
2022-07-12 19:45:07 +03:00
openharmony_ci
e1f986305b !745 iccarm工具链支持
Merge pull request !745 from wish/tag_iccarm
2022-07-12 11:05:34 +00:00
openharmony_ci
0c8b7d2a1b !751 refactor:编译框架对不同工具链的解耦优化
Merge pull request !751 from Zhaotianyu/20220712buildframework_opt
2022-07-12 09:40:58 +00:00
i-wangliangliang
62eb96dd8d iccarm工具链编译适配
Signed-off-by: i-wangliangliang <willfox@126.com>
Change-Id: I9360dc232c35ec4db7a9bee08f3c288e22941e39
2022-07-12 17:01:44 +08:00
arvinzzz
009d2503fb refactor: 编译框架对不同工具链的解耦优化
close: #I5GQ9A

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I3e371a67bdab75c53e769e08c1c54ec83c741a69
2022-07-12 16:54:35 +08:00
Dmytro Kosmii
f7d79148b7 Use rv32i substring as RISC-V architecture selector.
Signed-off-by: Dmytro Kosmii <dmytro.kosmii@telink-semi.com>
Change-Id: Ie5b0b2be987f112bc150ec817080b59a332cbac1
2022-07-08 15:37:22 +03:00
336 changed files with 5676 additions and 2860 deletions

View File

@@ -31,11 +31,6 @@ import("//build/lite/config/component/lite_component.gni")
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
declare_args() {
liteos_name = "OHOS_Image"
liteos_kernel_only = false
}
import("liteos.gni")
if (defined(LOSCFG_COMPILER_ICCARM)) {
@@ -96,8 +91,9 @@ config("dialect_config") {
}
config("misc_config") {
defines = []
if (!defined(LOSCFG_COMPILER_ICCARM)) {
defines = [ "__LITEOS__" ]
defines += [ "__LITEOS__" ]
defines += [ "__LITEOS_M__" ]
}
if (!defined(LOSCFG_DEBUG_VERSION)) {
@@ -125,8 +121,11 @@ config("los_config") {
cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi"
HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
# board and soc decoupling feature, device_path should contains board
BOARD_SOC_FEATURE = device_path != string_replace(device_path, "/board/", "")
# If device_path points to vendor, use device_path directly,
# otherwise board is decoupled from soc, device_path should contain board
BOARD_SOC_FEATURE =
device_path == string_replace(device_path, "/vendor/", "") &&
device_path != string_replace(device_path, "/board/", "")
config("public") {
configs = [
@@ -194,15 +193,7 @@ executable("liteos") {
":los_config",
]
if (defined(LOSCFG_COMPILER_ICCARM)) {
ldflags = [ "--map=$liteos_name.map" ]
} else {
ldflags = [
"-static",
"-Wl,--gc-sections",
"-Wl,-Map=$liteos_name.map",
]
}
ldflags = executable_config_ldflags
output_dir = target_out_dir
@@ -223,20 +214,5 @@ build_ext_component("build_kernel_image") {
deps = [ ":copy_liteos" ]
exec_path = rebase_path(root_out_dir)
if (defined(LOSCFG_COMPILER_ICCARM)) {
objcopy = "${compile_prefix}ielftool$toolchain_cmd_suffix"
objdump = "${compile_prefix}ielfdumparm$toolchain_cmd_suffix"
command = "$objcopy --bin --verbose $liteos_name $liteos_name.bin"
command +=
" && sh -c '$objdump --source --all $liteos_name -o $liteos_name.asm'"
} else {
objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
command = "$objcopy -O binary $liteos_name $liteos_name.bin"
command +=
" && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'"
}
command = toochain_config_command
}

37
Kconfig
View File

@@ -335,6 +335,14 @@ config KERNEL_PM
Configuration item for low power frame tailoring.
If you wish to build LiteOS with support for power management.
config KERNEL_PM_IDLE
bool "Enable Power Management Idle"
default n
depends on KERNEL_PM
help
Configuration item for low power frame tailoring.
If you wish to build LiteOS with support for power management idle.
config KERNEL_PM_TASK_PTIORITY
int "Power Management Task Priority"
default 1
@@ -357,15 +365,10 @@ config KERNEL_PM_DEBUG
help
Configuration item for low power frame debug tailoring.
config DEBUG_HOOK
bool
default n
config PLATFORM_EXC
bool "Enable Hook Feature"
bool "Enable Platform Exc Hook"
default n
depends on KERNEL_EXTKERNEL
select DEBUG_HOOK
config KERNEL_LMK
bool "Enable Low Memory Killer"
@@ -518,6 +521,14 @@ config DEBUG_QUEUE
help
Answer Y to enable debug queue.
config MUTEX_CREATE_TRACE
bool "Enable Mutex Trace Debugging"
default n
depends on ARCH_ARM
depends on DEBUG_KERNEL
help
Answer Y to enable debug mutex trace.
config DEBUG_DEADLOCK
bool "Enable Mutex Deadlock Debugging"
default n
@@ -532,14 +543,20 @@ config DEBUG_SEMAPHORE
help
Answer Y to enable debug semaphore.
source "components/shell/Kconfig"
config NET_LWIP_SACK_TFTP
bool "Enable Tftp"
default y
depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION
help
Answer Y to enable LiteOS support tftp cmd and tftp tool.
osource "net/telnet/Kconfig"
config DEBUG_HOOK
bool "Enable Hook Framework"
default n
depends on DEBUG_VERSION
help
Enable the kernel hook framework to support customized trace information capture.
config SCHED_DEBUG
bool "Enable sched debug Feature"
default n
@@ -600,12 +617,14 @@ config VM_OVERLAP_CHECK
depends on DEBUG_VERSION && MEM_DEBUG
help
Answer Y to enable vm overlap check.
config TASK_MEM_USED
bool "Enable show task mem used or not"
default n
depends on DEBUG_VERSION && MEM_DEBUG
source "components/shell/Kconfig"
endmenu
######################## config options os drivers ########################

View File

@@ -43,7 +43,7 @@ module_group("arch") {
"$board_cpu" == "ck804ef") {
modules += [ "csky" ]
} else if ("$board_cpu" == "") {
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
if ("$board_arch" != string_replace("$board_arch", "rv32i", "")) {
modules += [ "risc-v" ]
} else if ("$board" == "esp32") {
modules += [ "xtensa" ]

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -60,7 +60,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -91,7 +91,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0
UINT32 hwCycle = 0;
UINT32 intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;

View File

@@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
#endif /* __cplusplus */
#endif

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -58,7 +58,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-2022 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:
@@ -27,13 +27,21 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if LIBC_MUSL
import("//kernel/liteos_m/liteos.gni")
config LIBC_MUSL_FS
bool "Enable POSIX file system API support"
default y
depends on FS_VFS
help
This enables POSIX style file system related APIs.
module_name = "arch"
kernel_module(module_name) {
sources = [
"los_context.c",
"los_dispatch.S",
"los_exc.S",
"los_interrupt.c",
"los_mpu.c",
"los_timer.c",
]
configs += [ "$LITEOSTOPDIR:warn_config" ]
}
endif # LIBC_MUSL
config("public") {
include_dirs = [ "." ]
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -61,7 +61,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

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

View File

@@ -58,7 +58,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -91,7 +91,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0
UINT32 hwCycle = 0;
UINT32 intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;

View File

@@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:

View File

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

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

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

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
#endif /* __cplusplus */
#endif

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -63,7 +63,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -612,7 +612,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
HalHwiHandleReInit((UINT32)&g_hwiForm);
HalSetVbr((UINT32)&g_hwiForm);
for (int i = 0; i < BYTES_OF_128_INT; i++) {
for (i = 0; i < BYTES_OF_128_INT; i++) {
VIC_REG->IABR[i] = 0x0;
VIC_REG->ICPR[i] = MASK_32_BITS;
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 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:
@@ -62,6 +62,14 @@ STATIC INLINE UINTPTR ArchMspGet(VOID)
__asm("mrs %0, msp" : "=r" (msp));
return msp;
}
#define ARCH_LR_GET() \
({ \
UINTPTR lr; \
__asm("mov %0, lr" : "=r" (lr)); \
(lr); \
})
#define ArchLRGet ARCH_LR_GET
#elif defined(__CLANG_ARM) || defined(__GNUC__)
STATIC INLINE UINTPTR ArchSpGet(VOID)
{
@@ -83,6 +91,14 @@ STATIC INLINE UINTPTR ArchMspGet(VOID)
__asm volatile("mrs %0, msp" : "=r" (msp));
return msp;
}
#define ARCH_LR_GET() \
({ \
UINTPTR lr; \
__asm volatile("mov %0, lr" : "=r" (lr)); \
(lr); \
})
#define ArchLRGet ARCH_LR_GET
#else
/* Other platforms to be improved */
#endif

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -107,13 +107,16 @@ UINT32 ArchIntUnLock(VOID);
*
* @attention
* <ul>
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring is enabled.</li>
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range applicable for a Cortex-A7 platform is [32,95].</li>
* <li>The hardware interrupt module is usable only when the configuration item for hardware
* interrupt tailoring is enabled.</li>
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range
* applicable for a Cortex-A7 platform is [32,95].</li>
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
* </ul>
*
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable
* for a Cortex-A7 platform is [32,95].
* @param irqParam [IN] Type #HwiIrqParam *. ID of hardware interrupt which will base on
* when delete the hardware interrupt.
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
@@ -133,13 +136,16 @@ UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam);
*
* @attention
* <ul>
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring is enabled.</li>
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range applicable for a Cortex-A7 platform is [32,95].</li>
* <li>The hardware interrupt module is usable only when the configuration item for hardware
* interrupt tailoring is enabled.</li>
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range
* applicable for a Cortex-A7 platform is [32,95].</li>
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
* </ul>
*
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a
* Cortex-A7 platform is [32,95].
* @param hwiPrio [IN] Type#HWI_PRIOR_T: hardware interrupt priority. Ignore this parameter temporarily.
* @param mode [IN] Type#HWI_MODE_T: hardware interrupt mode. Ignore this parameter temporarily.
* @param handler [IN] Type#HWI_PROC_FUNC: interrupt handler used when a hardware interrupt is triggered.
@@ -149,7 +155,8 @@ UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam);
* @retval #OS_ERRNO_HWI_PROC_FUNC_NULL 0x02000901: Null hardware interrupt handling function.
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
* @retval #OS_ERRNO_HWI_NO_MEMORY 0x02000903: Insufficient memory for hardware interrupt creation.
* @retval #OS_ERRNO_HWI_ALREADY_CREATED 0x02000904: The interrupt handler being created has already been created.
* @retval #OS_ERRNO_HWI_ALREADY_CREATED 0x02000904: The interrupt handler being created has
* already been created.
* @retval #LOS_OK 0 : The interrupt is successfully created.
* @par Dependency:
* <ul><li>los_interrupt.h: the header file that contains the API declaration.</li></ul>

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -35,6 +35,7 @@
#include "los_config.h"
#include "los_interrupt.h"
#include "los_arch_context.h"
#include "los_error.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -103,7 +103,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
LOS_IntLock();
(VOID)LOS_IntLock();
while (1) {
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -58,6 +58,9 @@
#define OS_CPUP_RECORD_PERIOD (g_sysClock)
#define OS_SYS_CYCLE_TO_US(cycle) ((cycle) / (g_sysClock)) * OS_SYS_US_PER_SECOND + \
((cycle) % (g_sysClock) * OS_SYS_US_PER_SECOND / (g_sysClock))
LITE_OS_SEC_BSS UINT16 g_cpupInitFlg = 0;
LITE_OS_SEC_BSS OsCpupCB *g_cpup = NULL;
LITE_OS_SEC_BSS UINT64 g_lastRecordTime;
@@ -167,6 +170,15 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit()
return LOS_OK;
}
/* The calculation time unit is changed to us to decouple the influence of
* system frequency modulation on CPUP
*/
STATIC UINT64 CpupTimeUsGet(VOID)
{
UINT64 time = LOS_SysCycleGet();
return OS_SYS_CYCLE_TO_US(time);
}
/*****************************************************************************
Function : OsTskCycleStart
Description: start task to get cycles count in current task beginning
@@ -183,10 +195,11 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleStart(VOID)
taskID = g_losTask.newTask->taskID;
g_cpup[taskID].cpupID = taskID;
g_cpup[taskID].startTime = LOS_SysCycleGet();
g_cpup[taskID].startTime = CpupTimeUsGet();
return;
}
/*****************************************************************************
Function : OsTskCycleEnd
Description: quit task and get cycle count
@@ -196,7 +209,7 @@ Return : None
LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleEnd(VOID)
{
UINT32 taskID;
UINT64 cpuCycle;
UINT64 cpuTime;
if (g_cpupInitFlg == 0) {
return;
@@ -208,17 +221,17 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleEnd(VOID)
return;
}
cpuCycle = LOS_SysCycleGet();
if (cpuCycle < g_cpup[taskID].startTime) {
cpuCycle += g_cyclesPerTick;
cpuTime = CpupTimeUsGet();
if (cpuTime < g_cpup[taskID].startTime) {
cpuTime += OS_US_PER_TICK;
}
g_cpup[taskID].allTime += (cpuCycle - g_cpup[taskID].startTime);
g_cpup[taskID].allTime += (cpuTime - g_cpup[taskID].startTime);
g_cpup[taskID].startTime = 0;
return;
}
/*****************************************************************************
Function : OsTskCycleEndStart
Description: start task to get cycles count in current task ending
@@ -228,7 +241,7 @@ Return : None
LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleEndStart(VOID)
{
UINT32 taskID;
UINT64 cpuCycle;
UINT64 cpuTime;
UINT16 loopNum;
if (g_cpupInitFlg == 0) {
@@ -236,23 +249,23 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleEndStart(VOID)
}
taskID = g_losTask.runTask->taskID;
cpuCycle = LOS_SysCycleGet();
cpuTime = CpupTimeUsGet();
if (g_cpup[taskID].startTime != 0) {
if (cpuCycle < g_cpup[taskID].startTime) {
cpuCycle += g_cyclesPerTick;
if (cpuTime < g_cpup[taskID].startTime) {
cpuTime += OS_US_PER_TICK;
}
g_cpup[taskID].allTime += (cpuCycle - g_cpup[taskID].startTime);
g_cpup[taskID].allTime += (cpuTime - g_cpup[taskID].startTime);
g_cpup[taskID].startTime = 0;
}
taskID = g_losTask.newTask->taskID;
g_cpup[taskID].cpupID = taskID;
g_cpup[taskID].startTime = cpuCycle;
g_cpup[taskID].startTime = cpuTime;
if ((cpuCycle - g_lastRecordTime) > OS_CPUP_RECORD_PERIOD) {
g_lastRecordTime = cpuCycle;
if ((cpuTime - g_lastRecordTime) > OS_CPUP_RECORD_PERIOD) {
g_lastRecordTime = cpuTime;
for (loopNum = 0; loopNum < g_taskMaxNum; loopNum++) {
g_cpup[loopNum].historyTime[g_hisPos] = g_cpup[loopNum].allTime;
@@ -268,12 +281,12 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleEndStart(VOID)
return;
}
LITE_OS_SEC_TEXT_MINOR static inline UINT16 OsGetPrePos(UINT16 curPos)
LITE_OS_SEC_TEXT_MINOR STATIC INLINE UINT16 OsGetPrePos(UINT16 curPos)
{
return (curPos == 0) ? (OS_CPUP_HISTORY_RECORD_NUM - 1) : (curPos - 1);
}
LITE_OS_SEC_TEXT_MINOR static VOID OsGetPositions(UINT16 mode, UINT16* curPosAddr, UINT16* prePosAddr)
LITE_OS_SEC_TEXT_MINOR STATIC VOID OsGetPositions(UINT16 mode, UINT16* curPosAddr, UINT16* prePosAddr)
{
UINT16 curPos;
UINT16 prePos = 0;
@@ -299,7 +312,7 @@ Return : cpupRet:current CPU usage
*****************************************************************************/
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_SysCpuUsage(VOID)
{
UINT64 cpuCycleAll = 0;
UINT64 cpuTimeAll = 0;
UINT32 cpupRet = 0;
UINT16 loopNum;
UINT32 intSave;
@@ -313,12 +326,12 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_SysCpuUsage(VOID)
OsTskCycleEnd();
for (loopNum = 0; loopNum < g_taskMaxNum; loopNum++) {
cpuCycleAll += g_cpup[loopNum].allTime;
cpuTimeAll += g_cpup[loopNum].allTime;
}
if (cpuCycleAll) {
if (cpuTimeAll) {
cpupRet = LOS_CPUP_PRECISION - (UINT32)((LOS_CPUP_PRECISION *
g_cpup[g_idleTaskID].allTime) / cpuCycleAll);
g_cpup[g_idleTaskID].allTime) / cpuTimeAll);
}
OsTskCycleStart();
@@ -335,7 +348,7 @@ Return : cpupRet:CPU usage history
*****************************************************************************/
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_HistorySysCpuUsage(UINT16 mode)
{
UINT64 cpuCycleAll = 0;
UINT64 cpuTimeAll = 0;
UINT64 idleCycleAll = 0;
UINT32 cpupRet = 0;
UINT16 loopNum;
@@ -355,9 +368,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_HistorySysCpuUsage(UINT16 mode)
for (loopNum = 0; loopNum < g_taskMaxNum; loopNum++) {
if (mode == CPUP_IN_1S) {
cpuCycleAll += g_cpup[loopNum].historyTime[curPos] - g_cpup[loopNum].historyTime[prePos];
cpuTimeAll += g_cpup[loopNum].historyTime[curPos] - g_cpup[loopNum].historyTime[prePos];
} else {
cpuCycleAll += g_cpup[loopNum].allTime - g_cpup[loopNum].historyTime[curPos];
cpuTimeAll += g_cpup[loopNum].allTime - g_cpup[loopNum].historyTime[curPos];
}
}
@@ -368,8 +381,8 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_HistorySysCpuUsage(UINT16 mode)
idleCycleAll += g_cpup[g_idleTaskID].allTime - g_cpup[g_idleTaskID].historyTime[curPos];
}
if (cpuCycleAll) {
cpupRet = (LOS_CPUP_PRECISION - (UINT32)((LOS_CPUP_PRECISION * idleCycleAll) / cpuCycleAll));
if (cpuTimeAll) {
cpupRet = (LOS_CPUP_PRECISION - (UINT32)((LOS_CPUP_PRECISION * idleCycleAll) / cpuTimeAll));
}
OsTskCycleStart();
@@ -386,7 +399,7 @@ Return : cpupRet:CPU usage of certain task
*****************************************************************************/
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskCpuUsage(UINT32 taskID)
{
UINT64 cpuCycleAll = 0;
UINT64 cpuTimeAll = 0;
UINT16 loopNum;
UINT32 intSave;
UINT32 cpupRet = 0;
@@ -411,11 +424,11 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskCpuUsage(UINT32 taskID)
if ((g_cpup[loopNum].status & OS_TASK_STATUS_UNUSED) || (g_cpup[loopNum].status == 0)) {
continue;
}
cpuCycleAll += g_cpup[loopNum].allTime;
cpuTimeAll += g_cpup[loopNum].allTime;
}
if (cpuCycleAll) {
cpupRet = (UINT32)((LOS_CPUP_PRECISION * g_cpup[taskID].allTime) / cpuCycleAll);
if (cpuTimeAll) {
cpupRet = (UINT32)((LOS_CPUP_PRECISION * g_cpup[taskID].allTime) / cpuTimeAll);
}
OsTskCycleStart();
@@ -433,8 +446,8 @@ Return : cpupRet:CPU usage history of task
*****************************************************************************/
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_HistoryTaskCpuUsage(UINT32 taskID, UINT16 mode)
{
UINT64 cpuCycleAll = 0;
UINT64 cpuCycleCurTsk = 0;
UINT64 cpuTimeAll = 0;
UINT64 cpuTimeCurTsk = 0;
UINT16 loopNum, curPos;
UINT16 prePos = 0;
UINT32 intSave;
@@ -464,19 +477,19 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_HistoryTaskCpuUsage(UINT32 taskID, UINT16 mode
}
if (mode == CPUP_IN_1S) {
cpuCycleAll += g_cpup[loopNum].historyTime[curPos] - g_cpup[loopNum].historyTime[prePos];
cpuTimeAll += g_cpup[loopNum].historyTime[curPos] - g_cpup[loopNum].historyTime[prePos];
} else {
cpuCycleAll += g_cpup[loopNum].allTime - g_cpup[loopNum].historyTime[curPos];
cpuTimeAll += g_cpup[loopNum].allTime - g_cpup[loopNum].historyTime[curPos];
}
}
if (mode == CPUP_IN_1S) {
cpuCycleCurTsk += g_cpup[taskID].historyTime[curPos] - g_cpup[taskID].historyTime[prePos];
cpuTimeCurTsk += g_cpup[taskID].historyTime[curPos] - g_cpup[taskID].historyTime[prePos];
} else {
cpuCycleCurTsk += g_cpup[taskID].allTime - g_cpup[taskID].historyTime[curPos];
cpuTimeCurTsk += g_cpup[taskID].allTime - g_cpup[taskID].historyTime[curPos];
}
if (cpuCycleAll) {
cpupRet = (UINT32)((LOS_CPUP_PRECISION * cpuCycleCurTsk) / cpuCycleAll);
if (cpuTimeAll) {
cpupRet = (UINT32)((LOS_CPUP_PRECISION * cpuTimeCurTsk) / cpuTimeAll);
}
OsTskCycleStart();
@@ -491,8 +504,8 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_AllTaskCpuUsage(CPUP_INFO_S *cpupInfo, UINT16
UINT16 curPos;
UINT16 prePos = 0;
UINT32 intSave;
UINT64 cpuCycleAll = 0;
UINT64 cpuCycleCurTsk = 0;
UINT64 cpuTimeAll = 0;
UINT64 cpuTimeCurTsk = 0;
if (g_cpupInitFlg == 0) {
return LOS_ERRNO_CPUP_NO_INIT;
@@ -514,9 +527,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_AllTaskCpuUsage(CPUP_INFO_S *cpupInfo, UINT16
}
if (mode == CPUP_IN_1S) {
cpuCycleAll += g_cpup[loopNum].historyTime[curPos] - g_cpup[loopNum].historyTime[prePos];
cpuTimeAll += g_cpup[loopNum].historyTime[curPos] - g_cpup[loopNum].historyTime[prePos];
} else {
cpuCycleAll += g_cpup[loopNum].allTime - g_cpup[loopNum].historyTime[curPos];
cpuTimeAll += g_cpup[loopNum].allTime - g_cpup[loopNum].historyTime[curPos];
}
}
@@ -527,16 +540,16 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_AllTaskCpuUsage(CPUP_INFO_S *cpupInfo, UINT16
}
if (mode == CPUP_IN_1S) {
cpuCycleCurTsk += g_cpup[loopNum].historyTime[curPos] - g_cpup[loopNum].historyTime[prePos];
cpuTimeCurTsk += g_cpup[loopNum].historyTime[curPos] - g_cpup[loopNum].historyTime[prePos];
} else {
cpuCycleCurTsk += g_cpup[loopNum].allTime - g_cpup[loopNum].historyTime[curPos];
cpuTimeCurTsk += g_cpup[loopNum].allTime - g_cpup[loopNum].historyTime[curPos];
}
cpupInfo[loopNum].usStatus = g_cpup[loopNum].status;
if (cpuCycleAll) {
cpupInfo[loopNum].uwUsage = (UINT32)((LOS_CPUP_PRECISION * cpuCycleCurTsk) / cpuCycleAll);
if (cpuTimeAll) {
cpupInfo[loopNum].uwUsage = (UINT32)((LOS_CPUP_PRECISION * cpuTimeCurTsk) / cpuTimeAll);
}
cpuCycleCurTsk = 0;
cpuTimeCurTsk = 0;
}
OsTskCycleStart();
@@ -607,13 +620,13 @@ LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqStart(UINT32 intNum)
return;
}
g_irqCpup[intNum].startTime = LOS_SysCycleGet();
g_irqCpup[intNum].startTime = CpupTimeUsGet();
return;
}
LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqEnd(UINT32 intNum)
{
UINT64 cpuCycle;
UINT64 cpuTime;
UINT64 usedTime;
if (g_irqCpupInitFlg == 0) {
@@ -624,15 +637,14 @@ LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqEnd(UINT32 intNum)
return;
}
cpuCycle = LOS_SysCycleGet();
if (cpuCycle < g_irqCpup[intNum].startTime) {
cpuCycle += g_cyclesPerTick;
cpuTime = CpupTimeUsGet();
if (cpuTime < g_irqCpup[intNum].startTime) {
cpuTime += OS_US_PER_TICK;
}
g_irqCpup[intNum].cpupID = intNum;
g_irqCpup[intNum].status = OS_CPUP_USED;
usedTime = cpuCycle - g_irqCpup[intNum].startTime;
usedTime = cpuTime - g_irqCpup[intNum].startTime;
if (g_irqCpup[intNum].count <= 1000) { /* 1000, Take 1000 samples */
g_irqCpup[intNum].allTime += usedTime;
@@ -674,12 +686,12 @@ LITE_OS_SEC_TEXT_MINOR STATIC VOID OsGetIrqPositions(UINT16 mode, UINT16* curPos
LITE_OS_SEC_TEXT_MINOR STATIC UINT64 OsGetIrqAllTime(VOID)
{
INT32 i;
UINT64 cpuCycleAll = 0;
UINT64 cpuTimeAll = 0;
for (i = 0; i < OS_CPUP_HISTORY_RECORD_NUM; i++) {
cpuCycleAll += g_cpuHistoryTime[i];
cpuTimeAll += g_cpuHistoryTime[i];
}
return cpuCycleAll;
return cpuTimeAll;
}
LITE_OS_SEC_TEXT_MINOR STATIC UINT64 OsGetIrqAllHisTime(UINT32 num)
@@ -699,8 +711,8 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_GetAllIrqCpuUsage(UINT16 mode, CPUP_INFO_S *cp
UINT16 curPos;
UINT16 prePos = 0;
UINT32 intSave;
UINT64 cpuCycleAll;
UINT64 cpuCycleCurIrq;
UINT64 cpuTimeAll;
UINT64 cpuTimeCurIrq;
if (g_irqCpupInitFlg == 0) {
return LOS_ERRNO_CPUP_NO_INIT;
@@ -714,9 +726,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_GetAllIrqCpuUsage(UINT16 mode, CPUP_INFO_S *cp
OsGetIrqPositions(mode, &curPos, &prePos);
if (mode == CPUP_IN_10S) {
cpuCycleAll = OsGetIrqAllTime();
cpuTimeAll = OsGetIrqAllTime();
} else {
cpuCycleAll = g_cpuHistoryTime[curPos] - g_cpuHistoryTime[prePos];
cpuTimeAll = g_cpuHistoryTime[curPos] - g_cpuHistoryTime[prePos];
}
for (loopNum = 0; loopNum < LOSCFG_PLATFORM_HWI_LIMIT; loopNum++) {
@@ -727,13 +739,13 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_GetAllIrqCpuUsage(UINT16 mode, CPUP_INFO_S *cp
cpupInfo[loopNum].usStatus = g_irqCpup[loopNum].status;
if (mode == CPUP_IN_10S) {
cpuCycleCurIrq = OsGetIrqAllHisTime(loopNum);
cpuTimeCurIrq = OsGetIrqAllHisTime(loopNum);
} else {
cpuCycleCurIrq = g_irqCpup[loopNum].historyTime[curPos] - g_irqCpup[loopNum].historyTime[prePos];
cpuTimeCurIrq = g_irqCpup[loopNum].historyTime[curPos] - g_irqCpup[loopNum].historyTime[prePos];
}
if (cpuCycleAll != 0) {
cpupInfo[loopNum].uwUsage = (UINT32)((LOS_CPUP_PRECISION * cpuCycleCurIrq) / cpuCycleAll);
if (cpuTimeAll != 0) {
cpupInfo[loopNum].uwUsage = (UINT32)((LOS_CPUP_PRECISION * cpuTimeCurIrq) / cpuTimeAll);
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -250,7 +250,8 @@ extern UINT32 LOS_SysCpuUsage(VOID);
* This API is used to obtain the historical CPU usage.
* @attention
* <ul>
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails to be obtained.</li>
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails
* to be obtained.</li>
* </ul>
*
* @param mode [IN] UINT16. Task mode. The parameter value 0 indicates that the CPU usage within 10s will be
@@ -273,7 +274,8 @@ extern UINT32 LOS_HistorySysCpuUsage(UINT16 mode);
* This API is used to obtain the CPU usage of a task specified by a passed-in task ID.
* @attention
* <ul>
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails to be obtained.</li>
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails
* to be obtained.</li>
* <li>The passed-in task ID must be valid and the task specified by the task ID must be created. Otherwise,
* the CPU usage fails to be obtained.</li>
* </ul>
@@ -327,7 +329,8 @@ extern UINT32 LOS_HistoryTaskCpuUsage(UINT32 taskID, UINT16 mode);
* This API is used to obtain the CPU usage of all tasks according to maximum number of threads.
* @attention
* <ul>
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails to be obtained.</li>
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails
* to be obtained.</li>
* <li>The input parameter pointer must not be NULL, Otherwise, the CPU usage fails to be obtained.</li>
* </ul>
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 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:
@@ -41,12 +41,6 @@
#include "los_debug.h"
#include "los_mux.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#if (LOSCFG_DYNLINK == 1)
#if defined(__ICCARM__) || defined(__CC_ARM)
@@ -279,7 +273,7 @@ STATIC DynSharedObj *OsLoadInit(const CHAR *fileName, VOID *pool)
goto ERR2;
}
strcpy(dso->buf, fileName);
(void)strcpy_s(dso->buf, nameLen + 1, fileName);
dso->fileName = dso->buf;
dso->ref = 1;
dso->pool = (pool ? pool : OS_SYS_MEM_ADDR);
@@ -867,7 +861,7 @@ STATIC VOID OsDoFini(DynSharedObj *dso)
--func;
finiFunc = (INIT_FINI_FUNC)(*func);
finiFunc();
}
}
}
if (initFiniTab->fini.func != 0) {
@@ -929,10 +923,3 @@ INT32 LOS_DynlinkInit(VOID)
}
#endif /* LOSCFG_DYNLINK */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 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:
@@ -129,8 +129,8 @@ typedef struct {
} DynSharedObj;
typedef struct {
CHAR *name;
UINTPTR addr;
CHAR *name;
UINTPTR addr;
} SymInfo;
#define SYM_EXPORT(func) \

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -54,13 +54,15 @@ extern "C" {
#endif
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == 1)
#define MAX_SWITCH_INFO_SIZE (INFO_TYPE_AND_SIZE + (sizeof(UINT32) + sizeof(CHAR) * LOS_TASK_NAMELEN) * OS_TASK_SWITCH_INFO_COUNT)
#define MAX_SWITCH_INFO_SIZE (INFO_TYPE_AND_SIZE + (sizeof(UINT32) + sizeof(CHAR) * LOS_TASK_NAMELEN) \
* OS_TASK_SWITCH_INFO_COUNT)
#else
#define MAX_SWITCH_INFO_SIZE (0)
#endif
#define MAX_MEM_INFO_SIZE (INFO_TYPE_AND_SIZE + sizeof(MemInfoCB) * OS_SYS_MEM_NUM)
#define MAX_EXC_MEM_SIZE (INFO_TYPE_AND_SIZE + MAX_SCENE_INFO_SIZE + MAX_TSK_INFO_SIZE + MAX_QUEUE_INFO_SIZE + MAX_INT_INFO_SIZE + MAX_SWITCH_INFO_SIZE + MAX_MEM_INFO_SIZE)
#define MAX_EXC_MEM_SIZE (INFO_TYPE_AND_SIZE + MAX_SCENE_INFO_SIZE + MAX_TSK_INFO_SIZE + MAX_QUEUE_INFO_SIZE \
+ MAX_INT_INFO_SIZE + MAX_SWITCH_INFO_SIZE + MAX_MEM_INFO_SIZE)
typedef enum {
OS_EXC_TYPE_CONTEXT = 0,

View File

@@ -32,7 +32,6 @@ config FS_FAT
default n
depends on FS_VFS
select SUPPORT_FATFS
select KAL_CMSIS
help
Answer Y to enable LiteOS support fat filesystem.

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -32,15 +32,82 @@
#define _GNU_SOURCE 1
#include "lfs_adapter.h"
#include "los_config.h"
#include "los_fs.h"
#include "vfs_files.h"
#include "vfs_operations.h"
#include "vfs_partition.h"
#include "vfs_maps.h"
#include "vfs_mount.h"
#include "securec.h"
#include "los_fs.h"
struct dirent g_nameValue;
static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER;
static struct PartitionCfg g_partitionCfg;
static struct DeviceDesc *g_lfsDevice = NULL;
static uint32_t LfsGetStartAddr(int partition)
{
if (g_lfsDevice == NULL) {
struct DeviceDesc *device = NULL;
for (device = getDeviceList(); device != NULL; device = device->dNext) {
if (strcmp(device->dFsType, "littlefs") == 0) {
g_lfsDevice = device;
break;
}
}
}
if ((g_lfsDevice == NULL) || (partition >= g_lfsDevice->dPartNum)) {
return INVALID_DEVICE_ADDR;
}
return (uint32_t)g_lfsDevice->dAddrArray[partition];
}
WEAK int littlefs_block_read(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, void *dst, lfs_size_t size)
{
UINT32 addr = c->block_size * block + off;
UINT32 startaddr = LfsGetStartAddr((int)c->context);
if (startaddr == INVALID_DEVICE_ADDR) {
return -1;
}
addr += startaddr;
return (g_partitionCfg.readFunc)((int)c->context, &addr, dst, size);
}
WEAK int littlefs_block_write(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, const void *dst, lfs_size_t size)
{
UINT32 addr = c->block_size * block + off;
UINT32 startaddr = LfsGetStartAddr((int)c->context);
if (startaddr == INVALID_DEVICE_ADDR) {
return -1;
}
addr += startaddr;
return (g_partitionCfg.writeFunc)((int)c->context, &addr, dst, size);
}
WEAK int littlefs_block_erase(const struct lfs_config *c, lfs_block_t block)
{
UINT32 addr = c->block_size * block;
UINT32 startaddr = LfsGetStartAddr((int)c->context);
if (startaddr == INVALID_DEVICE_ADDR) {
return -1;
}
addr += startaddr;
return (g_partitionCfg.eraseFunc)((int)c->context, addr, c->block_size);
}
WEAK int littlefs_block_sync(const struct lfs_config *c)
{
(void)c;
return 0;
}
static int ConvertFlagToLfsOpenFlag (int oflags)
{
@@ -82,38 +149,69 @@ static int LittlefsErrno(int result)
return (result < 0) ? -result : result;
}
void LfsConfigAdapter(struct PartitionCfg *pCfg, struct lfs_config *lfsCfg)
{
lfsCfg->context = (void *)pCfg->partNo;
lfsCfg->read_size = pCfg->readSize;
lfsCfg->prog_size = pCfg->writeSize;
lfsCfg->cache_size = pCfg->cacheSize;
lfsCfg->block_cycles = pCfg->blockCycles;
lfsCfg->lookahead_size = pCfg->lookaheadSize;
lfsCfg->block_size = pCfg->blockSize;
lfsCfg->block_count = pCfg->blockCount;
lfsCfg->read = littlefs_block_read;
lfsCfg->prog = littlefs_block_write;
lfsCfg->erase = littlefs_block_erase;
lfsCfg->sync = littlefs_block_sync;
g_partitionCfg.readFunc = pCfg->readFunc;
g_partitionCfg.writeFunc = pCfg->writeFunc;
g_partitionCfg.eraseFunc = pCfg->eraseFunc;
}
int LfsMount(struct MountPoint *mp, unsigned long mountflags, const void *data)
{
int ret;
lfs_t *mountHdl = NULL;
struct lfs_config *cfg = NULL;
if ((mp == NULL) || (mp->mPath == NULL) || (data == NULL)) {
errno = EFAULT;
ret = LOS_NOK;
ret = (int)LOS_NOK;
goto errout;
}
mountHdl = (lfs_t *)malloc(sizeof(lfs_t));
if (mountflags & MS_REMOUNT) {
errno = ENOSYS;
ret = (int)LOS_NOK;
goto errout;
}
mountHdl = (lfs_t *)LOSCFG_FS_MALLOC_HOOK(sizeof(lfs_t) + sizeof(struct lfs_config));
if (mountHdl == NULL) {
errno = ENODEV;
ret = LOS_NOK;
ret = (int)LOS_NOK;
goto errout;
}
(void)memset_s(mountHdl, sizeof(lfs_t), 0, sizeof(lfs_t));
(void)memset_s(mountHdl, sizeof(lfs_t) + sizeof(struct lfs_config), 0, sizeof(lfs_t) + sizeof(struct lfs_config));
mp->mData = (void *)mountHdl;
cfg = (void *)((UINTPTR)mountHdl + sizeof(lfs_t));
ret = lfs_mount((lfs_t *)mp->mData, (struct lfs_config *)data);
LfsConfigAdapter((struct PartitionCfg *)data, cfg);
ret = lfs_mount((lfs_t *)mp->mData, cfg);
if (ret != 0) {
ret = lfs_format((lfs_t *)mp->mData, (struct lfs_config*)data);
ret = lfs_format((lfs_t *)mp->mData, cfg);
if (ret == 0) {
ret = lfs_mount((lfs_t *)mp->mData, (struct lfs_config*)data);
ret = lfs_mount((lfs_t *)mp->mData, cfg);
}
}
if (ret != 0) {
free(mountHdl);
LOSCFG_FS_FREE_HOOK(mountHdl);
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
errout:
@@ -126,21 +224,21 @@ int LfsUmount(struct MountPoint *mp)
if (mp == NULL) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if (mp->mData == NULL) {
errno = ENOENT;
return LOS_NOK;
return (int)LOS_NOK;
}
ret = lfs_unmount((lfs_t *)mp->mData);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
free(mp->mData);
LOSCFG_FS_FREE_HOOK(mp->mData);
mp->mData = NULL;
return ret;
}
@@ -151,18 +249,18 @@ int LfsUnlink(struct MountPoint *mp, const char *fileName)
if ((mp == NULL) || (fileName == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if (mp->mData == NULL) {
errno = ENOENT;
return LOS_NOK;
return (int)LOS_NOK;
}
ret = lfs_remove((lfs_t *)mp->mData, fileName);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
return ret;
@@ -174,12 +272,12 @@ int LfsMkdir(struct MountPoint *mp, const char *dirName)
if ((dirName == NULL) || (mp == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if (mp->mData == NULL) {
errno = ENOENT;
return LOS_NOK;
return (int)LOS_NOK;
}
lfs_t *lfs = (lfs_t *)mp->mData;
@@ -187,7 +285,7 @@ int LfsMkdir(struct MountPoint *mp, const char *dirName)
ret = lfs_mkdir(lfs, dirName);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
return ret;
@@ -200,25 +298,25 @@ int LfsRmdir(struct MountPoint *mp, const char *dirName)
if (mp == NULL) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if (mp->mData == NULL) {
errno = ENOENT;
return LOS_NOK;
return (int)LOS_NOK;
}
lfs = (lfs_t *)mp->mData;
if (dirName == NULL) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
ret = lfs_remove(lfs, dirName);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
return ret;
@@ -230,20 +328,20 @@ int LfsOpendir(struct Dir *dir, const char *dirName)
if ((dir == NULL) || (dir->dMp == NULL) || (dir->dMp->mData == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
lfs_t *lfs = (lfs_t *)dir->dMp->mData;
lfs_dir_t *dirInfo = (lfs_dir_t *)malloc(sizeof(lfs_dir_t));
lfs_dir_t *dirInfo = (lfs_dir_t *)LOSCFG_FS_MALLOC_HOOK(sizeof(lfs_dir_t));
if (dirInfo == NULL) {
errno = ENOMEM;
return LOS_NOK;
return (int)LOS_NOK;
}
(void)memset_s(dirInfo, sizeof(lfs_dir_t), 0, sizeof(lfs_dir_t));
ret = lfs_dir_open(lfs, dirInfo, dirName);
if (ret != 0) {
free(dirInfo);
LOSCFG_FS_FREE_HOOK(dirInfo);
errno = LittlefsErrno(ret);
goto errout;
}
@@ -254,7 +352,7 @@ int LfsOpendir(struct Dir *dir, const char *dirName)
return LOS_OK;
errout:
return LOS_NOK;
return (int)LOS_NOK;
}
int LfsReaddir(struct Dir *dir, struct dirent *dent)
@@ -265,12 +363,12 @@ int LfsReaddir(struct Dir *dir, struct dirent *dent)
if ((dir == NULL) || (dir->dMp == NULL) || (dir->dMp->mData == NULL) ||
(dent == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if (dir->dData == NULL) {
errno = EBADF;
return LOS_NOK;
return (int)LOS_NOK;
}
lfs_t *lfs = (lfs_t *)dir->dMp->mData;
@@ -278,7 +376,6 @@ int LfsReaddir(struct Dir *dir, struct dirent *dent)
ret = lfs_dir_read(lfs, dirInfo, &lfsInfo);
if (ret == TRUE) {
pthread_mutex_lock(&g_FslocalMutex);
(void)strncpy_s(dent->d_name, sizeof(dent->d_name), lfsInfo.name, strlen(lfsInfo.name) + 1);
if (lfsInfo.type == LFS_TYPE_DIR) {
dent->d_type = DT_DIR;
@@ -287,7 +384,6 @@ int LfsReaddir(struct Dir *dir, struct dirent *dent)
}
dent->d_reclen = lfsInfo.size;
pthread_mutex_unlock(&g_FslocalMutex);
return LOS_OK;
}
@@ -296,7 +392,7 @@ int LfsReaddir(struct Dir *dir, struct dirent *dent)
errno = LittlefsErrno(ret);
}
return LOS_NOK;
return (int)LOS_NOK;
}
int LfsClosedir(struct Dir *dir)
@@ -305,12 +401,12 @@ int LfsClosedir(struct Dir *dir)
if ((dir == NULL) || (dir->dMp == NULL) || (dir->dMp->mData == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if (dir->dData == NULL) {
errno = EBADF;
return LOS_NOK;
return (int)LOS_NOK;
}
lfs_t *lfs = (lfs_t *)dir->dMp->mData;
@@ -319,10 +415,10 @@ int LfsClosedir(struct Dir *dir)
ret = lfs_dir_close(lfs, dirInfo);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
free(dirInfo);
LOSCFG_FS_FREE_HOOK(dirInfo);
dir->dData = NULL;
return ret;
@@ -336,19 +432,19 @@ int LfsOpen(struct File *file, const char *pathName, int openFlag)
if ((pathName == NULL) || (file == NULL) || (file->fMp == NULL) ||
(file->fMp->mData == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
lfsHandle = (lfs_file_t *)malloc(sizeof(lfs_file_t));
lfsHandle = (lfs_file_t *)LOSCFG_FS_MALLOC_HOOK(sizeof(lfs_file_t));
if (lfsHandle == NULL) {
errno = ENOMEM;
return LOS_NOK;
return (int)LOS_NOK;
}
int lfsOpenFlag = ConvertFlagToLfsOpenFlag(openFlag);
ret = lfs_file_open((lfs_t *)file->fMp->mData, lfsHandle, pathName, lfsOpenFlag);
if (ret != 0) {
free(lfsHandle);
LOSCFG_FS_FREE_HOOK(lfsHandle);
errno = LittlefsErrno(ret);
goto errout;
}
@@ -368,25 +464,25 @@ int LfsRead(struct File *file, char *buf, size_t len)
if (buf == NULL) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if ((file == NULL) || (file->fData == NULL)) {
errno = EBADF;
return LOS_NOK;
return (int)LOS_NOK;
}
lfsHandle = (lfs_file_t *)file->fData;
mp = file->fMp;
if ((mp == NULL) || (mp->mData == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
ret = lfs_file_read((lfs_t *)mp->mData, lfsHandle, buf, len);
if (ret < 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
return ret;
}
@@ -399,25 +495,25 @@ int LfsWrite(struct File *file, const char *buf, size_t len)
if (buf == NULL) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if ((file == NULL) || (file->fData == NULL)) {
errno = EBADF;
return LOS_NOK;
return (int)LOS_NOK;
}
lfsHandle = (lfs_file_t *)file->fData;
mp = file->fMp;
if ((mp == NULL) || (mp->mData == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
ret = lfs_file_write((lfs_t *)mp->mData, lfsHandle, buf, len);
if (ret < 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
return ret;
}
@@ -430,20 +526,20 @@ off_t LfsSeek(struct File *file, off_t offset, int whence)
if ((file == NULL) || (file->fData == NULL)) {
errno = EBADF;
return LOS_NOK;
return (off_t)LOS_NOK;
}
lfsHandle = (lfs_file_t *)file->fData;
mp = file->fMp;
if ((mp == NULL) || (mp->mData == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (off_t)LOS_NOK;
}
ret = (off_t)lfs_file_seek((lfs_t *)mp->mData, lfsHandle, offset, whence);
if (ret < 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (off_t)LOS_NOK;
}
return ret;
@@ -451,32 +547,29 @@ off_t LfsSeek(struct File *file, off_t offset, int whence)
int LfsClose(struct File *file)
{
INT32 ret;
int ret;
struct MountPoint *mp = NULL;
lfs_file_t *lfsHandle = NULL;
if ((file == NULL) || (file->fData == NULL)) {
errno = EBADF;
return LOS_NOK;
return (int)LOS_NOK;
}
lfsHandle = (lfs_file_t *)file->fData;
mp = file->fMp;
if ((mp == NULL) || (mp->mData == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
pthread_mutex_lock(&g_FslocalMutex);
ret = lfs_file_close((lfs_t *)mp->mData, lfsHandle);
pthread_mutex_unlock(&g_FslocalMutex);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
free(file->fData);
LOSCFG_FS_FREE_HOOK(file->fData);
file->fData = NULL;
return ret;
}
@@ -487,18 +580,18 @@ int LfsRename(struct MountPoint *mp, const char *oldName, const char *newName)
if ((mp == NULL) || (oldName == NULL) || (newName == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if (mp->mData == NULL) {
errno = ENOENT;
return LOS_NOK;
return (int)LOS_NOK;
}
ret = lfs_rename((lfs_t *)mp->mData, oldName, newName);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
return ret;
@@ -511,12 +604,12 @@ int LfsStat(struct MountPoint *mp, const char *path, struct stat *buf)
if ((mp == NULL) || (path == NULL) || (buf == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
if (mp->mData == NULL) {
errno = ENOENT;
return LOS_NOK;
return (int)LOS_NOK;
}
ret = lfs_stat((lfs_t *)mp->mData, path, &info);
@@ -529,7 +622,7 @@ int LfsStat(struct MountPoint *mp, const char *path, struct stat *buf)
}
} else {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
return ret;
@@ -542,19 +635,37 @@ int LfsSync(struct File *file)
if ((file == NULL) || (file->fData == NULL)) {
errno = EBADF;
return LOS_NOK;
return (int)LOS_NOK;
}
if ((file->fMp == NULL) || (file->fMp->mData == NULL)) {
errno = EFAULT;
return LOS_NOK;
return (int)LOS_NOK;
}
mp = file->fMp;
ret = lfs_file_sync((lfs_t *)mp->mData, (lfs_file_t *)file->fData);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = LOS_NOK;
ret = (int)LOS_NOK;
}
return ret;
}
int LfsFormat(const char *partName, void *privData)
{
int ret;
lfs_t lfs = {0};
struct lfs_config cfg = {0};
(void)partName;
LfsConfigAdapter((struct PartitionCfg *)privData, &cfg);
ret = lfs_format(&lfs, &cfg);
if (ret != 0) {
errno = LittlefsErrno(ret);
ret = (int)LOS_NOK;
}
return ret;
}
@@ -587,7 +698,7 @@ static struct FileOps g_lfsFops = {
static struct FsManagement g_lfsMgt = {
.fdisk = NULL,
.format = NULL,
.format = LfsFormat,
};
void LfsInit(void)

View File

@@ -45,6 +45,6 @@
#include "pthread.h"
#define INVALID_FD (-1)
#define INVALID_DEVICE_ADDR ((uint32_t)-1)
void LfsInit(void);
#endif /* _LFS_ADAPTER_H_ */

View File

@@ -50,7 +50,9 @@ kernel_module(module_name) {
deps = [ "//kernel/liteos_m/kal" ]
configs += [ "$LITEOSTOPDIR:warn_config" ]
cflags = [ "-Wno-parentheses" ]
if (!defined(LOSCFG_COMPILER_ICCARM)) {
cflags = [ "-Wno-parentheses" ]
}
}
config("public") {

View File

@@ -30,6 +30,23 @@
config FS_VFS
bool "Enable FS VFS"
default y
select POSIX_FS_API
help
Answer Y to enable LiteOS support VFS.
if FS_VFS
config FS_LOCK_TIMEOUT
int "Filesystem global lock timeout value in tick. -1 for waiting forever"
default -1
help
The timeout value of getting filesystem lock in tick. -1 for waiting forever
config FS_SUPPORT_MOUNT_TARGET_RECURSIVE
bool "Mount target can be recursive"
default n
depends on FS_VFS
help
Answer Y to enable LiteOS support VFS mount recursively. For example, "/system/bin".
endif

View File

@@ -38,12 +38,15 @@
#define _LOS_FS_H_
#include "los_config.h"
#include "los_memory.h"
#include "dirent.h"
#include "sys/mount.h"
#include "sys/statfs.h"
#include "sys/stat.h"
#include "sys/uio.h"
#include "unistd.h"
#include <stdarg.h>
#include "vfs_maps.h"
#ifdef __cplusplus
#if __cplusplus
@@ -51,37 +54,33 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int LOS_Open(const char *path, int flags, ...);
int LOS_Close(int fd);
ssize_t LOS_Read(int fd, void *buff, size_t bytes);
ssize_t LOS_Write(int fd, const void *buff, size_t bytes);
off_t LOS_Lseek(int fd, off_t off, int whence);
int LOS_Stat(const char *path, struct stat *stat);
int LOS_Statfs(const char *path, struct statfs *buf);
int LOS_Unlink(const char *path);
int LOS_Rename(const char *oldpath, const char *newpath);
int LOS_Fsync(int fd);
DIR *LOS_Opendir(const char *path);
struct dirent *LOS_Readdir(DIR *dir);
int LOS_Closedir(DIR *dir);
int LOS_Mkdir(const char *path, mode_t mode);
int LOS_Rmdir(const char *path);
int LOS_Lstat(const char *path, struct stat *buffer);
int LOS_Fstat(int fd, struct stat *buf);
int LOS_Fcntl(int fd, int cmd, ...);
int LOS_Ioctl(int fd, int req, ...);
ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt);
ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt);
ssize_t LOS_Pread(int fd, void *buff, size_t bytes, off_t off);
ssize_t LOS_Pwrite(int fd, const void *buff, size_t bytes, off_t off);
int LOS_Isatty(int fd);
int LOS_Access(const char *path, int amode);
int LOS_Ftruncate(int fd, off_t length);
int LOS_FsUmount(const char *target);
int LOS_FsUmount2(const char *target, int flag);
int LOS_FsMount(const char *source, const char *target,
const char *fsType, unsigned long mountflags,
const void *data);
#ifndef LOSCFG_FS_MALLOC_HOOK
#define LOSCFG_FS_MALLOC_HOOK(size) LOS_MemAlloc((VOID *)OS_SYS_MEM_ADDR, size)
#endif
#ifndef LOSCFG_FS_FREE_HOOK
#define LOSCFG_FS_FREE_HOOK(ptr) LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, ptr)
#endif
struct PartitionCfg {
/* partition low-level read func */
int (*readFunc)(int partition, UINT32 *offset, void *buf, UINT32 size);
/* partition low-level write func */
int (*writeFunc)(int partition, UINT32 *offset, const void *buf, UINT32 size);
/* partition low-level erase func */
int (*eraseFunc)(int partition, UINT32 offset, UINT32 size);
int readSize; /* size of a block read */
int writeSize; /* size of a block write */
int blockSize; /* size of an erasable block */
int blockCount; /* number of partition blocks */
int cacheSize; /* size of block caches */
int partNo; /* partition number */
int lookaheadSize; /* lookahead size */
int blockCycles; /* block cycles */
};
/*
* @brief Divide the device into partitions.
*
@@ -93,6 +92,7 @@ int LOS_FsMount(const char *source, const char *target,
* @param lengthArray List of partition size. For example:
* [0x10000000, 0x2000000], 256M and 512M partitions will be created and
* left all will not allocated.
* @param addrArray List of partition start addr, partition num same as lengthArray
* @param partNum Length of 'lengthArray'.
*
* @return Return LOS_NOK if error. Return LOS_OK if success.
@@ -103,8 +103,8 @@ int LOS_FsMount(const char *source, const char *target,
* The name is a combination of: 'deviceName'+'p'+'partitionId',
* such as "emmc0p0", "emmc0p1", "emmc0p2"...
*/
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray,
int partnum);
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray, int *addrArray,
int partNum);
/*
* @brief Format a partition.
@@ -118,6 +118,39 @@ int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray,
*/
int LOS_PartitionFormat(const char *partName, char *fsType, void *data);
/*
* @brief new file system callbacks register.
* These callback functions are the adaptation layer implemented by the developer,
* used to interconnect the vfs with the new file system.
*
* LOS_FsRegister must be called after kernel initialization is complete.
*
* @param fsType file system type, don't register the same type fs more than once.
* @param fsMops mount operation of the fs.
* @param fsFops file operation of the fs.
* @param fsMgt management operation of the fs.
*
* @return Return LOS_OK if success.
* Return LOS_NOK if error.
* errno EINVAL: input errors, such as null pointers.
* errno ENOMEM: memory may malloc failed.
*
*/
int LOS_FsRegister(const char *fsType, const struct MountOps *fsMops,
const struct FileOps *fsFops, const struct FsManagement *fsMgt);
/*
* @brief Lock the whole filesystem to forbid filesystem access.
*
* @return Return LOS_NOK if error. Return LOS_OK if seccess.
*/
int LOS_FsLock(void);
/*
* @brief Unlock the whole filesystem to allow filesystem access.
*/
void LOS_FsUnlock(void);
#ifdef __cplusplus
#if __cplusplus
extern "C" {

View File

@@ -49,21 +49,17 @@
#ifdef LOSCFG_FS_FAT
#include "fatfs_conf.h"
#define __FAT_NFILE FAT_MAX_OPEN_FILES
#else
#define __FAT_NFILE 0
#endif
#ifdef LOSCFG_FS_LITTLEFS
#include "lfs_conf.h"
#define __LFS_NFILE LOSCFG_LFS_MAX_OPEN_FILES
#else
#define __LFS_NFILE 0
#endif
#define CONFIG_NFILE_DESCRIPTORS (__FAT_NFILE + __LFS_NFILE)
#ifndef CONFIG_NFILE_DESCRIPTORS
#define CONFIG_NFILE_DESCRIPTORS 256
#endif
#define NR_OPEN_DEFAULT CONFIG_NFILE_DESCRIPTORS
#define NR_OPEN_DEFAULT (CONFIG_NFILE_DESCRIPTORS - MIN_START_FD)
/* time configure */
@@ -88,4 +84,9 @@
#define MAX_DIRENT_NUM 14 // 14 means 4096 length buffer can store 14 dirent, see struct DIR
/* max number of open directories */
#ifndef LOSCFG_MAX_OPEN_DIRS
#define LOSCFG_MAX_OPEN_DIRS 10
#endif
#endif

View File

@@ -39,10 +39,10 @@
static struct File g_files[NR_OPEN_DEFAULT];
int FileToFd(struct File *file)
int FileToFd(const struct File *file)
{
if (file == NULL) {
return LOS_NOK;
return (int)LOS_NOK;
}
return file - g_files + MIN_START_FD;
}

View File

@@ -89,7 +89,7 @@ struct Dir {
void *dData;
};
int FileToFd(struct File *file);
int FileToFd(const struct File *file);
struct File *FdToFile(int fd);
struct File *VfsFileGet(void);
struct File *VfsFileGetSpec(int fd);

File diff suppressed because it is too large Load Diff

View File

@@ -41,7 +41,7 @@
int OsVfsInit(void)
{
if (LOS_MuxCreate(&g_fsMutex) != LOS_OK) {
return LOS_NOK;
return (int)LOS_NOK;
}
#if (LOSCFG_SUPPORT_FATFS == 1)
FatFsInit();

View File

@@ -4,7 +4,8 @@
* 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. *
* 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.
@@ -32,6 +33,7 @@
#include "securec.h"
#include "los_debug.h"
#include "los_compiler.h"
#include "los_fs.h"
struct FsMap *g_fsMap = NULL;
@@ -39,49 +41,67 @@ struct FsMap *VfsFsMapGet(const char *fsType)
{
struct FsMap *curr = g_fsMap;
(void)VfsLock();
(void)LOS_FsLock();
while (curr != NULL) {
if ((curr->fsType != NULL) && (fsType != NULL) &&
(strcmp(curr->fsType, fsType) == 0)) {
(void)VfsUnlock();
LOS_FsUnlock();
return curr;
}
curr = curr->next;
}
VfsUnlock();
LOS_FsUnlock();
return NULL;
}
int OsFsRegister(const char *fsType, struct MountOps *fsMops,
struct FileOps *fsFops, struct FsManagement *fsMgt)
int OsFsRegister(const char *fsType, const struct MountOps *fsMops,
const struct FileOps *fsFops, const struct FsManagement *fsMgt)
{
size_t len;
if ((fsMops == NULL) || (fsFops == NULL)) {
return LOS_NOK;
VFS_ERRNO_SET(EINVAL);
return (int)LOS_NOK;
}
struct FsMap *newfs = (struct FsMap *)malloc(sizeof(struct FsMap));
struct FsMap *newfs = (struct FsMap *)LOSCFG_FS_MALLOC_HOOK(sizeof(struct FsMap));
if (newfs == NULL) {
PRINT_ERR("Fs register malloc failed, fsType %s.\n", fsType);
return LOS_NOK;
VFS_ERRNO_SET(ENOMEM);
return (int)LOS_NOK;
}
(void)memset_s(newfs, sizeof(struct FsMap), 0, sizeof(struct FsMap));
newfs->fsType = strdup(fsType);
len = strlen(fsType) + 1;
newfs->fsType = LOSCFG_FS_MALLOC_HOOK(len);
if (newfs->fsType == NULL) {
free(newfs);
return LOS_NOK;
LOSCFG_FS_FREE_HOOK(newfs);
VFS_ERRNO_SET(ENOMEM);
return (int)LOS_NOK;
}
(void)strcpy_s((char *)newfs->fsType, len, fsType);
newfs->fsMops = fsMops;
newfs->fsFops = fsFops;
newfs->fsMgt = fsMgt;
newfs->fsRefs = 0;
(void)VfsLock();
(void)LOS_FsLock();
newfs->next = g_fsMap;
g_fsMap = newfs;
VfsUnlock();
LOS_FsUnlock();
return LOS_OK;
}
int LOS_FsRegister(const char *fsType, const struct MountOps *fsMops,
const struct FileOps *fsFops, const struct FsManagement *fsMgt)
{
if (VfsFsMapGet(fsType) != NULL) {
PRINT_ERR("fsType has been registered or fsType error\n");
VFS_ERRNO_SET(EINVAL);
return (int)LOS_NOK;
}
return OsFsRegister(fsType, fsMops, fsFops, fsMgt);
}

View File

@@ -56,8 +56,8 @@ struct FsMap {
struct FsMap *next;
};
int OsFsRegister(const char *fsType, struct MountOps *fsMops,
struct FileOps *fsFops, struct FsManagement *fsMgt);
int OsFsRegister(const char *fsType, const struct MountOps *fsMops,
const struct FileOps *fsFops, const struct FsManagement *fsMgt);
struct FsMap *VfsFsMapGet(const char *fsType);
#ifdef __cplusplus

View File

@@ -33,6 +33,9 @@
#include "vfs_config.h"
#include "stdlib.h"
#include "string.h"
#include "limits.h"
#include "errno.h"
#include "securec.h"
#include "vfs_operations.h"
#include "los_compiler.h"
#include "los_debug.h"
@@ -60,14 +63,13 @@ static void MpDeleteFromList(struct MountPoint *mp)
}
}
#if (LOSCFG_FS_SUPPORT_MOUNT_TARGET_RECURSIVE == 1)
struct MountPoint *VfsMpFind(const char *path, const char **pathInMp)
{
struct MountPoint *mp = g_mountPoints;
struct MountPoint *bestMp = NULL;
int bestMatches = 0;
if (path == NULL) {
return NULL;
}
if (pathInMp != NULL) {
*pathInMp = NULL;
}
@@ -119,53 +121,171 @@ struct MountPoint *VfsMpFind(const char *path, const char **pathInMp)
next:
mp = mp->mNext;
}
return bestMp;
}
int LOS_FsMount(const char *source, const char *target,
const char *fsType, unsigned long mountflags,
const void *data)
#else
struct MountPoint *VfsMpFind(const char *path, const char **pathInMp)
{
int ret;
struct MountPoint *mp = NULL;
const char *pathInMp = NULL;
struct MountPoint *mp = g_mountPoints;
const char *iPath = path;
const char *mPath = NULL;
const char *target = NULL;
/* target must begin with '/', for example /system, /data, etc. */
if ((target == NULL) || (target[0] != '/')) {
return LOS_NOK;
if (pathInMp != NULL) {
*pathInMp = NULL;
}
while (*iPath == '/') {
++iPath;
}
(void)VfsLock();
while ((mp != NULL) && (mp->mPath != NULL)) {
mPath = mp->mPath;
target = iPath;
while (*mPath == '/') {
++mPath;
}
while ((*mPath != '\0') && (*mPath != '/') &&
(*target != '\0') && (*target != '/')) {
if (*mPath != *target) {
break;
}
++mPath;
++target;
}
if (((*mPath == '\0') || (*mPath == '/')) &&
((*target == '\0') || (*target == '/'))) {
if (pathInMp != NULL) {
*pathInMp = path;
}
return mp;
}
mp = mp->mNext;
}
return NULL;
}
#endif
STATIC struct MountPoint *VfsMountPointInit(const char *source, const char *target,
const char *fsType, unsigned long mountflags)
{
struct MountPoint *mp = NULL;
const char *pathInMp = NULL;
struct FsMap *mFs = NULL;
size_t ssize = 0;
size_t tsize;
/* find mp by target, to see if it was mounted */
mp = VfsMpFind(target, &pathInMp);
if (mp != NULL && pathInMp != NULL) {
goto errout;
errno = EINVAL;
return NULL;
}
/* Find fsMap coresponding to the fsType */
struct FsMap *mFs = VfsFsMapGet(fsType);
if ((mFs == NULL) || (mFs->fsMops == NULL) ||
(mFs->fsMops->mount == NULL)) {
goto errout;
mFs = VfsFsMapGet(fsType);
if ((mFs == NULL) || (mFs->fsMops == NULL) || (mFs->fsMops->mount == NULL)) {
errno = ENODEV;
return NULL;
}
mp = (struct MountPoint *)malloc(sizeof(struct MountPoint));
if (source != NULL) {
ssize = strlen(source) + 1;
}
tsize = strlen(target) + 1;
mp = (struct MountPoint *)LOSCFG_FS_MALLOC_HOOK(sizeof(struct MountPoint) + ssize + tsize);
if (mp == NULL) {
goto errout;
errno = ENOMEM;
return NULL;
}
mp->mFs = mFs;
mp->mDev = NULL;
if (source != NULL) {
mp->mDev = strdup(source);
if (mp->mDev == NULL) {
goto errout;
}
mp->mRefs = 0;
mp->mWriteEnable = (mountflags & MS_RDONLY) ? FALSE : TRUE;
mp->mFs->fsRefs++;
if (source != NULL && strcpy_s((char *)mp + sizeof(struct MountPoint), ssize, source) != EOK) {
LOSCFG_FS_FREE_HOOK(mp);
errno = ENOMEM;
return NULL;
}
mp->mPath = strdup(target);
if (mp->mPath == NULL) {
goto errout;
if (strcpy_s((char *)mp + sizeof(struct MountPoint) + ssize, tsize, target) != EOK) {
LOSCFG_FS_FREE_HOOK(mp);
errno = ENOMEM;
return NULL;
}
mp->mDev = source ? (char *)mp + sizeof(struct MountPoint) : NULL;
mp->mPath = (char *)mp + sizeof(struct MountPoint) + ssize;
return mp;
}
STATIC int VfsRemount(const char *source, const char *target,
const char *fsType, unsigned long mountflags,
const void *data)
{
(VOID)source;
(VOID)fsType;
struct MountPoint *mp;
mp = VfsMpFind(target, NULL);
if (mp == NULL) {
errno = EINVAL;
return (int)LOS_NOK;
}
LOS_ASSERT(mp->mFs != NULL);
LOS_ASSERT(mp->mFs->fsMops != NULL);
LOS_ASSERT(mp->mFs->fsMops->mount != NULL);
return mp->mFs->fsMops->mount(mp, mountflags, data);
}
STATIC int VfsMountPathCheck(const char *target)
{
/* target must begin with '/', for example /system, /data, etc. */
if ((target == NULL) || (target[0] != '/')) {
errno = EINVAL;
return (int)LOS_NOK;
}
if (strlen(target) >= PATH_MAX) {
errno = ENAMETOOLONG;
return (int)LOS_NOK;
}
return LOS_OK;
}
int mount(const char *source, const char *target,
const char *fsType, unsigned long mountflags,
const void *data)
{
int ret;
struct MountPoint *mp = NULL;
if (VfsMountPathCheck(target) != LOS_OK) {
return (int)LOS_NOK;
}
(void)LOS_FsLock();
if (mountflags & MS_REMOUNT) {
ret = VfsRemount(source, target, fsType, mountflags, data);
LOS_FsUnlock();
return ret;
}
mp = VfsMountPointInit(source, target, fsType, mountflags);
if (mp == NULL) {
LOS_FsUnlock();
return (int)LOS_NOK;
}
ret = mp->mFs->fsMops->mount(mp, mountflags, data);
@@ -174,34 +294,29 @@ int LOS_FsMount(const char *source, const char *target,
PRINT_ERR("mount failed, target %s.\n", target);
goto errout;
}
mp->mRefs = 0;
mp->mWriteEnable = (mountflags & MS_RDONLY) ? FALSE : TRUE;
mp->mFs->fsRefs++;
mp->mNext = g_mountPoints;
g_mountPoints = mp;
VfsUnlock();
LOS_FsUnlock();
return LOS_OK;
errout:
free((void *)mp->mPath);
free((void *)mp->mDev);
free(mp);
VfsUnlock();
return LOS_NOK;
LOSCFG_FS_FREE_HOOK(mp);
LOS_FsUnlock();
return (int)LOS_NOK;
}
int LOS_FsUmount(const char *target)
int umount(const char *target)
{
struct MountPoint *mp = NULL;
const char *pathInMp = NULL;
int ret = LOS_NOK;
int ret = (int)LOS_NOK;
(void)VfsLock();
if (target == NULL) {
(void)LOS_FsLock();
if (VfsMountPathCheck(target) != LOS_OK) {
goto errout;
}
mp = VfsMpFind(target, &pathInMp);
mp = VfsMpFind(target, NULL);
if ((mp == NULL) || (mp->mRefs != 0)) {
goto errout;
}
@@ -220,20 +335,18 @@ int LOS_FsUmount(const char *target)
/* delete mp from mount list */
MpDeleteFromList(mp);
mp->mFs->fsRefs--;
free((void *)mp->mPath);
free((void *)mp->mDev);
free(mp);
LOSCFG_FS_FREE_HOOK(mp);
VfsUnlock();
LOS_FsUnlock();
return LOS_OK;
errout:
PRINT_ERR("umount2 failed, target %s.\n", target);
VfsUnlock();
return LOS_NOK;
LOS_FsUnlock();
return (int)LOS_NOK;
}
static void CloseFdsInMp(struct MountPoint *mp)
static void CloseFdsInMp(const struct MountPoint *mp)
{
for (int fd = 0; fd < NR_OPEN_DEFAULT; fd++) {
struct File *f = FdToFile(fd);
@@ -248,18 +361,17 @@ static void CloseFdsInMp(struct MountPoint *mp)
}
}
int LOS_FsUmount2(const char *target, int flag)
int umount2(const char *target, int flag)
{
struct MountPoint *mp = NULL;
const char *pathInMp = NULL;
int ret = LOS_NOK;
int ret = (int)LOS_NOK;
(void)VfsLock();
if (target == NULL) {
(void)LOS_FsLock();
if (VfsMountPathCheck(target) != LOS_OK) {
goto errout;
}
mp = VfsMpFind(target, &pathInMp);
mp = VfsMpFind(target, NULL);
if ((mp == NULL) || (mp->mRefs != 0) ||
(mp->mFs == NULL) || (mp->mFs->fsMops == NULL) ||
(mp->mFs->fsMops->umount2 == NULL)) {
@@ -280,15 +392,13 @@ int LOS_FsUmount2(const char *target, int flag)
/* delete mp from mount list */
MpDeleteFromList(mp);
mp->mFs->fsRefs--;
free((void *)mp->mPath);
free((void *)mp->mDev);
free(mp);
LOSCFG_FS_FREE_HOOK(mp);
VfsUnlock();
LOS_FsUnlock();
return LOS_OK;
errout:
PRINT_ERR("umount2 failed, target %s.\n", target);
VfsUnlock();
return LOS_NOK;
LOS_FsUnlock();
return (int)LOS_NOK;
}

View File

@@ -52,8 +52,6 @@ extern "C" {
extern UINT32 g_fsMutex;
int OsVfsInit(void);
int VfsLock(void);
void VfsUnlock(void);
#ifdef __cplusplus
#if __cplusplus

View File

@@ -37,25 +37,27 @@
#include "stdlib.h"
#include "string.h"
static struct DeviceDesc *g_deviceList = NULL;
int GetPartIdByPartName(const char *partName)
{
if (partName == NULL) {
return LOS_NOK;
return (int)LOS_NOK;
}
/* the character next to p is the partId */
char *p = strrchr(partName, 'p');
if (p + 1 != NULL) {
if (p != NULL) {
return atoi(p + 1);
}
return LOS_NOK;
return (int)LOS_NOK;
}
int GetDevIdByDevName(const char *dev)
{
if (dev == NULL) {
return LOS_NOK;
return (int)LOS_NOK;
}
/* last character is the deviceId */
@@ -64,34 +66,106 @@ int GetDevIdByDevName(const char *dev)
return atoi(p);
}
return LOS_NOK;
return (int)LOS_NOK;
}
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray,
int partnum)
struct DeviceDesc *getDeviceList(VOID)
{
int ret = LOS_NOK;
return g_deviceList;
}
static int AddDevice(const char *dev, const char *fsType, int *lengthArray, int *addrArray,
int partNum)
{
size_t len;
struct DeviceDesc *prev = NULL;
for (prev = g_deviceList; prev != NULL; prev = prev->dNext) {
if (strcmp(prev->dDev, dev) == 0) {
errno = -EEXIST;
return (int)LOS_NOK;
}
}
if (addrArray == NULL) {
errno = -EFAULT;
return (int)LOS_NOK;
}
prev = (struct DeviceDesc *)LOSCFG_FS_MALLOC_HOOK(sizeof(struct DeviceDesc));
if (prev == NULL) {
errno = -ENOMEM;
return (int)LOS_NOK;
}
len = strlen(dev) + 1;
prev->dDev = LOSCFG_FS_MALLOC_HOOK(len);
len = strlen(fsType) + 1;
prev->dFsType = LOSCFG_FS_MALLOC_HOOK(len);
prev->dAddrArray = (int *)LOSCFG_FS_MALLOC_HOOK(partNum * sizeof(int));
if (prev->dDev == NULL || prev->dFsType == NULL || prev->dAddrArray == NULL) {
goto errout;
}
(void)strcpy_s((char *)prev->dDev, len, dev);
(void)strcpy_s((char *)prev->dFsType, len, fsType);
(void)memcpy_s(prev->dAddrArray, partNum * sizeof(int), addrArray, partNum * sizeof(int));
if (lengthArray != NULL) {
prev->dLengthArray = (int *)LOSCFG_FS_MALLOC_HOOK(partNum * sizeof(int));
if (prev->dLengthArray == NULL) {
goto errout;
}
(void)memcpy_s(prev->dLengthArray, partNum * sizeof(int), lengthArray, partNum * sizeof(int));
}
prev->dNext = g_deviceList;
prev->dPartNum = partNum;
g_deviceList = prev;
return LOS_OK;
errout:
if (prev->dDev != NULL) {
LOSCFG_FS_FREE_HOOK((void *)prev->dDev);
}
if (prev->dFsType != NULL) {
LOSCFG_FS_FREE_HOOK((void *)prev->dFsType);
}
if (prev->dAddrArray != NULL) {
LOSCFG_FS_FREE_HOOK((void *)prev->dAddrArray);
}
if (prev->dLengthArray != NULL) {
LOSCFG_FS_FREE_HOOK((void *)prev->dLengthArray);
}
LOSCFG_FS_FREE_HOOK(prev);
errno = -ENOMEM;
return (int)LOS_NOK;
}
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray, int *addrArray,
int partNum)
{
int ret = (int)LOS_NOK;
struct FsMap *fMap = VfsFsMapGet(fsType);
if ((fMap != NULL) && (fMap->fsMgt != NULL) &&
(fMap->fsMgt->fdisk != NULL)) {
ret = fMap->fsMgt->fdisk(dev, lengthArray, partnum);
ret = fMap->fsMgt->fdisk(dev, lengthArray, partNum);
return ret;
}
ret = AddDevice(dev, fsType, lengthArray, addrArray, partNum);
return ret;
}
int LOS_PartitionFormat(const char *partName, char *fsType, void *data)
{
int ret = LOS_NOK;
int ret = (int)LOS_NOK;
/* check if the device is mounted by iterate the mp list
format is not allowed when the device has been mounted. */
struct MountPoint *iter = NULL;
LOS_MP_FOR_EACH_ENTRY(iter) {
if ((iter->mFs != NULL) && (iter->mFs->fsType != NULL) &&
strcmp(iter->mFs->fsType, fsType) == 0) {
if ((iter->mPath != NULL) && (strcmp(iter->mPath, partName) == 0)) {
errno = EBUSY;
return LOS_NOK;
return (int)LOS_NOK;
}
}
@@ -100,5 +174,6 @@ int LOS_PartitionFormat(const char *partName, char *fsType, void *data)
(fMap->fsMgt->format != NULL)) {
ret = fMap->fsMgt->format(partName, data);
}
return ret;
}

View File

@@ -31,6 +31,8 @@
#ifndef _VFS_PARTITION_H_
#define _VFS_PARTITION_H_
#include "los_compiler.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
@@ -41,6 +43,19 @@ extern "C" {
int GetPartIdByPartName(const char *partName);
int GetDevIdByDevName(const char *dev);
struct DeviceDesc *getDeviceList(void);
struct DeviceDesc {
struct FsMap *dFs; /* file system info */
struct DeviceDesc *dNext; /* point to next mount point */
const char *dPath; /* target path, /system, /usr, etc. */
const char *dDev; /* device, "emmc0p0", "emmc0p1", etc. */
void *dData; /* specific file system handle */
const char *dFsType; /* file system type */
int *dLengthArray; /* point to device partitions length array */
int *dAddrArray; /* point to device partitions address array */
int dPartNum; /* number of device partitions */
};
#ifdef __cplusplus
#if __cplusplus

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -191,7 +191,7 @@ VOID LOS_LmkOpsNodeInfoShow(VOID)
intSave = LOS_IntLock();
LOS_DL_LIST_FOR_EACH_ENTRY(opsNode, &g_losLmkOps.lmkOpsList, LosLmkOpsNode, node) {
PRINTK("Priority: %-4u Free:0x%-8x Restore:0x%-8x\n", opsNode->priority,
PRINTK("Priority: %-4u Free:0x%-8x Restore:0x%-8x\n", opsNode->priority,
(UINT32)(UINTPTR)opsNode->freeMem, (UINT32)(UINTPTR)opsNode->restoreTask);
}
LOS_IntRestore(intSave);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -199,7 +199,7 @@ UINT32 LOS_LmkTasksRestore(VOID);
* @brief Kill the tasks to release the used memory.
*
* @par Description:
* This API is used to kill the tasks to release the used memory when low memory killer is triggered.
* This API is used to kill the tasks to release the used memory when low memory killer is triggered.
*
* @attention None.
*

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -56,7 +56,7 @@ void *memcpy(void *dest, const void *src, size_t len)
}
#undef strcat
char *strcat (char *s, const char *append)
char *strcat(char *s, const char *append)
{
if ((s == NULL) || (append == NULL)) {
return NULL;

View File

@@ -182,18 +182,18 @@ VOID LOS_LmsCheckPoolDel(const VOID *pool)
LmsMemListNode *delNode = OsLmsGetPoolNode(pool);
if (delNode == NULL) {
PRINT_ERR("[LMS]pool %p is not on lms checklist !\n", pool);
goto REALEASE;
goto RELEASE;
}
delNode->used = LMS_POOL_UNUSED;
LOS_ListDelete(&(delNode->node));
REALEASE:
RELEASE:
LMS_UNLOCK(intSave);
}
VOID OsLmsInit(VOID)
{
memset(g_lmsCheckPoolArray, 0, sizeof(g_lmsCheckPoolArray));
(VOID)memset(g_lmsCheckPoolArray, 0, sizeof(g_lmsCheckPoolArray));
LOS_ListInit(&g_lmsCheckPoolList);
static LmsHook hook = {
.init = LOS_LmsCheckPoolAdd,
@@ -284,7 +284,7 @@ VOID OsLmsSetShadowValue(LmsMemListNode *node, UINTPTR startAddr, UINTPTR endAdd
}
if (shadowEnd + 1 > shadowStart) {
memset((VOID *)shadowStart, value & LMS_SHADOW_MASK_U8, shadowEnd + 1 - shadowStart);
(VOID)memset((VOID *)shadowStart, value & LMS_SHADOW_MASK_U8, shadowEnd + 1 - shadowStart);
}
}
}
@@ -339,7 +339,7 @@ VOID OsLmsLosMallocMark(const VOID *curNodeStart, const VOID *nextNodeStart, UIN
}
OsLmsSetShadowValue(node, curNodeStartAddr, curNodeStartAddr + nodeHeadSize, LMS_SHADOW_REDZONE_U8);
OsLmsSetShadowValue(node, curNodeStartAddr + nodeHeadSize, nextNodeStartAddr, LMS_SHADOW_ACCESSABLE_U8);
OsLmsSetShadowValue(node, curNodeStartAddr + nodeHeadSize, nextNodeStartAddr, LMS_SHADOW_ACCESSIBLE_U8);
OsLmsSetShadowValue(node, nextNodeStartAddr, nextNodeStartAddr + nodeHeadSize, LMS_SHADOW_REDZONE_U8);
LMS_UNLOCK(intSave);
}
@@ -357,7 +357,7 @@ VOID OsLmsCheckValid(UINTPTR checkAddr, BOOL isFreeCheck)
OsLmsGetShadowValue(node, checkAddr, &shadowValue);
LMS_UNLOCK(intSave);
if ((shadowValue == LMS_SHADOW_ACCESSABLE) || ((isFreeCheck) && (shadowValue == LMS_SHADOW_PAINT))) {
if ((shadowValue == LMS_SHADOW_ACCESSIBLE) || ((isFreeCheck) && (shadowValue == LMS_SHADOW_PAINT))) {
return;
}
@@ -380,7 +380,7 @@ VOID OsLmsLosFreeMark(const VOID *curNodeStart, const VOID *nextNodeStart, UINT3
UINTPTR nextNodeStartAddr = (UINTPTR)nextNodeStart;
OsLmsGetShadowValue(node, curNodeStartAddr + nodeHeadSize, &shadowValue);
if ((shadowValue != LMS_SHADOW_ACCESSABLE) && (shadowValue != LMS_SHADOW_PAINT)) {
if ((shadowValue != LMS_SHADOW_ACCESSIBLE) && (shadowValue != LMS_SHADOW_PAINT)) {
LMS_UNLOCK(intSave);
OsLmsReportError(curNodeStartAddr + nodeHeadSize, MEM_REGION_SIZE_1, FREE_ERRORMODE);
return;
@@ -421,7 +421,7 @@ VOID LOS_LmsAddrDisableProtect(UINTPTR addrStart, UINTPTR addrEnd)
LMS_LOCK(intSave);
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addrStart);
if (node != NULL) {
OsLmsSetShadowValue(node, addrStart, addrEnd, LMS_SHADOW_ACCESSABLE_U8);
OsLmsSetShadowValue(node, addrStart, addrEnd, LMS_SHADOW_ACCESSIBLE_U8);
}
LMS_UNLOCK(intSave);
}
@@ -440,7 +440,7 @@ STATIC UINT32 OsLmsCheckAddr(UINTPTR addr)
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addr);
if (node == NULL) {
LMS_UNLOCK(intSave);
return LMS_SHADOW_ACCESSABLE_U8;
return LMS_SHADOW_ACCESSIBLE_U8;
}
OsLmsGetShadowValue(node, addr, &shadowValue);
@@ -556,7 +556,7 @@ STATIC VOID OsLmsGetErrorInfo(UINTPTR addr, UINT32 size, LmsAddrInfo *info)
{
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addr);
OsLmsGetShadowInfo(node, addr, info);
if (info->shadowValue != LMS_SHADOW_ACCESSABLE_U8) {
if (info->shadowValue != LMS_SHADOW_ACCESSIBLE_U8) {
return;
} else {
OsLmsGetShadowInfo(node, addr + size - 1, info);
@@ -572,7 +572,7 @@ STATIC VOID OsLmsPrintErrInfo(LmsAddrInfo *info, UINT32 errMod)
case LMS_SHADOW_REDZONE:
PRINT_ERR("Heap buffer overflow error detected\n");
break;
case LMS_SHADOW_ACCESSABLE:
case LMS_SHADOW_ACCESSIBLE:
PRINT_ERR("No error\n");
break;
default:
@@ -609,7 +609,7 @@ VOID OsLmsReportError(UINTPTR p, UINT32 size, UINT32 errMod)
LMS_LOCK(intSave);
g_checkDepth += 1;
memset(&info, 0, sizeof(LmsAddrInfo));
(VOID)memset(&info, 0, sizeof(LmsAddrInfo));
PRINT_ERR("***** Kernel Address Sanitizer Error Detected Start *****\n");
@@ -628,7 +628,7 @@ VOID OsLmsReportError(UINTPTR p, UINT32 size, UINT32 errMod)
#if (LOSCFG_LMS_STORE_CHECK == 1)
VOID __asan_store1_noabort(UINTPTR p)
{
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSABLE_U8) {
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSIBLE_U8) {
OsLmsReportError(p, MEM_REGION_SIZE_1, STORE_ERRMODE);
}
}
@@ -704,7 +704,7 @@ VOID __asan_storeN_noabort(UINTPTR p, UINT32 size)
#if (LOSCFG_LMS_LOAD_CHECK == 1)
VOID __asan_load1_noabort(UINTPTR p)
{
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSABLE_U8) {
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSIBLE_U8) {
OsLmsReportError(p, MEM_REGION_SIZE_1, LOAD_ERRMODE);
}
}

View File

@@ -59,13 +59,13 @@ extern "C" {
#define LMS_POOL_RESIZE(size) ((size) / (LMS_SHADOW_U8_REFER_BYTES + 1) * LMS_SHADOW_U8_REFER_BYTES)
#define LMS_ADDR_ALIGN(p) (((UINTPTR)(p) + sizeof(UINTPTR) - 1) & ~((UINTPTR)(sizeof(UINTPTR) - 1)))
#define LMS_SHADOW_ACCESSABLE 0x00
#define LMS_SHADOW_ACCESSIBLE 0x00
#define LMS_SHADOW_AFTERFREE 0x03
#define LMS_SHADOW_REDZONE 0x02
#define LMS_SHADOW_PAINT 0x01
#define LMS_SHADOW_MASK 0x03
#define LMS_SHADOW_ACCESSABLE_U8 0x00
#define LMS_SHADOW_ACCESSIBLE_U8 0x00
#define LMS_SHADOW_AFTERFREE_U8 0xFF
#define LMS_SHADOW_REDZONE_U8 0xAA
#define LMS_SHADOW_MASK_U8 0xFF

View File

@@ -34,7 +34,7 @@ module_switch = defined(LOSCFG_NET_LWIP_SACK)
module_name = "lwip"
kernel_module(module_name) {
sources = LWIP_PORTING_FILES + LWIPNOAPPSFILES - [ "$LWIPDIR/api/sockets.c" ]
include_dirs = [ "//utils/native/lite/include" ]
include_dirs = [ "//commonlibrary/utils_lite/include" ]
}
config("public") {

View File

@@ -125,7 +125,7 @@ int ip6addr_aton(const char *cp, ip6_addr_t *addr)
int squash_pos = ipv6_blocks;
int i;
const unsigned char *sc = (const unsigned char *)cp;
const char *ss = cp-1;
const unsigned char *ss = (const unsigned char *)(cp - 1);
for (; ; sc++) {
if (current_block_index >= ipv6_blocks) {
@@ -142,7 +142,7 @@ int ip6addr_aton(const char *cp, ip6_addr_t *addr)
break;
} else if (*sc == ':') {
if (sc - ss == 1) {
if (sc != cp || sc[1] != ':') {
if (sc != (const unsigned char *)cp || sc[1] != ':') {
return 0; // address begins with a single ':' or contains ":::"
} // else address begins with one valid "::"
} else {
@@ -163,7 +163,7 @@ int ip6addr_aton(const char *cp, ip6_addr_t *addr)
#if LWIP_IPV4
} else if (*sc == '.' && current_block_index < ipv6_blocks - 1) {
ip4_addr_t ip4;
int ret = ip4addr_aton(ss+1, &ip4);
int ret = ip4addr_aton((const char *)(ss + 1), &ip4);
if (!ret) {
return 0;
}

View File

@@ -240,4 +240,7 @@
#define LWIP_SOCKET_OFFSET CONFIG_NFILE_DESCRIPTORS
#endif
#define LWIP_SOCKET_IOCTL 0
#define LWIP_SOCKET_FCNTL 0
#endif /* _LWIP_PORTING_LWIPOPTS_H_ */

View File

@@ -373,8 +373,9 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
while (!ping_kill && (forever || (i < cnt))) {
iecho->seqno = htons((u16_t)i);
iecho->chksum = 0;
#if (CHECKSUM_GEN_ICMP > 0)
iecho->chksum = inet_chksum((void *)iecho, iecho_len);
#endif
ret = sendto(sfd, iecho, iecho_len, 0, (struct sockaddr *)&to, (socklen_t)sizeof(to));
if (ret < 0) {
perror("Ping: sending ICMP echo request failed\n");
@@ -469,8 +470,9 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
}
intrvl -= 1000; /* 1000: 1000ms = 1s */
sys_msleep(1000); /* 1000: 1000ms = 1s */
if (ping_kill == 1)
if (ping_kill == 1) {
break;
}
} while (intrvl > 0);
succ_cnt++;
break;
@@ -528,7 +530,7 @@ u32_t OsShellPing(int argc, const char **argv)
{
int ret;
u32_t i = 0;
u32_t count = 0;
u32_t count;
int count_set = 0;
u32_t interval = 1000; /* default ping interval */
u32_t data_len = 48; /* default data length */

View File

@@ -33,7 +33,8 @@
#include <stdlib.h>
#include "lwip/tcpip.h"
#include "ohos_init.h"
void TcpIpPortingInit()
void TcpIpPortingInit(void)
{
tcpip_init(NULL, NULL);
}

View File

@@ -211,6 +211,7 @@ int close(int fd)
}
#endif
#if LWIP_SOCKET_IOCTL
#ifdef LWIP_SOCKET_IOCTL_FUNC
int ioctl(int fd, int req, ...)
{
@@ -222,7 +223,9 @@ int ioctl(int fd, int req, ...)
return lwip_ioctl(fd, (long)req, (void *)arg);
}
#endif
#endif
#if LWIP_SOCKET_FCNTL
#ifdef LWIP_SOCKET_FCNTL_FUNC
int fcntl(int fd, int cmd, ...)
{
@@ -234,6 +237,7 @@ int fcntl(int fd, int cmd, ...)
return lwip_fcntl(fd, cmd, val);
}
#endif
#endif
#if LWIP_SOCKET_SELECT
#ifdef LWIP_SOCKET_SELECT_FUNC

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 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:
@@ -209,7 +209,7 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeoutMs)
{
if (mbox == NULL) {
LWIP_DEBUGF(SYS_DEBUG, ("sys_arch_mbox_fetch: mbox is null"));
return ERR_ARG;
return (u32_t)ERR_ARG;
}
void *ignore = 0; /* if msg==NULL, the fetched msg should be dropped */
@@ -232,7 +232,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
{
if (mbox == NULL) {
LWIP_DEBUGF(SYS_DEBUG, ("sys_arch_mbox_tryfetch: mbox is null"));
return ERR_ARG;
return (u32_t)ERR_ARG;
}
void *ignore = 0; /* if msg==NULL, the fetched msg should be dropped */
@@ -313,7 +313,7 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeoutMs)
{
if (sem == NULL) {
LWIP_DEBUGF(SYS_DEBUG, ("sys_arch_sem_wait: sem is null"));
return ERR_ARG;
return (u32_t)ERR_ARG;
}
UINT64 tick = ROUND_UP_DIV((UINT64)timeoutMs * LOSCFG_BASE_CORE_TICK_PER_SECOND, OS_SYS_MS_PER_SECOND);

View File

@@ -129,7 +129,8 @@ STATIC BOOL OsPmTickTimerStop(LosPmCB *pm)
#endif
LosPmTickTimer *tickTimer = pm->tickTimer;
if ((tickTimer == NULL) || (tickTimer->tickLock == NULL)) {
if ((tickTimer == NULL) || (tickTimer->tickLock == NULL) ||
(pm->sysMode == LOS_SYS_NORMAL_SLEEP)) {
return FALSE;
}
@@ -167,7 +168,6 @@ STATIC VOID OsPmCpuResume(LosPmCB *pm)
STATIC VOID OsPmCpuSuspend(LosPmCB *pm)
{
/* cpu enter low power mode */
LOS_ASSERT(pm->sysctrl != NULL);
if (pm->sysMode == LOS_SYS_NORMAL_SLEEP) {
pm->sysctrl->normalSuspend();
@@ -226,6 +226,8 @@ STATIC UINT32 OsPmSuspendCheck(LosPmCB *pm, Suspend *sysSuspendEarly, Suspend *d
return LOS_NOK;
}
LOS_ASSERT(pm->sysctrl != NULL);
pm->isWake = FALSE;
*mode = pm->sysMode;
*sysSuspendEarly = pm->sysctrl->early;
@@ -260,6 +262,11 @@ STATIC UINT32 OsPmSuspendSleep(LosPmCB *pm)
goto EXIT;
}
if (pm->sysctrl->suspendCheck != NULL) {
pm->sysctrl->suspendCheck(mode);
pm->sysMode = pm->pmMode;
}
tickTimerStop = OsPmTickTimerStop(pm);
if (!tickTimerStop) {
OsSchedResetSchedResponseTime(0);
@@ -283,6 +290,9 @@ EXIT:
STATIC VOID OsPmNormalSleep(VOID)
{
#if (LOSCFG_KERNEL_PM_IDLE == 1)
(VOID)LOS_PmSuspend(0);
#else
UINT32 intSave;
LosPmCB *pm = &g_pmCB;
@@ -293,6 +303,7 @@ STATIC VOID OsPmNormalSleep(VOID)
OsPmCpuResume(pm);
LOS_IntRestore(intSave);
#endif
}
STATIC UINT32 OsPmDeviceRegister(LosPmCB *pm, LosPmDevice *device)
@@ -343,6 +354,9 @@ STATIC UINT32 OsPmSysctrlRegister(LosPmCB *pm, LosPmSysctrl *sysctrl)
if (sysctrl->late != NULL) {
pm->sysctrl->late = sysctrl->late;
}
if (sysctrl->suspendCheck != NULL) {
pm->sysctrl->suspendCheck = sysctrl->suspendCheck;
}
if (sysctrl->normalSuspend != NULL) {
pm->sysctrl->normalSuspend = sysctrl->normalSuspend;
}

View File

@@ -165,6 +165,8 @@ typedef struct {
* Unlocked task scheduling.
*/
VOID (*late)(UINT32 mode);
/* Final check before low-power consumption. */
VOID (*suspendCheck)(UINT32 mode);
/* The system enters the Normal sleep mode.
* In normal mode, the value cannot be NULL.
*/

View File

@@ -67,7 +67,7 @@ int SysUserTaskCreate(unsigned long entry, unsigned long userArea, unsigned long
int SysSchedSetScheduler(unsigned int tid, int policy, int priority)
{
if ((tid <= 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
if ((tid == 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
return EINVAL;
}
@@ -92,7 +92,7 @@ int *SysSchedGetArea(unsigned int tid)
unsigned int intSave;
int *area = NULL;
if ((tid <= 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
if ((tid == 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
return NULL;
}

View File

@@ -263,7 +263,7 @@ SYSCALL_HAND_DEF(__NR_get_thread_area, SysGetThreadArea, char *, ARG_NUM_0)
// SYSCALL_HAND_DEF(__NR_pthread_set_detach, SysUserThreadSetDetach, int, ARG_NUM_1)
// SYSCALL_HAND_DEF(__NR_pthread_join, SysThreadJoin, int, ARG_NUM_1)
// SYSCALL_HAND_DEF(__NR_pthread_deatch, SysUserThreadDetach, int, ARG_NUM_1)
SYSCALL_HAND_DEF(__NR_creat_user_thread, SysUserTaskCreate, unsigned int, ARG_NUM_4)
SYSCALL_HAND_DEF(__NR_create_user_thread, SysUserTaskCreate, unsigned int, ARG_NUM_4)
// SYSCALL_HAND_DEF(__NR_getrusage, SysGetrusage, int, ARG_NUM_2)
// SYSCALL_HAND_DEF(__NR_sysconf, SysSysconf, long, ARG_NUM_1)
// SYSCALL_HAND_DEF(__NR_ugetrlimit, SysUgetrlimit, int, ARG_NUM_2)

View File

@@ -43,6 +43,10 @@
#include "los_debugtools.h"
#endif
#if (LOSCFG_KERNEL_TRACE == 1)
#include "los_trace_pri.h"
#endif
#define SHELL_INIT_MAGIC_FLAG 0xABABABAB
STATIC CmdModInfo cmdInfo;
@@ -75,6 +79,13 @@ CmdItem g_shellcmdAll[] = {
{CMD_TYPE_EX, "st", 1, (CmdCallBackFunc)OsShellCmdSchedTrace},
#endif
{CMD_TYPE_EX, "help", 0, (CmdCallBackFunc)OsShellCmdHelp},
#if (LOSCFG_KERNEL_TRACE == 1)
{CMD_TYPE_EX, "trace_start", 0, (CmdCallBackFunc)LOS_TraceStart},
{CMD_TYPE_EX, "trace_stop", 0, (CmdCallBackFunc)LOS_TraceStop},
{CMD_TYPE_EX, "trace_mask", 1, (CmdCallBackFunc)OsShellCmdTraceSetMask},
{CMD_TYPE_EX, "trace_reset", 0, (CmdCallBackFunc)LOS_TraceReset},
{CMD_TYPE_EX, "trace_dump", 1, (CmdCallBackFunc)OsShellCmdTraceDump},
#endif
};
CmdModInfo *OsCmdInfoGet(VOID)

View File

@@ -82,7 +82,6 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdFree(INT32 argc, const CHAR *argv[])
#if (LOSCFG_MEM_WATERLINE == 1)
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdWaterLine(INT32 argc, const CHAR *argv[])
{
UINT32 ret;
LOS_MEM_POOL_STATUS poolStatus;
if (argc > 1) {

View File

@@ -181,6 +181,7 @@ VOID OsLs(const CHAR *pathname)
d = opendir(path);
if (d == NULL) {
PRINT_ERR("No such directory = %s\n", path);
free(path);
} else {
PRINTK("Directory %s:\n", path);
do {
@@ -544,11 +545,6 @@ STATIC INT32 OsShellCmdDoRmdir(const CHAR *pathname)
}
if (strcmp(dirent->d_name, "..") && strcmp(dirent->d_name, ".")) {
size_t fullPathBufSize = strlen(pathname) + strlen(dirent->d_name) + SEPARATOR_EOF_LEN;
if (fullPathBufSize <= 0) {
PRINTK("buffer size is invalid!\n");
(VOID)closedir(d);
return -1;
}
fullpath = (CHAR *)malloc(fullPathBufSize);
if (fullpath == NULL) {
PRINTK("malloc failure!\n");
@@ -724,7 +720,7 @@ STATIC INT32 OsWildcardExtractDirectory(CHAR *fullpath, VOID *dst, wildcard_type
if (d == NULL) {
perror("opendir error");
return VFS_ERROR;
return (INT32)VFS_ERROR;
}
while (1) {

View File

@@ -64,3 +64,11 @@ kernel_module(module_name) {
include_dirs += [ "pipeline/serial" ]
}
}
config("public") {
include_dirs = [
".",
"cnv",
"pipeline",
]
}

View File

@@ -1,7 +1,7 @@
config KERNEL_TRACE
bool "Enable Trace Feature"
default n
depends on DEBUG_HOOK
select DEBUG_HOOK
config TRACE_MSG_EXTEND
bool "Enable Record more extended content"

View File

@@ -39,12 +39,6 @@
#include "los_swtmr.h"
#include "los_hook.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC VOID LOS_TraceMemInit(VOID *pool, UINT32 size)
{
LOS_TRACE(MEM_INFO_REQ, pool);
@@ -264,9 +258,3 @@ VOID OsTraceCnvInit(VOID)
LOS_HookReg(LOS_HOOK_TYPE_SWTMR_START, LOS_TraceSwtmrStart);
LOS_HookReg(LOS_HOOK_TYPE_SWTMR_STOP, LOS_TraceSwtmrStop);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -45,12 +45,6 @@
#include "shell.h"
#endif
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#if (LOSCFG_KERNEL_TRACE == 1)
LITE_OS_SEC_BSS STATIC UINT32 g_traceEventCount;
LITE_OS_SEC_BSS STATIC volatile enum TraceState g_traceState = TRACE_UNINIT;
@@ -417,18 +411,6 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdTraceDump(INT32 argc, const CHAR **argv)
LOS_TraceRecordDump(toClient);
return LOS_OK;
}
SHELLCMD_ENTRY(tracestart_shellcmd, CMD_TYPE_EX, "trace_start", 0, (CmdCallBackFunc)LOS_TraceStart);
SHELLCMD_ENTRY(tracestop_shellcmd, CMD_TYPE_EX, "trace_stop", 0, (CmdCallBackFunc)LOS_TraceStop);
SHELLCMD_ENTRY(tracesetmask_shellcmd, CMD_TYPE_EX, "trace_mask", 1, (CmdCallBackFunc)OsShellCmdTraceSetMask);
SHELLCMD_ENTRY(tracereset_shellcmd, CMD_TYPE_EX, "trace_reset", 0, (CmdCallBackFunc)LOS_TraceReset);
SHELLCMD_ENTRY(tracedump_shellcmd, CMD_TYPE_EX, "trace_dump", 1, (CmdCallBackFunc)OsShellCmdTraceDump);
#endif
#endif /* LOSCFG_KERNEL_TRACE == 1 */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -152,6 +152,11 @@ extern VOID OsTraceRecordDump(BOOL toClient);
#define OsTraceNotifyStop()
#endif
#if (LOSCFG_SHELL == 1)
extern UINT32 OsShellCmdTraceSetMask(INT32 argc, const CHAR **argv);
extern UINT32 OsShellCmdTraceDump(INT32 argc, const CHAR **argv);
#endif
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -32,12 +32,6 @@
#include "trace_pipeline_serial.h"
#include "trace_pipeline.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#if (LOSCFG_TRACE_CONTROL_AGENT == 1)
UINT32 SerialPipelineInit(VOID)
{
@@ -93,9 +87,3 @@ UINT32 OsTracePipelineInit(VOID)
OsTracePipelineReg(&g_serialOps);
return g_serialOps.init();
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -33,12 +33,6 @@
#include "trace_tlv.h"
#include "los_trace_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#if (LOSCFG_KERNEL_SMP == 1)
LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_pipeSpin);
#define PIPE_LOCK(state) LOS_SpinLockSave(&g_pipeSpin, &(state))
@@ -154,9 +148,3 @@ UINT32 OsTraceDataWait(VOID)
{
return g_tracePipelineOps->wait();
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -32,12 +32,6 @@
#include "trace_tlv.h"
#include "securec.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define CRC_WIDTH 8
#define CRC_POLY 0x1021
#define CRC_TOPBIT 0x8000
@@ -114,9 +108,3 @@ UINT32 OsTraceDataEncode(UINT8 type, const TlvTable *table, UINT8 *src, UINT8 *d
head->crc = crc;
return len + sizeof(TraceMsgTlvHead);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -31,12 +31,8 @@
#include "los_trace_pri.h"
#include "trace_pipeline.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#include "los_memory.h"
#include "securec.h"
#if (LOSCFG_RECORDER_MODE_OFFLINE == 1)
#define BITS_NUM_FOR_TASK_ID 16
@@ -257,9 +253,3 @@ OfflineHead *OsTraceRecordGet(VOID)
}
#endif /* LOSCFG_RECORDER_MODE_OFFLINE == 1 */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

Some files were not shown because too many files have changed in this diff Show More