Mercurial > hg > Members > kono > Cerium
changeset 239:ae6aa53faf70
hey
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc Fri May 29 13:43:52 2009 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Fri May 29 15:34:13 2009 +0900 @@ -38,11 +38,33 @@ * @param[in] mask Tag for Wait DMA process */ void +CellDmaManager::start_dmawait_profile() +{ + wait_time = readch(SPU_RdDec); + global_busy_time += busy_time - wait_time; + writech(SPU_WrDec, 0xffffffff); +} + +void +CellDmaManager::end_dmawait_profile() +{ + wait_time = readch(SPU_RdDec); + global_wait_time += 0xffffffff - wait_time; + busy_time = wait_time; +} + +void CellDmaManager::dma_wait(uint32 mask) { +#ifdef SPU_PROFILE + start_dmawait_profile(); +#endif mfc_write_tag_mask(1 << mask); mfc_write_tag_update_all(); mfc_read_tag_status(); +#ifdef SPU_PROFILE + end_dmawait_profile(); +#endif } void
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Cell/spe/CellDmaManager.cc~ Fri May 29 15:34:13 2009 +0900 @@ -0,0 +1,73 @@ +#include <stdio.h> +#include <stdlib.h> +#include "CellDmaManager.h" + +/** + * DMA Load + * + * @param[in] buf Buffer of Load Data + * @param[in] addr Address of Load Data at Main Memory + * @param[in] size Size of Load Data + * @param[in] mask DMA tag +*/ +void +CellDmaManager::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) +{ + if (size == 0) return ; + mfc_get((volatile void *)buf, addr, size, mask, 0, 0); +} + +/** + * DMA Store + * + * @param[in] buf Buffer of Store Data at SPE + * @param[in] addr Address of Store Data at Main Memory + * @param[in] size Size of Store Data + * @param[in] mask DMA tag +*/ +void +CellDmaManager::dma_store(void *buf, uint32 addr, uint32 size, uint32 mask) +{ + if (size == 0) return ; + mfc_put((volatile void *)buf, addr, size, mask, 0, 0); +} + +/** + * DMA Wait + * + * @param[in] mask Tag for Wait DMA process + */ +void +CellDmaManager::dma_wait(uint32 mask) +{ + mfc_write_tag_mask(1 << mask); + mfc_write_tag_update_all(); + mfc_read_tag_status(); +} + +void +CellDmaManager::mail_write(uint32 data) +{ + spu_write_out_mbox(data); +} + +unsigned int +CellDmaManager::mail_read(void) +{ + unsigned int mail = spu_read_in_mbox(); + return mail; +} + +void +CellDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) +{ + mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, + mask, 0, 0); +} + +void +CellDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) +{ + mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, + mask, 0, 0); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/SGList.cpp Fri May 29 15:34:13 2009 +0900 @@ -0,0 +1,5 @@ +#include "SGList.h" + +const char *sglist_table[SGLIST_LENGTH] = { + "Ball", "LongCube", "Venus000", "Venus001", "Venus002", "Venus008", "Venus003", "Venus007", "Venus006", "Venus004", "Venus005", "Venus009", "Cube", "BigCube", "Plane", "SmallCube", "Diry", "Dirz", "Dirx", "IEBOSS", "IEJIKI", "IETAMA", "MCUBE_BACK", "MCUBE", "BIGMCUBE", "CUBE", "PANEL_1024", "PANEL_2048", "PANEL_512", "BACK", "BULEBULLET", "E_PLANE", "IDLE", "Sphere", "BigSphere", "Earth", "Moon" +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/SGList.h Fri May 29 15:34:13 2009 +0900 @@ -0,0 +1,83 @@ +#ifndef INCLUDED_SGLIST +#define INCLUDED_SGLIST + +/* ../xml_file/Ball.xml */ +#define Ball 0 + +/* ../xml_file/LongCube.xml */ +#define LongCube 1 + +/* ../xml_file/Venus.xml */ +#define Venus000 2 +#define Venus001 3 +#define Venus002 4 +#define Venus008 5 +#define Venus003 6 +#define Venus007 7 +#define Venus006 8 +#define Venus004 9 +#define Venus005 10 +#define Venus009 11 + +/* ../xml_file/cube.xml */ +#define Cube 12 + +/* ../xml_file/cube_big.xml */ +#define BigCube 13 + +/* ../xml_file/cube_split.xml */ +#define Plane 14 +#define SmallCube 15 + +/* ../xml_file/direction.xml */ +#define Diry 16 +#define Dirz 17 +#define Dirx 18 + +/* ../xml_file/ieboss.xml */ +#define IEBOSS 19 + +/* ../xml_file/iejiki.xml */ +#define IEJIKI 20 + +/* ../xml_file/ietama.xml */ +#define IETAMA 21 + +/* ../xml_file/mcube.xml */ +#define MCUBE_BACK 22 +#define MCUBE 23 +#define BIGMCUBE 24 +#define CUBE 25 + +/* ../xml_file/panel_1024.xml */ +#define PANEL_1024 26 + +/* ../xml_file/panel_2048.xml */ +#define PANEL_2048 27 + +/* ../xml_file/panel_512.xml */ +#define PANEL_512 28 + +/* ../xml_file/player.xml */ +#define BACK 29 +#define BULEBULLET 30 +#define E_PLANE 31 +#define IDLE 32 + +/* ../xml_file/sphere.xml */ +#define Sphere 33 + +/* ../xml_file/sphere_big.xml */ +#define BigSphere 34 + +/* ../xml_file/universe.xml */ +#define Earth 35 +#define Moon 36 + +/* Number of Scene */ +#define SGLIST_LENGTH 37 + +/* Scene Table */ +extern const char *sglist_table[SGLIST_LENGTH]; + +#endif
--- a/include/TaskManager/CellDmaManager.h Fri May 29 13:43:52 2009 +0900 +++ b/include/TaskManager/CellDmaManager.h Fri May 29 15:34:13 2009 +0900 @@ -11,6 +11,8 @@ #include <spu_mfcio.h> +#define SPU_PROFILE 1 + class CellDmaManager : public DmaManager { public: BASE_NEW_DELETE(CellDmaManager); @@ -21,11 +23,15 @@ } DmaList, *DmaListPtr; /* variables */ + unsigned int wait_time, busy_time; + unsigned long long global_busy_time = 0, global_wait_time = 0; /* functions */ void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); void dma_store(void *buf, uint32 addr, uint32 size, uint32 mask); void dma_wait(uint32 mask) ; + void start_dmawait_profile(); + void end_dmawait_profile(); void mail_write(uint32 data); uint32 mail_read(void);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/TaskManager/CellDmaManager.h~ Fri May 29 15:34:13 2009 +0900 @@ -0,0 +1,36 @@ +#ifndef INCLUDED_CELL_DMA_MANAGER +#define INCLUDED_CELL_DMA_MANAGER + +#ifndef INCLUDED_BASE_H_ +# include "base.h" +#endif + +#ifndef INCLUDED_DMA_MANAGER +# include "DmaManager.h" +#endif + +#include <spu_mfcio.h> + +class CellDmaManager : public DmaManager { +public: + BASE_NEW_DELETE(CellDmaManager); + + typedef struct dma_list { + uint32 addr; + uint32 size; + } DmaList, *DmaListPtr; + + /* variables */ + + /* functions */ + void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); + void dma_store(void *buf, uint32 addr, uint32 size, uint32 mask); + void dma_wait(uint32 mask) ; + + void mail_write(uint32 data); + uint32 mail_read(void); + void dma_loadList(ListDataPtr list, void *buff, uint32 mask); + void dma_storeList(ListDataPtr, void *buff, uint32 mask); +}; + +#endif