include: Include headers where needed
[qemu.git] / include / hw / dma / sifive_pdma.h
blob8c6cfa7f32509e22e7b3a1c573e54b126dad1a40
1 /*
2 * SiFive Platform DMA emulation
4 * Copyright (c) 2020 Wind River Systems, Inc.
6 * Author:
7 * Bin Meng <bin.meng@windriver.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 or
12 * (at your option) version 3 of the License.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <http://www.gnu.org/licenses/>.
23 #ifndef SIFIVE_PDMA_H
24 #define SIFIVE_PDMA_H
26 #include "hw/sysbus.h"
28 struct sifive_pdma_chan {
29 uint32_t control;
30 uint32_t next_config;
31 uint64_t next_bytes;
32 uint64_t next_dst;
33 uint64_t next_src;
34 uint32_t exec_config;
35 uint64_t exec_bytes;
36 uint64_t exec_dst;
37 uint64_t exec_src;
38 int state;
41 #define SIFIVE_PDMA_CHANS 4
42 #define SIFIVE_PDMA_IRQS (SIFIVE_PDMA_CHANS * 2)
43 #define SIFIVE_PDMA_REG_SIZE 0x100000
44 #define SIFIVE_PDMA_CHAN_NO(reg) ((reg & (SIFIVE_PDMA_REG_SIZE - 1)) >> 12)
46 typedef struct SiFivePDMAState {
47 SysBusDevice parent;
48 MemoryRegion iomem;
49 qemu_irq irq[SIFIVE_PDMA_IRQS];
51 struct sifive_pdma_chan chan[SIFIVE_PDMA_CHANS];
52 } SiFivePDMAState;
54 #define TYPE_SIFIVE_PDMA "sifive.pdma"
56 #define SIFIVE_PDMA(obj) \
57 OBJECT_CHECK(SiFivePDMAState, (obj), TYPE_SIFIVE_PDMA)
59 #endif /* SIFIVE_PDMA_H */