annotate TaskManager/Cell/CellTaskListInfo.cc @ 501:7ddbe22d4cdb draft

Cell inData/outData DMA removal
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 11 Oct 2009 18:20:33 +0900
parents 028ffc9c0375
children 30dd8a3deb4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
1 #include <stdio.h>
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
2 #include <stdlib.h>
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
3 #include "CellTaskListInfo.h"
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
4
60
f50c74835a9b *** empty log message ***
gongo
parents: 57
diff changeset
5 #define NEXT_ADDR(addr, size) \
f50c74835a9b *** empty log message ***
gongo
parents: 57
diff changeset
6 (TaskListPtr)((int)(addr) + (size))
f50c74835a9b *** empty log message ***
gongo
parents: 57
diff changeset
7
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
8 int
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
9 CellTaskListInfo::extend_pool(int num)
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
10 {
60
f50c74835a9b *** empty log message ***
gongo
parents: 57
diff changeset
11 TaskListPtr q = NULL;
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
12 int unit_size;
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
13
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 60
diff changeset
14 unit_size = (ROUND_UP_ALIGN(sizeof(TaskList), DEFAULT_ALIGNMENT));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 60
diff changeset
15 posix_memalign((void**)&q, DEFAULT_ALIGNMENT, unit_size*(num+1));
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
16
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
17 if (q == NULL) {
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
18 return -1;
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
19 }
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
20
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
21 q->next = taskListPool;
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
22 taskListPool = q;
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
23
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
24 /* Connect all free pack_list in the pool */
60
f50c74835a9b *** empty log message ***
gongo
parents: 57
diff changeset
25 q = NEXT_ADDR(taskListPool, unit_size); // q = taskListPool + 1;
f50c74835a9b *** empty log message ***
gongo
parents: 57
diff changeset
26 for (; --num > 0; q = NEXT_ADDR(q, unit_size)) {
f50c74835a9b *** empty log message ***
gongo
parents: 57
diff changeset
27 q->next = NEXT_ADDR(q, unit_size); // q->next = q + 1;
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
28 }
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
29 q->next = freeTaskList;
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
30 freeTaskList = NEXT_ADDR(taskListPool, unit_size);
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
31
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
32 return 0;
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
33 }