]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/staging/csr/csr_wifi_vif_utils.h
Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[karo-tx-linux.git] / drivers / staging / csr / csr_wifi_vif_utils.h
1 /*****************************************************************************
2
3             (c) Cambridge Silicon Radio Limited 2011
4             All rights reserved and confidential information of CSR
5
6             Refer to LICENSE.txt included with this source for details
7             on the license terms.
8
9 *****************************************************************************/
10
11 #ifndef CSR_WIFI_VIF_UTILS_H
12 #define CSR_WIFI_VIF_UTILS_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* STANDARD INCLUDES ********************************************************/
19
20 /* PROJECT INCLUDES *********************************************************/
21 /* including this file for CsrWifiInterfaceMode*/
22 #include "csr_wifi_private_common.h"
23
24 /* MACROS *******************************************************************/
25
26 /* Common macros for NME and SME to be used temporarily until SoftMAC changes are made */
27 #define CSR_WIFI_NUM_INTERFACES        (u8)0x1
28 #define CSR_WIFI_INTERFACE_IN_USE      (u16)0x0
29
30 /* This is used at places where interface Id isn't available*/
31 #define CSR_WIFI_INTERFACE_ZERO        0
32 #define CSR_WIFI_INTERFACE_STA         0
33 #define CSR_WIFI_INTERFACE_AMP         0
34
35
36 #define CSR_WIFI_VIF_UTILS_UNDEFINED_TAG 0xFFFF
37
38 /* Extract the Interface Id from the event */
39 #define CsrWifiVifUtilsGetVifTagFromEvent(msg) \
40     ((u16) * ((u16 *) ((u8 *) (msg) + sizeof(CsrWifiFsmEvent))))
41
42 /* The HPI Vif combines the type and the interface id */
43 #define CsrWifiVifUtilsGetVifTagFromHipEvent(msg) \
44     ((msg)->virtualInterfaceIdentifier & 0x00FF)
45
46 #define CsrWifiVifUtilsPackHipEventVif(type, interfaceId) \
47     ((u16)((interfaceId) | ((type) << 8)))
48
49
50 /* TYPES DEFINITIONS ********************************************************/
51
52 /* GLOBAL VARIABLE DECLARATIONS *********************************************/
53
54 /* PUBLIC FUNCTION PROTOTYPES ***********************************************/
55
56 /**
57  * @brief
58  *     First checks if the mode is supported capability bitmap of the interface.
59  *     If this succeeds, then checks if running this mode on this interface is allowed.
60  *
61  * @param[in] u8 : interface capability bitmap
62  * @param[in] u8* : pointer to the array of current interface modes
63  * @param[in] u16 : interfaceTag
64  * @param[in] CsrWifiInterfaceMode : mode
65  *
66  * @return
67  *     u8 : returns true if the interface is allowed to operate in the mode otherwise false.
68  */
69 extern u8 CsrWifiVifUtilsCheckCompatibility(u8             interfaceCapability,
70                                                  u8            *currentInterfaceModes,
71                                                  u16            interfaceTag,
72                                                  CsrWifiInterfaceMode mode);
73
74 /**
75  * @brief
76  *     Checks if the specified interface is supported.
77  *     NOTE: Only checks that the interface is supported, no checks are made to
78  *     determine whether a supported interface may be made active.
79  *
80  * @param[in] u16 : interfaceTag
81  *
82  * @return
83  *     u8 : returns true if the interface is supported, otherwise false.
84  */
85 extern u8 CsrWifiVifUtilsIsSupported(u16 interfaceTag);
86
87 #ifdef CSR_LOG_ENABLE
88 /**
89  * @brief
90  *     Registers the virtual interface utils logging details.
91  *     Should only be called once at initialisation.
92  *
93  * @param[in/out] None
94  *
95  * @return
96  *     None
97  */
98 void CsrWifiVifUtilsLogTextRegister(void);
99 #else
100 #define CsrWifiVifUtilsLogTextRegister()
101 #endif
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #endif /* CSR_WIFI_VIF_UTILS_H */
108