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

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/drivers/video/cyber2000fb.h
  3.  *
  4.  *  Copyright (C) 1998-2000 Russell King
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License version 2 as
  8.  * published by the Free Software Foundation.
  9.  *
  10.  * Integraphics Cyber2000 frame buffer device
  11.  */
  12. #include <linux/config.h>
  13. /*
  14.  * Internal CyberPro sizes and offsets.
  15.  */
  16. #define MMIO_OFFSET 0x00800000
  17. #define MMIO_SIZE 0x000c0000
  18. #define NR_PALETTE 256
  19. #if defined(DEBUG) && defined(CONFIG_DEBUG_LL)
  20. static void debug_printf(char *fmt, ...)
  21. {
  22. extern void printascii(const char *);
  23. char buffer[128];
  24. va_list ap;
  25. va_start(ap, fmt);
  26. vsprintf(buffer, fmt, ap);
  27. va_end(ap);
  28. printascii(buffer);
  29. }
  30. #else
  31. #define debug_printf(x...) do { } while (0)
  32. #endif
  33. #define PIXFORMAT_8BPP 0
  34. #define PIXFORMAT_16BPP 1
  35. #define PIXFORMAT_24BPP 2
  36. #define PIXFORMAT_32BPP 3
  37. #define VISUALID_256 1
  38. #define VISUALID_64K 2
  39. #define VISUALID_16M_32 3
  40. #define VISUALID_16M 4
  41. #define VISUALID_32K 6
  42. #define FUNC_CTL 0x3c
  43. #define FUNC_CTL_EXTREGENBL 0x80 /* enable access to 0xbcxxx */
  44. #define BIU_BM_CONTROL 0x3e
  45. #define BIU_BM_CONTROL_ENABLE 0x01 /* enable bus-master */
  46. #define BIU_BM_CONTROL_BURST 0x02 /* enable burst */
  47. #define BIU_BM_CONTROL_BACK2BACK 0x04 /* enable back to back */
  48. #define X_V2_VID_MEM_START 0x40
  49. #define X_V2_VID_SRC_WIDTH 0x43
  50. #define X_V2_X_START 0x45
  51. #define X_V2_X_END 0x47
  52. #define X_V2_Y_START 0x49
  53. #define X_V2_Y_END 0x4b
  54. #define X_V2_VID_SRC_WIN_WIDTH 0x4d
  55. #define Y_V2_DDA_X_INC 0x43
  56. #define Y_V2_DDA_Y_INC 0x47
  57. #define Y_V2_VID_FIFO_CTL 0x49
  58. #define Y_V2_VID_FMT 0x4b
  59. #define Y_V2_VID_DISP_CTL1 0x4c
  60. #define Y_V2_VID_FIFO_CTL1 0x4d
  61. #define J_X2_VID_MEM_START 0x40
  62. #define J_X2_VID_SRC_WIDTH 0x43
  63. #define J_X2_X_START 0x47
  64. #define J_X2_X_END 0x49
  65. #define J_X2_Y_START 0x4b
  66. #define J_X2_Y_END 0x4d
  67. #define J_X2_VID_SRC_WIN_WIDTH 0x4f
  68. #define K_X2_DDA_X_INIT 0x40
  69. #define K_X2_DDA_X_INC 0x42
  70. #define K_X2_DDA_Y_INIT 0x44
  71. #define K_X2_DDA_Y_INC 0x46
  72. #define K_X2_VID_FMT 0x48
  73. #define K_X2_VID_DISP_CTL1 0x49
  74. #define K_CAP_X2_CTL1 0x49
  75. #define CAP_X_START 0x60
  76. #define CAP_X_END 0x62
  77. #define CAP_Y_START 0x64
  78. #define CAP_Y_END 0x66
  79. #define CAP_DDA_X_INIT 0x68
  80. #define CAP_DDA_X_INC 0x6a
  81. #define CAP_DDA_Y_INIT 0x6c
  82. #define CAP_DDA_Y_INC 0x6e
  83. #define MEM_CTL1 0x71
  84. #define MEM_CTL2 0x72
  85. #define MEM_CTL2_SIZE_2MB 0x01
  86. #define MEM_CTL2_SIZE_4MB 0x02
  87. #define MEM_CTL2_SIZE_MASK 0x03
  88. #define MEM_CTL2_64BIT 0x04
  89. #define EXT_FIFO_CTL 0x74
  90. #define CAP_PIP_X_START 0x80
  91. #define CAP_PIP_X_END 0x82
  92. #define CAP_PIP_Y_START 0x84
  93. #define CAP_PIP_Y_END 0x86
  94. #define CAP_NEW_CTL1 0x88
  95. #define CAP_NEW_CTL2 0x89
  96. #define BM_CTRL0 0x9c
  97. #define BM_CTRL1 0x9d
  98. #define CAP_MODE1 0xa4
  99. #define CAP_MODE1_8BIT 0x01 /* enable 8bit capture mode */
  100. #define CAP_MODE1_CCIR656 0x02 /* CCIR656 mode */
  101. #define CAP_MODE1_IGNOREVGT 0x04 /* ignore VGT */
  102. #define CAP_MODE1_ALTFIFO 0x10 /* use alternate FIFO for capture */
  103. #define CAP_MODE1_SWAPUV 0x20 /* swap UV bytes */
  104. #define CAP_MODE1_MIRRORY 0x40 /* mirror vertically */
  105. #define CAP_MODE1_MIRRORX 0x80 /* mirror horizontally */
  106. #define DCLK_MULT 0xb0
  107. #define DCLK_DIV 0xb1
  108. #define DCLK_DIV_VFSEL 0x20
  109. #define MCLK_MULT 0xb2
  110. #define MCLK_DIV 0xb3
  111. #define CAP_MODE2 0xa5
  112. #define Y_TV_CTL 0xae
  113. #define EXT_MEM_START 0xc0 /* ext start address 21 bits */
  114. #define HOR_PHASE_SHIFT 0xc2 /* high 3 bits */
  115. #define EXT_SRC_WIDTH 0xc3 /* ext offset phase  10 bits */
  116. #define EXT_SRC_HEIGHT 0xc4 /* high 6 bits */
  117. #define EXT_X_START 0xc5 /* ext->screen, 16 bits */
  118. #define EXT_X_END 0xc7 /* ext->screen, 16 bits */
  119. #define EXT_Y_START 0xc9 /* ext->screen, 16 bits */
  120. #define EXT_Y_END 0xcb /* ext->screen, 16 bits */
  121. #define EXT_SRC_WIN_WIDTH 0xcd /* 8 bits */
  122. #define EXT_COLOUR_COMPARE 0xce /* 24 bits */
  123. #define EXT_DDA_X_INIT 0xd1 /* ext->screen 16 bits */
  124. #define EXT_DDA_X_INC 0xd3 /* ext->screen 16 bits */
  125. #define EXT_DDA_Y_INIT 0xd5 /* ext->screen 16 bits */
  126. #define EXT_DDA_Y_INC 0xd7 /* ext->screen 16 bits */
  127. #define EXT_VID_FIFO_CTL 0xd9
  128. #define EXT_VID_FMT 0xdb
  129. #define EXT_VID_FMT_YUV422 0x00 /* formats - does this cause conversion? */
  130. #define EXT_VID_FMT_RGB555 0x01
  131. #define EXT_VID_FMT_RGB565 0x02
  132. #define EXT_VID_FMT_RGB888_24 0x03
  133. #define EXT_VID_FMT_RGB888_32 0x04
  134. #define EXT_VID_FMT_DUP_PIX_ZOON 0x08 /* duplicate pixel zoom */
  135. #define EXT_VID_FMT_MOD_3RD_PIX 0x20 /* modify 3rd duplicated pixel */
  136. #define EXT_VID_FMT_DBL_H_PIX 0x40 /* double horiz pixels */
  137. #define EXT_VID_FMT_UV128 0x80 /* UV data offset by 128 */
  138. #define EXT_VID_DISP_CTL1 0xdc
  139. #define EXT_VID_DISP_CTL1_INTRAM 0x01 /* video pixels go to internal RAM */
  140. #define EXT_VID_DISP_CTL1_IGNORE_CCOMP 0x02 /* ignore colour compare registers */
  141. #define EXT_VID_DISP_CTL1_NOCLIP 0x04 /* do not clip to 16235,16240 */
  142. #define EXT_VID_DISP_CTL1_UV_AVG 0x08 /* U/V data is averaged */
  143. #define EXT_VID_DISP_CTL1_Y128 0x10 /* Y data offset by 128 */
  144. #define EXT_VID_DISP_CTL1_VINTERPOL_OFF 0x20 /* vertical interpolation off */
  145. #define EXT_VID_DISP_CTL1_FULL_WIN 0x40 /* video out window full */
  146. #define EXT_VID_DISP_CTL1_ENABLE_WINDOW 0x80 /* enable video window */
  147. #define EXT_VID_FIFO_CTL1 0xdd
  148. #define VFAC_CTL1 0xe8
  149. #define VFAC_CTL1_CAPTURE 0x01 /* capture enable */
  150. #define VFAC_CTL1_VFAC_ENABLE 0x02 /* vfac enable */
  151. #define VFAC_CTL1_FREEZE_CAPTURE 0x04 /* freeze capture */
  152. #define VFAC_CTL1_FREEZE_CAPTURE_SYNC 0x08 /* sync freeze capture */
  153. #define VFAC_CTL1_VALIDFRAME_SRC 0x10 /* select valid frame source */
  154. #define VFAC_CTL1_PHILIPS 0x40 /* select Philips mode */
  155. #define VFAC_CTL1_MODVINTERPOLCLK 0x80 /* modify vertical interpolation clocl */
  156. #define VFAC_CTL2 0xe9
  157. #define VFAC_CTL2_INVERT_VIDDATAVALID 0x01 /* invert video data valid */
  158. #define VFAC_CTL2_INVERT_GRAPHREADY 0x02 /* invert graphic ready output sig */
  159. #define VFAC_CTL2_INVERT_DATACLK 0x04 /* invert data clock signal */
  160. #define VFAC_CTL2_INVERT_HSYNC 0x08 /* invert hsync input */
  161. #define VFAC_CTL2_INVERT_VSYNC 0x10 /* invert vsync input */
  162. #define VFAC_CTL2_INVERT_FRAME 0x20 /* invert frame odd/even input */
  163. #define VFAC_CTL2_INVERT_BLANK 0x40 /* invert blank output */
  164. #define VFAC_CTL2_INVERT_OVSYNC 0x80 /* invert other vsync input */
  165. #define VFAC_CTL3 0xea
  166. #define VFAC_CTL3_CAP_IRQ 0x40 /* enable capture interrupt */
  167. #define CAP_MEM_START 0xeb /* 18 bits */
  168. #define CAP_MAP_WIDTH 0xed /* high 6 bits */
  169. #define CAP_PITCH 0xee /* 8 bits */
  170. #define CAP_CTL_MISC 0xef
  171. #define CAP_CTL_MISC_HDIV 0x01
  172. #define CAP_CTL_MISC_HDIV4 0x02
  173. #define CAP_CTL_MISC_ODDEVEN 0x04
  174. #define CAP_CTL_MISC_HSYNCDIV2 0x08
  175. #define CAP_CTL_MISC_SYNCTZHIGH 0x10
  176. #define CAP_CTL_MISC_SYNCTZOR 0x20
  177. #define CAP_CTL_MISC_DISPUSED 0x80
  178. #define REG_BANK 0xfa
  179. #define REG_BANK_X 0x00
  180. #define REG_BANK_Y 0x01
  181. #define REG_BANK_W 0x02
  182. #define REG_BANK_T 0x03
  183. #define REG_BANK_J 0x04
  184. #define REG_BANK_K 0x05
  185. /*
  186.  * Bus-master
  187.  */
  188. #define BM_VID_ADDR_LOW 0xbc040
  189. #define BM_VID_ADDR_HIGH 0xbc044
  190. #define BM_ADDRESS_LOW 0xbc080
  191. #define BM_ADDRESS_HIGH 0xbc084
  192. #define BM_LENGTH 0xbc088
  193. #define BM_CONTROL 0xbc08c
  194. #define BM_CONTROL_ENABLE 0x01 /* enable transfer */
  195. #define BM_CONTROL_IRQEN 0x02 /* enable IRQ at end of transfer */
  196. #define BM_CONTROL_INIT 0x04 /* initialise status & count */
  197. #define BM_COUNT 0xbc090 /* read-only */
  198. /*
  199.  * Graphics Co-processor
  200.  */
  201. #define CO_CMD_L_PATTERN_FGCOL 0x8000
  202. #define CO_CMD_L_INC_LEFT 0x0004
  203. #define CO_CMD_L_INC_UP 0x0002
  204. #define CO_CMD_H_SRC_PIXMAP 0x2000
  205. #define CO_CMD_H_BLITTER 0x0800
  206. #define CO_REG_CONTROL 0xbf011
  207. #define CO_REG_SRC_WIDTH 0xbf018
  208. #define CO_REG_PIX_FORMAT 0xbf01c
  209. #define CO_REG_FORE_MIX 0xbf048
  210. #define CO_REG_FOREGROUND 0xbf058
  211. #define CO_REG_WIDTH 0xbf060
  212. #define CO_REG_HEIGHT 0xbf062
  213. #define CO_REG_X_PHASE 0xbf078
  214. #define CO_REG_CMD_L 0xbf07c
  215. #define CO_REG_CMD_H 0xbf07e
  216. #define CO_REG_SRC_PTR 0xbf170
  217. #define CO_REG_DEST_PTR 0xbf178
  218. #define CO_REG_DEST_WIDTH 0xbf218
  219. /*
  220.  * Private structure
  221.  */
  222. struct cfb_info;
  223. struct cyberpro_info {
  224. struct pci_dev *dev;
  225. unsigned char *regs;
  226. char *fb;
  227. char dev_name[32];
  228. unsigned int fb_size;
  229. /*
  230.  * The following is a pointer to be passed into the
  231.  * functions below.  The modules outside the main
  232.  * cyber2000fb.c driver have no knowledge as to what
  233.  * is within this structure.
  234.  */
  235. struct cfb_info *info;
  236. /*
  237.  * Use these to enable the BM or TV registers.  In an SMP
  238.  * environment, these two function pointers should only be
  239.  * called from the module_init() or module_exit()
  240.  * functions.
  241.  */
  242. void (*enable_extregs)(struct cfb_info *);
  243. void (*disable_extregs)(struct cfb_info *);
  244. };
  245. /*
  246.  * Note! Writing to the Cyber20x0 registers from an interrupt
  247.  * routine is definitely a bad idea atm.
  248.  */
  249. int cyber2000fb_attach(struct cyberpro_info *info, int idx);
  250. void cyber2000fb_detach(int idx);