annotate TaskManager/kernel/ppe/DmaBuffer.cc @ 86:61bacd3b4405

*** empty log message ***
author gongo
date Wed, 27 Feb 2008 10:56:09 +0900
parents 178459e03f5c
children 504899860e66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
54
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
1 #include <stdio.h>
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
2 #include <stdlib.h>
70
178459e03f5c *** empty log message ***
gongo
parents: 55
diff changeset
3 #include "types.h"
54
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
4 #include "DmaBuffer.h"
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
5
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
6 DmaBuffer::DmaBuffer(int size)
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
7 {
86
61bacd3b4405 *** empty log message ***
gongo
parents: 70
diff changeset
8 buffer[0] = malloc(size);
61bacd3b4405 *** empty log message ***
gongo
parents: 70
diff changeset
9 buffer[1] = malloc(size);
70
178459e03f5c *** empty log message ***
gongo
parents: 55
diff changeset
10
86
61bacd3b4405 *** empty log message ***
gongo
parents: 70
diff changeset
11 //posix_memalign(&buffer[0], DEFAULT_ALIGNMENT, size);
61bacd3b4405 *** empty log message ***
gongo
parents: 70
diff changeset
12 //posix_memalign(&buffer[1], DEFAULT_ALIGNMENT, size);
70
178459e03f5c *** empty log message ***
gongo
parents: 55
diff changeset
13
54
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
14 flag = 0;
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
15 }
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
16
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
17 DmaBuffer::~DmaBuffer(void)
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
18 {
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
19 free(buffer[0]);
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
20 free(buffer[1]);
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
21 }
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
22
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
23 void
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
24 DmaBuffer::swap_buffer(void)
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
25 {
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
26 flag ^= 1;
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
27 }
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
28
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
29 void
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
30 DmaBuffer::get_buffer(void *_dst)
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
31 {
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
32 void **dst = (void**)_dst;
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
33 *dst = buffer[flag];
90523ccc4dff *** empty log message ***
gongo
parents:
diff changeset
34 }