diff options
Diffstat (limited to 'snd-alpx/alpx_axcmem.c')
-rw-r--r-- | snd-alpx/alpx_axcmem.c | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/snd-alpx/alpx_axcmem.c b/snd-alpx/alpx_axcmem.c deleted file mode 100644 index 4966b10..0000000 --- a/snd-alpx/alpx_axcmem.c +++ /dev/null @@ -1,129 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* -* Support for Digigram AlpX PCI-e boards -* -* Copyright (c) 2024 Digigram Digital (info@digigram.com) -*/ - -#include "alpx_axcmem.h" - -#include <linux/module.h> -#include <linux/printk.h> -#include <asm/byteorder.h> - -/* Items sizes in bytes*/ -static const unsigned int AXCMEM_PAGE_SIZE = 32; -static const unsigned int AXCMEM_LINE_SIZE = 4; - -/* AxCMem area offset */ -static const uint32_t AXCMEM_AREA_OFFSET = 0x72000; - - -void* alpx_axcmem_getRegAddr(struct alpx_device* alp, - const struct alpx_axcmem_loc* loc) -{ - dev_dbg(alp->dev," BAR:%p, loc{%d:%d:%d}\n", - alp->base, - loc->page, loc->line, loc->row); - - return (uint8_t*)alp->base + - AXCMEM_AREA_OFFSET + - loc->page * AXCMEM_PAGE_SIZE + - loc->line * AXCMEM_LINE_SIZE + - loc->row; -} - -void* alpx_axcmem_getPointedRegAddrByRefLoc(struct alpx_device* alp, - const struct alpx_axcmem_loc* ref_loc, - const struct alpx_axcmem_loc* loc) -{ - void* const ref_reg_addr = alpx_axcmem_getRegAddr(alp, ref_loc); - - dev_dbg(alp->dev, "BAR:%p, base:%p=>%d, loc{%d:%d:%d}\n", - alp->base, ref_reg_addr, alpx_axcmem_getRegU8Value(ref_reg_addr), - loc->page, loc->line, loc->row); - - return (uint8_t*)alp->base + AXCMEM_AREA_OFFSET + alpx_axcmem_getRegU8Value(ref_reg_addr) * AXCMEM_PAGE_SIZE + - loc->page * AXCMEM_PAGE_SIZE + - loc->line * AXCMEM_LINE_SIZE + - loc->row; -} - -int alpx_acxmem_getByteArrayByRefLoc(struct alpx_device* alp, - const struct alpx_axcmem_loc* ref_loc, - const struct alpx_axcmem_loc* loc, - unsigned char* dst, - unsigned int length) -{ - unsigned int idx = 0; - const unsigned char* src = NULL; - - if ((alp == NULL) || - (ref_loc == NULL) || - (loc == NULL) || - (dst == NULL)) { - return -EINVAL; - } - - if (length == 0) - return 0; - - src = (unsigned char*) alpx_axcmem_getPointedRegAddrByRefLoc(alp, ref_loc, loc); - - for (idx = 0 ; idx < length ; ++idx) { - dst[idx] = src[idx]; - dev_dbg(alp->dev, " src[%d]: 0x%02x => dst[%d]: 0x%02x\n", idx, src[idx], idx, dst[idx]); - } - - return 0; -} - -uint32_t alpx_axcmem_getRegU8Value_ptr(void* addr) -{ - return alpx_axcmem_getRegU8Value(addr); -} - -void alpx_axcmem_setRegU8Value_ptr(void* addr, uint32_t value) -{ - alpx_axcmem_setRegU8Value(addr, value); -} - -uint32_t alpx_axcmem_getRegU16Value_ptr(void* addr) -{ - return alpx_axcmem_getRegU16Value(addr); -} - -void alpx_axcmem_setRegU16Value_ptr(void* addr, uint32_t value) -{ - alpx_axcmem_setRegU16Value(addr, value); -} - -uint32_t alpx_axcmem_getRegBEU16Value_ptr(void* addr) -{ - return alpx_axcmem_getRegBEU16Value(addr); -} - -void alpx_axcmem_setRegBEU16Value_ptr(void* addr, uint32_t value) -{ - alpx_axcmem_setRegBEU16Value(addr, value); -} - -uint32_t alpx_axcmem_getRegU32Value_ptr(void* addr) -{ - return alpx_axcmem_getRegU32Value(addr); -} - -void alpx_axcmem_setRegU32Value_ptr(void* addr, uint32_t value) -{ - alpx_axcmem_setRegU32Value(addr, value); -} - -uint32_t alpx_axcmem_getRegBEU32Value_ptr(void* addr) -{ - return alpx_axcmem_getRegBEU32Value(addr); -} - -void alpx_axcmem_setRegBEU32Value_ptr(void* addr, uint32_t value) -{ - alpx_axcmem_setRegBEU32Value(addr, value); -} |