/* Adds a region of memory to the descriptor ring. Note that it may take multiple descriptors for each region of memory. It is the callers responsibility to allocate a sufficiently large descriptor ring. */
int dma_add_descriptors(DMA_DescriptorRing_t *ring, DMA_Device_t device, dma_addr_t srcData, dma_addr_t dstData, size_t numBytes)
/* Adds a region of memory to the descriptor ring. Note that it may take multiple descriptors for each region of memory. It is the callers responsibility to allocate a sufficiently large descriptor ring. */
int dma_add_descriptors(DMA_DescriptorRing_t *ring, DMA_Device_t device, dma_addr_t srcData, dma_addr_t dstData, size_t numBytes)
{
	int rc;
	DMA_DeviceAttribute_t *devAttr;
	if (!IsDeviceValid(device)) {
		return -ENODEV;
	}
	devAttr = &DMA_gDeviceAttribute[device];
	rc = dmacHw_setDataDescriptor(&devAttr->config,
				      ring->virtAddr,
				      (void *)srcData,
				      (void *)dstData, numBytes);
	if (rc < 0) {
		printk(KERN_ERR
		       "dma_add_descriptors: dmacHw_setDataDescriptor failed with code: %d\n",
		       rc);
		return -ENOMEM;
	}
	return 0;
}