xlnx_dp.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * xlnx_dp.h
  3. *
  4. * Copyright (C) 2015 : GreenSocs Ltd
  5. * http://www.greensocs.com/ , email: info@greensocs.com
  6. *
  7. * Developed by :
  8. * Frederic Konrad <fred.konrad@greensocs.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with this program; if not, see <http://www.gnu.org/licenses/>.
  22. */
  23. #ifndef XLNX_DP_H
  24. #define XLNX_DP_H
  25. #include "hw/sysbus.h"
  26. #include "ui/console.h"
  27. #include "hw/misc/auxbus.h"
  28. #include "hw/i2c/i2c.h"
  29. #include "hw/display/dpcd.h"
  30. #include "hw/display/i2c-ddc.h"
  31. #include "qemu/fifo8.h"
  32. #include "qemu/units.h"
  33. #include "hw/dma/xlnx_dpdma.h"
  34. #include "audio/audio.h"
  35. #include "qom/object.h"
  36. #include "hw/ptimer.h"
  37. #define AUD_CHBUF_MAX_DEPTH (32 * KiB)
  38. #define MAX_QEMU_BUFFER_SIZE (4 * KiB)
  39. #define DP_CORE_REG_OFFSET (0x0000)
  40. #define DP_CORE_REG_ARRAY_SIZE (0x3B0 >> 2)
  41. #define DP_AVBUF_REG_OFFSET (0xB000)
  42. #define DP_AVBUF_REG_ARRAY_SIZE (0x238 >> 2)
  43. #define DP_VBLEND_REG_OFFSET (0xA000)
  44. #define DP_VBLEND_REG_ARRAY_SIZE (0x1E0 >> 2)
  45. #define DP_AUDIO_REG_OFFSET (0xC000)
  46. #define DP_AUDIO_REG_ARRAY_SIZE (0x50 >> 2)
  47. #define DP_CONTAINER_SIZE (0xC050)
  48. struct PixmanPlane {
  49. pixman_format_code_t format;
  50. DisplaySurface *surface;
  51. };
  52. struct XlnxDPState {
  53. /*< private >*/
  54. SysBusDevice parent_obj;
  55. /* < public >*/
  56. MemoryRegion container;
  57. uint32_t core_registers[DP_CORE_REG_ARRAY_SIZE];
  58. MemoryRegion core_iomem;
  59. uint32_t avbufm_registers[DP_AVBUF_REG_ARRAY_SIZE];
  60. MemoryRegion avbufm_iomem;
  61. uint32_t vblend_registers[DP_VBLEND_REG_ARRAY_SIZE];
  62. MemoryRegion vblend_iomem;
  63. uint32_t audio_registers[DP_AUDIO_REG_ARRAY_SIZE];
  64. MemoryRegion audio_iomem;
  65. QemuConsole *console;
  66. /*
  67. * This is the planes used to display in console. When the blending is
  68. * enabled bout_plane is displayed in console else it's g_plane.
  69. */
  70. struct PixmanPlane g_plane;
  71. struct PixmanPlane v_plane;
  72. struct PixmanPlane bout_plane;
  73. QEMUSoundCard aud_card;
  74. SWVoiceOut *amixer_output_stream;
  75. int16_t audio_buffer_0[AUD_CHBUF_MAX_DEPTH];
  76. int16_t audio_buffer_1[AUD_CHBUF_MAX_DEPTH];
  77. size_t audio_data_available[2];
  78. int64_t temp_buffer[AUD_CHBUF_MAX_DEPTH];
  79. int16_t out_buffer[AUD_CHBUF_MAX_DEPTH];
  80. size_t byte_left; /* byte available in out_buffer. */
  81. size_t data_ptr; /* next byte to be sent to QEMU. */
  82. /* Associated DPDMA controller. */
  83. XlnxDPDMAState *dpdma;
  84. qemu_irq irq;
  85. AUXBus *aux_bus;
  86. Fifo8 rx_fifo;
  87. Fifo8 tx_fifo;
  88. /*
  89. * XXX: This should be in an other module.
  90. */
  91. DPCDState *dpcd;
  92. I2CDDCState *edid;
  93. ptimer_state *vblank;
  94. };
  95. #define TYPE_XLNX_DP "xlnx.v-dp"
  96. OBJECT_DECLARE_SIMPLE_TYPE(XlnxDPState, XLNX_DP)
  97. #endif