From 641ddcdeec81fd38132eec5b4a83de9f7ea9a079 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 18 Nov 2015 03:26:52 +0100 Subject: Adjust IPEDMA register model to address new revision --- dma/ipe_private.h | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'dma/ipe_private.h') diff --git a/dma/ipe_private.h b/dma/ipe_private.h index fdc2d83..8f2b00b 100644 --- a/dma/ipe_private.h +++ b/dma/ipe_private.h @@ -19,20 +19,37 @@ //#define IPEDMA_DETECT_PACKETS /**< Using empty_deceted flag */ #define IPEDMA_SUPPORT_EMPTY_DETECTED /**< Avoid waiting for data when empty_detected flag is set in hardware */ +#define IPEDMA_REG_ADDR_MASK 0xFFF +#define IPEDMA_REG_BANK_MASK 0xF000 +#define IPEDMA_REG_BANK_SHIFT 24 + +#define REG2VIRT(reg) (ctx->base_addr[(reg&IPEDMA_REG_BANK_MASK)>>IPEDMA_REG_BANK_SHIFT] + (reg&IPEDMA_REG_ADDR_MASK)) +#define REG(bank, addr) ((bank<base_addr + addr) = value; } -#define RD(addr, value) { value = *(uint32_t*)(ctx->base_addr + addr); } +#define WR(addr, value) { *(uint32_t*)(REG2VIRT(addr)) = value; } +#define RD(addr, value) { value = *(uint32_t*)(REG2VIRT(addr)); } typedef struct ipe_dma_s ipe_dma_t; @@ -55,7 +72,7 @@ struct ipe_dma_s { //pcilib_dma_engine_description_t engine[2]; const pcilib_register_bank_description_t *dma_bank; - char *base_addr; + char *base_addr[3]; pcilib_irq_type_t irq_enabled; /**< indicates that IRQs are enabled */ pcilib_irq_type_t irq_preserve; /**< indicates that IRQs should not be disabled during clean-up */ -- cgit v1.2.3