sifive_pdma.h (1664B)
1/* 2 * SiFive Platform DMA emulation 3 * 4 * Copyright (c) 2020 Wind River Systems, Inc. 5 * 6 * Author: 7 * Bin Meng <bin.meng@windriver.com> 8 * 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. 13 * 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. 18 * 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/>. 21 */ 22 23#ifndef SIFIVE_PDMA_H 24#define SIFIVE_PDMA_H 25 26struct sifive_pdma_chan { 27 uint32_t control; 28 uint32_t next_config; 29 uint64_t next_bytes; 30 uint64_t next_dst; 31 uint64_t next_src; 32 uint32_t exec_config; 33 uint64_t exec_bytes; 34 uint64_t exec_dst; 35 uint64_t exec_src; 36 int state; 37}; 38 39#define SIFIVE_PDMA_CHANS 4 40#define SIFIVE_PDMA_IRQS (SIFIVE_PDMA_CHANS * 2) 41#define SIFIVE_PDMA_REG_SIZE 0x100000 42#define SIFIVE_PDMA_CHAN_NO(reg) ((reg & (SIFIVE_PDMA_REG_SIZE - 1)) >> 12) 43 44typedef struct SiFivePDMAState { 45 SysBusDevice parent; 46 MemoryRegion iomem; 47 qemu_irq irq[SIFIVE_PDMA_IRQS]; 48 49 struct sifive_pdma_chan chan[SIFIVE_PDMA_CHANS]; 50} SiFivePDMAState; 51 52#define TYPE_SIFIVE_PDMA "sifive.pdma" 53 54#define SIFIVE_PDMA(obj) \ 55 OBJECT_CHECK(SiFivePDMAState, (obj), TYPE_SIFIVE_PDMA) 56 57#endif /* SIFIVE_PDMA_H */