]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.c
cf40e3f6b7649d209806dfeaef043dc57ae30314
[karo-tx-linux.git] / drivers / mxc / gpu-viv / arch / GC350 / hal / kernel / gc_hal_kernel_hardware_command_vg.c
1 /****************************************************************************
2 *
3 *    Copyright (C) 2005 - 2013 by Vivante Corp.
4 *
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.
9 *
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.
14 *
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.
18 *
19 *****************************************************************************/
20
21
22 #include "gc_hal.h"
23 #include "gc_hal_kernel.h"
24
25 #if gcdENABLE_VG
26
27 #include "gc_hal_kernel_hardware_command_vg.h"
28
29 #define _GC_OBJ_ZONE    gcvZONE_COMMAND
30
31 /******************************************************************************\
32 ****************************** gckVGCOMMAND API code *****************************
33 \******************************************************************************/
34
35 /*******************************************************************************
36 **
37 **  gckVGCOMMAND_InitializeInfo
38 **
39 **  Initialize architecture dependent command buffer information.
40 **
41 **  INPUT:
42 **
43 **      gckVGCOMMAND Command
44 **          Pointer to the Command object.
45 **
46 **  OUTPUT:
47 **
48 **      Nothing.
49 */
50 gceSTATUS
51 gckVGCOMMAND_InitializeInfo(
52     IN gckVGCOMMAND Command
53     )
54 {
55     gceSTATUS status;
56     gcmkHEADER_ARG("Command=0x%x", Command);
57
58     /* Verify the arguments. */
59     gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
60
61     do
62     {
63         /* Reset interrupts. */
64         Command->info.feBufferInt   = -1;
65         Command->info.tsOverflowInt = -1;
66
67         /* Set command buffer attributes. */
68         Command->info.addressAlignment = 64;
69         Command->info.commandAlignment = 8;
70
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)));
73
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
78             ));
79
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
84             ));
85
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
90             ));
91
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
96             ));
97
98         /* Query the number of bytes needed by the RETURN command. */
99         gcmkERR_BREAK(gckVGCOMMAND_ReturnCommand(
100             Command, gcvNULL,
101             &Command->info.returnCommandSize
102             ));
103
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
108             ));
109
110         /* Query the number of bytes needed by the END command. */
111         gcmkERR_BREAK(gckVGCOMMAND_EndCommand(
112             Command, gcvNULL, -1,
113             &Command->info.endCommandSize
114             ));
115
116         /* Determine the tail reserve size. */
117         Command->info.staticTailSize = gcmMAX(
118             Command->info.fetchCommandSize,
119             gcmMAX(
120                 Command->info.returnCommandSize,
121                 Command->info.endCommandSize
122                 )
123             );
124
125         /* Determine the maximum tail size. */
126         Command->info.dynamicTailSize
127             = Command->info.staticTailSize
128             + Command->info.eventCommandSize * gcvBLOCK_COUNT;
129     }
130     while (gcvFALSE);
131
132     gcmkFOOTER();
133     /* Return status. */
134     return status;
135 }
136
137 /*******************************************************************************
138 **
139 **  gckVGCOMMAND_StateCommand
140 **
141 **  Append a STATE command at the specified location in the command buffer.
142 **
143 **  INPUT:
144 **
145 **      gckVGCOMMAND Command
146 **          Pointer to an gckVGCOMMAND object.
147 **
148 **      gctUINT32 Pipe
149 **          Harwdare destination pipe.
150 **
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.
154 **
155 **      gctUINT32 Address
156 **          Starting register address of the state buffer.
157 **          If 'Logical' is gcvNULL, this argument is ignored.
158 **
159 **      gctUINT32 Count
160 **          Number of states in state buffer.
161 **          If 'Logical' is gcvNULL, this argument is ignored.
162 **
163 **      gctSIZE_T * Bytes
164 **          Pointer to the number of bytes available for the STATE command.
165 **          If 'Logical' is gcvNULL, the value from this argument is ignored.
166 **
167 **  OUTPUT:
168 **
169 **      gctSIZE_T * Bytes
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.
172 */
173 gceSTATUS
174 gckVGCOMMAND_StateCommand(
175     IN gckVGCOMMAND Command,
176     IN gctUINT32 Pipe,
177     IN gctPOINTER Logical,
178     IN gctUINT32 Address,
179     IN gctSIZE_T Count,
180     IN OUT gctSIZE_T * Bytes
181     )
182 {
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);
185
186     /* Verify the arguments. */
187     gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
188
189     if (Command->fe20)
190     {
191         if (Logical != gcvNULL)
192         {
193             gctUINT32_PTR buffer;
194
195             /* Cast the buffer pointer. */
196             buffer = (gctUINT32_PTR) Logical;
197
198             /* Append STATE. */
199             buffer[0]
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)));
204         }
205
206         if (Bytes != gcvNULL)
207         {
208             /* Return number of bytes required by the STATE command. */
209             *Bytes = 4 * (Count + 1);
210         }
211     }
212     else
213     {
214         if (Logical != gcvNULL)
215         {
216             gctUINT32_PTR buffer;
217
218             /* Cast the buffer pointer. */
219             buffer = (gctUINT32_PTR) Logical;
220
221             /* Append LOAD_STATE. */
222             buffer[0]
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)));
226         }
227
228         if (Bytes != gcvNULL)
229         {
230             /* Return number of bytes required by the STATE command. */
231             *Bytes = 4 * (Count + 1);
232         }
233     }
234
235     gcmkFOOTER_NO();
236     /* Success. */
237     return gcvSTATUS_OK;
238 }
239
240 /*******************************************************************************
241 **
242 **  gckVGCOMMAND_RestartCommand
243 **
244 **  Form a RESTART command at the specified location in the command buffer.
245 **
246 **  INPUT:
247 **
248 **      gckVGCOMMAND Command
249 **          Pointer to an gckVGCOMMAND object.
250 **
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.
254 **
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.
258 **
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.
263 **
264 **      gctSIZE_T * Bytes
265 **          Pointer to the number of bytes available for the RESTART command.
266 **          If 'Logical' is gcvNULL, the value from this argument is ignored.
267 **
268 **  OUTPUT:
269 **
270 **      gctSIZE_T * Bytes
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.
273 */
274 gceSTATUS
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
281     )
282 {
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);
287
288     if (Command->fe20)
289     {
290         if (Logical != gcvNULL)
291         {
292             gctUINT32_PTR buffer;
293             gctUINT32 beginEndMark;
294
295             /* Cast the buffer pointer. */
296             buffer = (gctUINT32_PTR) Logical;
297
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)));
302
303             /* Append RESTART. */
304             buffer[0]
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)))
307                 | beginEndMark;
308
309             buffer[1]
310                 = FetchAddress;
311         }
312
313         if (Bytes != gcvNULL)
314         {
315             /* Return number of bytes required by the RESTART command. */
316             *Bytes = 8;
317         }
318     }
319     else
320     {
321         gcmkFOOTER_NO();
322         return gcvSTATUS_NOT_SUPPORTED;
323     }
324
325
326     gcmkFOOTER_NO();
327     /* Success. */
328     return gcvSTATUS_OK;
329 }
330
331 /*******************************************************************************
332 **
333 **  gckVGCOMMAND_FetchCommand
334 **
335 **  Form a FETCH command at the specified location in the command buffer.
336 **
337 **  INPUT:
338 **
339 **      gckVGCOMMAND Command
340 **          Pointer to an gckVGCOMMAND object.
341 **
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.
345 **
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.
349 **
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.
354 **
355 **      gctSIZE_T * Bytes
356 **          Pointer to the number of bytes available for the FETCH command.
357 **          If 'Logical' is gcvNULL, the value from this argument is ignored.
358 **
359 **  OUTPUT:
360 **
361 **      gctSIZE_T * Bytes
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.
364 */
365 gceSTATUS
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
372     )
373 {
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);
378
379     if (Command->fe20)
380     {
381         if (Logical != gcvNULL)
382         {
383             gctUINT32_PTR buffer;
384
385             /* Cast the buffer pointer. */
386             buffer = (gctUINT32_PTR) Logical;
387
388             /* Append FETCH. */
389             buffer[0]
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)));
392
393             buffer[1]
394                 = gcmkFIXADDRESS(FetchAddress);
395         }
396
397         if (Bytes != gcvNULL)
398         {
399             /* Return number of bytes required by the FETCH command. */
400             *Bytes = 8;
401         }
402     }
403     else
404     {
405         if (Logical != gcvNULL)
406         {
407             gctUINT32_PTR buffer;
408
409             /* Cast the buffer pointer. */
410             buffer = (gctUINT32_PTR) Logical;
411
412             /* Append LINK. */
413             buffer[0]
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)));
416
417             buffer[1]
418                 = gcmkFIXADDRESS(FetchAddress);
419         }
420
421         if (Bytes != gcvNULL)
422         {
423             /* Return number of bytes required by the LINK command. */
424             *Bytes = 8;
425         }
426     }
427
428     gcmkFOOTER_NO();
429     /* Success. */
430     return gcvSTATUS_OK;
431 }
432
433 /*******************************************************************************
434 **
435 **  gckVGCOMMAND_CallCommand
436 **
437 **  Append a CALL command at the specified location in the command buffer.
438 **
439 **  INPUT:
440 **
441 **      gckVGCOMMAND Command
442 **          Pointer to an gckVGCOMMAND object.
443 **
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.
447 **
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.
451 **
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.
456 **
457 **      gctSIZE_T * Bytes
458 **          Pointer to the number of bytes available for the CALL command.
459 **          If 'Logical' is gcvNULL, the value from this argument is ignored.
460 **
461 **  OUTPUT:
462 **
463 **      gctSIZE_T * Bytes
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.
466 */
467 gceSTATUS
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
474     )
475 {
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);
480
481     if (Command->fe20)
482     {
483         if (Logical != gcvNULL)
484         {
485             gctUINT32_PTR buffer;
486
487             /* Cast the buffer pointer. */
488             buffer = (gctUINT32_PTR) Logical;
489
490             /* Append CALL. */
491             buffer[0]
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)));
494
495             buffer[1]
496                 = gcmkFIXADDRESS(FetchAddress);
497         }
498
499         if (Bytes != gcvNULL)
500         {
501             /* Return number of bytes required by the CALL command. */
502             *Bytes = 8;
503         }
504     }
505     else
506     {
507         gcmkFOOTER_NO();
508         return gcvSTATUS_NOT_SUPPORTED;
509     }
510
511     gcmkFOOTER_NO();
512     /* Success. */
513     return gcvSTATUS_OK;
514 }
515
516 /*******************************************************************************
517 **
518 **  gckVGCOMMAND_ReturnCommand
519 **
520 **  Append a RETURN command at the specified location in the command buffer.
521 **
522 **  INPUT:
523 **
524 **      gckVGCOMMAND Command
525 **          Pointer to an gckVGCOMMAND object.
526 **
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.
530 **
531 **      gctSIZE_T * Bytes
532 **          Pointer to the number of bytes available for the RETURN command.
533 **          If 'Logical' is gcvNULL, the value from this argument is ignored.
534 **
535 **  OUTPUT:
536 **
537 **      gctSIZE_T * Bytes
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.
540 */
541 gceSTATUS
542 gckVGCOMMAND_ReturnCommand(
543     IN gckVGCOMMAND Command,
544     IN gctPOINTER Logical,
545     IN OUT gctSIZE_T * Bytes
546     )
547 {
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);
552
553     if (Command->fe20)
554     {
555         if (Logical != gcvNULL)
556         {
557             gctUINT32_PTR buffer;
558
559             /* Cast the buffer pointer. */
560             buffer = (gctUINT32_PTR) Logical;
561
562             /* Append RETURN. */
563             buffer[0]
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)));
565         }
566
567         if (Bytes != gcvNULL)
568         {
569             /* Return number of bytes required by the RETURN command. */
570             *Bytes = 8;
571         }
572     }
573     else
574     {
575         gcmkFOOTER_NO();
576         return gcvSTATUS_NOT_SUPPORTED;
577     }
578
579     gcmkFOOTER_NO();
580     /* Success. */
581     return gcvSTATUS_OK;
582 }
583
584 /*******************************************************************************
585 **
586 **  gckVGCOMMAND_EventCommand
587 **
588 **  Form an EVENT command at the specified location in the command buffer.
589 **
590 **  INPUT:
591 **
592 **      gckVGCOMMAND Command
593 **          Pointer to the Command object.
594 **
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.
598 **
599 **      gctINT32 InterruptId
600 **          The ID of the interrupt to generate.
601 **          If 'Logical' is gcvNULL, this argument is ignored.
602 **
603 **      gceBLOCK Block
604 **          Block that will generate the interrupt.
605 **
606 **      gctSIZE_T * Bytes
607 **          Pointer to the number of bytes available for the EVENT command.
608 **          If 'Logical' is gcvNULL, the value from this argument is ignored.
609 **
610 **  OUTPUT:
611 **
612 **      gctSIZE_T * Bytes
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.
615 */
616 gceSTATUS
617 gckVGCOMMAND_EventCommand(
618     IN gckVGCOMMAND Command,
619     IN gctPOINTER Logical,
620     IN gceBLOCK Block,
621     IN gctINT32 InterruptId,
622     IN OUT gctSIZE_T * Bytes
623     )
624 {
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);
629
630     if (Command->fe20)
631     {
632         typedef struct _gcsEVENTSTATES
633         {
634             /* Chips before VG21 use these values. */
635             gctUINT     eventFromFE;
636             gctUINT     eventFromPE;
637
638             /* VG21 chips and later use SOURCE field. */
639             gctUINT     eventSource;
640         }
641         gcsEVENTSTATES;
642
643         static gcsEVENTSTATES states[] =
644         {
645             /* gcvBLOCK_COMMAND */
646             {
647                 (gctUINT)~0,
648                 (gctUINT)~0,
649                 (gctUINT)~0
650             },
651
652             /* gcvBLOCK_TESSELLATOR */
653             {
654                 0x0,
655                 0x1,
656                 0x10
657             },
658
659             /* gcvBLOCK_TESSELLATOR2 */
660             {
661                 0x0,
662                 0x1,
663                 0x12
664             },
665
666             /* gcvBLOCK_TESSELLATOR3 */
667             {
668                 0x0,
669                 0x1,
670                 0x14
671             },
672
673             /* gcvBLOCK_RASTER */
674             {
675                 0x0,
676                 0x1,
677                 0x07,
678             },
679
680             /* gcvBLOCK_VG */
681             {
682                 0x0,
683                 0x1,
684                 0x0F
685             },
686
687             /* gcvBLOCK_VG2 */
688             {
689                 0x0,
690                 0x1,
691                 0x11
692             },
693
694             /* gcvBLOCK_VG3 */
695             {
696                 0x0,
697                 0x1,
698                 0x13
699             },
700
701             /* gcvBLOCK_PIXEL */
702             {
703                 0x0,
704                 0x1,
705                 0x07
706             },
707         };
708
709         /* Verify block ID. */
710         gcmkVERIFY_ARGUMENT(gcmIS_VALID_INDEX(Block, states));
711
712         if (Logical != gcvNULL)
713         {
714             gctUINT32_PTR buffer;
715
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))))));
719
720             /* Cast the buffer pointer. */
721             buffer = (gctUINT32_PTR) Logical;
722
723             /* Append EVENT. */
724             buffer[0]
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)));
729
730             /* Determine chip version. */
731             if (Command->vg21)
732             {
733                 /* Get the event source for the block. */
734                 gctUINT eventSource = states[Block].eventSource;
735
736                 /* Supported? */
737                 if (eventSource == ~0)
738                 {
739                     gcmkFOOTER_NO();
740                     return gcvSTATUS_NOT_SUPPORTED;
741                 }
742
743                 buffer[1]
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)));
746             }
747             else
748             {
749                 /* Get the event source for the block. */
750                 gctUINT eventFromFE = states[Block].eventFromFE;
751                 gctUINT eventFromPE = states[Block].eventFromPE;
752
753                 /* Supported? */
754                 if (eventFromFE == ~0)
755                 {
756                     gcmkFOOTER_NO();
757                     return gcvSTATUS_NOT_SUPPORTED;
758                 }
759
760                 buffer[1]
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)));
764             }
765         }
766
767         if (Bytes != gcvNULL)
768         {
769             /* Make sure the events are directly supported for the block. */
770             if (states[Block].eventSource == ~0)
771             {
772                 gcmkFOOTER_NO();
773                 return gcvSTATUS_NOT_SUPPORTED;
774             }
775
776             /* Return number of bytes required by the END command. */
777             *Bytes = 8;
778         }
779     }
780     else
781     {
782         if (Logical != gcvNULL)
783         {
784             gctUINT32_PTR buffer;
785
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))))));
789
790             /* Cast the buffer pointer. */
791             buffer = (gctUINT32_PTR) Logical;
792
793             /* Append EVENT. */
794             buffer[0]
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)));
798
799             /* Determine event source. */
800             if (Block == gcvBLOCK_COMMAND)
801             {
802                 buffer[1]
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)));
805             }
806             else
807             {
808                 buffer[1]
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)));
811             }
812         }
813
814         if (Bytes != gcvNULL)
815         {
816             /* Return number of bytes required by the EVENT and END commands. */
817             *Bytes = 8;
818         }
819     }
820
821     gcmkFOOTER_NO();
822     /* Success. */
823     return gcvSTATUS_OK;
824 }
825
826 /*******************************************************************************
827 **
828 **  gckVGCOMMAND_EndCommand
829 **
830 **  Form an END command at the specified location in the command buffer.
831 **
832 **  INPUT:
833 **
834 **      gckVGCOMMAND Command
835 **          Pointer to the Command object.
836 **
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.
840 **
841 **      gctINT32 InterruptId
842 **          The ID of the interrupt to generate.
843 **          If 'Logical' is gcvNULL, this argument will be ignored.
844 **
845 **      gctSIZE_T * Bytes
846 **          Pointer to the number of bytes available for the END command.
847 **          If 'Logical' is gcvNULL, the value from this argument is ignored.
848 **
849 **  OUTPUT:
850 **
851 **      gctSIZE_T * Bytes
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.
854 */
855 gceSTATUS
856 gckVGCOMMAND_EndCommand(
857     IN gckVGCOMMAND Command,
858     IN gctPOINTER Logical,
859     IN gctINT32 InterruptId,
860     IN OUT gctSIZE_T * Bytes
861     )
862 {
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);
867
868     if (Command->fe20)
869     {
870         if (Logical != gcvNULL)
871         {
872             gctUINT32_PTR buffer;
873
874             /* Verify the event ID. */
875             gcmkVERIFY_ARGUMENT(InterruptId >= 0);
876
877             /* Cast the buffer pointer. */
878             buffer = (gctUINT32_PTR) Logical;
879
880             /* Append END. */
881             buffer[0]
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)));
884         }
885
886         if (Bytes != gcvNULL)
887         {
888             /* Return number of bytes required by the END command. */
889             *Bytes = 8;
890         }
891     }
892     else
893     {
894         if (Logical != gcvNULL)
895         {
896             gctUINT32_PTR memory;
897
898             /* Verify the event ID. */
899             gcmkVERIFY_ARGUMENT(InterruptId >= 0);
900
901             /* Cast the buffer pointer. */
902             memory = (gctUINT32_PTR) Logical;
903
904             /* Append EVENT. */
905             memory[0]
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)));
909
910             memory[1]
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)));
913
914             /* Append END. */
915             memory[2]
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)));
917         }
918
919         if (Bytes != gcvNULL)
920         {
921             /* Return number of bytes required by the EVENT and END commands. */
922             *Bytes = 16;
923         }
924     }
925
926     gcmkFOOTER_NO();
927     /* Success. */
928     return gcvSTATUS_OK;
929 }
930
931 #endif /* gcdENABLE_VG */
932