1 | /*␊ |
2 | * nviviaresolution.h␊ |
3 | * ␊ |
4 | *␊ |
5 | * Created by Le Bidou on 19/03/10.␊ |
6 | * Copyright 2010 ---. All rights reserved.␊ |
7 | *␊ |
8 | */␊ |
9 | ␊ |
10 | #ifndef _NVDA_RESOLUTION_HEADER_␊ |
11 | #define _NVDA_RESOLUTION_HEADER_␊ |
12 | ␊ |
13 | #include "libsaio.h"␊ |
14 | #include "autoresolution.h"␊ |
15 | ␊ |
16 | #define NVIDIA_SIGNATURE "NVIDIA Corp"␊ |
17 | ␊ |
18 | #define OFFSET_TO_VESA_TABLE_INDEX 2␊ |
19 | #define MAIN_VESA_TABLE 0␊ |
20 | #define SECOND_VESA_TABLE 1␊ |
21 | ␊ |
22 | #define HSyncPolarityMask␉␉0x4␊ |
23 | #define VSyncPolarityMask␉␉0x2␊ |
24 | #define isGraphicsModeMask␉␉0x1␊ |
25 | ␊ |
26 | typedef struct {␊ |
27 | ␉unsigned char␉tableMajor; //These names are probably wrong␊ |
28 | ␉unsigned char␉tableMinor;␊ |
29 | ␉unsigned char␉tableRev;␊ |
30 | ␉unsigned short␉tableSize;␊ |
31 | }__packed nvCommonTableHeader;␊ |
32 | ␊ |
33 | typedef struct {␊ |
34 | ␉unsigned short␉clock;␊ |
35 | ␉unsigned short␉hActive;␊ |
36 | ␉unsigned short hActiveMinusOne;␊ |
37 | ␉unsigned short␉reserved1;␊ |
38 | ␉unsigned short hActiveMinusOne_;␊ |
39 | ␉unsigned short␉hSyncStart;␊ |
40 | ␉unsigned short␉hSyncEnd;␊ |
41 | ␉unsigned short␉hTotal;␊ |
42 | ␉unsigned short␉vActive;␊ |
43 | ␉unsigned short vActiveMinusOne;␊ |
44 | ␉unsigned short␉reserved2;␊ |
45 | ␉unsigned short vActiveMinusOne_;␊ |
46 | ␉unsigned short␉vSyncStart;␊ |
47 | ␉unsigned short␉vSyncEnd;␊ |
48 | ␉unsigned short␉vTotal;␊ |
49 | ␉unsigned short␉reserved3;␊ |
50 | }__packed nvModeline;␊ |
51 | ␊ |
52 | typedef struct {␊ |
53 | ␉unsigned short hActive;␊ |
54 | ␉unsigned short vActive;␊ |
55 | ␉unsigned char hBlank;␊ |
56 | ␉unsigned char hSyncOffset;␊ |
57 | ␉unsigned char hSyncWidth;␊ |
58 | ␉unsigned char vBlank;␊ |
59 | ␉//unsigned char vSyncwidth;␊ |
60 | ␉unsigned char flags; //looks like flags & 1 means "Graphics Mode", to oppose to "Console Mode"␊ |
61 | ␉//on 7xxx the high four bits look like a mode id number.␊ |
62 | ␉//on 8xxx only the low four bits are used, standard graphics mode are always 5.␊ |
63 | ␉//␉␉it can be 1 (1400x1050 and 2048x1536) (HSync High, VSync High ?)␊ |
64 | ␉//␉␉␉␉ 3 (1440x900, 1680x1050 and 1920x1200) (HSync High, VSync Low ?)␊ |
65 | ␉//␉␉␉␉ 5 (Standard Timings) (HSync Low, VSync High ?)␊ |
66 | ␉//␉␉␉ or 7 (1280x800 and 768x340) (HSync Low, VSync Low ?)␊ |
67 | }__packed nvModeline_2;␊ |
68 | ␊ |
69 | typedef struct {␊ |
70 | ␉nvCommonTableHeader␉header;␊ |
71 | ␉nvModeline␉*␉␉␉modelines;␊ |
72 | }__packed nvVesaTable;␊ |
73 | ␊ |
74 | vBiosMap * openNvidiaVbios(vBiosMap *map);␊ |
75 | ␊ |
76 | bool nvidiaSetMode(sModeTable* table, uint8_t idx, uint32_t* x, uint32_t* y);␊ |
77 | ␊ |
78 | #endif |