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

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _VGATYPES_
  2. #define _VGATYPES_
  3. #ifdef LINUX_XF86
  4. #include "xf86Pci.h"
  5. #endif
  6. #ifdef LINUX_KERNEL  /* TW: We don't want the X driver to depend on kernel source */
  7. #include <linux/ioctl.h>
  8. #endif
  9. #ifndef TC
  10. #define far
  11. #endif
  12. #ifndef FALSE
  13. #define FALSE   0
  14. #endif
  15. #ifndef TRUE
  16. #define TRUE    1
  17. #endif
  18. #ifndef NULL
  19. #define NULL    0
  20. #endif
  21. #ifndef CHAR
  22. typedef char CHAR;
  23. #endif
  24. #ifndef SHORT
  25. typedef short SHORT;
  26. #endif
  27. #ifndef LONG
  28. typedef long  LONG;
  29. #endif
  30. #ifndef UCHAR
  31. typedef unsigned char UCHAR;
  32. #endif
  33. #ifndef USHORT
  34. typedef unsigned short USHORT;
  35. #endif
  36. #ifndef ULONG
  37. typedef unsigned long ULONG;
  38. #endif
  39. #ifndef PUCHAR
  40. typedef UCHAR far *PUCHAR;
  41. #endif
  42. #ifndef PUSHORT
  43. typedef USHORT far *PUSHORT;
  44. #endif
  45. #ifndef PULONG
  46. typedef ULONG far *PULONG;
  47. #endif
  48. #ifndef PVOID
  49. typedef void far *PVOID;
  50. #endif
  51. #ifndef VOID
  52. typedef void VOID;
  53. #endif
  54. #ifndef BOOLEAN
  55. typedef UCHAR BOOLEAN;
  56. #endif
  57. #ifndef WINCE_HEADER
  58. #ifndef bool
  59. typedef UCHAR bool;
  60. #endif
  61. #endif /*WINCE_HEADER*/
  62. #ifndef VBIOS_VER_MAX_LENGTH
  63. #define VBIOS_VER_MAX_LENGTH         4
  64. #endif
  65. #ifndef LINUX_KERNEL   /* For kernel, this is defined in sisfb.h */
  66. #ifndef WIN2000
  67. #ifndef SIS_CHIP_TYPE
  68. typedef enum _SIS_CHIP_TYPE {
  69.     SIS_VGALegacy = 0,
  70. #ifdef LINUX_XF86
  71.     SIS_530, /* TW */
  72.     SIS_OLD, /* TW */
  73. #endif
  74.     SIS_300,
  75.     SIS_630,
  76.     SIS_730,
  77.     SIS_540,
  78.     SIS_315H,   /* SiS 310 */
  79.     SIS_315,
  80.     SIS_315PRO, /* SiS 325 */
  81.     SIS_550,
  82.     SIS_640,
  83.     SIS_740,
  84.     SIS_650,
  85.     SIS_330, 
  86.     MAX_SIS_CHIP
  87. } SIS_CHIP_TYPE;
  88. #endif
  89. #endif
  90. #endif
  91. #ifndef WIN2000
  92. #ifndef SIS_VB_CHIP_TYPE
  93. typedef enum _SIS_VB_CHIP_TYPE {
  94.     VB_CHIP_Legacy = 0,
  95.     VB_CHIP_301,
  96.     VB_CHIP_301B,      
  97.     VB_CHIP_301LV,
  98.     VB_CHIP_301LVX,
  99.     VB_CHIP_302,
  100.     VB_CHIP_302B,
  101.     VB_CHIP_302LV,
  102.     VB_CHIP_302LVX,
  103.     VB_CHIP_303,
  104.     VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */
  105.     MAX_VB_CHIP
  106. } SIS_VB_CHIP_TYPE;
  107. #endif
  108. #endif
  109. #ifndef WIN2000
  110. #ifndef SIS_LCD_TYPE
  111. typedef enum _SIS_LCD_TYPE {
  112.     LCD_INVALID = 0,
  113.     LCD_800x600,
  114.     LCD_1024x768,
  115.     LCD_1280x1024,
  116.     LCD_1280x960,
  117.     LCD_640x480,
  118.     LCD_1600x1200,
  119.     LCD_1920x1440,
  120.     LCD_2048x1536,
  121.     LCD_320x480,       /* TW: FSTN */
  122.     LCD_1400x1050,
  123.     LCD_1152x864,
  124.     LCD_1152x768,
  125.     LCD_1280x768,
  126.     LCD_1024x600,
  127.     LCD_UNKNOWN
  128. } SIS_LCD_TYPE;
  129. #endif
  130. #endif
  131. #ifndef WIN2000 /* mark by Paul, Move definition to sisv.h*/
  132. #ifndef PSIS_DSReg
  133. typedef struct _SIS_DSReg
  134. {
  135.   UCHAR  jIdx;
  136.   UCHAR  jVal;
  137. } SIS_DSReg, *PSIS_DSReg;
  138. #endif
  139. #ifndef SIS_HW_DEVICE_INFO
  140. typedef struct _SIS_HW_DEVICE_INFO  SIS_HW_DEVICE_INFO, *PSIS_HW_DEVICE_INFO;
  141. typedef BOOLEAN (*PSIS_QUERYSPACE)   (PSIS_HW_DEVICE_INFO, ULONG, ULONG, ULONG *);
  142. struct _SIS_HW_DEVICE_INFO
  143. {
  144.     PVOID  pDevice;              /* The pointer to the physical device data structure
  145.                                     in each OS or NULL for unused. */
  146.     UCHAR  *pjVirtualRomBase;    /* base virtual address of VBIOS ROM Space */
  147.                                  /* or base virtual address of ROM image file. */
  148.                                  /* if NULL, then read from pjROMImage; */
  149.                                  /* Note:ROM image file is the file of VBIOS ROM */
  150.     BOOLEAN UseROM;  /* TW: Use the ROM image if provided */
  151.  
  152.     UCHAR  *pjCustomizedROMImage;/* base virtual address of ROM image file. */
  153.                                  /* wincE:ROM image file is the file for OEM */
  154.                                  /*       customized table */
  155.                                  /* Linux: not used */
  156.                                  /* NT   : not used  */
  157.                                  /* Note : pjCustomizedROMImage=NULL if no ROM image file */
  158.     UCHAR  *pjVideoMemoryAddress;/* base virtual memory address */
  159.                                  /* of Linear VGA memory */
  160.     ULONG  ulVideoMemorySize;    /* size, in bytes, of the memory on the board */
  161.     ULONG  ulIOAddress;          /* base I/O address of VGA ports (0x3B0) */
  162.     UCHAR  jChipType;            /* Used to Identify SiS Graphics Chip */
  163.                                  /* defined in the data structure type  */
  164.                                  /* "SIS_CHIP_TYPE" */
  165.     UCHAR  jChipRevision;        /* Used to Identify SiS Graphics Chip Revision */
  166.     UCHAR  ujVBChipID;           /* the ID of video bridge */
  167.                                  /* defined in the data structure type */
  168.                                  /* "SIS_VB_CHIP_TYPE" */
  169.     USHORT usExternalChip;       /* NO VB or other video bridge(not  */
  170.                                  /* SiS video bridge) */
  171.                                  /* if ujVBChipID = VB_CHIP_UNKNOWN, */
  172.                                  /* then bit0=1 : LVDS,bit1=1 : trumpion, */
  173.                                  /* bit2=1 : CH7005 & no video bridge if */
  174.                                  /* usExternalChip = 0. */
  175.                                  /* Note: CR37[3:1]: */
  176.                                  /*             001:SiS 301 */
  177.                                  /*             010:LVDS */
  178.                                  /*             011:Trumpion LVDS Scaling Chip */
  179.                                  /*             100:LVDS(LCD-out)+Chrontel 7005 */
  180.                                  /*             101:Single Chrontel 7005 */
  181.  /* TW: This has changed on 310/325 series! */
  182.     ULONG  ulCRT2LCDType;        /* defined in the data structure type */
  183.                                  /* "SIS_LCD_TYPE" */
  184.                                      
  185.     BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */
  186.                                       
  187.     BOOLEAN bSkipDramSizing;     /* True: Skip video memory sizing. */
  188.     PSIS_DSReg  pSR;             /* restore SR registers in initial function. */
  189.                                  /* end data :(idx, val) =  (FF, FF). */
  190.                                  /* Note : restore SR registers if  */
  191.                                  /* bSkipDramSizing = TRUE */
  192.     PSIS_DSReg  pCR;             /* restore CR registers in initial function. */
  193.                                  /* end data :(idx, val) =  (FF, FF) */
  194.                                  /* Note : restore cR registers if  */
  195.                                  /* bSkipDramSizing = TRUE */
  196.     PSIS_QUERYSPACE  pQueryVGAConfigSpace; /* Get/Set VGA Configuration  */
  197.                                            /* space */
  198.  
  199.     PSIS_QUERYSPACE  pQueryNorthBridgeSpace;/* Get/Set North Bridge  */
  200.                                             /* space  */
  201.     UCHAR  szVBIOSVer[VBIOS_VER_MAX_LENGTH];
  202.     UCHAR  pdc; /* TW: PanelDelayCompensation */
  203. #ifdef LINUX_XF86
  204.     PCITAG PciTag; /* PCI Tag for Linux XF86 */
  205. #endif
  206. };
  207. #endif
  208. #endif 
  209. /* TW: Addtional IOCTL for communication sisfb <> X driver        */
  210. /*     If changing this, sisfb.h must also be changed (for sisfb) */
  211. #ifdef LINUX_XF86  /* We don't want the X driver to depend on the kernel source */
  212. /* TW: ioctl for identifying and giving some info (esp. memory heap start) */
  213. #define SISFB_GET_INFO    0x80046ef8  /* Wow, what a terrible hack... */
  214. /* TW: Structure argument for SISFB_GET_INFO ioctl  */
  215. typedef struct _SISFB_INFO sisfb_info, *psisfb_info;
  216. struct _SISFB_INFO {
  217. unsigned long sisfb_id;         /* for identifying sisfb */
  218. #ifndef SISFB_ID
  219. #define SISFB_ID   0x53495346    /* Identify myself with 'SISF' */
  220. #endif
  221.   int    chip_id; /* PCI ID of detected chip */
  222. int    memory; /* video memory in KB which sisfb manages */
  223. int    heapstart;               /* heap start (= sisfb "mem" argument) in KB */
  224. unsigned char fbvidmode; /* current sisfb mode */
  225. unsigned char sisfb_version;
  226. unsigned char sisfb_revision;
  227. unsigned char sisfb_patchlevel;
  228. unsigned char sisfb_caps; /* sisfb's capabilities */
  229. int    sisfb_tqlen; /* turbo queue length (in KB) */
  230. char reserved[249];  /* for future use */
  231. };
  232. #endif
  233. #ifndef WIN2000
  234. #ifndef WINCE_HEADER
  235. #ifndef BUS_DATA_TYPE
  236. typedef enum _BUS_DATA_TYPE {
  237.     ConfigurationSpaceUndefined = -1,
  238.     Cmos,
  239.     EisaConfiguration,
  240.     Pos,
  241.     CbusConfiguration,
  242.     PCIConfiguration,
  243.     VMEConfiguration,
  244.     NuBusConfiguration,
  245.     PCMCIAConfiguration,
  246.     MPIConfiguration,
  247.     MPSAConfiguration,
  248.     PNPISAConfiguration,
  249.     MaximumBusDataType
  250. } BUS_DATA_TYPE, *PBUS_DATA_TYPE;
  251. #endif
  252. #endif /* WINCE_HEADER */
  253. #ifndef PCI_TYPE0_ADDRESSES
  254. #define PCI_TYPE0_ADDRESSES             6
  255. #endif
  256. #ifndef PCI_TYPE1_ADDRESSES
  257. #define PCI_TYPE1_ADDRESSES             2
  258. #endif
  259. #ifndef WINCE_HEADER
  260. #ifndef PCI_COMMON_CONFIG
  261. typedef struct _PCI_COMMON_CONFIG {
  262.     USHORT  VendorID;                   /* (ro)                 */
  263.     USHORT  DeviceID;                   /* (ro)                 */
  264.     USHORT  Command;                    /* Device control       */
  265.     USHORT  Status;
  266.     UCHAR   RevisionID;                 /* (ro)                 */
  267.     UCHAR   ProgIf;                     /* (ro)                 */
  268.     UCHAR   SubClass;                   /* (ro)                 */
  269.     UCHAR   BaseClass;                  /* (ro)                 */
  270.     UCHAR   CacheLineSize;              /* (ro+)                */
  271.     UCHAR   LatencyTimer;               /* (ro+)                */
  272.     UCHAR   HeaderType;                 /* (ro)                 */
  273.     UCHAR   BIST;                       /* Built in self test   */
  274.     union {
  275.         struct _PCI_HEADER_TYPE_0 {
  276.             ULONG   BaseAddresses[PCI_TYPE0_ADDRESSES];
  277.             ULONG   CIS;
  278.             USHORT  SubVendorID;
  279.             USHORT  SubSystemID;
  280.             ULONG   ROMBaseAddress;
  281.             ULONG   Reserved2[2];
  282.             UCHAR   InterruptLine;      /*                    */
  283.             UCHAR   InterruptPin;       /* (ro)               */
  284.             UCHAR   MinimumGrant;       /* (ro)               */
  285.             UCHAR   MaximumLatency;     /* (ro)               */
  286.         } type0;
  287.     } u;
  288.     UCHAR   DeviceSpecific[192];
  289. } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
  290. #endif
  291. #endif /* WINCE_HEADER */
  292. #ifndef FIELD_OFFSET
  293. #define FIELD_OFFSET(type, field)    ((LONG)&(((type *)0)->field))
  294. #endif
  295. #ifndef PCI_COMMON_HDR_LENGTH
  296. #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET (PCI_COMMON_CONFIG, DeviceSpecific))
  297. #endif
  298. #endif
  299. #endif