hw/dma: Implement a Xilinx CSU DMA model
[qemu/ar7.git] / include / hw / dma / xlnx_csu_dma.h
blob204d94c6737543aa18620578d2eefa332d71bd40
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 #define TYPE_XLNX_CSU_DMA "xlnx.csu_dma"
26 #define XLNX_CSU_DMA_R_MAX (0x2c / 4)
28 typedef struct XlnxCSUDMA {
29 SysBusDevice busdev;
30 MemoryRegion iomem;
31 MemTxAttrs attr;
32 MemoryRegion *dma_mr;
33 AddressSpace *dma_as;
34 qemu_irq irq;
35 StreamSink *tx_dev; /* Used as generic StreamSink */
36 ptimer_state *src_timer;
38 uint16_t width;
39 bool is_dst;
40 bool r_size_last_word;
42 StreamCanPushNotifyFn notify;
43 void *notify_opaque;
45 uint32_t regs[XLNX_CSU_DMA_R_MAX];
46 RegisterInfo regs_info[XLNX_CSU_DMA_R_MAX];
47 } XlnxCSUDMA;
49 #define XLNX_CSU_DMA(obj) \
50 OBJECT_CHECK(XlnxCSUDMA, (obj), TYPE_XLNX_CSU_DMA)
52 #endif