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 ******************************************************************************/
28 #include "servicesint.h"
29 #include "bridged_support.h"
32 PVRSRVLookupOSMemHandle(struct PVRSRV_HANDLE_BASE *psHandleBase,
33 void **phOSMemHandle, void *hMHandle)
36 enum PVRSRV_HANDLE_TYPE eHandleType;
37 enum PVRSRV_ERROR eError;
39 eError = PVRSRVLookupHandleAnyType(psHandleBase, &hMHandleInt,
40 &eHandleType, hMHandle);
41 if (eError != PVRSRV_OK)
44 switch (eHandleType) {
45 case PVRSRV_HANDLE_TYPE_MEM_INFO:
46 case PVRSRV_HANDLE_TYPE_MEM_INFO_REF:
47 case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO:
49 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo =
50 (struct PVRSRV_KERNEL_MEM_INFO *)hMHandleInt;
52 *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle;
56 case PVRSRV_HANDLE_TYPE_SYNC_INFO:
58 struct PVRSRV_KERNEL_SYNC_INFO *psSyncInfo =
59 (struct PVRSRV_KERNEL_SYNC_INFO *)hMHandleInt;
60 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo =
61 psSyncInfo->psSyncDataMemInfoKM;
63 *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle;
67 case PVRSRV_HANDLE_TYPE_SOC_TIMER:
69 *phOSMemHandle = (void *)hMHandleInt;
73 return PVRSRV_ERROR_BAD_MAPPING;