Mercurial > hg > Members > yutaka > manager
diff ppe/Sys.cc @ 2:1e1b0d280427
commit
author | yutaka@localhost.localdomain |
---|---|
date | Wed, 07 Apr 2010 05:18:52 +0900 |
parents | dcd83cefb980 |
children | 8b4d6bf8c43d |
line wrap: on
line diff
--- a/ppe/Sys.cc Tue Apr 06 22:52:33 2010 +0900 +++ b/ppe/Sys.cc Wed Apr 07 05:18:52 2010 +0900 @@ -2,6 +2,29 @@ #include <stdlib.h> #include "Sys.h" +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; + + task->head->next_task = 0; + task->head->next_task_size = 0; + + return task; + +} + +void +set_pin(task_t *task, int pin_in, int pin_out) +{ + + task->head->pin_in = pin_in; + task->head->pin_out = pin_out; + +} + int size_fix(int size, int fix) { @@ -27,33 +50,48 @@ } void -fix_type(send_params_t *send_params, void *buff) +fix_type(task_t *task, void *buff) { char *p; p = (char*)buff; - p = p + sizeof(send_params_head_t); + p = p + sizeof(task_head_t); - send_params->head = (send_params_head_t*)buff; - send_params->buff = p; + task->head = (task_head_t*)buff; + task->input = p; } -send_params_t -task_allocate(int size) +task_t* +task_allocate(int in_size, int out_size) { - if (size % 16) { - printf("allocate size is not multiple of 16\n"); + if (in_size % 16) { + printf("allocate in_size is not multiple of 16\n"); + } + + if (out_size % 16) { + printf("allocate out_size is not multiple of 16\n"); } int alignment = 16; - send_params_t send_params; + task_t *task = (task_t*)allocate(sizeof(task_t)); void *buff; - posix_memalign(&buff, alignment, size); - fix_type(&send_params, buff); + void *out; + + int task_size = in_size + sizeof(task_head_t); + + posix_memalign(&buff, alignment, task_size); + fix_type(task, buff); - return send_params; + posix_memalign(&out, alignment, out_size); + task->head->ea_out = (unsigned long long) (unsigned long) out; + task->head->size_out = out_size; + + task->task_size = task_size; + + + return task; }