Mercurial > hg > Members > kono > Cerium
view TaskManager/kernel/ppe/DmaBuffer.cc @ 70:178459e03f5c
*** empty log message ***
author | gongo |
---|---|
date | Mon, 18 Feb 2008 01:13:00 +0900 |
parents | 9a9c7bef1988 |
children | 61bacd3b4405 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "types.h" #include "DmaBuffer.h" DmaBuffer::DmaBuffer(int size) { //buffer[0] = malloc(size); //buffer[1] = malloc(size); posix_memalign(&buffer[0], DEFAULT_ALIGNMENT, size); posix_memalign(&buffer[1], DEFAULT_ALIGNMENT, 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]; }