/[pearpc]/src/io/graphic/gcard.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /src/io/graphic/gcard.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Wed Sep 5 17:11:21 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 3781 byte(s)
import upstream CVS
1 /*
2 * PearPC
3 * gcard.h
4 *
5 * Copyright (C) 2003 Sebastian Biallas (sb@biallas.net)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #ifndef __IO_GCARD_H__
22 #define __IO_GCARD_H__
23
24 #include "system/types.h"
25 #include "system/display.h"
26 #include "debug/tracers.h"
27
28 #define IO_GCARD_FRAMEBUFFER_EA 0xd0000000
29 #define IO_GCARD_FRAMEBUFFER_PA_START 0x84000000
30 #define IO_GCARD_FRAMEBUFFER_PA_END 0x85000000
31 //#define IO_GCARD_FRAMEBUFFER_PA_START 0x81000000
32 //#define IO_GCARD_FRAMEBUFFER_PA_END 0x82000000
33
34 #include "io/pci/pci.h"
35
36 class PCI_GCard: public PCI_Device {
37 public:
38 PCI_GCard();
39 virtual bool readDeviceMem(uint r, uint32 address, uint32 &data, uint size);
40 virtual bool writeDeviceMem(uint r, uint32 address, uint32 data, uint size);
41 };
42
43
44 void FASTCALL gcard_write_1(uint32 addr, uint32 data);
45 void FASTCALL gcard_write_2(uint32 addr, uint32 data);
46 void FASTCALL gcard_write_4(uint32 addr, uint32 data);
47 void FASTCALL gcard_write_8(uint32 addr, uint64 data);
48 void FASTCALL gcard_write_16(uint32 addr, uint128 *data);
49 void FASTCALL gcard_write_16_native(uint32 addr, uint128 *data);
50 void FASTCALL gcard_read_1(uint32 addr, uint32 &data);
51 void FASTCALL gcard_read_2(uint32 addr, uint32 &data);
52 void FASTCALL gcard_read_4(uint32 addr, uint32 &data);
53 void FASTCALL gcard_read_8(uint32 addr, uint64 &data);
54 void FASTCALL gcard_read_16(uint32 addr, uint128 *data);
55 void FASTCALL gcard_read_16_native(uint32 addr, uint128 *data);
56
57 static inline void gcard_write(uint32 addr, uint32 data, int size)
58 {
59 switch (size) {
60 case 1:
61 gcard_write_1(addr, data);
62 break;
63 case 2:
64 gcard_write_2(addr, data);
65 break;
66 case 4:
67 gcard_write_4(addr, data);
68 break;
69 default:
70 IO_GRAPHIC_ERR("unknown size %d", size);
71 }
72 }
73
74 static inline void gcard_read(uint32 addr, uint32 &data, int size)
75 {
76 switch (size) {
77 case 1:
78 gcard_read_1(addr, data);
79 break;
80 case 2:
81 gcard_read_2(addr, data);
82 break;
83 case 4:
84 gcard_read_4(addr, data);
85 break;
86 default:
87 IO_GRAPHIC_ERR("unknown size");
88 }
89 }
90
91 static inline void gcard_write64(uint32 addr, uint64 data)
92 {
93 gcard_write_8(addr, data);
94 }
95
96 static inline void gcard_read64(uint32 addr, uint64 &data)
97 {
98 gcard_read_8(addr, data);
99 }
100
101 static inline void gcard_write128(uint32 addr, uint128 *data)
102 {
103 gcard_write_16(addr, data);
104 }
105
106 static inline void gcard_write128_native(uint32 addr, uint128 *data)
107 {
108 gcard_write_16_native(addr, data);
109 }
110
111 static inline void gcard_read128(uint32 addr, uint128 *data)
112 {
113 gcard_read_16(addr, data);
114 }
115
116 static inline void gcard_read128_native(uint32 addr, uint128 *data)
117 {
118 gcard_read_16_native(addr, data);
119 }
120
121 void gcard_raise_interrupt();
122
123 void gcard_osi(int cpu);
124 bool gcard_set_mode(DisplayCharacteristics &mode);
125
126
127 void gcard_init();
128 void gcard_done();
129 void gcard_init_modes();
130 void gcard_init_host_modes();
131 void gcard_init_config();
132
133 bool displayCharacteristicsFromString(DisplayCharacteristics &aChar, const String &s);
134 void gcard_add_characteristic(const DisplayCharacteristics &aChar);
135 bool gcard_supports_characteristic(const DisplayCharacteristics &aChar);
136 bool gcard_finish_characteristic(DisplayCharacteristics &aChar);
137
138 #endif
139

  ViewVC Help
Powered by ViewVC 1.1.26