• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 GOODIX.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "ohos_init.h"
17 #include "cmsis_os2.h"
18 #include "shcmd.h"
19 #include "shell.h"
20 
21 #define SHELL_TEST_TASK_STACK_SIZE   512
22 #define SHELL_TEST_TASK_PRIO         25
23 #define MS_1000                     1000
24 
CmdGetDeviceInfo(UINT32 argc,const CHAR ** argv)25 UINT32 CmdGetDeviceInfo(UINT32 argc, const CHAR **argv)
26 {
27     printf("Board:GR5515 Starter Kit, Version:OpenHarmony master\r\n");
28     return LOS_OK;
29 }
30 
ShellTestTask(const char * arg)31 static void *ShellTestTask(const char *arg)
32 {
33     (void)arg;
34 
35     osCmdReg(CMD_TYPE_EX, "devinfo", 0, CmdGetDeviceInfo);
36 
37     while (1) {
38         osDelay(MS_1000);
39     }
40 }
41 
ShellTestTaskEntry(void)42 void ShellTestTaskEntry(void)
43 {
44     osThreadAttr_t attr;
45 
46     attr.name = "ShellTestTask";
47     attr.attr_bits = 0U;
48     attr.cb_mem = NULL;
49     attr.cb_size = 0U;
50     attr.stack_mem = NULL;
51     attr.stack_size = SHELL_TEST_TASK_STACK_SIZE;
52     attr.priority = SHELL_TEST_TASK_PRIO;
53 
54     if (osThreadNew((osThreadFunc_t)ShellTestTask, NULL, &attr) == NULL) {
55         printf("[HelloDemo] Falied to create ShellTestTask!\n");
56     }
57 }
58 
59 SYS_RUN(ShellTestTaskEntry);
60