tgafb.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:5k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/drivers/video/tgafb.h -- DEC 21030 TGA frame buffer device
  3.  *
  4.  *   Copyright (C) 1999,2000 Martin Lucina, Tom Zerucha
  5.  *  
  6.  *  $Id: tgafb.h,v 1.4.2.3 2000/04/04 06:44:56 mato Exp $
  7.  *
  8.  *  This file is subject to the terms and conditions of the GNU General Public
  9.  *  License. See the file COPYING in the main directory of this archive for
  10.  *  more details.
  11.  */
  12. #ifndef TGAFB_H
  13. #define TGAFB_H
  14.     /*
  15.      * TGA hardware description (minimal)
  16.      */
  17. #define TGA_TYPE_8PLANE 0
  18. #define TGA_TYPE_24PLANE 1
  19. #define TGA_TYPE_24PLUSZ 3
  20.     /*
  21.      * Offsets within Memory Space
  22.      */
  23. #define TGA_ROM_OFFSET 0x0000000
  24. #define TGA_REGS_OFFSET 0x0100000
  25. #define TGA_8PLANE_FB_OFFSET 0x0200000
  26. #define TGA_24PLANE_FB_OFFSET 0x0804000
  27. #define TGA_24PLUSZ_FB_OFFSET 0x1004000
  28. #define TGA_PLANEMASK_REG 0x0028
  29. #define TGA_MODE_REG 0x0030
  30. #define TGA_RASTEROP_REG 0x0034
  31. #define TGA_PIXELSHIFT_REG 0x0038
  32. #define TGA_DEEP_REG 0x0050
  33. #define TGA_PIXELMASK_REG 0x005c
  34. #define TGA_CURSOR_BASE_REG 0x0060
  35. #define TGA_HORIZ_REG 0x0064
  36. #define TGA_VERT_REG 0x0068
  37. #define TGA_BASE_ADDR_REG 0x006c
  38. #define TGA_VALID_REG 0x0070
  39. #define TGA_CURSOR_XY_REG 0x0074
  40. #define TGA_INTR_STAT_REG 0x007c
  41. #define TGA_RAMDAC_SETUP_REG 0x00c0
  42. #define TGA_BLOCK_COLOR0_REG 0x0140
  43. #define TGA_BLOCK_COLOR1_REG 0x0144
  44. #define TGA_CLOCK_REG 0x01e8
  45. #define TGA_RAMDAC_REG 0x01f0
  46. #define TGA_CMD_STAT_REG 0x01f8
  47.     /* 
  48.      * useful defines for managing the registers
  49.      */
  50. #define TGA_HORIZ_ODD 0x80000000
  51. #define TGA_HORIZ_POLARITY 0x40000000
  52. #define TGA_HORIZ_ACT_MSB 0x30000000
  53. #define TGA_HORIZ_BP 0x0fe00000
  54. #define TGA_HORIZ_SYNC 0x001fc000
  55. #define TGA_HORIZ_FP 0x00007c00
  56. #define TGA_HORIZ_ACT_LSB 0x000001ff
  57. #define TGA_VERT_SE 0x80000000
  58. #define TGA_VERT_POLARITY 0x40000000
  59. #define TGA_VERT_RESERVED 0x30000000
  60. #define TGA_VERT_BP 0x0fc00000
  61. #define TGA_VERT_SYNC 0x003f0000
  62. #define TGA_VERT_FP 0x0000f800
  63. #define TGA_VERT_ACTIVE 0x000007ff
  64. #define TGA_VALID_VIDEO 0x01
  65. #define TGA_VALID_BLANK 0x02
  66. #define TGA_VALID_CURSOR 0x04
  67.     /*
  68.      * useful defines for managing the ICS1562 PLL clock
  69.      */
  70. #define TGA_PLL_BASE_FREQ  14318 /* .18 */
  71. #define TGA_PLL_MAX_FREQ  230000
  72.     /*
  73.      * useful defines for managing the BT485 on the 8-plane TGA
  74.      */
  75. #define BT485_READ_BIT 0x01
  76. #define BT485_WRITE_BIT 0x00
  77. #define BT485_ADDR_PAL_WRITE 0x00
  78. #define BT485_DATA_PAL 0x02
  79. #define BT485_PIXEL_MASK 0x04
  80. #define BT485_ADDR_PAL_READ 0x06
  81. #define BT485_ADDR_CUR_WRITE 0x08
  82. #define BT485_DATA_CUR 0x0a
  83. #define BT485_CMD_0 0x0c
  84. #define BT485_ADDR_CUR_READ 0x0e
  85. #define BT485_CMD_1 0x10
  86. #define BT485_CMD_2 0x12
  87. #define BT485_STATUS 0x14
  88. #define BT485_CMD_3 0x14
  89. #define BT485_CUR_RAM 0x16
  90. #define BT485_CUR_LOW_X 0x18
  91. #define BT485_CUR_HIGH_X 0x1a
  92. #define BT485_CUR_LOW_Y 0x1c
  93. #define BT485_CUR_HIGH_Y 0x1e
  94.     /*
  95.      * useful defines for managing the BT463 on the 24-plane TGAs
  96.      */
  97. #define BT463_ADDR_LO 0x0
  98. #define BT463_ADDR_HI 0x1
  99. #define BT463_REG_ACC 0x2
  100. #define BT463_PALETTE 0x3
  101. #define BT463_CUR_CLR_0 0x0100
  102. #define BT463_CUR_CLR_1 0x0101
  103. #define BT463_CMD_REG_0 0x0201
  104. #define BT463_CMD_REG_1 0x0202
  105. #define BT463_CMD_REG_2 0x0203
  106. #define BT463_READ_MASK_0 0x0205
  107. #define BT463_READ_MASK_1 0x0206
  108. #define BT463_READ_MASK_2 0x0207
  109. #define BT463_READ_MASK_3 0x0208
  110. #define BT463_BLINK_MASK_0 0x0209
  111. #define BT463_BLINK_MASK_1 0x020a
  112. #define BT463_BLINK_MASK_2 0x020b
  113. #define BT463_BLINK_MASK_3 0x020c
  114. #define BT463_WINDOW_TYPE_BASE 0x0300
  115.     /*
  116.      * Macros for reading/writing TGA and RAMDAC registers
  117.      */
  118. #define TGA_WRITE_REG(v,r) 
  119. { writel((v), fb_info.tga_regs_base+(r)); mb(); }
  120. #define TGA_READ_REG(r) readl(fb_info.tga_regs_base+(r))
  121. #define BT485_WRITE(v,r) 
  122.   TGA_WRITE_REG((r),TGA_RAMDAC_SETUP_REG);
  123.   TGA_WRITE_REG(((v)&0xff)|((r)<<8),TGA_RAMDAC_REG);
  124. #define BT463_LOAD_ADDR(a) 
  125. TGA_WRITE_REG(BT463_ADDR_LO<<2, TGA_RAMDAC_SETUP_REG); 
  126. TGA_WRITE_REG((BT463_ADDR_LO<<10)|((a)&0xff), TGA_RAMDAC_REG); 
  127. TGA_WRITE_REG(BT463_ADDR_HI<<2, TGA_RAMDAC_SETUP_REG); 
  128. TGA_WRITE_REG((BT463_ADDR_HI<<10)|(((a)>>8)&0xff), TGA_RAMDAC_REG);
  129. #define BT463_WRITE(m,a,v) 
  130. BT463_LOAD_ADDR((a)); 
  131. TGA_WRITE_REG(((m)<<2),TGA_RAMDAC_SETUP_REG); 
  132. TGA_WRITE_REG(((m)<<10)|((v)&0xff),TGA_RAMDAC_REG);
  133.     /*
  134.      *  This structure describes the board.
  135.      */
  136. struct tgafb_info {
  137.     /* Use the generic framebuffer ops */
  138.     struct fb_info_gen gen;
  139.     /* Device dependent information */
  140.     u8 tga_type; /* TGA_TYPE_XXX */
  141.     u8 tga_chip_rev; /* dc21030 revision */
  142.     u64 tga_mem_base;
  143.     u64 tga_fb_base;
  144.     u64 tga_regs_base;
  145.     struct fb_var_screeninfo default_var; /* default video mode */
  146. };
  147.     /*
  148.      *  This structure uniquely defines a video mode.
  149.      */
  150. struct tgafb_par {
  151.     u32 xres, yres; /* resolution in pixels */
  152.     u32 htimings; /* horizontal timing register */
  153.     u32 vtimings; /* vertical timing register */
  154.     u32 pll_freq; /* pixclock in mhz */
  155.     u32 bits_per_pixel; /* bits per pixel */
  156.     u32 sync_on_green; /* set if sync is on green */
  157. };
  158. #endif /* TGAFB_H */