2
0

macfb.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * QEMU Motorola 680x0 Macintosh Video Card Emulation
  3. * Copyright (c) 2012-2018 Laurent Vivier
  4. *
  5. * some parts from QEMU G364 framebuffer Emulator.
  6. * Copyright (c) 2007-2011 Herve Poussineau
  7. *
  8. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  9. * See the COPYING file in the top-level directory.
  10. *
  11. */
  12. #ifndef MACFB_H
  13. #define MACFB_H
  14. #include "exec/memory.h"
  15. #include "hw/irq.h"
  16. #include "hw/nubus/nubus.h"
  17. #include "hw/sysbus.h"
  18. #include "ui/console.h"
  19. #include "qemu/timer.h"
  20. typedef enum {
  21. MACFB_DISPLAY_APPLE_21_COLOR = 0,
  22. MACFB_DISPLAY_APPLE_PORTRAIT = 1,
  23. MACFB_DISPLAY_APPLE_12_RGB = 2,
  24. MACFB_DISPLAY_APPLE_2PAGE_MONO = 3,
  25. MACFB_DISPLAY_NTSC_UNDERSCAN = 4,
  26. MACFB_DISPLAY_NTSC_OVERSCAN = 5,
  27. MACFB_DISPLAY_APPLE_12_MONO = 6,
  28. MACFB_DISPLAY_APPLE_13_RGB = 7,
  29. MACFB_DISPLAY_16_COLOR = 8,
  30. MACFB_DISPLAY_PAL1_UNDERSCAN = 9,
  31. MACFB_DISPLAY_PAL1_OVERSCAN = 10,
  32. MACFB_DISPLAY_PAL2_UNDERSCAN = 11,
  33. MACFB_DISPLAY_PAL2_OVERSCAN = 12,
  34. MACFB_DISPLAY_VGA = 13,
  35. MACFB_DISPLAY_SVGA = 14,
  36. } MacfbDisplayType;
  37. typedef struct MacFbMode {
  38. uint8_t type;
  39. uint8_t depth;
  40. uint32_t mode_ctrl1;
  41. uint32_t mode_ctrl2;
  42. uint32_t width;
  43. uint32_t height;
  44. uint32_t stride;
  45. uint32_t offset;
  46. } MacFbMode;
  47. #define MACFB_CTRL_TOPADDR 0x200
  48. #define MACFB_NUM_REGS (MACFB_CTRL_TOPADDR / sizeof(uint32_t))
  49. typedef struct MacfbState {
  50. MemoryRegion mem_vram;
  51. MemoryRegion mem_ctrl;
  52. QemuConsole *con;
  53. uint8_t *vram;
  54. uint32_t vram_bit_mask;
  55. uint32_t palette_current;
  56. uint8_t color_palette[256 * 3];
  57. uint32_t width, height; /* in pixels */
  58. uint8_t depth;
  59. uint8_t type;
  60. uint32_t regs[MACFB_NUM_REGS];
  61. MacFbMode *mode;
  62. QEMUTimer *vbl_timer;
  63. qemu_irq irq;
  64. } MacfbState;
  65. #define TYPE_MACFB "sysbus-macfb"
  66. OBJECT_DECLARE_SIMPLE_TYPE(MacfbSysBusState, MACFB)
  67. struct MacfbSysBusState {
  68. SysBusDevice busdev;
  69. MacfbState macfb;
  70. };
  71. #define TYPE_NUBUS_MACFB "nubus-macfb"
  72. OBJECT_DECLARE_TYPE(MacfbNubusState, MacfbNubusDeviceClass, NUBUS_MACFB)
  73. struct MacfbNubusDeviceClass {
  74. DeviceClass parent_class;
  75. DeviceRealize parent_realize;
  76. DeviceUnrealize parent_unrealize;
  77. };
  78. struct MacfbNubusState {
  79. NubusDevice busdev;
  80. MacfbState macfb;
  81. };
  82. #endif