]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h
gpu: vivante: Update driver from Freescale 3.10.53-1.1-ga BSP
[karo-tx-linux.git] / drivers / mxc / gpu-viv / hal / kernel / inc / gc_hal_vg.h
1 /****************************************************************************
2 *
3 *    Copyright (C) 2005 - 2014 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 #ifndef __gc_hal_vg_h_
23 #define __gc_hal_vg_h_
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29
30 #include "gc_hal_rename.h"
31 #include "gc_hal_types.h"
32 #include "gc_hal_enum.h"
33 #include "gc_hal_base.h"
34
35 #if gcdENABLE_VG
36
37 /* Thread routine type. */
38 #if defined(LINUX)
39     typedef gctINT              gctTHREADFUNCRESULT;
40     typedef gctPOINTER          gctTHREADFUNCPARAMETER;
41 #   define  gctTHREADFUNCTYPE
42 #elif defined(WIN32)
43     typedef gctUINT             gctTHREADFUNCRESULT;
44     typedef gctPOINTER          gctTHREADFUNCPARAMETER;
45 #   define  gctTHREADFUNCTYPE   __stdcall
46 #elif defined(__QNXNTO__)
47     typedef void *              gctTHREADFUNCRESULT;
48     typedef gctPOINTER          gctTHREADFUNCPARAMETER;
49 #   define  gctTHREADFUNCTYPE
50 #endif
51
52 typedef gctTHREADFUNCRESULT (gctTHREADFUNCTYPE * gctTHREADFUNC) (
53     gctTHREADFUNCPARAMETER ThreadParameter
54     );
55
56
57 #if defined(gcvDEBUG)
58 #   undef gcvDEBUG
59 #endif
60
61 #define gcdFORCE_DEBUG 0
62 #define gcdFORCE_MESSAGES 0
63
64
65 #if DBG || defined(DEBUG) || defined(_DEBUG) || gcdFORCE_DEBUG
66 #   define gcvDEBUG 1
67 #else
68 #   define gcvDEBUG 0
69 #endif
70
71 #define _gcmERROR_RETURN(prefix, func) \
72     status = func; \
73     if (gcmIS_ERROR(status)) \
74     { \
75         prefix##PRINT_VERSION(); \
76         prefix##TRACE(gcvLEVEL_ERROR, \
77             #prefix "ERR_RETURN: status=%d(%s) @ %s(%d)", \
78             status, gcoOS_DebugStatus2Name(status), __FUNCTION__, __LINE__); \
79         return status; \
80     } \
81     do { } while (gcvFALSE)
82
83 #define gcmERROR_RETURN(func)         _gcmERROR_RETURN(gcm, func)
84
85 #define gcmLOG_LOCATION()
86
87 #define gcmkIS_ERROR(status)        (status < 0)
88
89 #define gcmALIGNDOWN(n, align) \
90 ( \
91     (n) & ~((align) - 1) \
92 )
93
94 #define gcmIS_VALID_INDEX(Index, Array) \
95     (((gctUINT) (Index)) < gcmCOUNTOF(Array))
96
97
98 #define gcmIS_NAN(x) \
99 ( \
100     ((* (gctUINT32_PTR) &(x)) & 0x7FFFFFFF) == 0x7FFFFFFF \
101 )
102
103 #define gcmLERP(v1, v2, w) \
104     ((v1) * (w) + (v2) * (1.0f - (w)))
105
106 #define gcmINTERSECT(Start1, Start2, Length) \
107     (gcmABS((Start1) - (Start2)) < (Length))
108
109 /*******************************************************************************
110 **
111 **  gcmERR_GOTO
112 **
113 **      Prints a message and terminates the current loop on error.
114 **
115 **  ASSUMPTIONS:
116 **
117 **      'status' variable of gceSTATUS type must be defined.
118 **
119 **  ARGUMENTS:
120 **
121 **      Function
122 **          Function to evaluate.
123 */
124
125 #define gcmERR_GOTO(Function) \
126     status = Function; \
127     if (gcmIS_ERROR(status)) \
128     { \
129         gcmTRACE( \
130             gcvLEVEL_ERROR, \
131             "gcmERR_GOTO: status=%d @ line=%d in function %s.\n", \
132             status, __LINE__, __FUNCTION__ \
133             ); \
134         goto ErrorHandler; \
135     }
136
137 #if gcvDEBUG || gcdFORCE_MESSAGES
138 #   define gcmVERIFY_BOOLEAN(Expression) \
139         gcmASSERT( \
140             ( (Expression) == gcvFALSE ) || \
141             ( (Expression) == gcvTRUE  )    \
142             )
143 #else
144 #   define gcmVERIFY_BOOLEAN(Expression)
145 #endif
146
147 /*******************************************************************************
148 **
149 **  gcmVERIFYFIELDFIT
150 **
151 **      Verify whether the value fits in the field.
152 **
153 **  ARGUMENTS:
154 **
155 **      data    Data value.
156 **      reg     Name of register.
157 **      field   Name of field within register.
158 **      value   Value for field.
159 */
160 #define gcmVERIFYFIELDFIT(reg, field, value) \
161     gcmASSERT( \
162         (value) <= gcmFIELDMAX(reg, field) \
163         )
164 /*******************************************************************************
165 **
166 **  gcmFIELDMAX
167 **
168 **      Get field maximum value.
169 **
170 **  ARGUMENTS:
171 **
172 **      reg     Name of register.
173 **      field   Name of field within register.
174 */
175 #define gcmFIELDMAX(reg, field) \
176 ( \
177     (gctUINT32) \
178         ( \
179         (__gcmGETSIZE(reg##_##field) == 32) \
180                 ?  ~0 \
181                 : (~(~0 << __gcmGETSIZE(reg##_##field))) \
182         ) \
183 )
184
185
186 /* ANSI C does not have the 'f' functions, define replacements here. */
187 #define gcmSINF(x)                      ((gctFLOAT) sin(x))
188 #define gcmCOSF(x)                      ((gctFLOAT) cos(x))
189 #define gcmASINF(x)                     ((gctFLOAT) asin(x))
190 #define gcmACOSF(x)                     ((gctFLOAT) acos(x))
191 #define gcmSQRTF(x)                     ((gctFLOAT) sqrt(x))
192 #define gcmFABSF(x)                     ((gctFLOAT) fabs(x))
193 #define gcmFMODF(x, y)                  ((gctFLOAT) fmod((x), (y)))
194 #define gcmCEILF(x)                     ((gctFLOAT) ceil(x))
195 #define gcmFLOORF(x)                    ((gctFLOAT) floor(x))
196
197
198
199 /* Fixed point constants. */
200 #define gcvZERO_X               ((gctFIXED_POINT) 0x00000000)
201 #define gcvHALF_X               ((gctFIXED_POINT) 0x00008000)
202 #define gcvONE_X                ((gctFIXED_POINT) 0x00010000)
203 #define gcvNEGONE_X             ((gctFIXED_POINT) 0xFFFF0000)
204 #define gcvTWO_X                ((gctFIXED_POINT) 0x00020000)
205
206 /* Integer constants. */
207 #define gcvMAX_POS_INT          ((gctINT) 0x7FFFFFFF)
208 #define gcvMAX_NEG_INT          ((gctINT) 0x80000000)
209
210 /* Float constants. */
211 #define gcvMAX_POS_FLOAT        ((gctFLOAT)  3.4028235e+038)
212 #define gcvMAX_NEG_FLOAT        ((gctFLOAT) -3.4028235e+038)
213
214 /******************************************************************************\
215 ***************************** Miscellaneous Macro ******************************
216 \******************************************************************************/
217
218 #define gcmKB2BYTES(Kilobyte) \
219 ( \
220     (Kilobyte) << 10 \
221 )
222
223 #define gcmMB2BYTES(Megabyte) \
224 ( \
225     (Megabyte) << 20 \
226 )
227
228 #define gcmMAT(Matrix, Row, Column) \
229 ( \
230     (Matrix) [(Row) * 3 + (Column)] \
231 )
232
233 #define gcmMAKE2CHAR(Char1, Char2) \
234 ( \
235     ((gctUINT16) (gctUINT8) (Char1) << 0) | \
236     ((gctUINT16) (gctUINT8) (Char2) << 8) \
237 )
238
239 #define gcmMAKE4CHAR(Char1, Char2, Char3, Char4) \
240 ( \
241     ((gctUINT32)(gctUINT8) (Char1) <<  0) | \
242     ((gctUINT32)(gctUINT8) (Char2) <<  8) | \
243     ((gctUINT32)(gctUINT8) (Char3) << 16) | \
244     ((gctUINT32)(gctUINT8) (Char4) << 24) \
245 )
246
247 /* some platforms need to fix the physical address for HW to access*/
248 #define gcmFIXADDRESS(address) \
249 (\
250     (address)\
251 )
252
253 #define gcmkFIXADDRESS(address) \
254 (\
255     (address)\
256 )
257
258 /******************************************************************************\
259 ****************************** Kernel Debug Macro ******************************
260 \******************************************************************************/
261
262 /* Set signal to signaled state for specified process. */
263 gceSTATUS
264 gckOS_SetSignal(
265     IN gckOS Os,
266     IN gctHANDLE Process,
267     IN gctSIGNAL Signal
268     );
269
270 /* Return the kernel logical pointer for the given physical one. */
271 gceSTATUS
272 gckOS_GetKernelLogical(
273     IN gckOS Os,
274     IN gctUINT32 Address,
275     OUT gctPOINTER * KernelPointer
276     );
277
278 /* Return the kernel logical pointer for the given physical one. */
279 gceSTATUS
280 gckOS_GetKernelLogicalEx(
281     IN gckOS Os,
282     IN gceCORE Core,
283     IN gctUINT32 Address,
284     OUT gctPOINTER * KernelPointer
285     );
286
287 /*----------------------------------------------------------------------------*/
288 /*----------------------------- Semaphore Object -----------------------------*/
289
290 /* Increment the value of a semaphore. */
291 gceSTATUS
292 gckOS_IncrementSemaphore(
293     IN gckOS Os,
294     IN gctSEMAPHORE Semaphore
295     );
296
297 /* Decrement the value of a semaphore (waiting might occur). */
298 gceSTATUS
299 gckOS_DecrementSemaphore(
300     IN gckOS Os,
301     IN gctSEMAPHORE Semaphore
302     );
303
304
305 /*----------------------------------------------------------------------------*/
306 /*------------------------------- Thread Object ------------------------------*/
307
308 /* Start a thread. */
309 gceSTATUS
310 gckOS_StartThread(
311     IN gckOS Os,
312     IN gctTHREADFUNC ThreadFunction,
313     IN gctPOINTER ThreadParameter,
314     OUT gctTHREAD * Thread
315     );
316
317 /* Stop a thread. */
318 gceSTATUS
319 gckOS_StopThread(
320     IN gckOS Os,
321     IN gctTHREAD Thread
322     );
323
324 /* Verify whether the thread is still running. */
325 gceSTATUS
326 gckOS_VerifyThread(
327     IN gckOS Os,
328     IN gctTHREAD Thread
329     );
330
331
332 /* Construct a new gckVGKERNEL object. */
333 gceSTATUS
334 gckVGKERNEL_Construct(
335     IN gckOS Os,
336     IN gctPOINTER Context,
337     IN gckKERNEL  inKernel,
338     OUT gckVGKERNEL * Kernel
339     );
340
341 /* Destroy an gckVGKERNEL object. */
342 gceSTATUS
343 gckVGKERNEL_Destroy(
344     IN gckVGKERNEL Kernel
345     );
346
347 /* Allocate linear video memory. */
348 gceSTATUS
349 gckVGKERNEL_AllocateLinearMemory(
350     IN gckKERNEL Kernel,
351     IN OUT gcePOOL * Pool,
352     IN gctSIZE_T Bytes,
353     IN gctUINT32 Alignment,
354     IN gceSURF_TYPE Type,
355     OUT gcuVIDMEM_NODE_PTR * Node
356     );
357
358 /* Unmap memory. */
359 gceSTATUS
360 gckKERNEL_UnmapMemory(
361     IN gckKERNEL Kernel,
362     IN gctPHYS_ADDR Physical,
363     IN gctSIZE_T Bytes,
364     IN gctPOINTER Logical
365     );
366
367 /* Dispatch a user-level command. */
368 gceSTATUS
369 gckVGKERNEL_Dispatch(
370     IN gckKERNEL Kernel,
371     IN gctBOOL FromUser,
372     IN OUT struct _gcsHAL_INTERFACE * Interface
373     );
374
375 /* Query command buffer requirements. */
376 gceSTATUS
377 gckKERNEL_QueryCommandBuffer(
378     IN gckKERNEL Kernel,
379     OUT gcsCOMMAND_BUFFER_INFO_PTR Information
380     );
381
382 /******************************************************************************\
383 ******************************* gckVGHARDWARE Object ******************************
384 \******************************************************************************/
385
386 /* Construct a new gckVGHARDWARE object. */
387 gceSTATUS
388 gckVGHARDWARE_Construct(
389     IN gckOS Os,
390     OUT gckVGHARDWARE * Hardware
391     );
392
393 /* Destroy an gckVGHARDWARE object. */
394 gceSTATUS
395 gckVGHARDWARE_Destroy(
396     IN gckVGHARDWARE Hardware
397     );
398
399 /* Query system memory requirements. */
400 gceSTATUS
401 gckVGHARDWARE_QuerySystemMemory(
402     IN gckVGHARDWARE Hardware,
403     OUT gctSIZE_T * SystemSize,
404     OUT gctUINT32 * SystemBaseAddress
405     );
406
407 /* Build virtual address. */
408 gceSTATUS
409 gckVGHARDWARE_BuildVirtualAddress(
410     IN gckVGHARDWARE Hardware,
411     IN gctUINT32 Index,
412     IN gctUINT32 Offset,
413     OUT gctUINT32 * Address
414     );
415
416 /* Kickstart the command processor. */
417 gceSTATUS
418 gckVGHARDWARE_Execute(
419     IN gckVGHARDWARE Hardware,
420     IN gctUINT32 Address,
421     IN gctUINT32 Count
422     );
423
424 /* Query the available memory. */
425 gceSTATUS
426 gckVGHARDWARE_QueryMemory(
427     IN gckVGHARDWARE Hardware,
428     OUT gctSIZE_T * InternalSize,
429     OUT gctUINT32 * InternalBaseAddress,
430     OUT gctUINT32 * InternalAlignment,
431     OUT gctSIZE_T * ExternalSize,
432     OUT gctUINT32 * ExternalBaseAddress,
433     OUT gctUINT32 * ExternalAlignment,
434     OUT gctUINT32 * HorizontalTileSize,
435     OUT gctUINT32 * VerticalTileSize
436     );
437
438 /* Query the identity of the hardware. */
439 gceSTATUS
440 gckVGHARDWARE_QueryChipIdentity(
441     IN gckVGHARDWARE Hardware,
442     OUT gceCHIPMODEL* ChipModel,
443     OUT gctUINT32* ChipRevision,
444     OUT gctUINT32* ChipFeatures,
445     OUT gctUINT32* ChipMinorFeatures,
446     OUT gctUINT32* ChipMinorFeatures1
447     );
448
449 /* Convert an API format. */
450 gceSTATUS
451 gckVGHARDWARE_ConvertFormat(
452     IN gckVGHARDWARE Hardware,
453     IN gceSURF_FORMAT Format,
454     OUT gctUINT32 * BitsPerPixel,
455     OUT gctUINT32 * BytesPerTile
456     );
457
458 /* Split a harwdare specific address into API stuff. */
459 gceSTATUS
460 gckVGHARDWARE_SplitMemory(
461     IN gckVGHARDWARE Hardware,
462     IN gctUINT32 Address,
463     OUT gcePOOL * Pool,
464     OUT gctUINT32 * Offset
465     );
466
467 /* Align size to tile boundary. */
468 gceSTATUS
469 gckVGHARDWARE_AlignToTile(
470     IN gckVGHARDWARE Hardware,
471     IN gceSURF_TYPE Type,
472     IN OUT gctUINT32_PTR Width,
473     IN OUT gctUINT32_PTR Height
474     );
475
476 /* Convert logical address to hardware specific address. */
477 gceSTATUS
478 gckVGHARDWARE_ConvertLogical(
479     IN gckVGHARDWARE Hardware,
480     IN gctPOINTER Logical,
481     IN gctBOOL InUserSpace,
482     OUT gctUINT32 * Address
483     );
484
485 /* Program MMU. */
486 gceSTATUS
487 gckVGHARDWARE_SetMMU(
488     IN gckVGHARDWARE Hardware,
489     IN gctPOINTER Logical
490     );
491
492 /* Flush the MMU. */
493 gceSTATUS
494 gckVGHARDWARE_FlushMMU(
495     IN gckVGHARDWARE Hardware
496     );
497
498 /* Get idle register. */
499 gceSTATUS
500 gckVGHARDWARE_GetIdle(
501     IN gckVGHARDWARE Hardware,
502     OUT gctUINT32 * Data
503     );
504
505 /* Flush the caches. */
506 gceSTATUS
507 gckVGHARDWARE_Flush(
508     IN gckVGHARDWARE Hardware,
509     IN gceKERNEL_FLUSH Flush,
510     IN gctPOINTER Logical,
511     IN OUT gctSIZE_T * Bytes
512     );
513
514 /* Enable/disable fast clear. */
515 gceSTATUS
516 gckVGHARDWARE_SetFastClear(
517     IN gckVGHARDWARE Hardware,
518     IN gctINT Enable
519     );
520
521 gceSTATUS
522 gckVGHARDWARE_ReadInterrupt(
523     IN gckVGHARDWARE Hardware,
524     OUT gctUINT32_PTR IDs
525     );
526
527 /* Power management. */
528 gceSTATUS
529 gckVGHARDWARE_SetPowerManagementState(
530     IN gckVGHARDWARE Hardware,
531     IN gceCHIPPOWERSTATE State
532     );
533
534 gceSTATUS
535 gckVGHARDWARE_QueryPowerManagementState(
536     IN gckVGHARDWARE Hardware,
537     OUT gceCHIPPOWERSTATE* State
538     );
539
540 gceSTATUS
541 gckVGHARDWARE_SetPowerManagement(
542     IN gckVGHARDWARE Hardware,
543     IN gctBOOL PowerManagement
544     );
545
546 gceSTATUS
547 gckVGHARDWARE_SetPowerOffTimeout(
548     IN gckVGHARDWARE  Hardware,
549     IN gctUINT32    Timeout
550     );
551
552 gceSTATUS
553 gckVGHARDWARE_QueryPowerOffTimeout(
554     IN gckVGHARDWARE  Hardware,
555     OUT gctUINT32*  Timeout
556     );
557
558 gceSTATUS
559 gckVGHARDWARE_QueryIdle(
560     IN gckVGHARDWARE Hardware,
561     OUT gctBOOL_PTR IsIdle
562     );
563 /******************************************************************************\
564 *************************** Command Buffer Structures **************************
565 \******************************************************************************/
566
567 /* Vacant command buffer marker. */
568 #define gcvVACANT_BUFFER        ((gcsCOMPLETION_SIGNAL_PTR) ((gctSIZE_T)1))
569
570 /* Command buffer header. */
571 typedef struct _gcsCMDBUFFER * gcsCMDBUFFER_PTR;
572 typedef struct _gcsCMDBUFFER
573 {
574     /* Pointer to the completion signal. */
575     gcsCOMPLETION_SIGNAL_PTR    completion;
576
577     /* The user sets this to the node of the container buffer whitin which
578        this particular command buffer resides. The kernel sets this to the
579        node of the internally allocated buffer. */
580     gcuVIDMEM_NODE_PTR          node;
581
582     /* Command buffer hardware address. */
583     gctUINT32                   address;
584
585     /* The offset of the buffer from the beginning of the header. */
586     gctUINT32                   bufferOffset;
587
588     /* Size of the area allocated for the data portion of this particular
589        command buffer (headers and tail reserves are excluded). */
590     gctUINT32                   size;
591
592     /* Offset into the buffer [0..size]; reflects exactly how much data has
593        been put into the command buffer. */
594     gctUINT                     offset;
595
596     /* The number of command units in the buffer for the hardware to
597        execute. */
598     gctUINT32                   dataCount;
599
600     /* MANAGED BY : user HAL (gcoBUFFER object).
601        USED BY    : user HAL (gcoBUFFER object).
602        Points to the immediate next allocated command buffer. */
603     gcsCMDBUFFER_PTR            nextAllocated;
604
605     /* MANAGED BY : user layers (HAL and drivers).
606        USED BY    : kernel HAL (gcoBUFFER object).
607        Points to the next subbuffer if any. A family of subbuffers are chained
608        together and are meant to be executed inseparably as a unit. Meaning
609        that context switching cannot occur while a chain of subbuffers is being
610        executed. */
611     gcsCMDBUFFER_PTR            nextSubBuffer;
612 }
613 gcsCMDBUFFER;
614
615 /* Command queue element. */
616 typedef struct _gcsVGCMDQUEUE
617 {
618     /* Pointer to the command buffer header. */
619     gcsCMDBUFFER_PTR            commandBuffer;
620
621     /* Dynamic vs. static command buffer state. */
622     gctBOOL                     dynamic;
623 }
624 gcsVGCMDQUEUE;
625
626 /* Context map entry. */
627 typedef struct _gcsVGCONTEXT_MAP
628 {
629     /* State index. */
630     gctUINT32                   index;
631
632     /* New state value. */
633     gctUINT32                   data;
634
635     /* Points to the next entry in the mod list. */
636     gcsVGCONTEXT_MAP_PTR            next;
637 }
638 gcsVGCONTEXT_MAP;
639
640 /* gcsVGCONTEXT structure that holds the current context. */
641 typedef struct _gcsVGCONTEXT
642 {
643     /* Context ID. */
644     gctUINT64                   id;
645
646     /* State caching ebable flag. */
647     gctBOOL                     stateCachingEnabled;
648
649     /* Current pipe. */
650     gctUINT32                   currentPipe;
651
652     /* State map/mod buffer. */
653     gctUINT32                   mapFirst;
654     gctUINT32                   mapLast;
655     gcsVGCONTEXT_MAP_PTR        mapContainer;
656     gcsVGCONTEXT_MAP_PTR        mapPrev;
657     gcsVGCONTEXT_MAP_PTR        mapCurr;
658     gcsVGCONTEXT_MAP_PTR        firstPrevMap;
659     gcsVGCONTEXT_MAP_PTR        firstCurrMap;
660
661     /* Main context buffer. */
662     gcsCMDBUFFER_PTR            header;
663     gctUINT32_PTR               buffer;
664
665     /* Completion signal. */
666     gctHANDLE                   process;
667     gctSIGNAL                   signal;
668
669 #if defined(__QNXNTO__)
670     gctINT32                    coid;
671     gctINT32                    rcvid;
672 #endif
673 }
674 gcsVGCONTEXT;
675
676 /* User space task header. */
677 typedef struct _gcsTASK * gcsTASK_PTR;
678 typedef struct _gcsTASK
679 {
680     /* Pointer to the next task for the same interrupt in user space. */
681     gcsTASK_PTR                 next;
682
683     /* Size of the task data that immediately follows the structure. */
684     gctUINT                     size;
685
686     /* Task data starts here. */
687     /* ... */
688 }
689 gcsTASK;
690
691 /* User space task master table entry. */
692 typedef struct _gcsTASK_MASTER_ENTRY * gcsTASK_MASTER_ENTRY_PTR;
693 typedef struct _gcsTASK_MASTER_ENTRY
694 {
695     /* Pointers to the head and to the tail of the task chain. */
696     gcsTASK_PTR                 head;
697     gcsTASK_PTR                 tail;
698 }
699 gcsTASK_MASTER_ENTRY;
700
701 /* User space task master table entry. */
702 typedef struct _gcsTASK_MASTER_TABLE
703 {
704     /* Table with one entry per block. */
705     gcsTASK_MASTER_ENTRY        table[gcvBLOCK_COUNT];
706
707     /* The total number of tasks sckeduled. */
708     gctUINT                     count;
709
710     /* The total size of event data in bytes. */
711     gctUINT                     size;
712
713 #if defined(__QNXNTO__)
714     gctINT32                    coid;
715     gctINT32                    rcvid;
716 #endif
717 }
718 gcsTASK_MASTER_TABLE;
719
720 /******************************************************************************\
721 ***************************** gckVGINTERRUPT Object ******************************
722 \******************************************************************************/
723
724 typedef struct _gckVGINTERRUPT * gckVGINTERRUPT;
725
726 typedef gceSTATUS (* gctINTERRUPT_HANDLER)(
727     IN gckVGKERNEL Kernel
728     );
729
730 gceSTATUS
731 gckVGINTERRUPT_Construct(
732     IN gckVGKERNEL Kernel,
733     OUT gckVGINTERRUPT * Interrupt
734     );
735
736 gceSTATUS
737 gckVGINTERRUPT_Destroy(
738     IN gckVGINTERRUPT Interrupt
739     );
740
741 gceSTATUS
742 gckVGINTERRUPT_Enable(
743     IN gckVGINTERRUPT Interrupt,
744     IN OUT gctINT32_PTR Id,
745     IN gctINTERRUPT_HANDLER Handler
746     );
747
748 gceSTATUS
749 gckVGINTERRUPT_Disable(
750     IN gckVGINTERRUPT Interrupt,
751     IN gctINT32 Id
752     );
753
754 #ifndef __QNXNTO__
755
756 gceSTATUS
757 gckVGINTERRUPT_Enque(
758     IN gckVGINTERRUPT Interrupt
759     );
760
761 #else
762
763 gceSTATUS
764 gckVGINTERRUPT_Enque(
765     IN gckVGINTERRUPT Interrupt,
766     OUT gckOS *Os,
767     OUT gctSEMAPHORE *Semaphore
768     );
769
770 #endif
771
772 gceSTATUS
773 gckVGINTERRUPT_DumpState(
774     IN gckVGINTERRUPT Interrupt
775     );
776
777
778 /******************************************************************************\
779 ******************************* gckVGCOMMAND Object *******************************
780 \******************************************************************************/
781
782 typedef struct _gckVGCOMMAND *      gckVGCOMMAND;
783
784 /* Construct a new gckVGCOMMAND object. */
785 gceSTATUS
786 gckVGCOMMAND_Construct(
787     IN gckVGKERNEL Kernel,
788     IN gctUINT TaskGranularity,
789     IN gctUINT QueueSize,
790     OUT gckVGCOMMAND * Command
791     );
792
793 /* Destroy an gckVGCOMMAND object. */
794 gceSTATUS
795 gckVGCOMMAND_Destroy(
796     IN gckVGCOMMAND Command
797     );
798
799 /* Query command buffer attributes. */
800 gceSTATUS
801 gckVGCOMMAND_QueryCommandBuffer(
802     IN gckVGCOMMAND Command,
803     OUT gcsCOMMAND_BUFFER_INFO_PTR Information
804     );
805
806 /* Allocate a command queue. */
807 gceSTATUS
808 gckVGCOMMAND_Allocate(
809     IN gckVGCOMMAND Command,
810     IN gctSIZE_T Size,
811     OUT gcsCMDBUFFER_PTR * CommandBuffer,
812     OUT gctPOINTER * Data
813     );
814
815 /* Release memory held by the command queue. */
816 gceSTATUS
817 gckVGCOMMAND_Free(
818     IN gckVGCOMMAND Command,
819     IN gcsCMDBUFFER_PTR CommandBuffer
820     );
821
822 /* Schedule the command queue for execution. */
823 gceSTATUS
824 gckVGCOMMAND_Execute(
825     IN gckVGCOMMAND Command,
826     IN gcsCMDBUFFER_PTR CommandBuffer
827     );
828
829 /* Commit a buffer to the command queue. */
830 gceSTATUS
831 gckVGCOMMAND_Commit(
832     IN gckVGCOMMAND Command,
833     IN gcsVGCONTEXT_PTR Context,
834     IN gcsVGCMDQUEUE_PTR Queue,
835     IN gctUINT EntryCount,
836     IN gcsTASK_MASTER_TABLE_PTR TaskTable
837     );
838
839 /******************************************************************************\
840 ********************************* gckVGMMU Object ********************************
841 \******************************************************************************/
842
843 typedef struct _gckVGMMU *          gckVGMMU;
844
845 /* Construct a new gckVGMMU object. */
846 gceSTATUS
847 gckVGMMU_Construct(
848     IN gckVGKERNEL Kernel,
849     IN gctUINT32 MmuSize,
850     OUT gckVGMMU * Mmu
851     );
852
853 /* Destroy an gckVGMMU object. */
854 gceSTATUS
855 gckVGMMU_Destroy(
856     IN gckVGMMU Mmu
857     );
858
859 /* Allocate pages inside the MMU. */
860 gceSTATUS
861 gckVGMMU_AllocatePages(
862     IN gckVGMMU Mmu,
863     IN gctSIZE_T PageCount,
864     OUT gctPOINTER * PageTable,
865     OUT gctUINT32 * Address
866     );
867
868 /* Remove a page table from the MMU. */
869 gceSTATUS
870 gckVGMMU_FreePages(
871     IN gckVGMMU Mmu,
872     IN gctPOINTER PageTable,
873     IN gctSIZE_T PageCount
874     );
875
876 /* Set the MMU page with info. */
877 gceSTATUS
878 gckVGMMU_SetPage(
879    IN gckVGMMU Mmu,
880    IN gctUINT32 PageAddress,
881    IN gctUINT32 *PageEntry
882    );
883
884 /* Flush MMU */
885 gceSTATUS
886 gckVGMMU_Flush(
887    IN gckVGMMU Mmu
888    );
889
890 #endif /* gcdENABLE_VG */
891
892 #ifdef __cplusplus
893 } /* extern "C" */
894 #endif
895
896 #endif /* __gc_hal_h_ */