annotate TaskManager/Fifo/ReferencedDmaManager.cc @ 1553:21ddbc06dcde draft

fix GpuScheduler
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Sun, 17 Feb 2013 19:42:36 +0900
parents 34582cd8a7af
children 138e7edff3ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1219
a27c361c436b add ReferencedDmaManager.cc
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "ReferencedDmaManager.h"
a27c361c436b add ReferencedDmaManager.cc
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "Scheduler.h"
a27c361c436b add ReferencedDmaManager.cc
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include "TaskManagerImpl.h"
1418
ff721740df6b DMA fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1417
diff changeset
4 #include <string.h>
1219
a27c361c436b add ReferencedDmaManager.cc
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a27c361c436b add ReferencedDmaManager.cc
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 void *
1417
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
7 ReferencedDmaManager::dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask)
1219
a27c361c436b add ReferencedDmaManager.cc
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 {
1415
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
9 return (void*)addr;
1219
a27c361c436b add ReferencedDmaManager.cc
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 }
1257
981b36f38333 add prefetcht0
Daichi Toma <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1219
diff changeset
11
1300
3a04b2e24df1 add dma_loadList
Daichi Toma <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1287
diff changeset
12 void *
1417
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
13 ReferencedDmaManager::dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask)
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
14 {
1418
ff721740df6b DMA fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1417
diff changeset
15 // void *from = (void*)addr;
ff721740df6b DMA fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1417
diff changeset
16 // if (buf != from)
ff721740df6b DMA fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1417
diff changeset
17 // memcpy(buf, from, size);
1417
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
18 return (void*)addr;
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
19 }
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
20
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
21
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
22 void *
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
23 ReferencedDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask)
1300
3a04b2e24df1 add dma_loadList
Daichi Toma <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1287
diff changeset
24 {
1415
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
25 ListElementPtr elm = &list->element[0];
1417
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1416
diff changeset
26 return (void*)elm->addr; // ==readbuf
1300
3a04b2e24df1 add dma_loadList
Daichi Toma <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1287
diff changeset
27 }
1413
5b024efa2429 fix free on non copy DMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1369
diff changeset
28
5b024efa2429 fix free on non copy DMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1369
diff changeset
29 void
1414
94ac6d8e73aa fix free inifite loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1413
diff changeset
30 ReferencedDmaManager::free_(void *buf) {
1413
5b024efa2429 fix free on non copy DMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1369
diff changeset
31 }
5b024efa2429 fix free on non copy DMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1369
diff changeset
32
1415
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
33 /**
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
34 * DMA buffer offset in rbuf
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
35 *
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
36 * faked offset for real address must be set to get correct address by
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
37 * return (void*)((char*)readbuf + inListData.bound[index]);
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
38 *
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
39 */
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
40 void
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
41 ReferencedDmaManager::bound(ListData *list)
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
42 {
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
43 ListElement *elm = list->element;
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
44 int *bound = list->bound;
1511
34582cd8a7af Fix compile error for cell
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1418
diff changeset
45 #ifdef __CERIUM_CELL__
34582cd8a7af Fix compile error for cell
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1418
diff changeset
46 uint32 readbuf = elm[0].addr;
34582cd8a7af Fix compile error for cell
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1418
diff changeset
47 #else
1415
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
48 memaddr readbuf = elm[0].addr;
1511
34582cd8a7af Fix compile error for cell
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1418
diff changeset
49 #endif
1415
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
50 for(int i=0;i<list->length;i++) {
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
51 bound[i] = elm[i].addr-readbuf;
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
52 }
774ea7a71b0f try to fix bound in ReferencedDmaManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1414
diff changeset
53 }
1413
5b024efa2429 fix free on non copy DMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1369
diff changeset
54
1416
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
55 void *
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
56 ReferencedDmaManager::get_writebuf(Scheduler *s,memaddr addr, uint32 size)
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
57 {
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
58 return (void*)addr;
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
59 }
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
60
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
61 void *
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
62 ReferencedDmaManager::dma_store(void *buf, memaddr addr, uint32 size, uint32 mask)
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
63 {
1418
ff721740df6b DMA fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1417
diff changeset
64 // void *to = (void*)addr;
ff721740df6b DMA fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1417
diff changeset
65 // if (buf != to)
ff721740df6b DMA fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1417
diff changeset
66 // memcpy(to, buf, size);
1416
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
67 return (void*)addr;
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
68 }
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
69
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
70 void
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
71 ReferencedDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
72 {
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
73 }
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
74
88d1b95e5f8d NULL write DMA mode
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1415
diff changeset
75