GadgetSeed  0.9.6
waitqueue.c
[詳解]
1 /** @file
2  @brief 待ちタスク制御
3 
4  これらの関数は非タスク状態からコールされる
5 
6  @date 2011.04.03
7  @author Takashi SHUDO
8 */
9 
10 #include "waitqueue.h"
11 #include "queue_opration.h"
12 
13 //#define DEBUGKBITS 0x01
14 #include "dkprintf.h"
15 
16 
17 struct st_queue wait_queue_head; ///< 待ちタスクキュー
18 
19 void waitqueue_add(struct st_tcb *tcb)
20 {
21  DKFPRINTF(0x01, "Wait PID=%d \"%s\"\n", tcb->id, tcb->name);
22 
23  add_queue(&wait_queue_head, (struct st_queue *)tcb);
24 }
25 
26 struct st_tcb *waitqueue_wakeup(struct st_tcb *tcb)
27 {
28  DKFPRINTF(0x01, "Wait wakeup PID=%d \"%s\"\n", tcb->id, tcb->name);
29 
30  if(check_queue(&wait_queue_head) == 0) {
31  return (struct st_tcb *)0;
32  }
33 
34  del_queue((struct st_queue *)tcb);
35 
36  return tcb;
37 }
待ちタスク制御
キュー構造
Definition: queue.h:13
char name[TASK_NAME_LEN+1]
タスク名
Definition: tcb.h:39
キュー操作
struct st_queue wait_queue_head
待ちタスクキュー
Definition: waitqueue.c:17
カーネル、ドライバ(非タスク)デバッグ用マクロ
int id
タスクID
Definition: tcb.h:38
タスクコンテキスト
Definition: tcb.h:32