view include/TaskManager/BufferManager.h @ 58:7492eb28b577

*** empty log message ***
author gongo
date Sat, 16 Feb 2008 19:40:20 +0900
parents 90523ccc4dff
children 54355e641172
line wrap: on
line source

#ifndef INCLUDED_BUFFER_MANAGER
#define INCLUDED_BUFFER_MANAGER

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

#ifndef INCLUDED_TYPES
#  include "types.h"
#endif

#ifndef INCLUDED_TASK_LIST_INFO
#  include "TaskListInfo.h"
#endif

#ifndef INCLUDED_TASK_QUEUE_INFO
#  include "TaskQueueInfo.h"
#endif

#ifndef INCLUDED_HTASK_INFO
#  include "HTaskInfo.h"
#endif

#ifndef INCLUDED_DMA_BUFFER
#  include "DmaBuffer.h"
#endif

class BufferManager {
public:
    /* constructor */
    BufferManager(int num = 1);
    virtual ~BufferManager(void);
    
    /* variables */
    TaskListInfo *tlistImpl;
    TaskQueueInfo *tqueueImpl;
    HTaskInfo *htaskImpl;

    int machineNum;
    TaskQueuePtr activeTaskQueue;
    TaskQueuePtr waitTaskQueue;
    TaskListPtr *machineTaskList;

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

    TaskQueuePtr create_taskQueue(HTaskPtr);
    HTaskPtr create_task(int cmd, int siz, DmaBuffer *in, DmaBuffer *out);
    void free_taskQueue(TaskQueuePtr);
    void free_task(HTaskPtr);

    // task list
    virtual TaskListPtr get_available_taskList(void);

    void finish(void);

    virtual void clear_taskList(void);

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

    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:
};

#endif