Compare commits
39 Commits
OpenHarmon
...
OpenHarmon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd864ea871 | ||
|
|
e7c1633f00 | ||
|
|
5e70129199 | ||
|
|
089376994a | ||
|
|
12adfd5832 | ||
|
|
c46c5a640d | ||
|
|
c812b0c27b | ||
|
|
51528ec39c | ||
|
|
beb03bfc81 | ||
|
|
bbbd96784e | ||
|
|
1c0de289ec | ||
|
|
a3d757c8e1 | ||
|
|
6fede4eb92 | ||
|
|
7be302633f | ||
|
|
0164461b33 | ||
|
|
9bb4be5e13 | ||
|
|
4acf1e9f8d | ||
|
|
870221452d | ||
|
|
30c3fb086e | ||
|
|
9b1e0a186b | ||
|
|
00dbf1e5d5 | ||
|
|
16fdbdf650 | ||
|
|
bee3d97163 | ||
|
|
9fb176b827 | ||
|
|
398f4a6ada | ||
|
|
19553f73e1 | ||
|
|
de24efadfa | ||
|
|
0057fb0dd5 | ||
|
|
bcf7e8ee02 | ||
|
|
0b9cac2cd3 | ||
|
|
9958f647f5 | ||
|
|
fa6b2d352c | ||
|
|
7f57e11ef9 | ||
|
|
1097d41a40 | ||
|
|
90d6ff9a6f | ||
|
|
eebe85fe31 | ||
|
|
b126f1cb5f | ||
|
|
639160f517 | ||
|
|
7fef6ac8d9 |
36
BUILD.gn
36
BUILD.gn
@@ -35,6 +35,7 @@ declare_args() {
|
||||
tee_enable = false
|
||||
liteos_name = "OHOS_Image"
|
||||
liteos_skip_make = false
|
||||
liteos_is_mini = false
|
||||
}
|
||||
|
||||
tee = ""
|
||||
@@ -128,7 +129,9 @@ config("stdinc_config") {
|
||||
"-isystem",
|
||||
std_include,
|
||||
]
|
||||
cflags += [ "-nostdinc" ]
|
||||
if (!defined(LOSCFG_LIBC_NEWLIB)) {
|
||||
cflags += [ "-nostdinc" ]
|
||||
}
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
@@ -315,14 +318,16 @@ group("kernel") {
|
||||
}
|
||||
|
||||
group("liteos_a") {
|
||||
deps = [
|
||||
":apps",
|
||||
":kernel",
|
||||
":tests",
|
||||
"//prebuilts/lite/sysroot/build:strip",
|
||||
]
|
||||
if (liteos_skip_make == false) {
|
||||
deps += [ ":make" ]
|
||||
deps = [ ":kernel" ]
|
||||
if (!liteos_is_mini) {
|
||||
deps += [
|
||||
":apps",
|
||||
":tests",
|
||||
"//third_party/musl/scripts/build_lite:strip",
|
||||
]
|
||||
if (liteos_skip_make == false) {
|
||||
deps += [ ":make" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,6 +344,17 @@ executable("liteos") {
|
||||
"-Wl,--no-eh-frame-hdr",
|
||||
]
|
||||
|
||||
if (defined(LOSCFG_LIBC_NEWLIB)) {
|
||||
ldflags += [
|
||||
"-Wl,--wrap=_free_r",
|
||||
"-Wl,--wrap,_malloc_usable_size_r",
|
||||
"-Wl,--wrap,_malloc_r",
|
||||
"-Wl,--wrap,_memalign_r",
|
||||
"-Wl,--wrap,_realloc_r",
|
||||
"-Wl,--wrap,_fseeko_r",
|
||||
]
|
||||
ldflags -= [ "-nostdlib" ]
|
||||
}
|
||||
libgcc = exec_script("//build/lite/run_shell_cmd.py",
|
||||
[ "$cc -print-libgcc-file-name" ],
|
||||
"trim string")
|
||||
@@ -350,7 +366,7 @@ executable("liteos") {
|
||||
} else {
|
||||
ldflags +=
|
||||
[ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ]
|
||||
ldflags += [ "-Wl,-nostartfiles" ]
|
||||
ldflags += [ "-nostartfiles" ]
|
||||
inputs = [ "tools/build/liteos.ld" ]
|
||||
}
|
||||
|
||||
|
||||
2
Kconfig
2
Kconfig
@@ -265,7 +265,7 @@ config MEM_LEAKCHECK
|
||||
default n
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the informations of mem node.
|
||||
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the information of mem node.
|
||||
config BASE_MEM_NODE_INTEGRITY_CHECK
|
||||
bool "Enable integrity check or not"
|
||||
default n
|
||||
|
||||
2
Makefile
2
Makefile
@@ -121,7 +121,7 @@ sysroot:
|
||||
$(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH))
|
||||
ifeq ($(origin SYSROOT_PATH),file)
|
||||
$(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \
|
||||
ln -snf $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/build/Makefile && \
|
||||
ln -snf $(LITEOSTOPDIR)/../../third_party/musl/scripts/build_lite/Makefile && \
|
||||
$(MAKE) TARGETS=liteos_a_user \
|
||||
ARCH=$(ARCH) \
|
||||
TARGET=$(LOSCFG_LLVM_TARGET) \
|
||||
|
||||
6
OAT.xml
6
OAT.xml
@@ -15,7 +15,7 @@
|
||||
-->
|
||||
|
||||
<!--
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool. Please copy it to your project root dir and modify it by referring to OpenHarmony/tools_oat/README.
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
@@ -23,7 +23,7 @@
|
||||
<licensefile></licensefile>
|
||||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="copyright" name="Huawei Device Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||
</policy>
|
||||
</policylist>
|
||||
@@ -38,7 +38,7 @@
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for license header policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
|
||||
11
README.md
11
README.md
@@ -62,19 +62,18 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
|
||||
## Constraints<a name="section119744591305"></a>
|
||||
|
||||
- Programming languages: C and C++
|
||||
- Applicable development boards: Hi3518E V300 and Hi3516D V300
|
||||
- Hi3518E V300 uses the JFFS2 file system by default, and Hi3516D V300 uses the FAT file system by default.
|
||||
- Applicable development boards: Hi3516D V300
|
||||
- Hi3516D V300 uses the FAT file system by default.
|
||||
|
||||
## Usage<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS Cortex-A supports the [Hi3518E V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3518.md) and [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md). You can develop and run your applications based on both development boards.
|
||||
OpenHarmony LiteOS Cortex-A supports the [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md). You can develop and run your applications based on this development board.
|
||||
|
||||
### Preparations<a name="section1579912573329"></a>
|
||||
|
||||
You need to set up the compilation environment on Linux.
|
||||
|
||||
- [Setting Up Ubuntu Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-env-setup-linux.md)
|
||||
- For Hi3518E V300, see [Setting Up the Hi3518 Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-hi3518-setting.md).
|
||||
- [Setting Up Ubuntu Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-env-setup.md)
|
||||
- For Hi3516D V300, see [Setting Up the Hi3516 Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md).
|
||||
|
||||
### Source Code Acquisition<a name="section11443189655"></a>
|
||||
@@ -85,8 +84,6 @@ Download and decompress a set of source code on a Linux server to acquire the [
|
||||
|
||||
For details about how to develop the first application, see:
|
||||
|
||||
- [Developing the First Example Program Running on Hi3518](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md)
|
||||
|
||||
- [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)
|
||||
|
||||
## Repositories Involved<a name="section1371113476307"></a>
|
||||
|
||||
@@ -62,19 +62,18 @@ OpenHarmony LiteOS-A內核是基於Huawei LiteOS內核演進發展的新一代
|
||||
## 約束<a name="section119744591305"></a>
|
||||
|
||||
- 開發語言:C/C++;
|
||||
- 適用於Hi3518EV300、Hi3516DV300單板;
|
||||
- Hi3518EV300默認使用jffs2文件系統,Hi3516DV300默認使用FAT文件系統。
|
||||
- 適用於Hi3516DV300單板;
|
||||
- Hi3516DV300默認使用FAT文件系統。
|
||||
|
||||
## 使用說明<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS-A內核支持Hi3518EV300([介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3518.md))、Hi3516DV300([介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md))單板,開發者可基於兩種單板開發運行自己的應用程序。
|
||||
OpenHarmony LiteOS-A內核支持Hi3516DV300([介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md))單板,開發者可基於此單板開發運行自己的應用程序。
|
||||
|
||||
### 準備<a name="section1579912573329"></a>
|
||||
|
||||
開發者需要在Linux上搭建編譯環境:
|
||||
|
||||
- [編譯環境凖備](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-package-environment.md);
|
||||
- Hi3518EV300單板:參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-setting.md);
|
||||
- [編譯環境凖備](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md);
|
||||
- Hi3516DV300單板:參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)。
|
||||
|
||||
### 獲取源碼<a name="section11443189655"></a>
|
||||
@@ -85,8 +84,6 @@ OpenHarmony LiteOS-A內核支持Hi3518EV300([介紹](https://gitee.com/openhar
|
||||
|
||||
開發者開發第一個應用程序可參考:
|
||||
|
||||
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md);
|
||||
|
||||
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)。
|
||||
|
||||
## 相關倉<a name="section1371113476307"></a>
|
||||
|
||||
16
README_zh.md
16
README_zh.md
@@ -33,6 +33,7 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
|
||||
│ ├── quickstart # 系统快速启动接口目录
|
||||
│ ├── random # 随机数设备驱动
|
||||
│ └── video # framebuffer驱动框架
|
||||
├── figures # 内核架构图
|
||||
├── fs # 文件系统模块,主要来源于NuttX开源项目
|
||||
│ ├── fat # fat文件系统
|
||||
│ ├── jffs2 # jffs2文件系统
|
||||
@@ -54,26 +55,27 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
|
||||
│ ├── include # 对外暴露头文件存放目录
|
||||
│ └── uart # 串口相关逻辑代码
|
||||
├── security # 安全特性相关的代码,包括进程权限管理和虚拟id映射管理
|
||||
├── shell # 接收用户输入的命令,内核去执行
|
||||
├── syscall # 系统调用
|
||||
├── testsuilts # 测试套件
|
||||
└── tools # 构建工具及相关配置和代码
|
||||
```
|
||||
|
||||
## 约束<a name="section119744591305"></a>
|
||||
|
||||
- 开发语言:C/C++;
|
||||
- 适用于Hi3518EV300、Hi3516DV300单板;
|
||||
- Hi3518EV300默认使用jffs2文件系统,Hi3516DV300默认使用FAT文件系统。
|
||||
- 适用于Hi3516DV300单板;
|
||||
- Hi3516DV300默认使用FAT文件系统。
|
||||
|
||||
## 使用说明<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS-A内核支持Hi3518EV300([介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3518.md))、Hi3516DV300([介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md))单板,开发者可基于两种单板开发运行自己的应用程序。
|
||||
OpenHarmony LiteOS-A内核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)单板。开发者可基于此单板开发运行自己的应用程序。
|
||||
|
||||
### 准备<a name="section1579912573329"></a>
|
||||
|
||||
开发者需要在Linux上搭建编译环境:
|
||||
|
||||
- [编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-package-environment.md);
|
||||
- Hi3518EV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-setting.md);
|
||||
- [编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md);
|
||||
- Hi3516DV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)。
|
||||
|
||||
### 获取源码<a name="section11443189655"></a>
|
||||
@@ -82,9 +84,7 @@ OpenHarmony LiteOS-A内核支持Hi3518EV300([介绍](https://gitee.com/openhar
|
||||
|
||||
### 编译构建<a name="section2081013992812"></a>
|
||||
|
||||
开发者开发第一个应用程序可参考:
|
||||
|
||||
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md);
|
||||
如果这是您的首次应用程序开发,可参考:
|
||||
|
||||
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)。
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ copy("copy_mksh_src") {
|
||||
|
||||
build_ext_component("build_mksh") {
|
||||
deps = [ ":copy_mksh_src" ]
|
||||
deps += [ "//prebuilts/lite/sysroot" ]
|
||||
deps += [ "//third_party/musl:sysroot_lite" ]
|
||||
exec_path = rebase_path("$target_out_dir/mksh_build")
|
||||
|
||||
cflags = [
|
||||
|
||||
@@ -422,7 +422,7 @@ static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len
|
||||
|
||||
forkPid = fork();
|
||||
if (forkPid < 0) {
|
||||
printf("Faild to fork from shell\n");
|
||||
printf("Failed to fork from shell\n");
|
||||
return;
|
||||
} else if (forkPid == 0) {
|
||||
ChildExec(cmdParsed->paramArray[0], cmdParsed->paramArray, foreground);
|
||||
|
||||
@@ -500,7 +500,7 @@ static void lwip_tftp_send_error(s32_t iSockNum, u32_t ulError, const char *szEr
|
||||
}
|
||||
}
|
||||
|
||||
/* INTEFACE to get a file using filename
|
||||
/* INTERFACE to get a file using filename
|
||||
ulHostAddr - IP address of Host
|
||||
szSrcFileName - Source file
|
||||
szDestDirPath - Destination file path
|
||||
@@ -1419,7 +1419,7 @@ err_handler:
|
||||
}
|
||||
|
||||
#ifdef TFTP_TO_RAWMEM
|
||||
/* INTEFACE to get a file using filename
|
||||
/* INTERFACE to get a file using filename
|
||||
ulHostAddr - IP address of Host
|
||||
szSrcFileName - Source file
|
||||
szDestMemAddr - The target memory address in the client
|
||||
|
||||
@@ -51,7 +51,7 @@ build_ext_component("build_toybox") {
|
||||
":copy_toybox_config",
|
||||
":copy_toybox_src",
|
||||
]
|
||||
deps += [ "//prebuilts/lite/sysroot" ]
|
||||
deps += [ "//third_party/musl:sysroot_lite" ]
|
||||
exec_path = rebase_path("$target_out_dir/toybox_build")
|
||||
|
||||
cflags = [
|
||||
|
||||
@@ -88,6 +88,7 @@ STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
|
||||
#define OS_MAX_BACKTRACE 15U
|
||||
#define DUMPSIZE 128U
|
||||
#define DUMPREGS 12U
|
||||
#define COM_REGS 4U
|
||||
#define INSTR_SET_MASK 0x01000020U
|
||||
#define THUMB_INSTR_LEN 2U
|
||||
#define ARM_INSTR_LEN 4U
|
||||
@@ -516,13 +517,22 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
|
||||
return;
|
||||
}
|
||||
|
||||
for (excReg = &(excBufAddr->R0); count <= DUMPREGS; excReg++, count++) {
|
||||
for (excReg = &(excBufAddr->R0); count < COM_REGS; excReg++, count++) {
|
||||
if (IS_VALID_ADDR(*excReg)) {
|
||||
PrintExcInfo("\ndump mem around R%u:%p", count, (*excReg));
|
||||
OsDumpMemByte(DUMPSIZE, ((*excReg) - (DUMPSIZE >> 1)));
|
||||
}
|
||||
}
|
||||
|
||||
for (excReg = &(excBufAddr->R4); count < DUMPREGS; excReg++, count++) {
|
||||
if (IS_VALID_ADDR(*excReg)) {
|
||||
PrintExcInfo("\ndump mem around R%u:%p", count, (*excReg));
|
||||
OsDumpMemByte(DUMPSIZE, ((*excReg) - (DUMPSIZE >> 1)));
|
||||
}
|
||||
}
|
||||
if (IS_VALID_ADDR(excBufAddr->R12)) {
|
||||
PrintExcInfo("\ndump mem around R12:%p", excBufAddr->R12);
|
||||
OsDumpMemByte(DUMPSIZE, (excBufAddr->R12 - (DUMPSIZE >> 1)));
|
||||
}
|
||||
if (IS_VALID_ADDR(excBufAddr->SP)) {
|
||||
PrintExcInfo("\ndump mem around SP:%p", excBufAddr->SP);
|
||||
OsDumpMemByte(DUMPSIZE, (excBufAddr->SP - (DUMPSIZE >> 1)));
|
||||
@@ -645,6 +655,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
|
||||
const StackInfo *stack = NULL;
|
||||
vaddr_t kvaddr;
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
|
||||
taskCB = OsCurrTaskGet();
|
||||
stackStart = taskCB->userMapBase;
|
||||
@@ -655,6 +666,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
|
||||
}
|
||||
return found;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Search in the task stacks */
|
||||
for (index = 0; index < g_taskMaxNum; index++) {
|
||||
|
||||
@@ -276,11 +276,11 @@ mmu_setup:
|
||||
mov r12, #0x7 /* 0b0111 */
|
||||
mcr p15, 0, r12, c3, c0, 0 /* Set DACR with 0b0111, client and manager domian */
|
||||
isb
|
||||
mrc p15, 0, r12, c1, c0, 1 /* ACTLR, Auxlliary Control Register */
|
||||
mrc p15, 0, r12, c1, c0, 1 /* ACTLR, Auxiliary Control Register */
|
||||
orr r12, r12, #(1 << 6) /* SMP, Enables coherent requests to the processor. */
|
||||
orr r12, r12, #(1 << 2) /* Enable D-side prefetch */
|
||||
orr r12, r12, #(1 << 11) /* Global BP Enable bit */
|
||||
mcr p15, 0, r12, c1, c0, 1 /* ACTLR, Auxlliary Control Register */
|
||||
mcr p15, 0, r12, c1, c0, 1 /* ACTLR, Auxiliary Control Register */
|
||||
dsb
|
||||
mrc p15, 0, r12, c1, c0, 0
|
||||
bic r12, #(1 << 29 | 1 << 28) /* Disable TRE/AFE */
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk
|
||||
include $(LITEOSTOPDIR)/../../drivers/hdf_core/adapter/khdf/liteos/lite.mk
|
||||
|
||||
MODULE_NAME := usb_base
|
||||
|
||||
@@ -122,13 +122,13 @@ LOCAL_SRCS += $(STORAGE_SRC)/umass.c
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_DRIVERS_USB_HID_CLASS)_$(LOSCFG_DRIVERS_HDF_INPUT), y_y)
|
||||
LOCAL_FLAGS += -I$(LITEOSTOPDIR)/../../drivers/framework/model/input/driver \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/include/core \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/core/common/include/host \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/utils \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/osal \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/ability/sbuf/include \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/include/osal \
|
||||
LOCAL_FLAGS += -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/model/input/driver \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/include/core \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/core/common/include/host \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/utils \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/osal \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/ability/sbuf/include \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/include/osal \
|
||||
-I$(LITEOSTOPDIR)/../../third_party/FreeBSD/sys/dev/evdev
|
||||
|
||||
LOCAL_SRCS += $(INPUT_SRC)/uhid.c \
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
#ifdef LOSCFG_AARCH64
|
||||
/*
|
||||
* This two structures originally did't exit,
|
||||
* This two structures originally didn't exit,
|
||||
* they added by liteos to support 64bit interfaces on 32bit platform,
|
||||
* in 64bit platform, timeval64 define to timeval which is platform adaptive.
|
||||
*/
|
||||
@@ -387,9 +387,16 @@ int gettimeofday64(struct timeval64 *tv, struct timezone *tz)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_LIBC_NEWLIB
|
||||
int gettimeofday(struct timeval *tv, void *_tz)
|
||||
#else
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
#endif
|
||||
{
|
||||
struct timeval64 stTimeVal64 = {0};
|
||||
#ifdef LOSCFG_LIBC_NEWLIB
|
||||
struct timezone *tz = (struct timezone *)_tz;
|
||||
#endif
|
||||
|
||||
if (tv == NULL) {
|
||||
TIME_RETURN(EINVAL);
|
||||
@@ -718,6 +725,7 @@ typedef struct {
|
||||
|
||||
static VOID SwtmrProc(UINTPTR tmrArg)
|
||||
{
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
INT32 sig, ret;
|
||||
UINT32 intSave;
|
||||
pid_t pid;
|
||||
@@ -761,9 +769,47 @@ static VOID SwtmrProc(UINTPTR tmrArg)
|
||||
return;
|
||||
EXIT:
|
||||
PRINT_ERR("Dispatch signals failed!, ret: %d\r\n", ret);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
int timer_create(clockid_t clockID, struct sigevent *restrict evp, timer_t *restrict timerID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT16 swtmrID;
|
||||
#ifdef LOSCFG_SECURITY_VID
|
||||
UINT16 vid;
|
||||
#endif
|
||||
|
||||
if (!timerID || (clockID != CLOCK_REALTIME) || !evp) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((evp->sigev_notify != SIGEV_THREAD) || evp->sigev_notify_attributes) {
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)evp->sigev_notify_function,
|
||||
&swtmrID, (UINTPTR)evp->sigev_value.sival_ptr);
|
||||
if (ret != LOS_OK) {
|
||||
errno = (ret == LOS_ERRNO_SWTMR_MAXSIZE) ? EAGAIN : EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_SECURITY_VID
|
||||
vid = AddNodeByRid(swtmrID);
|
||||
if (vid == MAX_INVALID_TIMER_VID) {
|
||||
(VOID)LOS_SwtmrDelete(swtmrID);
|
||||
return -1;
|
||||
}
|
||||
swtmrID = vid;
|
||||
#endif
|
||||
*timerID = (timer_t)(UINTPTR)swtmrID;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OsTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
|
||||
{
|
||||
UINT32 ret;
|
||||
@@ -823,6 +869,7 @@ int timer_delete(timer_t timerID)
|
||||
{
|
||||
UINT16 swtmrID = (UINT16)(UINTPTR)timerID;
|
||||
VOID *arg = NULL;
|
||||
UINTPTR swtmrProc;
|
||||
|
||||
#ifdef LOSCFG_SECURITY_VID
|
||||
swtmrID = GetRidByVid(swtmrID);
|
||||
@@ -832,10 +879,11 @@ int timer_delete(timer_t timerID)
|
||||
}
|
||||
|
||||
arg = (VOID *)OS_SWT_FROM_SID(swtmrID)->uwArg;
|
||||
swtmrProc = (UINTPTR)OS_SWT_FROM_SID(swtmrID)->pfnHandler;
|
||||
if (LOS_SwtmrDelete(swtmrID)) {
|
||||
goto ERROUT;
|
||||
}
|
||||
if (arg != NULL) {
|
||||
if ((swtmrProc == (UINTPTR)SwtmrProc) && (arg != NULL)) {
|
||||
free(arg);
|
||||
}
|
||||
|
||||
@@ -979,7 +1027,11 @@ STATIC INT32 DoNanoSleep(UINT64 nanoseconds)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_LIBC_NEWLIB
|
||||
int usleep(unsigned long useconds)
|
||||
#else
|
||||
int usleep(unsigned useconds)
|
||||
#endif
|
||||
{
|
||||
return DoNanoSleep((UINT64)useconds * OS_SYS_NS_PER_US);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ config DRIVERS
|
||||
Answer Y to enable LiteOS support driver.
|
||||
|
||||
source "bsd/dev/usb/Kconfig"
|
||||
source "../../drivers/adapter/khdf/liteos/Kconfig"
|
||||
source "../../drivers/hdf_core/adapter/khdf/liteos/Kconfig"
|
||||
|
||||
# Device driver Kconfig import
|
||||
source "$(DEVICE_PATH)/drivers/Kconfig"
|
||||
@@ -17,5 +17,4 @@ source "drivers/char/video/Kconfig"
|
||||
source "drivers/char/trace/Kconfig"
|
||||
source "drivers/char/perf/Kconfig"
|
||||
|
||||
source "../../drivers/liteos/tzdriver/Kconfig"
|
||||
source "../../drivers/liteos/hievent/Kconfig"
|
||||
|
||||
@@ -163,7 +163,7 @@ extern "C" {
|
||||
#define DISK_ATA_GET_MODEL 21 /* Get model name */
|
||||
#define DISK_ATA_GET_SN 22 /* Get serial number */
|
||||
|
||||
#ifdef LOSCFG_FS_FAT_CACHE
|
||||
#ifndef LOSCFG_FS_FAT_CACHE
|
||||
#define DISK_DIRECT_BUFFER_SIZE 4 /* los_disk direct io buffer when bcache is off */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ group("fs") {
|
||||
deps = [
|
||||
"fat",
|
||||
"fat/virpart",
|
||||
"jffs2",
|
||||
"nfs",
|
||||
"patchfs",
|
||||
"proc",
|
||||
|
||||
@@ -64,7 +64,7 @@ extern "C" {
|
||||
#define MBR_PRIMARY_PART_NUM 4
|
||||
#define JUMP_CODE "\xEB\xFE\x90"
|
||||
|
||||
/* Partiton type */
|
||||
/* Partition type */
|
||||
#define FAT12 0x01 /* FAT12 as primary partition in first physical 32MB */
|
||||
#define FAT16 0x04 /* FAT16 with less than 65536 sectors(32MB) */
|
||||
#define EXTENDED_PARTITION_CHS 0x05
|
||||
|
||||
@@ -179,7 +179,7 @@ static INT FatfsDisablePart(void *handle)
|
||||
* Scan the FAT inside the boundary of CHILD FATFS limit, and update the free cluster and last cluster
|
||||
* for all CHILD FATFS.
|
||||
* Acceptable Return Value:
|
||||
* - FR_OK : Successfully scaned the FAT and update field.
|
||||
* - FR_OK : Successfully scanned the FAT and update field.
|
||||
* Others Return Value:
|
||||
* - FR_INVAILD_FATFS : The FATFS object has error or the info in it has been occuried
|
||||
* - FR_DENIED : The virtual partition feature has been shut down by switcher
|
||||
|
||||
@@ -373,7 +373,7 @@ static FRESULT FatfsCheckScanFatParam(FATFS *fs)
|
||||
* Scan the FAT inside the boundary of CHILD FATFS limit, and update the free cluster and last cluster
|
||||
*
|
||||
* Acceptable Return Value:
|
||||
* - FR_OK : Successfully scaned the FAT and update field.
|
||||
* - FR_OK : Successfully scanned the FAT and update field.
|
||||
*
|
||||
* Others Return Value:
|
||||
* - FR_INVAILD_FATFS : The FATFS object has error or the info in it has been occuried
|
||||
|
||||
@@ -31,19 +31,86 @@ import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_FS_JFFS)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
linux_path = rebase_path("//kernel/linux/linux-5.10")
|
||||
out_path = rebase_path(target_out_dir)
|
||||
|
||||
kernel_module(module_name) {
|
||||
patch_path = rebase_path(".")
|
||||
cmd = "if [ -d ${out_path}/jffs2_build ]; then rm -r ${out_path}/jffs2_build; fi && mkdir -p ${out_path}/jffs2_build/fs"
|
||||
cmd += " && cp ${linux_path}/fs/jffs2 ${out_path}/jffs2_build/fs/. -r"
|
||||
cmd += " && pushd ${out_path}/jffs2_build/"
|
||||
cmd += " && patch -p1 < ${patch_path}/jffs2.patch && popd"
|
||||
exec_script("//build/lite/run_shell_cmd.py", [ cmd ])
|
||||
|
||||
sources = [
|
||||
"src/jffs2_hash.c",
|
||||
"src/vfs_jffs2.c",
|
||||
]
|
||||
|
||||
sources += LINUX_KERNEL_FS_JFFS2_SRC_FILES
|
||||
sources += [
|
||||
"${out_path}/jffs2_build/fs/jffs2/background.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/build.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/compr.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/compr_rtime.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/compr_rubin.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/compr_zlib.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/debug.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/dir.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/erase.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/file.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/fs.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/gc.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/malloc.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/nodelist.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/nodemgmt.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/read.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/readinode.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/scan.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/summary.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/super.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/write.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/writev.c",
|
||||
]
|
||||
|
||||
include_dirs = LINUX_KERNEL_FS_JFFS2_INCLUDE_DIRS
|
||||
include_dirs = [
|
||||
"${out_path}/jffs2_build/fs",
|
||||
"${out_path}/jffs2_build/fs/jffs2",
|
||||
]
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
|
||||
deps = [ ":cp_jffs2_src" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
action("cp_jffs2_src") {
|
||||
script = "//build/lite/run_shell_cmd.py"
|
||||
|
||||
outputs = [
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/background.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/build.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/compr.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/compr_rtime.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/compr_rubin.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/compr_zlib.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/debug.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/dir.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/erase.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/file.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/fs.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/gc.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/malloc.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/nodelist.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/nodemgmt.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/read.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/readinode.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/scan.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/summary.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/super.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/write.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/writev.c",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -31,13 +31,51 @@ include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
MODULE_NAME := $(notdir $(shell pwd))
|
||||
|
||||
LOCAL_SRCS := $(wildcard src/*.c) \
|
||||
$(wildcard $(LITEOSTOPDIR)/../linux/linux-5.10/fs/jffs2/*.c)
|
||||
LINUX_PATH := $(LITEOSTOPDIR)/../linux/linux-5.10
|
||||
LOCAL_PATH := $(shell pwd)
|
||||
TEMP_SRC_PATH := $(OUT)/jffs2_build
|
||||
|
||||
LOCAL_SRCS := \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/background.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/build.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/compr.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/compr_rtime.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/compr_rubin.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/compr_zlib.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/debug.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/dir.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/erase.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/file.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/fs.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/gc.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/malloc.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/nodelist.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/nodemgmt.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/read.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/readinode.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/scan.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/summary.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/super.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/write.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/writev.c \
|
||||
$(LOCAL_PATH)/src/jffs2_hash.c \
|
||||
$(LOCAL_PATH)/src/vfs_jffs2.c \
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(LITEOSTOPDIR)/fs/jffs2/include \
|
||||
-I $(LITEOSTOPDIR)/../linux/linux-5.10/fs/jffs2 \
|
||||
-I $(LITEOSTOPDIR)/../linux/linux-5.10/fs
|
||||
-I $(TEMP_SRC_PATH)/fs/jffs2 \
|
||||
-I $(TEMP_SRC_PATH)/fs
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE)
|
||||
|
||||
.PHONY: patch patch_clean
|
||||
$(LOCAL_SRCS): patch
|
||||
|
||||
patch: patch_clean
|
||||
cp $(LINUX_PATH)/fs/jffs2 $(TEMP_SRC_PATH)/fs/. -r
|
||||
cd $(TEMP_SRC_PATH) && patch -p1 < $(LOCAL_PATH)/jffs2.patch
|
||||
|
||||
patch_clean:
|
||||
$(HIDE) $(RM) -rf $(TEMP_SRC_PATH)
|
||||
|
||||
include $(MODULE)
|
||||
|
||||
|
||||
9927
fs/jffs2/jffs2.patch
Normal file
9927
fs/jffs2/jffs2.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -135,7 +135,7 @@ void ProcFdInit(void)
|
||||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("fd", 0, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("creat /proc/fd error.\n");
|
||||
PRINT_ERR("create /proc/fd error.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ void ProcMountsInit(void)
|
||||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("mounts", 0, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("creat mounts error!\n");
|
||||
PRINT_ERR("create mounts error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void ProcUptimeInit(void)
|
||||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("uptime", 0, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("creat /proc/uptime error!\n");
|
||||
PRINT_ERR("create /proc/uptime error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ typedef struct tagOsBcache {
|
||||
* <li>The block number is automatically adjusted if position is greater than block size.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @retval #0 read succeded
|
||||
* @retval #0 read succeeded
|
||||
* @retval #INT32 read failed
|
||||
*
|
||||
* @par Dependency:
|
||||
@@ -168,7 +168,7 @@ INT32 BlockCacheRead(OsBcache *bc,
|
||||
* <li>The block number is automatically adjusted if position is greater than block size.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @retval #0 write succeded
|
||||
* @retval #0 write succeeded
|
||||
* @retval #INT32 write failed
|
||||
*
|
||||
* @par Dependency:
|
||||
@@ -193,7 +193,7 @@ INT32 BlockCacheWrite(OsBcache *bc,
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @retval #0 sync succeded
|
||||
* @retval #0 sync succeeded
|
||||
* @retval #INT32 sync failed
|
||||
*
|
||||
* @par Dependency:
|
||||
@@ -219,7 +219,7 @@ INT32 BlockCacheSync(OsBcache *bc);
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @retval #OsBcache * init succeded
|
||||
* @retval #OsBcache * init succeeded
|
||||
* @retval #NULL init failed
|
||||
*
|
||||
* @par Dependency:
|
||||
|
||||
@@ -90,8 +90,13 @@ kernel_module(module_name) {
|
||||
}
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
configs += [ ":private" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
config("private") {
|
||||
cflags = [ "-Wno-frame-address" ]
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk
|
||||
include $(LITEOSTOPDIR)/../../drivers/hdf_core/adapter/khdf/liteos/lite.mk
|
||||
|
||||
MODULE_NAME := $(notdir $(shell pwd))
|
||||
|
||||
@@ -40,6 +40,6 @@ LOCAL_SRCS := $(wildcard ipc/*.c) $(wildcard core/*.c) $(wildcard mem/membox/*.
|
||||
$(wildcard sched/*.c) \
|
||||
$(wildcard vm/*.c)
|
||||
|
||||
LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK)
|
||||
LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK) -Wno-frame-address
|
||||
|
||||
include $(MODULE)
|
||||
|
||||
@@ -226,6 +226,9 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsIdleTaskCreate(VOID)
|
||||
taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid());
|
||||
#endif
|
||||
ret = LOS_TaskCreateOnly(&idleTaskID, &taskInitParam);
|
||||
if (ret != LOS_OK) {
|
||||
return ret;
|
||||
}
|
||||
LosTaskCB *idleTask = OS_TCB_FROM_TID(idleTaskID);
|
||||
idleTask->taskStatus |= OS_TASK_FLAG_SYSTEM_TASK;
|
||||
OsSchedRunqueueIdleInit(idleTaskID);
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
#endif
|
||||
#include "los_stackinfo_pri.h"
|
||||
#include "los_futex_pri.h"
|
||||
#ifdef LOSCFG_KERNEL_PM
|
||||
#include "los_pm_pri.h"
|
||||
#endif
|
||||
#include "los_signal.h"
|
||||
#ifdef LOSCFG_KERNEL_CPUP
|
||||
#include "los_cpup_pri.h"
|
||||
@@ -555,9 +557,11 @@ STATIC INLINE VOID SchedTaskFreeze(LosTaskCB *taskCB)
|
||||
{
|
||||
UINT64 responseTime;
|
||||
|
||||
#ifdef LOSCFG_KERNEL_PM
|
||||
if (!OsIsPmMode()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(taskCB->taskStatus & (OS_TASK_STATUS_PEND_TIME | OS_TASK_STATUS_DELAY))) {
|
||||
return;
|
||||
|
||||
@@ -284,7 +284,7 @@ static int SigProcessSignalHandler(LosTaskCB *tcb, void *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If the default tcb is not setted, then set this one as default. */
|
||||
/* If the default tcb is not set, then set this one as default. */
|
||||
if (!info->defaultTcb) {
|
||||
info->defaultTcb = tcb;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ static int SigProcessSignalHandler(LosTaskCB *tcb, void *arg)
|
||||
/* Is this signal unblocked on this thread? */
|
||||
isMember = OsSigIsMember(&tcb->sig.sigprocmask, info->sigInfo->si_signo);
|
||||
if ((!isMember) && (!info->receivedTcb) && (tcb != info->awakenedTcb)) {
|
||||
/* if unblockedTcb of this signal is not setted, then set it. */
|
||||
/* if unblockedTcb of this signal is not set, then set it. */
|
||||
if (!info->unblockedTcb) {
|
||||
info->unblockedTcb = tcb;
|
||||
}
|
||||
|
||||
@@ -190,11 +190,7 @@ VOID OsLockDepCheckIn(SPIN_LOCK_S *lock)
|
||||
{
|
||||
UINT32 intSave;
|
||||
enum LockDepErrType checkResult = LOCKDEP_SUCCESS;
|
||||
#ifdef LOSCFG_COMPILER_CLANG_LLVM
|
||||
VOID *requestAddr = (VOID *)__builtin_return_address(1);
|
||||
#else
|
||||
VOID *requestAddr = (VOID *)__builtin_return_address(0);
|
||||
#endif
|
||||
LosTaskCB *current = OsCurrTaskGet();
|
||||
LockDep *lockDep = ¤t->lockDep;
|
||||
LosTaskCB *lockOwner = NULL;
|
||||
@@ -276,11 +272,7 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
|
||||
UINT32 intSave;
|
||||
INT32 depth;
|
||||
enum LockDepErrType checkResult = LOCKDEP_SUCCESS;
|
||||
#ifdef LOSCFG_COMPILER_CLANG_LLVM
|
||||
VOID *requestAddr = (VOID *)__builtin_return_address(1);
|
||||
#else
|
||||
VOID *requestAddr = (VOID *)__builtin_return_address(0);
|
||||
#endif
|
||||
LosTaskCB *current = OsCurrTaskGet();
|
||||
LosTaskCB *owner = NULL;
|
||||
LockDep *lockDep = NULL;
|
||||
|
||||
@@ -1238,7 +1238,7 @@ STATIC CONSOLE_CB *OsConsoleCreate(UINT32 consoleID, const CHAR *deviceName)
|
||||
|
||||
ret = (INT32)LOS_SemCreate(1, &consoleCB->consoleSem);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("creat sem for uart failed\n");
|
||||
PRINT_ERR("create sem for uart failed\n");
|
||||
goto ERR_WITH_BUF;
|
||||
}
|
||||
|
||||
|
||||
@@ -198,6 +198,7 @@ __attribute__((noinline)) VOID UartPrintf(const CHAR *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#ifndef LOSCFG_LIBC_NEWLIB
|
||||
__attribute__((noinline)) VOID dprintf(const CHAR *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -210,6 +211,7 @@ __attribute__((noinline)) VOID dprintf(const CHAR *fmt, ...)
|
||||
#endif
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID LkDprintf(const CHAR *fmt, va_list ap)
|
||||
{
|
||||
@@ -279,7 +281,7 @@ VOID LOS_LkPrint(INT32 level, const CHAR *func, INT32 line, const CHAR *fmt, ...
|
||||
}
|
||||
|
||||
if ((level != LOS_COMMON_LEVEL) && ((level > LOS_EMG_LEVEL) && (level <= LOS_TRACE_LEVEL))) {
|
||||
dprintf("[%s][%s:%s]", g_logString[level],
|
||||
PRINTK("[%s][%s:%s]", g_logString[level],
|
||||
((OsCurrProcessGet() == NULL) ? "NULL" : OsCurrProcessGet()->processName),
|
||||
((OsCurrTaskGet() == NULL) ? "NULL" : OsCurrTaskGet()->taskName));
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ static ssize_t HiLogRead(struct file *filep, char *buffer, size_t bufLen)
|
||||
}
|
||||
|
||||
if (bufLen < header.len + sizeof(header)) {
|
||||
dprintf("buffer too small,bufLen=%d, header.len=%d,%d\n", bufLen, header.len, header.hdrSize);
|
||||
PRINTK("buffer too small,bufLen=%d, header.len=%d,%d\n", bufLen, header.len, header.hdrSize);
|
||||
retval = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ static void HiLogHeadInit(struct HiLogEntry *header, size_t len)
|
||||
|
||||
ret = clock_gettime(CLOCK_REALTIME, &now);
|
||||
if (ret != 0) {
|
||||
dprintf("In %s line %d,clock_gettime fail\n", __FUNCTION__, __LINE__);
|
||||
PRINTK("In %s line %d,clock_gettime fail\n", __FUNCTION__, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ static void HiLogCoverOldLog(size_t bufLen)
|
||||
if (isLastTimeFull == 1 && isThisTimeFull == 0) {
|
||||
/* so we can only print one log if hilog ring buffer is full in a short time */
|
||||
if (dropLogLines > 0) {
|
||||
dprintf("hilog ringbuffer full, drop %d line(s) log\n", dropLogLines);
|
||||
PRINTK("hilog ringbuffer full, drop %d line(s) log\n", dropLogLines);
|
||||
}
|
||||
isLastTimeFull = 0;
|
||||
dropLogLines = 0;
|
||||
@@ -319,7 +319,7 @@ out:
|
||||
wake_up_interruptible(&g_hiLogDev.wq);
|
||||
}
|
||||
if (retval < 0) {
|
||||
dprintf("write fail retval=%d\n", retval);
|
||||
PRINTK("write fail retval=%d\n", retval);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@@ -328,7 +328,7 @@ static ssize_t HiLogWrite(struct file *filep, const char *buffer, size_t bufLen)
|
||||
{
|
||||
(void)filep;
|
||||
if (bufLen + sizeof(struct HiLogEntry) > HILOG_BUFFER) {
|
||||
dprintf("input too large\n");
|
||||
PRINTK("input too large\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ static void HiLogDeviceInit(void)
|
||||
{
|
||||
g_hiLogDev.buffer = LOS_MemAlloc((VOID *)OS_SYS_MEM_ADDR, HILOG_BUFFER);
|
||||
if (g_hiLogDev.buffer == NULL) {
|
||||
dprintf("In %s line %d,LOS_MemAlloc fail\n", __FUNCTION__, __LINE__);
|
||||
PRINTK("In %s line %d,LOS_MemAlloc fail\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
init_waitqueue_head(&g_hiLogDev.wq);
|
||||
|
||||
@@ -1026,7 +1026,7 @@ LITE_OS_SEC_TEXT STATIC UINT32 CheckPara(IpcContent *content, UINT32 *dstTid)
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
PRINT_DEBUG("Unknow msg type:%d\n", msg->type);
|
||||
PRINT_DEBUG("Unknown msg type:%d\n", msg->type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1118,13 +1118,13 @@ LITE_OS_SEC_TEXT STATIC UINT32 CheckRecievedMsg(IpcListNode *node, IpcContent *c
|
||||
}
|
||||
#if (USE_TIMESTAMP == 1)
|
||||
if (node->msg.timestamp != content->outMsg->timestamp) {
|
||||
PRINT_ERR("Recieve a unmatch reply, drop it\n");
|
||||
PRINT_ERR("Receive a unmatch reply, drop it\n");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
#else
|
||||
if ((node->msg.code != content->outMsg->code) ||
|
||||
(node->msg.target.token != content->outMsg->target.token)) {
|
||||
PRINT_ERR("Recieve a unmatch reply, drop it\n");
|
||||
PRINT_ERR("Receive a unmatch reply, drop it\n");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
#endif
|
||||
@@ -1132,7 +1132,7 @@ LITE_OS_SEC_TEXT STATIC UINT32 CheckRecievedMsg(IpcListNode *node, IpcContent *c
|
||||
case MT_DEATH_NOTIFY:
|
||||
break;
|
||||
default:
|
||||
PRINT_ERR("Unknow msg type:%d\n", node->msg.type);
|
||||
PRINT_ERR("Unknown msg type:%d\n", node->msg.type);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
if (ret != LOS_OK) {
|
||||
@@ -1310,7 +1310,7 @@ LITE_OS_SEC_TEXT STATIC UINT32 HandleCmsCmd(CmsCmdContent *content)
|
||||
}
|
||||
return AddServiceAccess(localContent.taskID, localContent.serviceHandle);
|
||||
default:
|
||||
PRINT_DEBUG("Unknow cmd cmd:%d\n", localContent.cmd);
|
||||
PRINT_DEBUG("Unknown cmd cmd:%d\n", localContent.cmd);
|
||||
return -EINVAL;
|
||||
}
|
||||
return ret;
|
||||
@@ -1375,7 +1375,7 @@ LITE_OS_SEC_TEXT int LiteIpcIoctl(struct file *filep, int cmd, unsigned long arg
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PRINT_ERR("Unknow liteipc ioctl cmd:%d\n", cmd);
|
||||
PRINT_ERR("Unknown liteipc ioctl cmd:%d\n", cmd);
|
||||
return -EINVAL;
|
||||
}
|
||||
return (INT32)ret;
|
||||
|
||||
@@ -87,9 +87,9 @@ typedef VOID (*pf_OUTPUT)(const CHAR *fmt, ...);
|
||||
* <ul><li>los_printf.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see printf
|
||||
*/
|
||||
#ifndef LOSCFG_LIBC_NEWLIB
|
||||
extern void dprintf(const char *fmt, ...);
|
||||
|
||||
#define diag_printf dprintf
|
||||
#endif
|
||||
|
||||
#define PRINT_DEBUG(fmt, args...) LOS_LkPrint(LOS_DEBUG_LEVEL, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
#define PRINT_INFO(fmt, args...) LOS_LkPrint(LOS_INFO_LEVEL, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
|
||||
@@ -977,7 +977,7 @@ extern UINT32 LOS_TaskInfoGet(UINT32 taskID, TSK_INFO_S *taskInfo);
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>If any low LOSCFG_KERNEL_CORE_NUM bit of the mask is not setted, an error is reported.</li>
|
||||
* <li>If any low LOSCFG_KERNEL_CORE_NUM bit of the mask is not set, an error is reported.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param uwTaskID [IN] Type #UINT32 Task ID. The task id value is obtained from task creation.
|
||||
@@ -987,7 +987,7 @@ extern UINT32 LOS_TaskInfoGet(UINT32 taskID, TSK_INFO_S *taskInfo);
|
||||
* @retval #LOS_ERRNO_TSK_ID_INVALID Invalid task ID.
|
||||
* @retval #LOS_ERRNO_TSK_NOT_CREATED The task is not created.
|
||||
* @retval #LOS_ERRNO_TSK_CPU_AFFINITY_MASK_ERR The task cpu affinity mask is incorrect.
|
||||
* @retval #LOS_OK The task cpu affinity mask is successfully setted.
|
||||
* @retval #LOS_OK The task cpu affinity mask is successfully set.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_task.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_TaskCpuAffiGet
|
||||
|
||||
14
lib/Kconfig
14
lib/Kconfig
@@ -5,6 +5,20 @@ config LIB_LIBC
|
||||
help
|
||||
Answer Y to enable libc for full code.
|
||||
|
||||
choice
|
||||
prompt "choose libc"
|
||||
default LIBC_MUSL
|
||||
depends on LIB_LIBC
|
||||
help
|
||||
Choose libc.
|
||||
|
||||
config LIBC_NEWLIB
|
||||
bool "newlibc"
|
||||
|
||||
config LIBC_MUSL
|
||||
bool "musl libc"
|
||||
endchoice
|
||||
|
||||
config LIB_ZLIB
|
||||
bool "Enable Zlib"
|
||||
default y
|
||||
|
||||
@@ -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:
|
||||
@@ -29,93 +29,16 @@
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
MUSLDIR = "$LITEOSTHIRDPARTY/musl"
|
||||
|
||||
import("//third_party/optimized-routines/optimized-routines.gni")
|
||||
import("$MUSLDIR/porting/liteos_a/kernel/musl.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_LIB_LIBC)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
kernel_module(module_name) {
|
||||
sources = MUSL_SRC_COMMON
|
||||
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
|
||||
sources += MUSL_SRC_ARM
|
||||
foreach(f, MUSL_SRC_ARM) {
|
||||
sources -= [ string_replace(f, "/arm/", "/") ]
|
||||
}
|
||||
}
|
||||
|
||||
if (LOSCFG_ARCH_ARM_VER == "armv7-a") {
|
||||
sources -= [
|
||||
"$MUSLPORTINGDIR/src/string/memchr.c",
|
||||
"$MUSLPORTINGDIR/src/string/memcpy.c",
|
||||
"$MUSLPORTINGDIR/src/string/strcmp.c",
|
||||
"$MUSLPORTINGDIR/src/string/strcpy.c",
|
||||
"$MUSLPORTINGDIR/src/string/strlen.c",
|
||||
]
|
||||
sources += [
|
||||
"src/arch/arm/memcmp.S",
|
||||
"src/arch/arm/memset.S",
|
||||
]
|
||||
sources += OPTRT_STRING_ARM_SRC_FILES_FOR_ARMV7_A
|
||||
asmflags = [
|
||||
"-D__strlen_armv6t2=strlen",
|
||||
"-D__strcmp_arm=strcmp",
|
||||
"-D__memchr_arm=memchr",
|
||||
]
|
||||
if (defined(LOSCFG_KERNEL_LMS)) {
|
||||
asmflags += [
|
||||
"-D__memcpy_arm=__memcpy",
|
||||
"-D__strcpy_arm=__strcpy",
|
||||
]
|
||||
} else {
|
||||
asmflags += [
|
||||
"-D__memcpy_arm=memcpy",
|
||||
"-D__strcpy_arm=strcpy",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
# arch is not armv7-a
|
||||
sources += [
|
||||
"src/memcmp.c",
|
||||
"src/memset.c",
|
||||
]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"$MUSLPORTINGDIR/src/include",
|
||||
"$MUSLPORTINGDIR/src/internal",
|
||||
group("libc") {
|
||||
deps = [
|
||||
"musl",
|
||||
"newlib",
|
||||
]
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
configs += [ ":private" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
cflags = [
|
||||
"-isystem",
|
||||
rebase_path("$MUSLPORTINGDIR/include"),
|
||||
]
|
||||
}
|
||||
|
||||
config("private") {
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags = [
|
||||
"-Wno-char-subscripts",
|
||||
"-Wno-unknown-pragmas",
|
||||
]
|
||||
} else {
|
||||
cflags = [
|
||||
"-frounding-math",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-unknown-pragmas",
|
||||
]
|
||||
}
|
||||
|
||||
cflags += [
|
||||
"-Wno-shift-op-parentheses",
|
||||
"-Wno-logical-op-parentheses",
|
||||
"-Wno-bitwise-op-parentheses",
|
||||
configs = [
|
||||
"musl:public",
|
||||
"newlib:public",
|
||||
]
|
||||
}
|
||||
|
||||
122
lib/libc/musl/BUILD.gn
Normal file
122
lib/libc/musl/BUILD.gn
Normal file
@@ -0,0 +1,122 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies 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:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
MUSLDIR = "$LITEOSTHIRDPARTY/musl"
|
||||
|
||||
import("//third_party/optimized-routines/optimized-routines.gni")
|
||||
import("$MUSLDIR/porting/liteos_a/kernel/musl.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_LIBC_MUSL)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
kernel_module(module_name) {
|
||||
sources = MUSL_SRC_COMMON
|
||||
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
|
||||
sources += MUSL_SRC_ARM
|
||||
foreach(f, MUSL_SRC_ARM) {
|
||||
sources -= [ string_replace(f, "/arm/", "/") ]
|
||||
}
|
||||
}
|
||||
|
||||
if (LOSCFG_ARCH_ARM_VER == "armv7-a") {
|
||||
sources -= [
|
||||
"$MUSLPORTINGDIR/src/string/memchr.c",
|
||||
"$MUSLPORTINGDIR/src/string/memcpy.c",
|
||||
"$MUSLPORTINGDIR/src/string/strcmp.c",
|
||||
"$MUSLPORTINGDIR/src/string/strcpy.c",
|
||||
"$MUSLPORTINGDIR/src/string/strlen.c",
|
||||
]
|
||||
sources += [
|
||||
"src/arch/arm/memcmp.S",
|
||||
"src/arch/arm/memset.S",
|
||||
]
|
||||
sources += OPTRT_STRING_ARM_SRC_FILES_FOR_ARMV7_A
|
||||
asmflags = [
|
||||
"-D__strlen_armv6t2=strlen",
|
||||
"-D__strcmp_arm=strcmp",
|
||||
"-D__memchr_arm=memchr",
|
||||
]
|
||||
if (defined(LOSCFG_KERNEL_LMS)) {
|
||||
asmflags += [
|
||||
"-D__memcpy_arm=__memcpy",
|
||||
"-D__strcpy_arm=__strcpy",
|
||||
]
|
||||
} else {
|
||||
asmflags += [
|
||||
"-D__memcpy_arm=memcpy",
|
||||
"-D__strcpy_arm=strcpy",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
# arch is not armv7-a
|
||||
sources += [
|
||||
"src/memcmp.c",
|
||||
"src/memset.c",
|
||||
]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"$MUSLPORTINGDIR/src/include",
|
||||
"$MUSLPORTINGDIR/src/internal",
|
||||
]
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
configs += [ ":private" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
cflags = [
|
||||
"-isystem",
|
||||
rebase_path("$MUSLPORTINGDIR/include"),
|
||||
]
|
||||
}
|
||||
|
||||
config("private") {
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags = [
|
||||
"-Wno-char-subscripts",
|
||||
"-Wno-ignored-pragmas",
|
||||
"-Wno-strict-prototypes",
|
||||
]
|
||||
} else {
|
||||
cflags = [
|
||||
"-frounding-math",
|
||||
"-Wno-unused-but-set-variable",
|
||||
]
|
||||
}
|
||||
|
||||
cflags += [
|
||||
"-Wno-shift-op-parentheses",
|
||||
"-Wno-logical-op-parentheses",
|
||||
"-Wno-bitwise-op-parentheses",
|
||||
"-Wno-unknown-pragmas",
|
||||
]
|
||||
}
|
||||
@@ -59,10 +59,10 @@ LOCAL_INCLUDE += $(addprefix -I$(MUSLPORTINGDIR)/, src/include src/internal)
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LOCAL_CMACRO)
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
LOCAL_FLAGS +=-Wno-char-subscripts -Wno-unknown-pragmas
|
||||
LOCAL_FLAGS +=-Wno-char-subscripts -Wno-ignored-pragmas -Wno-strict-prototypes
|
||||
else
|
||||
LOCAL_FLAGS += -frounding-math -Wno-unused-but-set-variable -Wno-unknown-pragmas
|
||||
LOCAL_FLAGS += -frounding-math -Wno-unused-but-set-variable
|
||||
endif
|
||||
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses
|
||||
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses -Wno-unknown-pragmas
|
||||
|
||||
include $(MODULE)
|
||||
58
lib/libc/newlib/BUILD.gn
Normal file
58
lib/libc/newlib/BUILD.gn
Normal file
@@ -0,0 +1,58 @@
|
||||
# Copyright (c) 2022-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:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/musl/porting/liteos_a_newlib/kernel/newlib.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_LIBC_NEWLIB)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
kernel_module(module_name) {
|
||||
sources = NEWLIB_ADAPT_SRC_COMMON
|
||||
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||
|
||||
configs += [ ":private" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "porting/include" ]
|
||||
include_dirs += NEWLIB_ADAPT_INCLUDE_DIRS
|
||||
}
|
||||
|
||||
config("private") {
|
||||
cflags = [
|
||||
"-frounding-math",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-unknown-pragmas",
|
||||
]
|
||||
|
||||
cflags += [
|
||||
"-Wno-shift-op-parentheses",
|
||||
"-Wno-logical-op-parentheses",
|
||||
"-Wno-bitwise-op-parentheses",
|
||||
]
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import("$root_out_dir/config.gni")
|
||||
|
||||
LITEOSTOPDIR = "//kernel/liteos_a"
|
||||
LITEOSTHIRDPARTY = "//third_party"
|
||||
HDFTOPDIR = "//drivers/adapter/khdf/liteos"
|
||||
HDFTOPDIR = "//drivers/hdf_core/adapter/khdf/liteos"
|
||||
|
||||
ARCH = ""
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
|
||||
|
||||
@@ -243,7 +243,7 @@ struct ifconfig_option {
|
||||
unsigned char ethaddr[6];
|
||||
u16_t mtu;
|
||||
/* when using telnet, print to the telnet socket will result in system */
|
||||
/* deadlock. So we cahe the prinf data to a buf, and when the tcpip */
|
||||
/* deadlock. So we cache the print data to a buf, and when the tcpip */
|
||||
/* callback returns, then print the data out to the telnet socket */
|
||||
sys_sem_t cb_completed;
|
||||
char cb_print_buf[PRINT_BUF_LEN];
|
||||
@@ -1158,9 +1158,9 @@ struct arp_option {
|
||||
unsigned int ipaddr;
|
||||
/* hw addr */
|
||||
unsigned char ethaddr[6];
|
||||
/* when using telnet, printf to the telnet socket will result in system */
|
||||
/* deadlock.so don't do it.cahe the data to prinf to a buf, and when */
|
||||
/* callback returns, then printf the data out to the telnet socket */
|
||||
/* when using telnet, print to the telnet socket will result in system */
|
||||
/* deadlock.so don't do it. cache the data to print to a buf, and when */
|
||||
/* callback returns, then print the data out to the telnet socket */
|
||||
sys_sem_t cb_completed;
|
||||
char cb_print_buf[PRINT_BUF_LEN];
|
||||
int print_buf_len;
|
||||
@@ -1326,7 +1326,7 @@ out:
|
||||
} else if (ret == ERR_RTE) {
|
||||
(void)snprintf_s(arp_cmd->cb_print_buf, PRINT_BUF_LEN, (PRINT_BUF_LEN - 1), "Network is unreachable\n");
|
||||
} else {
|
||||
(void)snprintf_s(arp_cmd->cb_print_buf, PRINT_BUF_LEN, (PRINT_BUF_LEN - 1), "Successed\n");
|
||||
(void)snprintf_s(arp_cmd->cb_print_buf, PRINT_BUF_LEN, (PRINT_BUF_LEN - 1), "Succeeded\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2234,13 +2234,13 @@ u32_t osShellPing6(int argc, const char **argv)
|
||||
}
|
||||
|
||||
if ((u32_t)ret < sizeof(struct icmp6_echo_hdr *)) {
|
||||
/* Drop the packet if its too short [Doesnot contain even the header !!] */
|
||||
/* Drop the packet if its too short [Doesn't contain even the header !!] */
|
||||
PRINTK("ping6 : received ICMP echo response too short\n");
|
||||
goto REDUCE_SELECT_TIME;
|
||||
}
|
||||
|
||||
/* Acceping the ICMPv6 payload. */
|
||||
/* Here, pbuf_resp->payload wont contain IPv6 Header since its an AF_INET6 RAW Socket */
|
||||
/* Here, pbuf_resp->payload won't contain IPv6 Header since its an AF_INET6 RAW Socket */
|
||||
iecho_resp = (struct icmp6_echo_hdr *)pbuf_resp->payload;
|
||||
|
||||
if (iecho_resp->id == icmpv6_id) {
|
||||
@@ -2283,7 +2283,7 @@ u32_t osShellPing6(int argc, const char **argv)
|
||||
|
||||
/* Checking if its a delayed packet */
|
||||
if ((iecho_resp->seqno != icmpv6_seq) && (nsent < ping6_params.pingcount)) {
|
||||
/* Incase of delayed packet wait on socket for other response before sending a new PING */
|
||||
/* In case of delayed packet wait on socket for other response before sending a new PING */
|
||||
/* We have to reduce the timeout value now when selecting on socket */
|
||||
goto REDUCE_SELECT_TIME;
|
||||
}
|
||||
@@ -2313,7 +2313,7 @@ REDUCE_SELECT_TIME:
|
||||
nsent, nrecieve, (float)(((float)(nsent - nrecieve)) * ((float)(100)) / ((float)(nsent))),
|
||||
((last.tv_sec - first.tv_sec) * 1000 + (last.tv_nsec - first.tv_nsec) / 1000000));
|
||||
if (nrecieve) {
|
||||
/* Display rtt stats only if atleast one packet is received */
|
||||
/* Display rtt stats only if at least one packet is received */
|
||||
PRINTK("rtt min/avg/max = %u/%.2f/%u ms\n", ping6_stats.min_rtt, ping6_stats.avg_rtt, ping6_stats.max_rtt);
|
||||
}
|
||||
|
||||
@@ -2778,7 +2778,7 @@ int netstat_get_udp_sendQLen6(struct udp_pcb *udppcb, struct pbuf *udpbuf)
|
||||
goto FUNC_OUT;
|
||||
}
|
||||
|
||||
/* check if there is enough space for atleast udp header available */
|
||||
/* check if there is enough space for at least udp header available */
|
||||
if (udpbuf->tot_len < UDP_HLEN) {
|
||||
goto FUNC_OUT;
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ LWIP_STATIC void handle_request(struct netif *netif, struct dhcps *dhcps, struct
|
||||
dhcp_common_option_byte(srvr_msg, DHCP_NAK, &options_len);
|
||||
|
||||
/* Just set this here, so that the NAK message is brcasted.
|
||||
The correct flags has already been added in the respose message during base message creation */
|
||||
The correct flags has already been added in the response message during base message creation */
|
||||
client_msg->flags |= htons(DHCP_BROADCAST_FLAG);
|
||||
client_msg->ciaddr.addr = 0; /* This is done so that NAK Gets brcasted */
|
||||
#ifdef LWIP_DEV_DEBUG
|
||||
|
||||
@@ -51,7 +51,7 @@ static UINT32 Testcase(void)
|
||||
g_testCount = 0;
|
||||
TEST_TASK_PARAM_INIT(task1, "it_smp_task_035", (TSK_ENTRY_FUNC)TaskF02Preempt, TASK_PRIO_TEST_TASK - 1);
|
||||
|
||||
/* creat preempt task */
|
||||
/* create preempt task */
|
||||
task1.usCpuAffiMask = 0;
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
@@ -61,7 +61,7 @@ static UINT32 Testcase(void)
|
||||
TEST_TASK_PARAM_INIT(task1, "it_smp_task_042", (TSK_ENTRY_FUNC)TaskF01, TASK_PRIO_TEST_TASK);
|
||||
int i;
|
||||
|
||||
/* creat high prio task on every cores */
|
||||
/* create high prio task on every cores */
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM - 1; i++) {
|
||||
/* take control of every cores */
|
||||
task1.usCpuAffiMask = CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) % (LOSCFG_KERNEL_CORE_NUM));
|
||||
|
||||
@@ -59,7 +59,7 @@ static UINT32 Testcase(void)
|
||||
TSK_INIT_PARAM_S task1 = { 0 };
|
||||
g_testCount = 0;
|
||||
|
||||
// 5, lengh of the queue; 50, max queue msg size.
|
||||
// 5, length of the queue; 50, max queue msg size.
|
||||
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ static UINT32 Testcase(void)
|
||||
TSK_INIT_PARAM_S task1 = { 0 };
|
||||
g_testCount = 0;
|
||||
|
||||
// 5, lengh of the queue; 50, max queue msg size.
|
||||
// 5, length of the queue; 50, max queue msg size.
|
||||
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
|
||||
|
||||
TEST_TASK_PARAM_INIT(task1, "it_smp_task_063", (TSK_ENTRY_FUNC)TaskF01, TASK_PRIO_TEST_TASK - 1);
|
||||
|
||||
@@ -72,7 +72,7 @@ static UINT32 Testcase(void)
|
||||
TSK_INIT_PARAM_S task1 = { 0 };
|
||||
g_testCount = 0;
|
||||
|
||||
// 5, lengh of the queue; 50, max queue msg size.
|
||||
// 5, length of the queue; 50, max queue msg size.
|
||||
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
|
||||
|
||||
TEST_TASK_PARAM_INIT(task1, "it_smp_task_068", (TSK_ENTRY_FUNC)TaskF01, TASK_PRIO_TEST_TASK - 1);
|
||||
|
||||
@@ -71,7 +71,7 @@ static UINT32 Testcase(void)
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1 = { 0 };
|
||||
g_testCount = 0;
|
||||
// 5, lengh of the queue; 50, max queue msg size.
|
||||
// 5, length of the queue; 50, max queue msg size.
|
||||
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
|
||||
|
||||
TEST_TASK_PARAM_INIT(task1, "it_smp_task_065", (TSK_ENTRY_FUNC)TaskF01, TASK_PRIO_TEST_TASK - 1);
|
||||
|
||||
@@ -57,7 +57,7 @@ static UINT32 Testcase(void)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
/* creat core_num same priority tasks */
|
||||
/* create core_num same priority tasks */
|
||||
task1.usCpuAffiMask = 0;
|
||||
ret = LOS_TaskCreate(&testTaskIDSmp[i], &task1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
@@ -72,7 +72,7 @@ static UINT32 Testcase(void)
|
||||
|
||||
timesliceCount2 = TestTickCountGet();
|
||||
|
||||
/* Check if task yield definitely successed */
|
||||
/* Check if task yield definitely succeeded */
|
||||
ICUNIT_GOTO_NOT_EQUAL(timesliceCount2, timesliceCount1, timesliceCount2 - timesliceCount1, EXIT);
|
||||
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
|
||||
@@ -115,7 +115,7 @@ VOID ItSuiteLosSem(void)
|
||||
ItLosSem037();
|
||||
ItLosSem038();
|
||||
#ifndef LOSCFG_KERNEL_SMP_TASK_SYNC
|
||||
// LOSCFG_KERNEL_SMP_TASK_SYNC is opened ,create task success is depend on created semaphore successed;
|
||||
// LOSCFG_KERNEL_SMP_TASK_SYNC is opened ,create task success is depend on created semaphore succeeded;
|
||||
ItLosSem039();
|
||||
ItLosSem040();
|
||||
ItLosSem041();
|
||||
|
||||
@@ -39,7 +39,7 @@ extern "C" {
|
||||
|
||||
/* pthread_mutex_init 4-1.c
|
||||
* Test that pthread_mutex_init()
|
||||
* Upon succesful completion, it shall return a 0
|
||||
* Upon successful completion, it shall return a 0
|
||||
*
|
||||
*/
|
||||
static UINT32 Testcase(VOID)
|
||||
|
||||
@@ -39,7 +39,7 @@ extern "C" {
|
||||
|
||||
/* pthread_mutex_destroy 3-1.c
|
||||
* Test that pthread_mutex_destroy()
|
||||
* Upon succesful completion, it shall return a 0
|
||||
* Upon successful completion, it shall return a 0
|
||||
*
|
||||
*/
|
||||
static UINT32 Testcase(VOID)
|
||||
|
||||
@@ -43,7 +43,7 @@ extern "C" {
|
||||
* source tree.
|
||||
|
||||
* Test that pthread_mutex_lock()
|
||||
* Upon succesful completion, it shall return a 0
|
||||
* Upon successful completion, it shall return a 0
|
||||
*
|
||||
*/
|
||||
static UINT32 Testcase(VOID)
|
||||
|
||||
@@ -42,7 +42,7 @@ extern "C" {
|
||||
* shall release the mutex object 'mutex'.
|
||||
|
||||
* Steps:
|
||||
* -- Initilize a mutex object
|
||||
* -- initialize a mutex object
|
||||
* -- Get the mutex using pthread_mutex_lock()
|
||||
* -- Release the mutex using pthread_mutex_unlock()
|
||||
* -- Try to get the mutex using pthread_mutex_trylock()
|
||||
|
||||
@@ -39,7 +39,7 @@ extern "C" {
|
||||
|
||||
/* pthread_mutex_unlock 3-1.c
|
||||
* Test that pthread_mutex_unlock()
|
||||
* Upon succesful completion, it shall return zero
|
||||
* Upon successful completion, it shall return zero
|
||||
*
|
||||
*/
|
||||
static UINT32 Testcase(VOID)
|
||||
|
||||
@@ -38,7 +38,7 @@ extern "C" {
|
||||
|
||||
/* pthread_mutex_trylock 3-1.c
|
||||
* Test that pthread_mutex_trylock()
|
||||
* Upon succesful completion, it shall return a 0
|
||||
* Upon successful completion, it shall return a 0
|
||||
*
|
||||
*/
|
||||
static UINT32 Testcase(VOID)
|
||||
|
||||
@@ -43,7 +43,7 @@ extern "C" {
|
||||
* -[EBUSY] The mutex could not be acquired because it was already locked.
|
||||
|
||||
* Steps:
|
||||
* -- Initilize a mutex object
|
||||
* -- initialize a mutex object
|
||||
* -- Lock the mutex using pthread_mutex_lock()
|
||||
* -- Try to lock the mutex using pthread_mutex_trylock() and expect EBUSY
|
||||
*
|
||||
|
||||
@@ -67,7 +67,7 @@ static UINT32 Testcase(VOID)
|
||||
/*
|
||||
* Check to make sure that 'value_ptr' that was passed to
|
||||
* pthread_join() and the pthread_exit() return code that
|
||||
* was used in the thread funciton are the same.
|
||||
* was used in the thread function are the same.
|
||||
*/
|
||||
ICUNIT_ASSERT_EQUAL(valuePtr, PTHREAD_EXIT_VALUE, errno);
|
||||
|
||||
|
||||
@@ -454,7 +454,7 @@ VOID TestTaskEntry(VOID)
|
||||
#if (TEST_MODULE_CHECK == 1)
|
||||
for (int i = 0; i < g_modelNum - 1; i++) {
|
||||
if (g_executModelNum[i] != 0) {
|
||||
dprintf("\nExecuted Model: %s, Executed Model_Num: %d ,failed_count: %d , sucess_count :%d",
|
||||
dprintf("\nExecuted Model: %s, Executed Model_Num: %d ,failed_count: %d , success_count :%d",
|
||||
g_strModule[i], g_executModelNum[i], g_failModelResult[i], g_passModelResult[i]);
|
||||
}
|
||||
for (int j = 0; j < g_failResult && j < 50; j++) { // 50
|
||||
|
||||
@@ -366,7 +366,7 @@ VOID TestInitUartDev(VOID) {}
|
||||
|
||||
/* ****************************************
|
||||
Function:Test_PartInit
|
||||
Description: creat a partition for testing,partition num is 0,mount point is jffs0
|
||||
Description: create a partition for testing,partition num is 0,mount point is jffs0
|
||||
Input:
|
||||
[1]type: "spinor"
|
||||
[2]start_addr: the partition start address
|
||||
|
||||
@@ -196,7 +196,7 @@ static void HandleServiceRegAndGet(int fd, IpcMsg *data)
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("recieve service request, code:%d, service name:%s\n", data->code, info->serviceName);
|
||||
printf("receive service request, code:%d, service name:%s\n", data->code, info->serviceName);
|
||||
switch (data->code) {
|
||||
case REG_CODE:
|
||||
if (i == MAX_SREVICE_NUM) {
|
||||
|
||||
@@ -162,8 +162,8 @@ static int TestCase(void)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
printf("1 pending=%d\n", pending.__bits[0]);
|
||||
printf("1 oldmask=%d\n", oldmask.__bits[0]);
|
||||
printf("1 pending=%lu\n", pending.__bits[0]);
|
||||
printf("1 oldmask=%lu\n", oldmask.__bits[0]);
|
||||
printf("before raise\n");
|
||||
raise(SIGALRM);
|
||||
printf("after raise\n");
|
||||
@@ -172,7 +172,7 @@ static int TestCase(void)
|
||||
printf("errline = %d\n", __LINE__);
|
||||
exit(-1);
|
||||
}
|
||||
printf("pending=%d,sigismem = %d\n", pending.__bits[0], sigismember(&pending, SIGALRM));
|
||||
printf("pending=%d,sigismem = %lu\n", pending.__bits[0], sigismember(&pending, SIGALRM));
|
||||
exit(0);
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
@@ -131,7 +131,7 @@ static int TestMultiPthreadFatherProcessExit()
|
||||
sleep(1);
|
||||
retValue = waitpid(fpids, &status, 0);
|
||||
// grandchild process kill father process, so child process is recovered by init process
|
||||
// child process doesn't receive termination singal from grandchild process
|
||||
// child process doesn't receive termination signal from grandchild process
|
||||
// so waitpid() returns -1
|
||||
ICUNIT_ASSERT_EQUAL(retValue, -1, retValue);
|
||||
exit(1);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "it_test_signal.h"
|
||||
#include "signal.h"
|
||||
|
||||
static void SigHandler(int sig) // <EFBFBD>źŴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
static void SigHandler(int sig) // źŴ
|
||||
{
|
||||
if (sig == SIGINT) {
|
||||
printf("SIGINT sig\n");
|
||||
@@ -74,8 +74,8 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("newset 1 = %x\n", newset.__bits[0]);
|
||||
printf("old 1 = %x\n", old.__bits[0]);
|
||||
printf("newset 1 = %lx\n", newset.__bits[0]);
|
||||
printf("old 1 = %lx\n", old.__bits[0]);
|
||||
|
||||
retValue = sigemptyset(&newset);
|
||||
if (retValue != 0) {
|
||||
@@ -89,8 +89,8 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("newset 2 = %x\n", newset.__bits[0]);
|
||||
printf("old 2 = %x\n", old.__bits[0]);
|
||||
printf("newset 2 = %lx\n", newset.__bits[0]);
|
||||
printf("old 2 = %lx\n", old.__bits[0]);
|
||||
|
||||
retValue = sigemptyset(&newset);
|
||||
if (retValue != 0) {
|
||||
@@ -105,8 +105,8 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("newset 1 = %x\n", newset.__bits[0]);
|
||||
printf("old 1 = %x\n", old.__bits[0]);
|
||||
printf("newset 1 = %lx\n", newset.__bits[0]);
|
||||
printf("old 1 = %lx\n", old.__bits[0]);
|
||||
|
||||
retValue = sigemptyset(&wait);
|
||||
if (retValue != 0) {
|
||||
@@ -116,7 +116,7 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("wait = %x\n", wait.__bits[0]);
|
||||
printf("wait = %lx\n", wait.__bits[0]);
|
||||
|
||||
if (sigsuspend(&wait) != -1) {
|
||||
printf("sigsuspend error\n");
|
||||
@@ -126,14 +126,14 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("old 2= %x\n", old.__bits[0]);
|
||||
printf("old 2= %lx\n", old.__bits[0]);
|
||||
|
||||
sigset_t pending;
|
||||
retValue = sigemptyset(&pending);
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("pending 1= %x\n", pending.__bits[0]);
|
||||
printf("pending 1= %lx\n", pending.__bits[0]);
|
||||
retValue = raise(SIGINT);
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
@@ -142,7 +142,7 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("pending 2= %x\n", pending.__bits[0]);
|
||||
printf("pending 2= %lx\n", pending.__bits[0]);
|
||||
|
||||
retValue = raise(SIGALRM);
|
||||
if (retValue != 0) {
|
||||
@@ -152,7 +152,7 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("pending 3= %x\n", pending.__bits[0]);
|
||||
printf("pending 3= %lx\n", pending.__bits[0]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -192,8 +192,8 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("new 1 = %x\n", new1.__bits[0]);
|
||||
printf("old 1 = %x\n", old1.__bits[0]);
|
||||
printf("new 1 = %lx\n", new1.__bits[0]);
|
||||
printf("old 1 = %lx\n", old1.__bits[0]);
|
||||
|
||||
retValue = kill(getpid(), SIGINT);
|
||||
if (retValue != 0) {
|
||||
@@ -203,7 +203,7 @@ static int TestSigSuspend()
|
||||
if (retValue != 0) {
|
||||
exit(retValue);
|
||||
}
|
||||
printf("raise 1 = %x\n", new1.__bits[0]);
|
||||
printf("raise 1 = %lx\n", new1.__bits[0]);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ static int g_sigCount = 0;
|
||||
static void SigPrint(int signum)
|
||||
{
|
||||
g_sigCount++;
|
||||
printf("signal receive sucess\n");
|
||||
printf("signal receive success\n");
|
||||
}
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
@@ -101,7 +101,7 @@ static UINT32 TestCase(VOID)
|
||||
sleep(1);
|
||||
ret = kill(pid, SIGUSR1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
printf("kill sucess\n");
|
||||
printf("kill success\n");
|
||||
ret = waitpid(pid, &status, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, pid, ret);
|
||||
ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), LOS_OK, WEXITSTATUS(status));
|
||||
|
||||
@@ -35,7 +35,7 @@ static int g_sigCount = 0;
|
||||
static void SigPrint(int sig)
|
||||
{
|
||||
g_sigCount++;
|
||||
printf("signal receive sucess\n");
|
||||
printf("signal receive success\n");
|
||||
}
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
@@ -68,7 +68,7 @@ static UINT32 TestCase(VOID)
|
||||
sleep(1);
|
||||
ret = kill(pid, SIGUSR1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
printf("kill sucess\n");
|
||||
printf("kill success\n");
|
||||
wait(&ret);
|
||||
ICUNIT_ASSERT_EQUAL(WEXITSTATUS(ret), LOS_OK, WEXITSTATUS(ret));
|
||||
return LOS_OK;
|
||||
|
||||
@@ -36,13 +36,13 @@ static int g_sigCount1 = 0;
|
||||
static void SigPrint(int sig)
|
||||
{
|
||||
g_sigCount++;
|
||||
printf("signal receive sucess\n");
|
||||
printf("signal receive success\n");
|
||||
}
|
||||
|
||||
static void SigPrint1(int sig)
|
||||
{
|
||||
g_sigCount1++;
|
||||
printf("signal receive sucess\n");
|
||||
printf("signal receive success\n");
|
||||
}
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
|
||||
@@ -37,7 +37,7 @@ static void SigPrint(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
g_sigCount++;
|
||||
printf("signal receive sucess\n");
|
||||
printf("signal receive success\cn");
|
||||
}
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
|
||||
@@ -36,7 +36,7 @@ static void SigPrint(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
g_sigCount++;
|
||||
printf("signal receive sucess\n");
|
||||
printf("signal receive success\n");
|
||||
}
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
|
||||
@@ -32,18 +32,36 @@
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
|
||||
const int domain_name_length = 10;
|
||||
const int buffer_size = 50;
|
||||
|
||||
static UINT32 testcase(VOID)
|
||||
{
|
||||
char *s = "";
|
||||
char domain[buffer_size], tmp[domain_name_length];
|
||||
srand(time(NULL));
|
||||
for (int i = 0, r = 0; i < domain_name_length; i++) {
|
||||
r = rand() % 36; // 36: 0-9 and a-z
|
||||
if (r < 10) { // 10: 0-9
|
||||
tmp[i] = '0' + r;
|
||||
} else {
|
||||
tmp[i] = 'a' + r;
|
||||
}
|
||||
}
|
||||
int ret = sprintf_s(domain, sizeof(domain), "www.%s.com", tmp);
|
||||
if (ret == 0) {
|
||||
printf("sprinf_s failed\n");
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
textdomain("gettext_demo");
|
||||
bindtextdomain("gettext_demo", ".");
|
||||
bind_textdomain_codeset("gettext_demo", "UTF-8");
|
||||
|
||||
printf(dcgettext("www.huawei.com", "TestString1\n", LC_MESSAGES));
|
||||
printf(dcgettext(domain, "TestString1\n", LC_MESSAGES));
|
||||
|
||||
s = dcgettext("www.huawei.com", "TestString1\n", LC_MESSAGES);
|
||||
s = dcgettext(domain, "TestString1\n", LC_MESSAGES);
|
||||
printf("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s);
|
||||
ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1\n", s);
|
||||
setlocale(LC_ALL, "C");
|
||||
|
||||
@@ -82,10 +82,10 @@ EXIT:
|
||||
4. use the mq_close to close the mqueue;
|
||||
5. use the mq_unlink to delete the mqueue.
|
||||
*-@texpect
|
||||
1. Return successed
|
||||
2. Return successed
|
||||
3. Return successed
|
||||
4. Return successed
|
||||
1. Return succeeded
|
||||
2. Return succeeded
|
||||
3. Return succeeded
|
||||
4. Return succeeded
|
||||
5. Successful operation
|
||||
*-@tprior 1
|
||||
*-@tauto TRUE
|
||||
|
||||
@@ -60,7 +60,7 @@ static UINT32 Testcase(VOID)
|
||||
/*
|
||||
* Check to make sure that 'value_ptr' that was passed to
|
||||
* pthread_join() and the pthread_exit() return code that
|
||||
* was used in the thread funciton are the same.
|
||||
* was used in the thread function are the same.
|
||||
*/
|
||||
ICUNIT_ASSERT_EQUAL(valuePtr, PTHREAD_EXIT_VALUE, errno);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ static UINT32 TestCase(VOID)
|
||||
|
||||
x = nrand48(seed);
|
||||
if ((x < 0) || (x > MAX_NRAND48)) {
|
||||
printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x);
|
||||
printf("[IN %s][line %d] x = %ld\n", __FUNCTION__, __LINE__, x);
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ static UINT32 TestCase(VOID)
|
||||
|
||||
x = random();
|
||||
if (x > labs(MAX_RANDOM - 1)) {
|
||||
printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x);
|
||||
printf("[IN %s][line %d] x = %ld\n", __FUNCTION__, __LINE__, x);
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
#include "It_test_sys.h"
|
||||
|
||||
#define TEST_PASSWORD (char *)"test1234"
|
||||
const int password_length = 10;
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
@@ -39,14 +39,24 @@ static UINT32 TestCase(VOID)
|
||||
char *key = NULL;
|
||||
char slat[2];
|
||||
int ret;
|
||||
char test_password[password_length];
|
||||
srand(time(NULL));
|
||||
for (int i = 0, r = 0; i < password_length; i++) {
|
||||
r = rand() % 36; // 36: 0-9 and a-z
|
||||
if (r < 10) { // 10: 0-9
|
||||
test_password[i] = '0' + r;
|
||||
} else {
|
||||
test_password[i] = 'a' + r;
|
||||
}
|
||||
}
|
||||
|
||||
key = TEST_PASSWORD;
|
||||
key = test_password;
|
||||
slat[0] = key[0];
|
||||
slat[1] = key[1];
|
||||
passwd1 = crypt(key, slat);
|
||||
ICUNIT_GOTO_NOT_EQUAL(passwd1, NULL, passwd1, EXIT);
|
||||
|
||||
key = TEST_PASSWORD;
|
||||
key = test_password;
|
||||
slat[0] = passwd1[0];
|
||||
slat[1] = passwd1[1];
|
||||
passwd2 = crypt(key, slat);
|
||||
|
||||
@@ -39,7 +39,7 @@ static UINT32 TestCase(VOID)
|
||||
|
||||
x = jrand48(seed);
|
||||
if ((x < -JRAND48_NUM) || (x > JRAND48_NUM)) {
|
||||
printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x);
|
||||
printf("[IN %s][line %d] x = %ld\n", __FUNCTION__, __LINE__, x);
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ static UINT32 TestCase(VOID)
|
||||
lcong48(seed);
|
||||
x = mrand48();
|
||||
if ((x < -MRAND48_NUM) || (x > MRAND48_NUM)) {
|
||||
printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x);
|
||||
printf("[IN %s][line %d] x = %ld\n", __FUNCTION__, __LINE__, x);
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,21 +32,31 @@
|
||||
|
||||
#include <lt_net_resolv.h>
|
||||
|
||||
const int buffer_size = 20;
|
||||
|
||||
static int EtherAtonTest(void)
|
||||
{
|
||||
struct ether_addr *eaddr = ether_aton("01::EF");
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(eaddr, NULL, -1);
|
||||
|
||||
eaddr = ether_aton("2C:9D:1E:4A:41:55");
|
||||
char mac_addr[buffer_size], *tmp = mac_addr;
|
||||
int r[ETH_ALEN];
|
||||
srand(time(NULL));
|
||||
for (int i = 0; i < ETH_ALEN; i++) {
|
||||
r[i] = rand() % 0xff;
|
||||
}
|
||||
// 0, 1, 2, 3, 4, 5: 6 elements of mac address.
|
||||
(void)sprintf_s(mac_addr, sizeof(mac_addr), "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", r[0], r[1], r[2], r[3], r[4], r[5]);
|
||||
eaddr = ether_aton(mac_addr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(eaddr, NULL, -1);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[0], 0x2C, eaddr->ether_addr_octet[0]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[1], 0x9D, eaddr->ether_addr_octet[1]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[2], 0x1E, eaddr->ether_addr_octet[2]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[3], 0x4A, eaddr->ether_addr_octet[3]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[4], 0x41, eaddr->ether_addr_octet[4]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[5], 0x55, eaddr->ether_addr_octet[5]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[0], r[0], eaddr->ether_addr_octet[0]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[1], r[1], eaddr->ether_addr_octet[1]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[2], r[2], eaddr->ether_addr_octet[2]); // 2: compare r[2] with eaddr
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[3], r[3], eaddr->ether_addr_octet[3]); // 3: compare r[3] with eaddr
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[4], r[4], eaddr->ether_addr_octet[4]); // 4: compare r[4] with eaddr
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[5], r[5], eaddr->ether_addr_octet[5]); // 5: compare r[5] with eaddr
|
||||
|
||||
return ICUNIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <lt_net_resolv.h>
|
||||
|
||||
const int buffer_size = 20;
|
||||
|
||||
static int EtherAtonrTest(void)
|
||||
{
|
||||
struct ether_addr addr;
|
||||
@@ -39,15 +41,23 @@ static int EtherAtonrTest(void)
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(eaddr, NULL, -1);
|
||||
|
||||
eaddr = ether_aton_r("2c:9d:1e:4A:41:55", &addr);
|
||||
char mac_addr[buffer_size], *tmp = mac_addr;
|
||||
int r[ETH_ALEN];
|
||||
srand(time(NULL));
|
||||
for (int i = 0; i < ETH_ALEN; i++) {
|
||||
r[i] = rand() % 0xff;
|
||||
}
|
||||
// 0, 1, 2, 3, 4, 5: 6 elements of mac address.
|
||||
(void)sprintf_s(mac_addr, sizeof(mac_addr), "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", r[0], r[1], r[2], r[3], r[4], r[5]);
|
||||
eaddr = ether_aton_r(mac_addr, &addr);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(eaddr, &addr, -1);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[0], 0x2c, eaddr->ether_addr_octet[0]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[1], 0x9d, eaddr->ether_addr_octet[1]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[2], 0x1e, eaddr->ether_addr_octet[2]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[3], 0x4a, eaddr->ether_addr_octet[3]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[4], 0x41, eaddr->ether_addr_octet[4]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[5], 0x55, eaddr->ether_addr_octet[5]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[0], r[0], eaddr->ether_addr_octet[0]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[1], r[1], eaddr->ether_addr_octet[1]);
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[2], r[2], eaddr->ether_addr_octet[2]); // 2: compare r[2] with eaddr
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[3], r[3], eaddr->ether_addr_octet[3]); // 3: compare r[3] with eaddr
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[4], r[4], eaddr->ether_addr_octet[4]); // 4: compare r[4] with eaddr
|
||||
ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[5], r[5], eaddr->ether_addr_octet[5]); // 5: compare r[5] with eaddr
|
||||
|
||||
return ICUNIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -32,13 +32,26 @@
|
||||
|
||||
#include <lt_net_resolv.h>
|
||||
|
||||
const int buffer_size = 20;
|
||||
|
||||
static int EtherNtoaTest(void)
|
||||
{
|
||||
struct ether_addr addr = {{11,12,13,14,15,16}}, *eaddr = &addr;
|
||||
struct ether_addr addr, *eaddr = &addr;
|
||||
srand(time(NULL));
|
||||
int r[ETH_ALEN];
|
||||
for (int i = 0; i < ETH_ALEN; i++) {
|
||||
r[i] = rand() % 16; // 16: 0x0-0xf
|
||||
eaddr->ether_addr_octet[i] = r[i];
|
||||
}
|
||||
char *buf = ether_ntoa(eaddr);
|
||||
char str1[buffer_size], str2[buffer_size];
|
||||
// 0, 1, 2, 3, 4, 5: 6 elements of mac address.
|
||||
(void)sprintf_s(str1, sizeof(str1), "%x:%x:%x:%x:%x:%x", r[0], r[1], r[2], r[3], r[4], r[5]);
|
||||
// 0, 1, 2, 3, 4, 5: 6 elements of mac address.
|
||||
(void)sprintf_s(str2, sizeof(str2), "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", r[0], r[1], r[2], r[3], r[4], r[5]);
|
||||
|
||||
ICUNIT_ASSERT_NOT_EQUAL(buf, 0, -1);
|
||||
ICUNIT_ASSERT_EQUAL((stricmp("b:c:d:e:f:10", buf) == 0 || stricmp("0b:0c:0d:0e:0f:10", buf) == 0), 1, printf("%s\n", buf));
|
||||
ICUNIT_ASSERT_EQUAL((stricmp(str1, buf) == 0 || stricmp(str2, buf) == 0), 1, printf("%s\n", buf));
|
||||
|
||||
return ICUNIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -31,13 +31,27 @@
|
||||
|
||||
#include <lt_net_resolv.h>
|
||||
|
||||
const int buffer_size = 20;
|
||||
|
||||
static int EtherNtoarTest(void)
|
||||
{
|
||||
struct ether_addr addr = {{11,12,13,4,15,16}}, *eaddr = &addr;
|
||||
struct ether_addr addr, *eaddr = &addr;
|
||||
srand(time(NULL));
|
||||
int r[ETH_ALEN];
|
||||
for (int i = 0; i < ETH_ALEN; i++) {
|
||||
r[i] = rand() % 16; // 16: 0x0-0xf
|
||||
eaddr->ether_addr_octet[i] = r[i];
|
||||
}
|
||||
char buf[100], *p = ether_ntoa_r(eaddr, buf);
|
||||
|
||||
char str1[buffer_size], str2[buffer_size];
|
||||
// 0, 1, 2, 3, 4, 5: 6 elements of mac address.
|
||||
(void)sprintf_s(str1, sizeof(str1), "%x:%x:%x:%x:%x:%x", r[0], r[1], r[2], r[3], r[4], r[5]);
|
||||
// 0, 1, 2, 3, 4, 5: 6 elements of mac address.
|
||||
(void)sprintf_s(str2, sizeof(str2), "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", r[0], r[1], r[2], r[3], r[4], r[5]);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(p, buf, (intptr_t)p);
|
||||
ICUNIT_ASSERT_EQUAL((stricmp("b:c:d:4:f:10", buf) == 0 || stricmp("0b:0c:0d:04:0f:10", buf) == 0), 1, printf("%s\n", p));
|
||||
ICUNIT_ASSERT_EQUAL((stricmp(str1, buf) == 0 || stricmp(str2, buf) == 0), 1, printf("%s\n", p));
|
||||
|
||||
return ICUNIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -64,12 +64,8 @@ EXIT:
|
||||
|
||||
static int Testcase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
pthread_t newPthread, newPthread1;
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex;
|
||||
int index = 0;
|
||||
pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL);
|
||||
|
||||
@@ -65,10 +65,8 @@ static int Testcase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
pthread_t newPthread, newPthread1;
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex;
|
||||
int index = 0;
|
||||
int currThreadPri, currThreadPolicy;
|
||||
|
||||
@@ -74,12 +74,9 @@ static int Testcase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
pthread_t newPthread, newPthread1;
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex;
|
||||
int count = 0;
|
||||
int currThreadPri, currThreadPolicy;
|
||||
|
||||
g_preTaskPri = 0xffffffff;
|
||||
|
||||
@@ -49,8 +49,6 @@ static void *ThreadFuncTest3(void *a)
|
||||
int ret;
|
||||
int tid = Gettid();
|
||||
pthread_t thread = pthread_self();
|
||||
int currThreadPri, currThreadPolicy;
|
||||
struct sched_param param = { 0 };
|
||||
|
||||
ret = pthread_detach(thread);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
@@ -124,14 +122,10 @@ EXIT:
|
||||
|
||||
static int Testcase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
pthread_t newPthread, newPthread1;
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex;
|
||||
int index = 0;
|
||||
|
||||
pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL);
|
||||
pthread_mutex_init(&g_muxLock001, &mutex);
|
||||
pthread_mutex_init(&g_muxLock002, &mutex);
|
||||
|
||||
@@ -49,8 +49,6 @@ static void *ThreadFuncTest3(void *a)
|
||||
int ret;
|
||||
int tid;
|
||||
pthread_t thread = pthread_self();
|
||||
int currThreadPri, currThreadPolicy;
|
||||
struct sched_param param = { 0 };
|
||||
|
||||
ret = pthread_detach(thread);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
@@ -126,14 +124,10 @@ EXIT:
|
||||
|
||||
static int Testcase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
pthread_t newPthread, newPthread1;
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex;
|
||||
int index = 0;
|
||||
|
||||
pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL);
|
||||
pthread_mutex_init(&g_muxLock001, &mutex);
|
||||
pthread_mutex_init(&g_muxLock002, &mutex);
|
||||
|
||||
@@ -48,8 +48,6 @@ static void *ThreadFuncTest3(void *a)
|
||||
{
|
||||
int ret;
|
||||
int tid = Gettid();
|
||||
int currThreadPri, currThreadPolicy;
|
||||
struct sched_param param = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
|
||||
ret = pthread_detach(thread);
|
||||
@@ -118,18 +116,14 @@ static void *ThreadFuncTest1(void *a)
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int Testcase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t newPthread, newPthread1;
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex;
|
||||
int index = 0;
|
||||
pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL);
|
||||
pthread_mutex_init(&g_mutexLock001, &mutex);
|
||||
pthread_mutex_init(&g_mutexLock002, &mutex);
|
||||
|
||||
@@ -43,7 +43,6 @@ static void *ThreadFuncTest3(void *a)
|
||||
{
|
||||
int ret;
|
||||
pthread_t thread = pthread_self();
|
||||
int currThreadPri, currThreadPolicy;
|
||||
struct sched_param param = { 0 };
|
||||
struct timespec time;
|
||||
struct timeval timeVal = { 0 };
|
||||
@@ -62,7 +61,7 @@ static void *ThreadFuncTest3(void *a)
|
||||
g_testToCount003++;
|
||||
|
||||
while (g_testToCount002 == 0) {
|
||||
SLEEP_AND_YIELD(2); // 2, delay enouge time
|
||||
SLEEP_AND_YIELD(2); // 2, delay enough time
|
||||
}
|
||||
|
||||
ret = pthread_mutex_unlock(&g_muxLock003);
|
||||
@@ -96,7 +95,7 @@ static void *ThreadFuncTest2(void *a)
|
||||
g_testToCount002++;
|
||||
|
||||
while (g_testToCount001 == 0) {
|
||||
SLEEP_AND_YIELD(2); // 2, delay enouge time
|
||||
SLEEP_AND_YIELD(2); // 2, delay enough time
|
||||
}
|
||||
|
||||
ret = pthread_mutex_unlock(&g_muxLock002);
|
||||
@@ -141,12 +140,8 @@ EXIT:
|
||||
|
||||
static int Testcase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
pthread_t newPthread, newPthread1;
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex = { 0 };
|
||||
int index = TEST_COUNT;
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ static void *ThreadFuncTest3(void *a)
|
||||
{
|
||||
int ret;
|
||||
pthread_t thread = pthread_self();
|
||||
int currThreadPri, currThreadPolicy;
|
||||
struct sched_param param = { 0 };
|
||||
struct timespec time;
|
||||
struct timeval timeVal = { 0 };
|
||||
|
||||
@@ -120,12 +118,8 @@ EXIT:
|
||||
|
||||
static int Testcase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
pthread_t newPthread, newPthread1;
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex;
|
||||
int index = TEST_COUNT;
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ static int g_testBackCount = 0;
|
||||
static void *ThreadFuncTest3(void *a)
|
||||
{
|
||||
int ret;
|
||||
int tid = Gettid();
|
||||
pthread_t thread = pthread_self();
|
||||
|
||||
ret = pthread_detach(thread);
|
||||
@@ -59,8 +58,6 @@ EXIT:
|
||||
static void *ThreadFuncTest2(void *a)
|
||||
{
|
||||
int ret;
|
||||
int tid = Gettid();
|
||||
pthread_t thread = pthread_self();
|
||||
|
||||
g_testBackCount++;
|
||||
ret = pthread_mutex_lock(&g_mutexLock);
|
||||
@@ -78,10 +75,8 @@ static int TestCase(void)
|
||||
{
|
||||
struct sched_param param = { 0 };
|
||||
int ret;
|
||||
void *res = nullptr;
|
||||
int currThreadPri, currThreadPolicy;
|
||||
pthread_attr_t a = { 0 };
|
||||
pthread_t thread = pthread_self();
|
||||
pthread_t newPthread;
|
||||
pthread_mutexattr_t mutex;
|
||||
pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user