Staging: add CSR wifi module
[linux-2.6-block.git] / drivers / staging / csr / csr_wifi_nme_ap_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_AP_LIB_H__
14 #define CSR_WIFI_NME_AP_LIB_H__
15
16 #include "csr_types.h"
17 #include "csr_pmem.h"
18 #include "csr_sched.h"
19 #include "csr_util.h"
20 #include "csr_msg_transport.h"
21
22 #include "csr_wifi_lib.h"
23
24 #include "csr_wifi_nme_ap_prim.h"
25 #include "csr_wifi_nme_task.h"
26
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #ifndef CSR_WIFI_NME_ENABLE
33 #error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h
34 #endif
35 #ifndef CSR_WIFI_AP_ENABLE
36 #error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h
37 #endif
38
39 /*----------------------------------------------------------------------------*
40  *  CsrWifiNmeApFreeUpstreamMessageContents
41  *
42  *  DESCRIPTION
43  *      Free the allocated memory in a CSR_WIFI_NME_AP upstream message. Does not
44  *      free the message itself, and can only be used for upstream messages.
45  *
46  *  PARAMETERS
47  *      Deallocates the resources in a CSR_WIFI_NME_AP upstream message
48  *----------------------------------------------------------------------------*/
49 void CsrWifiNmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message);
50
51 /*----------------------------------------------------------------------------*
52  *  CsrWifiNmeApFreeDownstreamMessageContents
53  *
54  *  DESCRIPTION
55  *      Free the allocated memory in a CSR_WIFI_NME_AP downstream message. Does not
56  *      free the message itself, and can only be used for downstream messages.
57  *
58  *  PARAMETERS
59  *      Deallocates the resources in a CSR_WIFI_NME_AP downstream message
60  *----------------------------------------------------------------------------*/
61 void CsrWifiNmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message);
62
63 /*----------------------------------------------------------------------------*
64  * Enum to string functions
65  *----------------------------------------------------------------------------*/
66 const CsrCharString* CsrWifiNmeApPersCredentialTypeToString(CsrWifiNmeApPersCredentialType value);
67
68
69 /*----------------------------------------------------------------------------*
70  * CsrPrim Type toString function.
71  * Converts a message type to the String name of the Message
72  *----------------------------------------------------------------------------*/
73 const CsrCharString* CsrWifiNmeApPrimTypeToString(CsrPrim msgType);
74
75 /*----------------------------------------------------------------------------*
76  * Lookup arrays for PrimType name Strings
77  *----------------------------------------------------------------------------*/
78 extern const CsrCharString *CsrWifiNmeApUpstreamPrimNames[CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT];
79 extern const CsrCharString *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT];
80
81 /*******************************************************************************
82
83   NAME
84     CsrWifiNmeApConfigSetReqSend
85
86   DESCRIPTION
87     This primitive passes AP configuration info for NME. This can be sent at
88     any time but will be acted upon when the AP is started again. This
89     information is common to both P2P GO and AP
90
91   PARAMETERS
92     queue       - Message Source Task Queue (Cfm's will be sent to this Queue)
93     apConfig    - AP configuration for the NME.
94     apMacConfig - MAC configuration to be acted on when
95                   CSR_WIFI_NME_AP_START.request is sent.
96
97 *******************************************************************************/
98 #define CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__) \
99     msg__ = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); \
100     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_REQ, dst__, src__); \
101     msg__->apConfig = (apConfig__); \
102     msg__->apMacConfig = (apMacConfig__);
103
104 #define CsrWifiNmeApConfigSetReqSendTo(dst__, src__, apConfig__, apMacConfig__) \
105     { \
106         CsrWifiNmeApConfigSetReq *msg__; \
107         CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__); \
108         CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
109     }
110
111 #define CsrWifiNmeApConfigSetReqSend(src__, apConfig__, apMacConfig__) \
112     CsrWifiNmeApConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, apConfig__, apMacConfig__)
113
114 /*******************************************************************************
115
116   NAME
117     CsrWifiNmeApConfigSetCfmSend
118
119   DESCRIPTION
120     This primitive reports the result of the request.
121
122   PARAMETERS
123     queue  - Destination Task Queue
124     status - Status of the request.
125
126 *******************************************************************************/
127 #define CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__) \
128     msg__ = (CsrWifiNmeApConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetCfm)); \
129     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_CFM, dst__, src__); \
130     msg__->status = (status__);
131
132 #define CsrWifiNmeApConfigSetCfmSendTo(dst__, src__, status__) \
133     { \
134         CsrWifiNmeApConfigSetCfm *msg__; \
135         CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__); \
136         CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
137     }
138
139 #define CsrWifiNmeApConfigSetCfmSend(dst__, status__) \
140     CsrWifiNmeApConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
141
142 /*******************************************************************************
143
144   NAME
145     CsrWifiNmeApStaRemoveReqSend
146
147   DESCRIPTION
148     This primitive disconnects a connected station. If keepBlocking is set to
149     TRUE, the station with the specified MAC address is not allowed to
150     connect. If the requested station is not already connected,it may be
151     blocked based on keepBlocking parameter.
152
153   PARAMETERS
154     queue         - Message Source Task Queue (Cfm's will be sent to this Queue)
155     interfaceTag  - Interface Identifier; unique identifier of an interface
156     staMacAddress - Mac Address of the station to be disconnected or blocked
157     keepBlocking  - If TRUE, the station is blocked. If FALSE and the station is
158                     connected, disconnect the station. If FALSE and the station
159                     is not connected, no action is taken.
160
161 *******************************************************************************/
162 #define CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \
163     msg__ = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); \
164     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STA_REMOVE_REQ, dst__, src__); \
165     msg__->interfaceTag = (interfaceTag__); \
166     msg__->staMacAddress = (staMacAddress__); \
167     msg__->keepBlocking = (keepBlocking__);
168
169 #define CsrWifiNmeApStaRemoveReqSendTo(dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \
170     { \
171         CsrWifiNmeApStaRemoveReq *msg__; \
172         CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__); \
173         CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
174     }
175
176 #define CsrWifiNmeApStaRemoveReqSend(src__, interfaceTag__, staMacAddress__, keepBlocking__) \
177     CsrWifiNmeApStaRemoveReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, staMacAddress__, keepBlocking__)
178
179 /*******************************************************************************
180
181   NAME
182     CsrWifiNmeApStartReqSend
183
184   DESCRIPTION
185     This primitive requests NME to started the AP operation.
186
187   PARAMETERS
188     queue          - Message Source Task Queue (Cfm's will be sent to this Queue)
189     interfaceTag   - Interface identifier; unique identifier of an interface
190     apType         - AP Type specifies the Legacy AP or P2P GO operation
191     cloakSsid      - Indicates whether the SSID should be cloaked (hidden and
192                      not broadcast in beacon) or not
193     ssid           - Service Set Identifier
194     ifIndex        - Radio interface
195     channel        - Channel number of the channel to use
196     apCredentials  - Security credential configuration.
197     maxConnections - Maximum number of stations/P2P clients allowed
198     p2pGoParam     - P2P specific GO parameters.
199                      NOT USED FOR CURRENT RELEASE
200     wpsEnabled     - Indicates whether WPS should be enabled or not
201
202 *******************************************************************************/
203 #define CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
204     msg__ = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); \
205     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_REQ, dst__, src__); \
206     msg__->interfaceTag = (interfaceTag__); \
207     msg__->apType = (apType__); \
208     msg__->cloakSsid = (cloakSsid__); \
209     msg__->ssid = (ssid__); \
210     msg__->ifIndex = (ifIndex__); \
211     msg__->channel = (channel__); \
212     msg__->apCredentials = (apCredentials__); \
213     msg__->maxConnections = (maxConnections__); \
214     msg__->p2pGoParam = (p2pGoParam__); \
215     msg__->wpsEnabled = (wpsEnabled__);
216
217 #define CsrWifiNmeApStartReqSendTo(dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
218     { \
219         CsrWifiNmeApStartReq *msg__; \
220         CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__); \
221         CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
222     }
223
224 #define CsrWifiNmeApStartReqSend(src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
225     CsrWifiNmeApStartReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__)
226
227 /*******************************************************************************
228
229   NAME
230     CsrWifiNmeApStartCfmSend
231
232   DESCRIPTION
233     This primitive reports the result of CSR_WIFI_NME_AP_START.request.
234
235   PARAMETERS
236     queue        - Destination Task Queue
237     interfaceTag - Interface identifier; unique identifier of an interface
238     status       - Status of the request.
239     ssid         - Service Set Identifier
240
241 *******************************************************************************/
242 #define CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__) \
243     msg__ = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); \
244     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_CFM, dst__, src__); \
245     msg__->interfaceTag = (interfaceTag__); \
246     msg__->status = (status__); \
247     msg__->ssid = (ssid__);
248
249 #define CsrWifiNmeApStartCfmSendTo(dst__, src__, interfaceTag__, status__, ssid__) \
250     { \
251         CsrWifiNmeApStartCfm *msg__; \
252         CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__); \
253         CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
254     }
255
256 #define CsrWifiNmeApStartCfmSend(dst__, interfaceTag__, status__, ssid__) \
257     CsrWifiNmeApStartCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, ssid__)
258
259 /*******************************************************************************
260
261   NAME
262     CsrWifiNmeApStationIndSend
263
264   DESCRIPTION
265     This primitive indicates that a station has joined or a previously joined
266     station has left the BSS/group
267
268   PARAMETERS
269     queue             - Destination Task Queue
270     interfaceTag      - Interface Identifier; unique identifier of an interface
271     mediaStatus       - Indicates whether the station is connected or
272                         disconnected
273     peerMacAddress    - MAC address of the station
274     peerDeviceAddress - P2P Device Address
275
276 *******************************************************************************/
277 #define CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
278     msg__ = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); \
279     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STATION_IND, dst__, src__); \
280     msg__->interfaceTag = (interfaceTag__); \
281     msg__->mediaStatus = (mediaStatus__); \
282     msg__->peerMacAddress = (peerMacAddress__); \
283     msg__->peerDeviceAddress = (peerDeviceAddress__);
284
285 #define CsrWifiNmeApStationIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
286     { \
287         CsrWifiNmeApStationInd *msg__; \
288         CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__); \
289         CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
290     }
291
292 #define CsrWifiNmeApStationIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
293     CsrWifiNmeApStationIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__)
294
295 /*******************************************************************************
296
297   NAME
298     CsrWifiNmeApStopReqSend
299
300   DESCRIPTION
301     This primitive requests NME to stop the AP operation.
302
303   PARAMETERS
304     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
305     interfaceTag - Interface identifier; unique identifier of an interface
306
307 *******************************************************************************/
308 #define CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__) \
309     msg__ = (CsrWifiNmeApStopReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopReq)); \
310     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_REQ, dst__, src__); \
311     msg__->interfaceTag = (interfaceTag__);
312
313 #define CsrWifiNmeApStopReqSendTo(dst__, src__, interfaceTag__) \
314     { \
315         CsrWifiNmeApStopReq *msg__; \
316         CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__); \
317         CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
318     }
319
320 #define CsrWifiNmeApStopReqSend(src__, interfaceTag__) \
321     CsrWifiNmeApStopReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
322
323 /*******************************************************************************
324
325   NAME
326     CsrWifiNmeApStopIndSend
327
328   DESCRIPTION
329     Indicates that AP operation had stopped because of some unrecoverable
330     error after AP operation was started successfully. NME sends this signal
331     after failing to restart the AP operation internally following an error
332
333   PARAMETERS
334     queue        - Destination Task Queue
335     interfaceTag - Interface Identifier; unique identifier of an interface
336     apType       - Reports AP Type (P2PGO or AP)
337     status       - Error Status
338
339 *******************************************************************************/
340 #define CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \
341     msg__ = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); \
342     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_IND, dst__, src__); \
343     msg__->interfaceTag = (interfaceTag__); \
344     msg__->apType = (apType__); \
345     msg__->status = (status__);
346
347 #define CsrWifiNmeApStopIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \
348     { \
349         CsrWifiNmeApStopInd *msg__; \
350         CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \
351         CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
352     }
353
354 #define CsrWifiNmeApStopIndSend(dst__, interfaceTag__, apType__, status__) \
355     CsrWifiNmeApStopIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, apType__, status__)
356
357 /*******************************************************************************
358
359   NAME
360     CsrWifiNmeApStopCfmSend
361
362   DESCRIPTION
363     This primitive confirms that the AP operation is stopped. NME shall send
364     this primitive in response to the request even if AP operation has
365     already been stopped
366
367   PARAMETERS
368     queue        - Destination Task Queue
369     interfaceTag - Interface identifier; unique identifier of an interface
370     status       - Status of the request.
371
372 *******************************************************************************/
373 #define CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
374     msg__ = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); \
375     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_CFM, dst__, src__); \
376     msg__->interfaceTag = (interfaceTag__); \
377     msg__->status = (status__);
378
379 #define CsrWifiNmeApStopCfmSendTo(dst__, src__, interfaceTag__, status__) \
380     { \
381         CsrWifiNmeApStopCfm *msg__; \
382         CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
383         CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
384     }
385
386 #define CsrWifiNmeApStopCfmSend(dst__, interfaceTag__, status__) \
387     CsrWifiNmeApStopCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
388
389 /*******************************************************************************
390
391   NAME
392     CsrWifiNmeApWmmParamUpdateReqSend
393
394   DESCRIPTION
395     Application uses this primitive to update the WMM parameters
396
397   PARAMETERS
398     queue         - Message Source Task Queue (Cfm's will be sent to this Queue)
399     wmmApParams   - WMM Access point parameters per access category. The array
400                     index corresponds to the ACI
401     wmmApBcParams - WMM station parameters per access category to be advertised
402                     in the beacons and probe response The array index
403                     corresponds to the ACI
404
405 *******************************************************************************/
406 #define CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__) \
407     msg__ = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); \
408     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \
409     CsrMemCpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \
410     CsrMemCpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4);
411
412 #define CsrWifiNmeApWmmParamUpdateReqSendTo(dst__, src__, wmmApParams__, wmmApBcParams__) \
413     { \
414         CsrWifiNmeApWmmParamUpdateReq *msg__; \
415         CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__); \
416         CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
417     }
418
419 #define CsrWifiNmeApWmmParamUpdateReqSend(src__, wmmApParams__, wmmApBcParams__) \
420     CsrWifiNmeApWmmParamUpdateReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wmmApParams__, wmmApBcParams__)
421
422 /*******************************************************************************
423
424   NAME
425     CsrWifiNmeApWmmParamUpdateCfmSend
426
427   DESCRIPTION
428     A confirm for for the WMM parameters update
429
430   PARAMETERS
431     queue  - Destination Task Queue
432     status - Status of the request.
433
434 *******************************************************************************/
435 #define CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__) \
436     msg__ = (CsrWifiNmeApWmmParamUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm)); \
437     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \
438     msg__->status = (status__);
439
440 #define CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, src__, status__) \
441     { \
442         CsrWifiNmeApWmmParamUpdateCfm *msg__; \
443         CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__); \
444         CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
445     }
446
447 #define CsrWifiNmeApWmmParamUpdateCfmSend(dst__, status__) \
448     CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
449
450 /*******************************************************************************
451
452   NAME
453     CsrWifiNmeApWpsRegisterReqSend
454
455   DESCRIPTION
456     This primitive allows the NME to accept the WPS registration from an
457     enrollee. Such registration procedure can be cancelled by sending
458     CSR_WIFI_NME_WPS_CANCEL.request.
459
460   PARAMETERS
461     queue                    - Message Source Task Queue (Cfm's will be sent to this Queue)
462     interfaceTag             - Interface Identifier; unique identifier of an
463                                interface
464     selectedDevicePasswordId - Selected password type
465     selectedConfigMethod     - Selected WPS configuration method type
466     pin                      - PIN value.
467                                Relevant if selected device password ID is PIN.4
468                                digit pin is passed by sending the pin digits in
469                                pin[0]..pin[3] and rest of the contents filled
470                                with '-'.
471
472 *******************************************************************************/
473 #define CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
474     msg__ = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); \
475     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_REQ, dst__, src__); \
476     msg__->interfaceTag = (interfaceTag__); \
477     msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \
478     msg__->selectedConfigMethod = (selectedConfigMethod__); \
479     CsrMemCpy(msg__->pin, (pin__), sizeof(CsrUint8) * 8);
480
481 #define CsrWifiNmeApWpsRegisterReqSendTo(dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
482     { \
483         CsrWifiNmeApWpsRegisterReq *msg__; \
484         CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__); \
485         CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
486     }
487
488 #define CsrWifiNmeApWpsRegisterReqSend(src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
489     CsrWifiNmeApWpsRegisterReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__)
490
491 /*******************************************************************************
492
493   NAME
494     CsrWifiNmeApWpsRegisterCfmSend
495
496   DESCRIPTION
497     This primitive reports the result of WPS procedure.
498
499   PARAMETERS
500     queue        - Destination Task Queue
501     interfaceTag - Interface identifier; unique identifier of an interface
502     status       - Status of the request.
503
504 *******************************************************************************/
505 #define CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
506     msg__ = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); \
507     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_CFM, dst__, src__); \
508     msg__->interfaceTag = (interfaceTag__); \
509     msg__->status = (status__);
510
511 #define CsrWifiNmeApWpsRegisterCfmSendTo(dst__, src__, interfaceTag__, status__) \
512     { \
513         CsrWifiNmeApWpsRegisterCfm *msg__; \
514         CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
515         CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
516     }
517
518 #define CsrWifiNmeApWpsRegisterCfmSend(dst__, interfaceTag__, status__) \
519     CsrWifiNmeApWpsRegisterCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
520
521
522 #ifdef __cplusplus
523 }
524 #endif
525
526 #endif /* CSR_WIFI_NME_AP_LIB_H__ */