Mercurial > hg > Members > kono > Cerium
diff TaskManager/kernel/ppe/DmaBuffer.cc @ 54:90523ccc4dff
*** empty log message ***
author | gongo |
---|---|
date | Sat, 16 Feb 2008 14:38:36 +0900 |
parents | |
children | 9a9c7bef1988 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/kernel/ppe/DmaBuffer.cc Sat Feb 16 14:38:36 2008 +0900 @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <stdlib.h> +#include "DmaBuffer.h" + +DmaBuffer::DmaBuffer(int size) +// :(buffer[0])(buf1), (buffer[1])(buf2), flag(0) {}; +{ + buffer[0] = malloc(size); + buffer[1] = malloc(size); + flag = 0; +} + +DmaBuffer::~DmaBuffer(void) +{ + free(buffer[0]); + free(buffer[1]); +} + +void +DmaBuffer::swap_buffer(void) +{ + flag ^= 1; +} + +void +DmaBuffer::get_buffer(void *_dst) +{ + void **dst = (void**)_dst; + *dst = buffer[flag]; +}