view TaskManager/Fifo/FifoDmaManager.h @ 1190:cfbf4f264829 draft

fix FifoDmaManager.h
author Daichi TOMA <amothic@cr.ie.u-ryukyu.ac.jp>
date Fri, 08 Jul 2011 19:18:41 +0900
parents 898fdcf53c31
children 27e35b4098a4
line wrap: on
line source

#ifndef INCLUDED_FIFO_DMA_MANAGER
#define INCLUDED_FIFO_DMA_MANAGER

#include "base.h"
#include "DmaManager.h"
#ifdef __CERIUM_PARALLEL__
#include "SemMailManager.h"
#else
#include "MailManager.h"
#endif

class FifoDmaManager : public DmaManager {

protected:
    /* variables */
    MailManagerPtr mail_queue1;
    MailManagerPtr mail_queue2;

public:
    BASE_NEW_DELETE(FifoDmaManager);

    FifoDmaManager() {
#ifdef __CERIUM_PARALLEL__
    		mail_queue1 = new SemMailManager();
    		mail_queue2 = new SemMailManager();
#else
    		mail_queue1 = new MailManager();
    		mail_queue2 = new MailManager();
#endif
    }

    ~FifoDmaManager() {
	delete mail_queue1;
	delete mail_queue2;
    }

    /* functions */
    void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask);
    void dma_store(void *buf, memaddr addr, uint32 size, uint32 mask);
    void dma_wait(uint32 mask) ;

    void mail_write(memaddr data) { mail_queue1->send(data); }
    void mail_write_queue(memaddr data) { mail_queue1->send(data); }
    void mail_write_finish_list(memaddr data) { mail_queue1->send(data); }
    memaddr mail_read() { return mail_queue2->recv(); }
    memaddr task_list_mail_read() { return mail_queue2->recv(); }

    void mail_write_from_host(memaddr data) { mail_queue2->send(data); }
    memaddr mail_read_from_host() { return mail_queue1->recv(); }
    int has_mail_from_host() { return mail_queue1->count(); }

    void dma_loadList(ListDataPtr list, void *buff, uint32 mask);
    void dma_storeList(ListDataPtr, void *buff, uint32 mask);

};

#endif