1 /****************************************************************************
3 * Copyright (C) 2005 - 2011 by Vivante Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the license, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *****************************************************************************/
25 #include "gc_hal_kernel.h"
29 #include "gc_hal_kernel_hardware_command_vg.h"
31 #define _GC_OBJ_ZONE gcvZONE_COMMAND
33 /******************************************************************************\
34 ****************************** gckVGCOMMAND API code *****************************
35 \******************************************************************************/
37 /*******************************************************************************
39 ** gckVGCOMMAND_InitializeInfo
41 ** Initialize architecture dependent command buffer information.
45 ** gckVGCOMMAND Command
46 ** Pointer to the Command object.
53 gckVGCOMMAND_InitializeInfo(
54 IN gckVGCOMMAND Command
58 gcmkHEADER_ARG("Command=0x%x", Command
);
60 /* Verify the arguments. */
61 gcmkVERIFY_OBJECT(Command
, gcvOBJ_COMMAND
);
65 /* Reset interrupts. */
66 Command
->info
.feBufferInt
= -1;
67 Command
->info
.tsOverflowInt
= -1;
69 /* Set command buffer attributes. */
70 Command
->info
.addressAlignment
= 64;
71 Command
->info
.commandAlignment
= 8;
73 /* Determine command alignment address mask. */
74 Command
->info
.addressMask
= ((((gctUINT32
) (Command
->info
.addressAlignment
- 1)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 1:0) - (0 ? 1:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:0) - (0 ? 1:0) + 1))))))) << (0 ? 1:0))) | (((gctUINT32
) ((gctUINT32
) (0 ) & ((gctUINT32
) ((((1 ? 1:0) - (0 ? 1:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:0) - (0 ? 1:0) + 1))))))) << (0 ? 1:0)));
76 /* Query the number of bytes needed by the STATE command. */
77 gcmkERR_BREAK(gckVGCOMMAND_StateCommand(
78 Command
, 0x0, gcvNULL
, (gctUINT32
)~0, 0,
79 &Command
->info
.stateCommandSize
82 /* Query the number of bytes needed by the RESTART command. */
83 gcmkERR_BREAK(gckVGCOMMAND_RestartCommand(
84 Command
, gcvNULL
, (gctUINT32
)~0, 0,
85 &Command
->info
.restartCommandSize
88 /* Query the number of bytes needed by the FETCH command. */
89 gcmkERR_BREAK(gckVGCOMMAND_FetchCommand(
90 Command
, gcvNULL
, (gctUINT32
)~0, 0,
91 &Command
->info
.fetchCommandSize
94 /* Query the number of bytes needed by the CALL command. */
95 gcmkERR_BREAK(gckVGCOMMAND_CallCommand(
96 Command
, gcvNULL
, (gctUINT32
)~0, 0,
97 &Command
->info
.callCommandSize
100 /* Query the number of bytes needed by the RETURN command. */
101 gcmkERR_BREAK(gckVGCOMMAND_ReturnCommand(
103 &Command
->info
.returnCommandSize
106 /* Query the number of bytes needed by the EVENT command. */
107 gcmkERR_BREAK(gckVGCOMMAND_EventCommand(
108 Command
, gcvNULL
, gcvBLOCK_PIXEL
, -1,
109 &Command
->info
.eventCommandSize
112 /* Query the number of bytes needed by the END command. */
113 gcmkERR_BREAK(gckVGCOMMAND_EndCommand(
114 Command
, gcvNULL
, -1,
115 &Command
->info
.endCommandSize
118 /* Determine the tail reserve size. */
119 Command
->info
.staticTailSize
= gcmMAX(
120 Command
->info
.fetchCommandSize
,
122 Command
->info
.returnCommandSize
,
123 Command
->info
.endCommandSize
127 /* Determine the maximum tail size. */
128 Command
->info
.dynamicTailSize
129 = Command
->info
.staticTailSize
130 + Command
->info
.eventCommandSize
* gcvBLOCK_COUNT
;
139 /*******************************************************************************
141 ** gckVGCOMMAND_StateCommand
143 ** Append a STATE command at the specified location in the command buffer.
147 ** gckVGCOMMAND Command
148 ** Pointer to an gckVGCOMMAND object.
151 ** Harwdare destination pipe.
153 ** gctPOINTER Logical
154 ** Pointer to the current location inside the command buffer to append
155 ** STATE command at or gcvNULL to query the size of the command.
158 ** Starting register address of the state buffer.
159 ** If 'Logical' is gcvNULL, this argument is ignored.
162 ** Number of states in state buffer.
163 ** If 'Logical' is gcvNULL, this argument is ignored.
166 ** Pointer to the number of bytes available for the STATE command.
167 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
172 ** Pointer to a variable that will receive the number of bytes required
173 ** for the STATE command. If 'Bytes' is gcvNULL, nothing is returned.
176 gckVGCOMMAND_StateCommand(
177 IN gckVGCOMMAND Command
,
179 IN gctPOINTER Logical
,
180 IN gctUINT32 Address
,
182 IN OUT gctSIZE_T
* Bytes
185 gcmkHEADER_ARG("Command=0x%x Pipe=0x%x Logical=0x%x Address=0x%x Count=0x%x Bytes = 0x%x",
186 Command
, Pipe
, Logical
, Address
, Count
, Bytes
);
188 /* Verify the arguments. */
189 gcmkVERIFY_OBJECT(Command
, gcvOBJ_COMMAND
);
193 if (Logical
!= gcvNULL
)
195 gctUINT32_PTR buffer
;
197 /* Cast the buffer pointer. */
198 buffer
= (gctUINT32_PTR
) Logical
;
202 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28))) | (((gctUINT32
) (0x3 & ((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28)))
203 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 11:0) - (0 ? 11:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 11:0) - (0 ? 11:0) + 1))))))) << (0 ? 11:0))) | (((gctUINT32
) ((gctUINT32
) (Address
) & ((gctUINT32
) ((((1 ? 11:0) - (0 ? 11:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 11:0) - (0 ? 11:0) + 1))))))) << (0 ? 11:0)))
204 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 27:16) - (0 ? 27:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:16) - (0 ? 27:16) + 1))))))) << (0 ? 27:16))) | (((gctUINT32
) ((gctUINT32
) (Count
) & ((gctUINT32
) ((((1 ? 27:16) - (0 ? 27:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:16) - (0 ? 27:16) + 1))))))) << (0 ? 27:16)))
205 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 13:12) - (0 ? 13:12) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 13:12) - (0 ? 13:12) + 1))))))) << (0 ? 13:12))) | (((gctUINT32
) ((gctUINT32
) (Pipe
) & ((gctUINT32
) ((((1 ? 13:12) - (0 ? 13:12) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 13:12) - (0 ? 13:12) + 1))))))) << (0 ? 13:12)));
208 if (Bytes
!= gcvNULL
)
210 /* Return number of bytes required by the STATE command. */
211 *Bytes
= 4 * (Count
+ 1);
216 if (Logical
!= gcvNULL
)
218 gctUINT32_PTR buffer
;
220 /* Cast the buffer pointer. */
221 buffer
= (gctUINT32_PTR
) Logical
;
223 /* Append LOAD_STATE. */
225 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32
) (0x01 & ((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27)))
226 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32
) ((gctUINT32
) (Count
) & ((gctUINT32
) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16)))
227 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32
) ((gctUINT32
) (Address
) & ((gctUINT32
) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0)));
230 if (Bytes
!= gcvNULL
)
232 /* Return number of bytes required by the STATE command. */
233 *Bytes
= 4 * (Count
+ 1);
242 /*******************************************************************************
244 ** gckVGCOMMAND_RestartCommand
246 ** Form a RESTART command at the specified location in the command buffer.
250 ** gckVGCOMMAND Command
251 ** Pointer to an gckVGCOMMAND object.
253 ** gctPOINTER Logical
254 ** Pointer to the current location inside the command buffer to append
255 ** RESTART command at or gcvNULL to query the size of the command.
257 ** gctUINT32 FetchAddress
258 ** The address of another command buffer to be executed by this RESTART
259 ** command. If 'Logical' is gcvNULL, this argument is ignored.
261 ** gctUINT FetchCount
262 ** The number of 64-bit data quantities in another command buffer to
263 ** be executed by this RESTART command. If 'Logical' is gcvNULL, this
264 ** argument is ignored.
267 ** Pointer to the number of bytes available for the RESTART command.
268 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
273 ** Pointer to a variable that will receive the number of bytes required
274 ** for the RESTART command. If 'Bytes' is gcvNULL, nothing is returned.
277 gckVGCOMMAND_RestartCommand(
278 IN gckVGCOMMAND Command
,
279 IN gctPOINTER Logical
,
280 IN gctUINT32 FetchAddress
,
281 IN gctUINT FetchCount
,
282 IN OUT gctSIZE_T
* Bytes
285 gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x",
286 Command
, Logical
, FetchAddress
, FetchCount
, Bytes
);
287 /* Verify the arguments. */
288 gcmkVERIFY_OBJECT(Command
, gcvOBJ_COMMAND
);
292 if (Logical
!= gcvNULL
)
294 gctUINT32_PTR buffer
;
295 gctUINT32 beginEndMark
;
297 /* Cast the buffer pointer. */
298 buffer
= (gctUINT32_PTR
) Logical
;
300 /* Determine Begin/End flag. */
301 beginEndMark
= (FetchCount
> 0)
302 ? ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 24:24) - (0 ? 24:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 24:24) - (0 ? 24:24) + 1))))))) << (0 ? 24:24))) | (((gctUINT32
) (0x0 & ((gctUINT32
) ((((1 ? 24:24) - (0 ? 24:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 24:24) - (0 ? 24:24) + 1))))))) << (0 ? 24:24)))
303 : ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 24:24) - (0 ? 24:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 24:24) - (0 ? 24:24) + 1))))))) << (0 ? 24:24))) | (((gctUINT32
) (0x1 & ((gctUINT32
) ((((1 ? 24:24) - (0 ? 24:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 24:24) - (0 ? 24:24) + 1))))))) << (0 ? 24:24)));
305 /* Append RESTART. */
307 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28))) | (((gctUINT32
) (0x9 & ((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28)))
308 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 20:0) - (0 ? 20:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 20:0) - (0 ? 20:0) + 1))))))) << (0 ? 20:0))) | (((gctUINT32
) ((gctUINT32
) (FetchCount
) & ((gctUINT32
) ((((1 ? 20:0) - (0 ? 20:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 20:0) - (0 ? 20:0) + 1))))))) << (0 ? 20:0)))
315 if (Bytes
!= gcvNULL
)
317 /* Return number of bytes required by the RESTART command. */
323 return gcvSTATUS_NOT_SUPPORTED
;
332 /*******************************************************************************
334 ** gckVGCOMMAND_FetchCommand
336 ** Form a FETCH command at the specified location in the command buffer.
340 ** gckVGCOMMAND Command
341 ** Pointer to an gckVGCOMMAND object.
343 ** gctPOINTER Logical
344 ** Pointer to the current location inside the command buffer to append
345 ** FETCH command at or gcvNULL to query the size of the command.
347 ** gctUINT32 FetchAddress
348 ** The address of another command buffer to be executed by this FETCH
349 ** command. If 'Logical' is gcvNULL, this argument is ignored.
351 ** gctUINT FetchCount
352 ** The number of 64-bit data quantities in another command buffer to
353 ** be executed by this FETCH command. If 'Logical' is gcvNULL, this
354 ** argument is ignored.
357 ** Pointer to the number of bytes available for the FETCH command.
358 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
363 ** Pointer to a variable that will receive the number of bytes required
364 ** for the FETCH command. If 'Bytes' is gcvNULL, nothing is returned.
367 gckVGCOMMAND_FetchCommand(
368 IN gckVGCOMMAND Command
,
369 IN gctPOINTER Logical
,
370 IN gctUINT32 FetchAddress
,
371 IN gctUINT FetchCount
,
372 IN OUT gctSIZE_T
* Bytes
375 gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x",
376 Command
, Logical
, FetchAddress
, FetchCount
, Bytes
);
377 /* Verify the arguments. */
378 gcmkVERIFY_OBJECT(Command
, gcvOBJ_COMMAND
);
382 if (Logical
!= gcvNULL
)
384 gctUINT32_PTR buffer
;
386 /* Cast the buffer pointer. */
387 buffer
= (gctUINT32_PTR
) Logical
;
391 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28))) | (((gctUINT32
) (0x5 & ((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28)))
392 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 20:0) - (0 ? 20:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 20:0) - (0 ? 20:0) + 1))))))) << (0 ? 20:0))) | (((gctUINT32
) ((gctUINT32
) (FetchCount
) & ((gctUINT32
) ((((1 ? 20:0) - (0 ? 20:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 20:0) - (0 ? 20:0) + 1))))))) << (0 ? 20:0)));
395 = gcmFIXADDRESS(FetchAddress
);
398 if (Bytes
!= gcvNULL
)
400 /* Return number of bytes required by the FETCH command. */
406 if (Logical
!= gcvNULL
)
408 gctUINT32_PTR buffer
;
410 /* Cast the buffer pointer. */
411 buffer
= (gctUINT32_PTR
) Logical
;
415 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32
) (0x08 & ((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27)))
416 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32
) ((gctUINT32
) (FetchCount
) & ((gctUINT32
) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0)));
419 = gcmFIXADDRESS(FetchAddress
);
422 if (Bytes
!= gcvNULL
)
424 /* Return number of bytes required by the LINK command. */
434 /*******************************************************************************
436 ** gckVGCOMMAND_CallCommand
438 ** Append a CALL command at the specified location in the command buffer.
442 ** gckVGCOMMAND Command
443 ** Pointer to an gckVGCOMMAND object.
445 ** gctPOINTER Logical
446 ** Pointer to the current location inside the command buffer to append
447 ** CALL command at or gcvNULL to query the size of the command.
449 ** gctUINT32 FetchAddress
450 ** The address of another command buffer to be executed by this CALL
451 ** command. If 'Logical' is gcvNULL, this argument is ignored.
453 ** gctUINT FetchCount
454 ** The number of 64-bit data quantities in another command buffer to
455 ** be executed by this CALL command. If 'Logical' is gcvNULL, this
456 ** argument is ignored.
459 ** Pointer to the number of bytes available for the CALL command.
460 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
465 ** Pointer to a variable that will receive the number of bytes required
466 ** for the CALL command. If 'Bytes' is gcvNULL, nothing is returned.
469 gckVGCOMMAND_CallCommand(
470 IN gckVGCOMMAND Command
,
471 IN gctPOINTER Logical
,
472 IN gctUINT32 FetchAddress
,
473 IN gctUINT FetchCount
,
474 IN OUT gctSIZE_T
* Bytes
477 gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x",
478 Command
, Logical
, FetchAddress
, FetchCount
, Bytes
);
479 /* Verify the arguments. */
480 gcmkVERIFY_OBJECT(Command
, gcvOBJ_COMMAND
);
484 if (Logical
!= gcvNULL
)
486 gctUINT32_PTR buffer
;
488 /* Cast the buffer pointer. */
489 buffer
= (gctUINT32_PTR
) Logical
;
493 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28))) | (((gctUINT32
) (0x6 & ((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28)))
494 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 20:0) - (0 ? 20:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 20:0) - (0 ? 20:0) + 1))))))) << (0 ? 20:0))) | (((gctUINT32
) ((gctUINT32
) (FetchCount
) & ((gctUINT32
) ((((1 ? 20:0) - (0 ? 20:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 20:0) - (0 ? 20:0) + 1))))))) << (0 ? 20:0)));
497 = gcmFIXADDRESS(FetchAddress
);
500 if (Bytes
!= gcvNULL
)
502 /* Return number of bytes required by the CALL command. */
508 return gcvSTATUS_NOT_SUPPORTED
;
516 /*******************************************************************************
518 ** gckVGCOMMAND_ReturnCommand
520 ** Append a RETURN command at the specified location in the command buffer.
524 ** gckVGCOMMAND Command
525 ** Pointer to an gckVGCOMMAND object.
527 ** gctPOINTER Logical
528 ** Pointer to the current location inside the command buffer to append
529 ** RETURN command at or gcvNULL to query the size of the command.
532 ** Pointer to the number of bytes available for the RETURN command.
533 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
538 ** Pointer to a variable that will receive the number of bytes required
539 ** for the RETURN command. If 'Bytes' is gcvNULL, nothing is returned.
542 gckVGCOMMAND_ReturnCommand(
543 IN gckVGCOMMAND Command
,
544 IN gctPOINTER Logical
,
545 IN OUT gctSIZE_T
* Bytes
548 gcmkHEADER_ARG("Command=0x%x Logical=0x%x Bytes = 0x%x",
549 Command
, Logical
, Bytes
);
550 /* Verify the arguments. */
551 gcmkVERIFY_OBJECT(Command
, gcvOBJ_COMMAND
);
555 if (Logical
!= gcvNULL
)
557 gctUINT32_PTR buffer
;
559 /* Cast the buffer pointer. */
560 buffer
= (gctUINT32_PTR
) Logical
;
564 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28))) | (((gctUINT32
) (0x7 & ((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28)));
567 if (Bytes
!= gcvNULL
)
569 /* Return number of bytes required by the RETURN command. */
576 return gcvSTATUS_NOT_SUPPORTED
;
584 /*******************************************************************************
586 ** gckVGCOMMAND_EventCommand
588 ** Form an EVENT command at the specified location in the command buffer.
592 ** gckVGCOMMAND Command
593 ** Pointer to the Command object.
595 ** gctPOINTER Logical
596 ** Pointer to the current location inside the command buffer to append
597 ** EVENT command at or gcvNULL to query the size of the command.
599 ** gctINT32 InterruptId
600 ** The ID of the interrupt to generate.
601 ** If 'Logical' is gcvNULL, this argument is ignored.
604 ** Block that will generate the interrupt.
607 ** Pointer to the number of bytes available for the EVENT command.
608 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
613 ** Pointer to a variable that will receive the number of bytes required
614 ** for the END command. If 'Bytes' is gcvNULL, nothing is returned.
617 gckVGCOMMAND_EventCommand(
618 IN gckVGCOMMAND Command
,
619 IN gctPOINTER Logical
,
621 IN gctINT32 InterruptId
,
622 IN OUT gctSIZE_T
* Bytes
625 gcmkHEADER_ARG("Command=0x%x Logical=0x%x Block=0x%x InterruptId=0x%x Bytes = 0x%x",
626 Command
, Logical
, Block
, InterruptId
, Bytes
);
627 /* Verify the arguments. */
628 gcmkVERIFY_OBJECT(Command
, gcvOBJ_COMMAND
);
632 typedef struct _gcsEVENTSTATES
634 /* Chips before VG21 use these values. */
638 /* VG21 chips and later use SOURCE field. */
643 static gcsEVENTSTATES states
[] =
645 /* gcvBLOCK_COMMAND */
652 /* gcvBLOCK_TESSELLATOR */
659 /* gcvBLOCK_TESSELLATOR2 */
666 /* gcvBLOCK_TESSELLATOR3 */
673 /* gcvBLOCK_RASTER */
709 /* Verify block ID. */
710 gcmkVERIFY_ARGUMENT(gcmIS_VALID_INDEX(Block
, states
));
712 if (Logical
!= gcvNULL
)
714 gctUINT32_PTR buffer
;
716 /* Verify the event ID. */
717 gcmkVERIFY_ARGUMENT(InterruptId
>= 0);
718 gcmkVERIFY_ARGUMENT(InterruptId
<= ((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))));
720 /* Cast the buffer pointer. */
721 buffer
= (gctUINT32_PTR
) Logical
;
725 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28))) | (((gctUINT32
) (0x3 & ((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28)))
726 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 11:0) - (0 ? 11:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 11:0) - (0 ? 11:0) + 1))))))) << (0 ? 11:0))) | (((gctUINT32
) ((gctUINT32
) (0x0E01) & ((gctUINT32
) ((((1 ? 11:0) - (0 ? 11:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 11:0) - (0 ? 11:0) + 1))))))) << (0 ? 11:0)))
727 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 27:16) - (0 ? 27:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:16) - (0 ? 27:16) + 1))))))) << (0 ? 27:16))) | (((gctUINT32
) ((gctUINT32
) (1) & ((gctUINT32
) ((((1 ? 27:16) - (0 ? 27:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:16) - (0 ? 27:16) + 1))))))) << (0 ? 27:16)))
728 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 13:12) - (0 ? 13:12) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 13:12) - (0 ? 13:12) + 1))))))) << (0 ? 13:12))) | (((gctUINT32
) (0x0 & ((gctUINT32
) ((((1 ? 13:12) - (0 ? 13:12) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 13:12) - (0 ? 13:12) + 1))))))) << (0 ? 13:12)));
730 /* Determine chip version. */
733 /* Get the event source for the block. */
734 gctUINT eventSource
= states
[Block
].eventSource
;
737 if (eventSource
== ~0)
739 return gcvSTATUS_NOT_SUPPORTED
;
743 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32
) ((gctUINT32
) (InterruptId
) & ((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0)))
744 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 12:8) - (0 ? 12:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 12:8) - (0 ? 12:8) + 1))))))) << (0 ? 12:8))) | (((gctUINT32
) ((gctUINT32
) (eventSource
) & ((gctUINT32
) ((((1 ? 12:8) - (0 ? 12:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 12:8) - (0 ? 12:8) + 1))))))) << (0 ? 12:8)));
748 /* Get the event source for the block. */
749 gctUINT eventFromFE
= states
[Block
].eventFromFE
;
750 gctUINT eventFromPE
= states
[Block
].eventFromPE
;
753 if (eventFromFE
== ~0)
755 return gcvSTATUS_NOT_SUPPORTED
;
759 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32
) ((gctUINT32
) (InterruptId
) & ((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0)))
760 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))) | (((gctUINT32
) ((gctUINT32
) (eventFromFE
) & ((gctUINT32
) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5)))
761 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 6:6) - (0 ? 6:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 6:6) - (0 ? 6:6) + 1))))))) << (0 ? 6:6))) | (((gctUINT32
) ((gctUINT32
) (eventFromPE
) & ((gctUINT32
) ((((1 ? 6:6) - (0 ? 6:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 6:6) - (0 ? 6:6) + 1))))))) << (0 ? 6:6)));
765 if (Bytes
!= gcvNULL
)
767 /* Make sure the events are directly supported for the block. */
768 if (states
[Block
].eventSource
== ~0)
770 return gcvSTATUS_NOT_SUPPORTED
;
773 /* Return number of bytes required by the END command. */
779 if (Logical
!= gcvNULL
)
781 gctUINT32_PTR buffer
;
783 /* Verify the event ID. */
784 gcmkVERIFY_ARGUMENT(InterruptId
>= 0);
785 gcmkVERIFY_ARGUMENT(InterruptId
<= ((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))));
787 /* Cast the buffer pointer. */
788 buffer
= (gctUINT32_PTR
) Logical
;
792 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32
) (0x01 & ((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27)))
793 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32
) ((gctUINT32
) (0x0E01) & ((gctUINT32
) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0)))
794 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32
) ((gctUINT32
) (1) & ((gctUINT32
) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16)));
796 /* Determine event source. */
797 if (Block
== gcvBLOCK_COMMAND
)
800 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32
) ((gctUINT32
) (InterruptId
) & ((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0)))
801 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))) | (((gctUINT32
) (0x1 & ((gctUINT32
) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5)));
806 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32
) ((gctUINT32
) (InterruptId
) & ((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0)))
807 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 6:6) - (0 ? 6:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 6:6) - (0 ? 6:6) + 1))))))) << (0 ? 6:6))) | (((gctUINT32
) (0x1 & ((gctUINT32
) ((((1 ? 6:6) - (0 ? 6:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 6:6) - (0 ? 6:6) + 1))))))) << (0 ? 6:6)));
811 if (Bytes
!= gcvNULL
)
813 /* Return number of bytes required by the EVENT and END commands. */
823 /*******************************************************************************
825 ** gckVGCOMMAND_EndCommand
827 ** Form an END command at the specified location in the command buffer.
831 ** gckVGCOMMAND Command
832 ** Pointer to the Command object.
834 ** gctPOINTER Logical
835 ** Pointer to the current location inside the command buffer to append
836 ** END command at or gcvNULL to query the size of the command.
838 ** gctINT32 InterruptId
839 ** The ID of the interrupt to generate.
840 ** If 'Logical' is gcvNULL, this argument will be ignored.
843 ** Pointer to the number of bytes available for the END command.
844 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
849 ** Pointer to a variable that will receive the number of bytes required
850 ** for the END command. If 'Bytes' is gcvNULL, nothing is returned.
853 gckVGCOMMAND_EndCommand(
854 IN gckVGCOMMAND Command
,
855 IN gctPOINTER Logical
,
856 IN gctINT32 InterruptId
,
857 IN OUT gctSIZE_T
* Bytes
860 gcmkHEADER_ARG("Command=0x%x Logical=0x%x InterruptId=0x%x Bytes = 0x%x",
861 Command
, Logical
, InterruptId
, Bytes
);
862 /* Verify the arguments. */
863 gcmkVERIFY_OBJECT(Command
, gcvOBJ_COMMAND
);
867 if (Logical
!= gcvNULL
)
869 gctUINT32_PTR buffer
;
871 /* Verify the event ID. */
872 gcmkVERIFY_ARGUMENT(InterruptId
>= 0);
874 /* Cast the buffer pointer. */
875 buffer
= (gctUINT32_PTR
) Logical
;
879 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28))) | (((gctUINT32
) (0x0 & ((gctUINT32
) ((((1 ? 31:28) - (0 ? 31:28) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:28) - (0 ? 31:28) + 1))))))) << (0 ? 31:28)))
880 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32
) ((gctUINT32
) (InterruptId
) & ((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0)));
883 if (Bytes
!= gcvNULL
)
885 /* Return number of bytes required by the END command. */
891 if (Logical
!= gcvNULL
)
893 gctUINT32_PTR memory
;
895 /* Verify the event ID. */
896 gcmkVERIFY_ARGUMENT(InterruptId
>= 0);
898 /* Cast the buffer pointer. */
899 memory
= (gctUINT32_PTR
) Logical
;
903 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32
) (0x01 & ((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27)))
904 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32
) ((gctUINT32
) (0x0E01) & ((gctUINT32
) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0)))
905 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32
) ((gctUINT32
) (1) & ((gctUINT32
) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16)));
908 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32
) ((gctUINT32
) (InterruptId
) & ((gctUINT32
) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0)))
909 | ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 6:6) - (0 ? 6:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 6:6) - (0 ? 6:6) + 1))))))) << (0 ? 6:6))) | (((gctUINT32
) (0x1 & ((gctUINT32
) ((((1 ? 6:6) - (0 ? 6:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 6:6) - (0 ? 6:6) + 1))))))) << (0 ? 6:6)));
913 = ((((gctUINT32
) (0)) & ~(((gctUINT32
) (((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32
) (0x02 & ((gctUINT32
) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27)));
916 if (Bytes
!= gcvNULL
)
918 /* Return number of bytes required by the EVENT and END commands. */
928 #endif /* gcdENABLE_VG */