Drivers for the MNT ZZ9000 graphics and ARM coprocessor card for classic Amigas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

245 lines
6.6 KiB

  1. /*
  2. * MNT ZZ9000 Amiga Graphics Card Driver (ZZ9000.card)
  3. * Copyright (C) 2016-2019, Lukas F. Hartmann <lukas@mntre.com>
  4. * MNT Research GmbH, Berlin
  5. * https://mntre.com
  6. *
  7. * More Info: https://mntre.com/zz9000
  8. *
  9. * SPDX-License-Identifier: GPL-3.0-or-later
  10. * GNU General Public License v3.0 or later
  11. *
  12. * https://spdx.org/licenses/GPL-3.0-or-later.html
  13. */
  14. #define uint8_t unsigned char
  15. #define uint16_t unsigned short
  16. #define uint32_t unsigned long
  17. #define u16 uint16_t
  18. #define u32 uint32_t
  19. #define MNTVA_COLOR_8BIT 0
  20. #define MNTVA_COLOR_16BIT565 1
  21. #define MNTVA_COLOR_32BIT 2
  22. #define MNTVA_COLOR_15BIT 3
  23. typedef volatile struct MNTZZ9KRegs {
  24. u16 fw_version; // 00
  25. u16 mode; // 02
  26. u16 config; // 04 misc config bits
  27. u16 sprite_x; // 06
  28. u16 sprite_y; // 08
  29. u16 pan_ptr_hi; // 0a
  30. u16 pan_ptr_lo; // 0c
  31. u16 videocap_vmode; // 0e
  32. u16 blitter_x1; // 10
  33. u16 blitter_y1; // 12
  34. u16 blitter_x2; // 14
  35. u16 blitter_y2; // 16
  36. u16 blitter_row_pitch; // 18 destination pitch
  37. u16 blitter_x3; // 1a
  38. u16 blitter_y3; // 1c
  39. u16 blitter_rgb_hi; // 1e
  40. u16 blitter_rgb_lo; // 20
  41. u16 blitter_op_fillrect; // 22
  42. u16 blitter_op_copyrect; // 24
  43. u16 blitter_op_filltemplate; // 26
  44. u16 blitter_src_hi; // 28
  45. u16 blitter_src_lo; // 2a
  46. u16 blitter_dst_hi; // 2c
  47. u16 blitter_dst_lo; // 2e
  48. u16 blitter_colormode; // 30 destination colormode
  49. u16 blitter_src_pitch; // 32
  50. u16 blitter_rgb2_hi; // 34 background/secondary color
  51. u16 blitter_rgb2_lo; // 36
  52. u16 blitter_op_p2c; // 38
  53. u16 blitter_op_draw_line; // 3a
  54. u16 blitter_op_p2d; // 3c
  55. u16 blitter_op_invertrect; // 3e
  56. // Reusing other register-accessible variables was getting a bit cluttered, and somewhat
  57. // of a coding hazard. Four additional user values should help for the time being.
  58. u16 blitter_user1; // 40
  59. u16 blitter_user2; // 42
  60. u16 blitter_user3; // 44
  61. u16 blitter_user4; // 46
  62. u16 sprite_bitmap; // 48
  63. u16 sprite_colors; // 4a
  64. u16 vblank_status; // 4c
  65. u16 un_3[0x17]; // 4e..7e
  66. u16 eth_tx; // 80
  67. u16 eth_rx; // 82
  68. u16 un_4[6]; // 84,86,88,8a,8c,8e
  69. u16 arm_run_hi; // 90
  70. u16 arm_run_lo; // 92
  71. u16 arm_argc; // 94
  72. u16 arm_arg[8]; // 96,98,9a,9c..a4
  73. u16 un_5[5]; // a6..ae
  74. u16 arm_event_serial; // b0
  75. u16 arm_event_code; // b2
  76. } MNTZZ9KRegs;
  77. typedef volatile struct MNTZZ9KCXRegs {
  78. u16 video_control_data_hi; // 00
  79. u16 video_control_data_lo; // 02
  80. u16 video_control_op; // 04
  81. u16 videocap_mode; // 06
  82. } MNTZZ9KCXRegs;
  83. enum zz_reg_offsets {
  84. REG_ZZ_HW_VERSION = 0x00,
  85. REG_ZZ_MODE = 0x02,
  86. REG_ZZ_CONFIG = 0x04,
  87. REG_ZZ_SPRITE_X = 0x06,
  88. REG_ZZ_SPRITE_Y = 0x08,
  89. REG_ZZ_PAN_HI = 0x0A,
  90. REG_ZZ_PAN_LO = 0x0C,
  91. REG_ZZ_VCAP_MODE = 0x0E,
  92. REG_ZZ_X1 = 0x10,
  93. REG_ZZ_Y1 = 0x12,
  94. REG_ZZ_X2 = 0x14,
  95. REG_ZZ_Y2 = 0x16,
  96. REG_ZZ_ROW_PITCH = 0x18,
  97. REG_ZZ_X3 = 0x1A,
  98. REG_ZZ_Y3 = 0x1C,
  99. REG_ZZ_RGB_HI = 0x1E,
  100. REG_ZZ_RGB_LO = 0x20,
  101. REG_ZZ_FILLRECT = 0x22,
  102. REG_ZZ_COPYRECT = 0x24,
  103. REG_ZZ_FILLTEMPLATE = 0x26,
  104. REG_ZZ_BLIT_SRC_HI = 0x28,
  105. REG_ZZ_BLIT_SRC_LO = 0x2A,
  106. REG_ZZ_BLIT_DST_HI = 0x2C,
  107. REG_ZZ_BLIT_DST_LO = 0x2E,
  108. REG_ZZ_COLORMODE = 0x30,
  109. REG_ZZ_SRC_PITCH = 0x32,
  110. REG_ZZ_RGB2_HI = 0x34,
  111. REG_ZZ_RGB2_LO = 0x36,
  112. REG_ZZ_P2C = 0x38,
  113. REG_ZZ_DRAWLINE = 0x3A,
  114. REG_ZZ_P2D = 0x3C,
  115. REG_ZZ_INVERTRECT = 0x3E,
  116. REG_ZZ_USER1 = 0x40,
  117. REG_ZZ_USER2 = 0x42,
  118. REG_ZZ_USER3 = 0x44,
  119. REG_ZZ_USER4 = 0x46,
  120. REG_ZZ_SPRITE_BITMAP = 0x48,
  121. REG_ZZ_SPRITE_COLORS = 0x4A,
  122. REG_ZZ_VBLANK_STATUS = 0x4C,
  123. REG_ZZ_UNUSED_REG4E = 0x4E,
  124. REG_ZZ_UNUSED_REG50 = 0x50,
  125. REG_ZZ_UNUSED_REG52 = 0x52,
  126. REG_ZZ_UNUSED_REG54 = 0x54,
  127. REG_ZZ_UNUSED_REG56 = 0x56,
  128. REG_ZZ_UNUSED_REG58 = 0x58,
  129. REG_ZZ_UNUSED_REG5A = 0x5A,
  130. REG_ZZ_UNUSED_REG5C = 0x5C,
  131. REG_ZZ_UNUSED_REG5E = 0x5E,
  132. REG_ZZ_UNUSED_REG60 = 0x60,
  133. REG_ZZ_UNUSED_REG62 = 0x62,
  134. REG_ZZ_UNUSED_REG64 = 0x64,
  135. REG_ZZ_UNUSED_REG66 = 0x66,
  136. REG_ZZ_UNUSED_REG68 = 0x68,
  137. REG_ZZ_UNUSED_REG6A = 0x6A,
  138. REG_ZZ_UNUSED_REG6C = 0x6C,
  139. REG_ZZ_UNUSED_REG6E = 0x6E,
  140. REG_ZZ_UNUSED_REG70 = 0x70,
  141. REG_ZZ_UNUSED_REG72 = 0x72,
  142. REG_ZZ_UNUSED_REG74 = 0x74,
  143. REG_ZZ_UNUSED_REG76 = 0x76,
  144. REG_ZZ_UNUSED_REG78 = 0x78,
  145. REG_ZZ_UNUSED_REG7A = 0x7A,
  146. REG_ZZ_UNUSED_REG7C = 0x7C,
  147. REG_ZZ_UNUSED_REG7E = 0x7E,
  148. REG_ZZ_ETH_TX = 0x80,
  149. REG_ZZ_ETH_RX = 0x82,
  150. REG_ZZ_ETH_MAC_HI = 0x84,
  151. REG_ZZ_ETH_MAC_HI2 = 0x86,
  152. REG_ZZ_ETH_MAC_LO = 0x88,
  153. REG_ZZ_UNUSED_REG8A = 0x8A,
  154. REG_ZZ_UNUSED_REG8C = 0x8C,
  155. REG_ZZ_UNUSED_REG8E = 0x8E,
  156. REG_ZZ_ARM_RUN_HI = 0x90,
  157. REG_ZZ_ARM_RUN_LO = 0x92,
  158. REG_ZZ_ARM_ARGC = 0x94,
  159. REG_ZZ_ARM_ARGV0 = 0x96,
  160. REG_ZZ_ARM_ARGV1 = 0x98,
  161. REG_ZZ_ARM_ARGV2 = 0x9A,
  162. REG_ZZ_ARM_ARGV3 = 0x9C,
  163. REG_ZZ_ARM_ARGV4 = 0x9E,
  164. REG_ZZ_ARM_ARGV5 = 0xA0,
  165. REG_ZZ_ARM_ARGV6 = 0xA2,
  166. REG_ZZ_ARM_ARGV7 = 0xA4,
  167. REG_ZZ_UNUSED_REGA6 = 0xA6,
  168. REG_ZZ_UNUSED_REGA8 = 0xA8,
  169. REG_ZZ_UNUSED_REGAA = 0xAA,
  170. REG_ZZ_UNUSED_REGAC = 0xAC,
  171. REG_ZZ_UNUSED_REGAE = 0xAE,
  172. REG_ZZ_ARM_EV_SERIAL = 0xB0,
  173. REG_ZZ_ARM_EV_CODE = 0xB2,
  174. REG_ZZ_UNUSED_REGB4 = 0xB4,
  175. REG_ZZ_UNUSED_REGB6 = 0xB6,
  176. REG_ZZ_UNUSED_REGB8 = 0xB8,
  177. REG_ZZ_UNUSED_REGBA = 0xBA,
  178. REG_ZZ_UNUSED_REGBC = 0xBC,
  179. REG_ZZ_UNUSED_REGBE = 0xBE,
  180. REG_ZZ_FW_VERSION = 0xC0,
  181. REG_ZZ_UNUSED_REGC2 = 0xC2,
  182. REG_ZZ_UNUSED_REGC4 = 0xC4,
  183. REG_ZZ_UNUSED_REGC6 = 0xC6,
  184. REG_ZZ_UNUSED_REGC8 = 0xC8,
  185. REG_ZZ_UNUSED_REGCA = 0xCA,
  186. REG_ZZ_UNUSED_REGCC = 0xCC,
  187. REG_ZZ_UNUSED_REGCE = 0xCE,
  188. REG_ZZ_USBBLK_TX_HI = 0xD0,
  189. REG_ZZ_USBBLK_TX_LO = 0xD2,
  190. REG_ZZ_USBBLK_RX_HI = 0xD4,
  191. REG_ZZ_USBBLK_RX_LO = 0xD6,
  192. REG_ZZ_USB_STATUS = 0xD8,
  193. REG_ZZ_USB_BUFSEL = 0xDA,
  194. REG_ZZ_USB_CAPACITY = 0xDC,
  195. REG_ZZ_UNUSED_REGDE = 0xDE,
  196. REG_ZZ_UNUSED_REGE0 = 0xE0,
  197. REG_ZZ_UNUSED_REGE2 = 0xE2,
  198. REG_ZZ_UNUSED_REGE4 = 0xE4,
  199. REG_ZZ_UNUSED_REGE6 = 0xE6,
  200. REG_ZZ_UNUSED_REGE8 = 0xE8,
  201. REG_ZZ_UNUSED_REGEA = 0xEA,
  202. REG_ZZ_UNUSED_REGEC = 0xEC,
  203. REG_ZZ_UNUSED_REGEE = 0xEE,
  204. REG_ZZ_UNUSED_REGF0 = 0xF0,
  205. REG_ZZ_UNUSED_REGF2 = 0xF2,
  206. REG_ZZ_UNUSED_REGF4 = 0xF4,
  207. REG_ZZ_UNUSED_REGF6 = 0xF6,
  208. REG_ZZ_UNUSED_REGF8 = 0xF8,
  209. REG_ZZ_UNUSED_REGFA = 0xFA,
  210. REG_ZZ_DEBUG = 0xFC,
  211. REG_ZZ_UNUSED_REGFE = 0xFE,
  212. };