bcm2836_control.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Raspberry Pi emulation (c) 2012 Gregory Estrade
  3. * Upstreaming code cleanup [including bcm2835_*] (c) 2013 Jan Petrous
  4. *
  5. * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft
  6. * Written by Andrew Baumann
  7. *
  8. * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti
  9. * Added basic IRQ_TIMER interrupt support
  10. *
  11. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  12. * See the COPYING file in the top-level directory.
  13. */
  14. #ifndef BCM2836_CONTROL_H
  15. #define BCM2836_CONTROL_H
  16. #include "hw/sysbus.h"
  17. #include "qemu/timer.h"
  18. #include "qom/object.h"
  19. /* 4 mailboxes per core, for 16 total */
  20. #define BCM2836_NCORES 4
  21. #define BCM2836_MBPERCORE 4
  22. #define TYPE_BCM2836_CONTROL "bcm2836-control"
  23. OBJECT_DECLARE_SIMPLE_TYPE(BCM2836ControlState, BCM2836_CONTROL)
  24. struct BCM2836ControlState {
  25. /*< private >*/
  26. SysBusDevice busdev;
  27. /*< public >*/
  28. MemoryRegion iomem;
  29. /* mailbox state */
  30. uint32_t mailboxes[BCM2836_NCORES * BCM2836_MBPERCORE];
  31. /* interrupt routing/control registers */
  32. uint8_t route_gpu_irq, route_gpu_fiq;
  33. uint32_t timercontrol[BCM2836_NCORES];
  34. uint32_t mailboxcontrol[BCM2836_NCORES];
  35. /* interrupt status regs (derived from input pins; not visible to user) */
  36. bool gpu_irq, gpu_fiq;
  37. uint8_t timerirqs[BCM2836_NCORES];
  38. /* local timer */
  39. QEMUTimer timer;
  40. uint32_t local_timer_control;
  41. uint8_t route_localtimer;
  42. /* interrupt source registers, post-routing (also input-derived; visible) */
  43. uint32_t irqsrc[BCM2836_NCORES];
  44. uint32_t fiqsrc[BCM2836_NCORES];
  45. /* outputs to CPU cores */
  46. qemu_irq irq[BCM2836_NCORES];
  47. qemu_irq fiq[BCM2836_NCORES];
  48. };
  49. #endif