summaryrefslogtreecommitdiff
path: root/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'Acceleration/library/icp_utils/OSAL/common/os/linux/src/core')
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsAtomic.c271
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsMemBarrier.c135
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsMsgQ.c143
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSemaphore.c607
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsServices.c586
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSpinLock.c507
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSymbols.c207
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsThread.c467
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsTimer.c275
-rw-r--r--Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/component.mk85
10 files changed, 3283 insertions, 0 deletions
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsAtomic.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsAtomic.c
new file mode 100644
index 0000000..674d375
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsAtomic.c
@@ -0,0 +1,271 @@
+/**
+ * @file IxOsalOsAtomic.c (linux)
+ *
+ * @brief OS-specific Atomic API's implementation.
+ *
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ * Intel Corporation
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+#include "IxOsal.h"
+#include <asm/atomic.h>
+
+
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Atomically read the value of atomic variable
+ *
+ * @param atomicVar (in) - atomic variable
+ *
+ * Atomically reads the value of atomicVar to the outValue
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return atomicVar value
+ */
+
+PUBLIC UINT32
+ixOsalAtomicGet(IxOsalAtomic *atomicVar)
+{
+ return (( UINT32 )atomic_read( atomicVar ));
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Atomically set the value of atomic variable
+ *
+ * @param inValue (in) - atomic variable to be set equal to inValue
+ *
+ * @param atomicVar (out) - atomic variable
+ *
+ * Atomically sets the value of IxOsalAtomicVar to the value given
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return none
+ */
+
+PUBLIC void
+ixOsalAtomicSet(UINT32 inValue, IxOsalAtomic *atomicVar)
+{
+ atomic_set(atomicVar,inValue);
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief add the value to atomic variable
+ *
+ * @param inValue (in) - value to be added to the atomic variable
+ *
+ * @param atomicVar (in & out) - atomic variable
+ *
+ * Atomically adds the value of inValue to the IxOsalAtomicVar
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return none
+ */
+
+PUBLIC void
+ixOsalAtomicAdd(UINT32 inValue, IxOsalAtomic *atomicVar)
+{
+ atomic_add((int)inValue, atomicVar);
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief subtract the value from atomic variable
+ *
+ * @param inValue (in) - atomic variable value to be subtracted by value
+ *
+ * @param atomicVar (in & out) - atomic variable
+ *
+ * Atomically subtracts the value of IxOsalAtomicVar by inValue
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return none
+ */
+
+PUBLIC void
+ixOsalAtomicSub(UINT32 inValue, IxOsalAtomic *atomicVar)
+{
+ atomic_sub((int)inValue, atomicVar);
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief subtract the value from atomic variable and test result
+ *
+ * @param inValue (in) - value to be subtracted from the atomic variable
+ *
+ * @param atomicVar (in & out) - atomic variable
+ *
+ * Atomically subtracts the IxOsalAtomicVar value by inValue and
+ * test the result.
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return TRUE if the result is zero or FALSE for other cases.
+ */
+
+PUBLIC IX_STATUS
+ixOsalAtomicSubAndTest(UINT32 inValue, IxOsalAtomic *atomicVar)
+{
+ return (IX_STATUS)(atomic_sub_and_test((int)inValue, atomicVar));
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief increment value of atomic variable by 1
+ *
+ * @param atomicVar (in & out) - atomic variable
+ *
+ * Atomically increments the value of IxOsalAtomicVar by 1.
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return none
+ */
+
+PUBLIC void
+ixOsalAtomicInc(IxOsalAtomic *atomicVar)
+{
+ atomic_inc(atomicVar);
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief decrement value of atomic variable by 1
+ *
+ * @param atomicVar (out) - atomic variable
+ *
+ * Atomically decrements the value of IxOsalAtomicVar by 1.
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return none
+ */
+
+PUBLIC void
+ixOsalAtomicDec(IxOsalAtomic *atomicVar)
+{
+ atomic_dec(atomicVar);
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief decrement atomic variable value by 1 and test result
+ *
+ * @param atomicVar (in & out) - atomic variable
+ *
+ * Atomically decrements the value of IxOsalAtomicVar by 1 and test
+ * result for zero.
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return TRUE if the result is zero or FALSE otherwise
+ */
+
+PUBLIC IX_STATUS
+ixOsalAtomicDecAndTest(IxOsalAtomic *atomicVar)
+{
+ return (IX_STATUS)(atomic_dec_and_test(atomicVar));
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief increment atomic variable by 1 and test result
+ *
+ * @param atomicVar (in & out) - atomic variable
+ *
+ * Atomically increments the value of IxOsalAtomicVar by 1 and test
+ * result for zero.
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return TRUE if the result is zero or FALSE otherwise
+ */
+
+PUBLIC IX_STATUS
+ixOsalAtomicIncAndTest(IxOsalAtomic *atomicVar)
+{
+ return (IX_STATUS)(atomic_inc_and_test(atomicVar));
+}
+
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsMemBarrier.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsMemBarrier.c
new file mode 100644
index 0000000..217134f
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsMemBarrier.c
@@ -0,0 +1,135 @@
+/**
+ * @file IxOsalOsMemBarrier.c (linux)
+ *
+ * @brief OS-specific Memory Barrier API's implementation.
+ *
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ * Intel Corporation
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+#include "IxOsal.h"
+
+#include <asm/system.h>
+
+
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief memory barrier which orders both memory read and writes
+ *
+ * @param none
+ *
+ * memory barrier that orders both memory read and writes
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return none
+ */
+
+PUBLIC void
+ixOsalMemBarrier(void)
+{
+ mb();
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief memory barrier which orders memory reads
+ *
+ * @param none
+ *
+ * memory barrier that orders memory reads
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return none
+ */
+
+PUBLIC void
+ixOsalReadMemBarrier(void)
+{
+ rmb();
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief memory barrier which orders memory writes
+ *
+ * @param none
+ *
+ * memory barrier that orders memory writes
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return none
+ */
+
+PUBLIC void
+ixOsalWriteMemBarrier(void)
+{
+ wmb();
+}
+
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsMsgQ.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsMsgQ.c
new file mode 100644
index 0000000..22a69bb
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsMsgQ.c
@@ -0,0 +1,143 @@
+/**
+ * @file IxOsalOsMsgQ.c (linux)
+ *
+ * @brief OS-specific Message Queue implementation.
+ *
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ * Intel Corporation
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+#include "IxOsal.h"
+
+#include <linux/linkage.h>
+#include <linux/spinlock.h>
+#include <linux/ipc.h>
+#include <linux/msg.h>
+#include <linux/interrupt.h>
+
+
+
+/*******************************
+ * Public functions
+ *******************************/
+PUBLIC IX_STATUS
+ixOsalMessageQueueCreate (IxOsalMessageQueue * queue,
+ UINT32 msgCount, UINT32 msgLen)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMessageQueueCreate(): Not implemented in Linux \n", 0, 0, 0, 0,
+ 0, 0);
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalSyncMessageQueueCreate (IxOsalMessageQueue * msgQueue,
+ UINT32 msgCount, UINT32 msgLen)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSyncMessageQueueCreate():"
+ "Not implemented in Linux \n", 0, 0, 0,
+ 0, 0, 0);
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalMessageQueueDelete (IxOsalMessageQueue * queue)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMessageQueueDelete(): Not implemented in Linux \n", 0, 0, 0, 0,
+ 0, 0);
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalMessageQueueSend (IxOsalMessageQueue * queue, UINT8 * message)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMessageQueueSend(): Not implemented in Linux \n", 0, 0, 0, 0,
+ 0, 0);
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalMessageQueueReceive (IxOsalMessageQueue * queue, UINT8 * message)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMessageQueueReceive(): Not implemented in Linux \n", 0, 0, 0,
+ 0, 0, 0);
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalSyncMessageQueueReceive (IxOsalMessageQueue * queue, UINT8 * message,
+ INT32 timeout)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSyncMessageQueueReceive():"
+ "Not implemented in Linux \n", 0, 0, 0,
+ 0, 0, 0);
+ return IX_SUCCESS;
+}
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSemaphore.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSemaphore.c
new file mode 100644
index 0000000..5b55a5a
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSemaphore.c
@@ -0,0 +1,607 @@
+/**
+ * @file IxOsalOsSemaphore.c (linux)
+ *
+ * @brief Implementation for semaphore and mutex.
+ *
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010,2011,2012 Avencall
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ * Copyright(c) 2010,2011,2012 Avencall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+#include "IxOsal.h"
+#include <linux/slab.h>
+#include <linux/version.h>
+#include <linux/semaphore.h>
+#include <asm/atomic.h>
+
+
+
+#ifdef IX_OSAL_OS_LINUX_VERSION_2_6
+
+#include <linux/hardirq.h>
+
+#else /* !KERNEL VERSION 2.6 */
+
+#include <asm/hardirq.h>
+
+#endif /* KERNEL_VERSION */
+
+
+/* Define a large number */
+#define IX_OSAL_MAX_LONG (0x7FFFFFFF)
+
+/* Max timeout in MS, used to guard against possible overflow */
+#define IX_OSAL_MAX_TIMEOUT_MS (IX_OSAL_MAX_LONG/HZ)
+
+
+PUBLIC IX_STATUS
+ixOsalSemaphoreInit (IxOsalSemaphore * sid, UINT32 start_value)
+{
+
+ if (NULL == sid)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreInit: NULL semaphore pointer \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ *sid = kmalloc (sizeof (struct semaphore), GFP_KERNEL);
+ if (!(*sid))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreInit: fail to allocate for semaphore \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ sema_init (*sid, start_value);
+
+ return IX_SUCCESS;
+}
+
+/**
+ * DESCRIPTION: If the semaphore is 'empty', the calling thread is blocked.
+ * If the semaphore is 'full', it is taken and control is returned
+ * to the caller. If the time indicated in 'timeout' is reached,
+ * the thread will unblock and return an error indication. If the
+ * timeout is set to 'IX_OSAL_WAIT_NONE', the thread will never block;
+ * if it is set to 'IX_OSAL_WAIT_FOREVER', the thread will block until
+ * the semaphore is available.
+ *
+ *
+ */
+
+
+PUBLIC IX_STATUS
+ixOsalSemaphoreWait (IxOsalOsSemaphore * sid, INT32 timeout)
+{
+
+ IX_STATUS ixStatus = IX_SUCCESS;
+ unsigned long timeoutTime;
+
+ if (sid == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreWait(): NULL semaphore handle \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ /*
+ * Guard against illegal timeout values
+ */
+ if ((timeout < 0) && (timeout != IX_OSAL_WAIT_FOREVER))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreWait(): illegal timeout value \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ if (timeout == IX_OSAL_WAIT_FOREVER)
+ {
+ down (*sid);
+ }
+ else if (timeout == IX_OSAL_WAIT_NONE)
+ {
+ if (down_trylock (*sid))
+ {
+ ixStatus = IX_FAIL;
+ }
+ }
+ else if (timeout > IX_OSAL_MAX_TIMEOUT_MS)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreWait(): use a smaller timeout value to avoid \
+ overflow \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+ else
+ {
+ /* Convert timeout in milliseconds to HZ */
+ timeoutTime = jiffies + (timeout * HZ) /IX_OSAL_THOUSAND;
+ while (1)
+ {
+ if (!down_trylock (*sid))
+ {
+ break;
+ }
+ else
+ {
+ if (time_after(jiffies, timeoutTime))
+ {
+ ixStatus = IX_FAIL;
+ break;
+ }
+ }
+ /* Switch to next running process instantly */
+ set_current_state((long)TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+
+ } /* End of while loop */
+ } /* End of if */
+
+ return ixStatus;
+
+}
+
+/*
+ * Attempt to get semaphore, return immediately,
+ * no error info because users expect some failures
+ * when using this API.
+ */
+PUBLIC IX_STATUS
+ixOsalSemaphoreTryWait (IxOsalSemaphore * sid)
+{
+ if (sid == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreTryWait(): NULL semaphore handle \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+ if (down_trylock (*sid))
+ {
+ return IX_FAIL;
+ }
+ return IX_SUCCESS;
+}
+
+/**
+ *
+ * DESCRIPTION: This function causes the next available thread in the pend queue
+ * to be unblocked. If no thread is pending on this semaphore, the
+ * semaphore becomes 'full'.
+ */
+PUBLIC IX_STATUS
+ixOsalSemaphorePost (IxOsalSemaphore * sid)
+{
+ if (sid == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphorePost(): NULL semaphore handle \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+ up (*sid);
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalSemaphoreDestroy (IxOsalSemaphore * sid)
+{
+ if (sid == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreDestroy(): NULL semaphore handle \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ kfree (*sid);
+ *sid = 0;
+
+ return IX_SUCCESS;
+}
+
+/****************************
+ * Mutex
+ ****************************/
+
+PUBLIC IX_STATUS
+ixOsalMutexInit (IxOsalMutex * mutex)
+{
+ if (mutex == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMutexInit(): NULL mutex handle \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+ *mutex =(struct semaphore *) kmalloc(sizeof(struct semaphore), GFP_KERNEL);
+ if (*mutex == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMutexInit(): Fail to allocate for mutex \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ init_MUTEX (*mutex);
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalMutexLock (IxOsalMutex * mutex, INT32 timeout)
+{
+ unsigned long timeoutTime;
+
+ if (mutex == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMutexLock(): NULL mutex handle \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ if ((timeout < 0) && (timeout != IX_OSAL_WAIT_FOREVER))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMutexLock(): Illegal timeout value \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ if (timeout == IX_OSAL_WAIT_FOREVER)
+ {
+ down (*mutex);
+ }
+ else if (timeout == IX_OSAL_WAIT_NONE)
+ {
+ if (down_trylock (*mutex))
+ {
+ return IX_FAIL;
+ }
+ }
+ else if (timeout > IX_OSAL_MAX_TIMEOUT_MS)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMutexLock(): use smaller timeout value to avoid overflow \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+ else
+ {
+ timeoutTime = jiffies + (timeout * HZ) / IX_OSAL_THOUSAND;
+ while (1)
+ {
+ if (!down_trylock (*mutex))
+ {
+ break;
+ }
+ else
+ {
+ if (time_after(jiffies, timeoutTime))
+ {
+ return IX_FAIL;
+ }
+ }
+
+ /* Switch to next running process if not in atomic state */
+ if (!in_atomic())
+ {
+ set_current_state((long)TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } /* End of while loop */
+ } /* End of if */
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalMutexUnlock (IxOsalMutex * mutex)
+{
+ if (mutex == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMutexUnlock(): NULL mutex handle \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ up (*mutex);
+ return IX_SUCCESS;
+}
+
+/*
+ * Attempt to get mutex, return immediately,
+ * no error info because users expect some failures
+ * when using this API.
+ */
+PUBLIC IX_STATUS
+ixOsalMutexTryLock (IxOsalMutex * mutex)
+{
+ if (mutex == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMutexTryLock(): NULL mutex handle \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ if (down_trylock (*mutex))
+ {
+ return IX_FAIL;
+ }
+
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalMutexDestroy (IxOsalMutex * mutex)
+{
+ if (mutex == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalMutexDestroy(): NULL mutex handle \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+ kfree (*mutex);
+ *mutex = 0;
+
+ return IX_SUCCESS;
+}
+
+
+
+#ifdef IX_OSAL_OEM_FAST_MUTEX
+
+PUBLIC IX_STATUS
+ixOsalFastMutexInit (IxOsalFastMutex * mutex)
+{
+ return IX_OSAL_OEM_FAST_MUTEX_INIT (mutex);
+}
+
+PUBLIC IX_STATUS
+ixOsalFastMutexTryLock(IxOsalFastMutex *mutex)
+{
+ return IX_OSAL_OEM_FAST_MUTEX_TRYLOCK(mutex);
+}
+
+PUBLIC IX_STATUS
+ixOsalFastMutexUnlock (IxOsalFastMutex * mutex)
+{
+ if (mutex == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalFastMutexUnlock(): NULL mutex handle \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+ return IX_OSAL_OEM_FAST_MUTEX_UNLOCK(mutex);
+}
+
+PUBLIC IX_STATUS
+ixOsalFastMutexDestroy (IxOsalFastMutex * mutex)
+{
+ if (mutex == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalFastMutexDestroy(): NULL mutex handle \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ return IX_OSAL_OEM_FAST_MUTEX_DESTROY(mutex);
+}
+
+#else /* ! OEM_FAST_MUTEX */
+
+PUBLIC IX_STATUS
+ixOsalFastMutexInit (IxOsalFastMutex * mutex)
+{
+ if (mutex)
+ {
+ atomic_set(mutex,1);
+ return IX_SUCCESS;
+ }
+ else
+ {
+ return IX_FAIL;
+ }
+}
+
+PUBLIC IX_STATUS
+ixOsalFastMutexTryLock(IxOsalFastMutex *mutex)
+{
+ if (atomic_dec_and_test(mutex))
+ {
+ return IX_SUCCESS;
+ }
+ else
+ {
+ atomic_inc(mutex);
+ return IX_FAIL;
+ }
+}
+
+PUBLIC IX_STATUS
+ixOsalFastMutexUnlock (IxOsalFastMutex * mutex)
+{
+ if (mutex)
+ {
+ atomic_inc(mutex);
+ return IX_SUCCESS;
+ }
+ else
+ {
+ return IX_FAIL;
+ }
+}
+
+PUBLIC IX_STATUS
+ixOsalFastMutexDestroy (IxOsalFastMutex * mutex)
+{
+ atomic_set(mutex,1);
+ return IX_SUCCESS;
+}
+
+#endif /* IX_OSAL_OEM_FAST_MUTEX */
+
+
+PUBLIC
+IX_STATUS ixOsalSemaphoreDownTimeout(
+ IxOsalSemaphore *sid,
+ INT32 timeout)
+{
+ IX_STATUS ixStatus;
+ ixStatus = ixOsalSemaphoreWait (sid, timeout);
+ return ixStatus;
+
+} /* ixOsalSemaphoreDownTimeout */
+
+
+
+PUBLIC
+IX_STATUS ixOsalSemaphoreWaitInterruptible(
+ IxOsalSemaphore *sid,
+ INT32 timeout)
+{
+ IX_STATUS ixStatus = IX_SUCCESS;
+ unsigned long timeoutTime;
+
+ if (sid == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreWaitInterruptible(): NULL handle \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ /*
+ * Guard against illegal timeout values
+ */
+ if ((timeout < 0) && (timeout != IX_OSAL_WAIT_FOREVER))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreWaitInterruptible: illegal timeout value\n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ if (timeout == IX_OSAL_WAIT_FOREVER)
+ {
+ // stupid morons wrote that code, what can I do?
+ if (down_interruptible(*sid))
+ return IX_FAIL; // well i can do that, this might probably be less harmful than the original "i don't care"
+ // approach, and less stupid than a busy waiting approach, but anyway i don't really give a
+ // fuck about that absurd amount of shit
+ }
+ else if (timeout == IX_OSAL_WAIT_NONE)
+ {
+ if (down_trylock (*sid))
+ {
+ ixStatus = IX_FAIL;
+ }
+ }
+ else if (timeout > IX_OSAL_MAX_TIMEOUT_MS)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSemaphoreWaitInterruptible():use smaller timeout \
+ value to avoid overflow \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+ else
+ {
+ /* Convert timeout in milliseconds to HZ */
+ timeoutTime = jiffies + (timeout * HZ) /IX_OSAL_THOUSAND;
+ while (1)
+ {
+ if (!down_trylock (*sid))
+ {
+ break;
+ }
+ else
+ {
+ if (time_after(jiffies, timeoutTime))
+ {
+ ixStatus = IX_FAIL;
+ break;
+ }
+ }
+ /* Switch to next running process instantly */
+ set_current_state((long)TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+
+ } /* End of while loop */
+ } /* End of if */
+
+ return ixStatus;
+
+} /* ixOsalSemaphoreWaitInterruptible */
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsServices.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsServices.c
new file mode 100644
index 0000000..db99c48
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsServices.c
@@ -0,0 +1,586 @@
+/**
+ * @file IxOsalOsServices.c (linux)
+ *
+ * @brief Implementation for Mem and Sleep.
+ *
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ * Intel Corporation
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+#include "IxOsal.h"
+#include "IxOsalOsTypes.h"
+
+#include <linux/version.h>
+
+#include <linux/delay.h>
+#include <linux/kernel.h>
+#include <linux/time.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+
+#include <linux/mm.h>
+#include <linux/mempool.h>
+#include <linux/vmalloc.h>
+
+/* More generic include */
+#include <linux/highmem.h>
+#include <asm/pgtable.h>
+#include <linux/random.h>
+
+/* Trace Message Logging Levels */
+
+static char *traceHeaders[] = {
+ "",
+ "[fatal] ",
+ "[error] ",
+ "[warning] ",
+ "[message] ",
+ "[debug1] ",
+ "[debug2] ",
+ "[debug3] ",
+ "[all]"
+};
+
+static CHAR osalModuleName[OSAL_MAX_MODULE_NAME_LENGTH] = "";
+
+/* by default trace all but debug message */
+PRIVATE unsigned int ixOsalCurrLogLevel = IX_OSAL_LOG_LVL_MESSAGE;
+
+#define IS_VMALLOC_ADDR(addr) (((UINT32)(addr) >= VMALLOC_START) && \
+ ((UINT32)(addr) < VMALLOC_END))
+
+/* Maximum memory (in bytes) that can be allocated using kmalloc.
+ Beyond this, vmalloc is to be used to allcoate memory */
+#define IX_OSAL_MAX_KMALLOC_MEM (1024 * 128)
+
+
+/*********************
+ * Log function
+ *********************/
+
+INT32
+ixOsalLog (IxOsalLogLevel level,
+ IxOsalLogDevice device,
+ char *format, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
+{
+ /*
+ * Return -1 for custom display devices
+ */
+ if ((device != IX_OSAL_LOG_DEV_STDOUT)
+ && (device != IX_OSAL_LOG_DEV_STDERR))
+ {
+ printk
+ ("ixOsalLog: only IX_OSAL_LOG_DEV_STDOUT and \
+ IX_OSAL_LOG_DEV_STDERR are supported \n");
+ return (IX_OSAL_LOG_ERROR);
+ }
+
+ if (level <= ixOsalCurrLogLevel && level != IX_OSAL_LOG_LVL_NONE)
+ {
+ INT32 return_val;
+ int headerByteCount =
+ (level ==
+ IX_OSAL_LOG_LVL_USER) ? 0 : printk (traceHeaders[level - 1]);
+
+
+ if ( OSAL_OS_GET_STRING_LENGTH(osalModuleName) != 0 )
+ {
+ headerByteCount +=
+ printk("%s :",osalModuleName);
+ }
+ headerByteCount +=
+ printk (format,
+ arg1, arg2, arg3, arg4, arg5,arg6);
+ return_val = (INT32)headerByteCount;
+ return return_val;
+ }
+ else
+ {
+ /*
+ * Return zero byte printed
+ */
+ return (IX_OSAL_NO_LOG);
+ }
+}
+
+PUBLIC UINT32
+ixOsalLogLevelSet (UINT32 level)
+{
+ UINT32 oldLevel;
+
+ /*
+ * Check value first
+ */
+ if ((level < IX_OSAL_LOG_LVL_NONE) || (level > IX_OSAL_LOG_LVL_ALL))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalLogLevelSet: Log Level is between %d and%d \n",
+ IX_OSAL_LOG_LVL_NONE, IX_OSAL_LOG_LVL_ALL, 0, 0, 0, 0);
+ return IX_OSAL_LOG_LVL_NONE;
+ }
+ oldLevel = ixOsalCurrLogLevel;
+
+ ixOsalCurrLogLevel = level;
+
+ return oldLevel;
+}
+
+/**************************************
+ * Task services
+ *************************************/
+
+PUBLIC void
+ixOsalBusySleep (UINT32 microseconds)
+{
+ udelay (microseconds);
+}
+
+PUBLIC void
+ixOsalSleep (UINT32 milliseconds)
+{
+ if (milliseconds != 0)
+ {
+ set_current_state((long)TASK_INTERRUPTIBLE);
+ schedule_timeout ((milliseconds * HZ) / IX_OSAL_THOUSAND);
+ }
+ else
+ {
+ schedule ();
+ }
+}
+
+/**************************************
+ * Memory functions
+ *************************************/
+
+void *
+ixOsalMemAlloc (UINT32 memsize)
+{
+ if(memsize > IX_OSAL_MAX_KMALLOC_MEM)
+ {
+ return ( vmalloc(memsize) );
+ }
+
+ return (kmalloc (memsize, GFP_KERNEL));
+}
+
+void
+ixOsalMemFree (void *ptr)
+{
+ IX_OSAL_MEM_ASSERT (ptr != NULL);
+
+ if(IS_VMALLOC_ADDR(ptr))
+ {
+ vfree(ptr);
+ return;
+ }
+
+ kfree (ptr);
+}
+
+/*
+ * Copy count bytes from src to dest ,
+ * returns pointer to the dest mem zone.
+ */
+void *
+ixOsalMemCopy (void *dest, const void *src, UINT32 count)
+{
+ IX_OSAL_MEM_ASSERT (dest != NULL);
+ IX_OSAL_MEM_ASSERT (src != NULL);
+ return (memcpy (dest, src, count));
+}
+
+/*
+ * Fills a memory zone with a given constant byte,
+ * returns pointer to the memory zone.
+ */
+void *
+ixOsalMemSet (void *ptr, UINT8 filler, UINT32 count)
+{
+ IX_OSAL_MEM_ASSERT (ptr != NULL);
+ return (memset (ptr, filler, count));
+}
+
+/**
+ * Compares count bytes from src and dest
+ * returns IX_SUCCESS/IX_FAIL
+ */
+PUBLIC IX_STATUS ixOsalMemCmp (void *dest, void *src, UINT32 count)
+{
+ IX_STATUS status = IX_FAIL;
+ IX_OSAL_MEM_ASSERT (dest != NULL);
+ IX_OSAL_MEM_ASSERT (src != NULL);
+ if( memcmp (dest, src, count) ==0)
+ {
+ status=IX_SUCCESS;
+ }
+ return status;
+}
+
+/*****************************
+ *
+ * Time
+ *
+ *****************************/
+
+/* Retrieve current system time */
+void
+ixOsalTimeGet (IxOsalTimeval * ptime)
+{
+ /*
+ * linux struct timeval has subfields:
+ * -- time_t (type long, second)
+ * -- suseconds_t ( type long, usecond)
+ */
+ do_gettimeofday ((struct timeval *) ptime);
+
+ /*
+ * Translate microsecond to nanosecond,
+ * second field is identical so no translation
+ * there.
+ */
+ ptime->nsecs *= IX_OSAL_THOUSAND;
+
+}
+
+
+PUBLIC void
+ixOsalYield (void)
+{
+ schedule ();
+}
+
+PUBLIC IX_STATUS
+ixOsalOsNameGet (INT8* osName, INT32 maxSize)
+{
+ IX_STATUS status = IX_FAIL;
+
+ /* Ensure that the input parameters are valid */
+ if (osName == NULL || maxSize <= 0)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalOsNameGet: invalid input parameters\n",
+ 0, 0, 0, 0, 0, 0);
+
+ return status;
+ }
+
+ status = IX_OSAL_OEM_OS_NAME_GET(osName, maxSize);
+
+ return status;
+}
+
+PUBLIC IX_STATUS
+ixOsalOsVersionGet(INT8* osVersion, INT32 maxSize)
+{
+ IX_STATUS status = IX_FAIL;
+
+ /* Ensure that the input parameters are valid */
+ if (osVersion == NULL || maxSize <= 0)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalOsVersionGet: invalid input parameters\n",
+ 0, 0, 0, 0, 0, 0);
+ return status;
+ }
+
+ status = IX_OSAL_OEM_OS_VERSION_GET(osVersion, maxSize);
+ return status;
+}
+
+
+PUBLIC
+IX_STATUS ixOsalSleepTick(UINT32 sleeptime_ticks)
+{
+ if(sleeptime_ticks < 1)
+ {
+ schedule();
+ return IX_SUCCESS;
+ }
+ else
+ {
+ set_current_state((long)TASK_UNINTERRUPTIBLE);
+ schedule_timeout(sleeptime_ticks);
+ }
+
+ return IX_SUCCESS;
+} /* ixOsalSleepTick */
+
+
+PUBLIC
+IX_STATUS ixOsalSleepUninterruptible(
+ UINT32 sleeptime_ms)
+{
+ struct timespec value;
+
+ if(sleeptime_ms < 1)
+ {
+ schedule();
+ return IX_SUCCESS;
+ }
+
+ value.tv_sec = sleeptime_ms/IX_OSAL_THOUSAND;
+ {
+ INT64 ll_sleeptime;
+ ll_sleeptime = (sleeptime_ms % IX_OSAL_THOUSAND) * IX_OSAL_MILLION;
+ ixOsalMemCopy(&value.tv_nsec, &ll_sleeptime, sizeof (value.tv_nsec));
+ }
+ /*Block added to remove parasoft issue*/
+ {
+ unsigned long l_sleep_time = timespec_to_jiffies(&value);
+ ixOsalMemCopy(&sleeptime_ms, &l_sleep_time, sizeof (UINT32));
+ }
+ {
+ struct task_struct* aTask = current;
+ aTask->state = (long)TASK_UNINTERRUPTIBLE;
+ schedule_timeout(sleeptime_ms);
+ }
+ return IX_SUCCESS;
+} /* ixOsalSleepUninterruptible */
+
+/*
+ * The function allocate a chunck of memory bigger that the required size
+ * It then calculate the aligned ptr that should be returned to the user.
+ * In the memory just above the returned chunck, the funcion stores the
+ * structure with the memory information
+ *
+ * +---+-------------------------+------------------------------- +---+
+ * |xxx|ixOsalMemAllocInfoStruct | memory returned to user (size) |xxx|
+ * +---+-------------------------+--------------------------------+---+
+ * ^ ^
+ * mAllocMemPtr Ptr returned to the caller of MemAlloc
+ *
+ */
+PUBLIC VOID *
+ixOsalMemAllocAligned(UINT32 space, UINT32 size, UINT32 alignment)
+{
+
+ VOID* ptr = NULL;
+ UINT32 toPadSize = 0;
+ UINT32 padding = 0;
+ VOID* pRet = NULL;
+ UINT32 alignment_offset = 0;
+
+ ixOsalMemAllocInfoStruct memInfo = {0};
+
+ if (size == 0 || alignment < 1)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "[ixOsalMemAllocAligned] size or alignment are zero \n",
+ size, alignment, 0, 0, 0, 0);
+ return NULL;
+ }
+
+ if (alignment & (alignment-1))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "[ixOsalMemAllocAligned] Expecting alignment of a power "
+ "of two but did not get one\n", 0, 0, 0, 0, 0, 0);
+ return NULL;
+ }
+
+ if (1 == alignment)
+ {
+ toPadSize = sizeof(ixOsalMemAllocInfoStruct);
+ padding = 0;
+ }
+ else if (sizeof(ixOsalMemAllocInfoStruct) > alignment)
+ {
+ toPadSize = sizeof(ixOsalMemAllocInfoStruct) + alignment;
+ padding = IX_OSAL_MEM_PADDING(toPadSize, alignment);
+ }
+ else
+ {
+ toPadSize = alignment;
+ padding = 0;
+ }
+
+ memInfo.mSize = size + toPadSize + padding;
+
+ if (memInfo.mSize > IX_OSAL_MAX_KMALLOC_MEM)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "[ixOsalMemAllocAligned] Total size needed for this "
+ "set of size and alignment (%ld) exceeds the OS "
+ "limit %ld\n", memInfo.mSize, IX_OSAL_MAX_KMALLOC_MEM,
+ 0, 0, 0, 0);
+
+
+ return NULL;
+ }
+
+ ptr = kmalloc (memInfo.mSize, GFP_KERNEL);
+
+ if (ptr == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "[ixOsalMemAllocAligned] memory allocation "
+ "failed %ld/%d\n",
+ size, alignment, 0, 0, 0, 0);
+
+ return NULL;
+ }
+
+
+ alignment_offset = (UINT32)ptr % alignment;
+ memInfo.mAllocMemPtr = ptr;
+
+ pRet = (VOID*) ((CHAR*)ptr + toPadSize + padding + alignment_offset);
+ memcpy((VOID*)((CHAR*)pRet - sizeof(ixOsalMemAllocInfoStruct)),
+ (VOID*)(&memInfo),
+ sizeof(ixOsalMemAllocInfoStruct));
+
+ return pRet;
+
+}
+
+VOID
+ixOsalMemAlignedFree (VOID *ptr, UINT32 size)
+{
+ ixOsalMemAllocInfoStruct *memInfo = NULL;
+
+ memInfo = (ixOsalMemAllocInfoStruct *)((CHAR *)ptr -
+ sizeof(ixOsalMemAllocInfoStruct));
+
+ if (memInfo->mSize == 0 || memInfo->mAllocMemPtr == NULL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "[ixOsalMemAlignedFree] ERROR: Detected the corrupted "
+ "data: memory leak!! \n", 0, 0, 0, 0, 0, 0);
+
+ return;
+ }
+
+ kfree (memInfo->mAllocMemPtr);
+
+}
+
+PUBLIC VOID
+ixOsalGetRandomNum32(UINT32 *num)
+{
+ get_random_bytes((void *)num, sizeof (UINT32));
+}
+
+PUBLIC VOID
+ixOsalLogSetPrefix(CHAR * moduleName)
+{
+ UINT8 stringLength;
+
+ if (moduleName == NULL)
+ {
+ return;
+ }
+
+ stringLength = (UINT8)OSAL_OS_GET_STRING_LENGTH(moduleName);
+
+ if (stringLength >= OSAL_MAX_MODULE_NAME_LENGTH)
+ {
+ stringLength = OSAL_MAX_MODULE_NAME_LENGTH -1 ;
+ }
+
+ ixOsalMemCopy(osalModuleName,moduleName,stringLength);
+ osalModuleName[stringLength] = '\0';
+ return;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief simple logging function
+ *
+ * @param arg_pFmtString - message format, in printk format
+ * arg1 - argument 1
+ * arg2 - argument 2
+ * arg3 - argument 3
+ * arg4 - argument 4
+ * arg5 - argument 5
+ * arg6 - argument 6
+ *
+ * Logging function, similar to printk. This provides a barebones logging
+ * mechanism for users without differing verbosity levels. This interface
+ * is not quaranteed to be IRQ safe.
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: no
+ */
+
+
+IX_STATUS ixOsalStdLog(
+ const char* arg_pFmtString,
+ ...
+ )
+{
+ IX_STATUS err = IX_SUCCESS;
+ va_list argList;
+
+ va_start(argList, arg_pFmtString);
+ if ( OSAL_OS_GET_STRING_LENGTH(osalModuleName) != 0 )
+ {
+ printk("%s :",osalModuleName);
+ }
+ vprintk(arg_pFmtString, argList);
+ va_end(argList);
+
+ return err;
+
+} /* ixOsalStdLog */
+
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSpinLock.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSpinLock.c
new file mode 100644
index 0000000..531d5ed
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSpinLock.c
@@ -0,0 +1,507 @@
+/**
+ * @file IxOsalOsSpinLock.c (linux)
+ *
+ * @brief Implementation for spinlocks
+ *
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010,2011,2012 Avencall
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ * Copyright(c) 2010,2011,2012 Avencall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+
+#include "IxOsal.h"
+
+/**
+ ***********************************************************
+ * @function: ixOsalSpinLockInit
+ *
+ * @param: slock - IN - pointer to a spinlock_t type
+ * @param: slockType - IN - not used
+ *
+ * @return: IX_STATUS - IX_SUCCESS or IX_FAIL
+ *
+ * @brief: Initialize Spin Lock.
+ ***********************************************************
+ */
+PUBLIC IX_STATUS
+ixOsalSpinLockInit(IxOsalSpinLock *slock, IxOsalSpinLockType slockType)
+{
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockInit(): Null spinlock pointer",
+ IX_FAIL);
+
+ /* Spinlock type is ignored in case of Linux */
+ spin_lock_init (slock); /* Kernel function call */
+
+ return IX_SUCCESS;
+}
+
+/**
+ ***********************************************************
+ * @function: ixOsalSpinLockLock
+ *
+ * @param: slock - IN - pointer to a spinlock_t type
+ *
+ * @return: IX_STATUS - IX_SUCCESS or IX_FAIL
+ *
+ * @brief: Acquire the basic SpinLock
+ ***********************************************************
+ */
+PUBLIC IX_STATUS
+ixOsalSpinLockLock(IxOsalSpinLock *slock)
+{
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockLock(): Null spinlock pointer",
+ IX_FAIL);
+
+ spin_lock (slock); /* kernel function call */
+
+ return IX_SUCCESS;
+}
+
+/**
+ ***********************************************************
+ *
+ * @param: slock - IN - pointer to a spinlock_t type
+ *
+ * @return: IX_STATUS - IX_SUCCESS or IX_FAIL
+ *
+ * @brief: Release the SpinLock.
+ ***********************************************************
+ */
+PUBLIC IX_STATUS
+ixOsalSpinLockUnlock(IxOsalSpinLock *slock)
+{
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockUnlock(): Null spinlock pointer",
+ IX_FAIL);
+
+ spin_unlock (slock); /* kernel function call */
+
+ return IX_SUCCESS;
+}
+
+/**
+ ***********************************************************
+ * @function: ixOsalSpinLockTry
+ *
+ * @param: slock - IN - pointer to a spinlock_t type
+ *
+ * @return: IX_STATUS - IX_SUCCESS or IX_FAIL
+ *
+ * @brief: Try to acquire the SpinLock.
+ ***********************************************************
+ */
+PUBLIC IX_STATUS
+ixOsalSpinLockTry(IxOsalSpinLock *slock)
+{
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockTry(): Null spinlock pointer",
+ IX_FAIL);
+
+ /* kernel function call */
+ return spin_trylock(slock) ? IX_SUCCESS : IX_FAIL;
+}
+
+/**
+ ***********************************************************
+ * @function: ixOsalSpinLockDestroy
+ *
+ * @param: slock - IN - pointer to a spinlock_t type
+ *
+ * @return: IX_STATUS - IX_SUCCESS or IX_FAIL
+ *
+ * @brief: Destroy the SpinLock. This is done by freeing
+ * the memory allocated to Spinlock.
+ ***********************************************************
+ */
+PUBLIC IX_STATUS
+ixOsalSpinLockDestroy(IxOsalSpinLock *slock)
+{
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockDestroy(): Null spinlock pointer",
+ IX_FAIL);
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief checks whether spinlock can be acquired
+ *
+ * @param slock - Spinlock handle
+ *
+ * This routine checks whether spinlock available for lock
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return - IX_SUCCESS if spinlock is locked. Returns IX_FAIL if spinlock
+ * is not locked.
+ */
+
+PUBLIC IX_STATUS ixOsalSpinLockIsLocked(IxOsalSpinLock *slock)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockIsLocked(): NULL spinlock pointer",
+ IX_FAIL);
+
+ return spin_is_locked(slock) ? IX_SUCCESS : IX_FAIL;
+}
+
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Acquires a spinlock
+ *
+ * @param slock - Spinlock handle
+ *
+ * This routine disables local irqs & then acquires a slock
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @usage This API can be used in user context or bottom half when critical
+ * section is shared between user context or bottom half and the
+ * irq handler
+ *
+ * @return - returns IX_SUCCESS if spinlock is acquired. If the spinlock is not
+ * available then it busy loops/spins till slock available. If the
+ * spinlock handle passed is NULL then returns IX_FAIL.
+ */
+
+PUBLIC IX_STATUS ixOsalSpinLockLockIrq(IxOsalSpinLock *slock)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockLockIrq(): NULL spinlock pointer",
+ IX_FAIL);
+
+ spin_lock_irq(slock);
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Releases the spinlock
+ *
+ * @param slock - Spinlock handle
+ *
+ * This routine releases the acquired spinlock & enables the local irqs
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @usage This API can be used in user context or bottom half when critical
+ * section is shared between user context or bottom half and
+ * irq handler
+ *
+ * @return - returns IX_SUCCESS if slock is unlocked. Returns IX_FAIL if the
+ * slock is NULL.
+ */
+PUBLIC IX_STATUS ixOsalSpinLockUnlockIrq(IxOsalSpinLock *slock)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockUnlockIrq(): Null spinlock pointer",
+ IX_FAIL);
+
+ spin_unlock_irq(slock);
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Tries to acquire the spinlock
+ *
+ * @param slock - Spinlock handle
+ *
+ * This routine disables local irq & attempts to acquire a spinlock but
+ * doesn't block the thread if spinlock not available.
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @usage This API can be used in user context or bottom half when critical
+ * section is shared between user context or bottom half and
+ * irq handler
+ *
+ * @return -If spinlock is available then returns the IX_SUCCESS with
+ * spinlock locked. If spinlock not available then enables the
+ * local irqs & returns IX_FAIL
+ *
+ */
+
+PUBLIC IX_STATUS ixOsalSpinLockTryIrq(IxOsalSpinLock *slock)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockTryIrq(): Null spinlock pointer",
+ IX_FAIL);
+
+ return spin_trylock_irq(slock) ? IX_SUCCESS : IX_FAIL;
+
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Acquires a spinlock
+ *
+ * @param slock - Spinlock handle
+ *
+ * This routine disables bottom half & then acquires a slock
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @usage This API can be used in user context when critical section is
+ * shared between user context & bottom half handler
+ *
+ * @return - returns IX_SUCCESS if spinlock is acquired. If the spinlock is not
+ * available then it busy loops/spins till slock available. If the
+ * spinlock handle passed is NULL then returns IX_FAIL.
+ */
+
+PUBLIC IX_STATUS ixOsalSpinLockLockBh(IxOsalSpinLock *slock)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockLockBh(): Null spinlock pointer",
+ IX_FAIL);
+
+ spin_lock_bh(slock);
+ return IX_SUCCESS;
+
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Releases the spin lock
+ *
+ * @param slock - Spinlock handle
+ *
+ * This routine releases the acquired spinlock & enables the
+ * bottom half handler
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: no
+ *
+ * @usage This API can be used in user context when critical section is
+ * shared between user context & bottom half handler
+ *
+ * @return - returns IX_SUCCESS if slock is released or unlocked.
+ * Returns IX_FAIL if the slock is NULL.
+ */
+PUBLIC IX_STATUS ixOsalSpinLockUnlockBh(IxOsalSpinLock *slock)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockUnlockBh(): Null spinlock pointer",
+ IX_FAIL);
+
+ spin_unlock_bh(slock);
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Tries to acquire the spin lock
+ *
+ * @param slock - Spinlock handle
+ *
+ * This routine disables bottom half handler & attempts to acquire a spinlock
+ * but doesn't block the thread if spinlock not available. It enables the bh &
+ * returns IX_FAIL if spinlock not available.
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: no
+ *
+ * @usage This API can be used in user context when critical section is
+ * shared between user context & bottom half handler
+ *
+ * @return -Returns the IX_SUCCESS with spinlock locked if the spinlock is
+ * available. Enables the local irqs & return IX_FAIL
+ * if spinlock is not available.
+ */
+PUBLIC IX_STATUS ixOsalSpinLockTryBh(IxOsalSpinLock *slock)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockTryBh(): Null spinlock pointer",
+ IX_FAIL);
+
+ return spin_trylock_bh(slock) ? IX_SUCCESS : IX_FAIL;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Acquires a spinlock
+ *
+ * @param slock - Spinlock handle
+ * @param flags - local irqs saved in flags
+ *
+ * @usage This API can be used when critical section is shared between
+ * irq routines
+ *
+ * This routine saves local irqs in flags & then acquires a spinlock
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return - returns IX_SUCCESS if spinlock acquired. If the spinlock is not
+ * available then it busy loops/spins till slock available.
+ * If the spinlock handle passed is NULL then returns IX_FAIL.
+ */
+
+PUBLIC IX_STATUS ixOsalSpinLockLockIrqSave(IxOsalSpinLock *slock,
+ UINT32 *flags)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockLockIrqSave(): Null spinlock pointer",
+ IX_FAIL);
+
+ IX_OSAL_LOCAL_ENSURE(flags,
+ "ixOsalSpinLockLockIrqSave(): Null flags pointer",
+ IX_FAIL);
+
+ // ugly hack because of ugly source code
+ spin_lock_irqsave(slock, *((unsigned long *)flags));
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Releases the spin lock
+ *
+ * @param slock - Spinlock handle
+ * @param flags - local irqs saved in flags
+ *
+ * @usage This API can be used when critical section is shared between
+ * irq routines
+ *
+ * This routine releases the acquired spin lock & restores irqs in flags
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @return - returns IX_SUCCESS if slock is unlocked. Returns IX_FAIL if the
+ * slock is NULL.
+ */
+PUBLIC IX_STATUS ixOsalSpinLockUnlockIrqRestore(IxOsalSpinLock *slock,
+ UINT32 *flags)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockUnlockIrqRestore(): Null spinlock pointer",
+ IX_FAIL);
+
+ IX_OSAL_LOCAL_ENSURE(flags,
+ "ixOsalSpinLockUnlockIrqRestore(): Null flags pointer",
+ IX_FAIL);
+
+ spin_unlock_irqrestore(slock, *((unsigned long *)flags));
+
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Tries to acquire the spinlock
+ *
+ * @param slock - Spinlock handle
+ * @param flags - local irqs saved in flags
+ *
+ * This routine saves irq in flags & attempts to acquire a spinlock but
+ * doesn't block the thread if the spin lock not avialble. If the
+ * spinlock not available then it restore the irqs & return IX_FAIL
+ *
+ * @li Reentrant: yes
+ * @li IRQ safe: yes
+ *
+ * @usage This API can be used when critical section is shared between
+ * irq routines
+ *
+ * @return -Returns the IX_SUCCESS with spinlock locked if the spinlock is
+ * available. Enables the local irqs & returns IX_FAIL
+ * if spinlock not available.
+ */
+PUBLIC IX_STATUS ixOsalSpinLockTryIrqSave(IxOsalSpinLock *slock, UINT32 *flags)
+{
+ /* SpinLock NULL pointer check. */
+ IX_OSAL_LOCAL_ENSURE(slock,
+ "ixOsalSpinLockTryIrqSave(): Null spinlock pointer",
+ IX_FAIL);
+
+ IX_OSAL_LOCAL_ENSURE(flags,
+ "ixOsalSpinLockTryIrqSave(): Null flags pointer",
+ IX_FAIL);
+
+ return spin_trylock_irqsave(slock, *((unsigned long *)flags))
+ ? IX_SUCCESS : IX_FAIL;
+}
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSymbols.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSymbols.c
new file mode 100644
index 0000000..81b9e52
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsSymbols.c
@@ -0,0 +1,207 @@
+/*
+ * @file IxOsalOsSymbols.c
+ * @author Intel Corporation
+ * @date 25-08-2004
+ *
+ * @brief description goes here
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010,2011,2012 Avencall
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ * Copyright(c) 2010,2011,2012 Avencall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+#include "IxOsal.h"
+
+#ifdef IX_OSAL_MODULE
+#include <linux/init.h>
+#include <linux/module.h>
+MODULE_LICENSE("Dual BSD/GPL");
+#endif
+
+#ifdef OSAL_EXPORT_SYMBOLS
+
+EXPORT_SYMBOL (ixOsalMemAlloc);
+EXPORT_SYMBOL (ixOsalMemFree);
+EXPORT_SYMBOL (ixOsalMemCopy);
+EXPORT_SYMBOL (ixOsalMemSet);
+EXPORT_SYMBOL (ixOsalMemCmp);
+
+
+EXPORT_SYMBOL (ixOsalThreadCreate);
+EXPORT_SYMBOL (ixOsalThreadStart);
+EXPORT_SYMBOL (ixOsalThreadKill);
+EXPORT_SYMBOL (ixOsalThreadExit);
+EXPORT_SYMBOL (ixOsalThreadPrioritySet);
+EXPORT_SYMBOL (ixOsalThreadSuspend);
+EXPORT_SYMBOL (ixOsalThreadResume);
+EXPORT_SYMBOL (ixOsalThreadGetPolicyAndPriority);
+
+#ifdef IX_OSAL_THREAD_EXIT_GRACEFULLY
+EXPORT_SYMBOL (ixOsalThreadStopCheck);
+#endif /* IX_OSAL_THREAD_EXIT_GRACEFULLY */
+
+EXPORT_SYMBOL (ixOsalMessageQueueCreate);
+EXPORT_SYMBOL (ixOsalMessageQueueDelete);
+EXPORT_SYMBOL (ixOsalMessageQueueSend);
+EXPORT_SYMBOL (ixOsalMessageQueueReceive);
+EXPORT_SYMBOL (ixOsalSyncMessageQueueReceive);
+EXPORT_SYMBOL (ixOsalSyncMessageQueueCreate);
+
+EXPORT_SYMBOL (ixOsalMutexInit);
+EXPORT_SYMBOL (ixOsalMutexLock);
+EXPORT_SYMBOL (ixOsalMutexUnlock);
+EXPORT_SYMBOL (ixOsalMutexTryLock);
+EXPORT_SYMBOL (ixOsalMutexDestroy);
+EXPORT_SYMBOL (ixOsalFastMutexInit);
+EXPORT_SYMBOL (ixOsalFastMutexTryLock);
+EXPORT_SYMBOL (ixOsalFastMutexUnlock);
+EXPORT_SYMBOL (ixOsalFastMutexDestroy);
+
+EXPORT_SYMBOL (ixOsalSemaphoreInit);
+EXPORT_SYMBOL (ixOsalSemaphorePost);
+EXPORT_SYMBOL (ixOsalSemaphoreWait);
+EXPORT_SYMBOL (ixOsalSemaphoreTryWait);
+EXPORT_SYMBOL (ixOsalSemaphoreDestroy);
+EXPORT_SYMBOL (ixOsalSemaphoreWaitInterruptible);
+EXPORT_SYMBOL (ixOsalSleepTick);
+EXPORT_SYMBOL (ixOsalSleepUninterruptible);
+EXPORT_SYMBOL (ixOsalSemaphoreDownTimeout);
+
+EXPORT_SYMBOL (ixOsalYield);
+EXPORT_SYMBOL (ixOsalSleep);
+EXPORT_SYMBOL (ixOsalBusySleep);
+EXPORT_SYMBOL (ixOsalTimeGet);
+EXPORT_SYMBOL (ixOsalTimevalToTicks);
+EXPORT_SYMBOL (ixOsalTicksToTimeval);
+
+EXPORT_SYMBOL (ixOsalLog);
+EXPORT_SYMBOL (ixOsalStdLog);
+EXPORT_SYMBOL (ixOsalLogLevelSet);
+EXPORT_SYMBOL (ixOsalLogSetPrefix);
+EXPORT_SYMBOL (ixOsalRepeatingTimerSchedule);
+EXPORT_SYMBOL (ixOsalSingleShotTimerSchedule);
+EXPORT_SYMBOL (ixOsalTimerCancel);
+EXPORT_SYMBOL (ixOsalTimersShow);
+
+EXPORT_SYMBOL (ixOsalOsNameGet);
+EXPORT_SYMBOL (ixOsalOsVersionGet);
+
+/* New Functions */
+EXPORT_SYMBOL (ixOsalThreadGetId);
+EXPORT_SYMBOL (ixOsalThreadSetPolicyAndPriority);
+
+
+#ifdef ENABLE_SPINLOCK
+
+EXPORT_SYMBOL (ixOsalSpinLockInit);
+EXPORT_SYMBOL (ixOsalSpinLockLock);
+EXPORT_SYMBOL (ixOsalSpinLockUnlock);
+EXPORT_SYMBOL (ixOsalSpinLockTry);
+EXPORT_SYMBOL (ixOsalSpinLockDestroy);
+EXPORT_SYMBOL (ixOsalSpinLockIsLocked);
+EXPORT_SYMBOL (ixOsalSpinLockLockBh);
+EXPORT_SYMBOL (ixOsalSpinLockUnlockBh);
+EXPORT_SYMBOL (ixOsalSpinLockTryBh);
+EXPORT_SYMBOL (ixOsalSpinLockLockIrq);
+EXPORT_SYMBOL (ixOsalSpinLockUnlockIrq);
+EXPORT_SYMBOL (ixOsalSpinLockTryIrq);
+EXPORT_SYMBOL (ixOsalSpinLockLockIrqSave);
+EXPORT_SYMBOL (ixOsalSpinLockUnlockIrqRestore);
+EXPORT_SYMBOL (ixOsalSpinLockTryIrqSave);
+
+#endif /* ENABLE_SPINLOCK */
+
+EXPORT_SYMBOL (ixOsalAtomicGet);
+EXPORT_SYMBOL (ixOsalAtomicSet);
+EXPORT_SYMBOL (ixOsalAtomicAdd);
+EXPORT_SYMBOL (ixOsalAtomicSub);
+EXPORT_SYMBOL (ixOsalAtomicSubAndTest);
+EXPORT_SYMBOL (ixOsalAtomicInc);
+EXPORT_SYMBOL (ixOsalAtomicDec);
+EXPORT_SYMBOL (ixOsalAtomicDecAndTest);
+EXPORT_SYMBOL (ixOsalAtomicIncAndTest);
+
+EXPORT_SYMBOL (ixOsalMemBarrier);
+EXPORT_SYMBOL (ixOsalReadMemBarrier);
+EXPORT_SYMBOL (ixOsalWriteMemBarrier);
+
+EXPORT_SYMBOL (ixOsalGetRandomNum32);
+EXPORT_SYMBOL (ixOsalMemAllocAtomic);
+EXPORT_SYMBOL (ixOsalMemAllocAligned);
+EXPORT_SYMBOL (ixOsalMemAlignedFree);
+
+#endif /* OSAL_EXPORT_SYMBOLS */
+
+#ifdef IX_OSAL_MODULE
+
+static int osal_init( void )
+{
+ printk( "Loading OSAL Module ...\n" ) ;
+ return 0;
+}
+
+
+static void osal_exit( void )
+{
+ printk("Unloading OSAL Module ...\n" ) ;
+}
+
+module_init(osal_init);
+module_exit(osal_exit);
+
+#endif
+
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsThread.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsThread.c
new file mode 100644
index 0000000..ceba2ed
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsThread.c
@@ -0,0 +1,467 @@
+/**
+ * @file IxOsalOsThread.c (linux)
+ *
+ * @brief OS-specific thread implementation.
+ *
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ * Intel Corporation
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+
+#include "IxOsal.h"
+
+#include <linux/sched.h>
+
+#ifdef IX_OSAL_OS_LINUX_VERSION_2_6
+
+#include <linux/list.h>
+#include <linux/kthread.h>
+#include <linux/hardirq.h>
+
+#endif /* IX_OSAL_OS_LINUX_VERSION_2_6 */
+
+/* Thread Data structure */
+struct IxOsalOsThreadData
+{
+ IxOsalVoidFnVoidPtr entryPoint;
+ void *arg;
+};
+
+/* declaring mutexes */
+DECLARE_MUTEX (IxOsalThreadMutex);
+DECLARE_MUTEX (IxOsalThreadStopMutex);
+
+#ifndef IX_OSAL_OS_LINUX_VERSION_2_6 /* ! Linux-Kernel Version 2.6 */
+
+struct IxOsalOsThreadData thread_data;
+struct task_struct *kill_task = NULL;
+
+#endif
+
+
+#ifdef IX_OSAL_OS_LINUX_VERSION_2_6 /* Linux Kernel Version 2.6 */
+
+/* Thread info structure */
+struct IxOsalOsThreadInfo
+{
+ struct IxOsalOsThreadData data;
+ IxOsalThread ptid;
+ struct list_head list;
+};
+
+
+/* Thread attribute is ignored in Create */
+
+PUBLIC IX_STATUS
+ixOsalThreadCreate (IxOsalThread * ptrTid,
+ IxOsalThreadAttr * threadAttr, IxOsalVoidFnVoidPtr entryPoint, void *arg)
+{
+ *ptrTid = kthread_create((void *)entryPoint, arg, "%s",
+ (NULL != threadAttr && NULL != threadAttr->name)
+ ? threadAttr->name: "OSAL");
+
+ return IX_SUCCESS;
+}
+
+
+PUBLIC IX_OSAL_INLINE BOOL
+ixOsalThreadStopCheck(void)
+{
+ INT32 err = kthread_should_stop();
+ return err ? TRUE : FALSE;
+}
+
+/**
+ * Start the thread
+ */
+PUBLIC IX_STATUS
+ixOsalThreadStart (IxOsalThread *tId)
+{
+ if (NULL == *tId)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadStart(): Invalid Thread ID!\n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ wake_up_process(*tId);
+ return IX_SUCCESS;
+}
+
+#ifdef IX_OSAL_THREAD_EXIT_GRACEFULLY
+/* Exit status check is possible only in kernel 2.6.10 and greater */
+
+/*
+ * Kill the kernel thread. This shall not be used if the thread function
+ * implements do_exit()
+ */
+PUBLIC IX_STATUS
+ixOsalThreadKill (IxOsalThread * tid)
+{
+ struct task_struct *task = (struct task_struct*)*tid;
+
+ /* Can't kill already defunc thread */
+ if (EXIT_DEAD == task->exit_state || EXIT_ZOMBIE == task->exit_state)
+ {
+ return IX_FAIL;
+ }
+
+ if (-EINTR == kthread_stop(task))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadKill(): Failed to kill thread\n", 0, 0, 0, 0, 0, 0);
+
+ return IX_FAIL;
+ }
+
+ return IX_SUCCESS;
+}
+
+#else /* __! EXIT_GRACEFULLY */
+
+PUBLIC IX_STATUS
+ixOsalThreadKill (IxOsalThread * tid)
+{
+ kill_proc ((pid_t)*tid, SIGKILL, 1);
+ return IX_SUCCESS;
+}
+
+#endif /* IX_OSAL_THREAD_EXIT_GRACEFULLY */
+
+
+
+/********************************************************************
+ * UINT32 priority - the value of priority can range from 0 to 39 *
+ * with 0 being the highest priority. *
+ * *
+ * Any value for priority more than 39 will be silently rounded off *
+ * to 39 in this implementation. Internally, the range is converted *
+ * to the corresponding nice value that can range from -20 to 19. *
+ ********************************************************************/
+
+PUBLIC IX_STATUS
+ixOsalThreadPrioritySet (IxOsalThread * tid, UINT32 priority)
+{
+ struct task_struct *pTask = (struct task_struct*)*tid;
+
+ IX_OSAL_LOCAL_ENSURE(tid,
+ "ixOsalThreadPrioritySet(): Null pointer",
+ IX_FAIL);
+
+ if (priority > IX_OSAL_PRIO_SET_MAX_VALID_VAL)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR,
+ "ixOsalThreadPrioritySet(): FAIL \n", 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ if (priority > IX_OSAL_PRIO_SET_MAX_VAL)
+ {
+ priority = IX_OSAL_PRIO_SET_MAX_VAL;
+ }
+ if (priority < 0)
+ {
+ priority = 0;
+ }
+
+ /* sending the nice equivalent of priority as the parameter */
+ set_user_nice ( pTask, priority - IX_OSAL_NICE_VAL_DIFFERENCE );
+
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadPrioritySet(): Priority changed successfully \n",
+ 0, 0, 0, 0, 0, 0);
+
+ return IX_SUCCESS;
+}
+
+/**
+ ***********************************************************
+ * End of code cleanup section
+ ***********************************************************
+ */
+
+#else /* ! LINUX_VERSION_2_6 */
+
+PUBLIC IX_OSAL_INLINE BOOL
+ixOsalThreadStopCheck()
+{
+ if (current == kill_task)
+ {
+ kill_task = NULL;
+ up(&IxOsalThreadStopMutex);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static int
+thread_internal (void *unused)
+{
+ IxOsalVoidFnVoidPtr entryPoint = thread_data.entryPoint;
+ void *arg = thread_data.arg;
+ static int seq = 0;
+
+ daemonize();
+ reparent_to_init ();
+ exit_files (current);
+
+ snprintf(current->comm, sizeof(current->comm), "IxOsal %d", ++seq);
+
+ up (&IxOsalThreadMutex);
+
+ entryPoint (arg);
+ return 0;
+}
+
+/* Thread attribute is ignored */
+PUBLIC IX_STATUS
+ixOsalThreadCreate (IxOsalThread * ptrTid,
+ IxOsalThreadAttr * threadAttr, IxOsalVoidFnVoidPtr entryPoint, void *arg)
+{
+ down (&IxOsalThreadMutex);
+ thread_data.entryPoint = entryPoint;
+ thread_data.arg = arg;
+
+ /*
+ * kernel_thread takes: int (*fn)(void *) as the first input.
+ */
+ *ptrTid = kernel_thread (thread_internal, NULL, CLONE_SIGHAND);
+
+ if (*ptrTid < 0)
+ {
+ up (&IxOsalThreadMutex);
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadCreate(): fail to generate thread \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ return IX_SUCCESS;
+
+}
+
+/*
+ * Start thread after given its thread handle
+ */
+PUBLIC IX_STATUS
+ixOsalThreadStart (IxOsalThread * tId)
+{
+ /* Thread already started upon creation */
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadStart(): not implemented in linux\n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_SUCCESS;
+}
+
+
+PUBLIC IX_STATUS
+ixOsalThreadKill (IxOsalThread * tid)
+{
+ down(&IxOsalThreadStopMutex);
+ kill_task = find_task_by_pid(*tid);
+
+ if (kill_task)
+ {
+ wake_up_process(kill_task);
+
+ return IX_SUCCESS;
+ }
+
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadKill: Task %d was dead\n", *tid, 0, 0, 0, 0, 0);
+
+ /* Kill failed, remove the mutex */
+ up(&IxOsalThreadStopMutex);
+ return IX_FAIL;
+}
+
+#endif /* IX_OSAL_OS_LINUX_VERSION_2_6 */
+
+PUBLIC void
+ixOsalThreadExit (void)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadExit(): not implemented in linux\n", 0, 0, 0, 0, 0, 0);
+}
+
+PUBLIC IX_STATUS
+ixOsalThreadSuspend (IxOsalThread * tId)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadSuspend(): not implemented in linux\n", 0, 0, 0, 0, 0, 0);
+ return IX_SUCCESS;
+}
+
+PUBLIC IX_STATUS
+ixOsalThreadResume (IxOsalThread * tId)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalThreadResume(): not implemented in linux \n", 0, 0, 0, 0, 0, 0);
+ return IX_SUCCESS;
+
+}
+
+IX_STATUS
+ixOsalThreadGetId(IxOsalThread *ptrTid)
+{
+ *ptrTid = (IxOsalThread)current->pid;
+
+ return IX_SUCCESS;
+
+} /* ixOsalThreadGetId */
+
+
+IX_STATUS
+ixOsalThreadSetPolicyAndPriority(
+ IxOsalThread *tid,
+ UINT32 policy,
+ UINT32 priority)
+{
+
+#ifdef IX_OSAL_OS_LINUX_VER_GT_2_6_18
+ struct task_struct *pTask = (struct task_struct*)*tid;
+ struct sched_param param1;
+ INT32 status;
+
+ IX_OSAL_LOCAL_ENSURE(tid,
+ "ixOsalThreadSetPolicyAndPriority(): Null pointer",
+ IX_FAIL);
+ /* set the policy of existing */
+ policy = policy;
+ param1.sched_priority = priority;
+ status = sched_setscheduler(pTask, policy, &param1);
+ if(status)
+ {
+ return IX_FAIL;
+ }
+ else
+ {
+ return IX_SUCCESS;
+ }
+#else
+ IX_STATUS err = IX_SUCCESS;
+ struct task_struct *pTask;
+
+ IX_OSAL_LOCAL_ENSURE(tid,
+ "ixOsalThreadSetPolicyAndPriority(): Null pointer",
+ IX_FAIL);
+ lock_kernel();
+
+ /* In case of Linux Kernel 2.4:
+ * pTask = find_task_by_pid(*tid); */
+
+ /* In case of Kernel 2.6(default for OSSL-Shim) */
+ pTask = *tid;
+
+ if(pTask == 0)
+ {
+ err = IX_FAIL;
+ }else{
+ pTask->policy = policy;
+ pTask->rt_priority = priority;
+ }
+
+ unlock_kernel();
+ return err;
+#endif /* IX_OSAL_OS_LINUX_VER_BT_2_6_18 */
+
+} /* ixOsalThreadSetPolicyAndPriority */
+
+PUBLIC IX_STATUS
+ixOsalThreadGetPolicyAndPriority(
+ IxOsalThread *tid,
+ UINT32 *policy,
+ UINT32 *priority)
+{
+#ifdef IX_OSAL_OS_LINUX_VER_GT_2_6_18
+ struct task_struct *pTask = (struct task_struct*)*tid;
+
+ IX_OSAL_ENSURE_RETURN(tid, "Null pointer");
+ /* set the policy of existing */
+ *policy = pTask->policy;
+ *priority = pTask->rt_priority;
+ return IX_SUCCESS;
+
+#else
+ IX_STATUS err = IX_SUCCESS;
+ struct task_struct *pTask;
+
+ IX_OSAL_ENSURE_RETURN(tid, "Null pointer");
+ lock_kernel();
+
+ /* In case of Linux Kernel 2.4:
+ * pTask = find_task_by_pid(*tid); */
+
+ pTask = *tid;
+
+ if(pTask == 0)
+ {
+ err = IX_FAIL;
+ }else{
+ *policy = pTask->policy;
+ *priority = pTask->rt_priority;
+ }
+
+ unlock_kernel();
+ return err;
+#endif /* IX_OSAL_OS_LINUX_VER_BT_2_6_18 */
+
+}
+
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsTimer.c b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsTimer.c
new file mode 100644
index 0000000..1171305
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/IxOsalOsTimer.c
@@ -0,0 +1,275 @@
+/**
+ * @file IxOsalOsTimer.c (linux)
+ *
+ * @brief Implementation for Timer API's.
+ *
+ *
+ * @par
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ * Intel Corporation
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ */
+#include "IxOsal.h"
+
+#include <linux/timer.h>
+
+
+static void callback_repeat_timer(unsigned long ptr)
+{
+ IxOsalTimerRec *nTimerPtr;
+
+ nTimerPtr = (IxOsalTimerRec *)ptr;
+ /* if timer inUse then only reregister the timer */
+ if(nTimerPtr->inUse == TRUE)
+ {
+ /* call callback function registered by user */
+ nTimerPtr->callback(nTimerPtr->callbackParam);
+ nTimerPtr->timer.expires = jiffies + nTimerPtr->period;
+ /* add timer to call the callback after period */
+ add_timer(&nTimerPtr->timer);
+ }
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Schedules a repeating timer
+ *
+ * @param timer - handle of the timer object
+ * @param period - timer trigger period, in milliseconds
+ * @param priority - timer priority (0 being the highest)
+ * @param callback - user callback to invoke when the timer triggers
+ * @param param - custom parameter passed to the callback
+ *
+ * Schedules a timer to be called every period milliseconds. The timer
+ * will invoke the specified callback function possibly in interrupt
+ * context, passing the given parameter. If several timers trigger at the
+ * same time contention issues are dealt according to the specified timer
+ * priorities.
+ *
+ * @li Reentrant: no
+ * @li IRQ safe: no
+ *
+ * @return - IX_SUCCESS/IX_FAIL
+ */
+PUBLIC IX_STATUS ixOsalRepeatingTimerSchedule (IxOsalTimer *timer,
+ UINT32 period,
+ UINT32 priority,
+ IxOsalVoidFnVoidPtr callback,
+ void *param)
+{
+ IxOsalTimerRec *timerPtr;
+ IX_OSAL_LOCAL_ENSURE(timer,
+ "ixOsalRepeatingTimerSchedule(): Null IxOsalTimer pointer",
+ IX_FAIL);
+
+ IX_OSAL_LOCAL_ENSURE(callback,
+ "ixOsalRepeatingTimerSchedule(): NULL callback function pointer",
+ IX_FAIL);
+
+ *timer = kmalloc (sizeof (IxOsalTimerRec), GFP_KERNEL);
+ if (!(*timer))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalRepeatingTimerSchedule(): "
+ "Fail to allocate for IxOsalTimer \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ timerPtr = *timer;
+ timerPtr->inUse = TRUE;
+ init_timer(&(timerPtr->timer));
+ timerPtr->timer.function = callback_repeat_timer;
+ timerPtr->timer.data = (unsigned long)timerPtr;
+ timerPtr->timer.expires = jiffies + \
+ ((period*HZ)/IX_OSAL_THOUSAND);
+
+ /* store period to call the callback at regular intervals in jiffies*/
+ timerPtr->period = ((period*HZ)/IX_OSAL_THOUSAND);
+ timerPtr->callback = callback;
+ timerPtr->callbackParam = param;
+ timerPtr->isRepeating = TRUE;
+ add_timer(&(timerPtr->timer));
+
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Schedules a single-shot timer
+ *
+ * @param timer - handle of the timer object
+ * @param period - timer trigger period, in milliseconds
+ * @param priority - timer priority (0 being the highest)
+ * @param callback - user callback to invoke when the timer triggers
+ * @param param - custom parameter passed to the callback
+ *
+ * Schedules a timer to be called after period milliseconds. The timer
+ * will cease to function past its first trigger. The timer will invoke
+ * the specified callback function, possibly in interrupt context, passing
+ * the given parameter. If several timers trigger at the same time contention
+ * issues are dealt according to the specified timer priorities.
+ *
+ * @li Reentrant: no
+ * @li IRQ safe: no
+ *
+ * @return - IX_SUCCESS/IX_FAIL
+ */
+PUBLIC IX_STATUS
+ixOsalSingleShotTimerSchedule (IxOsalTimer *timer,
+ UINT32 period,
+ UINT32 priority,
+ IxOsalVoidFnVoidPtr callback, void *param)
+{
+ IxOsalTimerRec *timerPtr;
+
+ IX_OSAL_LOCAL_ENSURE(timer,
+ "ixOsalSingleShotTimerSchedule(): NULL IxOsalTimer pointer",
+ IX_FAIL);
+
+ IX_OSAL_LOCAL_ENSURE(callback,
+ "ixOsalSingleShotTimerSchedule(): NULL callback function pointer",
+ IX_FAIL);
+
+ *timer = kmalloc (sizeof (IxOsalTimerRec), GFP_KERNEL);
+ if (!(*timer))
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
+ IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalSingleShotTimerSchedule() Fail to allocate IxOsalTimer \n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ timerPtr = *timer;
+ timerPtr->inUse = TRUE;
+ init_timer(&timerPtr->timer);
+ timerPtr->timer.function = (voidFnULongPtr)callback;
+ timerPtr->timer.data = (unsigned long)param;
+ timerPtr->timer.expires = jiffies + \
+ ((period*HZ)/IX_OSAL_THOUSAND);
+ timerPtr->isRepeating = FALSE;
+ add_timer(&timerPtr->timer);
+
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief Cancels a running timer
+ *
+ * @param timer - handle of the timer object
+ *
+ * Cancels a single-shot or repeating timer.
+ *
+ * @li Reentrant: no
+ * @li IRQ safe: yes
+ *
+ * @return - IX_SUCCESS/IX_FAIL
+ */
+PUBLIC IX_STATUS ixOsalTimerCancel (IxOsalTimer * timer)
+{
+ IxOsalTimerRec *timerPtr;
+ IX_OSAL_LOCAL_ENSURE(timer,
+ "ixOsalTimerCancel(): Null IxOsalTimer pointer\n",
+ IX_FAIL);
+
+ timerPtr = *timer;
+ if(timerPtr->inUse == FALSE)
+ {
+ ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalTimerCancel(): Timer is already deleted\n",
+ 0, 0, 0, 0, 0, 0);
+ return IX_FAIL;
+ }
+
+ timerPtr->inUse = FALSE;
+ /* free & call del_timer in callback fn for repeat timer */
+ del_timer(&(timerPtr->timer));
+ kfree (*timer);
+
+ return IX_SUCCESS;
+}
+
+/**
+ * @ingroup IxOsal
+ *
+ * @brief displays all the running timers
+ *
+ * Displays a list with all the running timers and their parameters (handle,
+ * period, type, priority, callback and user parameter)
+ *
+ * @li Reentrant: no
+ * @li IRQ safe: no
+ *
+ * @return - none
+ */
+PUBLIC void ixOsalTimersShow (void)
+{
+ ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
+ "ixOsalTimersShow not Supported in linux native mode implemenattion\n",
+ 0, 0, 0, 0, 0, 0);
+
+ return ;
+}
+
+
diff --git a/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/component.mk b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/component.mk
new file mode 100644
index 0000000..d9d25b8
--- /dev/null
+++ b/Acceleration/library/icp_utils/OSAL/common/os/linux/src/core/component.mk
@@ -0,0 +1,85 @@
+#
+# @par
+# This file is provided under a dual BSD/GPLv2 license. When using or
+# redistributing this file, you may do so under either license.
+#
+# GPL LICENSE SUMMARY
+#
+# Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+# The full GNU General Public License is included in this distribution
+# in the file called LICENSE.GPL.
+#
+# Contact Information:
+# Intel Corporation
+#
+# BSD LICENSE
+#
+# Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+#
+
+core_os_OBJ := \
+ IxOsalOsThread.o \
+ IxOsalOsServices.o \
+ IxOsalOsSemaphore.o \
+ IxOsalOsSymbols.o \
+ IxOsalOsMsgQ.o \
+ IxOsalOsAtomic.o \
+ IxOsalOsMemBarrier.o
+
+ifneq (,$(findstring ENABLE_SPINLOCK,$(CFLAGS)))
+core_os_OBJ += IxOsalOsSpinLock.o
+endif
+
+ifneq (,$(findstring USE_NATIVE_OS_TIMER_API,$(CFLAGS)))
+core_os_OBJ += IxOsalOsTimer.o
+endif
+
+ifneq (,$(findstring IX_OSAL_MODULE,$(CFLAGS)))
+core_os_OBJ += IxOsalOsModule.o
+endif
+
+# Add CFLAGS per source file here if needed
+core_os_CFLAGS :=
+