view TaskManager/kernel/ppe/DmaBuffer.cc @ 55:9a9c7bef1988

*** empty log message ***
author gongo
date Sat, 16 Feb 2008 18:54:52 +0900
parents 90523ccc4dff
children 178459e03f5c
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include "DmaBuffer.h"

DmaBuffer::DmaBuffer(int size)
{
    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];
}