1 1 /*-------------------------------------------------------------------------
2 2
3 3 软件主体
4 4
5 5
6 6 -------------------------------------------------------------------------*/
7 7
8 8 #include "bsp.h"
9 9 #include "App.h"
10 10
11 11 extern void MainTask(void);
12 12 extern void GUI_TOUCH_Exec(void);
13 13
14 14 static OS_TCB taskStartTCB;
15 15 static CPU_STK taskStartStk[STARTUP_TASK_STK_SIZE]; //启动任务的程序空间
16 16
17 17 static OS_TCB task1TCB;
18 18 static CPU_STK task1Stk[TASK1_STK_SIZE];
19 19
20 20 static OS_TCB task2TCB;
21 21 static CPU_STK task2Stk[TASK2_STK_SIZE];
22 22
23 23 static OS_TCB task3TCB;
24 24 static CPU_STK task3Stk[TASK3_STK_SIZE];
25 25
26 26 static OS_TCB dispTCB;
27 27 static CPU_STK dispStk[TASK4_STK_SIZE];
28 28
29 29 static volatile OS_SEM taskSem;
30 30
31 31
32 32
33 33 /*******************************************************************************
34 34 * Function Name :void TaskStart(void)
35 35 * Description :任务启动
36 36 * Input :
37 37 * Output :
38 38 * Other :
39 39 * Date :2012.04.18 11:48:23
40 40 *******************************************************************************/
41 41 static void TaskStart(void)
42 42 {
43 43 OS_ERR err;
44 44
45 45 led_init();
46 46 SysTickInit();
47 47
48 48
49 49 OSTaskCreate( (OS_TCB *)&task1TCB,
50 50 (CPU_CHAR *)"Task1",
51 51 (OS_TASK_PTR)Task1,
52 52 (void *)0,
53 53 (OS_PRIO )TASK1_PRIO,
54 54 (CPU_STK *)&task1Stk[0],
55 55 (CPU_STK_SIZE)TASK1_STK_SIZE / 10,
56 56 (CPU_STK_SIZE)TASK1_STK_SIZE,
57 57 (OS_MSG_QTY )0,
58 58 (OS_TICK )0,
59 59 (void *)0,
60 60 (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
61 61 (OS_ERR *)&err);
62 62
63 63 OSTaskCreate( (OS_TCB *)&task2TCB,
64 64 (CPU_CHAR *)"Task2",
65 65 (OS_TASK_PTR)Task2,
66 66 (void *)0,
67 67 (OS_PRIO ) TASK2_PRIO,
68 68 (CPU_STK *)&task2Stk[0],
69 69 (CPU_STK_SIZE)TASK2_STK_SIZE / 10,
70 70 (CPU_STK_SIZE)TASK2_STK_SIZE,
71 71 (OS_MSG_QTY )0,
72 72 (OS_TICK )0,
73 73 (void *)0,
74 74 (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
75 75 (OS_ERR *)&err);
76 76
77 77
78 78 OSTaskCreate( (OS_TCB *)&task3TCB,
79 79 (CPU_CHAR *)"Task3",
80 80 (OS_TASK_PTR)Task3,
81 81 (void *)0,
82 82 (OS_PRIO )TASK3_PRIO,
83 83 (CPU_STK *)&task3Stk[0],
84 84 (CPU_STK_SIZE)TASK3_STK_SIZE / 10,
85 85 (CPU_STK_SIZE)TASK3_STK_SIZE,
86 86 (OS_MSG_QTY )0,
87 87 (OS_TICK )0,
88 88 (void *)0,
89 89 (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
90 90 (OS_ERR *)&err);
91 91
92 92 OSTaskCreate( (OS_TCB *)&dispTCB,
93 93 (CPU_CHAR *)"LCD display",
94 94 (OS_TASK_PTR)MainTask,
95 95 (void *)0,
96 96 (OS_PRIO )Disp_PRIO,
97 97 (CPU_STK *)&dispStk[0],
98 98 (CPU_STK_SIZE)TASK4_STK_SIZE / 10,
99 99 (CPU_STK_SIZE)TASK4_STK_SIZE,
100 100 (OS_MSG_QTY )0,
101 101 (OS_TICK )0,
102 102 (void *)0,
103 103 (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
104 104 (OS_ERR *)&err);
105 105
106 106 OSSemCreate( (OS_SEM *)&taskSem,
107 107 (CPU_CHAR *)"taskSem",
108 108 (OS_SEM_CTR )0,
109 109 (OS_ERR *)err);
110 110
111 111 OSTaskDel( (OS_TCB *)&taskStartTCB,
112 112 (OS_ERR *)&err);
113 113 }
114 114 |