04b7c31342c86932b3c23eec6ad57a8653dc03ab
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / staging / csr / csr_wifi_nme_lib.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 /* Note: this is an auto-generated file. */
12
13 #ifndef CSR_WIFI_NME_LIB_H__
14 #define CSR_WIFI_NME_LIB_H__
15
16 #include "csr_pmem.h"
17 #include "csr_sched.h"
18 #include "csr_macro.h"
19 #include "csr_msg_transport.h"
20
21 #include "csr_wifi_lib.h"
22
23 #include "csr_wifi_nme_prim.h"
24 #include "csr_wifi_nme_task.h"
25
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #ifndef CSR_WIFI_NME_ENABLE
32 #error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_lib.h
33 #endif
34
35 /*----------------------------------------------------------------------------*
36  *  CsrWifiNmeFreeUpstreamMessageContents
37  *
38  *  DESCRIPTION
39  *      Free the allocated memory in a CSR_WIFI_NME upstream message. Does not
40  *      free the message itself, and can only be used for upstream messages.
41  *
42  *  PARAMETERS
43  *      Deallocates the resources in a CSR_WIFI_NME upstream message
44  *----------------------------------------------------------------------------*/
45 void CsrWifiNmeFreeUpstreamMessageContents(u16 eventClass, void *message);
46
47 /*----------------------------------------------------------------------------*
48  *  CsrWifiNmeFreeDownstreamMessageContents
49  *
50  *  DESCRIPTION
51  *      Free the allocated memory in a CSR_WIFI_NME downstream message. Does not
52  *      free the message itself, and can only be used for downstream messages.
53  *
54  *  PARAMETERS
55  *      Deallocates the resources in a CSR_WIFI_NME downstream message
56  *----------------------------------------------------------------------------*/
57 void CsrWifiNmeFreeDownstreamMessageContents(u16 eventClass, void *message);
58
59 /*----------------------------------------------------------------------------*
60  * Enum to string functions
61  *----------------------------------------------------------------------------*/
62 const char* CsrWifiNmeAuthModeToString(CsrWifiNmeAuthMode value);
63 const char* CsrWifiNmeBssTypeToString(CsrWifiNmeBssType value);
64 const char* CsrWifiNmeCcxOptionsMaskToString(CsrWifiNmeCcxOptionsMask value);
65 const char* CsrWifiNmeConfigActionToString(CsrWifiNmeConfigAction value);
66 const char* CsrWifiNmeConnectionStatusToString(CsrWifiNmeConnectionStatus value);
67 const char* CsrWifiNmeCredentialTypeToString(CsrWifiNmeCredentialType value);
68 const char* CsrWifiNmeEapMethodToString(CsrWifiNmeEapMethod value);
69 const char* CsrWifiNmeEncryptionToString(CsrWifiNmeEncryption value);
70 const char* CsrWifiNmeIndicationsToString(CsrWifiNmeIndications value);
71 const char* CsrWifiNmeSecErrorToString(CsrWifiNmeSecError value);
72 const char* CsrWifiNmeSimCardTypeToString(CsrWifiNmeSimCardType value);
73 const char* CsrWifiNmeUmtsAuthResultToString(CsrWifiNmeUmtsAuthResult value);
74 const char* CsrWifiNmeWmmQosInfoToString(CsrWifiNmeWmmQosInfo value);
75
76
77 /*----------------------------------------------------------------------------*
78  * CsrPrim Type toString function.
79  * Converts a message type to the String name of the Message
80  *----------------------------------------------------------------------------*/
81 const char* CsrWifiNmePrimTypeToString(CsrPrim msgType);
82
83 /*----------------------------------------------------------------------------*
84  * Lookup arrays for PrimType name Strings
85  *----------------------------------------------------------------------------*/
86 extern const char *CsrWifiNmeUpstreamPrimNames[CSR_WIFI_NME_PRIM_UPSTREAM_COUNT];
87 extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_COUNT];
88
89 /*******************************************************************************
90
91   NAME
92     CsrWifiNmeConnectionStatusGetReqSend
93
94   DESCRIPTION
95     Requests the current connection status of the NME.
96
97   PARAMETERS
98     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
99     interfaceTag - Interface Identifier; unique identifier of an interface
100
101 *******************************************************************************/
102 #define CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__) \
103     msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetReq), GFP_KERNEL); \
104     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ, dst__, src__); \
105     msg__->interfaceTag = (interfaceTag__);
106
107 #define CsrWifiNmeConnectionStatusGetReqSendTo(dst__, src__, interfaceTag__) \
108     { \
109         CsrWifiNmeConnectionStatusGetReq *msg__; \
110         CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__); \
111         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
112     }
113
114 #define CsrWifiNmeConnectionStatusGetReqSend(src__, interfaceTag__) \
115     CsrWifiNmeConnectionStatusGetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
116
117 /*******************************************************************************
118
119   NAME
120     CsrWifiNmeConnectionStatusGetCfmSend
121
122   DESCRIPTION
123     Reports the connection status of the NME.
124
125   PARAMETERS
126     queue            - Destination Task Queue
127     interfaceTag     - Interface Identifier; unique identifier of an interface
128     status           - Indicates the success or otherwise of the requested
129                        operation.
130     connectionStatus - NME current connection status
131
132 *******************************************************************************/
133 #define CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__) \
134     msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetCfm), GFP_KERNEL); \
135     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM, dst__, src__); \
136     msg__->interfaceTag = (interfaceTag__); \
137     msg__->status = (status__); \
138     msg__->connectionStatus = (connectionStatus__);
139
140 #define CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStatus__) \
141     { \
142         CsrWifiNmeConnectionStatusGetCfm *msg__; \
143         CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__); \
144         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
145     }
146
147 #define CsrWifiNmeConnectionStatusGetCfmSend(dst__, interfaceTag__, status__, connectionStatus__) \
148     CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectionStatus__)
149
150 /*******************************************************************************
151
152   NAME
153     CsrWifiNmeEventMaskSetReqSend
154
155   DESCRIPTION
156     The wireless manager application may register with the NME to receive
157     notification of interesting events. Indications will be sent only if the
158     wireless manager explicitly registers to be notified of that event.
159     indMask is a bit mask of values defined in CsrWifiNmeIndicationsMask.
160
161   PARAMETERS
162     queue   - Message Source Task Queue (Cfm's will be sent to this Queue)
163     indMask - Set mask with values from CsrWifiNmeIndications
164
165 *******************************************************************************/
166 #define CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \
167     msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetReq), GFP_KERNEL); \
168     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_REQ, dst__, src__); \
169     msg__->indMask = (indMask__);
170
171 #define CsrWifiNmeEventMaskSetReqSendTo(dst__, src__, indMask__) \
172     { \
173         CsrWifiNmeEventMaskSetReq *msg__; \
174         CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \
175         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
176     }
177
178 #define CsrWifiNmeEventMaskSetReqSend(src__, indMask__) \
179     CsrWifiNmeEventMaskSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, indMask__)
180
181 /*******************************************************************************
182
183   NAME
184     CsrWifiNmeEventMaskSetCfmSend
185
186   DESCRIPTION
187     The NME calls the primitive to report the result of the request
188     primitive.
189
190   PARAMETERS
191     queue  - Destination Task Queue
192     status - Reports the result of the request
193
194 *******************************************************************************/
195 #define CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \
196     msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetCfm), GFP_KERNEL); \
197     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_CFM, dst__, src__); \
198     msg__->status = (status__);
199
200 #define CsrWifiNmeEventMaskSetCfmSendTo(dst__, src__, status__) \
201     { \
202         CsrWifiNmeEventMaskSetCfm *msg__; \
203         CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \
204         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
205     }
206
207 #define CsrWifiNmeEventMaskSetCfmSend(dst__, status__) \
208     CsrWifiNmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
209
210 /*******************************************************************************
211
212   NAME
213     CsrWifiNmeProfileConnectReqSend
214
215   DESCRIPTION
216     Requests the NME to attempt to connect to the specified profile.
217     Overrides any current connection attempt.
218
219   PARAMETERS
220     queue           - Message Source Task Queue (Cfm's will be sent to this Queue)
221     interfaceTag    - Interface Identifier; unique identifier of an interface
222     profileIdentity - Identity (BSSID, SSID) of profile to be connected to.
223                       It must match an existing profile in the NME.
224
225 *******************************************************************************/
226 #define CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__) \
227     msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectReq), GFP_KERNEL); \
228     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_REQ, dst__, src__); \
229     msg__->interfaceTag = (interfaceTag__); \
230     msg__->profileIdentity = (profileIdentity__);
231
232 #define CsrWifiNmeProfileConnectReqSendTo(dst__, src__, interfaceTag__, profileIdentity__) \
233     { \
234         CsrWifiNmeProfileConnectReq *msg__; \
235         CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__); \
236         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
237     }
238
239 #define CsrWifiNmeProfileConnectReqSend(src__, interfaceTag__, profileIdentity__) \
240     CsrWifiNmeProfileConnectReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentity__)
241
242 /*******************************************************************************
243
244   NAME
245     CsrWifiNmeProfileConnectCfmSend
246
247   DESCRIPTION
248     Reports the status of the NME PROFILE CONNECT REQ. If unsuccessful the
249     connectAttempt parameters contain details of the APs that the NME
250     attempted to connect to before reporting the failure of the request.
251
252   PARAMETERS
253     queue                - Destination Task Queue
254     interfaceTag         - Interface Identifier; unique identifier of an
255                            interface
256     status               - Indicates the success or otherwise of the requested
257                            operation.
258     connectAttemptsCount - This parameter is relevant only if
259                            status!=CSR_WIFI_NME_STATUS_SUCCESS.
260                            Number of connection attempt elements provided with
261                            this primitive
262     connectAttempts      - This parameter is relevant only if
263                            status!=CSR_WIFI_NME_STATUS_SUCCESS.
264                            Points to the list of connection attempt elements
265                            provided with this primitive
266                            Each element of the list provides information about
267                            an AP on which the connection attempt was made and
268                            the error that occurred during the attempt.
269
270 *******************************************************************************/
271 #define CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
272     msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectCfm), GFP_KERNEL); \
273     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_CFM, dst__, src__); \
274     msg__->interfaceTag = (interfaceTag__); \
275     msg__->status = (status__); \
276     msg__->connectAttemptsCount = (connectAttemptsCount__); \
277     msg__->connectAttempts = (connectAttempts__);
278
279 #define CsrWifiNmeProfileConnectCfmSendTo(dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
280     { \
281         CsrWifiNmeProfileConnectCfm *msg__; \
282         CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__); \
283         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
284     }
285
286 #define CsrWifiNmeProfileConnectCfmSend(dst__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
287     CsrWifiNmeProfileConnectCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__)
288
289 /*******************************************************************************
290
291   NAME
292     CsrWifiNmeProfileDeleteAllReqSend
293
294   DESCRIPTION
295     Deletes all profiles present in the NME, but does NOT modify the
296     preferred profile list.
297
298   PARAMETERS
299     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
300
301 *******************************************************************************/
302 #define CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__) \
303     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllReq), GFP_KERNEL); \
304     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ, dst__, src__);
305
306 #define CsrWifiNmeProfileDeleteAllReqSendTo(dst__, src__) \
307     { \
308         CsrWifiNmeProfileDeleteAllReq *msg__; \
309         CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__); \
310         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
311     }
312
313 #define CsrWifiNmeProfileDeleteAllReqSend(src__) \
314     CsrWifiNmeProfileDeleteAllReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__)
315
316 /*******************************************************************************
317
318   NAME
319     CsrWifiNmeProfileDeleteAllCfmSend
320
321   DESCRIPTION
322     Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ.
323     Returns always CSR_WIFI_NME_STATUS_SUCCESS.
324
325   PARAMETERS
326     queue  - Destination Task Queue
327     status - Indicates the success or otherwise of the requested operation, but
328              in this case it always set to success.
329
330 *******************************************************************************/
331 #define CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__) \
332     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllCfm), GFP_KERNEL); \
333     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM, dst__, src__); \
334     msg__->status = (status__);
335
336 #define CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, src__, status__) \
337     { \
338         CsrWifiNmeProfileDeleteAllCfm *msg__; \
339         CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__); \
340         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
341     }
342
343 #define CsrWifiNmeProfileDeleteAllCfmSend(dst__, status__) \
344     CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
345
346 /*******************************************************************************
347
348   NAME
349     CsrWifiNmeProfileDeleteReqSend
350
351   DESCRIPTION
352     Will delete the profile with a matching identity, but does NOT modify the
353     preferred profile list.
354
355   PARAMETERS
356     queue           - Message Source Task Queue (Cfm's will be sent to this Queue)
357     profileIdentity - Identity (BSSID, SSID) of profile to be deleted.
358
359 *******************************************************************************/
360 #define CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__) \
361     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteReq), GFP_KERNEL); \
362     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_REQ, dst__, src__); \
363     msg__->profileIdentity = (profileIdentity__);
364
365 #define CsrWifiNmeProfileDeleteReqSendTo(dst__, src__, profileIdentity__) \
366     { \
367         CsrWifiNmeProfileDeleteReq *msg__; \
368         CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__); \
369         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
370     }
371
372 #define CsrWifiNmeProfileDeleteReqSend(src__, profileIdentity__) \
373     CsrWifiNmeProfileDeleteReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profileIdentity__)
374
375 /*******************************************************************************
376
377   NAME
378     CsrWifiNmeProfileDeleteCfmSend
379
380   DESCRIPTION
381     Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_REQ.
382     Returns CSR_WIFI_NME_STATUS_NOT_FOUND if there is no matching profile.
383
384   PARAMETERS
385     queue  - Destination Task Queue
386     status - Indicates the success or otherwise of the requested operation.
387
388 *******************************************************************************/
389 #define CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__) \
390     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteCfm), GFP_KERNEL); \
391     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_CFM, dst__, src__); \
392     msg__->status = (status__);
393
394 #define CsrWifiNmeProfileDeleteCfmSendTo(dst__, src__, status__) \
395     { \
396         CsrWifiNmeProfileDeleteCfm *msg__; \
397         CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__); \
398         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
399     }
400
401 #define CsrWifiNmeProfileDeleteCfmSend(dst__, status__) \
402     CsrWifiNmeProfileDeleteCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
403
404 /*******************************************************************************
405
406   NAME
407     CsrWifiNmeProfileDisconnectIndSend
408
409   DESCRIPTION
410     Indication generated from the NME (if an application subscribes to
411     receive it) that informs that application that the current profile
412     connection has disconnected. The indication will contain information
413     about APs that it attempted to maintain the connection via i.e. in the
414     case of failed roaming.
415
416   PARAMETERS
417     queue                - Destination Task Queue
418     interfaceTag         - Interface Identifier; unique identifier of an
419                            interface
420     connectAttemptsCount - Number of connection attempt elements provided with
421                            this primitive
422     connectAttempts      - Points to the list of connection attempt elements
423                            provided with this primitive
424                            Each element of the list provides information about
425                            an AP on which the connection attempt was made and
426                            the error occurred during the attempt.
427
428 *******************************************************************************/
429 #define CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
430     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDisconnectInd), GFP_KERNEL); \
431     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DISCONNECT_IND, dst__, src__); \
432     msg__->interfaceTag = (interfaceTag__); \
433     msg__->connectAttemptsCount = (connectAttemptsCount__); \
434     msg__->connectAttempts = (connectAttempts__);
435
436 #define CsrWifiNmeProfileDisconnectIndSendTo(dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
437     { \
438         CsrWifiNmeProfileDisconnectInd *msg__; \
439         CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__); \
440         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
441     }
442
443 #define CsrWifiNmeProfileDisconnectIndSend(dst__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
444     CsrWifiNmeProfileDisconnectIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, connectAttemptsCount__, connectAttempts__)
445
446 /*******************************************************************************
447
448   NAME
449     CsrWifiNmeProfileOrderSetReqSend
450
451   DESCRIPTION
452     Defines the preferred order that profiles present in the NME should be
453     used during the NME auto-connect behaviour.
454     If profileIdentitysCount == 0, it removes any existing preferred profile
455     list already present in the NME, effectively disabling the auto-connect
456     behaviour.
457     NOTE: Profile identities that do not match any profile stored in the NME
458     are ignored during the auto-connect procedure.
459     NOTE: during auto-connect the NME will only attempt to join an existing
460     adhoc network and it will never attempt to host an adhoc network; for
461     hosting and adhoc network, use CSR_WIFI_NME_PROFILE_CONNECT_REQ
462
463   PARAMETERS
464     queue                 - Message Source Task Queue (Cfm's will be sent to this Queue)
465     interfaceTag          - Interface Identifier; unique identifier of an
466                             interface
467     profileIdentitysCount - The number of profiles identities in the list.
468     profileIdentitys      - Points to the list of profile identities.
469
470 *******************************************************************************/
471 #define CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
472     msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetReq), GFP_KERNEL); \
473     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_REQ, dst__, src__); \
474     msg__->interfaceTag = (interfaceTag__); \
475     msg__->profileIdentitysCount = (profileIdentitysCount__); \
476     msg__->profileIdentitys = (profileIdentitys__);
477
478 #define CsrWifiNmeProfileOrderSetReqSendTo(dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
479     { \
480         CsrWifiNmeProfileOrderSetReq *msg__; \
481         CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__); \
482         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
483     }
484
485 #define CsrWifiNmeProfileOrderSetReqSend(src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
486     CsrWifiNmeProfileOrderSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__)
487
488 /*******************************************************************************
489
490   NAME
491     CsrWifiNmeProfileOrderSetCfmSend
492
493   DESCRIPTION
494     Confirmation to UNIFI_NME_PROFILE_ORDER_SET.request.
495
496   PARAMETERS
497     queue        - Destination Task Queue
498     interfaceTag - Interface Identifier; unique identifier of an interface
499     status       - Indicates the success or otherwise of the requested
500                    operation.
501
502 *******************************************************************************/
503 #define CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
504     msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetCfm), GFP_KERNEL); \
505     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_CFM, dst__, src__); \
506     msg__->interfaceTag = (interfaceTag__); \
507     msg__->status = (status__);
508
509 #define CsrWifiNmeProfileOrderSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
510     { \
511         CsrWifiNmeProfileOrderSetCfm *msg__; \
512         CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
513         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
514     }
515
516 #define CsrWifiNmeProfileOrderSetCfmSend(dst__, interfaceTag__, status__) \
517     CsrWifiNmeProfileOrderSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
518
519 /*******************************************************************************
520
521   NAME
522     CsrWifiNmeProfileSetReqSend
523
524   DESCRIPTION
525     Creates or updates an existing profile in the NME that matches the unique
526     identity of the profile. Each profile is identified by the combination of
527     BSSID and SSID. The profile contains all the required credentials for
528     attempting to connect to the network. Creating or updating a profile via
529     the NME PROFILE SET REQ does NOT add the profile to the preferred profile
530     list within the NME used for the NME auto-connect behaviour.
531
532   PARAMETERS
533     queue   - Message Source Task Queue (Cfm's will be sent to this Queue)
534     profile - Specifies the identity and credentials of the network.
535
536 *******************************************************************************/
537 #define CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__) \
538     msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetReq), GFP_KERNEL); \
539     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_REQ, dst__, src__); \
540     msg__->profile = (profile__);
541
542 #define CsrWifiNmeProfileSetReqSendTo(dst__, src__, profile__) \
543     { \
544         CsrWifiNmeProfileSetReq *msg__; \
545         CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__); \
546         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
547     }
548
549 #define CsrWifiNmeProfileSetReqSend(src__, profile__) \
550     CsrWifiNmeProfileSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profile__)
551
552 /*******************************************************************************
553
554   NAME
555     CsrWifiNmeProfileSetCfmSend
556
557   DESCRIPTION
558     Reports the status of the NME PROFILE SET REQ; the request will only fail
559     if the details specified in the profile contains an invalid combination
560     of parameters for example specifying the profile as cloaked but not
561     specifying the SSID. The NME doesn't limit the number of profiles that
562     may be created. The NME assumes that the entity configuring it is aware
563     of the appropriate limits.
564
565   PARAMETERS
566     queue  - Destination Task Queue
567     status - Indicates the success or otherwise of the requested operation.
568
569 *******************************************************************************/
570 #define CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__) \
571     msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetCfm), GFP_KERNEL); \
572     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_CFM, dst__, src__); \
573     msg__->status = (status__);
574
575 #define CsrWifiNmeProfileSetCfmSendTo(dst__, src__, status__) \
576     { \
577         CsrWifiNmeProfileSetCfm *msg__; \
578         CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__); \
579         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
580     }
581
582 #define CsrWifiNmeProfileSetCfmSend(dst__, status__) \
583     CsrWifiNmeProfileSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
584
585 /*******************************************************************************
586
587   NAME
588     CsrWifiNmeProfileUpdateIndSend
589
590   DESCRIPTION
591     Indication generated from the NME (if an application subscribes to
592     receive it) that informs that application that the contained profile has
593     changed.
594     For example, either the credentials EAP-FAST PAC file or the session data
595     within the profile has changed.
596     It is up to the application whether it stores this updated profile or
597     not.
598
599   PARAMETERS
600     queue        - Destination Task Queue
601     interfaceTag - Interface Identifier; unique identifier of an interface
602     profile      - The identity and credentials of the network.
603
604 *******************************************************************************/
605 #define CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__) \
606     msg__ = kmalloc(sizeof(CsrWifiNmeProfileUpdateInd), GFP_KERNEL); \
607     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_UPDATE_IND, dst__, src__); \
608     msg__->interfaceTag = (interfaceTag__); \
609     msg__->profile = (profile__);
610
611 #define CsrWifiNmeProfileUpdateIndSendTo(dst__, src__, interfaceTag__, profile__) \
612     { \
613         CsrWifiNmeProfileUpdateInd *msg__; \
614         CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__); \
615         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
616     }
617
618 #define CsrWifiNmeProfileUpdateIndSend(dst__, interfaceTag__, profile__) \
619     CsrWifiNmeProfileUpdateIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, profile__)
620
621 /*******************************************************************************
622
623   NAME
624     CsrWifiNmeSimGsmAuthIndSend
625
626   DESCRIPTION
627     Indication generated from the NME (if an application subscribes to
628     receive it) that requests the UICC Manager to perform a GSM
629     authentication on behalf of the NME. This indication is generated when
630     the NME is attempting to connect to a profile configured for EAP-SIM. An
631     application MUST register to receive this indication for the NME to
632     support the EAP-SIM credential types. Otherwise the NME has no route to
633     obtain the information from the UICC. EAP-SIM authentication requires 2
634     or 3 GSM authentication rounds and therefore 2 or 3 RANDS (GSM Random
635     Challenges) are included.
636
637   PARAMETERS
638     queue       - Destination Task Queue
639     randsLength - GSM RAND is 16 bytes long hence valid values are 32 (2 RANDS)
640                   or 48 (3 RANDs).
641     rands       - 2 or 3 RANDs values.
642
643 *******************************************************************************/
644 #define CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__) \
645     msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthInd), GFP_KERNEL); \
646     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_IND, dst__, src__); \
647     msg__->randsLength = (randsLength__); \
648     msg__->rands = (rands__);
649
650 #define CsrWifiNmeSimGsmAuthIndSendTo(dst__, src__, randsLength__, rands__) \
651     { \
652         CsrWifiNmeSimGsmAuthInd *msg__; \
653         CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__); \
654         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
655     }
656
657 #define CsrWifiNmeSimGsmAuthIndSend(dst__, randsLength__, rands__) \
658     CsrWifiNmeSimGsmAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, randsLength__, rands__)
659
660 /*******************************************************************************
661
662   NAME
663     CsrWifiNmeSimGsmAuthResSend
664
665   DESCRIPTION
666     Response from the application that received the NME SIM GSM AUTH IND. For
667     each GSM authentication round a GSM Ciphering key (Kc) and a signed
668     response (SRES) are produced. Since 2 or 3 GSM authentication rounds are
669     used the 2 or 3 Kc's obtained respectively are combined into one buffer
670     and similarly the 2 or 3 SRES's obtained are combined into another
671     buffer. The order of Kc values (SRES values respectively) in their buffer
672     is the same as that of their corresponding RAND values in the incoming
673     indication.
674
675   PARAMETERS
676     status     - Indicates the outcome of the requested operation:
677                  STATUS_SUCCESS or STATUS_ERROR
678     kcsLength  - Length in Bytes of Kc buffer. Legal values are: 16 or 24.
679     kcs        - Kc buffer holding 2 or 3 Kc values.
680     sresLength - Length in Bytes of SRES buffer. Legal values are: 8 or 12.
681     sres       - SRES buffer holding 2 or 3 SRES values.
682
683 *******************************************************************************/
684 #define CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
685     msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthRes), GFP_KERNEL); \
686     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_RES, dst__, src__); \
687     msg__->status = (status__); \
688     msg__->kcsLength = (kcsLength__); \
689     msg__->kcs = (kcs__); \
690     msg__->sresLength = (sresLength__); \
691     msg__->sres = (sres__);
692
693 #define CsrWifiNmeSimGsmAuthResSendTo(dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
694     { \
695         CsrWifiNmeSimGsmAuthRes *msg__; \
696         CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__); \
697         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
698     }
699
700 #define CsrWifiNmeSimGsmAuthResSend(src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
701     CsrWifiNmeSimGsmAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, kcsLength__, kcs__, sresLength__, sres__)
702
703 /*******************************************************************************
704
705   NAME
706     CsrWifiNmeSimImsiGetIndSend
707
708   DESCRIPTION
709     Indication generated from the NME (if an application subscribes to
710     receive it) that requests the IMSI and UICC type from the UICC Manager.
711     This indication is generated when the NME is attempting to connect to a
712     profile configured for EAP-SIM/AKA. An application MUST register to
713     receive this indication for the NME to support the EAP-SIM/AKA credential
714     types. Otherwise the NME has no route to obtain the information from the
715     UICC.
716
717   PARAMETERS
718     queue  - Destination Task Queue
719
720 *******************************************************************************/
721 #define CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__) \
722     msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetInd), GFP_KERNEL); \
723     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_IND, dst__, src__);
724
725 #define CsrWifiNmeSimImsiGetIndSendTo(dst__, src__) \
726     { \
727         CsrWifiNmeSimImsiGetInd *msg__; \
728         CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__); \
729         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
730     }
731
732 #define CsrWifiNmeSimImsiGetIndSend(dst__) \
733     CsrWifiNmeSimImsiGetIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE)
734
735 /*******************************************************************************
736
737   NAME
738     CsrWifiNmeSimImsiGetResSend
739
740   DESCRIPTION
741     Response from the application that received the NME SIM IMSI GET IND.
742
743   PARAMETERS
744     status   - Indicates the outcome of the requested operation: STATUS_SUCCESS
745                or STATUS_ERROR.
746     imsi     - The value of the IMSI obtained from the UICC.
747     cardType - The UICC type (GSM only (SIM), UMTS only (USIM), Both).
748
749 *******************************************************************************/
750 #define CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__) \
751     msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetRes), GFP_KERNEL); \
752     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_RES, dst__, src__); \
753     msg__->status = (status__); \
754     msg__->imsi = (imsi__); \
755     msg__->cardType = (cardType__);
756
757 #define CsrWifiNmeSimImsiGetResSendTo(dst__, src__, status__, imsi__, cardType__) \
758     { \
759         CsrWifiNmeSimImsiGetRes *msg__; \
760         CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__); \
761         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
762     }
763
764 #define CsrWifiNmeSimImsiGetResSend(src__, status__, imsi__, cardType__) \
765     CsrWifiNmeSimImsiGetResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, imsi__, cardType__)
766
767 /*******************************************************************************
768
769   NAME
770     CsrWifiNmeSimUmtsAuthIndSend
771
772   DESCRIPTION
773     Indication generated from the NME (if an application subscribes to
774     receive it) that requests the UICC Manager to perform a UMTS
775     authentication on behalf of the NME. This indication is generated when
776     the NME is attempting to connect to a profile configured for EAP-AKA. An
777     application MUST register to receive this indication for the NME to
778     support the EAP-AKA credential types. Otherwise the NME has no route to
779     obtain the information from the USIM. EAP-AKA requires one UMTS
780     authentication round and therefore only one RAND and one AUTN values are
781     included.
782
783   PARAMETERS
784     queue  - Destination Task Queue
785     rand   - UMTS RAND value.
786     autn   - UMTS AUTN value.
787
788 *******************************************************************************/
789 #define CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__) \
790     msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthInd), GFP_KERNEL); \
791     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_IND, dst__, src__); \
792     memcpy(msg__->rand, (rand__), sizeof(u8) * 16); \
793     memcpy(msg__->autn, (autn__), sizeof(u8) * 16);
794
795 #define CsrWifiNmeSimUmtsAuthIndSendTo(dst__, src__, rand__, autn__) \
796     { \
797         CsrWifiNmeSimUmtsAuthInd *msg__; \
798         CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__); \
799         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
800     }
801
802 #define CsrWifiNmeSimUmtsAuthIndSend(dst__, rand__, autn__) \
803     CsrWifiNmeSimUmtsAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, rand__, autn__)
804
805 /*******************************************************************************
806
807   NAME
808     CsrWifiNmeSimUmtsAuthResSend
809
810   DESCRIPTION
811     Response from the application that received the NME SIM UMTS AUTH IND.
812     The values of umtsCipherKey, umtsIntegrityKey, resParameterLength and
813     resParameter are only meanigful when result = UMTS_AUTH_RESULT_SUCCESS.
814     The value of auts is only meaningful when
815     result=UMTS_AUTH_RESULT_SYNC_FAIL.
816
817   PARAMETERS
818     status             - Indicates the outcome of the requested operation:
819                          STATUS_SUCCESS or STATUS_ERROR.
820     result             - The result of UMTS authentication as performed by the
821                          UICC which could be: Success, Authentication Reject or
822                          Synchronisation Failure. For all these 3 outcomes the
823                          value of status is success.
824     umtsCipherKey      - The UMTS Cipher Key as calculated and returned by the
825                          UICC.
826     umtsIntegrityKey   - The UMTS Integrity Key as calculated and returned by
827                          the UICC.
828     resParameterLength - The length (in bytes) of the RES parameter (min=4; max
829                          = 16).
830     resParameter       - The RES parameter as calculated and returned by the
831                          UICC.
832     auts               - The AUTS parameter as calculated and returned by the
833                          UICC.
834
835 *******************************************************************************/
836 #define CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
837     msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthRes), GFP_KERNEL); \
838     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_RES, dst__, src__); \
839     msg__->status = (status__); \
840     msg__->result = (result__); \
841     memcpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(u8) * 16); \
842     memcpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(u8) * 16); \
843     msg__->resParameterLength = (resParameterLength__); \
844     msg__->resParameter = (resParameter__); \
845     memcpy(msg__->auts, (auts__), sizeof(u8) * 14);
846
847 #define CsrWifiNmeSimUmtsAuthResSendTo(dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
848     { \
849         CsrWifiNmeSimUmtsAuthRes *msg__; \
850         CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__); \
851         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
852     }
853
854 #define CsrWifiNmeSimUmtsAuthResSend(src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
855     CsrWifiNmeSimUmtsAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__)
856
857 /*******************************************************************************
858
859   NAME
860     CsrWifiNmeWpsCancelReqSend
861
862   DESCRIPTION
863     Requests the NME to cancel any WPS procedure that it is currently
864     performing. This includes WPS registrar activities started because of
865     CSR_WIFI_NME_AP_REGISTER.request
866
867   PARAMETERS
868     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
869     interfaceTag - Interface Identifier; unique identifier of an interface
870
871 *******************************************************************************/
872 #define CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__) \
873     msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelReq), GFP_KERNEL); \
874     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_REQ, dst__, src__); \
875     msg__->interfaceTag = (interfaceTag__);
876
877 #define CsrWifiNmeWpsCancelReqSendTo(dst__, src__, interfaceTag__) \
878     { \
879         CsrWifiNmeWpsCancelReq *msg__; \
880         CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__); \
881         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
882     }
883
884 #define CsrWifiNmeWpsCancelReqSend(src__, interfaceTag__) \
885     CsrWifiNmeWpsCancelReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
886
887 /*******************************************************************************
888
889   NAME
890     CsrWifiNmeWpsCancelCfmSend
891
892   DESCRIPTION
893     Reports the status of the NME WPS REQ, the request is always SUCCESSFUL.
894
895   PARAMETERS
896     queue        - Destination Task Queue
897     interfaceTag - Interface Identifier; unique identifier of an interface
898     status       - Only returns CSR_WIFI_NME_STATUS_SUCCESS
899
900 *******************************************************************************/
901 #define CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
902     msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelCfm), GFP_KERNEL); \
903     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_CFM, dst__, src__); \
904     msg__->interfaceTag = (interfaceTag__); \
905     msg__->status = (status__);
906
907 #define CsrWifiNmeWpsCancelCfmSendTo(dst__, src__, interfaceTag__, status__) \
908     { \
909         CsrWifiNmeWpsCancelCfm *msg__; \
910         CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
911         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
912     }
913
914 #define CsrWifiNmeWpsCancelCfmSend(dst__, interfaceTag__, status__) \
915     CsrWifiNmeWpsCancelCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
916
917 /*******************************************************************************
918
919   NAME
920     CsrWifiNmeWpsCfmSend
921
922   DESCRIPTION
923     Reports the status of the NME WPS REQ.
924     If CSR_WIFI_NME_STATUS_SUCCESS, the profile parameter contains the
925     identity and credentials of the AP.
926
927   PARAMETERS
928     queue        - Destination Task Queue
929     interfaceTag - Interface Identifier; unique identifier of an interface
930     status       - Indicates the success or otherwise of the requested
931                    operation.
932     profile      - This parameter is relevant only if
933                    status==CSR_WIFI_NME_STATUS_SUCCESS.
934                    The identity and credentials of the network.
935
936 *******************************************************************************/
937 #define CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__) \
938     msg__ = kmalloc(sizeof(CsrWifiNmeWpsCfm), GFP_KERNEL); \
939     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CFM, dst__, src__); \
940     msg__->interfaceTag = (interfaceTag__); \
941     msg__->status = (status__); \
942     msg__->profile = (profile__);
943
944 #define CsrWifiNmeWpsCfmSendTo(dst__, src__, interfaceTag__, status__, profile__) \
945     { \
946         CsrWifiNmeWpsCfm *msg__; \
947         CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__); \
948         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
949     }
950
951 #define CsrWifiNmeWpsCfmSend(dst__, interfaceTag__, status__, profile__) \
952     CsrWifiNmeWpsCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, profile__)
953
954 /*******************************************************************************
955
956   NAME
957     CsrWifiNmeWpsConfigSetReqSend
958
959   DESCRIPTION
960     This primitive passes the WPS information for the device to NME. This may
961     be accepted only if no interface is active.
962
963   PARAMETERS
964     queue     - Message Source Task Queue (Cfm's will be sent to this Queue)
965     wpsConfig - WPS config.
966
967 *******************************************************************************/
968 #define CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__) \
969     msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetReq), GFP_KERNEL); \
970     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_REQ, dst__, src__); \
971     msg__->wpsConfig = (wpsConfig__);
972
973 #define CsrWifiNmeWpsConfigSetReqSendTo(dst__, src__, wpsConfig__) \
974     { \
975         CsrWifiNmeWpsConfigSetReq *msg__; \
976         CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__); \
977         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
978     }
979
980 #define CsrWifiNmeWpsConfigSetReqSend(src__, wpsConfig__) \
981     CsrWifiNmeWpsConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wpsConfig__)
982
983 /*******************************************************************************
984
985   NAME
986     CsrWifiNmeWpsConfigSetCfmSend
987
988   DESCRIPTION
989     Confirm.
990
991   PARAMETERS
992     queue  - Destination Task Queue
993     status - Status of the request.
994
995 *******************************************************************************/
996 #define CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__) \
997     msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetCfm), GFP_KERNEL); \
998     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_CFM, dst__, src__); \
999     msg__->status = (status__);
1000
1001 #define CsrWifiNmeWpsConfigSetCfmSendTo(dst__, src__, status__) \
1002     { \
1003         CsrWifiNmeWpsConfigSetCfm *msg__; \
1004         CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__); \
1005         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
1006     }
1007
1008 #define CsrWifiNmeWpsConfigSetCfmSend(dst__, status__) \
1009     CsrWifiNmeWpsConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
1010
1011 /*******************************************************************************
1012
1013   NAME
1014     CsrWifiNmeWpsReqSend
1015
1016   DESCRIPTION
1017     Requests the NME to look for WPS enabled APs and attempt to perform WPS
1018     to determine the appropriate security credentials to connect to the AP.
1019     If the PIN == '00000000' then 'push button mode' is indicated, otherwise
1020     the PIN has to match that of the AP. 4 digit pin is passed by sending the
1021     pin digits in pin[0]..pin[3] and rest of the contents filled with '-'.
1022
1023   PARAMETERS
1024     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1025     interfaceTag - Interface Identifier; unique identifier of an interface
1026     pin          - PIN value.
1027     ssid         - Service Set identifier
1028     bssid        - ID of Basic Service Set for which a WPS connection attempt is
1029                    being made.
1030
1031 *******************************************************************************/
1032 #define CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \
1033     msg__ = kmalloc(sizeof(CsrWifiNmeWpsReq), GFP_KERNEL); \
1034     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_REQ, dst__, src__); \
1035     msg__->interfaceTag = (interfaceTag__); \
1036     memcpy(msg__->pin, (pin__), sizeof(u8) * 8); \
1037     msg__->ssid = (ssid__); \
1038     msg__->bssid = (bssid__);
1039
1040 #define CsrWifiNmeWpsReqSendTo(dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \
1041     { \
1042         CsrWifiNmeWpsReq *msg__; \
1043         CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__); \
1044         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
1045     }
1046
1047 #define CsrWifiNmeWpsReqSend(src__, interfaceTag__, pin__, ssid__, bssid__) \
1048     CsrWifiNmeWpsReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, pin__, ssid__, bssid__)
1049
1050
1051 #ifdef __cplusplus
1052 }
1053 #endif
1054
1055 #endif /* CSR_WIFI_NME_LIB_H__ */