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)25void *DemoSdkBiz(const char *arg) 26 { 27 (void)arg; 28 while (1) { 29 printf("it is demo biz: hello world.\n"); 30 DemoSdkSleepMs(SECOND_CNT); 31 } 32 return NULL; 33 } 34 DemoSdkEntry(void)35int DemoSdkEntry(void) 36 { 37 printf("it is demosdk entry.\n"); 38 struct TaskPara para = {0}; 39 para.name = "demotask"; 40 para.func = (void *)DemoSdkBiz; 41 para.prio = TASK_PRIO; 42 para.size = TASK_STACK_SIZE; 43 unsigned int handle; 44 int ret = DemoSdkCreateTask(&handle, ¶); 45 if (ret != 0) { 46 printf("create task fail.\n"); 47 return -1; 48 } 49 return 0; 50 } 51