view TaskManager/kernel/ppe/CpuThreads.h @ 1229:424c1f16e704 draft

add args useRefDma
author Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
date Wed, 24 Aug 2011 07:45:27 +0900
parents 898fdcf53c31
children 6b4a0846afcb
line wrap: on
line source

#ifndef INCLUDED_CPU_THREADS
#define INCLUDED_CPU_THREADS

#include <pthread.h>
#include "Threads.h"
#include "TaskManagerImpl.h"
#include "MainScheduler.h"
#include "Sem.h"

typedef struct cpu_arg {
    int cpuid;
    // should be syncrhonized
    MainScheduler *scheduler;
    TaskManagerImpl *manager;
    SemPtr wait;
	int useRefDma;
} cpu_thread_arg_t;

class CpuThreads : public Threads {
public:
    /* constructor */
    CpuThreads(int num = 1, int useRefDma = 0, int start_id = 0);
    ~CpuThreads();
    static void *cpu_thread_run(void *args);

    /* functions */
    virtual void init();
    virtual int get_mail(int speid, int count, memaddr *ret); // BLOCKING
    virtual int has_mail(int speid, int count, memaddr *ret); // NONBLOCK
    virtual void send_mail(int speid, int num, memaddr *data); // BLOCKING
    virtual void add_output_tasklist(int command, memaddr buff, int alloc_size);

private:
    /* variables */
    pthread_t *threads;
    cpu_thread_arg_t *args;
    SemPtr wait; //スレッド生成時の待ち用
    int cpu_num;
    int id_offset;
};

#endif