From 728f1ff3e32e14e19847ba513f8b0e3af80762c0 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Wed, 7 Mar 2018 19:04:31 +0800 Subject: [PATCH] dma: change dma transfer type to enum. Change to use enum for dma transfer type. Signed-off-by: Keyon Jie --- src/drivers/dw-dma.c | 2 +- src/drivers/hda-dma.c | 2 +- src/include/reef/dma.h | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c index ccefc50f3..f6f776aa1 100644 --- a/src/drivers/dw-dma.c +++ b/src/drivers/dw-dma.c @@ -249,7 +249,7 @@ /* data for each DMA channel */ struct dma_chan_data { uint32_t status; - uint32_t direction; + enum dma_copy_dir direction; struct dw_lli2 *lli; struct dw_lli2 *lli_current; uint32_t desc_count; diff --git a/src/drivers/hda-dma.c b/src/drivers/hda-dma.c index 06b2d9c87..d2064e8a1 100644 --- a/src/drivers/hda-dma.c +++ b/src/drivers/hda-dma.c @@ -84,7 +84,7 @@ struct hda_chan_data { uint32_t status; uint32_t desc_count; uint32_t desc_avail; - uint32_t direction; + enum dma_copy_dir direction; }; struct dma_pdata { diff --git a/src/include/reef/dma.h b/src/include/reef/dma.h index f82b53364..247bcbf4a 100644 --- a/src/include/reef/dma.h +++ b/src/include/reef/dma.h @@ -38,13 +38,15 @@ #include #include -/* DMA directions */ -#define DMA_DIR_MEM_TO_MEM 0 /* local memcpy */ -#define DMA_DIR_HMEM_TO_LMEM 1 /* host to local memcpy */ -#define DMA_DIR_LMEM_TO_HMEM 2 /* local to host memcpy */ -#define DMA_DIR_MEM_TO_DEV 3 -#define DMA_DIR_DEV_TO_MEM 4 -#define DMA_DIR_DEV_TO_DEV 5 +/* types of DMA directions */ +enum dma_copy_dir { + DMA_DIR_MEM_TO_MEM = 0, /* local memcpy */ + DMA_DIR_HMEM_TO_LMEM, /* host to local memcpy */ + DMA_DIR_LMEM_TO_HMEM, /* local to host memcpy */ + DMA_DIR_MEM_TO_DEV, + DMA_DIR_DEV_TO_MEM, + DMA_DIR_DEV_TO_DEV, +}; /* DMA IRQ types */ #define DMA_IRQ_TYPE_BLOCK (1 << 0) @@ -71,7 +73,7 @@ struct dma_sg_config { uint32_t src_width; /* in bytes */ uint32_t dest_width; /* in bytes */ uint32_t burst_elems; - uint32_t direction; + enum dma_copy_dir direction; uint32_t src_dev; uint32_t dest_dev; uint32_t cyclic; /* circular buffer */