|
8 | 8 | #pragma once |
9 | 9 |
|
10 | 10 | #include <stdint.h> |
| 11 | +#include <stddef.h> |
11 | 12 | #include "regs/idma.h" |
12 | 13 | #include "params.h" |
13 | 14 |
|
14 | | -#define DMA_SRC_ADDR(BASE) (void *)((uint8_t *)BASE + IDMA_REG64_2D_SRC_ADDR_LOW_REG_OFFSET) |
15 | | -#define DMA_DST_ADDR(BASE) (void *)((uint8_t *)BASE + IDMA_REG64_2D_DST_ADDR_LOW_REG_OFFSET) |
16 | | -#define DMA_NUMBYTES_ADDR(BASE) (void *)((uint8_t *)BASE + IDMA_REG64_2D_LENGTH_LOW_REG_OFFSET) |
17 | | -#define DMA_CONF_ADDR(BASE) (void *)((uint8_t *)BASE + IDMA_REG64_2D_CONF_REG_OFFSET) |
18 | | -#define DMA_STATUS_ADDR(BASE) (void *)((uint8_t *)BASE + IDMA_REG64_2D_STATUS_0_REG_OFFSET) |
19 | | -#define DMA_NEXTID_ADDR(BASE) (void *)((uint8_t *)BASE + IDMA_REG64_2D_NEXT_ID_0_REG_OFFSET) |
20 | | -#define DMA_DONE_ADDR(BASE) (void *)((uint8_t *)BASE + IDMA_REG64_2D_DONE_ID_0_REG_OFFSET) |
| 15 | +#define DMA_SRC_ADDR(BASE) (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, src_addr)) |
| 16 | +#define DMA_DST_ADDR(BASE) (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, dst_addr)) |
| 17 | +#define DMA_NUMBYTES_ADDR(BASE) (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, length)) |
| 18 | +#define DMA_CONF_ADDR(BASE) (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, conf)) |
| 19 | +#define DMA_STATUS_ADDR(BASE) (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, status)) |
| 20 | +#define DMA_NEXTID_ADDR(BASE) (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, next_id)) |
| 21 | +#define DMA_DONE_ADDR(BASE) (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, done_id)) |
21 | 22 | #define DMA_SRC_STRIDE_ADDR(BASE) \ |
22 | | - (void *)((uint8_t *)BASE + IDMA_REG64_2D_SRC_STRIDE_2_LOW_REG_OFFSET) |
| 23 | + (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, dim[0].src_stride)) |
23 | 24 | #define DMA_DST_STRIDE_ADDR(BASE) \ |
24 | | - (void *)((uint8_t *)BASE + IDMA_REG64_2D_DST_STRIDE_2_LOW_REG_OFFSET) |
25 | | -#define DMA_NUM_REPS_ADDR(BASE) (void *)((uint8_t *)BASE + IDMA_REG64_2D_REPS_2_LOW_REG_OFFSET) |
| 25 | + (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, dim[0].dst_stride)) |
| 26 | +#define DMA_NUM_REPS_ADDR(BASE) (void *)((uint8_t *)BASE + offsetof(idma_reg64_2d_t, dim[0].reps)) |
26 | 27 | #define DMA_CONF_DECOUPLE_NONE (0) |
27 | | -#define DMA_CONF_DECOUPLE_AW (1 << IDMA_REG64_2D_CONF_DECOUPLE_AW_BIT) |
28 | | -#define DMA_CONF_DECOUPLE_RW (1 << IDMA_REG64_2D_CONF_DECOUPLE_RW_BIT) |
| 28 | +#define DMA_CONF_DECOUPLE_AW (1 << IDMA_REG64_2D__CONF__DECOUPLE_AW_bp) |
| 29 | +#define DMA_CONF_DECOUPLE_RW (1 << IDMA_REG64_2D__CONF__DECOUPLE_RW_bp) |
29 | 30 | #define DMA_CONF_DECOUPLE_ALL (DMA_CONF_DECOUPLE_AW | DMA_CONF_DECOUPLE_RW) |
30 | 31 |
|
31 | 32 | #define X(NAME, BASE_ADDR) \ |
|
83 | 84 | *(NAME##_dma_src_ptr()) = (uint64_t)src; \ |
84 | 85 | *(NAME##_dma_dst_ptr()) = (uint64_t)dst; \ |
85 | 86 | *(NAME##_dma_num_bytes_ptr()) = size; \ |
86 | | - *(NAME##_dma_conf_ptr()) = conf | (1 << IDMA_REG64_2D_CONF_ENABLE_ND_BIT); \ |
| 87 | + *(NAME##_dma_conf_ptr()) = conf | (1 << IDMA_REG64_2D__CONF__ENABLE_ND_bp); \ |
87 | 88 | *(NAME##_dma_src_stride_ptr()) = src_stride; \ |
88 | 89 | *(NAME##_dma_dst_stride_ptr()) = dst_stride; \ |
89 | 90 | *(NAME##_dma_num_reps_ptr()) = num_reps; \ |
|
0 commit comments