GadgetSeed  0.9.6
task.c ファイル

タスク制御 [詳解]

#include "timer.h"
#include "asm.h"
#include "str.h"
#include "tkprintf.h"
#include "tcb.h"
#include "task.h"
#include "event.h"
#include "mutex.h"
#include "syscall.h"
#include "calltrace.h"
#include "interrupt.h"
#include "task_opration.h"
#include "queue_opration.h"
#include "mutex_opration.h"
#include "event_opration.h"
#include "sleepqueue.h"
#include "waitqueue.h"
#include "syscall_param.h"
#include "dkprintf.h"
task.c の依存先関係図:

[ソースコード]

マクロ定義

#define GSC_KERNEL_IDLE_TASK_STACK_SIZE   (1024)
 

関数

static int idle_task (char *arg)
 
void init_task (void)
 
static void task_startup (void)
 
static struct st_tcbsearch_next_task (void)
 
static void print_queue (struct st_queue *queue)
 
static void print_tcb_queue (struct tcb_queue *queue)
 
int get_tasks_info (struct st_task_info *ti, int count)
 タスク情報を取得する [詳解]
 
void print_task (void)
 
void print_queues (void)
 
static void print_task_stack (struct st_tcb *tcb)
 
void print_stack (void)
 
static void dispatch_task (struct st_tcb *task, int status)
 
static void wakeup_task (struct st_tcb *tcb)
 
static void task_add_queue (struct st_tcb *tcb)
 
void task_schedule (void *sp, unsigned long long systime)
 
static struct st_tcbtask_init (task_func func, char *name, int priority, struct st_tcb *tcb, void *stack, int stack_size, char *arg)
 
void task_exec_ISR (task_func func, char *name, int priority, struct st_tcb *tcb, void *stack, int stack_size, char *arg)
 タスクを実行する [詳解]
 
void task_add_ISR (task_func func, char *name, int priority, struct st_tcb *tcb, void *stack, int stack_size, char *arg)
 タスクを追加する [詳解]
 
void task_exit_ISR (void *sp)
 
static struct st_tcbsearch_id (struct st_queue *queue, int id)
 
static struct st_tcbsearch_task_id (int id)
 
void task_kill_id_ISR (void *sp, int id)
 
void task_wakeup_id_ISR (void *sp, int id)
 idタスクを実行する [詳解]
 
void task_pause_ISR (void *sp)
 
void task_sleep_ISR (void *sp, unsigned int sleep_time)
 
void event_wait_ISR (void *sp, struct st_event *evtque, void *arg, unsigned int timeout)
 
int event_check_ISR (void *sp, struct st_event *evtque)
 イベントカウントを取得する [詳解]
 
void event_clear_ISR (void *sp, struct st_event *evtque)
 イベントカウンタをクリアリセットする [詳解]
 
void event_push_ISR (void *sp, struct st_event *evtque, void *arg)
 イベントFIFOにイベントを登録する [詳解]
 
void event_set_ISR (void *sp, struct st_event *evtque)
 イベント待ちタスクを起動する [詳解]
 
void event_wakeup_ISR (void *sp, struct st_event *evtque, void *arg)
 イベントキューにイベントを登録し、イベント待ちタスクを起動する [詳解]
 
void mutex_lock_ISR (void *sp, struct st_mutex *mutex, unsigned int timeout)
 
void mutex_unlock_ISR (void *sp, struct st_mutex *mutex)
 
void task_print_task_queue (void)
 
void disp_task_info (void)
 

変数

struct st_tcbrun_task
 
struct st_tcb dummy_task
 
static int new_task_id
 
static int enable_schedule
 
static struct st_tcblast_task
 
static struct tcb_queue task_list_head
 
static struct st_queue ready_queue_head [GSC_KERNEL_MAX_TASK_PRIORITY]
 
static struct st_tcb idle_tcb
 
static unsigned int idle_stack [GSC_KERNEL_IDLE_TASK_STACK_SIZE/sizeof(unsigned int)]
 
const char status_str [][8]
 

詳解

タスク制御

これらの関数は非タスク状態から実行されなければならない

日付
2017.09.03
2011.02.27
著者
Takashi SHUDO

task.c に定義があります。

関数詳解

◆ event_check_ISR()

int event_check_ISR ( void *  sp,
struct st_event evtque 
)

イベントカウントを取得する

引数
[in]spスタックポインタ
[in]evtqueイベントキューポインタ
注釈
割り込みハンドラからのみ実行可能

task.c814 行目に定義があります。

◆ event_clear_ISR()

void event_clear_ISR ( void *  sp,
struct st_event evtque 
)

イベントカウンタをクリアリセットする

引数
[in]spスタックポインタ
[in]evtqueイベントキューポインタ
注釈
割り込みハンドラからのみ実行可能
イベント待ちタスクは実行状態にはならない

task.c838 行目に定義があります。

◆ event_push_ISR()

void event_push_ISR ( void *  sp,
struct st_event evtque,
void *  arg 
)

イベントFIFOにイベントを登録する

引数
[in]spスタックポインタ
[in]evtqueイベントキューポインタ
[in]argイベント引数ポインタ
注釈
割り込みハンドラからのみ実行可能
イベント待ちタスクは実行状態にはならない

task.c857 行目に定義があります。

◆ event_set_ISR()

void event_set_ISR ( void *  sp,
struct st_event evtque 
)

イベント待ちタスクを起動する

引数
[in]spスタックポインタ
[in]evtqueイベントキューポインタ
注釈
割り込みハンドラからのみ実行可能
注意
event_push_ISR() をコールした割り込み処理内で実行する必要がある
event_set_ISR() 実行以前に1回以上 event_push_ISR() が実行されている必要がある

task.c879 行目に定義があります。

◆ event_wakeup_ISR()

void event_wakeup_ISR ( void *  sp,
struct st_event evtque,
void *  arg 
)

イベントキューにイベントを登録し、イベント待ちタスクを起動する

引数
[in]spスタックポインタ
[in]evtqueイベントキューポインタ
[in]argイベント引数ポインタ
注釈
割り込みハンドラからのみコール可能
イベント待ちタスクがなければイベントカウンタをインクリメントする

task.c923 行目に定義があります。

◆ get_tasks_info()

int get_tasks_info ( struct st_task_info ti,
int  count 
)

タスク情報を取得する

引数
[out]tiタスク情報
[in]count取得する最大タスク数
戻り値
取得したタスク数
注意
tiのサイズはcount数分確保していなければならない

task.c175 行目に定義があります。

◆ task_add_ISR()

void task_add_ISR ( task_func  func,
char *  name,
int  priority,
struct st_tcb tcb,
void *  stack,
int  stack_size,
char *  arg 
)

タスクを追加する

引数
[in]funcタスク関数
[in]nameタスク名文字列ポインタ
[in]priorityタスク優先度
[in]tcbタスクコンテキストポインタ
[in]stackタスクスタックポインタ
[in]stack_sizeタスクスタックサイズ
[in]argタスク実行時引数文字列ポインタ
注釈
割り込みハンドラからのみ実行可能

task.c541 行目に定義があります。

◆ task_exec_ISR()

void task_exec_ISR ( task_func  func,
char *  name,
int  priority,
struct st_tcb tcb,
void *  stack,
int  stack_size,
char *  arg 
)

タスクを実行する

引数
[in]funcタスク関数
[in]nameタスク名文字列ポインタ
[in]priorityタスク優先度
[in]tcbタスクコンテキストポインタ
[in]stackタスクスタックポインタ
[in]stack_sizeタスクスタックサイズ
[in]argタスク実行時引数文字列ポインタ
注釈
割り込みハンドラからのみ実行可能

task.c515 行目に定義があります。

◆ task_wakeup_id_ISR()

void task_wakeup_id_ISR ( void *  sp,
int  id 
)

idタスクを実行する

引数
[in]spスタックポインタ
[in]idタスクID
注釈
割り込みハンドラからのみ実行可能

task.c662 行目に定義があります。

変数詳解

◆ status_str

const char status_str[][8]
初期値:
= {
"READY",
"RUN",
"TIMER",
"EVENT",
"MUTEX",
"REQUEST",
"DRMNT"
}

task.c155 行目に定義があります。