]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h
2a910e8ee36dba596f6feccc73621b412cc17380
[karo-tx-linux.git] / drivers / mxc / gpu-viv / hal / kernel / inc / gc_hal_vg.h
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 #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 gckKERNEL_AllocateLinearMemory(
350     IN gckKERNEL Kernel,
351     IN OUT gcePOOL * Pool,
352     IN gctSIZE_T Bytes,
353     IN gctSIZE_T 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 #if gcdDYNAMIC_MAP_RESERVED_MEMORY
383 gceSTATUS
384 gckOS_MapReservedMemoryToKernel(
385     IN gckOS Os,
386     IN gctUINT32 Physical,
387     IN gctINT Bytes,
388     IN OUT gctPOINTER *Virtual
389     );
390
391 gceSTATUS
392 gckOS_UnmapReservedMemoryFromKernel(
393     IN gctPOINTER Virtual
394     );
395 #endif
396
397 /******************************************************************************\
398 ******************************* gckVGHARDWARE Object ******************************
399 \******************************************************************************/
400
401 /* Construct a new gckVGHARDWARE object. */
402 gceSTATUS
403 gckVGHARDWARE_Construct(
404     IN gckOS Os,
405     OUT gckVGHARDWARE * Hardware
406     );
407
408 /* Destroy an gckVGHARDWARE object. */
409 gceSTATUS
410 gckVGHARDWARE_Destroy(
411     IN gckVGHARDWARE Hardware
412     );
413
414 /* Query system memory requirements. */
415 gceSTATUS
416 gckVGHARDWARE_QuerySystemMemory(
417     IN gckVGHARDWARE Hardware,
418     OUT gctSIZE_T * SystemSize,
419     OUT gctUINT32 * SystemBaseAddress
420     );
421
422 /* Build virtual address. */
423 gceSTATUS
424 gckVGHARDWARE_BuildVirtualAddress(
425     IN gckVGHARDWARE Hardware,
426     IN gctUINT32 Index,
427     IN gctUINT32 Offset,
428     OUT gctUINT32 * Address
429     );
430
431 /* Kickstart the command processor. */
432 gceSTATUS
433 gckVGHARDWARE_Execute(
434     IN gckVGHARDWARE Hardware,
435     IN gctUINT32 Address,
436     IN gctSIZE_T Count
437     );
438
439 /* Query the available memory. */
440 gceSTATUS
441 gckVGHARDWARE_QueryMemory(
442     IN gckVGHARDWARE Hardware,
443     OUT gctSIZE_T * InternalSize,
444     OUT gctUINT32 * InternalBaseAddress,
445     OUT gctUINT32 * InternalAlignment,
446     OUT gctSIZE_T * ExternalSize,
447     OUT gctUINT32 * ExternalBaseAddress,
448     OUT gctUINT32 * ExternalAlignment,
449     OUT gctUINT32 * HorizontalTileSize,
450     OUT gctUINT32 * VerticalTileSize
451     );
452
453 /* Query the identity of the hardware. */
454 gceSTATUS
455 gckVGHARDWARE_QueryChipIdentity(
456     IN gckVGHARDWARE Hardware,
457     OUT gceCHIPMODEL* ChipModel,
458     OUT gctUINT32* ChipRevision,
459     OUT gctUINT32* ChipFeatures,
460     OUT gctUINT32* ChipMinorFeatures,
461     OUT gctUINT32* ChipMinorFeatures1
462     );
463
464 /* Convert an API format. */
465 gceSTATUS
466 gckVGHARDWARE_ConvertFormat(
467     IN gckVGHARDWARE Hardware,
468     IN gceSURF_FORMAT Format,
469     OUT gctUINT32 * BitsPerPixel,
470     OUT gctUINT32 * BytesPerTile
471     );
472
473 /* Split a harwdare specific address into API stuff. */
474 gceSTATUS
475 gckVGHARDWARE_SplitMemory(
476     IN gckVGHARDWARE Hardware,
477     IN gctUINT32 Address,
478     OUT gcePOOL * Pool,
479     OUT gctUINT32 * Offset
480     );
481
482 /* Align size to tile boundary. */
483 gceSTATUS
484 gckVGHARDWARE_AlignToTile(
485     IN gckVGHARDWARE Hardware,
486     IN gceSURF_TYPE Type,
487     IN OUT gctUINT32_PTR Width,
488     IN OUT gctUINT32_PTR Height
489     );
490
491 /* Convert logical address to hardware specific address. */
492 gceSTATUS
493 gckVGHARDWARE_ConvertLogical(
494     IN gckVGHARDWARE Hardware,
495     IN gctPOINTER Logical,
496     OUT gctUINT32 * Address
497     );
498
499 /* Program MMU. */
500 gceSTATUS
501 gckVGHARDWARE_SetMMU(
502     IN gckVGHARDWARE Hardware,
503     IN gctPOINTER Logical
504     );
505
506 /* Flush the MMU. */
507 gceSTATUS
508 gckVGHARDWARE_FlushMMU(
509     IN gckVGHARDWARE Hardware
510     );
511
512 /* Get idle register. */
513 gceSTATUS
514 gckVGHARDWARE_GetIdle(
515     IN gckVGHARDWARE Hardware,
516     OUT gctUINT32 * Data
517     );
518
519 /* Flush the caches. */
520 gceSTATUS
521 gckVGHARDWARE_Flush(
522     IN gckVGHARDWARE Hardware,
523     IN gceKERNEL_FLUSH Flush,
524     IN gctPOINTER Logical,
525     IN OUT gctSIZE_T * Bytes
526     );
527
528 /* Enable/disable fast clear. */
529 gceSTATUS
530 gckVGHARDWARE_SetFastClear(
531     IN gckVGHARDWARE Hardware,
532     IN gctINT Enable
533     );
534
535 gceSTATUS
536 gckVGHARDWARE_ReadInterrupt(
537     IN gckVGHARDWARE Hardware,
538     OUT gctUINT32_PTR IDs
539     );
540
541 /* Power management. */
542 gceSTATUS
543 gckVGHARDWARE_SetPowerManagementState(
544     IN gckVGHARDWARE Hardware,
545     IN gceCHIPPOWERSTATE State
546     );
547
548 gceSTATUS
549 gckVGHARDWARE_QueryPowerManagementState(
550     IN gckVGHARDWARE Hardware,
551     OUT gceCHIPPOWERSTATE* State
552     );
553
554 gceSTATUS
555 gckVGHARDWARE_SetPowerManagement(
556     IN gckVGHARDWARE Hardware,
557     IN gctBOOL PowerManagement
558     );
559
560 gceSTATUS
561 gckVGHARDWARE_SetPowerOffTimeout(
562     IN gckVGHARDWARE  Hardware,
563     IN gctUINT32    Timeout
564     );
565
566 gceSTATUS
567 gckVGHARDWARE_QueryPowerOffTimeout(
568     IN gckVGHARDWARE  Hardware,
569     OUT gctUINT32*  Timeout
570     );
571
572 gceSTATUS
573 gckVGHARDWARE_QueryIdle(
574     IN gckVGHARDWARE Hardware,
575     OUT gctBOOL_PTR IsIdle
576     );
577 /******************************************************************************\
578 *************************** Command Buffer Structures **************************
579 \******************************************************************************/
580
581 /* Vacant command buffer marker. */
582 #define gcvVACANT_BUFFER        ((gcsCOMPLETION_SIGNAL_PTR) (1))
583
584 /* Command buffer header. */
585 typedef struct _gcsCMDBUFFER * gcsCMDBUFFER_PTR;
586 typedef struct _gcsCMDBUFFER
587 {
588     /* Pointer to the completion signal. */
589     gcsCOMPLETION_SIGNAL_PTR    completion;
590
591     /* The user sets this to the node of the container buffer whitin which
592        this particular command buffer resides. The kernel sets this to the
593        node of the internally allocated buffer. */
594     gctUINT64                   node;
595
596     /* Command buffer hardware address. */
597     gctUINT32                   address;
598
599     /* The offset of the buffer from the beginning of the header. */
600     gctUINT32                   bufferOffset;
601
602     /* Size of the area allocated for the data portion of this particular
603        command buffer (headers and tail reserves are excluded). */
604     gctSIZE_T                   size;
605
606     /* Offset into the buffer [0..size]; reflects exactly how much data has
607        been put into the command buffer. */
608     gctUINT                     offset;
609
610     /* The number of command units in the buffer for the hardware to
611        execute. */
612     gctSIZE_T                   dataCount;
613
614     /* MANAGED BY : user HAL (gcoBUFFER object).
615        USED BY    : user HAL (gcoBUFFER object).
616        Points to the immediate next allocated command buffer. */
617     gcsCMDBUFFER_PTR            nextAllocated;
618
619     /* MANAGED BY : user layers (HAL and drivers).
620        USED BY    : kernel HAL (gcoBUFFER object).
621        Points to the next subbuffer if any. A family of subbuffers are chained
622        together and are meant to be executed inseparably as a unit. Meaning
623        that context switching cannot occur while a chain of subbuffers is being
624        executed. */
625     gcsCMDBUFFER_PTR            nextSubBuffer;
626 }
627 gcsCMDBUFFER;
628
629 /* Command queue element. */
630 typedef struct _gcsVGCMDQUEUE
631 {
632     /* Pointer to the command buffer header. */
633     gcsCMDBUFFER_PTR            commandBuffer;
634
635     /* Dynamic vs. static command buffer state. */
636     gctBOOL                     dynamic;
637 }
638 gcsVGCMDQUEUE;
639
640 /* Context map entry. */
641 typedef struct _gcsVGCONTEXT_MAP
642 {
643     /* State index. */
644     gctUINT32                   index;
645
646     /* New state value. */
647     gctUINT32                   data;
648
649     /* Points to the next entry in the mod list. */
650     gcsVGCONTEXT_MAP_PTR            next;
651 }
652 gcsVGCONTEXT_MAP;
653
654 /* gcsVGCONTEXT structure that holds the current context. */
655 typedef struct _gcsVGCONTEXT
656 {
657     /* Context ID. */
658     gctUINT64                   id;
659
660     /* State caching ebable flag. */
661     gctBOOL                     stateCachingEnabled;
662
663     /* Current pipe. */
664     gctUINT32                   currentPipe;
665
666     /* State map/mod buffer. */
667     gctSIZE_T                   mapFirst;
668     gctSIZE_T                   mapLast;
669 #ifdef __QNXNTO__
670     gctSIZE_T                   mapContainerSize;
671 #endif
672     gcsVGCONTEXT_MAP_PTR            mapContainer;
673     gcsVGCONTEXT_MAP_PTR            mapPrev;
674     gcsVGCONTEXT_MAP_PTR            mapCurr;
675     gcsVGCONTEXT_MAP_PTR            firstPrevMap;
676     gcsVGCONTEXT_MAP_PTR            firstCurrMap;
677
678     /* Main context buffer. */
679     gcsCMDBUFFER_PTR            header;
680     gctUINT32_PTR               buffer;
681
682     /* Completion signal. */
683     gctHANDLE                   process;
684     gctSIGNAL                   signal;
685
686 #if defined(__QNXNTO__)
687     gctINT32                    coid;
688     gctINT32                    rcvid;
689 #endif
690 }
691 gcsVGCONTEXT;
692
693 /* User space task header. */
694 typedef struct _gcsTASK * gcsTASK_PTR;
695 typedef struct _gcsTASK
696 {
697     /* Pointer to the next task for the same interrupt in user space. */
698     gcsTASK_PTR                 next;
699
700     /* Size of the task data that immediately follows the structure. */
701     gctUINT                     size;
702
703     /* Task data starts here. */
704     /* ... */
705 }
706 gcsTASK;
707
708 /* User space task master table entry. */
709 typedef struct _gcsTASK_MASTER_ENTRY * gcsTASK_MASTER_ENTRY_PTR;
710 typedef struct _gcsTASK_MASTER_ENTRY
711 {
712     /* Pointers to the head and to the tail of the task chain. */
713     gcsTASK_PTR                 head;
714     gcsTASK_PTR                 tail;
715 }
716 gcsTASK_MASTER_ENTRY;
717
718 /* User space task master table entry. */
719 typedef struct _gcsTASK_MASTER_TABLE
720 {
721     /* Table with one entry per block. */
722     gcsTASK_MASTER_ENTRY        table[gcvBLOCK_COUNT];
723
724     /* The total number of tasks sckeduled. */
725     gctUINT                     count;
726
727     /* The total size of event data in bytes. */
728     gctUINT                     size;
729
730 #if defined(__QNXNTO__)
731     gctINT32                    coid;
732     gctINT32                    rcvid;
733 #endif
734 }
735 gcsTASK_MASTER_TABLE;
736
737 /******************************************************************************\
738 ***************************** gckVGINTERRUPT Object ******************************
739 \******************************************************************************/
740
741 typedef struct _gckVGINTERRUPT * gckVGINTERRUPT;
742
743 typedef gceSTATUS (* gctINTERRUPT_HANDLER)(
744     IN gckVGKERNEL Kernel
745     );
746
747 gceSTATUS
748 gckVGINTERRUPT_Construct(
749     IN gckVGKERNEL Kernel,
750     OUT gckVGINTERRUPT * Interrupt
751     );
752
753 gceSTATUS
754 gckVGINTERRUPT_Destroy(
755     IN gckVGINTERRUPT Interrupt
756     );
757
758 gceSTATUS
759 gckVGINTERRUPT_Enable(
760     IN gckVGINTERRUPT Interrupt,
761     IN OUT gctINT32_PTR Id,
762     IN gctINTERRUPT_HANDLER Handler
763     );
764
765 gceSTATUS
766 gckVGINTERRUPT_Disable(
767     IN gckVGINTERRUPT Interrupt,
768     IN gctINT32 Id
769     );
770
771 #ifndef __QNXNTO__
772
773 gceSTATUS
774 gckVGINTERRUPT_Enque(
775     IN gckVGINTERRUPT Interrupt
776     );
777
778 #else
779
780 gceSTATUS
781 gckVGINTERRUPT_Enque(
782     IN gckVGINTERRUPT Interrupt,
783     OUT gckOS *Os,
784     OUT gctSEMAPHORE *Semaphore
785     );
786
787 #endif
788
789 gceSTATUS
790 gckVGINTERRUPT_DumpState(
791     IN gckVGINTERRUPT Interrupt
792     );
793
794
795 /******************************************************************************\
796 ******************************* gckVGCOMMAND Object *******************************
797 \******************************************************************************/
798
799 typedef struct _gckVGCOMMAND *      gckVGCOMMAND;
800
801 /* Construct a new gckVGCOMMAND object. */
802 gceSTATUS
803 gckVGCOMMAND_Construct(
804     IN gckVGKERNEL Kernel,
805     IN gctUINT TaskGranularity,
806     IN gctUINT QueueSize,
807     OUT gckVGCOMMAND * Command
808     );
809
810 /* Destroy an gckVGCOMMAND object. */
811 gceSTATUS
812 gckVGCOMMAND_Destroy(
813     IN gckVGCOMMAND Command
814     );
815
816 /* Query command buffer attributes. */
817 gceSTATUS
818 gckVGCOMMAND_QueryCommandBuffer(
819     IN gckVGCOMMAND Command,
820     OUT gcsCOMMAND_BUFFER_INFO_PTR Information
821     );
822
823 /* Allocate a command queue. */
824 gceSTATUS
825 gckVGCOMMAND_Allocate(
826     IN gckVGCOMMAND Command,
827     IN gctSIZE_T Size,
828     OUT gcsCMDBUFFER_PTR * CommandBuffer,
829     OUT gctPOINTER * Data
830     );
831
832 /* Release memory held by the command queue. */
833 gceSTATUS
834 gckVGCOMMAND_Free(
835     IN gckVGCOMMAND Command,
836     IN gcsCMDBUFFER_PTR CommandBuffer
837     );
838
839 /* Schedule the command queue for execution. */
840 gceSTATUS
841 gckVGCOMMAND_Execute(
842     IN gckVGCOMMAND Command,
843     IN gcsCMDBUFFER_PTR CommandBuffer
844     );
845
846 /* Commit a buffer to the command queue. */
847 gceSTATUS
848 gckVGCOMMAND_Commit(
849     IN gckVGCOMMAND Command,
850     IN gcsVGCONTEXT_PTR Context,
851     IN gcsVGCMDQUEUE_PTR Queue,
852     IN gctUINT EntryCount,
853     IN gcsTASK_MASTER_TABLE_PTR TaskTable
854     );
855
856 /******************************************************************************\
857 ********************************* gckVGMMU Object ********************************
858 \******************************************************************************/
859
860 typedef struct _gckVGMMU *          gckVGMMU;
861
862 /* Construct a new gckVGMMU object. */
863 gceSTATUS
864 gckVGMMU_Construct(
865     IN gckVGKERNEL Kernel,
866     IN gctSIZE_T MmuSize,
867     OUT gckVGMMU * Mmu
868     );
869
870 /* Destroy an gckVGMMU object. */
871 gceSTATUS
872 gckVGMMU_Destroy(
873     IN gckVGMMU Mmu
874     );
875
876 /* Allocate pages inside the MMU. */
877 gceSTATUS
878 gckVGMMU_AllocatePages(
879     IN gckVGMMU Mmu,
880     IN gctSIZE_T PageCount,
881     OUT gctPOINTER * PageTable,
882     OUT gctUINT32 * Address
883     );
884
885 /* Remove a page table from the MMU. */
886 gceSTATUS
887 gckVGMMU_FreePages(
888     IN gckVGMMU Mmu,
889     IN gctPOINTER PageTable,
890     IN gctSIZE_T PageCount
891     );
892
893 /* Set the MMU page with info. */
894 gceSTATUS
895 gckVGMMU_SetPage(
896    IN gckVGMMU Mmu,
897    IN gctUINT32 PageAddress,
898    IN gctUINT32 *PageEntry
899    );
900
901 /* Flush MMU */
902 gceSTATUS
903 gckVGMMU_Flush(
904    IN gckVGMMU Mmu
905    );
906
907 #endif /* gcdENABLE_VG */
908
909 #ifdef __cplusplus
910 } /* extern "C" */
911 #endif
912
913 #endif /* __gc_hal_h_ */