view TaskManager/kernel/schedule/DmaManager.h @ 2069:26aa08c9a1de draft default tip

cuda example fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 12 Feb 2017 10:04:55 +0900
parents 5238ca826d6e
children
line wrap: on
line source

#ifndef INCLUDED_DMA_MANAGER
#define INCLUDED_DMA_MANAGER

#include "base.h"
#include "ListData.h"
#include "types.h"
#include "Sem.h"

enum dma_tag {
    DMA_READ  = 25,
    DMA_READ2  = 26,
    DMA_WRITE = 27,
//    DMA_READ_IN_LIST  = 29,
//    DMA_READ_OUT_LIST = 30,
    DMA_READ_TASKLIST = 31,
};

class Scheduler;

class DmaManager {
public:
    virtual ~DmaManager() {};

    BASE_NEW_DELETE(DmaManager);

    virtual void init() {}  // local initializer ( mainly for mailqueue if avaiable );
    // API for DMA transfer
    virtual void *dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask) { return 0; }
    virtual void *dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask) { return 0; }
    virtual void *dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) { return 0; }
    virtual void free_(void *buf) { free(buf); }
    virtual void *get_writebuf(Scheduler *s, memaddr addr, uint32 size) { return 0; }
    virtual void dma_wait(uint32 mask) {}
    virtual void show_dma_wait(Scheduler *s, int cpu) {}
    virtual void start_profile() {}
    virtual void show_profile() {}
    void (*start_dmawait_profile)(unsigned long long* start);
    void (*end_dmawait_profile)(unsigned long long* global_busy_time,unsigned long long* start,unsigned long long* stop);
    unsigned long long global_busy_time;
    unsigned long long start_time,stop_time;
    // API for SPU inbound/outbound mailbox
    virtual void mail_write(memaddr data) {}
    virtual void mail_write_finish_list(memaddr data) {}
    virtual memaddr mail_read() { return 0; }
    virtual memaddr task_list_mail_read() { return 0; }
    virtual void set_mail_waiter(SemPtr w)  = 0;
    
    // API for MFC list DMA transfer
    virtual void *dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask) { return 0; }
    virtual void dma_storeList(ListDataPtr, void *buff, uint32 mask) {}
    virtual uint32 get_tag() { return 0;}
    virtual void bound(ListData *) {}
};

#endif