view TaskManager/Fifo/FifoDmaManager.h @ 1213:a49c02dffe6f draft

DMA connector reogranization
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 22 Jul 2011 13:25:30 +0900
parents 27e35b4098a4
children bb75ee244826
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 "SynchronizedMailManager.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 SynchronizedMailManager();
    		mail_queue2 = new SynchronizedMailManager();
#else
    		mail_queue1 = new MailManager();
    		mail_queue2 = new MailManager();
#endif
    }

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

    /* functions */
    void *dma_load(Scheduler *s, 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 *get_writebuf(Scheduler *s, memaddr addr, uint32 size) ;


    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(Scheduler *s, ListDataPtr list, void *buff, uint32 mask);
    void dma_storeList(ListDataPtr, void *buff, uint32 mask);
    void *get_writebuf(Scheduler *s, ListDataPtr, uint32 size) ;

    uint32 get_tag();
    void bound(ListData *);

};

#endif