# HG changeset patch # User Shinji KONO # Date 1254392725 -32400 # Node ID 44c0bce54dcfc7c1ce9bbd173baee3272d6bdc58 # Parent 4fa8760e18c2f811f4a817458b5a7894de8bbfe0 fix all examples. test_render is not working now. diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/ChainCal.cc --- a/TaskManager/Test/test_render/spe/ChainCal.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/ChainCal.cc Thu Oct 01 19:25:25 2009 +0900 @@ -10,12 +10,12 @@ #define CHAIN_LEN 50 -static double m = 100.0; -static double k = 7000.0; -static double g = 9.8; -static double dt = 0.003; -static double chain_width = 10; -static double safe = 0.995; +static const double m = 100.0; +static const double k = 7000.0; +static const double g = 9.8; +static const double dt = 0.003; +static const double chain_width = 10; +static const double safe = 0.995; typedef struct { double x, y, next_x, next_y; @@ -30,8 +30,8 @@ int ChainCal::run(SchedTask *s,void *rbuf, void *wbuf) { - ChainPropertyPtr property = (ChainPropertyPtr)get_input(rbuf, 0); - ChainPropertyPtr update_property = (ChainPropertyPtr)get_output(wbuf, 0); + ChainPropertyPtr property = (ChainPropertyPtr)s->get_input(rbuf, 0); + ChainPropertyPtr update_property = (ChainPropertyPtr)s->get_output(wbuf, 0); // ChainPropertyPtr property = (ChainPropertyPtr)rbuf; // int id = get_param(0); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/ChainCal.h --- a/TaskManager/Test/test_render/spe/ChainCal.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/ChainCal.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class ChainCal : public SchedTask { -public: - SchedConstructor(ChainCal); - - int run(SchedTask *smanager, void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/ChainInit.cc --- a/TaskManager/Test/test_render/spe/ChainInit.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/ChainInit.cc Thu Oct 01 19:25:25 2009 +0900 @@ -17,16 +17,15 @@ uint32 parent; } CHAIN_VARS; -CHAIN_VARS* property; -int -ChainInit::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { - CHAIN_VARS* idata = (CHAIN_VARS*)get_input(rbuf, 0); - uint32 chain_len = get_param(0); + CHAIN_VARS* idata = (CHAIN_VARS*)s->get_input(rbuf, 0); + uint32 chain_len = s->get_param(0); // property は spe 上で allocate している(global) - property = (CHAIN_VARS*)global_alloc(DATA_ID, sizeof(CHAIN_VARS)*chain_len); + CHAIN_VARS *property = (CHAIN_VARS*)global_alloc(DATA_ID, sizeof(CHAIN_VARS)*chain_len); memcpy(property, idata, sizeof(CHAIN_VARS)*chain_len); return 0; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/ChainInit.h --- a/TaskManager/Test/test_render/spe/ChainInit.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/ChainInit.h Thu Oct 01 19:25:25 2009 +0900 @@ -6,11 +6,5 @@ #endif -class ChainInit : public SchedTask { -public: - SchedConstructor(ChainInit); - - int run(SchedTask *s, void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/CreatePolygon.cc --- a/TaskManager/Test/test_render/spe/CreatePolygon.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreatePolygon.cc Thu Oct 01 19:25:25 2009 +0900 @@ -37,10 +37,10 @@ } } -int -CreatePolygon::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *smanager,void *rbuf, void *wbuf) { - __debug_spe("CreatePolygon\n"); + smanager->__debug_spe("CreatePolygon\n"); float xyz1[4],xyz2[4],xyz3[4]; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/CreatePolygon.h --- a/TaskManager/Test/test_render/spe/CreatePolygon.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreatePolygon.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class CreatePolygon : public SchedTask { -public: - SchedConstructor(CreatePolygon); - - int run(SchedTask *s, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/CreateSpan.cc --- a/TaskManager/Test/test_render/spe/CreateSpan.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreateSpan.cc Thu Oct 01 19:25:25 2009 +0900 @@ -11,9 +11,11 @@ static const int TILE_LOAD = 9; static const int TILE_STORE = 10; -static SpanPackPtr spack = NULL; -static SpanPackPtr send_spack = NULL; -static int prev_index = 0; +static struct g { + SpanPackPtr spack ; + SpanPackPtr send_spack ; + int prev_index = ; +} G, *Gptr; SchedDefineTask(CreateSpan); @@ -409,10 +411,10 @@ } -int -CreateSpan::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { - __debug_spe("CreateSpan\n"); + smanager->__debug_spe("CreateSpan\n"); PolygonPack *pp = (PolygonPack*)smanager->get_input(0); PolygonPack *next_pp = @@ -438,7 +440,7 @@ int charge_y_end = get_param(2); do { - __debug_spe("CreateSpan allocated 0x%x\n",(uint32)next_pp); + smanager->__debug_spe("CreateSpan allocated 0x%x\n",(uint32)next_pp); if (pp->next != NULL) { smanager->dma_load(next_pp, (uint32)pp->next, @@ -494,7 +496,7 @@ smanager->dma_store(spack, (uint32)spackList[prev_index], sizeof(SpanPack), SPAN_PACK_STORE); smanager->dma_wait(SPAN_PACK_STORE); - __debug_spe("CreateSpan spack_stored 0x%x\n",(uint32)spackList[prev_index]); + smanager->__debug_spe("CreateSpan spack_stored 0x%x\n",(uint32)spackList[prev_index]); // smanager で allocate したのだから free も smanager でやるべき free(free_pp); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/CreateSpan.h --- a/TaskManager/Test/test_render/spe/CreateSpan.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreateSpan.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,16 +5,5 @@ #include "polygon_pack.h" #include "SpanPack.h" -class CreateSpan : public SchedTask { -public: - SchedConstructor(CreateSpan); - - 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, - int length_y, float tex_y_len); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/DrawBack.cc --- a/TaskManager/Test/test_render/spe/DrawBack.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawBack.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,7 +8,7 @@ SchedDefineTask(DrawBack); -void +static void DrawBack::linebuf_init(int *buf, int x, int rgb) { for (int i = 0; i < x; i++) { @@ -16,8 +16,8 @@ } } -int -DrawBack::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { __debug_spe("DrawBack\n"); int rgb = smanager->get_param(0); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/DrawBack.h --- a/TaskManager/Test/test_render/spe/DrawBack.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawBack.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,13 +3,5 @@ #include "SchedTask.h" -class DrawBack : public SchedTask { -public: - SchedConstructor(DrawBack); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); - - void linebuf_init(int *buf, int width, int rgb); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/DrawSpan.cc --- a/TaskManager/Test/test_render/spe/DrawSpan.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cc Thu Oct 01 19:25:25 2009 +0900 @@ -18,11 +18,14 @@ #define SPAN_PACK_LOAD 2 #define FB_STORE 3 +/* + * done in post func? DrawSpan::~DrawSpan(void) { - smanager->dma_wait(FB_STORE); + smanager->dma_wait(FB_STORE); // 誰のために待ってるの? free((void*)((int)linebuf*doneWrite)); } + */ inline vector float spu_re_nrm(vector float a) @@ -36,13 +39,13 @@ } -vector signed int +static vector signed int getLocalPositionVec(vector signed int d, signed int offset) { return spu_and(d, spu_splats(offset-1)); } -vector signed int +static vector signed int getLocalXVec(vector signed int x) { return getLocalPositionVec(x, split_screen_w); @@ -79,8 +82,8 @@ * @param[in] twidth Width of texture * @return block ID */ -int -DrawSpan::getTexBlock(int tx, int ty, int twidth) +static int +getTexBlock(int tx, int ty, int twidth) { int blockX, blockY; @@ -100,8 +103,8 @@ * @param[in] tex_addr_top (tx,ty) で使うテクスチャの先頭address * @return block ID */ -memaddr -DrawSpan::getTile(int tx, int ty, int tw, memaddr tex_addr_top) +static memaddr +getTile(int tx, int ty, int tw, memaddr tex_addr_top) { int block = getTexBlock(tx, ty, tw); return tex_addr_top + block*TEXTURE_BLOCK_SIZE * sizeof(uint32); @@ -115,8 +118,8 @@ * @param rgb Initial value of RGB at Buffer * @return Buffer */ -int* -DrawSpan::linebuf_init(int width, int height, int rgb) +static int* +linebuf_init(int width, int height, int rgb) { int *buf = (int*)smanager->allocate(sizeof(int)*width*height); @@ -134,8 +137,8 @@ * @param height Height of Z-Buffer * @return Z-Buffer */ -float* -DrawSpan::zRow_init(int width, int height) +static float* +zRow_init(int width, int height) { float *buf = (float*)smanager->allocate(sizeof(float)*width*height); float def = 65535.0f; @@ -153,8 +156,8 @@ } -uint32 -DrawSpan::get_rgb(int tx, int ty, TilePtr tile) +static uint32 +get_rgb(int tx, int ty, TilePtr tile) { uint32 *data = (uint32 *)tile->data; return data[(TEXTURE_SPLIT_PIXEL)*ty+tx]; @@ -209,8 +212,8 @@ } #endif -void -DrawSpan::writebuffer(unsigned int display, int buf_width, int height, +static void +writebuffer(unsigned int display, int buf_width, int height, int screen_width) { for (int i = 0; i < height; i++) { @@ -233,8 +236,8 @@ * @param tex_y 〃 の y 座標 * @param tex_addr テクスチャのアドレス(MainMemory) */ -void -DrawSpan::updateBuffer(float zpos, int rangex, int x, int y, +static void +updateBuffer(float zpos, int rangex, int x, int y, int tex_x, int tex_y, TilePtr tile) { int rgb = get_rgb(tex_x, tex_y, tile); @@ -250,8 +253,9 @@ * @param startx 描画開始範囲 * @param endx 描画終了範囲 */ -int -DrawSpan::drawDot1(SpanPtr span, int startx, int endx, int wait_tag) + +static int +drawDot1(SpanPtr span, int startx, int endx, int wait_tag) { int rangex = endx - startx + 1; @@ -318,8 +322,8 @@ * @param endx 描画終了範囲 * @return 「span のどの位置まで rendering が終わったか」の x 座標 */ -int -DrawSpan::drawLine1(SpanPtr span, int startx, int endx, int wait_tag) +static int +drawLine1(SpanPtr span, int startx, int endx, int wait_tag) { int x = span->x; int rangex = endx - startx + 1; @@ -388,8 +392,8 @@ return ret; } -int -DrawSpan::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { __debug_spe("DrawSpan\n"); this->smanager = smanager; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/DrawSpan.h --- a/TaskManager/Test/test_render/spe/DrawSpan.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,39 +5,34 @@ #include "Tapestry.h" #include "SpanPack.h" -class DrawSpan : public SchedTask { -public: - SchedConstructor(DrawSpan); - - SchedTask *smanager; - +struct g { int *linebuf; float *zRow; TileListPtr tileList; int doneWrite; +} G, *Gptr ; - ~DrawSpan(void); - int run(SchedTask *smanager, void *rbuf, void *wbuf); +static int run(SchedTask *smanager, void *rbuf, void *wbuf); - int* linebuf_init(int width, int height, int rgb); - float* zRow_init(int width, int height); - uint32 get_rgb(int tx, int ty, TilePtr tile); - 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, +static int* linebuf_init(int width, int height, int rgb); +static float* zRow_init(int width, int height); +static uint32 get_rgb(int tx, int ty, TilePtr tile); +static memaddr getTile(int tx, int ty, int tw, memaddr tex_addr_top); +static int getTexBlock(int tx, int ty, int twidth); +static void writebuffer(unsigned int display, int width, int height, int screen_width); - void updateBuffer(float zpos, int rangex, int x, int y, +static void updateBuffer(float zpos, int rangex, int x, int y, int tex_x, int tex_y, TilePtr tile); #if 0 - void reboot(SpanPackPtr spack, int cur_span_x); +static void reboot(SpanPackPtr spack, int cur_span_x); #endif - 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); +static int drawDot1(SpanPtr span, int startx, int endx, int wait_tag); +static void drawDot2(SpanPtr span, int startx, int endx, int js, int wait_tag); +static int drawLine1(SpanPtr span, int startx, int endx, int wait_tag); +static void drawLine2(SpanPtr span, int startx, int endx, int js, int wait_tag); }; typedef struct { diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/InitKey.cc --- a/TaskManager/Test/test_render/spe/InitKey.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/InitKey.cc Thu Oct 01 19:25:25 2009 +0900 @@ -7,8 +7,8 @@ SchedDefineTask(InitKey); -int -InitKey::run(SchedTask *smanager, void *rbuf , void *wbuf) +static int +run(SchedTask *smanager, void *rbuf , void *wbuf) { /*void *key = */ smanager->global_alloc(KEY_STATUS, sizeof(key_stat)); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/InitKey.h --- a/TaskManager/Test/test_render/spe/InitKey.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/InitKey.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class InitKey : public SchedTask { -public: - SchedConstructor(InitKey); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/Load_Texture.cc --- a/TaskManager/Test/test_render/spe/Load_Texture.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Load_Texture.cc Thu Oct 01 19:25:25 2009 +0900 @@ -17,10 +17,10 @@ * 「Load」といいながら、結局 DrawSpan で使う * Hash の準備だけなので、名前変えないとなー */ -int -LoadTexture::run(SchedTask *smanager, void *rbuf , void *wbuf) +static int +run(SchedTask *smanager, void *rbuf , void *wbuf) { - __debug_spe("LoadTexture\n"); + smanager->__debug_spe("LoadTexture\n"); MemList *ml = smanager->createMemList(sizeof(uint32) * TEXTURE_BLOCK_SIZE, MAX_TILE); smanager->global_set(GLOBAL_TILE_LIST, (void *)ml); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/Load_Texture.h --- a/TaskManager/Test/test_render/spe/Load_Texture.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Load_Texture.h Thu Oct 01 19:25:25 2009 +0900 @@ -4,11 +4,5 @@ #include "SchedTask.h" #include "Tapestry.h" -class LoadTexture : public SchedTask { -public: - SchedConstructor(LoadTexture); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/Set_Texture.cc --- a/TaskManager/Test/test_render/spe/Set_Texture.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Set_Texture.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,22 +8,22 @@ SchedDefineTask(SetTexture); //texture をglobal 領域にコピーするタスク -int -SetTexture::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { - __debug_spe("SetTexture\n"); + __debug_spe(s, "SetTexture\n"); void *src[4]; - src[0] = get_input(rbuf, 0); - src[1] = get_input(rbuf, 1); - src[2] = get_input(rbuf, 2); - src[3] = get_input(rbuf, 3); + src[0] = s->get_input(rbuf, 0); + src[1] = s->get_input(rbuf, 1); + src[2] = s->get_input(rbuf, 2); + src[3] = s->get_input(rbuf, 3); - if (global_get(TEXTURE_ID)) { + if (s->global_get(TEXTURE_ID)) { return 0; } else { //タスクが共有できる領域確保 - void *data = global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); + void *data = s->global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); memcpy(data, src[0], MAX_LOAD_SIZE); memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/Set_Texture.h --- a/TaskManager/Test/test_render/spe/Set_Texture.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Set_Texture.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,12 +3,6 @@ #include "SchedTask.h" -class SetTexture : public SchedTask { -public: - SchedConstructor(SetTexture); - - int run(SchedTask *s, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/ShowTime.cc --- a/TaskManager/Test/test_render/spe/ShowTime.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/ShowTime.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,8 +3,8 @@ SchedDefineTask(ShowTime); -int -ShowTime::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { /* * ここで show_dma_wait() を呼びたい diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/ShowTime.h --- a/TaskManager/Test/test_render/spe/ShowTime.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/ShowTime.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class ShowTime : public SchedTask { -public: - SchedConstructor(ShowTime); - - int run(SchedTask *smanager, void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/TileHash.cc --- a/TaskManager/Test/test_render/spe/TileHash.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/TileHash.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,6 +3,10 @@ #include #include "TileHash.h" +#if 0 + +not used now + static unsigned short PRIME[8] = { 0x002, 0x065, 0x0c7, 0x133, 0x191, 0x1f3, 0x259, 0x2bd, }; @@ -86,3 +90,5 @@ { bzero(table, tableSize); } +#endif + diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/TileHash.h --- a/TaskManager/Test/test_render/spe/TileHash.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/TileHash.h Thu Oct 01 19:25:25 2009 +0900 @@ -1,6 +1,10 @@ #ifndef INCLUDED_TEXTURE_HASH #define INCLUDED_TEXTURE_HASH +#if 0 + +Not used Now + #include "Tapestry.h" class TileHash { @@ -25,4 +29,4 @@ const int hashSize = 263; const int tableSize = sizeof(TilePtr)*hashSize; - +#endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/UpdateKey.cc --- a/TaskManager/Test/test_render/spe/UpdateKey.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/UpdateKey.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,8 +5,8 @@ SchedDefineTask(UpdateKey); -int -UpdateKey::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { key_stat *key = (key_stat*)smanager->get_input(rbuf, 0); key_stat *gdata = (key_stat*)smanager->global_get(KEY_STATUS); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/spe/UpdateKey.h --- a/TaskManager/Test/test_render/spe/UpdateKey.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/spe/UpdateKey.h Thu Oct 01 19:25:25 2009 +0900 @@ -4,12 +4,5 @@ #include "SchedTask.h" //#include "SceneGraphRoot.h" -class UpdateKey : public SchedTask { -public: - SchedConstructor(UpdateKey); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); - void setKeyStat(); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/ChainMove.cc --- a/TaskManager/Test/test_render/task/ChainMove.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/ChainMove.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,3 @@ #include "ChainMove.h" #include "viewer_types.h" -SchedDefineTask(ChainMove); - -int -ChainMove::run(SchedTask *s,void *rbuf, void *wbuf) -{ - - return 0; -} diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/ChainMove.h --- a/TaskManager/Test/test_render/task/ChainMove.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/ChainMove.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class ChainMove : public SchedTask { -public: - SchedConstructor(ChainMove); - - int run(SchedTask *s,void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/CreatePolygon.cc --- a/TaskManager/Test/test_render/task/CreatePolygon.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygon.cc Thu Oct 01 19:25:25 2009 +0900 @@ -34,8 +34,8 @@ } } -int -CreatePolygon::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { float xyz1[4],xyz2[4],xyz3[4]; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/CreatePolygon.h --- a/TaskManager/Test/test_render/task/CreatePolygon.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygon.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class CreatePolygon : public SchedTask { -public: - SchedConstructor(CreatePolygon); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cc --- a/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cc Thu Oct 01 19:25:25 2009 +0900 @@ -70,8 +70,8 @@ } } */ -int -CreatePolygonFromSceneGraph::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { float xyz1[4], xyz2[4], xyz3[4]; /* diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.h --- a/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class CreatePolygonFromSceneGraph : public SchedTask { -public: - SchedConstructor(CreatePolygonFromSceneGraph); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/CreateSpan.cc --- a/TaskManager/Test/test_render/task/CreateSpan.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreateSpan.cc Thu Oct 01 19:25:25 2009 +0900 @@ -418,8 +418,8 @@ } -int -CreateSpan::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { PolygonPack *pp = (PolygonPack*)smanager->get_input(0); PolygonPack *next_pp = @@ -435,14 +435,14 @@ SpanPackPtr *spackList = (SpanPackPtr*)smanager->get_input(1); spack = (SpanPackPtr)smanager->get_input(2); send_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); - prev_index = get_param(0); + prev_index = smanager->get_param(0); // spack と send_spack は swap しながら DMA を繰り返すので // 自分で allocate した send_spack を覚えてないといけない SpanPackPtr free_spack = send_spack; - int charge_y_top = get_param(1); - int charge_y_end = get_param(2); + int charge_y_top = smanager->get_param(1); + int charge_y_end = smanager->get_param(2); do { if (pp->next != NULL) { diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/CreateSpan.h --- a/TaskManager/Test/test_render/task/CreateSpan.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreateSpan.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,17 +5,11 @@ #include "polygon_pack.h" #include "SpanPack.h" -class CreateSpan : public SchedTask { -public: - SchedConstructor(CreateSpan); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); - void half_triangle(SchedTask *smanager, SpanPackPtr *spackList, +static void half_triangle(SchedTask *smanager, SpanPackPtr *spackList, int charge_y_top, int charge_y_end, TriangleTexInfoPtr tex_info, VertexPack *vMin,VertexPack *vMid,VertexPack *vMid1, NormalPack *normal1, NormalPack *normal2, NormalPack *normal3, int length_y, float tex_y_len); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Draw.cc --- a/TaskManager/Test/test_render/task/Draw.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Draw.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,8 +5,8 @@ SchedDefineTask(Draw); -int -Draw::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { return 0; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Draw.h --- a/TaskManager/Test/test_render/task/Draw.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Draw.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,12 +3,5 @@ #include "SchedTask.h" -class Draw : public SchedTask { -public: - SchedConstructor(Draw); - - int run(SchedTask *s,void *rbuf, void *wbuf); - -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/DrawBack.cc --- a/TaskManager/Test/test_render/task/DrawBack.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawBack.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,16 +5,16 @@ SchedDefineTask(DrawBack); -void -DrawBack::linebuf_init(int *buf, int x, int rgb) +static void +linebuf_init(int *buf, int x, int rgb) { for (int i = 0; i < x; i++) { buf[i] = rgb; } } -int -DrawBack::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { int rgb = smanager->get_param(0); int rangex_start = smanager->get_param(1); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/DrawBack.h --- a/TaskManager/Test/test_render/task/DrawBack.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawBack.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,13 +3,7 @@ #include "SchedTask.h" -class DrawBack : public SchedTask { -public: - SchedConstructor(DrawBack); - int run(SchedTask *smanager, void *rbuf, void *wbuf); - - void linebuf_init(int *buf, int width, int rgb); -}; +static void linebuf_init(int *buf, int width, int rgb); #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/DrawSpan.cc --- a/TaskManager/Test/test_render/task/DrawSpan.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.cc Thu Oct 01 19:25:25 2009 +0900 @@ -15,11 +15,15 @@ #define SPAN_PACK_LOAD 2 #define FB_STORE 3 +/* + * + * should be done in some where... DrawSpan::~DrawSpan() { dma_wait(FB_STORE); free((void*)((int)linebuf*doneWrite)); } + */ /** * テクスチャは、TEXTURE_SPLIT_PIXEL^2 のブロックに分割する @@ -51,8 +55,8 @@ * @param[in] twidth Width of texture * @return block ID */ -int -DrawSpan::getTexBlock(int tx, int ty, int twidth) +static int +getTexBlock(int tx, int ty, int twidth) { int blockX, blockY; @@ -72,8 +76,8 @@ * @param[in] tex_addr_top (tx,ty) で使うテクスチャの先頭address * @return block ID */ -memaddr -DrawSpan::getTile(int tx, int ty, int tw, memaddr tex_addr_top) +static memaddr +getTile(int tx, int ty, int tw, memaddr tex_addr_top) { int block = getTexBlock(tx, ty, tw); return tex_addr_top + block * TEXTURE_BLOCK_SIZE * sizeof(uint32); @@ -87,8 +91,8 @@ * @param rgb Initial value of RGB at Buffer * @return Buffer */ -int* -DrawSpan::linebuf_init(SchedTask *smanager, int width, int height, int rgb) +static int* +linebuf_init(SchedTask *smanager, int width, int height, int rgb) { int *buf = (int*)smanager->allocate(sizeof(int)*width*height); @@ -106,8 +110,8 @@ * @param height Height of Z-Buffer * @return Z-Buffer */ -float* -DrawSpan::zRow_init(SchedTask *smanager, int width, int height) +static float* +zRow_init(SchedTask *smanager, int width, int height) { float *buf = (float*)smanager->allocate(sizeof(float)*width*height); float def = 65535.0f; @@ -120,16 +124,16 @@ } -uint32 -DrawSpan::get_rgb(int tx, int ty, TilePtr tile) +static uint32 +get_rgb(int tx, int ty, TilePtr tile) { uint32 *data = (uint32 *)tile->data; return data[(TEXTURE_SPLIT_PIXEL)*ty+tx]; } -void -DrawSpan::writebuffer(SchedTask *smanager, unsigned int display, +static void +writebuffer(SchedTask *smanager, unsigned int display, int buf_width, int height, int screen_width) { for (int i = 0; i < height; i++) { @@ -152,8 +156,8 @@ * @param tex_y 〃 の y 座標 * @param tex_addr テクスチャのアドレス(MainMemory) */ -void -DrawSpan::updateBuffer(float zpos, int rangex, int x, int y, int tex_x, int tex_y, +static void +updateBuffer(float zpos, int rangex, int x, int y, int tex_x, int tex_y, float normal_x, float normal_y, float normal_z, TilePtr tile) { @@ -177,8 +181,8 @@ * @param startx 描画開始範囲 * @param endx 描画終了範囲 */ -int -DrawSpan::drawDot1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag) +static int +drawDot1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag) { int rangex = endx - startx + 1; @@ -233,8 +237,8 @@ return -1; } -void -DrawSpan::drawDot2(SchedTask *smanager, SpanPtr span, int startx, int end, int js, int wait_tag) +static void +drawDot2(SchedTask *smanager, SpanPtr span, int startx, int end, int js, int wait_tag) { //printf("%d\n", js); } @@ -256,8 +260,8 @@ * @param endx 描画終了範囲 * @return 「span のどの位置まで rendering が終わったか」の x 座標 */ -int -DrawSpan::drawLine1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag) +static int +drawLine1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag) { int x = span->x; int rangex = endx - startx + 1; @@ -331,8 +335,8 @@ return ret; } -int -DrawSpan::infinity_light_calc(int color,float normal_x, float normal_y, float normal_z) +static int +infinity_light_calc(int color,float normal_x, float normal_y, float normal_z) { unsigned char rgb[4]; int light_rgb; @@ -365,8 +369,8 @@ } -int -DrawSpan::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { SpanPackPtr spack = (SpanPackPtr)smanager->get_input(0); SpanPackPtr next_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/DrawSpan.h --- a/TaskManager/Test/test_render/task/DrawSpan.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.h Thu Oct 01 19:25:25 2009 +0900 @@ -8,40 +8,36 @@ #include "TileHash.h" #endif -class DrawSpan : public SchedTask { -public: - SchedConstructor(DrawSpan); - +struct g { int *linebuf; float *zRow; TileListPtr tileList; int doneWrite; +} G, *Gptr; - ~DrawSpan(void); - int run(SchedTask *smanager, void *rbuf, void *wbuf); - 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(SchedTask *smanager, unsigned int display, +static int* linebuf_init(SchedTask *smanager, int width, int height, int rgb); +static float* zRow_init(SchedTask *smanager, int width, int height); +static TilePtr set_rgb(memaddr addr, int wait_tag); +static void set_rgbs(memaddr addr, uint32 *max_addr, int wait_tag); +static uint32 get_rgb(int tx, int ty, TilePtr tile); +static TilePtr isAvailableTile(memaddr addr); +static memaddr getTile(int tx, int ty, int tw, memaddr tex_addr_top); +static int getTexBlock(int tx, int ty, int twidth); +static void writebuffer(SchedTask *smanager, unsigned int display, int width, int height, int screen_width); - void updateBuffer(float zpos, int rangex, int x, int y, +static 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); +static void reboot(SpanPackPtr spack, int cur_span_x); - 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); +static int drawDot1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag); +static void drawDot2(SchedTask *smanager, SpanPtr span, int startx, int endx, int js, int wait_tag); +static int drawLine1(SchedTask *smanager, SpanPtr span, int startx, int endx, int wait_tag); +static void drawLine2(SchedTask *smanager, SpanPtr span, int startx, int endx, int js, int wait_tag); +static int infinity_light_calc(int color,float normal_x, float normal_y, float normal_z); }; typedef struct { diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/InitKey.cc --- a/TaskManager/Test/test_render/task/InitKey.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/InitKey.cc Thu Oct 01 19:25:25 2009 +0900 @@ -7,8 +7,8 @@ SchedDefineTask(InitKey); -int -InitKey::run(SchedTask *smanager, void *rbuf , void *wbuf) +static int +run(SchedTask *smanager, void *rbuf , void *wbuf) { void *key = smanager->global_alloc(KEY_STATUS, sizeof(key_stat)); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/InitKey.h --- a/TaskManager/Test/test_render/task/InitKey.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/InitKey.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class InitKey : public SchedTask { -public: - SchedConstructor(InitKey); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Load_Texture.cc --- a/TaskManager/Test/test_render/task/Load_Texture.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Load_Texture.cc Thu Oct 01 19:25:25 2009 +0900 @@ -15,8 +15,8 @@ * 「Load」といいながら、結局 DrawSpan で使う * Hash の準備だけなので、名前変えないとなー */ -int -LoadTexture::run(SchedTask *smanager, void *rbuf , void *wbuf) +static int +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); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Load_Texture.h --- a/TaskManager/Test/test_render/task/Load_Texture.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Load_Texture.h Thu Oct 01 19:25:25 2009 +0900 @@ -4,11 +4,5 @@ #include "SchedTask.h" #include "Tapestry.h" -class LoadTexture : public SchedTask { -public: - SchedConstructor(LoadTexture); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Move.cc --- a/TaskManager/Test/test_render/task/Move.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Move.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,8 +5,8 @@ SchedDefineTask(Move); -int -Move::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { //sgroot->updateControllerState(); //sgroot->speExecute(width, height); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Move.h --- a/TaskManager/Test/test_render/task/Move.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Move.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class Move : public SchedTask { -public: - SchedConstructor(Move); - - int run(SchedTask *s,void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/SendKey.cc --- a/TaskManager/Test/test_render/task/SendKey.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/SendKey.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,8 +3,8 @@ SchedDefineTask(SendKey); -int -SendKey::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/SendKey.h --- a/TaskManager/Test/test_render/task/SendKey.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/SendKey.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class SendKey : public SchedTask { -public: - SchedConstructor(SendKey); - - int run(SchedTask *s,void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Set_Texture.cc --- a/TaskManager/Test/test_render/task/Set_Texture.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Set_Texture.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,8 +6,8 @@ SchedDefineTask(SetTexture); //texture をglobal 領域にコピーするタスク -int -SetTexture::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { void *src[4]; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Set_Texture.h --- a/TaskManager/Test/test_render/task/Set_Texture.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Set_Texture.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,12 +3,6 @@ #include "SchedTask.h" -class SetTexture : public SchedTask { -public: - SchedConstructor(SetTexture); - - int run(SchedTask *s,void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/ShowTime.cc --- a/TaskManager/Test/test_render/task/ShowTime.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/ShowTime.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,8 +3,8 @@ SchedDefineTask(ShowTime); -int -ShowTime::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { /* * ここで show_dma_wait() を呼びたい diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/ShowTime.h --- a/TaskManager/Test/test_render/task/ShowTime.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/ShowTime.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,11 +3,5 @@ #include "SchedTask.h" -class ShowTime : public SchedTask { -public: - SchedConstructor(ShowTime); - - int run(SchedTask *s,void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Switch.cc --- a/TaskManager/Test/test_render/task/Switch.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Switch.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,8 +6,8 @@ SchedDefineTask(Switch); -int -Switch::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { // 配列にする // SceneGraphRootPtr tmp = sgroot; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/Switch.h --- a/TaskManager/Test/test_render/task/Switch.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/Switch.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,10 +3,5 @@ #include "SchedTask.h" -class Switch : public SchedTask { -public: - SchedConstructor(Switch); - int run(SchedTask *s,void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/TileHash.cc --- a/TaskManager/Test/test_render/task/TileHash.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/TileHash.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,6 +3,10 @@ #include #include "TileHash.h" +#if 0 + +not used now + static unsigned short PRIME[8] = { 0x002, 0x065, 0x0c7, 0x133, 0x191, 0x1f3, 0x259, 0x2bd, }; @@ -86,3 +90,4 @@ { bzero(table, tableSize); } +#endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/TileHash.h --- a/TaskManager/Test/test_render/task/TileHash.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/TileHash.h Thu Oct 01 19:25:25 2009 +0900 @@ -3,6 +3,7 @@ #include "Tapestry.h" +#if 0 class TileHash { public: TileHash(void); @@ -23,4 +24,4 @@ typedef TileHash* TileHashPtr; #endif - +#endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/UpdateKey.cc --- a/TaskManager/Test/test_render/task/UpdateKey.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/UpdateKey.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,8 +5,8 @@ SchedDefineTask(UpdateKey); -int -UpdateKey::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { key_stat *key = (key_stat*)smanager->get_input(rbuf, 0); key_stat *gdata = (key_stat*)smanager->global_get(KEY_STATUS); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/UpdateKey.h --- a/TaskManager/Test/test_render/task/UpdateKey.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/UpdateKey.h Thu Oct 01 19:25:25 2009 +0900 @@ -4,12 +4,6 @@ #include "SchedTask.h" #include "SceneGraphRoot.h" -class UpdateKey : public SchedTask { -public: - SchedConstructor(UpdateKey); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); - void setKeyStat(); -}; +static void setKeyStat(); #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/create_sgp.cc --- a/TaskManager/Test/test_render/task/create_sgp.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/create_sgp.cc Thu Oct 01 19:25:25 2009 +0900 @@ -13,9 +13,9 @@ * 親?の要素を探す事は出来ないかもしれません。 * next を辿って node->pn == とかやるのは確実だけどさ。。。 */ -int +static int //create_sgp(Polygon *sg, SceneGraphPack *sgp) -Create_SGP::run(SchedTask *smanager, void *rbuf, void *wbuf) +run(SchedTask *smanager, void *rbuf, void *wbuf) { //SceneGraph *sg = (SceneGraph*)smanager->get_input(rbuf, 0); SceneGraph *sg = (SceneGraph*)smanager->get_param(0); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/create_sgp.h --- a/TaskManager/Test/test_render/task/create_sgp.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/create_sgp.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ #include "SchedTask.h" #endif -class Create_SGP : public SchedTask { -public: - SchedConstructor(Create_SGP); - - int run(SchedTask *smanager, void *rbuf, void *wbuf); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/dummy.cc --- a/TaskManager/Test/test_render/task/dummy.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/dummy.cc Thu Oct 01 19:25:25 2009 +0900 @@ -2,8 +2,8 @@ SchedDefineTask(Dummy); -int -Dummy::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/dummy.h --- a/TaskManager/Test/test_render/task/dummy.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/dummy.h Thu Oct 01 19:25:25 2009 +0900 @@ -1,8 +1,2 @@ #include "SchedTask.h" -class Dummy : public SchedTask { -public: - SchedConstructor(Dummy); - - int run(SchedTask *s,void *rbuf, void *wbuf); -}; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/update_sgp.cc --- a/TaskManager/Test/test_render/task/update_sgp.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/update_sgp.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,8 +8,8 @@ SchedDefineTask(Update_SGP); -int -Update_SGP::run(SchedTask *s,void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { SceneGraphNodePtr node; SceneGraphPack *sgp = (SceneGraphPack*)get_input(rbuf, 0); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/Test/test_render/task/update_sgp.h --- a/TaskManager/Test/test_render/task/update_sgp.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/Test/test_render/task/update_sgp.h Thu Oct 01 19:25:25 2009 +0900 @@ -1,9 +1,2 @@ #include "SchedTask.h" -class Update_SGP : public SchedTask { -public: - SchedConstructor(Update_SGP); - - //int update_sgp(void *rbuf, void *wbuf); - int run(SchedTask *s,void *rbuf, void *wbuf); -}; diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/kernel/schedule/SchedTask.cc --- a/TaskManager/kernel/schedule/SchedTask.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Thu Oct 01 19:25:25 2009 +0900 @@ -581,6 +581,7 @@ return __scheduler->allocate(size); } + void SchedTask::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) { __scheduler->dma_load(buf, addr, size, mask); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/kernel/schedule/SchedTask.h --- a/TaskManager/kernel/schedule/SchedTask.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Thu Oct 01 19:25:25 2009 +0900 @@ -2,6 +2,7 @@ #define INCLUDED_SCHED_TASK #include +#include #include "base.h" #include "Scheduler.h" #include "SchedTaskBase.h" @@ -134,6 +135,9 @@ void *allocate(int size); + void free_(void *p) { + __scheduler->free_(p); + } void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask); diff -r 4fa8760e18c2 -r 44c0bce54dcf TaskManager/kernel/schedule/Scheduler.h --- a/TaskManager/kernel/schedule/Scheduler.h Thu Oct 01 17:33:58 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Thu Oct 01 19:25:25 2009 +0900 @@ -146,6 +146,7 @@ void global_free(int id); MemList* createMemList(int size, int count); virtual void *allocate(int size) { return NULL; }; + void free_(void *p) { free(p); } virtual void mainMem_alloc(int id, int size) {}; virtual void mainMem_wait() {}; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/HelloWorld/ppe/Hello.cc --- a/example/HelloWorld/ppe/Hello.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/HelloWorld/ppe/Hello.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,12 +6,12 @@ /* これは必須 */ SchedDefineTask(Hello); -int -Hello::run(void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { - int task_id = get_param(0); + int task_id = smanager->get_param(0); - printf("[%d] Hello, World!!\n", task_id); + smanager->printf("[%d] Hello, World!!\n", task_id); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/HelloWorld/ppe/Hello.h --- a/example/HelloWorld/ppe/Hello.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/HelloWorld/ppe/Hello.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Hello : public SchedTask { -public: - SchedConstructor(Hello); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/HelloWorld/ppe/task_init.cc --- a/example/HelloWorld/ppe/task_init.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/HelloWorld/ppe/task_init.cc Thu Oct 01 19:25:25 2009 +0900 @@ -11,7 +11,7 @@ */ void -task_init(void) +task_init() { SchedRegisterTask(HELLO_TASK, Hello); } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/HelloWorld/spe/Hello.cc --- a/example/HelloWorld/spe/Hello.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/HelloWorld/spe/Hello.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,12 +5,12 @@ /* これは必須 */ SchedDefineTask(Hello); -int -Hello::run(SchedTask *smanager, void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { - int task_id = get_param(0); + int task_id = smanager->get_param(0); - printf("[%d] Hello, World!!\n", task_id); + smanager->printf("[%d] Hello, World!!\n", task_id); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/HelloWorld/spe/Hello.h --- a/example/HelloWorld/spe/Hello.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/HelloWorld/spe/Hello.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Hello : public SchedTask { -public: - SchedConstructor(Hello); - - int run(SchedTask *smanager, void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/HelloWorld/spe/spe-main.cc --- a/example/HelloWorld/spe/spe-main.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/HelloWorld/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,7 +8,7 @@ * 必ずこの関数名でお願いします。 */ void -task_init(void) +task_init(Scheduler *s) { SchedRegisterTask(HELLO_TASK, Hello); } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/MemList/Makefile.cell --- a/example/MemList/Makefile.cell Thu Oct 01 17:33:58 2009 +0900 +++ b/example/MemList/Makefile.cell Thu Oct 01 19:25:25 2009 +0900 @@ -38,3 +38,4 @@ clean: rm -f $(TARGET) $(OBJS) $(TASK_OBJS) rm -f *~ \#* + cd spe; $(MAKE) clean diff -r 4fa8760e18c2 -r 44c0bce54dcf example/MemList/spe/Hello.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/MemList/spe/Hello.cc Thu Oct 01 19:25:25 2009 +0900 @@ -0,0 +1,16 @@ +#include +#include "Hello.h" +#include "Func.h" + +/* これは必須 */ +SchedDefineTask(Hello); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + int task_id = smanager->get_param(0); + + smanager->printf("[%d] Hello, World!!\n", task_id); + + return 0; +} diff -r 4fa8760e18c2 -r 44c0bce54dcf example/MemList/spe/Hello.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/MemList/spe/Hello.h Thu Oct 01 19:25:25 2009 +0900 @@ -0,0 +1,9 @@ +#ifndef INCLUDED_TASK_HELLO +#define INCLUDED_TASK_HELLO + +#ifndef INCLUDED_SCHED_TASK +# include "SchedTask.h" +#endif + + +#endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/MemList/spe/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/MemList/spe/Makefile Thu Oct 01 19:25:25 2009 +0900 @@ -0,0 +1,51 @@ +include ../Makefile.def + +TARGET = ../spe-main + +SRCS = spe-main.o +# SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) +SPEOBJS = $(SRCS:.cc=.o) +OVLOBJS = Hello.o +OLEVEL = 9 + +CC = spu-g++ +INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I.. +CFLAGS1 = $(INCLUDE) -O$(OLEVEL) -g -Wall -fno-exceptions -fno-rtti #-DDEBUG +# CFLAGS = -DNO_OVERLAY=1 $(CFLAGS1) +CFLAGS = $(CFLAGS1) + +LIBS = -L../${CERIUM}/TaskManager -lspemanager -Wl,--gc-sections +SPELIBS = -Wl,-T,$(LDSCRIPT) -Wl,-N $(LIBS) + +LDSCRIPT = ld.script +LDSCRIPT_ORIG = ../$(CERIUM)/lib/ld.script.orig +LDSCRIPT_ED = ld.script.ed +OVL_TABLE_GEN = perl ../$(CERIUM)/bin/cell_ovly_table.pl +FIX_PIC = perl ../$(CERIUM)/bin/cell_fixpic.pl + +OFFSET_H = runTask_offset.h + +all: $(TARGET) + +.SUFFIXES: .cc .o + +$(OFFSET_H) $(LDSCRIPT_ED): $(OVLOBJS:.o=.cc) + $(OVL_TABLE_GEN) $(TARGET) $(OVLOBJS:.o=.cc) + +$(SPEOBJS): %.o : %.cc $(OFFSET_H) + $(CC) $(CFLAGS) -c $< -o $@ + +$(OVLOBJS): %.o : %.cc $(OFFSET_H) + $(CC) $(CFLAGS) -c $< -S -o $(<:.cc=.s) + $(FIX_PIC) $(<:.cc=.s) | $(CC) $(SPECFLAGS) -x assembler -c -o $@ - + +$(LDSCRIPT): $(LDSCRIPT_ED) + cp $(LDSCRIPT_ORIG) $(LDSCRIPT) + ed $(LDSCRIPT) < $(LDSCRIPT_ED) > /dev/null 2>&1 + +$(TARGET): $(SPEOBJS) $(OVLOBJS) $(LDSCRIPT) + $(CC) -o $@ $(SPEOBJS) $(OVLOBJS) $(SPELIBS) + +clean: + rm -f $(TARGET) $(SPEOBJS) $(OVLOBJS) $(OFFSET_H) + rm -f *~ \#* diff -r 4fa8760e18c2 -r 44c0bce54dcf example/MemList/spe/ld.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/MemList/spe/ld.script Thu Oct 01 19:25:25 2009 +0900 @@ -0,0 +1,193 @@ +/* Default linker script, for normal executables */ +OUTPUT_FORMAT("elf32-spu", "elf32-spu", + "elf32-spu") +OUTPUT_ARCH(spu) +ENTRY(_start) +SEARCH_DIR("/usr/spu/lib"); +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__executable_start = 0); . = 0; + .interrupt : { KEEP(*(.interrupt)) } + .interp : { *(.interp) } + .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } + .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } + .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .text : + { + *(.text .stub .text.* .gnu.linkonce.t.*) + KEEP (*(.text.*personality*)) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + } =0 + .fini : + { + KEEP (*(.fini)) + } =0 + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + .eh_frame_hdr : { *(.eh_frame_hdr) } + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(0x80); + /* Exception handling */ + .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } + /* Thread Local Storage sections */ + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + } + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE_HIDDEN (__fini_array_end = .); + } + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) + /* We don't want to include the .ctor section from + the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + .jcr : { KEEP (*(.jcr)) } + .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } + .dynamic : { *(.dynamic) } + .got : { *(.got.plt) *(.got) } + .data : + { + *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(.gnu.linkonce.d.*personality*)) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + _edata = .; PROVIDE (edata = .); + __bss_start = .; + .bss : + { + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. + FIXME: Why do we need it? When there is no .bss section, we don't + pad the .data section. */ + . = ALIGN(. != 0 ? 16 : 1); + } + .toe ALIGN(128) : { *(.toe) } = 0 + . = ALIGN(16); + . = ALIGN(16); + PROVIDE (__stack = 0x3fff0); + _end = .; PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + .note.spu_name 0 : { KEEP(*(.note.spu_name)) } + /DISCARD/ : { *(.note.GNU-stack) } +} diff -r 4fa8760e18c2 -r 44c0bce54dcf example/MemList/spe/ldscript.ed diff -r 4fa8760e18c2 -r 44c0bce54dcf example/MemList/spe/spe-main.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/MemList/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -0,0 +1,14 @@ +#include "Func.h" +#include "Scheduler.h" + +SchedExternTask(Hello); + +/** + * この関数は SpeScheduler から呼ばれるので + * 必ずこの関数名でお願いします。 + */ +void +task_init(Scheduler *s) +{ + SchedRegisterTask(HELLO_TASK, Hello); +} diff -r 4fa8760e18c2 -r 44c0bce54dcf example/basic/ppe/Twice.cc --- a/example/basic/ppe/Twice.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/basic/ppe/Twice.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,16 +6,16 @@ /* これは必須 */ SchedDefineTask(Twice); -int -Twice::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s,void *rbuf, void *wbuf) { int *i_data; int *o_data; int length; - i_data = (int*)get_input(rbuf, 0); - o_data = (int*)get_output(wbuf, 0); - length = get_param(0); + i_data = (int*)s->get_input(rbuf, 0); + o_data = (int*)s->get_output(wbuf, 0); + length = s->get_param(0); for (int i = 0; i < length; i++) { o_data[i] = i_data[i] * 2; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/basic/ppe/Twice.h --- a/example/basic/ppe/Twice.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/basic/ppe/Twice.h Thu Oct 01 19:25:25 2009 +0900 @@ -4,12 +4,13 @@ #ifndef INCLUDED_SCHED_TASK # include "SchedTask.h" #endif - +/* class Twice : public SchedTask { public: SchedConstructor(Twice); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/basic/spe/Twice.cc --- a/example/basic/spe/Twice.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/basic/spe/Twice.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,16 +6,16 @@ /* これは必須 */ SchedDefineTask(Twice); -int -Twice::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { int *i_data; int *o_data; int length; - i_data = (int*)get_input(rbuf, 0); - o_data = (int*)get_output(wbuf, 0); - length = get_param(0); + i_data = (int*)s->get_input(rbuf, 0); + o_data = (int*)s->get_output(wbuf, 0); + length = s->get_param(0); for (int i = 0; i < length; i++) { o_data[i] = i_data[i] * 2; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/basic/spe/Twice.h --- a/example/basic/spe/Twice.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/basic/spe/Twice.h Thu Oct 01 19:25:25 2009 +0900 @@ -4,12 +4,13 @@ #ifndef INCLUDED_SCHED_TASK # include "SchedTask.h" #endif - +/* class Twice : public SchedTask { public: SchedConstructor(Twice); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/basic/spe/spe-main.cc --- a/example/basic/spe/spe-main.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/basic/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,7 +8,7 @@ * 必ずこの関数名でお願いします。 */ void -task_init(void) +task_init(Scheduler *s) { SchedRegisterTask(TWICE_TASK, Twice); } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/ppe/Exec.cc --- a/example/dependency_task/ppe/Exec.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/ppe/Exec.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,13 +5,13 @@ /* これは必須 */ SchedDefineTask(Exec); -int -Exec::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int *idata = (int*)get_input(rbuf, 0); - int *odata = (int*)get_output(wbuf, 0); - int length = get_param(0); - int calnum = get_param(1); + int *idata = (int*)s->get_input(rbuf, 0); + int *odata = (int*)s->get_output(wbuf, 0); + int length = s->get_param(0); + int calnum = s->get_param(1); for (int i = 0; i < length; i++) { odata[i] = idata[i] + calnum; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/ppe/Exec.h --- a/example/dependency_task/ppe/Exec.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/ppe/Exec.h Thu Oct 01 19:25:25 2009 +0900 @@ -4,12 +4,13 @@ #ifndef INCLUDED_SCHED_TASK # include "SchedTask.h" #endif - +/* class Exec : public SchedTask { public: SchedConstructor(Exec); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/ppe/Print.cc --- a/example/dependency_task/ppe/Print.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/ppe/Print.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,17 +6,17 @@ /* これは必須 */ SchedDefineTask(Print); -int -Print::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int *idata = (int*)get_input(rbuf, 0); - int length = get_param(0); + int *idata = (int*)s->get_input(rbuf, 0); + int length = s->get_param(0); - printf("[TASK_PRINT]\n"); + s->printf("[TASK_PRINT]\n"); for (int i = 0; i < length; i++) { - printf("%2d ", idata[i]); + s->printf("%2d ", idata[i]); } - printf("\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/ppe/Print.h --- a/example/dependency_task/ppe/Print.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/ppe/Print.h Thu Oct 01 19:25:25 2009 +0900 @@ -4,12 +4,13 @@ #ifndef INCLUDED_SCHED_TASK # include "SchedTask.h" #endif - +/* class Print : public SchedTask { public: SchedConstructor(Print); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/ppe/RunFinish.cc --- a/example/dependency_task/ppe/RunFinish.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/ppe/RunFinish.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,8 +3,8 @@ /* これは必須 */ SchedDefineTask(RunFinish); -int -RunFinish::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/ppe/RunFinish.h --- a/example/dependency_task/ppe/RunFinish.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/ppe/RunFinish.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,13 @@ # include "SchedTask.h" #endif +/* class RunFinish : public SchedTask { public: SchedConstructor(RunFinish); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/spe/Exec.cc --- a/example/dependency_task/spe/Exec.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/spe/Exec.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,13 +5,13 @@ /* これは必須 */ SchedDefineTask(Exec); -int -Exec::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int *idata = (int*)get_input(rbuf, 0); - int *odata = (int*)get_output(wbuf, 0); - int length = get_param(0); - int calnum = get_param(1); + int *idata = (int*)s->get_input(rbuf, 0); + int *odata = (int*)s->get_output(wbuf, 0); + int length = s->get_param(0); + int calnum = s->get_param(1); for (int i = 0; i < length; i++) { odata[i] = idata[i] + calnum; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/spe/Exec.h --- a/example/dependency_task/spe/Exec.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/spe/Exec.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,13 @@ # include "SchedTask.h" #endif +/* class Exec : public SchedTask { public: SchedConstructor(Exec); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/spe/Print.cc --- a/example/dependency_task/spe/Print.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/spe/Print.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,17 +6,17 @@ /* これは必須 */ SchedDefineTask(Print); -int -Print::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int *idata = (int*)get_input(rbuf, 0); - int length = get_param(0); + int *idata = (int*)s->get_input(rbuf, 0); + int length = s->get_param(0); - printf("[TASK_PRINT]\n"); + s->printf("[TASK_PRINT]\n"); for (int i = 0; i < length; i++) { - printf("%2d ", idata[i]); + s->printf("%2d ", idata[i]); } - printf("\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/spe/Print.h --- a/example/dependency_task/spe/Print.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/spe/Print.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,13 @@ # include "SchedTask.h" #endif +/* class Print : public SchedTask { public: SchedConstructor(Print); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/dependency_task/spe/spe-main.cc --- a/example/dependency_task/spe/spe-main.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/dependency_task/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -9,7 +9,7 @@ * 必ずこの関数名でお願いします。 */ void -task_init(void) +task_init(Scheduler *s) { SchedRegisterTask(TASK_PRINT, Print); SchedRegisterTask(TASK_EXEC, Exec); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/get_segment/spe/Hello.cc --- a/example/get_segment/spe/Hello.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/get_segment/spe/Hello.cc Thu Oct 01 19:25:25 2009 +0900 @@ -11,7 +11,10 @@ int task_id = smanager->get_param(0); unsigned int pc; - __asm__ __volatile__("ai %0,$0,0 ### here" : "=r" (pc)); + __asm__ __volatile__( +" brsl %0,____LLLL\n" +"____LLLL:" + : "=r" (pc)); smanager->fprintf(smanager->stderr_,"[%d] Hello, World!! Seg1 \n", task_id); smanager->fprintf(smanager->stderr_,"pc=0x%0x 0x%0x\n",pc, (unsigned int)&runTask_Hello); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/get_segment/spe/Hello1.cc --- a/example/get_segment/spe/Hello1.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/get_segment/spe/Hello1.cc Thu Oct 01 19:25:25 2009 +0900 @@ -10,8 +10,10 @@ int task_id = smanager->get_param(0); unsigned int pc; - __asm__ __volatile__("ai %0,$0,0 ### here" : "=r" (pc)); - + __asm__ __volatile__( +" brsl %0,____LLLL\n" +"____LLLL:" + : "=r" (pc)); smanager->fprintf(smanager->stderr_,"[%d] Hello, World Seg 2!!\n", task_id); smanager->fprintf(smanager->stderr_,"pc=0x%0x 0x%0x\n",pc, (unsigned int)&runTask_Hello1); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/mainMem/ppe/Hello.cc --- a/example/mainMem/ppe/Hello.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/mainMem/ppe/Hello.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,10 +8,10 @@ #define PP_STORE 3 #define SIZE (4096*sizeof(int)) -int -Hello::run(void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { - int task_id = get_param(0); + int task_id = smanager->get_param(0); int *ptr = 0; #if 1 ptr = (int*)smanager->allocate(SIZE); @@ -35,8 +35,8 @@ #endif - fprintf(stderr,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); - fprintf(stderr,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); + smanager->fprintf(smanager->stderr_,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); + smanager->fprintf(smanager->stderr_,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/mainMem/ppe/Hello.h --- a/example/mainMem/ppe/Hello.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/mainMem/ppe/Hello.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,13 @@ # include "SchedTask.h" #endif +/* class Hello : public SchedTask { public: SchedConstructor(Hello); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/mainMem/spe/Hello.cc --- a/example/mainMem/spe/Hello.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/mainMem/spe/Hello.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,10 +8,10 @@ #define PP_STORE 3 #define SIZE (4096*sizeof(int)) -int -Hello::run(void *rbuf, void *wbuf) +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) { - int task_id = get_param(0); + int task_id = smanager->get_param(0); int *ptr = 0; #if 1 ptr = (int*)smanager->allocate(SIZE); @@ -35,9 +35,9 @@ #endif - fprintf(stderr,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); - fprintf(stderr,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); + smanager->fprintf(smanager->stderr_,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); + smanager->fprintf(smanager->stderr_,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); - free(ptr); + smanager->free_(ptr); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/mainMem/spe/Hello.h --- a/example/mainMem/spe/Hello.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/mainMem/spe/Hello.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,13 @@ # include "SchedTask.h" #endif +/* class Hello : public SchedTask { public: SchedConstructor(Hello); int run(void *r, void *w); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/mainMem/spe/spe-main.cc --- a/example/mainMem/spe/spe-main.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/mainMem/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,7 +8,7 @@ * 必ずこの関数名でお願いします。 */ void -task_init(void) +task_init(Scheduler *s) { SchedRegisterTask(HELLO_TASK, Hello); } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/many_task/ppe/QuickSort.cc --- a/example/many_task/ppe/QuickSort.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/many_task/ppe/QuickSort.cc Thu Oct 01 19:25:25 2009 +0900 @@ -4,14 +4,17 @@ SchedDefineTask(QuickSort); -int -QuickSort::run(void* rbuff, void* wbuff) { +static void quick_sort( Data *data, int begin, int end ) ; +static void swap( Data *data, int left, int right ); + +static int +run(SchedTask *s, void* rbuff, void* wbuff) { // copy value int begin = 0; - int end = get_param(0); + int end = s->get_param(0); - Data *r_data = (Data*)get_input(rbuff, 0); - Data *w_data = (Data*)get_output(wbuff, 0); + Data *r_data = (Data*)s->get_input(rbuff, 0); + Data *w_data = (Data*)s->get_output(wbuff, 0); //printf("[PPE] Quick: length:%d addr->%x \n",end, (int*)rbuff); //printf("[PPE] Quick: data[0]: %d addr->%x\n",sizeof(r_data),r_data); @@ -23,8 +26,8 @@ return 0; } -void -QuickSort::quick_sort( Data *data, int begin, int end ) { +static void +quick_sort( Data *data, int begin, int end ) { if (begin < end) { int where = (begin + end) / 2; @@ -46,8 +49,8 @@ } } -void -QuickSort::swap( Data *data, int left, int right ) +static void +swap( Data *data, int left, int right ) { int tmp = data[left].index; data[left].index = data[right].index; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/many_task/ppe/QuickSort.h --- a/example/many_task/ppe/QuickSort.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/many_task/ppe/QuickSort.h Thu Oct 01 19:25:25 2009 +0900 @@ -7,13 +7,5 @@ #include "sort.h" -class QuickSort : public SchedTask { -public: - SchedConstructor(QuickSort); - - int run(void *r, void *w); - void quick_sort(Data *data, int left, int right); - void swap(Data *data, int left, int right ); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/many_task/spe/QuickSort.cc --- a/example/many_task/spe/QuickSort.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/many_task/spe/QuickSort.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,8 +5,13 @@ SchedDefineTask(QuickSort); -int -QuickSort::run(SchedTask *smanager, void* rbuff, void* wbuff) { +static void bubble_sort(DataPtr data, int begin, int end); +static void quick_sort(DataPtr data, int begin, int end); + +static void swap(Data *data, int left, int right); + +static int +run(SchedTask *smanager, void* rbuff, void* wbuff) { int begin = 0; int end = smanager->get_param(0); DataPtr r_data = (DataPtr)smanager->get_input(0); @@ -14,8 +19,10 @@ //SpeProfile *prof = new SpeProfile; //prof->ProfStart(); - quick_sort(r_data, begin, end-1); - //bubble_sort(r_data, begin, end-1); + if (0) + bubble_sort(r_data, begin, end-1); + else + quick_sort(r_data, begin, end-1); memcpy(w_data, r_data, sizeof(Data)*end); //prof->ProfStop(); //prof->ProfPrint(); @@ -24,8 +31,8 @@ return 0; } -void -QuickSort::bubble_sort(DataPtr data, int begin, int end) +static void +bubble_sort(DataPtr data, int begin, int end) { for (int i = 0; i < end; i++) { for (int j = end; j > i; j--) { @@ -36,8 +43,9 @@ } } -void -QuickSort::quick_sort(DataPtr data, int begin, int end) + +static void +quick_sort(DataPtr data, int begin, int end) { if (begin < end) { @@ -61,10 +69,13 @@ } } -void -QuickSort::swap(Data *data, int left, int right) + +static void +swap(Data *data, int left, int right) { int tmp = data[left].index; data[left].index = data[right].index; data[right].index = tmp; } + +/* end */ diff -r 4fa8760e18c2 -r 44c0bce54dcf example/many_task/spe/QuickSort.h --- a/example/many_task/spe/QuickSort.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/many_task/spe/QuickSort.h Thu Oct 01 19:25:25 2009 +0900 @@ -6,7 +6,7 @@ #endif #include "sort.h" - +/* class QuickSort : public SchedTask { public: SchedConstructor(QuickSort); @@ -16,5 +16,6 @@ void bubble_sort(Data *data, int left, int right); void swap(Data *data, int left, int right ); }; + */ #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/many_task/spe/spe-main.cc --- a/example/many_task/spe/spe-main.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/many_task/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -14,7 +14,7 @@ } void -task_init(void) +task_init(Scheduler *s) { spe_debug(); SchedRegisterTask(QUICK_SORT, QuickSort); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/post_function/ppe/Hello.cc --- a/example/post_function/ppe/Hello.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/post_function/ppe/Hello.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,12 +6,12 @@ /* これは必須 */ SchedDefineTask(Hello); -int -Hello::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int id = get_param(0); + int id = s->get_param(0); - printf("Hello, World!! post_func output %d\n", id); + s->printf("Hello, World!! post_func output %d\n", id); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/post_function/ppe/Hello.h --- a/example/post_function/ppe/Hello.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/post_function/ppe/Hello.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Hello : public SchedTask { -public: - SchedConstructor(Hello); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/post_function/spe/Hello.cc --- a/example/post_function/spe/Hello.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/post_function/spe/Hello.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,10 +6,10 @@ /* これは必須 */ SchedDefineTask(Hello); -int -Hello::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int id = get_param(0); + int id = s->get_param(0); printf("Hello, World!! post_func output %d\n", id); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/post_function/spe/Hello.h --- a/example/post_function/spe/Hello.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/post_function/spe/Hello.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Hello : public SchedTask { -public: - SchedConstructor(Hello); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/post_function/spe/spe-main.cc --- a/example/post_function/spe/spe-main.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/post_function/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -8,7 +8,7 @@ * 必ずこの関数名でお願いします。 */ void -task_init(void) +task_init(Scheduler *s) { SchedRegisterTask(HELLO_TASK, Hello); } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/Renew1.cc --- a/example/renew_task/ppe/Renew1.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/Renew1.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,17 +5,17 @@ /* これは必須 */ SchedDefineTask(Renew1); -int -Renew1::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - printf("[PPE] ** running Renew1\n"); + s->printf("[PPE] ** running Renew1\n"); - printf("[PPE] Create Task : Renew2\n"); - TaskPtr nextTask = create_task(RENEW2); - wait_task(nextTask); + s->printf("[PPE] Create Task : Renew2\n"); + TaskPtr nextTask = s->create_task(RENEW2); + s->wait_task(nextTask); - printf("[PPE] ** finish Renew1\n"); - printf("\n"); + s->printf("[PPE] ** finish Renew1\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/Renew1.h --- a/example/renew_task/ppe/Renew1.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/Renew1.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Renew1 : public SchedTask { -public: - SchedConstructor(Renew1); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/Renew2.cc --- a/example/renew_task/ppe/Renew2.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/Renew2.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,17 +5,17 @@ /* これは必須 */ SchedDefineTask(Renew2); -int -Renew2::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - printf("[PPE] ** running Renew2\n"); + s->printf("[PPE] ** running Renew2\n"); - printf("[PPE] Create Task : Renew3\n"); - TaskPtr nextTask = create_task(RENEW3); - wait_task(nextTask); + s->printf("[PPE] Create Task : Renew3\n"); + TaskPtr nextTask = s->create_task(RENEW3); + s->wait_task(nextTask); - printf("[PPE] ** finish Renew2\n"); - printf("\n"); + s->printf("[PPE] ** finish Renew2\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/Renew2.h --- a/example/renew_task/ppe/Renew2.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/Renew2.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Renew2 : public SchedTask { -public: - SchedConstructor(Renew2); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/Renew3.cc --- a/example/renew_task/ppe/Renew3.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/Renew3.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,17 +5,17 @@ /* これは必須 */ SchedDefineTask(Renew3); -int -Renew3::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - printf("[PPE] ** running Renew3\n"); + s->printf("[PPE] ** running Renew3\n"); - printf("[PPE] Create Task : Renew4\n"); - TaskPtr nextTask = create_task(RENEW4); - wait_task(nextTask); + s->printf("[PPE] Create Task : Renew4\n"); + TaskPtr nextTask = s->create_task(RENEW4); + s->wait_task(nextTask); - printf("[PPE] ** finish Renew3\n"); - printf("\n"); + s->printf("[PPE] ** finish Renew3\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/Renew3.h --- a/example/renew_task/ppe/Renew3.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/Renew3.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Renew3 : public SchedTask { -public: - SchedConstructor(Renew3); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/Renew4.cc --- a/example/renew_task/ppe/Renew4.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/Renew4.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,12 +5,12 @@ /* これは必須 */ SchedDefineTask(Renew4); -int -Renew4::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - printf("[PPE] ** running Renew4\n"); + s->printf("[PPE] ** running Renew4\n"); - printf("[PPE] ** finish Renew4\n"); + s->printf("[PPE] ** finish Renew4\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/Renew4.h --- a/example/renew_task/ppe/Renew4.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/Renew4.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Renew4 : public SchedTask { -public: - SchedConstructor(Renew4); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/RenewStart.cc --- a/example/renew_task/ppe/RenewStart.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/RenewStart.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,17 +5,17 @@ /* これは必須 */ SchedDefineTask(RenewStart); -int -RenewStart::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - printf("[PPE] ** running RenewStart\n"); + s->printf("[PPE] ** running RenewStart\n"); - printf("[PPE] Create Task : Renew1\n"); - TaskPtr nextTask = create_task(RENEW1); - wait_task(nextTask); + s->printf("[PPE] Create Task : Renew1\n"); + TaskPtr nextTask = s->create_task(RENEW1); + s->wait_task(nextTask); - printf("[PPE] ** finish RenewStart\n"); - printf("\n"); + s->printf("[PPE] ** finish RenewStart\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/ppe/RenewStart.h --- a/example/renew_task/ppe/RenewStart.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/ppe/RenewStart.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class RenewStart : public SchedTask { -public: - SchedConstructor(RenewStart); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/Renew1.cc --- a/example/renew_task/spe/Renew1.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/Renew1.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,20 +6,20 @@ /* これは必須 */ SchedDefineTask(Renew1); -int -Renew1::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - SpeProfile *profile = (SpeProfile*)global_get(0); + SpeProfile *profile = (SpeProfile*)s->global_get(0); profile->ProfStop(); profile->ProfPrint(); - printf("[SPE] ** running Renew1\n"); + s->printf("[SPE] ** running Renew1\n"); - printf("[SPE] Create Task : Renew2\n"); - TaskPtr nextTask = create_task(RENEW2); - wait_task(nextTask); + s->printf("[SPE] Create Task : Renew2\n"); + TaskPtr nextTask = s->create_task(RENEW2); + s->wait_task(nextTask); - printf("[SPE] ** finish Renew1\n\n"); + s->printf("[SPE] ** finish Renew1\n\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/Renew1.h --- a/example/renew_task/spe/Renew1.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/Renew1.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Renew1 : public SchedTask { -public: - SchedConstructor(Renew1); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/Renew2.cc --- a/example/renew_task/spe/Renew2.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/Renew2.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,20 +6,20 @@ /* これは必須 */ SchedDefineTask(Renew2); -int -Renew2::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - SpeProfile *profile = (SpeProfile*) global_get(0); + SpeProfile *profile = (SpeProfile*) s->global_get(0); profile->ProfStop(); profile->ProfPrint(); - printf("[SPE] ** running Renew2\n"); + s->printf("[SPE] ** running Renew2\n"); - printf("[SPE] Create Task : Renew3\n"); - TaskPtr nextTask = create_task(RENEW3); - wait_task(nextTask); + s->printf("[SPE] Create Task : Renew3\n"); + TaskPtr nextTask = s->create_task(RENEW3); + s->wait_task(nextTask); - printf("[SPE] ** finish Renew2\n\n"); + s->printf("[SPE] ** finish Renew2\n\n"); profile->ProfStart(); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/Renew2.h --- a/example/renew_task/spe/Renew2.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/Renew2.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Renew2 : public SchedTask { -public: - SchedConstructor(Renew2); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/Renew3.cc --- a/example/renew_task/spe/Renew3.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/Renew3.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,21 +6,21 @@ /* これは必須 */ SchedDefineTask(Renew3); -int -Renew3::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - SpeProfile *profile = (SpeProfile*) global_get(0); + SpeProfile *profile = (SpeProfile*) s->global_get(0); profile->ProfStop(); profile->ProfPrint(); - printf("[SPE] ** running Renew3\n"); + s->printf("[SPE] ** running Renew3\n"); - printf("[SPE] Create Task : Renew4\n"); - TaskPtr nextTask = create_task(RENEW4); - wait_task(nextTask); + s->printf("[SPE] Create Task : Renew4\n"); + TaskPtr nextTask = s->create_task(RENEW4); + s->wait_task(nextTask); - printf("[SPE] ** finish Renew3\n"); - printf("\n"); + s->printf("[SPE] ** finish Renew3\n"); + s->printf("\n"); profile->ProfStart(); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/Renew3.h --- a/example/renew_task/spe/Renew3.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/Renew3.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Renew3 : public SchedTask { -public: - SchedConstructor(Renew3); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/Renew4.cc --- a/example/renew_task/spe/Renew4.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/Renew4.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,18 +6,18 @@ /* これは必須 */ SchedDefineTask(Renew4); -int -Renew4::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - SpeProfile *profile = (SpeProfile*) global_get(0); + SpeProfile *profile = (SpeProfile*) s->global_get(0); profile->ProfStop(); profile->ProfPrint(); - printf("[SPE] ** running Renew4\n"); + s->printf("[SPE] ** running Renew4\n"); - printf("[SPE] ** finish Renew4\n"); + s->printf("[SPE] ** finish Renew4\n"); - global_free(0); + s->global_free(0); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/Renew4.h --- a/example/renew_task/spe/Renew4.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/Renew4.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Renew4 : public SchedTask { -public: - SchedConstructor(Renew4); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/RenewStart.cc --- a/example/renew_task/spe/RenewStart.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/RenewStart.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,19 +6,20 @@ /* これは必須 */ SchedDefineTask(RenewStart); -int -RenewStart::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - printf("[SPE] ** running RenewStart\n"); + s->printf("[SPE] ** running RenewStart\n"); - void *tmp = global_alloc(sizeof(SpeProfile), 0); + void *tmp = s->global_alloc(sizeof(SpeProfile), 0); + // overlay で動くの? SpeProfile *profile = new (tmp) SpeProfile; - printf("[SPE] Create Task : Renew1\n"); - TaskPtr nextTask = create_task(RENEW1); - wait_task(nextTask); + s->printf("[SPE] Create Task : Renew1\n"); + TaskPtr nextTask = s->create_task(RENEW1); + s->wait_task(nextTask); - printf("[SPE] ** finish RenewStart\n\n"); + s->printf("[SPE] ** finish RenewStart\n\n"); profile->ProfStart(); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/RenewStart.h --- a/example/renew_task/spe/RenewStart.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/RenewStart.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class RenewStart : public SchedTask { -public: - SchedConstructor(RenewStart); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/renew_task/spe/spe-main.cc --- a/example/renew_task/spe/spe-main.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/renew_task/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -12,7 +12,7 @@ * 必ずこの関数名でお願いします。 */ void -task_init(void) +task_init(Scheduler *s) { SchedRegisterTask(RENEW_START, RenewStart); SchedRegisterTask(RENEW1, Renew1); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/ppe/Exec.cc --- a/example/share_task/ppe/Exec.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/ppe/Exec.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,20 +5,20 @@ /* これは必須 */ SchedDefineTask(Exec); -int -Exec::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int *idata = (int*)global_get(DATA_ID); - int length = get_param(0); - int number = get_param(1); - int calnum = get_param(2); + int *idata = (int*)s->global_get(DATA_ID); + int length = s->get_param(0); + int number = s->get_param(1); + int calnum = s->get_param(2); - printf("[TASK_EXEC %02d] ", number); + s->printf("[TASK_EXEC %02d] ", number); for (int i = 0; i < length; i++) { idata[i] += calnum; - printf("%03d ", idata[i]); + s->printf("%03d ", idata[i]); } - printf("\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/ppe/Exec.h --- a/example/share_task/ppe/Exec.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/ppe/Exec.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Exec : public SchedTask { -public: - SchedConstructor(Exec); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/ppe/Load.cc --- a/example/share_task/ppe/Load.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/ppe/Load.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,22 +6,22 @@ /* これは必須 */ SchedDefineTask(Load); -int -Load::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int *idata = (int*)get_input(rbuf, 0); - int *odata = (int*)global_get(DATA_ID); - int length = get_param(0); + int *idata = (int*)s->get_input(rbuf, 0); + int *odata = (int*)s->global_get(DATA_ID); + int length = s->get_param(0); // SPU LS 内に領域確保し、データをコピー - odata = (int*)global_alloc(DATA_ID, sizeof(int)*length); + odata = (int*)s->global_alloc(DATA_ID, sizeof(int)*length); memcpy(odata, idata, sizeof(int)*length); - printf("[TASK_LOAD] "); + s->printf("[TASK_LOAD] "); for (int i = 0; i < length; i++) { - printf("%03d ", idata[i]); + s->printf("%03d ", idata[i]); } - printf("\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/ppe/Load.h --- a/example/share_task/ppe/Load.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/ppe/Load.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Load : public SchedTask { -public: - SchedConstructor(Load); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/ppe/RunFinish.cc --- a/example/share_task/ppe/RunFinish.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/ppe/RunFinish.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,8 +3,8 @@ /* これは必須 */ SchedDefineTask(RunFinish); -int -RunFinish::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/ppe/RunFinish.h --- a/example/share_task/ppe/RunFinish.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/ppe/RunFinish.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class RunFinish : public SchedTask { -public: - SchedConstructor(RunFinish); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/spe/Exec.cc --- a/example/share_task/spe/Exec.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/spe/Exec.cc Thu Oct 01 19:25:25 2009 +0900 @@ -5,20 +5,20 @@ /* これは必須 */ SchedDefineTask(Exec); -int -Exec::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int *idata = (int*)global_get(DATA_ID); - int length = get_param(0); - int number = get_param(1); - int calnum = get_param(2); + int *idata = (int*)s->global_get(DATA_ID); + int length = s->get_param(0); + int number = s->get_param(1); + int calnum = s->get_param(2); - printf("[TASK_EXEC %02d] ", number); + s->printf("[TASK_EXEC %02d] ", number); for (int i = 0; i < length; i++) { idata[i] += calnum; - printf("%03d ", idata[i]); + s->printf("%03d ", idata[i]); } - printf("\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/spe/Exec.h --- a/example/share_task/spe/Exec.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/spe/Exec.h Thu Oct 01 19:25:25 2009 +0900 @@ -6,11 +6,5 @@ #endif -class Exec : public SchedTask { -public: - SchedConstructor(Exec); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/spe/Load.cc --- a/example/share_task/spe/Load.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/spe/Load.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,22 +6,22 @@ /* これは必須 */ SchedDefineTask(Load); -int -Load::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - int *idata = (int*)get_input(rbuf, 0); + int *idata = (int*)s->get_input(rbuf, 0); int *odata; - int length = get_param(0); + int length = s->get_param(0); // SPU LS 内に領域確保し、データをコピー - odata = (int*)global_alloc(DATA_ID, sizeof(int)*length); + odata = (int*)s->global_alloc(DATA_ID, sizeof(int)*length); memcpy(odata, idata, sizeof(int)*length); - printf("[TASK_LOAD] "); + s->printf("[TASK_LOAD] "); for (int i = 0; i < length; i++) { - printf("%03d ", odata[i]); + s->printf("%03d ", odata[i]); } - printf("\n"); + s->printf("\n"); return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/spe/Load.h --- a/example/share_task/spe/Load.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/spe/Load.h Thu Oct 01 19:25:25 2009 +0900 @@ -6,11 +6,5 @@ #endif -class Load : public SchedTask { -public: - SchedConstructor(Load); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/share_task/spe/spe-main.cc --- a/example/share_task/spe/spe-main.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/share_task/spe/spe-main.cc Thu Oct 01 19:25:25 2009 +0900 @@ -9,7 +9,7 @@ * 必ずこの関数名でお願いします。 */ void -task_init(void) +task_init(Scheduler *s) { SchedRegisterTask(TASK_LOAD, Load); SchedRegisterTask(TASK_EXEC, Exec); diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/ppe/Exec.cc --- a/example/word_count/ppe/Exec.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/ppe/Exec.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,13 +6,13 @@ /* これは必須 */ SchedDefineTask(Exec); -int -Exec::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - char *i_data = (char*)get_input(rbuf, 0); - unsigned long long *o_data = (unsigned long long*)get_output(wbuf, 0); - int length = get_param(0); - int word_flag = get_param(1); + char *i_data = (char*)s->get_input(rbuf, 0); + unsigned long long *o_data = (unsigned long long*)s->get_output(wbuf, 0); + int length = s->get_param(0); + int word_flag = s->get_param(1); int word_num = 0; int line_num = 0; int i; @@ -20,10 +20,10 @@ /*先頭の文字まで、飛ぶルーチン*/ for(i = 0; i < length; i++) { if ((i_data[i] != 0x20) && (i_data[i] != 0x0A)) { - //printf("[SPE%d] break[%d] %d\n",id,i,i_data[i]); + //s->printf("[SPE%d] break[%d] %d\n",id,i,i_data[i]); break; } - //printf("[SPE%d]%c",id,i_data[start_num]); + //s->printf("[SPE%d]%c",id,i_data[start_num]); word_num += word_flag; word_flag = 0; line_num += (i_data[i] == 0x0A); @@ -33,10 +33,10 @@ for (; i < length; i++) { - //printf("[SPE%d]%c",id,i_data[i]); + //s->printf("[SPE%d]%c",id,i_data[i]); if((i_data[i] != 0x20) && (i_data[i] != 0x0A)) { - //printf("文字 数 = %d\n", word_num + word_flag); + //s->printf("文字 数 = %d\n", word_num + word_flag); word_num += word_flag; word_flag = 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/ppe/Exec.h --- a/example/word_count/ppe/Exec.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/ppe/Exec.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Exec : public SchedTask { -public: - SchedConstructor(Exec); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/ppe/Print.cc --- a/example/word_count/ppe/Print.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/ppe/Print.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,15 +6,15 @@ /* これは必須 */ SchedDefineTask(Print); -int -Print::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - unsigned long long *idata = (unsigned long long*)get_input(rbuf, 0); - int task_num = get_param(0); - int status_num = get_param(1); + unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); + int task_num = s->get_param(0); + int status_num = s->get_param(1); unsigned long long word_data[task_num]; - printf("start sum\n"); + s->printf("start sum\n"); for (int i = 0; i < status_num; i++) { word_data[i] = 0; @@ -27,10 +27,10 @@ } for (int i = 0; i < status_num; i++) { - printf("%llu ",word_data[i]); + s->printf("%llu ",word_data[i]); } - printf("\n"); + s->printf("\n"); return 0; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/ppe/Print.h --- a/example/word_count/ppe/Print.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/ppe/Print.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Print : public SchedTask { -public: - SchedConstructor(Print); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/ppe/RunFinish.cc --- a/example/word_count/ppe/RunFinish.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/ppe/RunFinish.cc Thu Oct 01 19:25:25 2009 +0900 @@ -3,8 +3,8 @@ /* これは必須 */ SchedDefineTask(RunFinish); -int -RunFinish::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { return 0; } diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/ppe/RunFinish.h --- a/example/word_count/ppe/RunFinish.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/ppe/RunFinish.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class RunFinish : public SchedTask { -public: - SchedConstructor(RunFinish); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/spe/Exec.cc --- a/example/word_count/spe/Exec.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/spe/Exec.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,13 +6,13 @@ /* これは必須 */ SchedDefineTask(Exec); -int -Exec::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - char *i_data = (char*)get_input(rbuf, 0); - unsigned long long *o_data = (unsigned long long*)get_output(wbuf, 0); - int length = get_param(0); - int word_flag = get_param(1); + char *i_data = (char*)s->get_input(rbuf, 0); + unsigned long long *o_data = (unsigned long long*)s->get_output(wbuf, 0); + int length = s->get_param(0); + int word_flag = s->get_param(1); int word_num = 0; int line_num = 0; int i; @@ -20,10 +20,10 @@ /*先頭の文字まで、飛ぶルーチン*/ for(i = 0; i < length; i++) { if ((i_data[i] != 0x20) && (i_data[i] != 0x0A)) { - //printf("[SPE%d] break[%d] %d\n",id,i,i_data[i]); + //s->printf("[SPE%d] break[%d] %d\n",id,i,i_data[i]); break; } - //printf("[SPE%d]%c",id,i_data[start_num]); + //s->printf("[SPE%d]%c",id,i_data[start_num]); word_num += word_flag; word_flag = 0; line_num += (i_data[i] == 0x0A); @@ -33,16 +33,16 @@ for (; i < length; i++) { - //printf("[SPE%d]%c",id,i_data[i]); + //s->printf("[SPE%d]%c",id,i_data[i]); if (i_data[i] == 0x20) { - //printf("スペース\n"); + //s->printf("スペース\n"); word_flag = 1; } else if (i_data[i] == 0x0A) { - //printf("改行\n"); + //s->printf("改行\n"); line_num += 1; word_flag = 1; } @@ -56,7 +56,7 @@ word_num += word_flag; - //printf("%d %d\n",word_num,line_num); + //s->printf("%d %d\n",word_num,line_num); o_data[0] = (unsigned long long)word_num; o_data[1] = (unsigned long long)line_num; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/spe/Exec.h --- a/example/word_count/spe/Exec.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/spe/Exec.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Exec : public SchedTask { -public: - SchedConstructor(Exec); - - int run(void *r, void *w); -}; #endif diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/spe/Print.cc --- a/example/word_count/spe/Print.cc Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/spe/Print.cc Thu Oct 01 19:25:25 2009 +0900 @@ -6,12 +6,12 @@ /* これは必須 */ SchedDefineTask(Print); -int -Print::run(void *rbuf, void *wbuf) +static int +run(SchedTask *s, void *rbuf, void *wbuf) { - unsigned long long *idata = (unsigned long long*)get_input(rbuf, 0); - int task_num = get_param(0); - int status_num = get_param(1); + unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); + int task_num = s->get_param(0); + int status_num = s->get_param(1); unsigned long long word_data[task_num]; for (int i = 0; i < status_num; i++) { @@ -25,10 +25,10 @@ } for (int i = 0; i < status_num; i++) { - printf("%llu ",word_data[i]); + s->printf("%llu ",word_data[i]); } - printf("\n"); + s->printf("\n"); return 0; diff -r 4fa8760e18c2 -r 44c0bce54dcf example/word_count/spe/Print.h --- a/example/word_count/spe/Print.h Thu Oct 01 17:33:58 2009 +0900 +++ b/example/word_count/spe/Print.h Thu Oct 01 19:25:25 2009 +0900 @@ -5,11 +5,5 @@ # include "SchedTask.h" #endif -class Print : public SchedTask { -public: - SchedConstructor(Print); - - int run(void *r, void *w); -}; #endif