cyberfb.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:13k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * linux/arch/m68k/console/cvision.h -- CyberVision64 definitions for the
  3.  *                                      text console driver.
  4.  *
  5.  *   Copyright (c) 1998 Alan Bair
  6.  *
  7.  * This file is based on the initial port to Linux of grf_cvreg.h:
  8.  *
  9.  *   Copyright (c) 1997 Antonio Santos
  10.  *
  11.  * The original work is from the NetBSD CyberVision 64 framebuffer driver 
  12.  * and support files (grf_cv.c, grf_cvreg.h, ite_cv.c):
  13.  * Permission to use the source of this driver was obtained from the
  14.  * author Michael Teske by Alan Bair.
  15.  *
  16.  *   Copyright (c) 1995 Michael Teske
  17.  *
  18.  * History:
  19.  *
  20.  *
  21.  *
  22.  * This file is subject to the terms and conditions of the GNU General Public
  23.  * License.  See the file COPYING in the main directory of this archive
  24.  * for more details.
  25.  */
  26. /* s3 commands */
  27. #define S3_BITBLT       0xc011
  28. #define S3_TWOPOINTLINE 0x2811
  29. #define S3_FILLEDRECT   0x40b1
  30. #define S3_FIFO_EMPTY 0x0400
  31. #define S3_HDW_BUSY   0x0200
  32. /* Enhanced register mapping (MMIO mode) */
  33. #define S3_READ_SEL      0xbee8 /* offset f */
  34. #define S3_MULT_MISC     0xbee8 /* offset e */
  35. #define S3_ERR_TERM      0x92e8
  36. #define S3_FRGD_COLOR    0xa6e8
  37. #define S3_BKGD_COLOR    0xa2e8
  38. #define S3_PIXEL_CNTL    0xbee8 /* offset a */
  39. #define S3_FRGD_MIX      0xbae8
  40. #define S3_BKGD_MIX      0xb6e8
  41. #define S3_CUR_Y         0x82e8
  42. #define S3_CUR_X         0x86e8
  43. #define S3_DESTY_AXSTP   0x8ae8
  44. #define S3_DESTX_DIASTP  0x8ee8
  45. #define S3_MIN_AXIS_PCNT 0xbee8 /* offset 0 */
  46. #define S3_MAJ_AXIS_PCNT 0x96e8
  47. #define S3_CMD           0x9ae8
  48. #define S3_GP_STAT       0x9ae8
  49. #define S3_ADVFUNC_CNTL  0x4ae8
  50. #define S3_WRT_MASK      0xaae8
  51. #define S3_RD_MASK       0xaee8
  52. /* Enhanced register mapping (Packed MMIO mode, write only) */
  53. #define S3_ALT_CURXY     0x8100
  54. #define S3_ALT_CURXY2    0x8104
  55. #define S3_ALT_STEP      0x8108
  56. #define S3_ALT_STEP2     0x810c
  57. #define S3_ALT_ERR       0x8110
  58. #define S3_ALT_CMD       0x8118
  59. #define S3_ALT_MIX       0x8134
  60. #define S3_ALT_PCNT      0x8148
  61. #define S3_ALT_PAT       0x8168
  62. /* Drawing modes */
  63. #define S3_NOTCUR          0x0000
  64. #define S3_LOGICALZERO     0x0001
  65. #define S3_LOGICALONE      0x0002
  66. #define S3_LEAVEASIS       0x0003
  67. #define S3_NOTNEW          0x0004
  68. #define S3_CURXORNEW       0x0005
  69. #define S3_NOT_CURXORNEW   0x0006
  70. #define S3_NEW             0x0007
  71. #define S3_NOTCURORNOTNEW  0x0008
  72. #define S3_CURORNOTNEW     0x0009
  73. #define S3_NOTCURORNEW     0x000a
  74. #define S3_CURORNEW        0x000b
  75. #define S3_CURANDNEW       0x000c
  76. #define S3_NOTCURANDNEW    0x000d
  77. #define S3_CURANDNOTNEW    0x000e
  78. #define S3_NOTCURANDNOTNEW 0x000f
  79. #define S3_CRTC_ADR    0x03d4
  80. #define S3_CRTC_DATA   0x03d5
  81. #define S3_REG_LOCK2 0x39
  82. #define S3_HGC_MODE  0x45
  83. #define S3_HWGC_ORGX_H 0x46
  84. #define S3_HWGC_ORGX_L 0x47
  85. #define S3_HWGC_ORGY_H 0x48
  86. #define S3_HWGC_ORGY_L 0x49
  87. #define S3_HWGC_DX     0x4e
  88. #define S3_HWGC_DY     0x4f
  89. #define S3_LAW_CTL 0x58
  90. /**************************************************/
  91. /* support for a BitBlt operation. The op-codes are identical
  92.    to X11 GCs */
  93. #define GRFBBOPclear 0x0 /* 0 */
  94. #define GRFBBOPand 0x1 /* src AND dst */
  95. #define GRFBBOPandReverse 0x2 /* src AND NOT dst */
  96. #define GRFBBOPcopy 0x3 /* src */
  97. #define GRFBBOPandInverted 0x4 /* NOT src AND dst */
  98. #define GRFBBOPnoop 0x5 /* dst */
  99. #define GRFBBOPxor 0x6 /* src XOR dst */
  100. #define GRFBBOPor 0x7 /* src OR dst */
  101. #define GRFBBOPnor 0x8 /* NOT src AND NOT dst */
  102. #define GRFBBOPequiv 0x9 /* NOT src XOR dst */
  103. #define GRFBBOPinvert 0xa /* NOT dst */
  104. #define GRFBBOPorReverse 0xb /* src OR NOT dst */
  105. #define GRFBBOPcopyInverted 0xc /* NOT src */
  106. #define GRFBBOPorInverted 0xd /* NOT src OR dst */
  107. #define GRFBBOPnand 0xe /* NOT src OR NOT dst */
  108. #define GRFBBOPset 0xf /* 1 */
  109. /* Write 16 Bit VGA register */
  110. #define vgaw16(ba, reg, val) 
  111. *((unsigned short *)  (((volatile unsigned char *)ba)+reg)) = val
  112. /*
  113.  * Defines for the used register addresses (mw)
  114.  *
  115.  * NOTE: There are some registers that have different addresses when
  116.  *       in mono or color mode. We only support color mode, and thus
  117.  *       some addresses won't work in mono-mode!
  118.  *
  119.  * General and VGA-registers taken from retina driver. Fixed a few
  120.  * bugs in it. (SR and GR read address is Port + 1, NOT Port)
  121.  *
  122.  */
  123. /* General Registers: */
  124. #define GREG_MISC_OUTPUT_R 0x03CC
  125. #define GREG_MISC_OUTPUT_W 0x03C2
  126. #define GREG_FEATURE_CONTROL_R 0x03CA
  127. #define GREG_FEATURE_CONTROL_W 0x03DA
  128. #define GREG_INPUT_STATUS0_R 0x03C2
  129. #define GREG_INPUT_STATUS1_R 0x03DA
  130. /* Setup Registers: */
  131. #define SREG_OPTION_SELECT 0x0102
  132. #define SREG_VIDEO_SUBS_ENABLE 0x46E8
  133. /* Attribute Controller: */
  134. #define ACT_ADDRESS 0x03C0
  135. #define ACT_ADDRESS_R 0x03C1
  136. #define ACT_ADDRESS_W 0x03C0
  137. #define ACT_ADDRESS_RESET 0x03DA
  138. #define ACT_ID_PALETTE0 0x00
  139. #define ACT_ID_PALETTE1 0x01
  140. #define ACT_ID_PALETTE2 0x02
  141. #define ACT_ID_PALETTE3 0x03
  142. #define ACT_ID_PALETTE4 0x04
  143. #define ACT_ID_PALETTE5 0x05
  144. #define ACT_ID_PALETTE6 0x06
  145. #define ACT_ID_PALETTE7 0x07
  146. #define ACT_ID_PALETTE8 0x08
  147. #define ACT_ID_PALETTE9 0x09
  148. #define ACT_ID_PALETTE10 0x0A
  149. #define ACT_ID_PALETTE11 0x0B
  150. #define ACT_ID_PALETTE12 0x0C
  151. #define ACT_ID_PALETTE13 0x0D
  152. #define ACT_ID_PALETTE14 0x0E
  153. #define ACT_ID_PALETTE15 0x0F
  154. #define ACT_ID_ATTR_MODE_CNTL 0x10
  155. #define ACT_ID_OVERSCAN_COLOR 0x11
  156. #define ACT_ID_COLOR_PLANE_ENA 0x12
  157. #define ACT_ID_HOR_PEL_PANNING 0x13
  158. #define ACT_ID_COLOR_SELECT 0x14
  159. /* Graphics Controller: */
  160. #define GCT_ADDRESS 0x03CE
  161. #define GCT_ADDRESS_R 0x03CF
  162. #define GCT_ADDRESS_W 0x03CF
  163. #define GCT_ID_SET_RESET 0x00
  164. #define GCT_ID_ENABLE_SET_RESET 0x01
  165. #define GCT_ID_COLOR_COMPARE 0x02
  166. #define GCT_ID_DATA_ROTATE 0x03
  167. #define GCT_ID_READ_MAP_SELECT 0x04
  168. #define GCT_ID_GRAPHICS_MODE 0x05
  169. #define GCT_ID_MISC 0x06
  170. #define GCT_ID_COLOR_XCARE 0x07
  171. #define GCT_ID_BITMASK 0x08
  172. /* Sequencer: */
  173. #define SEQ_ADDRESS 0x03C4
  174. #define SEQ_ADDRESS_R 0x03C5
  175. #define SEQ_ADDRESS_W 0x03C5
  176. #define SEQ_ID_RESET 0x00
  177. #define SEQ_ID_CLOCKING_MODE 0x01
  178. #define SEQ_ID_MAP_MASK 0x02
  179. #define SEQ_ID_CHAR_MAP_SELECT 0x03
  180. #define SEQ_ID_MEMORY_MODE 0x04
  181. #define SEQ_ID_UNKNOWN1 0x05
  182. #define SEQ_ID_UNKNOWN2 0x06
  183. #define SEQ_ID_UNKNOWN3 0x07
  184. /* S3 extensions */
  185. #define SEQ_ID_UNLOCK_EXT 0x08
  186. #define SEQ_ID_EXT_SEQ_REG9 0x09
  187. #define SEQ_ID_BUS_REQ_CNTL 0x0A
  188. #define SEQ_ID_EXT_MISC_SEQ 0x0B
  189. #define SEQ_ID_UNKNOWN4 0x0C
  190. #define SEQ_ID_EXT_SEQ 0x0D
  191. #define SEQ_ID_UNKNOWN5 0x0E
  192. #define SEQ_ID_UNKNOWN6 0x0F
  193. #define SEQ_ID_MCLK_LO 0x10
  194. #define SEQ_ID_MCLK_HI 0x11
  195. #define SEQ_ID_DCLK_LO 0x12
  196. #define SEQ_ID_DCLK_HI 0x13
  197. #define SEQ_ID_CLKSYN_CNTL_1 0x14
  198. #define SEQ_ID_CLKSYN_CNTL_2 0x15
  199. #define SEQ_ID_CLKSYN_TEST_HI 0x16 /* reserved for S3 testing of the */
  200. #define SEQ_ID_CLKSYN_TEST_LO 0x17 /*   internal clock synthesizer   */
  201. #define SEQ_ID_RAMDAC_CNTL 0x18
  202. #define SEQ_ID_MORE_MAGIC 0x1A
  203. /* CRT Controller: */
  204. #define CRT_ADDRESS 0x03D4
  205. #define CRT_ADDRESS_R 0x03D5
  206. #define CRT_ADDRESS_W 0x03D5
  207. #define CRT_ID_HOR_TOTAL 0x00
  208. #define CRT_ID_HOR_DISP_ENA_END 0x01
  209. #define CRT_ID_START_HOR_BLANK 0x02
  210. #define CRT_ID_END_HOR_BLANK 0x03
  211. #define CRT_ID_START_HOR_RETR 0x04
  212. #define CRT_ID_END_HOR_RETR 0x05
  213. #define CRT_ID_VER_TOTAL 0x06
  214. #define CRT_ID_OVERFLOW 0x07
  215. #define CRT_ID_PRESET_ROW_SCAN 0x08
  216. #define CRT_ID_MAX_SCAN_LINE 0x09
  217. #define CRT_ID_CURSOR_START 0x0A
  218. #define CRT_ID_CURSOR_END 0x0B
  219. #define CRT_ID_START_ADDR_HIGH 0x0C
  220. #define CRT_ID_START_ADDR_LOW 0x0D
  221. #define CRT_ID_CURSOR_LOC_HIGH 0x0E
  222. #define CRT_ID_CURSOR_LOC_LOW 0x0F
  223. #define CRT_ID_START_VER_RETR 0x10
  224. #define CRT_ID_END_VER_RETR 0x11
  225. #define CRT_ID_VER_DISP_ENA_END 0x12
  226. #define CRT_ID_SCREEN_OFFSET 0x13
  227. #define CRT_ID_UNDERLINE_LOC 0x14
  228. #define CRT_ID_START_VER_BLANK 0x15
  229. #define CRT_ID_END_VER_BLANK 0x16
  230. #define CRT_ID_MODE_CONTROL 0x17
  231. #define CRT_ID_LINE_COMPARE 0x18
  232. #define CRT_ID_GD_LATCH_RBACK 0x22
  233. #define CRT_ID_ACT_TOGGLE_RBACK 0x24
  234. #define CRT_ID_ACT_INDEX_RBACK 0x26
  235. /* S3 extensions: S3 VGA Registers */
  236. #define CRT_ID_DEVICE_HIGH 0x2D
  237. #define CRT_ID_DEVICE_LOW 0x2E
  238. #define CRT_ID_REVISION  0x2F
  239. #define CRT_ID_CHIP_ID_REV 0x30
  240. #define CRT_ID_MEMORY_CONF 0x31
  241. #define CRT_ID_BACKWAD_COMP_1 0x32
  242. #define CRT_ID_BACKWAD_COMP_2 0x33
  243. #define CRT_ID_BACKWAD_COMP_3 0x34
  244. #define CRT_ID_REGISTER_LOCK 0x35
  245. #define CRT_ID_CONFIG_1  0x36
  246. #define CRT_ID_CONFIG_2  0x37
  247. #define CRT_ID_REGISTER_LOCK_1 0x38
  248. #define CRT_ID_REGISTER_LOCK_2 0x39
  249. #define CRT_ID_MISC_1 0x3A
  250. #define CRT_ID_DISPLAY_FIFO 0x3B
  251. #define CRT_ID_LACE_RETR_START 0x3C
  252. /* S3 extensions: System Control Registers  */
  253. #define CRT_ID_SYSTEM_CONFIG 0x40
  254. #define CRT_ID_BIOS_FLAG 0x41
  255. #define CRT_ID_LACE_CONTROL 0x42
  256. #define CRT_ID_EXT_MODE  0x43
  257. #define CRT_ID_HWGC_MODE 0x45 /* HWGC = Hardware Graphics Cursor */
  258. #define CRT_ID_HWGC_ORIGIN_X_HI 0x46
  259. #define CRT_ID_HWGC_ORIGIN_X_LO 0x47
  260. #define CRT_ID_HWGC_ORIGIN_Y_HI 0x48
  261. #define CRT_ID_HWGC_ORIGIN_Y_LO 0x49
  262. #define CRT_ID_HWGC_FG_STACK 0x4A
  263. #define CRT_ID_HWGC_BG_STACK 0x4B
  264. #define CRT_ID_HWGC_START_AD_HI 0x4C
  265. #define CRT_ID_HWGC_START_AD_LO 0x4D
  266. #define CRT_ID_HWGC_DSTART_X 0x4E
  267. #define CRT_ID_HWGC_DSTART_Y 0x4F
  268. /* S3 extensions: System Extension Registers  */
  269. #define CRT_ID_EXT_SYS_CNTL_1 0x50
  270. #define CRT_ID_EXT_SYS_CNTL_2 0x51
  271. #define CRT_ID_EXT_BIOS_FLAG_1 0x52
  272. #define CRT_ID_EXT_MEM_CNTL_1 0x53
  273. #define CRT_ID_EXT_MEM_CNTL_2 0x54
  274. #define CRT_ID_EXT_DAC_CNTL 0x55
  275. #define CRT_ID_EX_SYNC_1 0x56
  276. #define CRT_ID_EX_SYNC_2 0x57
  277. #define CRT_ID_LAW_CNTL 0x58 /* LAW = Linear Address Window */
  278. #define CRT_ID_LAW_POS_HI 0x59
  279. #define CRT_ID_LAW_POS_LO 0x5A
  280. #define CRT_ID_GOUT_PORT 0x5C
  281. #define CRT_ID_EXT_HOR_OVF 0x5D
  282. #define CRT_ID_EXT_VER_OVF 0x5E
  283. #define CRT_ID_EXT_MEM_CNTL_3 0x60
  284. #define CRT_ID_EX_SYNC_3 0x63
  285. #define CRT_ID_EXT_MISC_CNTL 0x65
  286. #define CRT_ID_EXT_MISC_CNTL_1 0x66
  287. #define CRT_ID_EXT_MISC_CNTL_2 0x67
  288. #define CRT_ID_CONFIG_3  0x68
  289. #define CRT_ID_EXT_SYS_CNTL_3 0x69
  290. #define CRT_ID_EXT_SYS_CNTL_4 0x6A
  291. #define CRT_ID_EXT_BIOS_FLAG_3 0x6B
  292. #define CRT_ID_EXT_BIOS_FLAG_4 0x6C
  293. /* Enhanced Commands Registers: */
  294. #define ECR_SUBSYSTEM_STAT 0x42E8
  295. #define ECR_SUBSYSTEM_CNTL 0x42E8
  296. #define ECR_ADV_FUNC_CNTL 0x4AE8
  297. #define ECR_CURRENT_Y_POS 0x82E8
  298. #define ECR_CURRENT_Y_POS2 0x82EA /* Trio64 only */
  299. #define ECR_CURRENT_X_POS 0x86E8
  300. #define ECR_CURRENT_X_POS2 0x86EA /* Trio64 only */
  301. #define ECR_DEST_Y__AX_STEP 0x8AE8
  302. #define ECR_DEST_Y2__AX_STEP2 0x8AEA /* Trio64 only */
  303. #define ECR_DEST_X__DIA_STEP 0x8EE8
  304. #define ECR_DEST_X2__DIA_STEP2 0x8EEA /* Trio64 only */
  305. #define ECR_ERR_TERM 0x92E8
  306. #define ECR_ERR_TERM2 0x92EA /* Trio64 only */
  307. #define ECR_MAJ_AXIS_PIX_CNT 0x96E8
  308. #define ECR_MAJ_AXIS_PIX_CNT2 0x96EA /* Trio64 only */
  309. #define ECR_GP_STAT 0x9AE8 /* GP = Graphics Processor */
  310. #define ECR_DRAW_CMD 0x9AE8
  311. #define ECR_DRAW_CMD2 0x9AEA /* Trio64 only */
  312. #define ECR_SHORT_STROKE 0x9EE8
  313. #define ECR_BKGD_COLOR 0xA2E8 /* BKGD = Background */
  314. #define ECR_FRGD_COLOR 0xA6E8 /* FRGD = Foreground */
  315. #define ECR_BITPLANE_WRITE_MASK 0xAAE8
  316. #define ECR_BITPLANE_READ_MASK 0xAEE8
  317. #define ECR_COLOR_COMPARE 0xB2E8
  318. #define ECR_BKGD_MIX 0xB6E8
  319. #define ECR_FRGD_MIX 0xBAE8
  320. #define ECR_READ_REG_DATA 0xBEE8
  321. #define ECR_ID_MIN_AXIS_PIX_CNT 0x00
  322. #define ECR_ID_SCISSORS_TOP 0x01
  323. #define ECR_ID_SCISSORS_LEFT 0x02
  324. #define ECR_ID_SCISSORS_BUTTOM 0x03
  325. #define ECR_ID_SCISSORS_RIGHT 0x04
  326. #define ECR_ID_PIX_CNTL 0x0A
  327. #define ECR_ID_MULT_CNTL_MISC_2 0x0D
  328. #define ECR_ID_MULT_CNTL_MISC 0x0E
  329. #define ECR_ID_READ_SEL 0x0F
  330. #define ECR_PIX_TRANS 0xE2E8
  331. #define ECR_PIX_TRANS_EXT 0xE2EA
  332. #define ECR_PATTERN_Y 0xEAE8 /* Trio64 only */
  333. #define ECR_PATTERN_X 0xEAEA /* Trio64 only */
  334. /* Pass-through */
  335. #define PASS_ADDRESS 0x40001
  336. #define PASS_ADDRESS_W 0x40001
  337. /* Video DAC */
  338. #define VDAC_ADDRESS 0x03c8
  339. #define VDAC_ADDRESS_W 0x03c8
  340. #define VDAC_ADDRESS_R 0x03c7
  341. #define VDAC_STATE 0x03c7
  342. #define VDAC_DATA 0x03c9
  343. #define VDAC_MASK 0x03c6
  344. #define WGfx(ba, idx, val) 
  345. do { wb_64(ba, GCT_ADDRESS, idx); wb_64(ba, GCT_ADDRESS_W , val); } while (0)
  346. #define WSeq(ba, idx, val) 
  347. do { wb_64(ba, SEQ_ADDRESS, idx); wb_64(ba, SEQ_ADDRESS_W , val); } while (0)
  348. #define WCrt(ba, idx, val) 
  349. do { wb_64(ba, CRT_ADDRESS, idx); wb_64(ba, CRT_ADDRESS_W , val); } while (0)
  350. #define WAttr(ba, idx, val) 
  351. do { 
  352.   unsigned char tmp;
  353.   tmp = rb_64(ba, ACT_ADDRESS_RESET);
  354.   wb_64(ba, ACT_ADDRESS_W, idx);
  355.   wb_64(ba, ACT_ADDRESS_W, val);
  356. } while (0)
  357. #define SetTextPlane(ba, m) 
  358. do { 
  359.   WGfx(ba, GCT_ID_READ_MAP_SELECT, m & 3 );
  360.   WSeq(ba, SEQ_ID_MAP_MASK, (1 << (m & 3)));
  361. } while (0)
  362.      /* --------------------------------- */
  363.      /* prototypes                        */
  364.      /* --------------------------------- */
  365. inline unsigned char RAttr(volatile unsigned char * board, short idx);
  366. inline unsigned char RSeq(volatile unsigned char * board, short idx);
  367. inline unsigned char RCrt(volatile unsigned char * board, short idx);
  368. inline unsigned char RGfx(volatile unsigned char * board, short idx);
  369. inline void cv64_write_port(unsigned short bits,
  370.     volatile unsigned char *board);
  371. inline void cvscreen(int toggle, volatile unsigned char *board);
  372. inline void gfx_on_off(int toggle, volatile unsigned char *board);
  373. #if 0
  374. unsigned short cv64_compute_clock(unsigned long freq);
  375. int cv_has_4mb(volatile unsigned char * fb);
  376. void cv64_board_init(void);
  377. void cv64_load_video_mode(struct fb_var_screeninfo *video_mode);
  378. #endif
  379. void cvision_bitblt(u_short sx, u_short sy, u_short dx, u_short dy, u_short w,
  380.     u_short h);
  381. void cvision_clear(u_short dx, u_short dy, u_short w, u_short h, u_short bg);