• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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  * Description: Tasks Sample Source. \n
16  *
17  * History: \n
18  * 2023-04-03, Create file. \n
19  */
20 #include "common_def.h"
21 #include "soc_osal.h"
22 #include "app_init.h"
23 
24 #define TASKS_TEST_DURATION_MS        5000
25 #define TASKS_TEST_TASK_PRIO          24
26 #define TASKS_TEST_TASK_STACK_SIZE    0x1000
27 
tasks_test_task(const char * arg)28 static void *tasks_test_task(const char *arg)
29 {
30     unused(arg);
31 
32     while (1) {
33         osal_msleep(TASKS_TEST_DURATION_MS);
34         osal_printk("Hello BS25, Now you can develop SLE Product!\r\n");
35     }
36 
37     return NULL;
38 }
39 
tasks_test_entry(void)40 static void tasks_test_entry(void)
41 {
42     osal_task *task_handle = NULL;
43     osal_kthread_lock();
44     task_handle = osal_kthread_create((osal_kthread_handler)tasks_test_task, 0, "TasksTask",
45                                       TASKS_TEST_TASK_STACK_SIZE);
46     if (task_handle != NULL) {
47         osal_kthread_set_priority(task_handle, TASKS_TEST_TASK_PRIO);
48         osal_kfree(task_handle);
49     }
50     osal_kthread_unlock();
51 }
52 
53 /* Run the tasks_test_entry. */
54 app_run(tasks_test_entry);