view TaskManager/kernel/ppe/SemMailManager.h @ 1189:898fdcf53c31 draft

add SemMailManager
author Daichi TOMA
date Fri, 08 Jul 2011 18:34:18 +0900
parents
children
line wrap: on
line source

#ifndef INCLUDED_SEM_MAIL_MANAGER
#define INCLUDED_SEM_MAIL_MANAGER

#include <pthread.h>
#include "MailManager.h"
#include "types.h"
#include "Sem.h"

class SemMailManager : public MailManager {
public:
    /* constructor */
    SemMailManager(unsigned int qsize = 32) ;

    ~SemMailManager();

    /* functions */
    void send(memaddr data);
    memaddr recv();
    int count();

private:
    /* variables */
    memaddr *queue;
    SemPtr queue_remain;
    SemPtr queue_count;
    unsigned int size;
    unsigned int read;
    unsigned int write;
    unsigned int mask;

    void calc_mask(unsigned int qsize);
    void extend();
}  ;

typedef SemMailManager *SemMailManagerPtr;

#endif