1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: 16: 17: 18:
19: #include <tk/tkernel.h>
20: #include <libstr.h>
21: #include <device/screen.h>
22: #include <device/sdrvif.h>
23: #include <device/devconf.h>
24:
25: #ifdef DEBUG
26: #define DP(exp) printf exp
27: #else
28: #define DP(exp)
29: #endif
30:
31: 32: 33:
34: #define L_OEMNAME 32
35: #define L_CHIPINF 32
36: typedef struct {
37: B oemname[L_OEMNAME+1];
38: B chipinf[L_CHIPINF+1];
39: UH vesaver;
40: UB reqmode;
41: UB curmode;
42: UW attr;
43: UW paneltype;
44: UW modemap;
45: void *framebuf_addr;
46: W framebuf_total;
47: W framebuf_rowb;
48: W banksize;
49: W bankshift;
50:
51: W vfreq;
52: W pciaddr;
53: UH vendorid;
54: UH deviceid;
55: UW maxvfreq;
56:
57: W width;
58: W height;
59: W pixbits;
60: W act_width;
61: W act_height;
62:
63: void *f_addr;
64: void *v_addr;
65: void *baseaddr;
66: W rowbytes;
67: W vramsz;
68: W vramrng;
69:
70: W cmapent;
71: COLOR *cmap;
72:
73: W pixbyte;
74:
75: W rotate;
76: W fb_width;
77: W fb_height;
78:
79:
80:
81:
82: void (*fn_setmode)(W flg);
83:
84:
85: void (*fn_setcmap)(COLOR *cmap, W ix, W nent);
86:
87:
88: void (*fn_banksw)(W bankno);
89:
90: void (*fn_updscr)(W x, W y, W dx, W dy);
91:
92:
93: ER (*fn_bright)(W *brightness, BOOL set);
94:
95:
96: ER (*fn_write)(W kind, void *buf, W size);
97:
98:
99: void (*fn_susres)(BOOL suspend);
100:
101:
102: void *extwrk;
103: } VideoInf;
104:
105: 106: 107:
108: #define BPP_24 0x20
109: #define DACBITS_8 0x40
110: #define LINEAR_FRAMEBUF 0x80
111:
112: #define SUPPORT_VFREQ 0x0200
113: #define USE_VVRAM 0x1000
114: #define NEED_FINPROC 0x10000
115: #define NEED_SUSRESPROC 0x20000
116:
117: 118: 119:
120: #define MIN_VFREQ 40
121: #define MAX_VFREQ 100
122:
123: 124: 125: 126:
127: #define allowUserVRAM (Vinf.vramrng == 3 && !(Vinf.attr & USE_VVRAM))
128:
129: 130: 131:
132: IMPORT VideoInf Vinf;
133:
134: 135: 136:
137:
138: IMPORT ER getMemory(W size, void **ptr);
139: IMPORT void* getPhyMemory(W size, void **phyaddr);
140: IMPORT ER mapFrameBuf(void *paddr, W len, void **laddr);
141: IMPORT ER initSCREEN(void);
142: IMPORT ER finishSCREEN(void);
143: IMPORT ER suspendSCREEN(void);
144: IMPORT ER resumeSCREEN(void);
145: IMPORT ER getSCRXSPEC(DEV_SPEC *spec, W mode);
146: IMPORT ER getSCRSPEC(DEV_SPEC *spec);
147: IMPORT W setModeStr(W mode, TC *str, W pos, W x, W y, W bpp, TC *desc);
148: IMPORT INT getSCRLIST(TC *str);
149: IMPORT ER getsetSCRNO(W *scnum, BOOL suspend, BOOL set);
150: IMPORT INT getsetSCRCOLOR(COLOR *cmap, BOOL set);
151: IMPORT ER getSCRBMP(BMP *bmp);
152: IMPORT ER getsetSCRBRIGHT(W *brightness, BOOL set);
153: IMPORT ER getSCRUPDFN(FP *updfn);
154: IMPORT ER getsetSCRVFREQ(W *vfreq, BOOL set);
155: IMPORT ER getsetSCRADJUST(ScrAdjust *adj, BOOL set);
156: IMPORT ER getSCRDEVINFO(ScrDevInfo *inf);
157: IMPORT ER setSCRUPDRECT(RECT *rp);
158: IMPORT ER setSCRWRITE(W kind, void *buf, W size);
159:
160:
161: IMPORT W getSpecSCRXSPEC(DEV_SPEC *spec, W mode);
162: IMPORT W getSpecSCRLIST(TC *str, W pos);
163:
164:
165: IMPORT W GetDevConf(UB *name, W *val);