Mercurial > hg > Game > Cerium
changeset 110:b69d50fefbdb draft
remove unecessary files
author | gongo@gendarme.local |
---|---|
date | Wed, 12 Nov 2008 17:51:04 +0900 |
parents | 028ffc9c0375 |
children | ab70b06db455 |
files | TaskManager/Test/simple_render/span.cpp TaskManager/Test/simple_render/span_pack.h TaskManager/Test/simple_render/spu_span.h TaskManager/kernel/schedule/FifoDmaManager.cc TaskManager/kernel/schedule/MainScheduler.cc include/TaskManager/SpeExit.h include/TaskManager/SpeMail.h include/TaskManager/SpeManager.h include/TaskManager/SpeNop.h include/TaskManager/SpeNop2Ready.h include/TaskManager/SpeTask.h include/TaskManager/SpeTaskList.h include/TaskManager/Sum.h include/TaskManager/dma_spe.h include/TaskManager/memorypool.h include/TaskManager/ppe_spe.h include/TaskManager/spe_taskinfo.h |
diffstat | 17 files changed, 0 insertions(+), 935 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Test/simple_render/span.cpp Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,398 +0,0 @@ -#include <iostream> -#include "span.h" -#include "triangle.h" -#include "polygon.h" -using namespace std; - - -// f1:x$B$NA}2CNL(B f2:y$B$NA}2CNL(B i:....... base:$B4pK\$H$J$kD:E@$N(By$B:BI8(B -static float calc(float f1, float f2,int i, float base){ - float ans; - ans = f1/f2*i + base; - return ans; -} - - -static Vertex *vMid1(Vertex *vMid1,Vertex *vMin, Vertex *vMid, Vertex *vMax) { - float d,d1; - - vMid1->y = vMid->y; - //vMid1->tex_y = vMid->tex_y; - d = (int)vMax->y-(int)vMin->y; - d1 = (int)vMid->y - (int)vMin->y; - /* - - if (-1.0<=vMax->y&&vMax->y<=1.0) { - a = 0.5; - } else { - a = (vMax->x-vMin->x)/d; - } - */ - //vMid1->tex_x = vMin->tex_x + a * (vMax->tex_x-vMin->tex_x); - vMid1->tex_x = calc(vMax->tex_x - vMin->tex_x, d, (int)d1 , vMin->tex_x); - vMid1->tex_y = calc(vMax->tex_y - vMin->tex_y, d, (int)d1 , vMin->tex_y); - //vMid1->x = vMin->x + a * (vMax->y -vMin->y); - vMid1->x = calc(vMax->x - vMin->x, d, (int)d1 , vMin->x); - //vMid1->z = vMin->z + a * (vMax->y -vMin->y); - vMid1->z = calc(vMax->z - vMin->z, d, (int)d1 , vMin->z); - //printf("x:%f y:%f z:%f tex_x:%f tex_y:%f\n",vMid1->x,vMid1->y,vMid1->z,vMid1->tex_x, vMid1->tex_y); - return vMid1; -} - - - -void -Span_c::half_triangle(Vertex *vMin, Vertex *vMid, Vertex *vMid1, - SDL_Surface *image) -{ - - float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2; - //tmp_x,tmp_y,tmp_ypos ......unused - float tex_x, tex_y,tex_z; - float tmp_xpos,tmp_end,tmp_zpos; - int tex_xpos,tex_ypos,tex_zpos; - int i,j; - float div_y; - Uint32 rgb; - float z,zpos; - int x,y; - int k =0; - int l = 1; - //float incli_x1, incli_x2; - //float incli_z1, incli_z2; - //float base_x1, base_x2 , base_z1, base_z2; - //int base_y; - - /* - incli_x1 = vMid1->x - vMin->x; - incli_x2 = vMid->x - vMin->x; - incli_z1 = vMid1->z - vMin->z; - incli_z2 = vMid->z - vMin->z; - base_x1 = vMin->x; - base_x2 = vMin->x; - base_z1 = vMin->z; - base_z2 = vMin->z; - */ - //cout << vMin->x << vMin->y << vMin->z << endl; - int start_y = (int)vMid->y; - int end_y = (int)vMin->y; - - if (start_y<end_y) { - int i; i=end_y; end_y=start_y; start_y = i; //y$B$NF~$lBX$((B - //Vertex *v; v = vMin; vMin = vMid; vMid = v; - /* - incli_x1 = vMin->x - vMid->x; incli_x2 = vMin->x - vMid1->x; - incli_z1 = vMin->z - vMid->z; incli_z2 = vMin->z - vMid1->z; - base_z1 = vMid->z; base_z2 = vMid1->z; - base_y = (int)vMid->y; - */ - k = 1; - l = -1; - } - - - - div_y = start_y - end_y; // > 0 - - //if(div_y < 1 && div_y > -1) div_y = 1; - for(i = k; i < div_y+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B - tmp_xpos = calc(vMid1->x - vMin->x ,div_y, i, vMin->x); - tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x); - tmp_z = calc(vMid1->z - vMin->z ,div_y, i, vMin->z); - tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z); - //printf("x:%f end:%f z:%f zpos:%f\n",tmp_xpos,tmp_end,tmp_z,tmp_zpos); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B - tmp_tex1 =((i/(div_y)) * vMid1->tex_x) + \ - ( ((div_y - i)/(div_y)) * vMin->tex_x); - tmp_tex2 =( (i/(div_y)) * vMid->tex_x) + \ - ( ((div_y - i)/(div_y)) * vMin->tex_x); - - tmp_tey1 =( (i/(div_y)) * vMid1->tex_y) + \ - ( ((div_y - i)/(div_y)) * vMin->tex_y); - tmp_tey2 =( (i/(div_y)) * vMid->tex_y) + \ - ( ((div_y - i)/(div_y)) * vMin->tex_y); - - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B - if(tmp_xpos > tmp_end) { - x = (int)tmp_end; - y = (int)vMin->y + i*l; - end = (int)(tmp_xpos)-(int)(tmp_end)+1; - z = tmp_zpos; - zpos = tmp_z; - tex1 = tmp_tex2; - tex2 = tmp_tex1; - tey1 = tmp_tey2; - tey2 = tmp_tey1; - } else { - x = (int)tmp_xpos; - y = (int)vMin->y + i*l; - end = (int)(tmp_end)-(int)(tmp_xpos)+1; - z = tmp_z; - zpos = tmp_zpos; - tex1 = tmp_tex1; - tex2 = tmp_tex2; - tey1 = tmp_tey1; - tey2 = tmp_tey2; - } - //printf("%d:%f,%f ",(int)vMin->y + i,xpos,end); - //printf("%d:%d:%d:x:%d,end:%d\n",x, y , end,(int)(tmp_end),(int)(tmp_xpos)); - //printf("x:%d y:%d end:%d z:%f zpos:%f\n",x,y,end,z , zpos); - //printf("tex1:%f tex2:%f tey1:%f tey2:%f\n",tex1,tex2,tey1,tey2); - if(end == 1) { - //printf("tex_x:%f tex_y:%f\n",tex1,tex2); - if(tex1 > 1) tex1 = 1; - if(tey1 > 1) tey1 = 1; - tex_xpos = (int)((image->h-1) * tex1); - tex_ypos = (int)((image->w-1) * tey1); - tex_zpos = (int)z; - //printf("tex_xpos:%d tex_ypos:%d\n",tex_xpos,tex_ypos); - //printf("image->h:%d tex_x:%f\n",image->h,tex1); - rgb = p->get_rgb(tex_xpos,tex_ypos); - viewer->write_pixel(x,y,zpos,rgb); - }else { - for(j = 0; j < end; j++) { - tex_x = tex1*(end-1-j)/(end-1) + tex2*j/(end-1); - tex_y = tey1*(end-1-j)/(end-1) + tey2*j/(end-1); - tex_z = z*(end-1-j)/(end-1) + zpos*j/(end-1); - if(tex_x > 1) tex_x = 1; - if(tex_y > 1) tex_y = 1; - tex_xpos = (int)((image->h-1) * tex_x); - tex_ypos = (int)((image->w-1) * tex_y); - //printf("tex_xpos:%d tex_ypos:%d\n",tex_xpos,tex_ypos); - //printf("z:%f zpos:%f tex_z:%f\n",z,zpos,tex_z); - //printf("tex_x:%f tex_y:%f\n",tex_x,tex_y); - rgb = p->get_rgb(tex_xpos,tex_ypos); - viewer->write_pixel(j+x,y,tex_z,rgb); - } - } - } -} - -void Span_c::create_span(Triangle *tri,SDL_Surface *image) { - Vertex *vMin , *vMid, *vMax; - /* - float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2; - //tmp_x,tmp_y,tmp_ypos ......unused - float tex_x, tex_y,tex_z; - float tmp_xpos,tmp_end,tmp_zpos; - int top_triangle; - int tex_xpos,tex_ypos,tex_zpos; - int i,j; - float div_x,div_y; - float z,zpos; - Uint32 rgb; - */ - - //cout << "x = " << tri->vertex1->x << endl; - if(tri->vertex1->y <= tri->vertex2->y) { - if(tri->vertex2->y <= tri->vertex3->y) { - //printf("condition 1\n"); - vMin = tri->vertex1; - vMid = tri->vertex2; - vMax = tri->vertex3; - } else if(tri->vertex3->y <= tri->vertex1->y) { - //printf("condition 2\n"); - vMin = tri->vertex3; - vMid = tri->vertex1; - vMax = tri->vertex2; - } else { - //printf("condition 3\n"); - vMin = tri->vertex1; - vMid = tri->vertex3; - vMax = tri->vertex2; - } - } else { - if(tri->vertex1->y <= tri->vertex3->y) { - //printf("condition 4\n"); - vMin = tri->vertex2; - vMid = tri->vertex1; - vMax = tri->vertex3; - } else if(tri->vertex3->y <= tri->vertex2->y) { - //printf("condition 5\n"); - vMin = tri->vertex3; - vMid = tri->vertex2; - vMax = tri->vertex1; - } else { - //printf("condition 6\n"); - vMin = tri->vertex2; - vMid = tri->vertex3; - vMax = tri->vertex1; - } - } - - Vertex *vMid10 = new Vertex(0,0,0,0,0); - vMid1(vMid10,vMin,vMid,vMax); - - half_triangle(vMin,vMid,vMid10,image); - half_triangle(vMax,vMid,vMid10,image); - - free(vMid10); -#if 0 - //cout << vMin->x << vMin->y << vMin->z << endl; - div_x = (int)vMid->y - (int)vMin->y; - if(div_x < 1 && div_x > -1) div_x = 1; - div_y = (int)vMax->y - (int)vMin->y; - if(div_y < 1 && div_y > -1) div_y = 1; - - for(i = 0; i < div_x+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B - tmp_xpos = calc(vMax->x - vMin->x,div_y, i, vMin->x); - tmp_end = calc(vMid->x - vMin->x,div_x, i, vMin->x); - tmp_z = calc(vMax->z - vMin->z,div_y, i, vMin->z); - tmp_zpos = calc(vMid->z - vMin->z,div_x, i, vMin->z); - - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B - tmp_tex1 =( (i/(div_y)) * vMax->tex_x) + \ - ( ((div_y - i)/(div_y)) * vMin->tex_x); - tmp_tex2 =( (i/(div_x)) * vMid->tex_x) + \ - ( ((div_x - i)/(div_x)) * vMin->tex_x); - - tmp_tey1 =( (i/(div_y)) * vMax->tex_y) + \ - ( ((div_y - i)/(div_y)) * vMin->tex_y); - tmp_tey2 =( (i/(div_x)) * vMid->tex_y) + \ - ( ((div_x - i)/(div_x)) * vMin->tex_y); - - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B - if(tmp_xpos > tmp_end) { - x = (int)tmp_end; - y = (int)vMin->y + i; - end = (int)(tmp_xpos)-(int)(tmp_end)+1; - z = tmp_z; - zpos = tmp_zpos; - tex1 = tmp_tex2; - tex2 = tmp_tex1; - tey1 = tmp_tey2; - tey2 = tmp_tey1; - } else { - x = (int)tmp_xpos; - y = (int)vMin->y + i; - end = (int)(tmp_end)-(int)(tmp_xpos)+1; - z = tmp_zpos; - zpos = tmp_z; - tex1 = tmp_tex1; - tex2 = tmp_tex2; - tey1 = tmp_tey1; - tey2 = tmp_tey2; - } - //printf("%d:%f,%f ",(int)vMin->y + i,xpos,end); - //printf("%d:%d:%d:x:%d,end:%d\n",x, y , end,(int)(tmp_end),(int)(tmp_xpos)); - //printf("x:%d y:%d end:%d z:%f zpos:%f\n",x,y,end,z , zpos); - //printf("tex1:%f tex2:%f tey1:%f tey2:%f\n",tex1,tex2,tey1,tey2); - if(end == 1) { - //printf("tex_x:%f tex_y:%f\n",tex1,tex2); - if(tex1 > 1) tex1 = 1; - if(tey1 > 1) tey1 = 1; - tex_xpos = (int)(image->h-1) * tex1; - tex_ypos = (int)(image->w-1) * tey1; - tex_zpos = z; - //printf("tex_xpos:%d tex_ypos:%d\n",tex_xpos,tex_ypos); - //printf("image->h:%d tex_x:%f\n",image->h,tex1); - rgb = p->get_rgb(tex_xpos,tex_ypos); - viewer->write_pixel(x,y,zpos,rgb); - }else { - for(j = 0; j < end; j++) { - tex_x = tex1*(end-1-j)/(end-1) + tex2*j/(end-1); - tex_y = tey1*(end-1-j)/(end-1) + tey2*j/(end-1); - tex_z = z*(end-1-j)/(end-1) + zpos*j/(end-1); - if(tex_x > 1) tex_x = 1; - if(tex_y > 1) tex_y = 1; - tex_xpos = (int)(image->h-1) * tex_x; - tex_ypos = (int)(image->w-1) * tex_y; - //printf("tex_xpos:%d tex_ypos:%d\n",tex_xpos,tex_ypos); - //printf("z:%f zpos:%f tex_z:%f\n",z,zpos,tex_z); - //printf("tex_x:%f tex_y:%f\n",tex_x,tex_y); - rgb = p->get_rgb(tex_xpos,tex_ypos); - viewer->write_pixel(j+x,y,tex_z,rgb); - } - } - } - - top_triangle = (int)vMid->y - (int)vMin->y; - div_x = (int)vMax->y - (int)vMid->y; - if(div_x < 1 && div_x > -1) div_x = 1; - div_y = (int)vMax->y - (int)vMin->y; - if(div_y < 1 && div_y > -1) div_y = 1; - - for(i = 0; i < div_x; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B - tmp_xpos = calc(vMax->x-vMin->x, div_y, (i+1+top_triangle), vMin->x); - tmp_end = calc(vMax->x-vMid->x, div_x, (i+1), vMid->x); - tmp_z = calc(vMax->z-vMin->z, div_y, (i+1+top_triangle), vMin->z); - tmp_zpos = calc(vMax->z-vMid->z, div_x, (i+1), vMid->z); - - tmp_tex1 =( ((i + 1 +top_triangle)/(div_y)) * vMax->tex_x) + \ - ( ((div_y - i - 1 - top_triangle)/(div_y)) * vMin->tex_x); - tmp_tex2 =( ((i+1)/(div_x)) * vMax->tex_x) + \ - ( ((div_x - i -1)/(div_x)) * vMid->tex_x); - - tmp_tey1 =( ((i+1+top_triangle)/(div_y)) * vMax->tex_y) + \ - ( ((div_y - i - 1 - top_triangle)/(div_y)) * vMin->tex_y); - tmp_tey2 =( ((i+1)/(div_x)) * vMax->tex_y) + \ - ( ((div_x - i -1)/(div_x)) * vMid->tex_y); - if(tmp_xpos > tmp_end) { - x = (int)tmp_end; - y = (int)vMid->y+i+1; - end = (int)(tmp_xpos)-(int)(tmp_end)+1; - z = tmp_z; - zpos = tmp_zpos; - tex1 = tmp_tex2; - tex2 = tmp_tex1; - tey1 = tmp_tey2; - tey2 = tmp_tey1; - } else { - x = (int)tmp_xpos; - y = (int)vMid->y+i+1; - end = (int)(tmp_end)-(int)(tmp_xpos)+1; - z = tmp_zpos; - zpos = tmp_z; - tex1 = tmp_tex1; - tex2 = tmp_tex2; - tey1 = tmp_tey1; - tey2 = tmp_tey2; - } - if(end == 0) end = 1; - //printf("%d:%d:%d\n",x, y , end); - //printf("x:%d y:%d end:%d z:%f zpos:%f\n",x,y,end,z,zpos); - //printf("tex1:%f tex2:%f tey1:%f tey2:%f\n",tex1,tex2,tey1,tey2); - if(end == 1) { - //printf("tex_x:%f tex_y:%f\n",tex1,tex2); - if(tex1 > 1) tex1 = 1; - if(tey1 > 1) tey1 = 1; - tex_xpos = (int)(image->h-1) * tex1; - tex_ypos = (int)(image->w-1) * tey1; - tex_zpos = z; - //printf("tex_x:%f tex_y:%f\n",tex_x,tex_y); - //printf("tex_xpos:%d tex_ypos:%d\n",tex_xpos,tex_ypos); - //printf("tex_x:%f tex_y:%f\n",tex_x,tex_y); - rgb = p->get_rgb(tex_xpos,tex_ypos); - viewer->write_pixel(x,y,tex_zpos,rgb); - }else { - for(j = 0; j < end; j++) { - tex_x = tex1*(end-1-j)/(end-1) + tex2*j/(end-1); - tex_y = tey1*(end-1-j)/(end-1) + tey2*j/(end-1); - tex_z = z*(end-1-j)/(end-1) + zpos*j/(end-1); - //printf("tex_x:%f tex_y:%f\n",tex_x,tex_y); - if(tex_x > 1) tex_x = 1; - if(tex_y > 1) tex_y = 1; - tex_xpos = (int)(image->h-2) * tex_x; - tex_ypos = (int)(image->w-1) * tex_y; - //printf("z:%f zpos:%f tex_z:%f\n",z,zpos,tex_z); - //printf("tex_xpos:%d tex_ypos:%d\n",tex_xpos,tex_ypos); - //printf("tex_x:%f tex_y:%f\n",tex_x,tex_y); - //printf("tex_x:%f tex_y:%f\n",tex_x,tex_y); - rgb = p->get_rgb(tex_xpos,tex_ypos); - viewer->write_pixel(j+x,y,tex_z,rgb); - } - } - } -#endif -} - -// i:$BJ,;R!"(Bf1:$BD9$5(B f2:$BBP1~$9$kD:E@(B1 f3:$BBP1~$9$kD:E@(B2 -/* -float Span::calc2(int i, float f1, float f2, float f3) { - float ans; - ans = i/f1 * f2 + (f1-i)/f1 * f3; - - */
--- a/TaskManager/Test/simple_render/span_pack.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#ifndef INCLUDED_SPAN_PACK -#define INCLUDED_SPAN_PACK - -typedef struct Span { - long *tex_addr, tex_width, tex_height; - int x, y, length_x; - float start_z, end_z; - float tex_x1, tex_x2, tex_y1, tex_y2; -} SPAN, *SPAN_PTR; - -typedef struct SpanPack { - struct SPAN_INFO { - int size; - int light_pos[3]; - int light_rgb[3]; - } info; - SPAN span[70]; - //SPAN *span; - int pad[1]; -} SPANPACK, *SPANPACK_PTR __attribute__((aligned(16))); - -/* -typedef struct SpanPackList { - int size; - SPANPACK dline[60]; - //SPANPACK dline[135]; - //SPANPACK *dline; -} SPANPACKLIST; -*/ - -#endif
--- a/TaskManager/Test/simple_render/spu_span.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#ifndef INCLUDED_SPU_SPAN -#define INCLUDED_SPU_SPAN - -#ifndef INCLUDED_SPAN_PACK -#include "span_pack.h" -#endif - -typedef struct SPUSPAN { - int length; - //SPANPACK spp[23]; // window_height = 1080 ( 1080/8/6 = 22.5 ) - SPANPACK spp[10]; // window_height = 480 ( 480/8/6 = 10 ) - //SPUSPAN *next; -} SPUSPAN; - -typedef struct SPUSPANLIST { - SPUSPAN ss[6]; // 6 = number of SPU -} SPUSPANLIST; - -/* -typedef struct SPLSSL { - SPUSPANLIST *ssl; - SPANPACKLIST *spl; -} SPLSSL; -*/ -#endif
--- a/TaskManager/kernel/schedule/FifoDmaManager.cc Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include "FifoDmaManager.h" - -void -FifoDmaManager::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) -{ - //if ((void*)addr == NULL) return; - if (size == 0) return; - memcpy(buf, (void*)addr, size); -} - -void -FifoDmaManager::dma_store(void *buf, uint32 addr, uint32 size, uint32 mask) -{ - //if ((void*)addr == NULL) return; - if (size == 0) return; - memcpy((void*)addr, buf, size); -} - -/** - * mask で設定した DMA 転送の完了を待つ - */ -void -FifoDmaManager::dma_wait(uint32 mask) -{ - //spu_writech(MFC_WrTagMask, 1 << mask); - //spu_mfcstat(MFC_TAG_UPDATE_ALL); -} - -void -FifoDmaManager::mail_write(uint32 data) -{ - //spu_writech(SPU_WrOutMbox, data); - - mail_sendQueue - = MailManager::append_mailQueue(mail_sendQueue, - mailManager->create(data)); -} - -unsigned int -FifoDmaManager::mail_read(void) -{ - MailQueuePtr q; - uint32 ret; - - q = mail_recvQueue; - - if (q == NULL) { - return 0; // error か 正しい値か判断できないな・・・ - } - - mail_recvQueue = mail_recvQueue->next; - - ret = q->data; - mailManager->free(q); - - return ret; -}
--- a/TaskManager/kernel/schedule/MainScheduler.cc Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#include <stdlib.h> -#include "MainScheduler.h" -#include "FifoDmaManager.h" -#include "error.h" - -void -MainScheduler::init_impl(void) -{ - connector = new FifoDmaManager(); - - for (int i = 0; i < 2; i++) { - listBuf[i] = (TaskListPtr)malloc(sizeof(TaskList)); - readBuf[i] = malloc(16*1024); - writeBuf[i] = malloc(16*1024);// どっかに定数を - } -} - -void -MainScheduler::set_mailManager(MailManager *m) -{ - ((FifoDmaManager*)connector)->mailManager = m; -} - - -void -MainScheduler::send_mailList(MailQueuePtr mail_list) -{ - ((FifoDmaManager*)connector)->mail_recvQueue = mail_list; - ((FifoDmaManager*)connector)->mail_sendQueue = NULL; -} - -MailQueuePtr -MainScheduler::recv_mailList(void) -{ - return ((FifoDmaManager*)connector)->mail_sendQueue; -}
--- a/include/TaskManager/SpeExit.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -#ifndef INCLUDED_SPE_EXIT -#define INCLUDED_SPE_EXIT - -#ifndef INCLUDED_SPEMANAGER -# include "SpeManager.h" -#endif - -class SpeExit : public SpeTaskBase { -public: - /* constructor */ - SpeExit(void) {} - - /* variables */ - - /* functions */ - SpeTaskBase* next(SpeManager *, SpeTaskBase *); -}; - -#endif
--- a/include/TaskManager/SpeMail.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#ifndef INCLUDED_SPE_MAIL -#define INCLUDED_SPE_MAIL - -#ifndef INCLUDED_SPE_MANAGER -# include "SpeManager.h" -#endif - -#include "error.h" - -class SpeMail : public SpeTaskBase{ -public: - /* constructor */ - SpeMail(DmaManager *); - - /* variables */ - unsigned int params_addr; - DmaManager* connector; - - /* functions */ - void read(void); - SpeTaskBase* next(SpeManager *, SpeTaskBase *); - -#if DEBUG - void exec(void) { __debug("[SpeMail:%s]\n", __FUNCTION__); } - void write(void) { __debug("[SpeMail:%s]\n", __FUNCTION__); } -#endif -}; - -#endif
--- a/include/TaskManager/SpeManager.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -#ifndef INCLUDED_SPE_MANAGER -#define INCLUDED_SPE_MANAGER - -#ifndef INCLUDED_TASK -# include "task.h" -#endif - -#ifndef INCLUDED_DMA_MANAGER -# include "DmaManager.h" -#endif - -class SpeTaskBase; -class SpeManager; - -class SpeTaskBase { -public: - /* constructor */ - SpeTaskBase(void) {} - virtual ~SpeTaskBase(void) {} - - /* variables */ - - // noaction in default - virtual void load(void) {} - virtual void read(void) {} - virtual void exec(void) {} - virtual void write(void) {} - - /* functions */ - virtual SpeTaskBase* next(SpeManager *, SpeTaskBase *) = 0; -}; - - -class SpeManager { -public: - SpeManager(void); - - /* variables */ - int listBufFlg; - int readBufFlg; - int writeBufFlg; - TaskListPtr listBuf[2]; - void *readBuf[2]; - void *writeBuf[2]; - - DmaManager* connector; - - SpeTaskBase* task1; - SpeTaskBase* task2; - SpeTaskBase* task3; - - /* functions */ - void init(void); - void set_connect(DmaManager*); - void run(void); - void finish(void); - - TaskListPtr get_curListBuf(void); - void* get_curReadBuf(void); - void* get_curWriteBuf(void); -}; - -#endif
--- a/include/TaskManager/SpeNop.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#ifndef INCLUDED_SPE_NOP -#define INCLUDED_SPE_NOP - -#ifndef INCLUDED_SPE_MANAGER -# include "SpeManager.h" -#endif - -#include "error.h" - -class SpeNop : public SpeTaskBase { -public: - /* functions */ - SpeTaskBase* next(SpeManager *, SpeTaskBase *); - -#if DEBUG - void read(void) { __debug("[SpeNop:%s]\n", __FUNCTION__); } - void exec(void) { __debug("[SpeNop:%s]\n", __FUNCTION__); } - void write(void) { __debug("[SpeNop:%s]\n", __FUNCTION__); } -#endif -}; - -#endif
--- a/include/TaskManager/SpeNop2Ready.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#ifndef INCLUDED_SPE_NOP2READY -#define INCLUDED_SPE_NOP2READY - -#ifndef INCLUDED_SPE_MANAGER -# include "SpeManager.h" -#endif - -#ifndef INCLUDED_SPE_NOP -# include "SpeNop.h" -#endif - -#include "error.h" - -class SpeNop2Ready : public SpeNop { -public: - /* constructor */ - SpeNop2Ready(DmaManager*); - - /* variables */ - DmaManager* connector; - - /* functions */ - void exec(void); - SpeTaskBase* next(SpeManager *, SpeTaskBase *); - -#if DEBUG - void read(void) { __debug("[SpeNop2Ready:%s]\n", __FUNCTION__); } - void write(void) { __debug("[SpeNop2Ready:%s]\n", __FUNCTION__); } -#endif -}; - -#endif
--- a/include/TaskManager/SpeTask.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#ifndef INCLUDED_SPE_TASK -#define INCLUDED_SPE_TASK - -#ifndef INCLUDED_SPE_MANAGER -# include "SpeManager.h" -#endif - -class SpeTask : public SpeTaskBase { -public: - /* constructor */ - SpeTask(TaskListPtr, TaskPtr, void*, void*, DmaManager*); - - /* variables */ - TaskListPtr list; - TaskPtr task; - void *readbuf; - void *writebuf; - - DmaManager* connector; - - // work area - // global variable 用とか - // 次の task に引き渡したり - // size : デフォルトで 4k - // ppuから教えてもらう? task に入れる - void (*func)(void *wbuf, void *rbuf); - - /* functions */ - SpeTaskBase* next(SpeManager *, SpeTaskBase *); - - // override - void read(void); - void exec(void); - void write(void); -}; - -#endif
--- a/include/TaskManager/SpeTaskList.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#ifndef INCLUDED_SPE_TASKLIST -#define INCLUDED_SPE_TASKLIST - -#ifndef INCLUDED_SPE_MANAGER -# include "SpeManager.h" -#endif - -#include "error.h" - -class SpeTaskList : public SpeTaskBase { -public: - /* constructor */ - SpeTaskList(unsigned int addr, TaskListPtr list, DmaManager* c); - - /* variables */ - unsigned int params_addr; - TaskListPtr list; - DmaManager* connector; - - /* functions */ - SpeTaskBase* next(SpeManager *, SpeTaskBase *); - - /* override functions */ - void read(void); - -#ifdef DEBUG - void exec(void) { __debug("[SpeTaskList:%s]\n", __FUNCTION__); } - void write(void) { __debug("[SpeTaskList:%s]\n", __FUNCTION__); } -#endif - -}; - -//extern void get_task_list(); -//extern void print_task_list(); - -#endif
--- a/include/TaskManager/Sum.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDED_TASK_MANAGER -# include "TaskManager.h" -#endif - -class Sum { -public: - void init(void); - void run(void); - -private: - TaskManager *manager; -};
--- a/include/TaskManager/dma_spe.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#include <spu_mfcio.h> -#include "dma.h" - -class SpeDmaManager : public DmaManager { -public: - void dma_load(void *buf, unsigned int addr, int size, int mask); - void dma_store(void *buf, unsigned int addr, int size, int mask); - void dma_wait(int mask) ; - - void mail_write(unsigned int data); - unsigned int mail_read(void); -};
--- a/include/TaskManager/memorypool.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -#ifndef MEMORY_POOL_H_ -#define MEMORY_POOL_H_ - -#include <memory> -#include <stdlib.h> - -const int DEFAULT_EXPAND_SIZE = 32; - -template <class T_, size_t size_ =DEFAULT_EXPAND_SIZE> -class MemoryPool { -public: - typedef MemoryPool<T_, size_> self_type; - - MemoryPool(void) { - next_ = NULL; - expandTheFreeList(size_); - } - - ~MemoryPool(void) { - MemoryPool * nextPtr = next_; - - while (nextPtr == 0) { - next_ = next_->next_; - delete [] nextPtr; - nextPtr = next_; - } - } - - void* alloc(size_t) { - if (!next_) expandTheFreeList(size_); - - self_type* head = next_; - next_ = head->next_; - - return head; - } - - void free(void* doomed) { - self_type* head = static_cast<self_type*>(doomed); - head->next_ = next_; - next_ = head; - } - -private: - void expandTheFreeList(int howMany); - -private: - self_type* next_; -}; - -template <class T_, size_t size_> -void MemoryPool<T_, size_>::expandTheFreeList(int howMany) -{ - size_t size = (sizeof(T_) > sizeof(self_type*)) - ? sizeof(T_) : sizeof(self_type*); - - self_type* runner = (self_type*)malloc(size); - - next_ = runner; - for (int i = 0; i < howMany; i++) { - runner->next_ = (self_type*)malloc(size); - runner = runner->next_; - } - runner->next_ = 0; -} - -template <class T_, size_t size_ =DEFAULT_EXPAND_SIZE> -class UseMemoryPool { -public: - void* operator new(size_t size) { return pool_->alloc(size); } - void operator delete(void* doomed, size_t) { pool_->free(doomed); } - -public: - static void initMemPool() { - pool_.reset(new MemoryPool<T_, size_>); - } - -private: - static std::auto_ptr<MemoryPool<T_, size_> > pool_; - -}; - -template <class T_, size_t size_> -std::auto_ptr<MemoryPool<T_, size_> > UseMemoryPool<T_, size_>::pool_; - -#endif // ! MEMORY_POOL_H_
--- a/include/TaskManager/ppe_spe.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/** - * Alignment value and macro for DMA transfer in SPE - */ -#ifndef INCLUDED_T -#define INCLUDED_T - -#define SPE_ALIGNMENT 16 -#define SPE_ALIGNMENT_FULL 128 -#define SPE_ALIGN __attribute__((aligned(SPE_ALIGNMENT))) -#define SPE_ALIGN_FULL __attribute__((aligned(SPE_ALIGNMENT_FULL)) -#define ROUND_UP_ALIGN(value, alignment) \ - (((value) + ((alignment) - 1))&(~((alignment)-1))) -#define DEFAULT_ALIGNMENT SPE_ALIGNMENT - -enum { - MY_SPE_COMMAND_EXIT, - MY_SPE_COMMAND_GO, - - MY_SPE_STATUS_BUSY, - MY_SPE_STATUS_READY -}; - -#endif
--- a/include/TaskManager/spe_taskinfo.h Wed Nov 12 17:39:33 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#ifndef INCLUDED_SPETASKINFO -#define INCLUDED_SPETASKINFO - -#ifndef INCLUDED_TASKINFO -# include "../taskinfo.h" -#endif - -class SpeTaskInfo : public TaskInfo { -public: - SpeTaskInfo(int num); - - int extend_pool_taskList(int num); -}; - -#endif