add place-holder directory for the a3000 wd533c93 scsi controller implementation.
[AROS.git] / arch / m68k-amiga / hidd / p96gfx / p96gfx_card.c
blob84262d6c0693e6c0b7f52e1ac7cea980fa91ebfe
1 /*
2 Copyright © 2019, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Stubs used to call into a p96 card driver.
6 */
8 #include <aros/debug.h>
9 #include <proto/oop.h>
10 #include <hidd/hidd.h>
11 #include <hidd/gfx.h>
12 #include <aros/libcall.h>
13 #include <aros/symbolsets.h>
14 #include <oop/oop.h>
16 #include "p96gfx_intern.h"
17 #include "p96gfx_bitmap.h"
18 #include "p96gfx_rtg.h"
19 #include "p96call.h"
21 static inline APTR __cardFunc(struct p96gfx_carddata *cid, WORD offset)
23 APTR code = (APTR)((ULONG*)(((UBYTE*)(cid->boardinfo)) + offset))[0];
24 D(bug("->RTG off=%d code=%p\n", (offset - (PSSO_BoardInfo_AllocCardMem)) / 4, code));
25 pw (cid->boardinfo + PSSO_BoardInfo_AROSFlag, 1);
26 return code;
29 BOOL FindCard(struct p96gfx_carddata *cid)
31 if (cid->CardBase)
32 return AROS_LVO_CALL1(BOOL,
33 AROS_LCA(APTR, cid->boardinfo, A0),
34 struct Library*, cid->CardBase, 5, );
35 else
36 return P96_LC1(BOOL, cid->p96romvector, 16,
37 AROS_LCA(APTR, cid->boardinfo, A0));
40 BOOL InitCard(struct p96gfx_carddata *cid)
42 if (cid->CardBase)
43 return AROS_LVO_CALL2(BOOL,
44 AROS_LCA(APTR, cid->boardinfo, A0),
45 AROS_LCA(APTR, NULL, A1),
46 struct Library*, cid->CardBase, 6, );
47 else
48 return P96_LC2(BOOL, cid->p96romvector, 29,
49 AROS_LCA(APTR, cid->boardinfo, A0), // For current WinP96s
50 AROS_LCA(APTR, cid->boardinfo, A2)); // For older E-P96s
53 void WaitBlitter(struct p96gfx_carddata *cid)
55 if (cid->CardBase)
56 AROS_CALL1NR(void, __cardFunc(cid, PSSO_BoardInfo_WaitBlitter),
57 AROS_LCA(APTR, cid->boardinfo, A0),
58 struct Library*, cid->CardBase);
61 void SetInterrupt(struct p96gfx_carddata *cid, ULONG state)
63 if (cid->CardBase)
64 AROS_CALL2(ULONG, __cardFunc(cid, PSSO_BoardInfo_SetInterrupt),
65 AROS_LCA(APTR, cid->boardinfo, A0),
66 AROS_LCA(ULONG, state, D0),
67 struct Library*, cid->CardBase);
70 ULONG GetPixelClock(struct p96gfx_carddata *cid, struct ModeInfo *mi, ULONG index, ULONG rgbformat)
72 if (cid->CardBase)
73 return AROS_CALL4(ULONG, __cardFunc(cid, PSSO_BoardInfo_GetPixelClock),
74 AROS_LCA(APTR, cid->boardinfo, A0),
75 AROS_LCA(APTR, mi, A1),
76 AROS_LCA(ULONG, index, D0),
77 AROS_LCA(ULONG, rgbformat, D7),
78 struct Library*, cid->CardBase);
79 else
80 return -2;
83 void SetMemoryMode(struct p96gfx_carddata *cid, ULONG rgbformat)
85 if (cid->CardBase)
86 AROS_CALL2(ULONG, __cardFunc(cid, PSSO_BoardInfo_SetMemoryMode),
87 AROS_LCA(APTR, cid->boardinfo, A0),
88 AROS_LCA(ULONG, rgbformat, D7),
89 struct Library*, cid->CardBase);
92 ULONG ResolvePixelClock(struct p96gfx_carddata *cid, struct ModeInfo *mi, ULONG pixelclock, ULONG rgbformat)
94 if (cid->CardBase)
95 return AROS_CALL4(ULONG, __cardFunc(cid, PSSO_BoardInfo_ResolvePixelClock),
96 AROS_LCA(APTR, cid->boardinfo, A0),
97 AROS_LCA(APTR, mi, A1),
98 AROS_LCA(ULONG, pixelclock, D0),
99 AROS_LCA(ULONG, rgbformat, D7),
100 struct Library*, cid->CardBase);
101 else
102 return -2;
105 ULONG SetClock(struct p96gfx_carddata *cid)
107 if (cid->CardBase)
108 return AROS_CALL1(ULONG, __cardFunc(cid, PSSO_BoardInfo_SetClock),
109 AROS_LCA(APTR, cid->boardinfo, A0),
110 struct Library*, cid->CardBase);
111 else
112 return -2;
115 BOOL SetDisplay(struct p96gfx_carddata *cid, BOOL state)
117 if (cid->CardBase)
118 return AROS_CALL2(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetDisplay),
119 AROS_LCA(APTR, cid->boardinfo, A0),
120 AROS_LCA(BOOL, state, D0),
121 struct Library*, cid->CardBase);
122 else
123 return P96_LC2(BOOL, cid->p96romvector, 26,
124 AROS_LCA(APTR, cid->boardinfo, A0),
125 AROS_LCA(BOOL, state, D0));
128 BOOL SetSwitch(struct p96gfx_carddata *cid, BOOL state)
130 if (cid->CardBase)
131 return AROS_CALL2(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetSwitch),
132 AROS_LCA(APTR, cid->boardinfo, A0),
133 AROS_LCA(BOOL, state, D0),
134 struct Library*, cid->CardBase);
135 else
136 return P96_LC2(BOOL, cid->p96romvector, 18,
137 AROS_LCA(APTR, cid->boardinfo, A0),
138 AROS_LCA(BOOL, state, D0));
141 void SetColorArray(struct p96gfx_carddata *cid, UWORD start, UWORD count)
143 if (cid->CardBase)
144 AROS_CALL3(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetColorArray),
145 AROS_LCA(APTR, cid->boardinfo, A0),
146 AROS_LCA(WORD, start, D0),
147 AROS_LCA(WORD, count, D1),
148 struct Library*, cid->CardBase);
149 else
150 P96_LC3(BOOL, cid->p96romvector, 19,
151 AROS_LCA(APTR, cid->boardinfo, A0),
152 AROS_LCA(WORD, start, D0),
153 AROS_LCA(WORD, count, D1));
156 void SetDAC(struct p96gfx_carddata *cid)
158 if (cid->CardBase)
159 AROS_CALL2(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetDAC),
160 AROS_LCA(APTR, cid->boardinfo, A0),
161 AROS_LCA(ULONG, *cid->rgbformat, D7),
162 struct Library*, cid->CardBase);
163 else
164 P96_LC2(BOOL, cid->p96romvector, 20,
165 AROS_LCA(APTR, cid->boardinfo, A0),
166 AROS_LCA(ULONG, *cid->rgbformat, D7));
169 void SetGC(struct p96gfx_carddata *cid, struct ModeInfo *mi, BOOL border)
171 if (cid->CardBase)
172 AROS_CALL3(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetGC),
173 AROS_LCA(APTR, cid->boardinfo, A0),
174 AROS_LCA(APTR, mi, A1),
175 AROS_LCA(BOOL, border, D0),
176 struct Library*, cid->CardBase);
177 else
178 P96_LC3(BOOL, cid->p96romvector, 21,
179 AROS_LCA(APTR, cid->boardinfo, A0),
180 AROS_LCA(APTR, mi, A1),
181 AROS_LCA(BOOL, border, D0));
184 void SetPanning(struct p96gfx_carddata *cid, UBYTE *video, UWORD width, WORD x, WORD y)
186 if (cid->CardBase)
187 AROS_CALL6(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetPanning),
188 AROS_LCA(APTR, cid->boardinfo, A0),
189 AROS_LCA(APTR, video, A1),
190 AROS_LCA(UWORD, width, D0),
191 AROS_LCA(WORD, x, D1),
192 AROS_LCA(WORD, y, D2),
193 AROS_LCA(ULONG, *cid->rgbformat, D7),
194 struct Library*, cid->CardBase);
195 else
196 P96_LC6(BOOL, cid->p96romvector, 22,
197 AROS_LCA(APTR, cid->boardinfo, A0),
198 AROS_LCA(APTR, video, A1),
199 AROS_LCA(UWORD, width, D0),
200 AROS_LCA(WORD, x, D1),
201 AROS_LCA(WORD, y, D2),
202 AROS_LCA(ULONG, *cid->rgbformat, D7));
205 BOOL DrawLine(struct p96gfx_carddata *cid, struct RenderInfo *ri,
206 struct Line * line, ULONG rgbformat)
208 if (cid->CardBase) {
209 AROS_CALL4(BOOL, __cardFunc(cid, PSSO_BoardInfo_DrawLine),
210 AROS_LCA(APTR, cid->boardinfo, A0),
211 AROS_LCA(APTR, ri, A1),
212 AROS_LCA(struct Line *, line, A2),
213 AROS_LCA(ULONG, rgbformat, D7),
214 struct Library*, cid->CardBase);
215 return gw (cid->boardinfo + PSSO_BoardInfo_AROSFlag);
217 #if (0)
218 else
219 return P96_LC4(BOOL, cid->p96romvector, 28,
220 AROS_LCA(APTR, cid->boardinfo, A0),
221 AROS_LCA(APTR, ri, A1),
222 AROS_LCA(struct Line *, line, A2),
223 AROS_LCA(ULONG, rgbformat, D7));
224 #else
225 return FALSE;
226 #endif
229 BOOL BlitRect(struct p96gfx_carddata *cid, struct RenderInfo *ri,
230 WORD sx, WORD sy, WORD dx, WORD dy, WORD w, WORD h, UBYTE mask, ULONG rgbformat)
232 if (cid->CardBase) {
233 AROS_CALL10(BOOL, __cardFunc(cid, PSSO_BoardInfo_BlitRect),
234 AROS_LCA(APTR, cid->boardinfo, A0),
235 AROS_LCA(APTR, ri, A1),
236 AROS_LCA(WORD, sx, D0),
237 AROS_LCA(WORD, sy, D1),
238 AROS_LCA(WORD, dx, D2),
239 AROS_LCA(WORD, dy, D3),
240 AROS_LCA(WORD, w, D4),
241 AROS_LCA(WORD, h, D5),
242 AROS_LCA(UBYTE, mask, D6),
243 AROS_LCA(ULONG, rgbformat, D7),
244 struct Library*, cid->CardBase);
245 return gw (cid->boardinfo + PSSO_BoardInfo_AROSFlag);
247 #if (0)
248 else
249 return P96_LC10(BOOL, cid->p96romvector, 28,
250 AROS_LCA(APTR, cid->boardinfo, A0),
251 AROS_LCA(APTR, ri, A1),
252 AROS_LCA(WORD, sx, D0),
253 AROS_LCA(WORD, sy, D1),
254 AROS_LCA(WORD, dx, D2),
255 AROS_LCA(WORD, dy, D3),
256 AROS_LCA(WORD, w, D4),
257 AROS_LCA(WORD, h, D5),
258 AROS_LCA(UBYTE, mask, D6),
259 AROS_LCA(ULONG, rgbformat, D7));
260 #else
261 return FALSE;
262 #endif
265 BOOL FillRect(struct p96gfx_carddata *cid, struct RenderInfo *ri, WORD x, WORD y, WORD w, WORD h, ULONG pen, UBYTE mask, ULONG rgbformat)
267 if (cid->CardBase) {
268 AROS_CALL9(BOOL, __cardFunc(cid, PSSO_BoardInfo_FillRect),
269 AROS_LCA(APTR, cid->boardinfo, A0),
270 AROS_LCA(APTR, ri, A1),
271 AROS_LCA(WORD, x, D0),
272 AROS_LCA(WORD, y, D1),
273 AROS_LCA(WORD, w, D2),
274 AROS_LCA(WORD, h, D3),
275 AROS_LCA(ULONG, pen, D4),
276 AROS_LCA(UBYTE, mask, D5),
277 AROS_LCA(ULONG, rgbformat, D7),
278 struct Library*, cid->CardBase);
279 return gw (cid->boardinfo + PSSO_BoardInfo_AROSFlag);
280 } else
281 return P96_LC9(BOOL, cid->p96romvector, 17,
282 AROS_LCA(APTR, cid->boardinfo, A0),
283 AROS_LCA(APTR, ri, A1),
284 AROS_LCA(WORD, x, D0),
285 AROS_LCA(WORD, y, D1),
286 AROS_LCA(WORD, w, D2),
287 AROS_LCA(WORD, h, D3),
288 AROS_LCA(ULONG, pen, D4),
289 AROS_LCA(UBYTE, mask, D5),
290 AROS_LCA(ULONG, rgbformat, D7));
293 BOOL InvertRect(struct p96gfx_carddata *cid, struct RenderInfo *ri, WORD x, WORD y, WORD w, WORD h, UBYTE mask, ULONG rgbformat)
295 if (cid->CardBase) {
296 AROS_CALL8(BOOL, __cardFunc(cid, PSSO_BoardInfo_InvertRect),
297 AROS_LCA(APTR, cid->boardinfo, A0),
298 AROS_LCA(APTR, ri, A1),
299 AROS_LCA(WORD, x, D0),
300 AROS_LCA(WORD, y, D1),
301 AROS_LCA(WORD, w, D2),
302 AROS_LCA(WORD, h, D3),
303 AROS_LCA(UBYTE, mask, D4),
304 AROS_LCA(ULONG, rgbformat, D7),
305 struct Library*, cid->CardBase);
306 return gw (cid->boardinfo + PSSO_BoardInfo_AROSFlag);
307 } else
308 return P96_LC8(BOOL, cid->p96romvector, 31,
309 AROS_LCA(APTR, cid->boardinfo, A0),
310 AROS_LCA(APTR, ri, A1),
311 AROS_LCA(WORD, x, D0),
312 AROS_LCA(WORD, y, D1),
313 AROS_LCA(WORD, w, D2),
314 AROS_LCA(WORD, h, D3),
315 AROS_LCA(UBYTE, mask, D4),
316 AROS_LCA(ULONG, rgbformat, D7));
319 BOOL BlitRectNoMaskComplete(struct p96gfx_carddata *cid, struct RenderInfo *risrc, struct RenderInfo *ridst,
320 WORD sx, WORD sy, WORD dx, WORD dy, WORD w, WORD h, UBYTE opcode, ULONG rgbformat)
322 if (cid->CardBase) {
323 AROS_CALL11(BOOL, __cardFunc(cid, PSSO_BoardInfo_BlitRectNoMaskComplete),
324 AROS_LCA(APTR, cid->boardinfo, A0),
325 AROS_LCA(APTR, risrc, A1),
326 AROS_LCA(APTR, ridst, A2),
327 AROS_LCA(WORD, sx, D0),
328 AROS_LCA(WORD, sy, D1),
329 AROS_LCA(WORD, dx, D2),
330 AROS_LCA(WORD, dy, D3),
331 AROS_LCA(WORD, w, D4),
332 AROS_LCA(WORD, h, D5),
333 AROS_LCA(UBYTE, opcode, D6),
334 AROS_LCA(ULONG, rgbformat, D7),
335 struct Library*, cid->CardBase);
336 return gw (cid->boardinfo + PSSO_BoardInfo_AROSFlag);
337 } else
338 return P96_LC11(BOOL, cid->p96romvector, 28,
339 AROS_LCA(APTR, cid->boardinfo, A0),
340 AROS_LCA(APTR, risrc, A1),
341 AROS_LCA(APTR, ridst, A2),
342 AROS_LCA(WORD, sx, D0),
343 AROS_LCA(WORD, sy, D1),
344 AROS_LCA(WORD, dx, D2),
345 AROS_LCA(WORD, dy, D3),
346 AROS_LCA(WORD, w, D4),
347 AROS_LCA(WORD, h, D5),
348 AROS_LCA(UBYTE, opcode, D6),
349 AROS_LCA(ULONG, rgbformat, D7));
352 BOOL BlitPattern(struct p96gfx_carddata *cid, struct RenderInfo *ri, struct Pattern *pat,
353 WORD x, WORD y, WORD w, WORD h, UBYTE mask, ULONG rgbformat)
355 if (cid->CardBase) {
356 AROS_CALL9(BOOL, __cardFunc(cid, PSSO_BoardInfo_BlitPattern),
357 AROS_LCA(APTR, cid->boardinfo, A0),
358 AROS_LCA(APTR, ri, A1),
359 AROS_LCA(APTR, pat, A2),
360 AROS_LCA(WORD, x, D0),
361 AROS_LCA(WORD, y, D1),
362 AROS_LCA(WORD, w, D2),
363 AROS_LCA(WORD, h, D3),
364 AROS_LCA(UBYTE, mask, D4),
365 AROS_LCA(ULONG, rgbformat, D7),
366 struct Library*, cid->CardBase);
367 return gw (cid->boardinfo + PSSO_BoardInfo_AROSFlag);
368 } else
369 return P96_LC9(BOOL, cid->p96romvector, 30,
370 AROS_LCA(APTR, cid->boardinfo, A0),
371 AROS_LCA(APTR, ri, A1),
372 AROS_LCA(APTR, pat, A2),
373 AROS_LCA(WORD, x, D0),
374 AROS_LCA(WORD, y, D1),
375 AROS_LCA(WORD, w, D2),
376 AROS_LCA(WORD, h, D3),
377 AROS_LCA(UBYTE, mask, D4),
378 AROS_LCA(ULONG, rgbformat, D7));
381 BOOL BlitTemplate(struct p96gfx_carddata *cid, struct RenderInfo *ri, struct Template *tmpl,
382 WORD x, WORD y, WORD w, WORD h, UBYTE mask, ULONG rgbformat)
384 if (cid->CardBase) {
385 AROS_CALL9(BOOL, __cardFunc(cid, PSSO_BoardInfo_BlitTemplate),
386 AROS_LCA(APTR, cid->boardinfo, A0),
387 AROS_LCA(APTR, ri, A1),
388 AROS_LCA(APTR, tmpl, A2),
389 AROS_LCA(WORD, x, D0),
390 AROS_LCA(WORD, y, D1),
391 AROS_LCA(WORD, w, D2),
392 AROS_LCA(WORD, h, D3),
393 AROS_LCA(UBYTE, mask, D4),
394 AROS_LCA(ULONG, rgbformat, D7),
395 struct Library*, cid->CardBase);
396 return gw (cid->boardinfo + PSSO_BoardInfo_AROSFlag);
397 } else
398 return P96_LC9(BOOL, cid->p96romvector, 27,
399 AROS_LCA(APTR, cid->boardinfo, A0),
400 AROS_LCA(APTR, ri, A1),
401 AROS_LCA(APTR, tmpl, A2),
402 AROS_LCA(WORD, x, D0),
403 AROS_LCA(WORD, y, D1),
404 AROS_LCA(WORD, w, D2),
405 AROS_LCA(WORD, h, D3),
406 AROS_LCA(UBYTE, mask, D4),
407 AROS_LCA(ULONG, rgbformat, D7));
410 WORD CalculateBytesPerRow(struct p96gfx_carddata *cid, WORD width, ULONG rgbformat)
412 if (cid->CardBase)
413 return AROS_CALL3(BOOL, __cardFunc(cid, PSSO_BoardInfo_CalculateBytesPerRow),
414 AROS_LCA(APTR, cid->boardinfo, A0),
415 AROS_LCA(UWORD, width, D0),
416 AROS_LCA(ULONG, rgbformat, D7),
417 struct Library*, cid->CardBase);
418 else
419 return P96_LC3(BOOL, cid->p96romvector, 23,
420 AROS_LCA(APTR, cid->boardinfo, A0),
421 AROS_LCA(UWORD, width, D0),
422 AROS_LCA(ULONG, rgbformat, D7));
425 BOOL SetSprite(struct p96gfx_carddata *cid, BOOL activate)
427 if (cid->CardBase)
428 return AROS_CALL3(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetSprite),
429 AROS_LCA(APTR, cid->boardinfo, A0),
430 AROS_LCA(BOOL, activate, D0),
431 AROS_LCA(ULONG, *cid->rgbformat, D7),
432 struct Library*, cid->CardBase);
433 return P96_LC3(BOOL, cid->p96romvector, 36,
434 AROS_LCA(APTR, cid->boardinfo, A0),
435 AROS_LCA(BOOL, activate, D0),
436 AROS_LCA(ULONG, *cid->rgbformat, D7));
439 BOOL SetSpritePosition(struct p96gfx_carddata *cid)
441 if (cid->CardBase)
442 return AROS_CALL2(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetSpritePosition),
443 AROS_LCA(APTR, cid->boardinfo, A0),
444 AROS_LCA(ULONG, *cid->rgbformat, D7),
445 struct Library*, cid->CardBase);
446 return P96_LC2(BOOL, cid->p96romvector, 37,
447 AROS_LCA(APTR, cid->boardinfo, A0),
448 AROS_LCA(ULONG, *cid->rgbformat, D7));
451 BOOL SetSpriteImage(struct p96gfx_carddata *cid)
453 if (cid->CardBase)
454 return AROS_CALL2(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetSpriteImage),
455 AROS_LCA(APTR, cid->boardinfo, A0),
456 AROS_LCA(ULONG, *cid->rgbformat, D7),
457 struct Library*, cid->CardBase);
458 return P96_LC2(BOOL, cid->p96romvector, 38,
459 AROS_LCA(APTR, cid->boardinfo, A0),
460 AROS_LCA(ULONG, *cid->rgbformat, D7));
463 BOOL SetSpriteColor(struct p96gfx_carddata *cid, UBYTE idx, UBYTE r, UBYTE g, UBYTE b)
465 if (cid->CardBase)
466 return AROS_CALL6(BOOL, __cardFunc(cid, PSSO_BoardInfo_SetSpriteColor),
467 AROS_LCA(APTR, cid->boardinfo, A0),
468 AROS_LCA(UBYTE, idx, D0),
469 AROS_LCA(UBYTE, r, D1),
470 AROS_LCA(UBYTE, g, D2),
471 AROS_LCA(UBYTE, b, D3),
472 AROS_LCA(ULONG, *cid->rgbformat, D7),
473 struct Library*, cid->CardBase);
474 return P96_LC6(BOOL, cid->p96romvector, 39,
475 AROS_LCA(APTR, cid->boardinfo, A0),
476 AROS_LCA(UBYTE, idx, D0),
477 AROS_LCA(UBYTE, r, D1),
478 AROS_LCA(UBYTE, g, D2),
479 AROS_LCA(UBYTE, b, D3),
480 AROS_LCA(ULONG, *cid->rgbformat, D7));