[Sound-open-firmware] [PATCH] dma: change dma transfer type to enum.
Keyon Jie
yang.jie at linux.intel.com
Wed Mar 7 12:04:31 CET 2018
Change to use enum for dma transfer type.
Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
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 c2d6917..49f782d 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 06b2d9c..d2064e8 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 f82b533..247bcbf 100644
--- a/src/include/reef/dma.h
+++ b/src/include/reef/dma.h
@@ -38,13 +38,15 @@
#include <reef/reef.h>
#include <reef/wait.h>
-/* 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 */
--
2.14.1
More information about the Sound-open-firmware
mailing list