view TaskManager/Fifo/FifoDmaManager.h @ 2022:fac44ad2867d draft

make a sound
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Wed, 16 Jul 2014 02:50:32 +0900
parents 5238ca826d6e
children
line wrap: on
line source

#ifndef INCLUDED_FIFO_DMA_MANAGER
#define INCLUDED_FIFO_DMA_MANAGER

#include "base.h"
#include "DmaManager.h"
#include "MailManager.h"

void do_start_dmawait_profile(unsigned long long *start);
void do_end_dmawait_profile(unsigned long long *counter,unsigned long long *start,unsigned long long *stop);
void null_start_dmawait_profile(unsigned long long *start);
void null_end_dmawait_profile(unsigned long long *counter,unsigned long long *start,unsigned long long *stop);

class FifoDmaManager : public DmaManager {


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

public:
    BASE_NEW_DELETE(FifoDmaManager);

    FifoDmaManager() {

        start_dmawait_profile = &null_start_dmawait_profile;
        end_dmawait_profile = &null_end_dmawait_profile;
    }

    virtual void init();

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

	/* variables */
protected:
    unsigned long long global_start_time;  
    unsigned long long global_load_time, global_store_time, global_mail_time;
    unsigned long long dma_load_time, dma_store_time, dma_loadList_time, dma_storeList_time;
    unsigned long long mail_read_time, mail_write_time;
    unsigned long long mail_read_from_host_time, mail_write_from_host_time;

    /* functions */
public:
    virtual void *dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask);
    virtual void *dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask);
    virtual void *dma_store(void *buf, memaddr addr, uint32 size, uint32 mask);
    virtual void dma_wait(uint32 mask) ;
    virtual void *get_writebuf(Scheduler *s, memaddr addr, uint32 size) ;
    virtual void set_mail_waiter(SemPtr w) {
        mail_queue1->set_waiter(w);
    }

    //    void (FifoDmaManager::*start_dmawait_profile)();
    //    void (FifoDmaManager::*end_dmawait_profile)(unsigned long long *counter);
    void start_profile();
    void stop_profile();

    void show_dma_wait(Scheduler *s, int cpu);

    void mail_write(memaddr data);
    void mail_write_finish_list(memaddr data);
    memaddr mail_read();
    memaddr task_list_mail_read();

    void mail_write_from_host(memaddr data); 
    memaddr mail_read_from_host();
    int has_mail_from_host();

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

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


};

#endif