/drivers/gpu/pvr/mutex.h
C++ Header | 70 lines | 23 code | 22 blank | 25 comment | 0 complexity | d95cceb55da990c2bcb888f4051a6029 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
1/**********************************************************************
2 *
3 * Copyright (C) Imagination Technologies Ltd. All rights reserved.
4 *
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.
8 *
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.
13 *
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.
17 *
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
20 *
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24 *
25 ******************************************************************************/
26
27#ifndef __INCLUDED_LINUX_MUTEX_H_
28#define __INCLUDED_LINUX_MUTEX_H_
29
30#include <linux/version.h>
31
32#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
33#include <linux/mutex.h>
34#else
35#include <asm/semaphore.h>
36#endif
37
38
39
40#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
41
42typedef struct mutex PVRSRV_LINUX_MUTEX;
43
44#else
45
46
47typedef struct {
48 struct semaphore sSemaphore;
49
50 atomic_t Count;
51}PVRSRV_LINUX_MUTEX;
52
53#endif
54
55
56extern IMG_VOID LinuxInitMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex);
57
58extern IMG_VOID LinuxLockMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex);
59
60extern PVRSRV_ERROR LinuxLockMutexInterruptible(PVRSRV_LINUX_MUTEX *psPVRSRVMutex);
61
62extern IMG_INT32 LinuxTryLockMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex);
63
64extern IMG_VOID LinuxUnLockMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex);
65
66extern IMG_BOOL LinuxIsLockedMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex);
67
68
69#endif
70