Mercurial > hg > Game > Cerium
changeset 403:e2f29e912d0b draft
clean up and add more info on task_list
line wrap: on
line diff
--- a/TaskManager/Test/test_render/task/CreatePolygon.cpp Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygon.cpp Wed Sep 23 12:04:29 2009 +0900 @@ -35,7 +35,7 @@ } int -CreatePolygon::run(void *rbuf, void *wbuf) +CreatePolygon::run(SchedTask *smanager, void *rbuf, void *wbuf) { float xyz1[4],xyz2[4],xyz3[4];
--- a/TaskManager/Test/test_render/task/CreatePolygon.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygon.h Wed Sep 23 12:04:29 2009 +0900 @@ -7,7 +7,7 @@ public: SchedConstructor(CreatePolygon); - int run(void *rbuf, void *wbuf); + int run(SchedTask *smanager, void *rbuf, void *wbuf); }; #endif
--- a/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cpp Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cpp Wed Sep 23 12:04:29 2009 +0900 @@ -71,7 +71,7 @@ } */ int -CreatePolygonFromSceneGraph::run(void *rbuf, void *wbuf) +CreatePolygonFromSceneGraph::run(SchedTask *smanager, void *rbuf, void *wbuf) { float xyz1[4], xyz2[4], xyz3[4]; /*
--- a/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.h Wed Sep 23 12:04:29 2009 +0900 @@ -7,7 +7,7 @@ public: SchedConstructor(CreatePolygonFromSceneGraph); - int run(void *rbuf, void *wbuf); + int run(SchedTask *smanager, void *rbuf, void *wbuf); }; #endif
--- a/TaskManager/Test/test_render/task/CreateSpan.cpp Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreateSpan.cpp Wed Sep 23 12:04:29 2009 +0900 @@ -195,7 +195,7 @@ * 長さの割合 (0 ... 1) */ void -CreateSpan::half_triangle(SpanPackPtr *spackList, +CreateSpan::half_triangle(SchedTask *smanager, SpanPackPtr *spackList, int charge_y_top, int charge_y_end, TriangleTexInfoPtr tex_info, VertexPack *vMin,VertexPack *vMid,VertexPack *vMid10, @@ -419,7 +419,7 @@ int -CreateSpan::run(void *rbuf, void *wbuf) +CreateSpan::run(SchedTask *smanager, void *rbuf, void *wbuf) { PolygonPack *pp = (PolygonPack*)smanager->get_input(0); PolygonPack *next_pp = @@ -480,11 +480,11 @@ * (vMax, vMid, vMid10) (vMin, vMid, vMid10) という * 二つの Triangle に分けている */ - half_triangle(spackList, charge_y_top, charge_y_end, + half_triangle(smanager, spackList, charge_y_top, charge_y_end, tri_tex_info, vMin, vMid, vMid10, normal1,normal2,normal3, (int)(vMax->y - vMin->y), vMax->tex_y - vMin->tex_y); - half_triangle(spackList, charge_y_top, charge_y_end, + half_triangle(smanager, spackList, charge_y_top, charge_y_end, tri_tex_info, vMax, vMid, vMid10, normal1,normal2,normal3, (int)(vMax->y - vMin->y), vMax->tex_y - vMin->tex_y);
--- a/TaskManager/Test/test_render/task/CreateSpan.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreateSpan.h Wed Sep 23 12:04:29 2009 +0900 @@ -9,8 +9,8 @@ public: SchedConstructor(CreateSpan); - int run(void *rbuf, void *wbuf); - void half_triangle(SpanPackPtr *spackList, + int run(SchedTask *smanager, void *rbuf, void *wbuf); + void half_triangle(SchedTask *smanager, SpanPackPtr *spackList, int charge_y_top, int charge_y_end, TriangleTexInfoPtr tex_info, VertexPack *vMin,VertexPack *vMid,VertexPack *vMid1,
--- a/TaskManager/Test/test_render/task/DrawBack.cpp Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawBack.cpp Wed Sep 23 12:04:29 2009 +0900 @@ -14,7 +14,7 @@ } int -DrawBack::run(void *rbuf, void *wbuf) +DrawBack::run(SchedTask *smanager, void *rbuf, void *wbuf) { int rgb = smanager->get_param(0); int rangex_start = smanager->get_param(1);
--- a/TaskManager/Test/test_render/task/DrawBack.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawBack.h Wed Sep 23 12:04:29 2009 +0900 @@ -7,7 +7,7 @@ public: SchedConstructor(DrawBack); - int run(void *rbuf, void *wbuf); + int run(SchedTask *smanager, void *rbuf, void *wbuf); void linebuf_init(int *buf, int width, int rgb); };
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.cpp Wed Sep 23 12:04:29 2009 +0900 @@ -15,9 +15,9 @@ #define SPAN_PACK_LOAD 2 #define FB_STORE 3 -DrawSpan::~DrawSpan(void) +DrawSpan::~DrawSpan() { - smanager->dma_wait(FB_STORE); + dma_wait(FB_STORE); free((void*)((int)linebuf*doneWrite)); } @@ -88,7 +88,7 @@ * @return Buffer */ int* -DrawSpan::linebuf_init(int width, int height, int rgb) +DrawSpan::linebuf_init(SchedTask *smanager, int width, int height, int rgb) { int *buf = (int*)smanager->allocate(sizeof(int)*width*height); @@ -107,7 +107,7 @@ * @return Z-Buffer */ float* -DrawSpan::zRow_init(int width, int height) +DrawSpan::zRow_init(SchedTask *smanager, int width, int height) { float *buf = (float*)smanager->allocate(sizeof(float)*width*height); float def = 65535.0f; @@ -129,8 +129,8 @@ void -DrawSpan::writebuffer(unsigned int display, int buf_width, int height, - int screen_width) +DrawSpan::writebuffer(SchedTask *smanager, unsigned int display, + int buf_width, int height, int screen_width) { for (int i = 0; i < height; i++) { smanager->dma_store(&linebuf[i*buf_width], @@ -178,7 +178,7 @@ * @param endx 描画終了範囲 */ int -DrawSpan::drawDot1(SpanPtr span, int startx, int endx, int wait_tag) +DrawSpan::drawDot1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag) { int rangex = endx - startx + 1; @@ -234,7 +234,7 @@ } void -DrawSpan::drawDot2(SpanPtr span, int startx, int end, int js, int wait_tag) +DrawSpan::drawDot2(SchedTask *smanager, SpanPtr span, int startx, int end, int js, int wait_tag) { //printf("%d\n", js); } @@ -257,7 +257,7 @@ * @return 「span のどの位置まで rendering が終わったか」の x 座標 */ int -DrawSpan::drawLine1(SpanPtr span, int startx, int endx, int wait_tag) +DrawSpan::drawLine1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag) { int x = span->x; int rangex = endx - startx + 1; @@ -366,7 +366,7 @@ int -DrawSpan::run(void *rbuf, void *wbuf) +DrawSpan::run(SchedTask *smanager, void *rbuf, void *wbuf) { SpanPackPtr spack = (SpanPackPtr)smanager->get_input(0); SpanPackPtr next_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); @@ -376,7 +376,7 @@ Span nop_span; nop_span.length_x = 1; - int (DrawSpan::*drawFunc1[2])(SpanPtr, int, int, int) = { + int (DrawSpan::*drawFunc1[2])(SchedTask *, SpanPtr, int, int, int) = { &DrawSpan::drawDot1, &DrawSpan::drawLine1 }; @@ -392,9 +392,9 @@ int rangey = smanager->get_param(4); tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST); - zRow = zRow_init(rangex, rangey); + zRow = zRow_init(smanager, rangex, rangey); //linebuf = linebuf_init(rangex, rangey, 0x00ffffff); - linebuf = linebuf_init(rangex, rangey, 0); + linebuf = linebuf_init(smanager, rangex, rangey, 0); doneWrite = 0; @@ -429,6 +429,7 @@ */ next_span_x = (this->*drawFunc1[(span->length_x != 1)])( + smanager, span, rangex_start, rangex_end, tl_tag[tl_tag_flg1]); next_span = span; @@ -453,7 +454,7 @@ next_spack = tmp_spack; } while (spack); - writebuffer(display, rangex, rangey, screen_width); + writebuffer(smanager, display, rangex, rangey, screen_width); // linebuf は、writebuffer() の dma_store を wait する // DrawSpan::~DrawSpan() 内で free する。
--- a/TaskManager/Test/test_render/task/DrawSpan.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.h Wed Sep 23 12:04:29 2009 +0900 @@ -19,28 +19,28 @@ ~DrawSpan(void); - int run(void *rbuf, void *wbuf); + int run(SchedTask *smanager, void *rbuf, void *wbuf); - int* linebuf_init(int width, int height, int rgb); - float* zRow_init(int width, int height); + int* linebuf_init(SchedTask *smanager, int width, int height, int rgb); + float* zRow_init(SchedTask *smanager, int width, int height); TilePtr set_rgb(memaddr addr, int wait_tag); void set_rgbs(memaddr addr, uint32 *max_addr, int wait_tag); uint32 get_rgb(int tx, int ty, TilePtr tile); TilePtr isAvailableTile(memaddr addr); memaddr getTile(int tx, int ty, int tw, memaddr tex_addr_top); int getTexBlock(int tx, int ty, int twidth); - void writebuffer(unsigned int display, int width, int height, - int screen_width); + void writebuffer(SchedTask *smanager, unsigned int display, + int width, int height, int screen_width); void updateBuffer(float zpos, int rangex, int x, int y, int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, TilePtr tile); void reboot(SpanPackPtr spack, int cur_span_x); - int drawDot1(SpanPtr span, int startx, int endx, int wait_tag); - void drawDot2(SpanPtr span, int startx, int endx, int js, int wait_tag); - int drawLine1(SpanPtr span, int startx, int endx, int wait_tag); - void drawLine2(SpanPtr span, int startx, int endx, int js, int wait_tag); + int drawDot1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag); + void drawDot2(SchedTask *smanager, SpanPtr span, int startx, int endx, int js, int wait_tag); + int drawLine1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag); + void drawLine2(SchedTask *smanager, SpanPtr span, int startx, int endx, int js, int wait_tag); int infinity_light_calc(int color,float normal_x, float normal_y, float normal_z); };
--- a/TaskManager/Test/test_render/task/Load_Texture.cpp Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/Load_Texture.cpp Wed Sep 23 12:04:29 2009 +0900 @@ -16,7 +16,7 @@ * Hash の準備だけなので、名前変えないとなー */ int -LoadTexture::run(void *rbuf , void *wbuf) +LoadTexture::run(SchedTask *smanager, void *rbuf , void *wbuf) { MemList *ml = smanager->createMemList(sizeof(uint32) * TEXTURE_BLOCK_SIZE, MAX_TILE); smanager->global_set(GLOBAL_TILE_LIST, (void *)ml);
--- a/TaskManager/Test/test_render/task/Load_Texture.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/Load_Texture.h Wed Sep 23 12:04:29 2009 +0900 @@ -8,7 +8,7 @@ public: SchedConstructor(LoadTexture); - int run(void *rbuf, void *wbuf); + int run(SchedTask *smanager, void *rbuf, void *wbuf); }; #endif
--- a/TaskManager/Test/test_render/task/create_sgp.cpp Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/create_sgp.cpp Wed Sep 23 12:04:29 2009 +0900 @@ -1,6 +1,6 @@ #include "scene_graph_pack.h" #include "SceneGraph.h" -#include "create_sgp.hpp" +#include "create_sgp.h" #include "TaskManager.h" using namespace std; @@ -15,7 +15,7 @@ */ int //create_sgp(Polygon *sg, SceneGraphPack *sgp) -Create_SGP::run(void *rbuf, void *wbuf) +Create_SGP::run(SchedTask *smanager, void *rbuf, void *wbuf) { //SceneGraph *sg = (SceneGraph*)smanager->get_input(rbuf, 0); SceneGraph *sg = (SceneGraph*)smanager->get_param(0);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/task/create_sgp.h Wed Sep 23 12:04:29 2009 +0900 @@ -0,0 +1,15 @@ +#ifndef INCLUDED_TASK_LOAD_TEXTURE +#define INCLUDED_TASK_LOAD_TEXTURE + +#ifndef INCLUDED_SCHED_TASK +#include "SchedTask.h" +#endif + +class Create_SGP : public SchedTask { +public: + SchedConstructor(Create_SGP); + + int run(SchedTask *smanager, void *rbuf, void *wbuf); +}; + +#endif
--- a/TaskManager/Test/test_render/task/create_sgp.hpp Mon Sep 21 20:00:12 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#ifndef INCLUDED_TASK_LOAD_TEXTURE -#define INCLUDED_TASK_LOAD_TEXTURE - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -class Create_SGP : public SchedTask { -public: - SchedConstructor(Create_SGP); - - int run(void *rbuf, void *wbuf); -}; - -#endif
--- a/TaskManager/Test/test_render/task/task_init.cpp Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/Test/test_render/task/task_init.cpp Wed Sep 23 12:04:29 2009 +0900 @@ -14,8 +14,8 @@ SchedExternTask(LoadTexture); SchedExternTask(SetTexture); -SchedExternTask(Move); -SchedExternTask(Draw); +// SchedExternTask(Move); +// SchedExternTask(Draw); SchedExternTask(Dummy); @@ -41,8 +41,8 @@ SchedRegisterTask(TASK_INIT_TEXTURE, LoadTexture); SchedRegisterTask(TASK_SET_TEXTURE, SetTexture); - SchedRegisterTask(TASK_MOVE, Move); - SchedRegisterTask(TASK_DRAW, Draw); +// SchedRegisterTask(TASK_MOVE, Move); +// SchedRegisterTask(TASK_DRAW, Draw); SchedRegisterTask(TASK_DUMMY, Dummy); SchedRegisterTask(SHOW_TIME, ShowTime);
--- a/TaskManager/kernel/schedule/SchedExit.cc Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedExit.cc Wed Sep 23 12:04:29 2009 +0900 @@ -3,7 +3,7 @@ #include "error.h" SchedTaskBase* -SchedExit::next(Scheduler *m, SchedTaskBase *p) +SchedExit::next(Scheduler *scheduler, SchedTaskBase *p) { delete p;
--- a/TaskManager/kernel/schedule/SchedExit.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedExit.h Wed Sep 23 12:04:29 2009 +0900 @@ -9,8 +9,9 @@ class SchedExit : public SchedTaskBase { public: BASE_NEW_DELETE(SchedExit); + /* functions */ + SchedTaskBase* next(Scheduler *, SchedTaskBase *); - SchedTaskBase* next(Scheduler *, SchedTaskBase *); }; #endif
--- a/TaskManager/kernel/schedule/SchedMail.cc Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedMail.cc Wed Sep 23 12:04:29 2009 +0900 @@ -3,13 +3,8 @@ #include "SchedExit.h" #include "error.h" -SchedMail::SchedMail(Scheduler *sched) -{ - scheduler = sched; -} - SchedTaskBase* -SchedMail::next(Scheduler *m, SchedTaskBase *p) +SchedMail::next(Scheduler *scheduler, SchedTaskBase *p) { delete p; @@ -20,6 +15,6 @@ if ((int)params_addr == MY_SPE_COMMAND_EXIT) { return new SchedExit(); } else { - return new SchedTaskList(params_addr, m); + return new SchedTaskList(params_addr, scheduler); } }
--- a/TaskManager/kernel/schedule/SchedMail.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedMail.h Wed Sep 23 12:04:29 2009 +0900 @@ -10,13 +10,10 @@ class SchedMail : public SchedTaskBase{ public: /* constructor */ - SchedMail(Scheduler *); - BASE_NEW_DELETE(SchedMail); /* variables */ unsigned int params_addr; - Scheduler* scheduler; /* functions */ SchedTaskBase* next(Scheduler *, SchedTaskBase *);
--- a/TaskManager/kernel/schedule/SchedNop.cc Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedNop.cc Wed Sep 23 12:04:29 2009 +0900 @@ -4,11 +4,11 @@ #include "error.h" SchedTaskBase* -SchedNop::next(Scheduler *m, SchedTaskBase *p) +SchedNop::next(Scheduler *scheduler, SchedTaskBase *p) { __debug("SchedNop::next()"); delete p; - return new SchedMail(m); + return new SchedMail(); }
--- a/TaskManager/kernel/schedule/SchedNop2Ready.cc Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedNop2Ready.cc Wed Sep 23 12:04:29 2009 +0900 @@ -18,7 +18,7 @@ } SchedTaskBase* -SchedNop2Ready::next(Scheduler *m, SchedTaskBase *p) +SchedNop2Ready::next(Scheduler *scheduler,SchedTaskBase *p) { SchedTaskBase *nextSched; @@ -33,6 +33,6 @@ return nextSched; } else { scheduler->mail_write(MY_SPE_STATUS_READY); - return new SchedMail(scheduler); + return new SchedMail(); } }
--- a/TaskManager/kernel/schedule/SchedTask.cc Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Wed Sep 23 12:04:29 2009 +0900 @@ -12,9 +12,9 @@ //#define NO_PIPELINE SchedTask * -createSchedTask(TaskPtr task) +createSchedTask(Scheduler *scheduler, TaskPtr task) { - return task_list[task->command](); + return task_list[task->command].creator(scheduler); } @@ -49,7 +49,7 @@ * Scheduler の持つ、使い回しの buffer ではなく * 新たに allocate されたものなので、ここで free する */ -SchedTask::~SchedTask(void) +SchedTask::~SchedTask() { if (__flag_renewTask == SCHED_TASK_RENEW) { free(__inListData); @@ -73,7 +73,7 @@ * このタスクを Renew Task とし、それに応じた関数をセットする */ void -SchedTask::__setRenew(void) +SchedTask::__setRenew() { __flag_renewTask = SCHED_TASK_RENEW; @@ -95,8 +95,6 @@ __scheduler = sc; __cur_index = index; - smanager = this; - __scheduler->mainMem_wait(); (this->*ex_init)(); @@ -106,7 +104,7 @@ * PPE 内で生成されたタスクの ex_init() */ void -SchedTask::ex_init_normal(void) +SchedTask::ex_init_normal() { __scheduler->dma_load(__inListData, (uint32)__task->inData, sizeof(ListData), DMA_READ_IN_LIST); @@ -127,7 +125,7 @@ * ex_init_normal() と違い、ここでは値を渡すだけ */ void -SchedTask::ex_init_renew(void) +SchedTask::ex_init_renew() { __inListData = __task->inData; __outListData = __task->outData; @@ -144,7 +142,7 @@ * # もちろん管理はユーザに任せるわけだ。 */ void -SchedTask::read(void) +SchedTask::read() { __debug("[SchedTask:%s]\n", __FUNCTION__); @@ -170,7 +168,7 @@ } void -SchedTask::exec(void) +SchedTask::exec() { __debug("[SchedTask:%s]\n", __FUNCTION__); @@ -205,7 +203,7 @@ } void -SchedTask::write(void) +SchedTask::write() { __debug("[SchedTask:%s]\n", __FUNCTION__); @@ -223,7 +221,7 @@ * PPE 内で生成されたタスクの ex_read() */ void -SchedTask::ex_read_normal(void) +SchedTask::ex_read_normal() { } @@ -231,7 +229,7 @@ * SPE 内で生成されたタスクの ex_read() */ void -SchedTask::ex_read_renew(void) +SchedTask::ex_read_renew() { } @@ -239,7 +237,7 @@ * PPE 内で生成されたタスクの ex_exec() */ void -SchedTask::ex_exec_normal(void) +SchedTask::ex_exec_normal() { } @@ -247,7 +245,7 @@ * SPE 内で生成されたタスクの ex_exec() */ void -SchedTask::ex_exec_renew(void) +SchedTask::ex_exec_renew() { } @@ -261,7 +259,7 @@ * PPE に終了したことは知らせない(command は送信しない) */ void -SchedTask::ex_write_normal(void) +SchedTask::ex_write_normal() { /** * このタスク内で新たにタスクが生成されなかった @@ -285,7 +283,7 @@ * PPE に mail 送信する。 */ void -SchedTask::ex_write_renew(void) +SchedTask::ex_write_renew() { uint32 cmd; @@ -300,7 +298,7 @@ } SchedTaskBase* -SchedTask::next(Scheduler *m, SchedTaskBase *p) +SchedTask::next(Scheduler *scheduler, SchedTaskBase *p) { __debug("[SchedTask:%s]\n", __FUNCTION__); @@ -310,7 +308,7 @@ } SchedTaskBase* -SchedTask::ex_next_normal(void) +SchedTask::ex_next_normal() { if (__cur_index < __list->length) { SchedTaskBase *nextSched; @@ -324,7 +322,7 @@ return nextSched; } else { TaskPtr nextTask = &__list->tasks[__cur_index++]; - nextSched = createSchedTask(nextTask); + nextSched = createSchedTask(__scheduler, nextTask); ((SchedTask*)nextSched)->__init__(__list, nextTask, __cur_index, __scheduler->get_curReadBuf(), __scheduler->get_curWriteBuf(), @@ -347,14 +345,14 @@ * */ SchedTaskBase* -SchedTask::ex_next_renew(void) +SchedTask::ex_next_renew() { TaskPtr nextTask; SchedTask *nextSched; if (__cur_index < __list->length) { nextTask = &__list->tasks[__cur_index++]; - nextSched = createSchedTask(nextTask); + nextSched = createSchedTask(__scheduler, nextTask); // RenewTaskList を実行中なので nextSched->__setRenew(); @@ -383,7 +381,7 @@ __cur_index = __scheduler->get_backupTaskListIndex(); nextTask = &nextList->tasks[__cur_index++]; - nextSched = createSchedTask(nextTask); + nextSched = createSchedTask(__scheduler, nextTask); nextSched->__init__(nextList, nextTask, __cur_index, __scheduler->get_curReadBuf(), @@ -398,7 +396,7 @@ } int -SchedTask::get_cpuid(void) +SchedTask::get_cpuid() { return __scheduler->id; } @@ -538,7 +536,7 @@ } void -SchedTask::mainMem_wait(void) { +SchedTask::mainMem_wait() { __scheduler->mainMem_wait(); }
--- a/TaskManager/kernel/schedule/SchedTask.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Wed Sep 23 12:04:29 2009 +0900 @@ -16,8 +16,6 @@ BASE_NEW_DELETE(SchedTask); - SchedTask *smanager; - private: /* variables */ @@ -163,7 +161,7 @@ const int SCHED_TASK_NORMAL = 0; const int SCHED_TASK_RENEW = 1; -extern SchedTask* createSchedTask(TaskPtr); +extern SchedTask* createSchedTask(Scheduler *,TaskPtr); #endif
--- a/TaskManager/kernel/schedule/SchedTaskBase.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskBase.h Wed Sep 23 12:04:29 2009 +0900 @@ -21,7 +21,7 @@ virtual void write(void) {} /* functions */ - virtual SchedTaskBase* next(Scheduler*, SchedTaskBase*) {return 0;} + virtual SchedTaskBase* next(Scheduler *, SchedTaskBase*) {return 0;} }; #endif
--- a/TaskManager/kernel/schedule/SchedTaskList.cc Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskList.cc Wed Sep 23 12:04:29 2009 +0900 @@ -34,7 +34,7 @@ void -SchedTaskList::read(void) +SchedTaskList::read() { __debug("[SchedTaskList:%s]\n", __FUNCTION__); @@ -48,7 +48,7 @@ } SchedTaskBase* -SchedTaskList::next(Scheduler *m, SchedTaskBase *p) +SchedTaskList::next(Scheduler *scheduler, SchedTaskBase *p) { SchedTaskBase *nextSched; @@ -67,7 +67,7 @@ } else { TaskPtr nextTask = &list->tasks[0]; - nextSched = createSchedTask(nextTask); + nextSched = createSchedTask(scheduler, nextTask); if (flag_renewTaskList == SCHED_TASKLIST_RENEW) { ((SchedTask*)nextSched)->__setRenew(); @@ -82,3 +82,4 @@ return nextSched; } +/* end */
--- a/TaskManager/kernel/schedule/Scheduler.cc Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Wed Sep 23 12:04:29 2009 +0900 @@ -330,10 +330,9 @@ * 本当は Scheduler クラスに入れるべきなんだろうか。。。 * なんか手抜きの感がある */ -void -register_task(int cmd, Scheduler::TaskObject task) +void register_task(int cmd, TaskObjectCreator creator) { - task_list[cmd] = task; + task_list[cmd].creator = creator; } /*!
--- a/TaskManager/kernel/schedule/Scheduler.h Mon Sep 21 20:00:12 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Wed Sep 23 12:04:29 2009 +0900 @@ -21,9 +21,11 @@ class SchedTask; class SchedTaskList; +typedef SchedTask* (*TaskObjectCreator)(Scheduler *); + class Scheduler { public: - virtual ~Scheduler(void); + virtual ~Scheduler(); BASE_NEW_DELETE(Scheduler); @@ -91,7 +93,11 @@ // Task Object Table // this is named TaskObject but it is not an object. // It is a pointer to an object creation function - typedef SchedTask* (*TaskObject)(void); + typedef struct { + TaskObjectCreator creator; + uint64 location; // location address in a.out + uint32 entry_offset; // offset for create(); + } TaskObject, *TaskObjectPtr; DmaManager* connector; @@ -101,28 +107,28 @@ SchedTaskBase* task3; /* functions */ - void init(void); - void run(void); - virtual void init_impl(void) {}; - void finish(void); + void init(); + void run(); + virtual void init_impl() {}; + void finish(); - TaskListPtr get_curListBuf(void); - ListDataPtr get_curReadBuf(void); - ListDataPtr get_curWriteBuf(void); - TaskListPtr get_renewListBuf(void); + TaskListPtr get_curListBuf(); + ListDataPtr get_curReadBuf(); + ListDataPtr get_curWriteBuf(); + TaskListPtr get_renewListBuf(); void set_backupTaskList(TaskListPtr cur_taskList); void set_backupTaskListIndex(int cur_index); - SchedTaskList* get_nextRenewTaskList(void); - TaskListPtr get_backupTaskList(void); - int get_backupTaskListIndex(void); + SchedTaskList* get_nextRenewTaskList(); + TaskListPtr get_backupTaskList(); + int get_backupTaskListIndex(); // なんか名前が変だが。。。 /* TaskGroup */ TaskGroupPtr set_groupTask(uint32 command); void add_groupTask(TaskGroupPtr group, TaskPtr task); void remove_groupTask(TaskGroupPtr group, TaskPtr task); - void reload_groupTask(void); + void reload_groupTask(); uint32 status_groupTask(TaskGroupPtr group); /* GlobalMemory */ @@ -134,7 +140,7 @@ virtual void *allocate(int size) { return NULL; }; virtual void mainMem_alloc(int id, int size) {}; - virtual void mainMem_wait(void) {}; + virtual void mainMem_wait() {}; void *mainMem_get(int id); MemorySegment * get_segment(memaddr addr, MemList *m); @@ -149,28 +155,32 @@ void show_dma_wait() { connector->show_dma_wait(id); }; void show_dma_wait(int id) { connector->show_dma_wait(id); }; void mail_write(uint32 data); - uint32 mail_read(void); + uint32 mail_read(); void dma_loadList(ListDataPtr list, void *, uint32 mask); void dma_storeList(ListDataPtr list, void *, uint32 mask); }; -extern void register_task(int cmd, Scheduler::TaskObject task); +extern void register_task(int cmd, TaskObjectCreator creator); + #endif #define SchedConstructor(str) \ - str(void) {} \ + str() {} \ BASE_NEW_DELETE(str) \ #define SchedDefineTask(str) \ - SchedTask* createTask_##str(void) \ + SchedTask* createTask_##str(Scheduler *manager) \ { \ return new str(); \ } #define SchedExternTask(str) \ extern \ - SchedTask* createTask_##str(void); + SchedTask* createTask_##str(Scheduler *manager); #define SchedRegisterTask(cmd, str) \ register_task(cmd, createTask_##str); + + +/* end */