Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
4a54de06
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4a54de06
编写于
9月 14, 2021
作者:
W
wusongqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updated printf information in md files
Signed-off-by:
N
wusongqing
<
wusongqing@huawei.com
>
上级
acdfa44c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
73 addition
and
73 deletion
+73
-73
en/device-dev/kernel/kernel-mini-basic-ipc-queue-guide.md
en/device-dev/kernel/kernel-mini-basic-ipc-queue-guide.md
+14
-14
en/device-dev/kernel/kernel-mini-basic-memory-dynamic.md
en/device-dev/kernel/kernel-mini-basic-memory-dynamic.md
+11
-11
en/device-dev/kernel/kernel-mini-basic-soft-guide.md
en/device-dev/kernel/kernel-mini-basic-soft-guide.md
+12
-12
zh-cn/device-dev/kernel/kernel-mini-basic-ipc-queue-guide.md
zh-cn/device-dev/kernel/kernel-mini-basic-ipc-queue-guide.md
+14
-14
zh-cn/device-dev/kernel/kernel-mini-basic-memory-dynamic.md
zh-cn/device-dev/kernel/kernel-mini-basic-memory-dynamic.md
+11
-11
zh-cn/device-dev/kernel/kernel-mini-basic-soft-guide.md
zh-cn/device-dev/kernel/kernel-mini-basic-soft-guide.md
+11
-11
未找到文件。
en/device-dev/kernel/kernel-mini-basic-ipc-queue-guide.md
浏览文件 @
4a54de06
...
...
@@ -121,7 +121,7 @@ VOID SendEntry(VOID)
ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0);
if(ret != LOS_OK) {
printf("
send message failure, e
rror: %x\n", ret);
printf("
Failed to send the message. E
rror: %x\n", ret);
}
}
...
...
@@ -133,22 +133,22 @@ VOID RecvEntry(VOID)
ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0);
if(ret != LOS_OK) {
printf("
recv message failure, e
rror: %x\n", ret);
printf("
Failed to receive the message. E
rror: %x\n", ret);
}
printf("
recv message
: %s\n", readBuf);
printf("
Message received
: %s\n", readBuf);
ret = LOS_QueueDelete(g_queue);
if(ret != LOS_OK) {
printf("
delete the queue failure, e
rror: %x\n", ret);
printf("
Failed to delete the queue. E
rror: %x\n", ret);
}
printf("
delete the queue success
.\n");
printf("
Queue deleted
.\n");
}
UINT32 ExampleQueue(VOID)
{
printf("
s
tart queue example.\n");
printf("
S
tart queue example.\n");
UINT32 ret = 0;
UINT32 task1, task2;
TSK_INIT_PARAM_S initParam = {0};
...
...
@@ -161,7 +161,7 @@ UINT32 ExampleQueue(VOID)
LOS_TaskLock();
ret = LOS_TaskCreate(&task1, &initParam);
if(ret != LOS_OK) {
printf("
create task1 failed, e
rror: %x\n", ret);
printf("
Failed to create task1. E
rror: %x\n", ret);
return ret;
}
...
...
@@ -170,16 +170,16 @@ UINT32 ExampleQueue(VOID)
initParam.usTaskPrio = 10;
ret = LOS_TaskCreate(&task2, &initParam);
if(ret != LOS_OK) {
printf("
create task2 failed, e
rror: %x\n", ret);
printf("
Failed to create task2. E
rror: %x\n", ret);
return ret;
}
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
if(ret != LOS_OK) {
printf("
create queue failure, e
rror: %x\n", ret);
printf("
Failed to create the queue. E
rror: %x\n", ret);
}
printf("
create the queue success
.\n");
printf("
Queue created
.\n");
LOS_TaskUnlock();
return ret;
}
...
...
@@ -190,9 +190,9 @@ UINT32 ExampleQueue(VOID)
The development is successful if the return result is as follows:
```
s
tart queue example.
create the queue success
.
recv message
: test message.
delete the queue success
.
S
tart queue example.
Queue created
.
Message received
: test message.
Queue deleted
.
```
en/device-dev/kernel/kernel-mini-basic-memory-dynamic.md
浏览文件 @
4a54de06
...
...
@@ -187,30 +187,30 @@ VOID Example_DynMem(VOID)
/* Initialize the memory pool. */
ret = LOS_MemInit(g_testPool, TEST_POOL_SIZE);
if (LOS_OK == ret) {
printf("Mem
init success!
\n");
printf("Mem
ory pool initialized.
\n");
} else {
printf("Mem
init failed!
\n");
printf("Mem
ory pool initialization failed.
\n");
return;
}
/* Allocate memory.*/
mem = (UINT32 *)LOS_MemAlloc(g_testPool, 4);
if (NULL == mem) {
printf("Mem
alloc failed!
\n");
printf("Mem
ory allocation failed.
\n");
return;
}
printf("Mem
alloc success!
\n");
printf("Mem
ory allocated.
\n");
/* Assign a value.*/
*mem = 828;
printf("*
mem
= %d\n", *mem);
printf("*
Memory
= %d\n", *mem);
/* Release memory.*/
ret = LOS_MemFree(g_testPool, mem);
if (LOS_OK == ret) {
printf("Mem
free success!
\n");
printf("Mem
ory released.
\n");
} else {
printf("Mem
free failed!
\n");
printf("Mem
ory release failed.
\n");
}
return;
...
...
@@ -222,9 +222,9 @@ VOID Example_DynMem(VOID)
The output is as follows:
```
Mem
init success!
Mem
alloc success!
*
mem
= 828
Mem
free success!
Mem
ory pool initialized.
Mem
ory allocated.
*
Memory
= 828
Mem
ory released.
```
en/device-dev/kernel/kernel-mini-basic-soft-guide.md
浏览文件 @
4a54de06
...
...
@@ -116,7 +116,7 @@ void Timer1_Callback(UINT32 arg) // Callback function 1
{
UINT32 tick_last1;
g_timerCount1++;
tick_last1 = (UINT32)LOS_TickCountGet(); //Obtain the current number of ticks.
tick_last1 = (UINT32)LOS_TickCountGet(); //
Obtain the current number of ticks.
printf("g_timerCount1=%d, tick_last1=%d\n", g_timerCount1, tick_last1);
}
...
...
@@ -140,29 +140,29 @@ void Timer_example(void)
/* Create a periodic software timer and execute callback function 2 every 100 ticks. */
LOS_SwtmrCreate(100, LOS_SWTMR_MODE_PERIOD, Timer2_Callback, &id2, 1);
printf("
create Timer1 success
\n");
printf("
Timer 1 created.
\n");
LOS_SwtmrStart(id1); // Start the one-shot software timer.
printf("
start Timer1 success
\n");
printf("
Timer 1 started.
\n");
LOS_TaskDelay(200); // Delay 200 ticks.
LOS_SwtmrTimeGet(id1, &tickCount); // Obtain the number of remaining ticks of the one-short software timer.
printf("tickCount=%d\n", tickCount);
LOS_SwtmrStop(id1); // Stop the software timer.
printf("
stop Timer1 success
\n");
printf("
Timer 1 stopped.
\n");
LOS_SwtmrStart(id1);
LOS_TaskDelay(1000);
LOS_SwtmrStart(id2); // Start the periodic software timer.
printf("
start Timer2
\n");
printf("
Timer 2 started.
\n");
LOS_TaskDelay(1000);
LOS_SwtmrStop(id2);
ret = LOS_SwtmrDelete(id2); // Delete the software timer.
if (ret == LOS_OK) {
printf("
delete Timer2 success
\n");
printf("
Timer 2 deleted.
\n");
}
}
...
...
@@ -182,7 +182,7 @@ UINT32 Example_TaskEntry(VOID)
task1.usTaskPrio = 5;
ret = LOS_TaskCreate(&g_testTaskId01, &task1);
if (ret != LOS_OK) {
printf("
TimerTsk create failed
.\n");
printf("
Failed to create the timer task
.\n");
return LOS_NOK;
}
...
...
@@ -198,12 +198,12 @@ UINT32 Example_TaskEntry(VOID)
The output is as follows:
```
create Timer1 success
start Timer1 success
Timer 1 created.
Timer 1 started.
tickCount=798
stop Timer1 success
Timer 1 stopped.
g_timerCount1=1, tick_last1=1208
start Timer2
Timer 2 started.
g_timerCount2=1 tick_last2=1313
g_timerCount2=2 tick_last2=1413
g_timerCount2=3 tick_last2=1513
...
...
@@ -214,6 +214,6 @@ g_timerCount2=7 tick_last2=1913
g_timerCount2=8 tick_last2=2013
g_timerCount2=9 tick_last2=2113
g_timerCount2=10 tick_last2=2213
delete Timer2 success
Timer 2 deleted.
```
zh-cn/device-dev/kernel/kernel-mini-basic-ipc-queue-guide.md
浏览文件 @
4a54de06
...
...
@@ -121,7 +121,7 @@ VOID SendEntry(VOID)
ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0);
if(ret != LOS_OK) {
printf("
send message failure, e
rror: %x\n", ret);
printf("
Failed to send the message. E
rror: %x\n", ret);
}
}
...
...
@@ -133,22 +133,22 @@ VOID RecvEntry(VOID)
ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0);
if(ret != LOS_OK) {
printf("
recv message failure, e
rror: %x\n", ret);
printf("
Failed to receive the message. E
rror: %x\n", ret);
}
printf("
recv message
: %s\n", readBuf);
printf("
Message received
: %s\n", readBuf);
ret = LOS_QueueDelete(g_queue);
if(ret != LOS_OK) {
printf("
delete the queue failure, e
rror: %x\n", ret);
printf("
Failed to delete the queue. E
rror: %x\n", ret);
}
printf("
delete the queue success
.\n");
printf("
Queue deleted
.\n");
}
UINT32 ExampleQueue(VOID)
{
printf("
s
tart queue example.\n");
printf("
S
tart queue example.\n");
UINT32 ret = 0;
UINT32 task1, task2;
TSK_INIT_PARAM_S initParam = {0};
...
...
@@ -161,7 +161,7 @@ UINT32 ExampleQueue(VOID)
LOS_TaskLock();
ret = LOS_TaskCreate(&task1, &initParam);
if(ret != LOS_OK) {
printf("
create task1 failed, e
rror: %x\n", ret);
printf("
Failed to create task1. E
rror: %x\n", ret);
return ret;
}
...
...
@@ -170,16 +170,16 @@ UINT32 ExampleQueue(VOID)
initParam.usTaskPrio = 10;
ret = LOS_TaskCreate(&task2, &initParam);
if(ret != LOS_OK) {
printf("
create task2 failed, e
rror: %x\n", ret);
printf("
Failed to create task2. E
rror: %x\n", ret);
return ret;
}
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
if(ret != LOS_OK) {
printf("
create queue failure, e
rror: %x\n", ret);
printf("
Failed to create the queue. E
rror: %x\n", ret);
}
printf("
create the queue success
.\n");
printf("
Queue created
.\n");
LOS_TaskUnlock();
return ret;
}
...
...
@@ -190,9 +190,9 @@ UINT32 ExampleQueue(VOID)
编译运行得到的结果为:
```
s
tart queue example.
create the queue success
.
recv message
: test message.
delete the queue success
.
S
tart queue example.
Queue created
.
Message received
: test message.
Queue deleted
.
```
zh-cn/device-dev/kernel/kernel-mini-basic-memory-dynamic.md
浏览文件 @
4a54de06
...
...
@@ -208,30 +208,30 @@ VOID Example_DynMem(VOID)
/*初始化内存池*/
ret = LOS_MemInit(g_testPool, TEST_POOL_SIZE);
if (LOS_OK == ret) {
printf("Mem
init success!
\n");
printf("Mem
ory pool initialized.
\n");
} else {
printf("Mem
init failed!
\n");
printf("Mem
ory pool initialization failed.
\n");
return;
}
/*分配内存*/
mem = (UINT32 *)LOS_MemAlloc(g_testPool, 4);
if (NULL == mem) {
printf("Mem
alloc failed!
\n");
printf("Mem
ory allocation failed.
\n");
return;
}
printf("Mem
alloc success!
\n");
printf("Mem
ory allocated.
\n");
/*赋值*/
*mem = 828;
printf("*
mem
= %d\n", *mem);
printf("*
Memory
= %d\n", *mem);
/*释放内存*/
ret = LOS_MemFree(g_testPool, mem);
if (LOS_OK == ret) {
printf("Mem
free success!
\n");
printf("Mem
ory released.
\n");
} else {
printf("Mem
free failed!
\n");
printf("Mem
ory release failed.
\n");
}
return;
...
...
@@ -243,9 +243,9 @@ VOID Example_DynMem(VOID)
输出结果如下:
```
Mem
init success!
Mem
alloc success!
*
mem
= 828
Mem
free success!
Mem
ory pool initialized.
Mem
ory allocated.
*
Memory
= 828
Mem
ory released.
```
zh-cn/device-dev/kernel/kernel-mini-basic-soft-guide.md
浏览文件 @
4a54de06
...
...
@@ -140,29 +140,29 @@ void Timer_example(void)
/*创建周期性软件定时器,每100Tick数执行回调函数2 */
LOS_SwtmrCreate(100, LOS_SWTMR_MODE_PERIOD, Timer2_Callback, &id2, 1);
printf("
create Timer1 success
\n");
printf("
Timer 1 created.
\n");
LOS_SwtmrStart(id1); //启动单次软件定时器
printf("
start Timer1 success
\n");
printf("
Timer 1 started.
\n");
LOS_TaskDelay(200); //延时200Tick数
LOS_SwtmrTimeGet(id1, &tickCount); // 获得单次软件定时器剩余Tick数
printf("tickCount=%d\n", tickCount);
LOS_SwtmrStop(id1); // 停止软件定时器
printf("
stop Timer1 success
\n");
printf("
Timer 1 stopped.
\n");
LOS_SwtmrStart(id1);
LOS_TaskDelay(1000);
LOS_SwtmrStart(id2); // 启动周期性软件定时器
printf("
start Timer2
\n");
printf("
Timer 2 started.
\n");
LOS_TaskDelay(1000);
LOS_SwtmrStop(id2);
ret = LOS_SwtmrDelete(id2); // 删除软件定时器
if (ret == LOS_OK) {
printf("
delete Timer2 success
\n");
printf("
Timer 2 deleted.
\n");
}
}
...
...
@@ -182,7 +182,7 @@ UINT32 Example_TaskEntry(VOID)
task1.usTaskPrio = 5;
ret = LOS_TaskCreate(&g_testTaskId01, &task1);
if (ret != LOS_OK) {
printf("
TimerTsk create failed
.\n");
printf("
Failed to create the timer task
.\n");
return LOS_NOK;
}
...
...
@@ -198,12 +198,12 @@ UINT32 Example_TaskEntry(VOID)
编译烧录运行,输出结果如下:
```
create Timer1 success
start Timer1 success
Timer 1 created.
Timer 1 started.
tickCount=798
stop Timer1 success
Timer 1 stopped.
g_timerCount1=1, tick_last1=1208
start Timer2
Timer 2 started.
g_timerCount2=1 tick_last2=1313
g_timerCount2=2 tick_last2=1413
g_timerCount2=3 tick_last2=1513
...
...
@@ -214,6 +214,6 @@ g_timerCount2=7 tick_last2=1913
g_timerCount2=8 tick_last2=2013
g_timerCount2=9 tick_last2=2113
g_timerCount2=10 tick_last2=2213
delete Timer2 success
Timer 2 deleted.
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录