ctB69000Vga.c
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:8k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* ctB69000Vga.c - a CHIPS B69000 initialization source module */
  2. /* Copyright 1984-2000 Wind River Systems, Inc. */
  3. #include "copyright_wrs.h"
  4. /*
  5. modification history
  6. --------------------
  7. 01a,26mar00,ms  written.
  8. */
  9. /*
  10. DESCRIPTION
  11. The 69000 is the first product in the CHIPS family of portable graphics
  12. accelerator product line that integrates high performance memory technology
  13. for the graphics frame buffer. Based on the proven HiQVideo graphics
  14. accelerator core, the 69000 combines state-of-the-art flat panel controller
  15. capabilities with low power, high performance integrated memory. The result
  16. is the start of a high performance, low power, highly integrated solution for
  17. the premier family of portable graphics products.
  18. .IP "High Performance Integrated Memory"
  19. The 69000 is the first member of the HiQVideo family to provide integrated high
  20. performance synchronous DRAM (SDRAM) memory technology. Targeted at the
  21. mainstream notebook market, the 69000 incorporates 2MB of proprietary integrated
  22. SDRAM for the graphics/video frame buffer. The integrated SDRAM memory can
  23. support up to 83MHz operation, thus increasing the available memory bandwidth
  24. for the graphics subsystem. The result is support for additional high color /
  25. high resolution graphics modes combined with real-time video acceleration. This
  26. additional bandwidth also allows more flexibility in the other graphics
  27. functions intensely used in Graphical User Interfaces (GUIs) such as Microsoft
  28. Windows.
  29. .IP "Frame-Based AGP Compatibility"
  30. The 69000 graphics is designed to be used with either 33MHz PCI, or with AGP as a
  31. frame-based AGP device, allowing it to be used with the AGP interface provided by
  32. the latest core logic chipsets.
  33. .IP "HiQColor TM Technology"
  34. The 69000 integrates CHIPS breakthrough HiQColor technology. Based on the CHIPS
  35. proprietary TMED (Temporal Modulated Energy Distribution) algorithm, HiQColor
  36. technology is a unique process that allows the display of 16.7 million true
  37. colors on STN panels without using Frame Rate Control (FRC) or dithering. In
  38. addition, TMED also reduces the need for the panel tuning associated with
  39. current FRC-based algorithms. Independent of panel response, the TMED algorithm
  40. eliminates all of the flaws (such as shimmer, Mach banding, and other motion
  41. artifacts) normally associated with dithering and FRC. Combined with the new
  42. fast response, high-contrast, and low-crosstalk technology found in new STN
  43. panels, HiQColor technology enables the best display quality and color fidelity
  44. previously only available with TFT technology.
  45. .IP "Versatile Panel Support"
  46. The HiQVideo family supports a wide variety of monochrome and color Single-
  47. Panel, Single-Drive (SS) and Dual-Panel, Dual Drive (DD), standard and high-
  48. resolution, passive STN and active matrix TFT/MIM LCD, and EL panels. With
  49. HiQColor technology, up to 256 gray scales are supported on passive STN LCDs. Up
  50. to 16.7M different colors can be displayed on passive STN LCDs and up to 16.7M
  51. colors on 24- bit active matrix LCDs.
  52. The 69000 offers a variety of programmable features to optimize display quality.
  53. Vertical centering and stretching are provided for handling modes with less than
  54. 480 lines on 480-line panels. Horizontal and vertical stretching capabilities
  55. are also available for both text and graphics modes for optimal display of VGA
  56. text and graphics modes on 800x600, 1024x768 and 1280x1024 panels.
  57. .IP "Television NTSC/PAL Flicker Free Output"
  58. The 69000 uses a flicker reduction process which makes text of all fonts and
  59. sizes readable by reducing the flicker and jumping lines on the display.
  60. .IP "HiQVideo T Multimedia Support"
  61. The 69000 uses independent multimedia capture and display systems on-chip.
  62. The capture system places data in display memory (usually off screen) and
  63. the display system places the data in a window on the screen.
  64. .IP "Low Power Consumption"
  65. The 69000 uses a variety of advanced power management features to reduce power
  66. consumption of the display sub-system and to extend battery life. Optimized for
  67. 3.3V operation, the 69000 internal logic, bus and panel interfaces operate at
  68. 3.3V but can tolerate 5V operation.
  69. .IP "Software Compatibility / Flexibility"
  70. The HiQVideo controllers are fully compatible with the VGA standard at both the
  71. register and BIOS levels. CHIPS and third-party vendors supply a fully VGA
  72. compatible BIOS, end-user utilities and drivers for common application programs.
  73. .IP "Acceleration for All Panels and All Modes"
  74. The 69000 graphics engine is designed to support high performance graphics and
  75. video acceleration for all supported display resolutions, display types, and
  76. color modes. There is no compromise in performance operating in 8, 16, or 24 bpp
  77. color modes allowing true acceleration while displaying up to 16.7M colors.
  78. .LP
  79. .I USAGE
  80. This library provides initialization routines to configure CHIPS B69000 (VGA)
  81. in alphanumeric mode.
  82. The functions addressed here include:
  83. .IP "   -"
  84. Initialization of CHIPS B69000 IC.
  85. .LP
  86. .I USER INTERFACE
  87. .CS
  88. STATUS ctB69000VgaInit
  89.     (
  90.     VOID
  91.     )
  92. .CE
  93. This routine will initialize the VGA card if present in PCI connector,
  94. sets up register set in VGA 3+ mode and loads the font in plane 2.
  95. INCLUDE FILES: NONE.
  96. */
  97. /* includes */
  98. #include "vxWorks.h"
  99. #include "sysLib.h"
  100. #include "drv/pci/pciConfigLib.h"
  101. #include "vgaInit.c"
  102. /* defines */
  103. #define CTB69000VGA_VENID          0x102C
  104. #define CTB69000VGA_DEVID          0x00C0
  105. #define CTB69000VGA_XR_PORT        0x3D6  /* Extended Register Index Port */
  106. #define CTB69000VGA_XR_DATA_PORT   0x3D7  /* Extended Register Data Port */
  107. #define CTB69000VGA_FR_PORT        0x3D0  /* Flat Panel Index Port */
  108. #define CTB69000VGA_FR_DATA_PORT   0x3D1  /* Flat Panel Data Port */
  109. #define CTB69000VGA_MR_PORT        0x3D2  /* Multimedia Index Port */
  110. /*******************************************************************************
  111. *
  112. * ctB69000VgaInit - initializes the B69000 chip and loads font in memory.
  113. *
  114. * This routine will initialize the VGA card if present in PCI connector,
  115. * sets up register set in VGA 3+ mode and loads the font in plane 2.
  116. *
  117. * RETURNS: OK/ERROR
  118. */
  119. STATUS ctB69000VgaInit
  120.     (
  121.     void
  122.     )
  123.     {
  124.     int pciBus = 0;
  125.     int pciDevice = 0;
  126.     int pciFunc = 0;
  127.     /* check PCI BASED - CHIPS B69000's presence on the bus */
  128.     if (pciFindDevice (CTB69000VGA_VENID, CTB69000VGA_DEVID, 0,
  129.                        &pciBus, &pciDevice, &pciFunc) != OK)
  130.         {
  131.         return ERROR;
  132.         }
  133.     
  134.     /* enable mapped memory and IO addresses */
  135.     pciConfigOutLong (pciBus, pciDevice, pciFunc, 0x04, 0x7);
  136.     /*
  137.      * Intialize CHIPS B69000 specific registers.
  138.      */
  139.     
  140.     /* Extension Registers */
  141.     vgaRegSet (CTB69000VGA_XR_PORT, 0x0005);
  142.     vgaRegSet (CTB69000VGA_XR_PORT, 0xC006);
  143.     vgaRegSet (CTB69000VGA_XR_PORT, 0x0308); 
  144.     
  145.     /* [0] = Paged; [1] = Linear Mapping; */
  146.     vgaRegSet (CTB69000VGA_XR_PORT, 0x000A);
  147.     vgaRegSet (CTB69000VGA_XR_PORT, 0x010B); 
  148.     vgaRegSet (CTB69000VGA_XR_PORT, 0x000E);
  149.     
  150.     vgaRegSet (CTB69000VGA_XR_PORT, 0x0040);
  151.     
  152.     vgaRegSet (CTB69000VGA_XR_PORT, 0xBC63);
  153.     
  154.     vgaRegSet (CTB69000VGA_XR_PORT, 0x0080);
  155.     vgaRegSet (CTB69000VGA_XR_PORT, 0x0081);
  156.     
  157.     /* Fout for DCLK0 = 25 Mhz */
  158.     vgaRegSet (CTB69000VGA_XR_PORT, 0xD1C0);
  159.     vgaRegSet (CTB69000VGA_XR_PORT, 0x1CC1);
  160.     vgaRegSet (CTB69000VGA_XR_PORT, 0x00C2);
  161.     vgaRegSet (CTB69000VGA_XR_PORT, 0x24C3);
  162.     
  163.     /* Fout for DCLK1 = 28 Mhz */ 
  164.     vgaRegSet (CTB69000VGA_XR_PORT, 0x55C4);
  165.     vgaRegSet (CTB69000VGA_XR_PORT, 0x09C5);
  166.     vgaRegSet (CTB69000VGA_XR_PORT, 0x00C6); 
  167.     vgaRegSet (CTB69000VGA_XR_PORT, 0x24C7);
  168.     
  169.     /* Fout for DCLK2 =    Mhz */
  170.     vgaRegSet (CTB69000VGA_XR_PORT, 0x6BC8);    
  171.     vgaRegSet (CTB69000VGA_XR_PORT, 0x3CC9);
  172.     vgaRegSet (CTB69000VGA_XR_PORT, 0x00CA); 
  173.     vgaRegSet (CTB69000VGA_XR_PORT, 0x21CB);
  174.     
  175.     /* Fout for MCLK = 83 Mhz */
  176.     vgaRegSet (CTB69000VGA_XR_PORT, 0x10CE); 
  177.     vgaRegSet (CTB69000VGA_XR_PORT, 0x38CC);    
  178.     vgaRegSet (CTB69000VGA_XR_PORT, 0x03CD);
  179.     vgaRegSet (CTB69000VGA_XR_PORT, 0x90CE);
  180.     
  181.     /* Enable MCLK and DCLK synthesizers */
  182.     vgaRegSet (CTB69000VGA_XR_PORT, 0x06CF);
  183.     
  184.     /* Enable DAC, Palette, DCLK-Vco and MCLK-Vco */
  185.     vgaRegSet (CTB69000VGA_XR_PORT, 0x0FD0);
  186.     vgaRegSet (CTB69000VGA_XR_PORT, 0x01D1);
  187.     
  188.     /* Flat Panel Registers */
  189.     vgaRegSet (CTB69000VGA_FR_PORT, 0x0101);
  190.     /*
  191.      * Intialize VGA compatible register set on B69000,
  192.      * and download font in memory for alphanumeric mode.
  193.      */
  194.     vgaInit ();
  195.     
  196.     return OK;
  197.     }
  198.