sifive_pdma.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #ifndef SIFIVE_PDMA_H
  23. #define SIFIVE_PDMA_H
  24. #include "hw/sysbus.h"
  25. struct sifive_pdma_chan {
  26. uint32_t control;
  27. uint32_t next_config;
  28. uint64_t next_bytes;
  29. uint64_t next_dst;
  30. uint64_t next_src;
  31. uint32_t exec_config;
  32. uint64_t exec_bytes;
  33. uint64_t exec_dst;
  34. uint64_t exec_src;
  35. int state;
  36. };
  37. #define SIFIVE_PDMA_CHANS 4
  38. #define SIFIVE_PDMA_IRQS (SIFIVE_PDMA_CHANS * 2)
  39. #define SIFIVE_PDMA_REG_SIZE 0x100000
  40. #define SIFIVE_PDMA_CHAN_NO(reg) ((reg & (SIFIVE_PDMA_REG_SIZE - 1)) >> 12)
  41. typedef struct SiFivePDMAState {
  42. SysBusDevice parent;
  43. MemoryRegion iomem;
  44. qemu_irq irq[SIFIVE_PDMA_IRQS];
  45. struct sifive_pdma_chan chan[SIFIVE_PDMA_CHANS];
  46. } SiFivePDMAState;
  47. #define TYPE_SIFIVE_PDMA "sifive.pdma"
  48. #define SIFIVE_PDMA(obj) \
  49. OBJECT_CHECK(SiFivePDMAState, (obj), TYPE_SIFIVE_PDMA)
  50. #endif /* SIFIVE_PDMA_H */