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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? demoreference.c

?? Nucleus 移植到OMAP1610的源代碼
?? 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 }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩激情一区二区| 国产亚洲综合性久久久影院| 亚洲精品国产品国语在线app| 成人av网在线| 国产精品午夜电影| 国产成人a级片| 精品福利在线导航| 国产一区二区三区综合| 精品国产免费一区二区三区香蕉| 午夜精品久久久久久久99水蜜桃 | 香蕉成人伊视频在线观看| 一本色道亚洲精品aⅴ| 亚洲婷婷综合久久一本伊一区| 国产乱人伦偷精品视频不卡| 久久婷婷综合激情| 国产精品影视在线观看| 欧美激情中文不卡| 色狠狠色狠狠综合| 欧美日韩国产123区| 午夜精品福利一区二区三区蜜桃| 日韩一区中文字幕| 欧美人与性动xxxx| 国产v综合v亚洲欧| 亚洲精品第1页| 国产不卡视频在线观看| 中文在线免费一区三区高中清不卡| 精品午夜久久福利影院| 久久精品免视看| 91麻豆高清视频| 日韩成人dvd| 久久精品免费在线观看| av高清久久久| 天堂精品中文字幕在线| 欧美精品色一区二区三区| 久久狠狠亚洲综合| 中文字幕乱码久久午夜不卡| 色诱视频网站一区| 日韩av不卡在线观看| 国产日韩欧美电影| 欧美三级三级三级爽爽爽| 婷婷一区二区三区| 久久午夜电影网| 在线视频中文字幕一区二区| 亚洲人成电影网站色mp4| 91精品国产91热久久久做人人| 激情深爱一区二区| 亚洲黄色片在线观看| 欧美一级理论性理论a| 福利电影一区二区| 亚洲h在线观看| 日韩三级伦理片妻子的秘密按摩| 成人不卡免费av| 亚洲一区二区三区四区在线 | 亚洲视频一区在线观看| 欧美伦理电影网| 9l国产精品久久久久麻豆| 日精品一区二区三区| 亚洲国产精品成人久久综合一区 | 日韩精品专区在线影院重磅| 色综合一个色综合| 成人久久18免费网站麻豆| 美女在线一区二区| 午夜在线成人av| 一区二区三区资源| 亚洲免费在线播放| 国产精品国产三级国产三级人妇| 国产午夜精品久久久久久免费视| 日韩一区二区三区免费看 | 国产日产欧美一区二区视频| 日韩视频一区二区| 7777精品伊人久久久大香线蕉超级流畅 | 一本色道a无线码一区v| www.欧美日韩国产在线| 国产99久久久国产精品潘金网站| 久久99精品视频| 精品一区二区三区影院在线午夜| 亚洲高清在线视频| 无码av免费一区二区三区试看| 一区二区免费看| 亚洲动漫第一页| 亚洲高清不卡在线| 日韩 欧美一区二区三区| 午夜不卡在线视频| 麻豆成人91精品二区三区| 视频一区视频二区中文字幕| 日日骚欧美日韩| 麻豆91在线观看| 国产在线不卡一卡二卡三卡四卡| 狠狠色狠狠色合久久伊人| 国产成人免费视频| 99视频一区二区| 91香蕉视频在线| 欧美亚日韩国产aⅴ精品中极品| 欧美亚洲尤物久久| 制服丝袜中文字幕一区| 精品国产三级电影在线观看| 国产网站一区二区| 亚洲精品五月天| 日韩精品久久理论片| 青青草国产精品亚洲专区无| 久久99国产精品免费网站| 国产经典欧美精品| 91亚洲午夜精品久久久久久| 欧美日韩mp4| 久久久久久亚洲综合| √…a在线天堂一区| 亚洲亚洲人成综合网络| 美国一区二区三区在线播放| 国产成人自拍在线| 91极品美女在线| 欧美精品一区二区高清在线观看| 欧美国产日韩在线观看| 亚洲国产精品人人做人人爽| 国内久久精品视频| 日本高清视频一区二区| 日韩精品一区二区三区在线观看| 中文字幕一区二区三中文字幕| 亚洲永久精品大片| 国产精品一二三在| 欧美日韩中文字幕精品| 国产亚洲精品精华液| 亚洲国产成人av网| 成熟亚洲日本毛茸茸凸凹| 欧美日韩国产天堂| 国产精品美女久久福利网站| 午夜婷婷国产麻豆精品| 国产盗摄精品一区二区三区在线| 欧美在线短视频| 国产欧美日韩一区二区三区在线观看| 一区二区三区视频在线观看| 国产九色sp调教91| 777亚洲妇女| 亚洲人成亚洲人成在线观看图片 | 国产在线精品免费| 欧美视频在线观看一区| 欧美激情在线一区二区| 奇米一区二区三区| 欧美在线制服丝袜| 欧美国产亚洲另类动漫| 久久精品av麻豆的观看方式| 在线日韩av片| 国产精品久久久久久久久免费相片 | 欧美三级在线播放| 亚洲欧洲在线观看av| 久久99精品久久久久| 欧美色视频一区| 亚洲啪啪综合av一区二区三区| 狠狠色伊人亚洲综合成人| 91精品在线一区二区| 亚洲一卡二卡三卡四卡| 99精品久久久久久| 国产精品免费视频观看| 国产成人一级电影| 久久久亚洲午夜电影| 久久精品国产亚洲5555| 51精品视频一区二区三区| 亚洲大片免费看| 欧美性欧美巨大黑白大战| 亚洲欧美精品午睡沙发| 99精品欧美一区| 亚洲欧美另类图片小说| 色综合久久久久久久| 国产精品家庭影院| www.久久久久久久久| 国产精品久久久久精k8 | 91亚洲精品久久久蜜桃网站| 国产精品三级视频| 成人ar影院免费观看视频| 中文字幕免费不卡| 不卡av在线免费观看| 亚洲欧美综合在线精品| 成人av在线一区二区| 中文一区一区三区高中清不卡| 波多野结衣中文字幕一区| 国产精品高潮呻吟| 色综合久久久久久久| 亚洲第一会所有码转帖| 91精品国产综合久久久久| 麻豆一区二区99久久久久| 欧美精品一区二| aaa亚洲精品| 亚洲电影第三页| 日韩精品一区二区三区在线| 国产乱子轮精品视频| 中文字幕免费观看一区| 在线免费视频一区二区| 天天综合日日夜夜精品| 欧美一级午夜免费电影| 国产曰批免费观看久久久| 国产精品全国免费观看高清 | 亚洲一区二区三区视频在线| 欧美美女激情18p| 精品一区在线看| 欧美经典一区二区| 91精品办公室少妇高潮对白| 蜜臀av亚洲一区中文字幕| 国产午夜精品一区二区三区视频| 色综合久久综合网| 久久精品国产亚洲5555| 中文字幕一区二区在线观看|