view TaskManager/kernel/spe/SpeTaskList.cc @ 31:6a77b5e755ab

*** empty log message ***
author gongo
date Tue, 12 Feb 2008 13:56:54 +0900
parents 7aa4c006e4be
children
line wrap: on
line source

#include <stdio.h>
#include "SpeTaskList.h"
#include "SpeTask.h"
#include "SpeNop2Ready.h"
#include "DmaManager.h"
#include "error.h"

SpeTaskList::SpeTaskList(unsigned int addr, TaskListPtr listbuf, DmaManager* c)
{
    params_addr = addr;
    list = listbuf;
    connector = c;
}

void
SpeTaskList::read(void)
{
    __debug("[SpeTaskList:%s]\n", __FUNCTION__);

    connector->dma_load(list, params_addr, sizeof(TaskList), DMA_READ);
    connector->dma_wait(DMA_READ);
}

SpeTaskBase*
SpeTaskList::next(SpeManager *m, SpeTaskBase *p)
{
    __debug("[SpeTaskList:%s]\n", __FUNCTION__);

    delete p;

    if (list->length < 1) {
	return new SpeNop2Ready(connector);
    } else {
	// 本当は、ここで task->command に対応する、
	// SpeTask を継承する class を作ればいい。。。はず
	return new SpeTask(list, &list->tasks[--list->length],
			   m->get_curReadBuf(),
			   m->get_curWriteBuf(),
			   connector);
    }
}