changeset 3:8b4d6bf8c43d

add entry_head function
author yutaka@localhost.localdomain
date Wed, 07 Apr 2010 17:35:34 +0900
parents 1e1b0d280427
children c2ce9efe2a52
files Makefile include/Run.h include/Sys.h include/params.h ppe/Manager.cc ppe/Menu.cc ppe/Sys.cc spe/SpeSentry.cc
diffstat 8 files changed, 58 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Apr 07 05:18:52 2010 +0900
+++ b/Makefile	Wed Apr 07 17:35:34 2010 +0900
@@ -10,16 +10,17 @@
 
 INC = -I include
 
-PPESRC = $(shell ls ppe/*.cc)
-SPESRC = $(shell ls spe/*.cc)
+PPESRC  = $(shell ls ppe/*.cc)
+SPESRC  = $(shell ls spe/*.cc)
+TASKSRC = $(shell ls task/*.cc)
 
 all: $(PPETARGET) $(SPETARGET)
 
 $(PPETARGET): $(PPEOBJ)
-	$(PPECC) $(PPELIB) $(INC) $(PPESRC) -o $@
+	$(PPECC) $(PPELIB) $(INC) $(PPESRC) $(TASKSRC) -o $@
 
 $(SPETARGET): $(SPEOBJ)
-	$(SPECC) $(SPELIB) $(INC) $(SPESRC) -o $@
+	$(SPECC) $(SPELIB) $(INC) $(SPESRC) $(TASKSRC) -o $@
 
 clean:
 	rm -f $(PPETARGET) $(SPETARGET)
--- a/include/Run.h	Wed Apr 07 05:18:52 2010 +0900
+++ b/include/Run.h	Wed Apr 07 17:35:34 2010 +0900
@@ -1,1 +1,6 @@
-void run(void *in, void *out, int data_length);
+#ifndef INCLUDED_RUN
+#define INCLUDED_RUN
+
+void run(void *in, void *out, int size_in, int size_out);
+
+#endif
--- a/include/Sys.h	Wed Apr 07 05:18:52 2010 +0900
+++ b/include/Sys.h	Wed Apr 07 17:35:34 2010 +0900
@@ -10,5 +10,6 @@
 
 task_t* add_list(task_t *tail, task_t *task);
 void set_pin(task_t *task, int pin_in, int pin_out);
+task_t* entry_head(task_head_t *head)
 
 #endif
--- a/include/params.h	Wed Apr 07 05:18:52 2010 +0900
+++ b/include/params.h	Wed Apr 07 17:35:34 2010 +0900
@@ -11,17 +11,19 @@
   unsigned long long ea_out; //8
 
   unsigned int next_task_size;   //4
+  unsigned int size_in;     //4
   unsigned int size_out;     //4
   unsigned int pin_in;       //4
   unsigned int pin_out;      //4
 
-} task_head_t; //32
+  int pat[3]; //12
+
+} task_head_t; //48
 
 typedef struct {
 
   task_head_t *head; //next data param
   void *input;
-  unsigned int task_size;
 
 } task_t;
 
--- a/ppe/Manager.cc	Wed Apr 07 05:18:52 2010 +0900
+++ b/ppe/Manager.cc	Wed Apr 07 17:35:34 2010 +0900
@@ -33,12 +33,15 @@
       int *out = (int*)tmp->head->ea_out;
       int *in = (int*)tmp->input;
 
+      int size_in  = tmp->head->size_in;
+      int size_out = tmp->head->size_out;
+
       //printf("in[%d] %f\n",i,in[i]);
       //printf("out[%d] %f\n",i,out[i]);
      
       //printf("size->out %d\n",tmp->head->size_out);
  
-      run(in, out, tmp->head->size_out);
+      run(in, out, size_in, size_out);
 	
       //printf("out_spe[%d] %f\n",i,out_spe[i]);
       //printf("out[%d] %f\n",i,out[i]);
@@ -67,10 +70,13 @@
       int *out_spe = (int*)allocate(tmp->head->size_out);
       int *in = (int*)tmp->input;
 
+      int size_in  = tmp->head->size_in;
+      int size_out = tmp->head->size_out;
+
       //printf("in[%d] %f\n",i,in[i]);
       //printf("out[%d] %f\n",i,out[i]);
       
-      run(in, out_spe, tmp->head->size_out);
+      run(in, out_spe, size_in, size_out);
 	
       //printf("out_spe[%d] %f\n",i,out_spe[i]);
       //printf("out[%d] %f\n",i,out[i]);
--- a/ppe/Menu.cc	Wed Apr 07 05:18:52 2010 +0900
+++ b/ppe/Menu.cc	Wed Apr 07 17:35:34 2010 +0900
@@ -10,12 +10,8 @@
 menu(int &list_num) {
 
   list_num = SPE_NUM;
-  int all_task_num = SPE_NUM*1000;
-  //int all_task_num = 1;
-  //int task_size = MAX_DMA_SIZE;
+  int all_task_num = SPE_NUM*10;
   int task_size = 16*1024;
-  //int in_size  = (task_size - sizeof(task_head_t)) * all_task_num;
-  //int out_size = (task_size - sizeof(task_head_t)) * all_task_num;
 
   int in_size  = (task_size - sizeof(task_head_t));
   int out_size = (task_size - sizeof(task_head_t));
@@ -26,14 +22,7 @@
 
   for (int i = 0; i < list_num; i++) {
 
-    list_head[i].ea_out   = 0;
-    list_head[i].size_out = 0;
-    list_head[i].pin_in   = 0;
-    list_head[i].pin_out  = 0;
-
-    task_t *tail = (task_t*)allocate(sizeof(task_t));
-    tail->head = &list_head[i];
-    tail->input = NULL;
+    task_t *tail = entry_head(&list_head[i]);
 
     for (int j = 0; j < list_length; j++) {
 
--- a/ppe/Sys.cc	Wed Apr 07 05:18:52 2010 +0900
+++ b/ppe/Sys.cc	Wed Apr 07 17:35:34 2010 +0900
@@ -3,11 +3,29 @@
 #include "Sys.h"
 
 task_t*
+entry_head(task_head_t *head)
+{
+
+  head->ea_out   = 0;
+  head->size_in  = 0;
+  head->size_out = 0;
+  head->pin_in   = 0;
+  head->pin_out  = 0;
+
+  task_t *tail = (task_t*)allocate(sizeof(task_t));
+  tail->head = head;
+  tail->input = NULL;
+
+  return tail;
+  
+}
+
+task_t*
 add_list(task_t *tail, task_t *task)
 {
 
   tail->head->next_task = (unsigned long long) (unsigned long) task->head;
-  tail->head->next_task_size = task->task_size;
+  tail->head->next_task_size = task->head->size_in + sizeof(task_head_t);
 
   task->head->next_task = 0;
   task->head->next_task_size = 0;
@@ -82,16 +100,19 @@
 
   int task_size = in_size + sizeof(task_head_t);
 
+  if (task_size > MAX_DMA_SIZE) {
+    printf("dma send size over %d\n",task_size); 
+  }
+
   posix_memalign(&buff, alignment, task_size);
   fix_type(task, buff);
 
   posix_memalign(&out, alignment, out_size);
   task->head->ea_out = (unsigned long long) (unsigned long) out;
+
+  task->head->size_in  = in_size;
   task->head->size_out = out_size;
 
-  task->task_size = task_size;
-
-
   return task;
 
 }
--- a/spe/SpeSentry.cc	Wed Apr 07 05:18:52 2010 +0900
+++ b/spe/SpeSentry.cc	Wed Apr 07 17:35:34 2010 +0900
@@ -117,13 +117,14 @@
 
 	  //printf("hoge");
 	  output_buff[cur] = allocate(send_params->head->size_out);
-	  int data_length = send_params->head->size_out;
 
+	  int size_in  = send_params->head->size_in;
+	  int size_out = send_params->head->size_out;
 	  
 	  //task********************************************
 	  
-	  run(in,output_buff[cur],data_length);
-	  
+	  run(in, output_buff[cur], size_in, size_out);
+
 	  //end*********************************************
 	  
 	  dma_put(output_buff[cur], send_params->head->ea_out, send_params->head->size_out, out_tag[cur]);
@@ -151,12 +152,12 @@
 
 	  //printf("hoge");
 	  output_buff[cur] = allocate(send_params->head->size_out);
-	  int data_length = send_params->head->size_out;
-
+	  int size_in  = send_params->head->size_in;
+	  int size_out = send_params->head->size_out;
 	  
 	  //task********************************************
 	  
-	  run(in,output_buff[cur],data_length);
+	  run(in, output_buff[cur], size_in, size_out);
 	  
 	  //end*********************************************