view TaskManager/kernel/ppe/TaskInfo.h @ 3:2356238ebea7

*** empty log message ***
author gongo
date Tue, 05 Feb 2008 20:22:50 +0900
parents
children
line wrap: on
line source

#ifndef INCLUDED_TASK_INFO
#define INCLUDED_TASK_INFO

#ifndef INCLUDED_TASK
#  include "task.h"
#endif

class TaskInfo {
public:
    /* constructor */
    TaskInfo(int num = 1);
    virtual ~TaskInfo(void) {}
    
    /* variables */
    TaskListPtr taskListPool;
    TaskListPtr freeTaskList;
    
    TaskQueuePtr taskQueuePool;
    TaskQueuePtr freeTaskQueue;
    TaskQueuePtr waitTaskQueue;
    TaskQueuePtr activeTaskQueue;

    /* function */
    virtual void init(void) = 0;

    // task list
    int init_pool_taskList(int num);
    virtual int extend_pool_taskList(int num) = 0;
    virtual TaskListPtr get_available_taskList(void) = 0;
    TaskListPtr get_free_taskList(void);

    // task queue
    int init_pool_taskQueue(int num);
    TaskQueuePtr get_free_taskQueue(HTaskPtr);
    int extend_pool_taskQueue(int num);

    // task
    int init_pool_task(int num);
    HTaskPtr get_free_task(int cmd, int size,
			  unsigned long long in_addr,
			  unsigned long long out_addr);

    virtual void clear_taskList(void) = 0;

    void append_activeTask(HTaskPtr);
    void append_waitTask(HTaskPtr);

    void free_taskList(TaskListPtr q);
    void free_taskQueue(TaskQueuePtr q);
    void free_task(HTaskPtr q);

    void check_task_finish(HTaskPtr task);
    void notify_wait_taskQueue(HTaskPtr depend, TaskQueuePtr list);
    TaskQueuePtr remove_taskQueue(TaskQueuePtr list, TaskQueuePtr task);
    TaskQueuePtr remove_taskQueue_eq_task(TaskQueuePtr list, HTaskPtr task);

private:
    int machineNum;
};

extern TaskQueuePtr append_taskQueue(TaskQueuePtr, TaskQueuePtr);
extern TaskListPtr append_taskList(TaskListPtr list, TaskListPtr q);

#endif