3991274d812308605986dbb58b749e5b4a5233d8
[firefly-linux-kernel-4.4.55.git] / drivers / staging / csr / csr_framework_ext.h
1 #ifndef CSR_FRAMEWORK_EXT_H__
2 #define CSR_FRAMEWORK_EXT_H__
3 /*****************************************************************************
4
5             (c) Cambridge Silicon Radio Limited 2010
6             All rights reserved and confidential information of CSR
7
8             Refer to LICENSE.txt included with this source for details
9             on the license terms.
10
11 *****************************************************************************/
12
13 #include "csr_result.h"
14 #include "csr_framework_ext_types.h"
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /* Result codes */
21 #define CSR_FE_RESULT_NO_MORE_EVENTS    ((CsrResult) 0x0001)
22 #define CSR_FE_RESULT_INVALID_POINTER   ((CsrResult) 0x0002)
23 #define CSR_FE_RESULT_INVALID_HANDLE    ((CsrResult) 0x0003)
24 #define CSR_FE_RESULT_NO_MORE_MUTEXES   ((CsrResult) 0x0004)
25 #define CSR_FE_RESULT_TIMEOUT           ((CsrResult) 0x0005)
26 #define CSR_FE_RESULT_NO_MORE_THREADS   ((CsrResult) 0x0006)
27
28 /* Thread priorities */
29 #define CSR_THREAD_PRIORITY_HIGHEST     ((u16) 0)
30 #define CSR_THREAD_PRIORITY_HIGH        ((u16) 1)
31 #define CSR_THREAD_PRIORITY_NORMAL      ((u16) 2)
32 #define CSR_THREAD_PRIORITY_LOW         ((u16) 3)
33 #define CSR_THREAD_PRIORITY_LOWEST      ((u16) 4)
34
35 #define CSR_EVENT_WAIT_INFINITE         ((u16) 0xFFFF)
36
37 /*----------------------------------------------------------------------------*
38  *  NAME
39  *      CsrEventCreate
40  *
41  *  DESCRIPTION
42  *      Creates an event and returns a handle to the created event.
43  *
44  *  RETURNS
45  *      Possible values:
46  *          CSR_RESULT_SUCCESS          in case of success
47  *          CSR_FE_RESULT_NO_MORE_EVENTS   in case of out of event resources
48  *          CSR_FE_RESULT_INVALID_POINTER  in case the eventHandle pointer is invalid
49  *
50  *----------------------------------------------------------------------------*/
51 CsrResult CsrEventCreate(CsrEventHandle *eventHandle);
52
53 /*----------------------------------------------------------------------------*
54  *  NAME
55  *      CsrEventWait
56  *
57  *  DESCRIPTION
58  *      Wait fore one or more of the event bits to be set.
59  *
60  *  RETURNS
61  *      Possible values:
62  *          CSR_RESULT_SUCCESS              in case of success
63  *          CSR_FE_RESULT_TIMEOUT              in case of timeout
64  *          CSR_FE_RESULT_INVALID_HANDLE       in case the eventHandle is invalid
65  *          CSR_FE_RESULT_INVALID_POINTER      in case the eventBits pointer is invalid
66  *
67  *----------------------------------------------------------------------------*/
68 CsrResult CsrEventWait(CsrEventHandle *eventHandle, u16 timeoutInMs, u32 *eventBits);
69
70 /*----------------------------------------------------------------------------*
71  *  NAME
72  *      CsrEventSet
73  *
74  *  DESCRIPTION
75  *      Set an event.
76  *
77  *  RETURNS
78  *      Possible values:
79  *          CSR_RESULT_SUCCESS              in case of success
80  *          CSR_FE_RESULT_INVALID_HANDLE       in case the eventHandle is invalid
81  *
82  *----------------------------------------------------------------------------*/
83 CsrResult CsrEventSet(CsrEventHandle *eventHandle, u32 eventBits);
84
85 /*----------------------------------------------------------------------------*
86  *  NAME
87  *      CsrEventDestroy
88  *
89  *  DESCRIPTION
90  *      Destroy the event associated.
91  *
92  *  RETURNS
93  *      void
94  *
95  *----------------------------------------------------------------------------*/
96 void CsrEventDestroy(CsrEventHandle *eventHandle);
97
98 /*----------------------------------------------------------------------------*
99  *  NAME
100  *      CsrGlobalMutexUnlock
101  *
102  *  DESCRIPTION
103  *      Unlock the global mutex.
104  *
105  *----------------------------------------------------------------------------*/
106 void CsrGlobalMutexUnlock(void);
107
108 /*----------------------------------------------------------------------------*
109  *  NAME
110  *      CsrThreadSleep
111  *
112  *  DESCRIPTION
113  *      Sleep for a given period.
114  *
115  *  RETURNS
116  *      void
117  *
118  *----------------------------------------------------------------------------*/
119 void CsrThreadSleep(u16 sleepTimeInMs);
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif