Newer
Older
barebox / arch / mips / include / asm / dma-mapping.h
@Antony Pavlov Antony Pavlov on 4 Jul 2014 442 bytes MIPS: add dma_alloc_coherent()
#ifndef _ASM_DMA_MAPPING_H
#define _ASM_DMA_MAPPING_H

#include <xfuncs.h>
#include <asm/addrspace.h>
#include <asm/types.h>
#include <malloc.h>

static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle)
{
	void *ret;

	ret = xmemalign(PAGE_SIZE, size);

	*dma_handle = CPHYSADDR(ret);

	return (void *)CKSEG1ADDR(ret);
}

static inline void dma_free_coherent(void *vaddr)
{
	free(vaddr);
}

#endif /* _ASM_DMA_MAPPING_H */