/* Set the callback function which will be called when a transfer completes. If a NULL callback function is set, then no callback will occur. */
int dma_set_device_handler(DMA_Device_t dev, DMA_DeviceHandler_t devHandler, void *userData)
/* Set the callback function which will be called when a transfer completes. If a NULL callback function is set, then no callback will occur. */
int dma_set_device_handler(DMA_Device_t dev, DMA_DeviceHandler_t devHandler, void *userData)
{
	DMA_DeviceAttribute_t *devAttr;
	unsigned long flags;
	if (!IsDeviceValid(dev)) {
		return -ENODEV;
	}
	devAttr = &DMA_gDeviceAttribute[dev];
	local_irq_save(flags);
	devAttr->userData = userData;
	devAttr->devHandler = devHandler;
	local_irq_restore(flags);
	return 0;
}