Merge tag 'pull-target-arm-20221114' of https://git.linaro.org/people/pmaydell/qemu...
[qemu/ar7.git] / include / hw / dma / xlnx_csu_dma.h
blob922ab80eb6185ee45ece29eded7314bc14e889a7
1 /*
2 * Xilinx Platform CSU Stream DMA emulation
4 * This implementation is based on
5 * https://github.com/Xilinx/qemu/blob/master/hw/dma/csu_stream_dma.c
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 or
10 * (at your option) version 3 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef XLNX_CSU_DMA_H
22 #define XLNX_CSU_DMA_H
24 #include "hw/sysbus.h"
25 #include "hw/register.h"
26 #include "hw/ptimer.h"
27 #include "hw/stream.h"
29 #define TYPE_XLNX_CSU_DMA "xlnx.csu_dma"
31 #define XLNX_CSU_DMA_R_MAX (0x2c / 4)
33 typedef struct XlnxCSUDMA {
34 SysBusDevice busdev;
35 MemoryRegion iomem;
36 MemTxAttrs attr;
37 MemoryRegion *dma_mr;
38 AddressSpace dma_as;
39 qemu_irq irq;
40 StreamSink *tx_dev; /* Used as generic StreamSink */
41 ptimer_state *src_timer;
43 uint16_t width;
44 bool is_dst;
45 bool r_size_last_word;
47 StreamCanPushNotifyFn notify;
48 void *notify_opaque;
50 uint32_t regs[XLNX_CSU_DMA_R_MAX];
51 RegisterInfo regs_info[XLNX_CSU_DMA_R_MAX];
52 } XlnxCSUDMA;
54 OBJECT_DECLARE_TYPE(XlnxCSUDMA, XlnxCSUDMAClass, XLNX_CSU_DMA)
56 struct XlnxCSUDMAClass {
57 SysBusDeviceClass parent_class;
60 * read: Start a read transfer on a Xilinx CSU DMA engine
62 * @s: the Xilinx CSU DMA engine to start the transfer on
63 * @addr: the address to read
64 * @len: the number of bytes to read at 'addr'
66 * @return a MemTxResult indicating whether the operation succeeded ('len'
67 * bytes were read) or failed.
69 MemTxResult (*read)(XlnxCSUDMA *s, hwaddr addr, uint32_t len);
72 #endif