view include/TaskManager/HTaskInfo.h @ 70:178459e03f5c

*** empty log message ***
author gongo
date Mon, 18 Feb 2008 01:13:00 +0900
parents 519d24aa7ac8
children 83b57e03d3ef
line wrap: on
line source

#ifndef INCLUDED_HTASK_INFO
#define INCLUDED_HTASK_INFO

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

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

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

class TaskManagerImpl;

struct htask {
    int command;
    int in_size;
    //unsigned int in_addr;
    //unsigned int out_addr;
    DmaBuffer *in_addr;
    DmaBuffer *out_addr;
    TaskQueuePtr wait_me;  // List of task waiting for me
    TaskQueuePtr wait_i;   // List of task for which I am waiting
    void (*post_func)(void);
    CPU_TYPE cpu_type;
    struct htask *next;

    TaskManagerImpl *mimpl;
    void spawn(void);
    void set_depend(struct htask *);
    void set_cpu(CPU_TYPE type);
};

class HTaskInfo {
public:
    /* constructor */
    HTaskInfo(void);
    ~HTaskInfo(void);

    /* functions */
    int init(int num);
    HTaskPtr create(int cmd,int size,DmaBuffer *in_addr, DmaBuffer *out_addr);
    void free(HTaskPtr q);

private:
    /* variables */
    HTaskPtr htaskPool;
    HTaskPtr freeHTask;

    /* functions */
    int extend_pool(int num);
    void destroy(void);
};

#endif