Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/modules/Resolution/915resolution.h

1/*
2 * resolution.h
3 *
4 *
5 * Created by Evan Lojewski on 3/4/10.
6 * Copyright 2009. All rights reserved.
7 *
8 */
9
10
11#ifndef __RESOLUTION_H
12#define __RESOLUTION_H
13
14#include "shortatombios.h"
15#include "edid.h"
16
17//Slice - moved to edid.h
18/*
19typedef struct _edid_mode {
20unsigned short pixel_clock;
21unsigned short h_active;
22unsigned short h_blanking;
23unsigned short v_active;
24unsigned short v_blanking;
25unsigned short h_sync_offset;
26unsigned short h_sync_width;
27unsigned short v_sync_offset;
28unsigned short v_sync_width;
29} edid_mode;
30*/
31
32
33void patchVideoBios();
34
35
36
37/* Copied from 915 resolution created by steve tomljenovic
38 *
39 * This code is based on the techniques used in :
40 *
41 * - 855patch. Many thanks to Christian Zietz (czietz gmx net)
42 * for demonstrating how to shadow the VBIOS into system RAM
43 * and then modify it.
44 *
45 * - 1280patch by Andrew Tipton (andrewtipton null li).
46 *
47 * - 855resolution by Alain Poirier
48 *
49 * This source code is into the public domain.
50 */
51
52#define VBIOS_START 0xc0000
53#define VBIOS_SIZE 0x10000
54
55#define FALSE 0
56#define TRUE 1
57
58#define MODE_TABLE_OFFSET_845G 617
59
60
61#define ATI_SIGNATURE1 "ATI MOBILITY RADEON"
62#define ATI_SIGNATURE2 "ATI Technologies Inc"
63#define NVIDIA_SIGNATURE "NVIDIA Corp"
64#define INTEL_SIGNATURE "Intel Corp"
65
66
67
68/*
69 * NVidia Defines and structures
70 */
71
72#define OFFSET_TO_VESA_TABLE_INDEX 2
73
74typedef struct {
75unsigned charucTable_Major;
76unsigned charucTable_Minor;
77unsigned charucTable_Rev;
78unsigned shortusTable_Size;
79} NV_COMMON_TABLE_HEADER;
80
81typedef struct {
82short reserved1;
83short reserved2;
84short reserved3;
85} NV_RESERVED;
86
87typedef struct {
88unsigned shortusPixel_Clock;
89unsigned shortusH_Active;
90NV_RESERVEDreserved1;
91unsigned shortusH_SyncStart;
92unsigned shortusH_SyncEnd;
93unsigned shortusH_Total;
94unsigned shortusV_Active;
95NV_RESERVEDreserved2;
96unsigned shortusV_SyncStart;
97unsigned shortusV_SyncEnd;
98unsigned shortusV_Total;
99unsigned shortreserved3;
100} NV_MODELINE;
101
102typedef struct {
103NV_COMMON_TABLE_HEADERsHeader;
104NV_MODELINE*sModelines;
105} NV_VESA_TABLE;
106
107/*---*/
108
109
110typedef enum {
111CT_UNKNOWN, CT_UNKNOWN_INTEL, CT_830, CT_845G, CT_855GM, CT_865G,
112CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ,
113CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X,
114CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,
115CT_GM45, CT_G41, CT_G31, CT_G45, CT_500, CT_3150,
116CT_CORE_PROC
117} chipset_type;
118
119
120
121typedef enum {
122BT_UNKNOWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA, BT_INTEL
123} bios_type;
124
125
126typedef struct {
127char*base;
128ATOM_ROM_HEADER*AtomRomHeader;
129unsigned short*MasterCommandTables;
130unsigned short*MasterDataTables;
131} bios_tables_t;
132
133typedef struct {
134UInt8 mode;
135UInt8 bits_per_pixel;
136UInt16 resolution;
137UInt8 unknown;
138} __attribute__((packed)) vbios_mode;
139
140typedef struct {
141UInt8 unknow1[2];
142UInt8 x1;
143UInt8 x_total;
144UInt8 x2;
145UInt8 y1;
146UInt8 y_total;
147UInt8 y2;
148} __attribute__((packed)) vbios_resolution_type1;
149
150typedef struct {
151unsigned long clock;
152
153UInt16 x1;
154UInt16 htotal;
155UInt16 x2;
156UInt16 hblank;
157UInt16 hsyncstart;
158UInt16 hsyncend;
159UInt16 y1;
160UInt16 vtotal;
161UInt16 y2;
162UInt16 vblank;
163UInt16 vsyncstart;
164UInt16 vsyncend;
165} __attribute__((packed)) vbios_modeline_type2;
166
167typedef struct {
168UInt8 xchars;
169UInt8 ychars;
170UInt8 unknown[4];
171
172vbios_modeline_type2 modelines[];
173} __attribute__((packed)) vbios_resolution_type2;
174
175typedef struct {
176unsigned long clock;
177
178UInt16 x1;
179UInt16 htotal;
180UInt16 x2;
181UInt16 hblank;
182UInt16 hsyncstart;
183UInt16 hsyncend;
184
185UInt16 y1;
186UInt16 vtotal;
187UInt16 y2;
188UInt16 vblank;
189UInt16 vsyncstart;
190UInt16 vsyncend;
191
192UInt16 timing_h;
193UInt16 timing_v;
194
195UInt8 unknown[6];
196} __attribute__((packed)) vbios_modeline_type3;
197
198typedef struct {
199unsigned char unknown[6];
200
201vbios_modeline_type3 modelines[];
202} __attribute__((packed)) vbios_resolution_type3;
203
204typedef struct {
205UInt32 chipset_id;
206chipset_type chipset;
207bios_type bios;
208
209bios_tables_t ati_tables;
210
211
212UInt32 bios_fd;
213char* bios_ptr;
214
215vbios_mode * mode_table;
216char * ati_mode_table;
217char * nv_mode_table;
218
219UInt32 mode_table_size;
220UInt8 b1, b2;
221
222UInt8 unlocked;
223} vbios_map;
224
225vbios_map * open_vbios(chipset_type);
226void close_vbios (vbios_map*);
227void unlock_vbios(vbios_map*);
228void relock_vbios(vbios_map*);
229void set_mode(vbios_map*, UInt32, UInt32, UInt32, UInt32, UInt32);
230
231#endif //__RESOLUTION_H
232

Archive Download this file

Revision: 2573