1 /****************************************************************************
3 * Copyright (C) 2005 - 2013 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 *****************************************************************************/
23 #include "gc_hal_kernel.h"
27 #include "gc_hal_kernel_hardware_command_vg.h"
29 #define _GC_OBJ_ZONE gcvZONE_COMMAND
31 /******************************************************************************\
32 ****************************** gckVGCOMMAND API code *****************************
33 \******************************************************************************/
35 /*******************************************************************************
37 ** gckVGCOMMAND_InitializeInfo
39 ** Initialize architecture dependent command buffer information.
43 ** gckVGCOMMAND Command
44 ** Pointer to the Command object.
51 gckVGCOMMAND_InitializeInfo(
52 IN gckVGCOMMAND Command
56 gcmkHEADER_ARG("Command=0x%x", Command);
58 /* Verify the arguments. */
59 gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
63 /* Reset interrupts. */
64 Command->info.feBufferInt = -1;
65 Command->info.tsOverflowInt = -1;
67 /* Set command buffer attributes. */
68 Command->info.addressAlignment = 64;
69 Command->info.commandAlignment = 8;
71 /* Determine command alignment address mask. */
72 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)));
74 /* Query the number of bytes needed by the STATE command. */
75 gcmkERR_BREAK(gckVGCOMMAND_StateCommand(
76 Command, 0x0, gcvNULL, (gctUINT32)~0, 0,
77 &Command->info.stateCommandSize
80 /* Query the number of bytes needed by the RESTART command. */
81 gcmkERR_BREAK(gckVGCOMMAND_RestartCommand(
82 Command, gcvNULL, (gctUINT32)~0, 0,
83 &Command->info.restartCommandSize
86 /* Query the number of bytes needed by the FETCH command. */
87 gcmkERR_BREAK(gckVGCOMMAND_FetchCommand(
88 Command, gcvNULL, (gctUINT32)~0, 0,
89 &Command->info.fetchCommandSize
92 /* Query the number of bytes needed by the CALL command. */
93 gcmkERR_BREAK(gckVGCOMMAND_CallCommand(
94 Command, gcvNULL, (gctUINT32)~0, 0,
95 &Command->info.callCommandSize
98 /* Query the number of bytes needed by the RETURN command. */
99 gcmkERR_BREAK(gckVGCOMMAND_ReturnCommand(
101 &Command->info.returnCommandSize
104 /* Query the number of bytes needed by the EVENT command. */
105 gcmkERR_BREAK(gckVGCOMMAND_EventCommand(
106 Command, gcvNULL, gcvBLOCK_PIXEL, -1,
107 &Command->info.eventCommandSize
110 /* Query the number of bytes needed by the END command. */
111 gcmkERR_BREAK(gckVGCOMMAND_EndCommand(
112 Command, gcvNULL, -1,
113 &Command->info.endCommandSize
116 /* Determine the tail reserve size. */
117 Command->info.staticTailSize = gcmMAX(
118 Command->info.fetchCommandSize,
120 Command->info.returnCommandSize,
121 Command->info.endCommandSize
125 /* Determine the maximum tail size. */
126 Command->info.dynamicTailSize
127 = Command->info.staticTailSize
128 + Command->info.eventCommandSize * gcvBLOCK_COUNT;
137 /*******************************************************************************
139 ** gckVGCOMMAND_StateCommand
141 ** Append a STATE command at the specified location in the command buffer.
145 ** gckVGCOMMAND Command
146 ** Pointer to an gckVGCOMMAND object.
149 ** Harwdare destination pipe.
151 ** gctPOINTER Logical
152 ** Pointer to the current location inside the command buffer to append
153 ** STATE command at or gcvNULL to query the size of the command.
156 ** Starting register address of the state buffer.
157 ** If 'Logical' is gcvNULL, this argument is ignored.
160 ** Number of states in state buffer.
161 ** If 'Logical' is gcvNULL, this argument is ignored.
164 ** Pointer to the number of bytes available for the STATE command.
165 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
170 ** Pointer to a variable that will receive the number of bytes required
171 ** for the STATE command. If 'Bytes' is gcvNULL, nothing is returned.
174 gckVGCOMMAND_StateCommand(
175 IN gckVGCOMMAND Command,
177 IN gctPOINTER Logical,
178 IN gctUINT32 Address,
180 IN OUT gctSIZE_T * Bytes
183 gcmkHEADER_ARG("Command=0x%x Pipe=0x%x Logical=0x%x Address=0x%x Count=0x%x Bytes = 0x%x",
184 Command, Pipe, Logical, Address, Count, Bytes);
186 /* Verify the arguments. */
187 gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
191 if (Logical != gcvNULL)
193 gctUINT32_PTR buffer;
195 /* Cast the buffer pointer. */
196 buffer = (gctUINT32_PTR) Logical;
200 = ((((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)))
201 | ((((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)))
202 | ((((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)))
203 | ((((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)));
206 if (Bytes != gcvNULL)
208 /* Return number of bytes required by the STATE command. */
209 *Bytes = 4 * (Count + 1);
214 if (Logical != gcvNULL)
216 gctUINT32_PTR buffer;
218 /* Cast the buffer pointer. */
219 buffer = (gctUINT32_PTR) Logical;
221 /* Append LOAD_STATE. */
223 = ((((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)))
224 | ((((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)))
225 | ((((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)));
228 if (Bytes != gcvNULL)
230 /* Return number of bytes required by the STATE command. */
231 *Bytes = 4 * (Count + 1);
240 /*******************************************************************************
242 ** gckVGCOMMAND_RestartCommand
244 ** Form a RESTART command at the specified location in the command buffer.
248 ** gckVGCOMMAND Command
249 ** Pointer to an gckVGCOMMAND object.
251 ** gctPOINTER Logical
252 ** Pointer to the current location inside the command buffer to append
253 ** RESTART command at or gcvNULL to query the size of the command.
255 ** gctUINT32 FetchAddress
256 ** The address of another command buffer to be executed by this RESTART
257 ** command. If 'Logical' is gcvNULL, this argument is ignored.
259 ** gctUINT FetchCount
260 ** The number of 64-bit data quantities in another command buffer to
261 ** be executed by this RESTART command. If 'Logical' is gcvNULL, this
262 ** argument is ignored.
265 ** Pointer to the number of bytes available for the RESTART command.
266 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
271 ** Pointer to a variable that will receive the number of bytes required
272 ** for the RESTART command. If 'Bytes' is gcvNULL, nothing is returned.
275 gckVGCOMMAND_RestartCommand(
276 IN gckVGCOMMAND Command,
277 IN gctPOINTER Logical,
278 IN gctUINT32 FetchAddress,
279 IN gctUINT FetchCount,
280 IN OUT gctSIZE_T * Bytes
283 gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x",
284 Command, Logical, FetchAddress, FetchCount, Bytes);
285 /* Verify the arguments. */
286 gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
290 if (Logical != gcvNULL)
292 gctUINT32_PTR buffer;
293 gctUINT32 beginEndMark;
295 /* Cast the buffer pointer. */
296 buffer = (gctUINT32_PTR) Logical;
298 /* Determine Begin/End flag. */
299 beginEndMark = (FetchCount > 0)
300 ? ((((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)))
301 : ((((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)));
303 /* Append RESTART. */
305 = ((((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)))
306 | ((((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)))
313 if (Bytes != gcvNULL)
315 /* Return number of bytes required by the RESTART command. */
322 return gcvSTATUS_NOT_SUPPORTED;
331 /*******************************************************************************
333 ** gckVGCOMMAND_FetchCommand
335 ** Form a FETCH command at the specified location in the command buffer.
339 ** gckVGCOMMAND Command
340 ** Pointer to an gckVGCOMMAND object.
342 ** gctPOINTER Logical
343 ** Pointer to the current location inside the command buffer to append
344 ** FETCH command at or gcvNULL to query the size of the command.
346 ** gctUINT32 FetchAddress
347 ** The address of another command buffer to be executed by this FETCH
348 ** command. If 'Logical' is gcvNULL, this argument is ignored.
350 ** gctUINT FetchCount
351 ** The number of 64-bit data quantities in another command buffer to
352 ** be executed by this FETCH command. If 'Logical' is gcvNULL, this
353 ** argument is ignored.
356 ** Pointer to the number of bytes available for the FETCH command.
357 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
362 ** Pointer to a variable that will receive the number of bytes required
363 ** for the FETCH command. If 'Bytes' is gcvNULL, nothing is returned.
366 gckVGCOMMAND_FetchCommand(
367 IN gckVGCOMMAND Command,
368 IN gctPOINTER Logical,
369 IN gctUINT32 FetchAddress,
370 IN gctUINT FetchCount,
371 IN OUT gctSIZE_T * Bytes
374 gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x",
375 Command, Logical, FetchAddress, FetchCount, Bytes);
376 /* Verify the arguments. */
377 gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
381 if (Logical != gcvNULL)
383 gctUINT32_PTR buffer;
385 /* Cast the buffer pointer. */
386 buffer = (gctUINT32_PTR) Logical;
390 = ((((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)))
391 | ((((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)));
394 = gcmkFIXADDRESS(FetchAddress);
397 if (Bytes != gcvNULL)
399 /* Return number of bytes required by the FETCH command. */
405 if (Logical != gcvNULL)
407 gctUINT32_PTR buffer;
409 /* Cast the buffer pointer. */
410 buffer = (gctUINT32_PTR) Logical;
414 = ((((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)))
415 | ((((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)));
418 = gcmkFIXADDRESS(FetchAddress);
421 if (Bytes != gcvNULL)
423 /* Return number of bytes required by the LINK command. */
433 /*******************************************************************************
435 ** gckVGCOMMAND_CallCommand
437 ** Append a CALL command at the specified location in the command buffer.
441 ** gckVGCOMMAND Command
442 ** Pointer to an gckVGCOMMAND object.
444 ** gctPOINTER Logical
445 ** Pointer to the current location inside the command buffer to append
446 ** CALL command at or gcvNULL to query the size of the command.
448 ** gctUINT32 FetchAddress
449 ** The address of another command buffer to be executed by this CALL
450 ** command. If 'Logical' is gcvNULL, this argument is ignored.
452 ** gctUINT FetchCount
453 ** The number of 64-bit data quantities in another command buffer to
454 ** be executed by this CALL command. If 'Logical' is gcvNULL, this
455 ** argument is ignored.
458 ** Pointer to the number of bytes available for the CALL command.
459 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
464 ** Pointer to a variable that will receive the number of bytes required
465 ** for the CALL command. If 'Bytes' is gcvNULL, nothing is returned.
468 gckVGCOMMAND_CallCommand(
469 IN gckVGCOMMAND Command,
470 IN gctPOINTER Logical,
471 IN gctUINT32 FetchAddress,
472 IN gctUINT FetchCount,
473 IN OUT gctSIZE_T * Bytes
476 gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x",
477 Command, Logical, FetchAddress, FetchCount, Bytes);
478 /* Verify the arguments. */
479 gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
483 if (Logical != gcvNULL)
485 gctUINT32_PTR buffer;
487 /* Cast the buffer pointer. */
488 buffer = (gctUINT32_PTR) Logical;
492 = ((((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)))
493 | ((((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)));
496 = gcmkFIXADDRESS(FetchAddress);
499 if (Bytes != gcvNULL)
501 /* 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)
740 return gcvSTATUS_NOT_SUPPORTED;
744 = ((((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)))
745 | ((((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)));
749 /* Get the event source for the block. */
750 gctUINT eventFromFE = states[Block].eventFromFE;
751 gctUINT eventFromPE = states[Block].eventFromPE;
754 if (eventFromFE == ~0)
757 return gcvSTATUS_NOT_SUPPORTED;
761 = ((((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)))
762 | ((((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)))
763 | ((((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)));
767 if (Bytes != gcvNULL)
769 /* Make sure the events are directly supported for the block. */
770 if (states[Block].eventSource == ~0)
773 return gcvSTATUS_NOT_SUPPORTED;
776 /* Return number of bytes required by the END command. */
782 if (Logical != gcvNULL)
784 gctUINT32_PTR buffer;
786 /* Verify the event ID. */
787 gcmkVERIFY_ARGUMENT(InterruptId >= 0);
788 gcmkVERIFY_ARGUMENT(InterruptId <= ((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))));
790 /* Cast the buffer pointer. */
791 buffer = (gctUINT32_PTR) Logical;
795 = ((((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)))
796 | ((((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)))
797 | ((((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)));
799 /* Determine event source. */
800 if (Block == gcvBLOCK_COMMAND)
803 = ((((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)))
804 | ((((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)));
809 = ((((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)))
810 | ((((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)));
814 if (Bytes != gcvNULL)
816 /* Return number of bytes required by the EVENT and END commands. */
826 /*******************************************************************************
828 ** gckVGCOMMAND_EndCommand
830 ** Form an END command at the specified location in the command buffer.
834 ** gckVGCOMMAND Command
835 ** Pointer to the Command object.
837 ** gctPOINTER Logical
838 ** Pointer to the current location inside the command buffer to append
839 ** END command at or gcvNULL to query the size of the command.
841 ** gctINT32 InterruptId
842 ** The ID of the interrupt to generate.
843 ** If 'Logical' is gcvNULL, this argument will be ignored.
846 ** Pointer to the number of bytes available for the END command.
847 ** If 'Logical' is gcvNULL, the value from this argument is ignored.
852 ** Pointer to a variable that will receive the number of bytes required
853 ** for the END command. If 'Bytes' is gcvNULL, nothing is returned.
856 gckVGCOMMAND_EndCommand(
857 IN gckVGCOMMAND Command,
858 IN gctPOINTER Logical,
859 IN gctINT32 InterruptId,
860 IN OUT gctSIZE_T * Bytes
863 gcmkHEADER_ARG("Command=0x%x Logical=0x%x InterruptId=0x%x Bytes = 0x%x",
864 Command, Logical, InterruptId, Bytes);
865 /* Verify the arguments. */
866 gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
870 if (Logical != gcvNULL)
872 gctUINT32_PTR buffer;
874 /* Verify the event ID. */
875 gcmkVERIFY_ARGUMENT(InterruptId >= 0);
877 /* Cast the buffer pointer. */
878 buffer = (gctUINT32_PTR) Logical;
882 = ((((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)))
883 | ((((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)));
886 if (Bytes != gcvNULL)
888 /* Return number of bytes required by the END command. */
894 if (Logical != gcvNULL)
896 gctUINT32_PTR memory;
898 /* Verify the event ID. */
899 gcmkVERIFY_ARGUMENT(InterruptId >= 0);
901 /* Cast the buffer pointer. */
902 memory = (gctUINT32_PTR) Logical;
906 = ((((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)))
907 | ((((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)))
908 | ((((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)));
911 = ((((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)))
912 | ((((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)));
916 = ((((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)));
919 if (Bytes != gcvNULL)
921 /* Return number of bytes required by the EVENT and END commands. */
931 #endif /* gcdENABLE_VG */