1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
27 #ifndef __BC_EXAMPLE_H__
28 #define __BC_EXAMPLE_H__
31 #include "servicesext.h"
32 #include "kernelbuffer.h"
34 extern IMG_BOOL PVRGetBufferClassJTable(
35 struct PVRSRV_BC_BUFFER2SRV_KMJTABLE *psJTable);
37 #define BC_EXAMPLE_NUM_BUFFERS 3
42 #define BC_EXAMPLE_WIDTH 320
43 #define BC_EXAMPLE_HEIGHT 160
44 #define BC_EXAMPLE_STRIDE 320
45 #define BC_EXAMPLE_PIXELFORMAT PVRSRV_PIXEL_FORMAT_NV12
49 #define BC_EXAMPLE_WIDTH 320
50 #define BC_EXAMPLE_HEIGHT 160
51 #define BC_EXAMPLE_STRIDE (320 * 2)
52 #define BC_EXAMPLE_PIXELFORMAT PVRSRV_PIXEL_FORMAT_RGB565
56 #define BC_EXAMPLE_DEVICEID 0
58 struct BC_EXAMPLE_BUFFER {
61 struct IMG_SYS_PHYADDR sSysAddr;
62 struct IMG_SYS_PHYADDR sPageAlignSysAddr;
63 void __iomem *sCPUVAddr;
64 struct PVRSRV_SYNC_DATA *psSyncData;
65 struct BC_EXAMPLE_BUFFER *psNext;
68 struct BC_EXAMPLE_DEVINFO {
70 struct BC_EXAMPLE_BUFFER *psSystemBuffer;
71 struct BUFFER_INFO sBufferInfo;
73 struct PVRSRV_BC_BUFFER2SRV_KMJTABLE sPVRJTable;
74 struct PVRSRV_BC_SRV2BUFFER_KMJTABLE sBCJTable;
79 enum PVRSRV_ERROR BC_Example_Init(void);
80 enum PVRSRV_ERROR BC_Example_Deinit(void);
82 enum PVRSRV_ERROR BCOpenPVRServices(void **phPVRServices);
83 enum PVRSRV_ERROR BCClosePVRServices(void *hPVRServices);
85 void *BCAllocKernelMem(u32 ui32Size);
86 void BCFreeKernelMem(void *pvMem);
88 enum PVRSRV_ERROR BCAllocContigMemory(u32 ui32Size, void **phMemHandle,
89 void __iomem **pLinAddr,
90 struct IMG_CPU_PHYADDR *pPhysAddr);
91 void BCFreeContigMemory(u32 ui32Size, void *hMemHandle, void __iomem *LinAddr,
92 struct IMG_CPU_PHYADDR PhysAddr);
94 struct IMG_SYS_PHYADDR CpuPAddrToSysPAddrBC(struct IMG_CPU_PHYADDR cpu_paddr);
95 struct IMG_CPU_PHYADDR SysPAddrToCpuPAddrBC(struct IMG_SYS_PHYADDR sys_paddr);
97 void *MapPhysAddr(struct IMG_SYS_PHYADDR sSysAddr, u32 ui32Size);
98 void UnMapPhysAddr(void *pvAddr, u32 ui32Size);
100 enum PVRSRV_ERROR BCGetLibFuncAddr(void *hExtDrv, char *szFunctionName,
101 IMG_BOOL (**ppfnFuncTable)(struct PVRSRV_BC_BUFFER2SRV_KMJTABLE *));
102 struct BC_EXAMPLE_DEVINFO *GetAnchorPtr(void);