zynq-xadc.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Device model for Zynq ADC controller
  3. *
  4. * Copyright (c) 2015 Guenter Roeck <linux@roeck-us.net>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. *
  11. * You should have received a copy of the GNU General Public License along
  12. * with this program; if not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef ZYNQ_XADC_H
  15. #define ZYNQ_XADC_H
  16. #include "hw/sysbus.h"
  17. #include "qom/object.h"
  18. #define ZYNQ_XADC_MMIO_SIZE 0x0020
  19. #define ZYNQ_XADC_NUM_IO_REGS (ZYNQ_XADC_MMIO_SIZE / 4)
  20. #define ZYNQ_XADC_NUM_ADC_REGS 128
  21. #define ZYNQ_XADC_FIFO_DEPTH 15
  22. #define TYPE_ZYNQ_XADC "xlnx-zynq-xadc"
  23. OBJECT_DECLARE_SIMPLE_TYPE(ZynqXADCState, ZYNQ_XADC)
  24. struct ZynqXADCState {
  25. /*< private >*/
  26. SysBusDevice parent_obj;
  27. /*< public >*/
  28. MemoryRegion iomem;
  29. uint32_t regs[ZYNQ_XADC_NUM_IO_REGS];
  30. uint16_t xadc_regs[ZYNQ_XADC_NUM_ADC_REGS];
  31. uint16_t xadc_read_reg_previous;
  32. uint16_t xadc_dfifo[ZYNQ_XADC_FIFO_DEPTH];
  33. uint16_t xadc_dfifo_entries;
  34. struct IRQState *qemu_irq;
  35. };
  36. #endif /* ZYNQ_XADC_H */