summaryrefslogtreecommitdiff
path: root/drivers/staging/csr/csr_framework_ext.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-19 23:15:42 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-19 23:37:01 (GMT)
commit635d2b00e5070378e7bf812acf47fb135c6ab928 (patch)
tree7048a0a511f3d221aa2dfe40aa3a401991f1b175 /drivers/staging/csr/csr_framework_ext.h
parent15a4bc17b7f4e85cb019e683f14e834078ec2208 (diff)
downloadlinux-fsl-qoriq-635d2b00e5070378e7bf812acf47fb135c6ab928.tar.xz
Staging: add CSR wifi module
This consists of two modules, the driver, and a "helper" module that is just a wrapper around common kernel functions. The wrapper module will be removed soon, but for now it's needed. These files were based on the csr-linux-wifi-5.0.3-oss.tar.gz package provided by CSR and Blue Giga, and is covered under the license specified in the LICENSE.txt file (basically dual BSD and GPLv2). The files were flattened out of the deep directory mess they were originally in, and a few EXPORT_SYMBOL_GPL() were added in order for everything to link properly with the helper module setup. Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com> Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com> Cc: Riku Mettälä <riku.mettala@bluegiga.com> Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/csr/csr_framework_ext.h')
-rw-r--r--drivers/staging/csr/csr_framework_ext.h354
1 files changed, 354 insertions, 0 deletions
diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h
new file mode 100644
index 0000000..401bf2d
--- /dev/null
+++ b/drivers/staging/csr/csr_framework_ext.h
@@ -0,0 +1,354 @@
+#ifndef CSR_FRAMEWORK_EXT_H__
+#define CSR_FRAMEWORK_EXT_H__
+/*****************************************************************************
+
+ (c) Cambridge Silicon Radio Limited 2010
+ All rights reserved and confidential information of CSR
+
+ Refer to LICENSE.txt included with this source for details
+ on the license terms.
+
+*****************************************************************************/
+
+#include "csr_types.h"
+#include "csr_result.h"
+#include "csr_framework_ext_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Result codes */
+#define CSR_FE_RESULT_NO_MORE_EVENTS ((CsrResult) 0x0001)
+#define CSR_FE_RESULT_INVALID_POINTER ((CsrResult) 0x0002)
+#define CSR_FE_RESULT_INVALID_HANDLE ((CsrResult) 0x0003)
+#define CSR_FE_RESULT_NO_MORE_MUTEXES ((CsrResult) 0x0004)
+#define CSR_FE_RESULT_TIMEOUT ((CsrResult) 0x0005)
+#define CSR_FE_RESULT_NO_MORE_THREADS ((CsrResult) 0x0006)
+
+/* Thread priorities */
+#define CSR_THREAD_PRIORITY_HIGHEST ((CsrUint16) 0)
+#define CSR_THREAD_PRIORITY_HIGH ((CsrUint16) 1)
+#define CSR_THREAD_PRIORITY_NORMAL ((CsrUint16) 2)
+#define CSR_THREAD_PRIORITY_LOW ((CsrUint16) 3)
+#define CSR_THREAD_PRIORITY_LOWEST ((CsrUint16) 4)
+
+#define CSR_EVENT_WAIT_INFINITE ((CsrUint16) 0xFFFF)
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrEventCreate
+ *
+ * DESCRIPTION
+ * Creates an event and returns a handle to the created event.
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case of success
+ * CSR_FE_RESULT_NO_MORE_EVENTS in case of out of event resources
+ * CSR_FE_RESULT_INVALID_POINTER in case the eventHandle pointer is invalid
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrEventCreate(CsrEventHandle *eventHandle);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrEventWait
+ *
+ * DESCRIPTION
+ * Wait fore one or more of the event bits to be set.
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case of success
+ * CSR_FE_RESULT_TIMEOUT in case of timeout
+ * CSR_FE_RESULT_INVALID_HANDLE in case the eventHandle is invalid
+ * CSR_FE_RESULT_INVALID_POINTER in case the eventBits pointer is invalid
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrEventWait(CsrEventHandle *eventHandle, CsrUint16 timeoutInMs, CsrUint32 *eventBits);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrEventSet
+ *
+ * DESCRIPTION
+ * Set an event.
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case of success
+ * CSR_FE_RESULT_INVALID_HANDLE in case the eventHandle is invalid
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrEventSet(CsrEventHandle *eventHandle, CsrUint32 eventBits);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrEventDestroy
+ *
+ * DESCRIPTION
+ * Destroy the event associated.
+ *
+ * RETURNS
+ * void
+ *
+ *----------------------------------------------------------------------------*/
+void CsrEventDestroy(CsrEventHandle *eventHandle);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMutexCreate
+ *
+ * DESCRIPTION
+ * Create a mutex and return a handle to the created mutex.
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case of success
+ * CSR_FE_RESULT_NO_MORE_MUTEXES in case of out of mutex resources
+ * CSR_FE_RESULT_INVALID_POINTER in case the mutexHandle pointer is invalid
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrMutexCreate(CsrMutexHandle *mutexHandle);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMutexLock
+ *
+ * DESCRIPTION
+ * Lock the mutex refered to by the provided handle.
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case of success
+ * CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrMutexLock(CsrMutexHandle *mutexHandle);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMutexUnlock
+ *
+ * DESCRIPTION
+ * Unlock the mutex refered to by the provided handle.
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case of success
+ * CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrMutexUnlock(CsrMutexHandle *mutexHandle);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMutexDestroy
+ *
+ * DESCRIPTION
+ * Destroy the previously created mutex.
+ *
+ * RETURNS
+ * void
+ *
+ *----------------------------------------------------------------------------*/
+void CsrMutexDestroy(CsrMutexHandle *mutexHandle);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrGlobalMutexLock
+ *
+ * DESCRIPTION
+ * Lock the global mutex. The global mutex is a single pre-initialised
+ * shared mutex, spinlock or similar that does not need to be created prior
+ * to use. The limitation is that there is only one single lock shared
+ * between all code. Consequently, it must only be used very briefly to
+ * either protect simple one-time initialisation or to protect the creation
+ * of a dedicated mutex by calling CsrMutexCreate.
+ *
+ *----------------------------------------------------------------------------*/
+void CsrGlobalMutexLock(void);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrGlobalMutexUnlock
+ *
+ * DESCRIPTION
+ * Unlock the global mutex.
+ *
+ *----------------------------------------------------------------------------*/
+void CsrGlobalMutexUnlock(void);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrThreadCreate
+ *
+ * DESCRIPTION
+ * Create thread function and return a handle to the created thread.
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case of success
+ * CSR_FE_RESULT_NO_MORE_THREADS in case of out of thread resources
+ * CSR_FE_RESULT_INVALID_POINTER in case one of the supplied pointers is invalid
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrThreadCreate(void (*threadFunction)(void *pointer), void *pointer,
+ CsrUint32 stackSize, CsrUint16 priority,
+ const CsrCharString *threadName, CsrThreadHandle *threadHandle);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrThreadGetHandle
+ *
+ * DESCRIPTION
+ * Return thread handle of calling thread.
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case of success
+ * CSR_FE_RESULT_INVALID_POINTER in case the threadHandle pointer is invalid
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrThreadGetHandle(CsrThreadHandle *threadHandle);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrThreadEqual
+ *
+ * DESCRIPTION
+ * Compare thread handles
+ *
+ * RETURNS
+ * Possible values:
+ * CSR_RESULT_SUCCESS in case thread handles are identical
+ * CSR_FE_RESULT_INVALID_POINTER in case either threadHandle pointer is invalid
+ * CSR_RESULT_FAILURE otherwise
+ *
+ *----------------------------------------------------------------------------*/
+CsrResult CsrThreadEqual(CsrThreadHandle *threadHandle1, CsrThreadHandle *threadHandle2);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrThreadSleep
+ *
+ * DESCRIPTION
+ * Sleep for a given period.
+ *
+ * RETURNS
+ * void
+ *
+ *----------------------------------------------------------------------------*/
+void CsrThreadSleep(CsrUint16 sleepTimeInMs);
+
+#ifndef CSR_PMEM_DEBUG_ENABLE
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMemAlloc
+ *
+ * DESCRIPTION
+ * Allocate dynamic memory of a given size.
+ *
+ * RETURNS
+ * Pointer to allocated memory, or NULL in case of failure.
+ * Allocated memory is not initialised.
+ *
+ *----------------------------------------------------------------------------*/
+#ifdef CSR_MEM_DEBUG
+void *CsrMemAllocDebug(CsrSize size,
+ const CsrCharString *file, CsrUint32 line);
+#define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__)
+#else
+void *CsrMemAlloc(CsrSize size);
+#endif
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMemCalloc
+ *
+ * DESCRIPTION
+ * Allocate dynamic memory of a given size calculated as the
+ * numberOfElements times the elementSize.
+ *
+ * RETURNS
+ * Pointer to allocated memory, or NULL in case of failure.
+ * Allocated memory is zero initialised.
+ *
+ *----------------------------------------------------------------------------*/
+#ifdef CSR_MEM_DEBUG
+void *CsrMemCallocDebug(CsrSize numberOfElements, CsrSize elementSize,
+ const CsrCharString *file, CsrUint32 line);
+#define CsrMemCalloc(cnt, sz) CsrMemAllocDebug((cnt), (sz), __FILE__, __LINE__)
+#else
+void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize);
+#endif
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMemFree
+ *
+ * DESCRIPTION
+ * Free dynamic allocated memory.
+ *
+ * RETURNS
+ * void
+ *
+ *----------------------------------------------------------------------------*/
+void CsrMemFree(void *pointer);
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMemAllocDma
+ *
+ * DESCRIPTION
+ * Allocate dynamic memory suitable for DMA transfers.
+ *
+ * RETURNS
+ * Pointer to allocated memory, or NULL in case of failure.
+ * Allocated memory is not initialised.
+ *
+ *----------------------------------------------------------------------------*/
+#ifdef CSR_MEM_DEBUG
+void *CsrMemAllocDmaDebug(CsrSize size,
+ const CsrCharString *file, CsrUint32 line);
+#define CsrMemAllocDma(sz) CsrMemAllocDmaDebug((sz), __FILE__, __LINE__)
+#else
+void *CsrMemAllocDma(CsrSize size);
+#endif
+
+
+/*----------------------------------------------------------------------------*
+ * NAME
+ * CsrMemFreeDma
+ *
+ * DESCRIPTION
+ * Free dynamic memory allocated by CsrMemAllocDma.
+ *
+ * RETURNS
+ * void
+ *
+ *----------------------------------------------------------------------------*/
+void CsrMemFreeDma(void *pointer);
+#else
+
+#include "csr_pmem.h"
+
+#define CsrMemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__)
+
+#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__)
+
+#define CsrMemFree(ptr) CsrPmemDebugFree(ptr,CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__)
+
+#define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__)
+
+#define CsrMemFreeDma(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__)
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif