/* Note: This function will release the descriptor memory for any current descriptor ring associated with this device. */
int dma_set_device_descriptor_ring(DMA_Device_t device, DMA_DescriptorRing_t *ring)
/* Note: This function will release the descriptor memory for any current descriptor ring associated with this device. */
int dma_set_device_descriptor_ring(DMA_Device_t device, DMA_DescriptorRing_t *ring)
{
	DMA_DeviceAttribute_t *devAttr;
	if (!IsDeviceValid(device)) {
		return -ENODEV;
	}
	devAttr = &DMA_gDeviceAttribute[device];
	dma_free_descriptor_ring(&devAttr->ring);
	if (ring != NULL) {
		devAttr->ring = *ring;
	}
	devAttr->prevSrcData = 0;
	devAttr->prevDstData = 0;
	devAttr->prevNumBytes = 0;
	return 0;
}