• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 Huawei Device Co., Ltd.
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 #include "demosdk.h"
16 
17 #include <stdio.h>
18 
19 #include "demosdk_adapter.h"
20 
21 #define TASK_STACK_SIZE 1000
22 #define TASK_PRIO 20
23 #define SECOND_CNT 1000
24 
DemoSdkBiz(const char * arg)25 static void *DemoSdkBiz(const char *arg)
26 {
27     (void)arg;
28     printf("it is demo biz: hello world.\n");
29     DemoSdkSleepMs(SECOND_CNT);
30     return NULL;
31 }
32 
DemoSdkEntry(void)33 int DemoSdkEntry(void)
34 {
35     printf("it is demosdk entry.\n");
36     struct TaskPara para = {0};
37     para.name = "demotask";
38     para.func = (void *)DemoSdkBiz;
39     para.prio = TASK_PRIO;
40     para.size = TASK_STACK_SIZE;
41     unsigned int handle;
42     int ret = DemoSdkCreateTask(&handle, &para);
43     if (ret != 0) {
44         printf("create task fail.\n");
45         return -1;
46     }
47     return 0;
48 }
49