/* Maps in a memory region such that it can be used for performing a DMA. */
int dma_map_mem(DMA_MemMap_t *memMap, void *mem, size_t numBytes, enum dma_data_direction dir)
/* Maps in a memory region such that it can be used for performing a DMA. */
int dma_map_mem(DMA_MemMap_t *memMap, void *mem, size_t numBytes, enum dma_data_direction dir)
{
	int rc;
	rc = dma_map_start(memMap, dir);
	if (rc == 0) {
		rc = dma_map_add_region(memMap, mem, numBytes);
		if (rc < 0) {
			dma_unmap(memMap, 0);
		}
	}
	return rc;
}