blob: 3fccb1ca9a7791fa3813dce40bcfe92a76a6fcc0 [file] [log] [blame]
/*************************************************************************/ /*!
@File
@Title Environment related functions
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License MIT
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#include "osfunc.h"
#include "cache_km.h"
#include "img_types.h"
#include "allocmem.h"
#include "pvr_debug.h"
#define NOT_IMPLEMENTED() fprintf(stderr, "msd-img-rgx-mtk: Not implemented in %s:%s:%d\n", __func__, __FILE__, __LINE__);
/*************************************************************************/ /*!
@Function OSAtomicRead
@Description Read the value of a variable atomically.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to read
@Return The value of the atomic variable
*/ /**************************************************************************/
IMG_INTERNAL
IMG_INT32
OSAtomicRead(const ATOMIC_T *pCounter)
{
NOT_IMPLEMENTED();
return 0;
}
/*************************************************************************/ /*!
@Function OSAtomicWrite
@Description Write the value of a variable atomically.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to be written to
@Input v The value to write
@Return None
*/ /**************************************************************************/
IMG_INTERNAL
void
OSAtomicWrite(ATOMIC_T *pCounter, IMG_INT32 v)
{
NOT_IMPLEMENTED();
}
/* For the following atomic operations, in addition to being SMP-safe,
should also have a memory barrier around each operation */
/*************************************************************************/ /*!
@Function OSAtomicIncrement
@Description Increment the value of a variable atomically.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to be incremented
@Return The new value of *pCounter.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_INT32
OSAtomicIncrement(ATOMIC_T *pCounter)
{
NOT_IMPLEMENTED();
return 0;
}
/*************************************************************************/ /*!
@Function OSAtomicDecrement
@Description Decrement the value of a variable atomically.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to be decremented
@Return The new value of *pCounter.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_INT32
OSAtomicDecrement(ATOMIC_T *pCounter)
{
NOT_IMPLEMENTED();
return 0;
}
/*************************************************************************/ /*!
@Function OSAtomicAdd
@Description Add a specified value to a variable atomically.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to add the value to
@Input v The value to be added
@Return The new value of *pCounter.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_INT32
OSAtomicAdd(ATOMIC_T *pCounter, IMG_INT32 v)
{
NOT_IMPLEMENTED();
return 0;
}
/*************************************************************************/ /*!
@Function OSAtomicAddUnless
@Description Add a specified value to a variable atomically unless it
already equals a particular value.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to add the value to
@Input v The value to be added to 'pCounter'
@Input t The test value. If 'pCounter' equals this,
its value will not be adjusted
@Return The new value of *pCounter.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_INT32
OSAtomicAddUnless(ATOMIC_T *pCounter, IMG_INT32 v, IMG_INT32 t)
{
NOT_IMPLEMENTED();
return 0;
}
/*************************************************************************/ /*!
@Function OSAtomicSubtract
@Description Subtract a specified value to a variable atomically.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to subtract the value from
@Input v The value to be subtracted
@Return The new value of *pCounter.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_INT32
OSAtomicSubtract(ATOMIC_T *pCounter, IMG_INT32 v)
{
NOT_IMPLEMENTED();
return 0;
}
/*************************************************************************/ /*!
@Function OSAtomicSubtractUnless
@Description Subtract a specified value from a variable atomically unless
it already equals a particular value.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to subtract the value from
@Input v The value to be subtracted from 'pCounter'
@Input t The test value. If 'pCounter' equals this,
its value will not be adjusted
@Return The new value of *pCounter.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_INT32
OSAtomicSubtractUnless(ATOMIC_T *pCounter, IMG_INT32 v, IMG_INT32 t)
{
NOT_IMPLEMENTED();
return 0;
}
/*************************************************************************/ /*!
@Function OSAtomicCompareExchange
@Description Set a variable to a given value only if it is currently
equal to a specified value. The whole operation must be atomic.
Atomic functions must be implemented in a manner that
is both symmetric multiprocessor (SMP) safe and has a memory
barrier around each operation.
@Input pCounter The atomic variable to be checked and
possibly updated
@Input oldv The value the atomic variable must have in
order to be modified
@Input newv The value to write to the atomic variable if
it equals 'oldv'
@Return The value of *pCounter after the function.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_INT32
OSAtomicCompareExchange(ATOMIC_T *pCounter, IMG_INT32 oldv, IMG_INT32 newv)
{
NOT_IMPLEMENTED();
return 0;
}
/**************************************************************************/ /*!
@Function OSLockCreate
@Description Creates an operating system lock object.
@Output phLock The created lock.
@Input eLockType The type of lock required. This may be:
LOCK_TYPE_PASSIVE - the lock will not be used
in interrupt context or
LOCK_TYPE_DISPATCH - the lock may be used
in interrupt context.
@Return PVRSRV_OK on success. PVRSRV_ERROR_OUT_OF_MEMORY if the driver
cannot allocate CPU memory needed for the lock.
PVRSRV_ERROR_INIT_FAILURE if the Operating System fails to
allocate the lock.
*/ /**************************************************************************/
IMG_INTERNAL
PVRSRV_ERROR
OSLockCreate(POS_LOCK *phLock, LOCK_TYPE eLockType)
{
NOT_IMPLEMENTED();
return PVRSRV_ERROR_NOT_SUPPORTED;
}
/**************************************************************************/ /*!
@Function OSLockDestroy
@Description Destroys an operating system lock object.
@Input hLock The lock to be destroyed.
@Return None.
*/ /**************************************************************************/
IMG_INTERNAL
PVRSRV_ERROR
OSLockDestroy(POS_LOCK hLock)
{
NOT_IMPLEMENTED();
return PVRSRV_ERROR_NOT_SUPPORTED;
}
/**************************************************************************/ /*!
@Function OSLockAcquire
@Description Acquires an operating system lock.
NB. This function must not return until the lock is acquired
(meaning the implementation should not timeout or return with
an error, as the caller will assume they have the lock).
@Input hLock The lock to be acquired.
@Return None.
*/ /**************************************************************************/
IMG_INTERNAL
void
OSLockAcquire(POS_LOCK hLock)
{
NOT_IMPLEMENTED();
}
/**************************************************************************/ /*!
@Function OSTryLockAcquire
@Description Try to acquire an operating system lock.
NB. If lock is acquired successfully in the first attempt,
then the function returns true and else it will return false.
@Input hLock The lock to be acquired.
@Return IMG_TRUE if lock acquired successfully,
IMG_FALSE otherwise.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_BOOL
OSTryLockAcquire(POS_LOCK hLock)
{
NOT_IMPLEMENTED();
return 0;
}
/**************************************************************************/ /*!
@Function OSLockRelease
@Description Releases an operating system lock.
@Input hLock The lock to be released.
@Return None.
*/ /**************************************************************************/
IMG_INTERNAL
void
OSLockRelease(POS_LOCK hLock)
{
NOT_IMPLEMENTED();
}
/**************************************************************************/ /*!
@Function OSLockIsLocked
@Description Tests whether or not an operating system lock is currently
locked.
@Input hLock The lock to be tested.
@Return IMG_TRUE if locked, IMG_FALSE if not locked.
*/ /**************************************************************************/
IMG_INTERNAL
IMG_BOOL
OSLockIsLocked(POS_LOCK hLock)
{
NOT_IMPLEMENTED();
return 0;
}