/* Do not check arguments before starting the DMA memcpy. Break the transfer up into two pieces. The first transfer is in multiples of 64k and the second transfer is the piece smaller than 64k.  */
void* dma_memcpy(void *pdst, const void *psrc, size_t size)
/* Do not check arguments before starting the DMA memcpy. Break the transfer up into two pieces. The first transfer is in multiples of 64k and the second transfer is the piece smaller than 64k.  */
void* dma_memcpy(void *pdst, const void *psrc, size_t size)
{
	unsigned long dst = (unsigned long)pdst;
	unsigned long src = (unsigned long)psrc;
	size_t bulk, rest;
	if (bfin_addr_dcacheable(src))
		blackfin_dcache_flush_range(src, src + size);
	if (bfin_addr_dcacheable(dst))
		blackfin_dcache_invalidate_range(dst, dst + size);
	bulk = size & ~0xffff;
	rest = size - bulk;
	if (bulk)
		_dma_memcpy(pdst, psrc, bulk);
	_dma_memcpy(pdst + bulk, psrc + bulk, rest);
	return pdst;
}