亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? demoreference.c

?? 基于OMAP1510的Nucleus移植代碼
?? C
字號:
/*The  example  system  described  in  this  chapter  is  comprised  of  an 
Application_Initialize function  and  six  tasks. All  of  the  tasks  are  created  during 
initialization.  In  addition  to  task  execution,  task  communication  and  synchronization  are 
demonstrated in this example. 
In  the  example  system  listing,  the  data  structures  are  defined  between  lines  3  and  20. 
Nucleus PLUS control structures are defined between lines 3 and 13. 
Application_Initialize starts  at  line  30,  and  ends  at  line  71.    In  this  example,  all 
system  objects  (tasks,  queues,  semaphores,  and  event  flag  groups)  are  created  during 
initialization.    The  example  system  tasks  are  created  between  lines  38  and  61.    The 
communication queue  is  created  at  line  64.    The  system  semaphore  is  created  at line 68.  
Finally, the system event flag group is created at line 70.   
NOTE:  A  20,000  byte  memory  pool,  starting  at  the  address  specified  by  the 
first_available_memory parameter is created first, at line 35.  This memory 
pool is used to allocate all of the task stacks and the actual queue area.  
Task  0  is  the  first  task  to  execute  when  the  system  starts.    This  is  because  task  0  is  the 
highest priority task in the system (priority 1).  Task 3  executes  after  task  0  suspends 
(priority 5).  Task 4 executes after task 3 suspends.  It is important to realize why task 3 
executes before task 4 although they both have the same priority.  The reason for this is 
that task 3 was created and started first (see Application_Initialize).  Tasks of the 
same priority execute in the order they become ready for execution. After task 4 suspends, 
task 5 executes (priority 7).  After task 5 suspends, task 1 executes (priority 10).  Finally, 
task 2 executes (priority 10) after task 1 suspends on a queue full condition. 
Task 0 is defined between lines 76 and 92.  Like all of the tasks in this example system, 
task  0  does  some  preliminary  initialization  and  then  starts  execution  of  an  endless  loop.  
Processing  inside  of  task  0.s  endless  loop  includes  successive  calls  to NU_Sleep and  
NU_Set_Events. Because of the call to NU_Sleep, task 0.s loop is executed once every 
18 timer ticks.   
NOTE: Task 5 is made ready on each call to NU_Set_Events. Since task 5 has 
a lower priority than task 0, it does not execute until task 0  executes  the
NU_Sleep call again. 
Task  1  is  defined  between  lines  96  and  121.    Task  1  continually  sends  a  single  32-bit 
message  to  queue  0.  When  the  capacity  of  the  queue  is  reached,  task  1  suspends,  until 
room is available in queue 0.  The suspension of task 1 allows task 2 to resume execution. 
Task  2  is  defined  between  lines  124 and  156.    Task 2 continually  retrieves  single  32-bit 
messages  from  queue  0.    When  the  queue  becomes  empty,  task  2  suspends.    The 
suspension of task 2 allows task 1 to resume execution. 
Tasks  3  and  4  share  the  same  instruction  code.    However,  each  task has  its own unique 
stack.    Tasks  3  and  4  are  defined  between  lines 162 and  184.   Each task competes for a 
binary  semaphore.    Once  the  semaphore  is  obtained,  the  task  sleeps  for 100 ticks  before 
releasing the semaphore again.   
This  action  allows  the  other  task  to  execute  and  suspend  attempting  to  obtain  the  same 
semaphore.  When the semaphore is released, suspension is lifted on the task waiting for 
the semaphore. 
Task 5 is defined between lines 186 and 204.  This task is in an endless loop waiting for an 
event flag to be set.  The desired event flag is set by task 0.  Therefore, task 5 executes at 
the same frequency as task 0. 
Example System  
The following is a source file listing of the example system.   
NOTE:  The  line  number  on  the  left  is  not  part  of  the  actual  file,  it  is  there  for 
reference purposes only. 
*/

1 /* Include necessary Nucleus PLUS files. */
2 #include "inucleus.h”
3 /* Define Application data structures. */
4 NU_TASK Task_0;
5 NU_TASK Task_1;
6 NU_TASK Task_2;
7 NU_TASK Task_3;
8 NU_TASK Task_4;
9 NU_TASK Task_5;
10 NU_QUEUE Queue_0;
11 NU_SEMAPHORE Semaphore_0;
12 NU_EVENT_GROUP Event_Group_0;
13 NU_MEMORY_POOL System_Memory;
14 /* Allocate global counters. */
15 UNSIGNED Task_Time;
16 UNSIGNED Task_2_messages_received;
17 UNSIGNED Task_2_invalid_messages;
18 UNSIGNED Task_1_messages_sent;
19 NU_TASK * Who_has_the_resource;
20 UNSIGNED Event_Detections;
21 /* Define prototypes for function references. */
22 void task_0(UNSIGNED argc, VOID *argv);
23 void task_1(UNSIGNED argc, VOID *argv);
24 void task_2(UNSIGNED argc, VOID *argv);
25 void task_3_and_4(UNSIGNED argc, VOID *argv);
26 void task_5(UNSIGNED argc, VOID *argv);
/*27  Define the Application_Initialize routine that determines the initial
  28 Nucleus PLUS application environment. */
29
30 void Application_Initialize(void *first_available_memory)
31 {
32 VOID *pointer;
/*33  Create a system memory pool that will be used to allocate task
  34  stacks, queue areas, etc. */
35 NU_Create_Memory_Pool(&System_Memory, "SYSMEM”, first_available_memory,
36 20000, 50, NU_FIFO);
37 /* Create each task in the system. */
38 /* Create task 0. */
39 NU_Allocate_Memory(&System_Memory, &pointer, 1000, NU_NO_SUSPEND);
40 NU_Create_Task(&Task_0, "TASK 0”, task_0, 0, NU_NULL, pointer, 1000, 1,
41 20, NU_PREEMPT, NU_START);
42 /* Create task 1. */
43 NU_Allocate_Memory(&System_Memory, &pointer, 1000, NU_NO_SUSPEND);
44 NU_Create_Task(&Task_1, "TASK 1”, task_1, 0, NU_NULL, pointer, 1000, 10,
45 5,NU_PREEMPT, NU_START);
46 /* Create task 2. */
47 NU_Allocate_Memory(&System_Memory, &pointer, 1000, NU_NO_SUSPEND);
48 NU_Create_Task(&Task_2, "TASK 2”, task_2, 0, NU_NULL, pointer, 1000,
49 10, 5, NU_PREEMPT, NU_START);
50 /* Create task 3. Note: task 4 uses the same instruction area. */
51 NU_Allocate_Memory(&System_Memory, &pointer, 1000, NU_NO_SUSPEND);
52 NU_Create_Task(&Task_3, "TASK 3”, task_3_and_4, 0, NU_NULL, pointer,
53 1000, 5, 0, NU_PREEMPT, NU_START);
54 /* Create task 4. Note that task 3 uses the same instruction area.*/
55 NU_Allocate_Memory(&System_Memory, &pointer, 1000, NU_NO_SUSPEND);
56 NU_Create_Task(&Task_4, "TASK 4”, task_3_and_4, 0, NU_NULL, pointer,
57 1000, 5, 0, NU_PREEMPT, NU_START);
58 /* Create task 5. */
59 NU_Allocate_Memory(&System_Memory, &pointer, 1000, NU_NO_SUSPEND);
60 NU_Create_Task(&Task_5, "TASK 5”, task_5, 0, NU_NULL, pointer, 1000, 7, 0,
61 NU_PREEMPT, NU_START);
62 /* Create communication queue. */
63 NU_Allocate_Memory(&System_Memory, &pointer, 100*sizeof(UNSIGNED),
64 NU_NO_SUSPEND);
65 NU_Create_Queue(&Queue_0, "QUEUE 0”, pointer, 100, NU_FIXED_SIZE, 1,
66 NU_FIFO);
67 /* Create synchronization semaphore. */
68 NU_Create_Semaphore(&Semaphore_0, "SEM 0”, 1, NU_FIFO);
69 /* Create event flag group. */
70 NU_Create_Event_Group(&Event_Group_0, "EVGROUP0”);
71 }
72
73 /* Define task 0. Task 0 increments the Task_Time variable every
74 18 clock ticks. Additionally, task 0 sets an event flag that
75 task 5 is waiting for, on each iteration of the loop. */
76 void task_0(UNSIGNED argc, VOID *argv)
77 {
78 STATUS status;
79 /* Access argc and argv just to avoid compilation warnings.*/
80 status = (STATUS) argc + (STATUS) argv;
81 /* Set the clock to 0. This clock ticks every 18 system timer ticks. */
82 Task_Time = 0;
83 while(1)
84 {
85 /* Sleep for 18 timer ticks. The value of the tick is programmable in
IND.ASM and is relative to the speed of the target system. */
86 NU_Sleep(18);
87 /* Increment the time. */
88 Task_Time++;
89 /* Set an event flag to lift the suspension on task 5.*/
90 NU_Set_Events(&Event_Group_0, 1, NU_OR);
91 }
92 }
93 /* Define the queue sending task. Note that the only things that cause
94 this task to suspend are queue full conditions and the time slice
95 specified in the configuration file. */
96 void task_1(UNSIGNED argc, VOID *argv)
97 {
98 STATUS status;
99 UNSIGNED Send_Message;
100 /* Access argc and argv just to avoid compilation warnings. */
101 status = (STATUS) argc + (STATUS) argv;
102 /* Initialize the message counter. */
103 Task_1_messages_sent = 0;
104 /* Initialize the message contents. The receiver will
105 examine the message contents for errors. */
106 Send_Message = 0;
107 while(1)
108 {
109
110 /* Send the message to Queue_0, which task 2 reads from. Note
111 that if the destination queue fills up this task suspends until
112 room becomes available. */
113 status = NU_Send_To_Queue(&Queue_0, &Send_Message, 1,
114 NU_SUSPEND);
115 /* Determine if the message was sent successfully. */
116 if (status == NU_SUCCESS)
117 Task_1_messages_sent++;
118 /* Modify the contents of the next message to send. */
119 Send_Message++;
120 }
121 }
/* Define the queue receiving task. Note that the only things that
122 cause this task to suspend are queue empty conditions and the
123 time slice specified in the configuration file. */
124 void task_2(UNSIGNED argc, VOID *argv)
125 {
126 STATUS status;
127 UNSIGNED Receive_Message;
128 UNSIGNED received_size;
129 UNSIGNED message_expected;
130 /* Access argc and argv just to avoid compilation warnings. */
131 status = (STATUS) argc + (STATUS) argv;
132 /* Initialize the message counter. */
133 Task_2_messages_received = 0;
134 /* Initialize the message error counter. */
135 Task_2_invalid_messages = 0;
136 /* Initialize the message contents to expect. */
137 message_expected = 0;
138 while(1)
139 {
140 /* Retrieve a message from Queue_0, which task 1 writes to.
141 Note that if the source queue is empty this task
142 suspends until something becomes available. */
143 status = NU_Receive_From_Queue(&Queue_0, &Receive_Message, 1,
144 &received_size, NU_SUSPEND);
145 /* Determine if the message was received successfully. */
146 if (status == NU_SUCCESS)
147 Task_2_messages_received++;
148 /* Check the contents of the message against what this task
149 is expecting. */
150 if ((received_size != 1) ||
151 (Receive_Message != message_expected))
152 Task_2_invalid_messages++;
153 /* Modify the expected contents of the next message. */
154 message_expected++;
155 }
156 }
157 /* Tasks 3 and 4 want a single resource. Once one of the tasks gets the
158 resource, it keeps it for 30 clock ticks before releasing it. During
159 this time the other task suspends waiting for the resource. Note that
160 both task 3 and 4 use the same instruction areas but have different
161 stacks. */
162 void task_3_and_4(UNSIGNED argc, VOID *argv)
163 {
164 STATUS status;
165 /* Access argc and argv just to avoid compilation warnings. */
166 status = (STATUS) argc + (STATUS) argv;
167 /* Loop to allocate and deallocate the resource. */
168 while(1)
169 {
170 /* Allocate the resource. Suspend until it becomes available. */
171 status = NU_Obtain_Semaphore(&Semaphore_0, NU_SUSPEND);
172 /* If the status is successful, show that this task owns the
173 resource. */
174 if (status == NU_SUCCESS)
175 {
176 Who_has_the_resource = NU_Current_Task_Pointer();
177 /* Sleep for 100 ticks to cause the other task to suspend on
178 the resource. */
179 NU_Sleep(100);
180 /* Release the semaphore. */
181 NU_Release_Semaphore(&Semaphore_0);
182 }
183 }
184 }
185 /* Define the task that waits for the event to be set by task 0. */
186 void task_5(UNSIGNED argc, VOID *argv)
187 {
188 STATUS status;
189 UNSIGNED event_group;
190 /* Access argc and argv just to avoid compilation warnings. */
191 status = (STATUS) argc + (STATUS) argv;
192 /* Initialize the event detection counter. */
193 Event_Detections = 0;
Nucleus PLUS Reference Manual  
194 /* Continue this process forever. */
195 while(1)
196 {
197 /* Wait for an event and consume it. */
198 status = NU_Retrieve_Events(&Event_Group_0, 1, NU_OR_CONSUME,
199 &event_group, NU_SUSPEND);
200 /* If the status is okay, increment the counter. */
201 if (status == NU_SUCCESS)
202 Event_Detections++;
203 }
204 }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品18久久久久久久网站| 精品一区二区三区免费播放| 欧美一区二区精品| 成人视屏免费看| 日日摸夜夜添夜夜添国产精品 | 视频一区欧美日韩| 国产欧美一区二区精品久导航| 欧美三级三级三级爽爽爽| 岛国一区二区三区| 麻豆精品视频在线观看免费| 一区二区在线电影| 国产精品伦理一区二区| 久久伊99综合婷婷久久伊| 欧美精品自拍偷拍动漫精品| 91美女在线观看| 成人综合在线观看| 国产一区二区在线免费观看| 日韩不卡免费视频| 一区二区在线观看av| 一色屋精品亚洲香蕉网站| 国产调教视频一区| 精品国内二区三区| 日韩欧美专区在线| 欧美高清hd18日本| 欧美三级电影精品| 欧美视频在线一区| 欧美中文字幕一区二区三区 | 欧洲精品在线观看| 不卡的av在线| 99国产精品99久久久久久| 国产一区二区三区在线观看免费视频 | 美女视频黄久久| 亚洲成年人网站在线观看| 亚洲综合在线免费观看| 一区二区三区在线观看国产| 成人欧美一区二区三区视频网页| 国产女人18水真多18精品一级做 | 中文字幕日韩一区二区| 中文字幕av一区二区三区高 | 亚洲国产中文字幕在线视频综合| 亚洲蜜臀av乱码久久精品蜜桃| 国产精品久久久久一区| 国产精品久久久久aaaa樱花 | 国产精品嫩草影院av蜜臀| 国产精品毛片高清在线完整版 | 国产精品素人视频| 国产精品国模大尺度视频| 国产精品女主播在线观看| 国产精品久久久久久户外露出| 国产精品电影院| 一区二区三区小说| 亚洲成人综合网站| 美国三级日本三级久久99| 国产精品一区免费在线观看| 国产成人精品免费网站| 99久久久久免费精品国产| 91久久精品一区二区二区| 欧美日韩国产首页在线观看| 欧美日韩五月天| 欧美电影免费观看完整版 | 无码av免费一区二区三区试看| 亚洲综合丁香婷婷六月香| 亚洲成av人影院| 免费人成黄页网站在线一区二区| 老司机一区二区| av在线这里只有精品| 欧美日韩第一区日日骚| 日韩网站在线看片你懂的| 久久久精品国产免大香伊| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 天使萌一区二区三区免费观看| 日韩成人一级大片| 国产乱理伦片在线观看夜一区| 99久久精品一区| 亚洲精品一区二区三区四区高清| 久久精品在线观看| 一区二区三区在线影院| 看电视剧不卡顿的网站| av动漫一区二区| 欧美一卡二卡三卡| 国产精品久久久久9999吃药| 日韩一区精品字幕| 成人av资源站| 日韩欧美视频一区| 综合色天天鬼久久鬼色| 奇米888四色在线精品| 99久久免费视频.com| 欧美成人官网二区| 亚洲欧美aⅴ...| 另类小说一区二区三区| 91麻豆.com| 欧美mv日韩mv亚洲| 亚洲国产精品尤物yw在线观看| 国产成人精品免费| 91麻豆精品国产91久久久久久久久 | 久久99热这里只有精品| 一本一道久久a久久精品| 精品久久人人做人人爽| 一级精品视频在线观看宜春院| 国产在线视频精品一区| 欧美体内she精高潮| 国产精品久久久久久亚洲伦| 久久精品久久综合| 欧美视频一二三区| 中文字幕一区二区三区不卡| 精彩视频一区二区三区| 欧美日韩中文字幕一区| 亚洲欧美日韩中文播放| 国产成人啪免费观看软件| 日韩小视频在线观看专区| 一区二区三区精品在线观看| 在线不卡中文字幕播放| 最新成人av在线| 国产激情一区二区三区| 精品国产123| 亚洲国产视频在线| 粉嫩绯色av一区二区在线观看| 91精品国产综合久久久久久| 一区二区三区精品视频在线| www.亚洲免费av| 五月婷婷久久综合| 国产精品久久夜| 亚洲老司机在线| 国产精品一区二区在线看| 日韩一区二区三区在线视频| 午夜精品视频一区| 欧美日韩精品一区二区| 一区二区三区中文在线| 91福利精品第一导航| 亚洲色图制服诱惑| 99re8在线精品视频免费播放| 久久久国产精品麻豆| 国产精品一区二区三区网站| 欧美mv日韩mv亚洲| 国产在线观看免费一区| 欧美成人精精品一区二区频| 激情偷乱视频一区二区三区| 欧美xxxxxxxxx| 国产在线播放一区二区三区| 欧美日本视频在线| 日韩精品乱码免费| 91麻豆精品国产自产在线观看一区 | 97久久精品人人做人人爽| 国产精品情趣视频| 91啪亚洲精品| 性感美女久久精品| 91麻豆精品久久久久蜜臀| 久久精品二区亚洲w码| 久久人人97超碰com| 国产精品亚洲成人| 国产精品女主播av| 在线亚洲精品福利网址导航| 一区二区三区蜜桃网| 欧美日韩国产综合一区二区| 美女一区二区三区| 久久九九99视频| aaa国产一区| 亚洲国产精品影院| 欧美成人aa大片| 丁香亚洲综合激情啪啪综合| 成人免费一区二区三区视频| 欧美亚洲国产一区二区三区va| 日韩精品亚洲专区| 国产色产综合产在线视频| 91丨九色porny丨蝌蚪| 天天做天天摸天天爽国产一区| 欧美va亚洲va| 色综合欧美在线视频区| 五月激情综合网| 欧美激情中文不卡| 精品视频全国免费看| 精彩视频一区二区三区| 亚洲人精品午夜| 欧美刺激午夜性久久久久久久| 成人午夜激情影院| 五月综合激情网| 国产精品女上位| 欧美一级精品在线| 一本色道久久加勒比精品 | 麻豆精品一二三| 中文字幕日韩精品一区| 日韩三级在线免费观看| 99精品在线免费| 久久99精品视频| 亚洲欧美色综合| 精品国产1区二区| 欧美在线你懂的| 国产99久久久久| 日韩精品免费视频人成| 中文字幕亚洲一区二区av在线| 91精品欧美福利在线观看| 不卡在线视频中文字幕| 免费成人你懂的| 一区二区三区四区精品在线视频| 精品国产伦一区二区三区观看体验| 色婷婷av一区| 国产成人夜色高潮福利影视| 日欧美一区二区| 亚洲精品成人天堂一二三| 国产视频视频一区|