4 * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name Texas Instruments nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 /** \file SwitchChannel.c
35 * \brief SwitchChannel module interface
37 * \see SwitchChannelApi.h
40 /****************************************************************************************************/
42 /* MODULE: SwitchChannel.c */
43 /* PURPOSE: SwitchChannel module interface. */
44 /* This module perform SwitchChannel (Dynamic Frequency Selection) */
45 /* according to AP command. The object responsibles for switching channel after*/
46 /* the requires time and quieting the channel for the required duration */
48 /****************************************************************************************************/
50 #define __FILE_ID__ FILE_ID_7
55 #include "SwitchChannelApi.h"
56 #include "DataCtrl_Api.h"
57 #include "regulatoryDomainApi.h"
59 #include "siteMgrApi.h"
60 #include "PowerMgr_API.h"
61 #include "healthMonitor.h"
63 #include "DrvMainModules.h"
65 /* allocation vector */
66 #define SC_INIT_BIT (1)
67 #define SC_SM_INIT_BIT (2)
69 #define SC_SWITCH_CHANNEL_CMD_LEN 3
70 #define SC_SWITCH_CHANNEL_MODE_NOT_TX_SUS 0
71 #define SC_SWITCH_CHANNEL_MODE_TX_SUS 1
74 #define SC_CHANNEL_INVALID TI_FALSE
75 #define SC_CHANNEL_VALID TI_TRUE
79 /** state machine states */
83 SC_STATE_WAIT_4_CMD = 1,
84 SC_STATE_WAIT_4_SCR = 2,
85 SC_STATE_SC_IN_PROG = 3,
87 } switchChannel_smStates;
89 /** State machine events */
96 SC_EVENT_SCR_FAIL = 4,
97 SC_EVENT_SC_CMPLT = 5,
98 SC_EVENT_FW_RESET = 6,
100 } switchChannel_smEvents;
103 #define SC_NUM_STATES SC_STATE_LAST
104 #define SC_NUM_EVENTS SC_EVENT_LAST
111 /* SwitchChannel parameters that can be configured externally */
112 TI_BOOL dot11SpectrumManagementRequired;
114 /* Internal SwitchChannel parameters */
115 TI_UINT8 currentState;
116 dot11_CHANNEL_SWITCH_t curChannelSwitchCmdParams;
117 TI_UINT32 SCRRequestTimestamp;
118 TI_UINT8 currentChannel;
119 TI_BOOL switchChannelStarted;
122 /* switchChannelCmd for debug */
123 dot11_CHANNEL_SWITCH_t debugChannelSwitchCmdParams;
124 TI_UINT8 ignoreCancelSwitchChannelCmd;
127 /* SwitchChannel SM */
128 fsm_stateMachine_t *pSwitchChannelSm;
130 /* SwitchChannel handles to other objects */
134 TI_HANDLE hRegulatoryDomain;
135 TI_HANDLE hPowerMngr;
145 /* External data definitions */
147 /* Local functions definitions */
149 /* Global variables */
152 /********************************************************************************/
153 /* Internal functions prototypes. */
154 /********************************************************************************/
158 static TI_STATUS switchChannel_smStartSwitchChannelCmd(void *pData);
159 static TI_STATUS switchChannel_smReqSCR_UpdateCmd(void *pData);
160 static TI_STATUS switchChannel_smSwitchChannelCmplt(void *pData);
161 static TI_STATUS switchChannel_smFwResetWhileSCInProg(void *pData);
162 static TI_STATUS switchChannel_smScrFailWhileWait4Scr(void *pData);
163 static TI_STATUS switchChannel_smNop(void *pData);
164 static TI_STATUS switchChannel_smUnexpected(void *pData);
165 static TI_STATUS switchChannel_smStopWhileWait4Cmd(void *pData);
166 static TI_STATUS switchChannel_smStopWhileWait4Scr(void *pData);
167 static TI_STATUS switchChannel_smStopWhileSwitchChannelInProg(void *pData);
168 static TI_STATUS switchChannel_smStart(void *pData);
171 /* other functions */
172 static void release_module(switchChannel_t *pSwitchChannel, TI_UINT32 initVec);
173 static TI_STATUS switchChannel_smEvent(TI_UINT8 *currState, TI_UINT8 event, void* data);
174 static void switchChannel_zeroDatabase(switchChannel_t *pSwitchChannel);
175 void switchChannel_SwitchChannelCmdCompleteReturn(TI_HANDLE hSwitchChannel);
176 void switchChannel_scrStatusCB(TI_HANDLE hSwitchChannel, EScrClientRequestStatus requestStatus,
177 EScrResourceId eResource, EScePendReason pendReason );
179 static void switchChannel_recvCmd4Debug(TI_HANDLE hSwitchChannel, dot11_CHANNEL_SWITCH_t *channelSwitch, TI_BOOL BeaconPacket, TI_UINT8 channel);
183 /********************************************************************************/
184 /* Interface functions Implementation. */
185 /********************************************************************************/
188 /************************************************************************
189 * switchChannel_create *
190 ************************************************************************/
195 * This procedure is called by the config manager when the driver is created.
196 * It creates the SwitchChannel object.
200 * I - hOs - OS context \n
204 * Handle to the SwitchChannel object.
208 TI_HANDLE switchChannel_create(TI_HANDLE hOs)
210 switchChannel_t *pSwitchChannel = NULL;
211 TI_UINT32 initVec = 0;
214 /* allocating the SwitchChannel object */
215 pSwitchChannel = os_memoryAlloc(hOs,sizeof(switchChannel_t));
217 if (pSwitchChannel == NULL)
220 initVec |= (1 << SC_INIT_BIT);
222 os_memoryZero(hOs, pSwitchChannel, sizeof(switchChannel_t));
224 pSwitchChannel->hOs = hOs;
226 status = fsm_Create(hOs, &pSwitchChannel->pSwitchChannelSm, SC_NUM_STATES, SC_NUM_EVENTS);
229 release_module(pSwitchChannel, initVec);
230 WLAN_OS_REPORT(("FATAL ERROR: switchChannel_create(): Error Creating pSwitchChannelSm - Aborting\n"));
233 initVec |= (1 << SC_SM_INIT_BIT);
235 return(pSwitchChannel);
238 /************************************************************************
239 * switchChannel_init *
240 ************************************************************************/
245 * This procedure is called by the DrvMain when the driver is initialized.
246 * It initializes the SwitchChannel object's variables and handlers and creates the SwitchChannel SM.
250 * I - pStadHandles - The driver modules handles \n
258 void switchChannel_init (TStadHandlesList *pStadHandles)
260 switchChannel_t *pSwitchChannel = (switchChannel_t *)(pStadHandles->hSwitchChannel);
262 /** Roaming State Machine matrix */
263 fsm_actionCell_t switchChannel_SM[SC_NUM_STATES][SC_NUM_EVENTS] =
265 /* next state and actions for IDLE state */
266 { {SC_STATE_WAIT_4_CMD, switchChannel_smStart}, /* START */
267 {SC_STATE_IDLE, switchChannel_smNop}, /* STOP */
268 {SC_STATE_IDLE, switchChannel_smNop}, /* SC_CMD */
269 {SC_STATE_IDLE, switchChannel_smUnexpected}, /* SCR_RUN */
270 {SC_STATE_IDLE, switchChannel_smUnexpected}, /* SCR_FAIL */
271 {SC_STATE_IDLE, switchChannel_smUnexpected}, /* SC_CMPLT */
272 {SC_STATE_IDLE, switchChannel_smUnexpected} /* FW_RESET */
275 /* next state and actions for WAIT_4_CMD state */
276 { {SC_STATE_WAIT_4_CMD, switchChannel_smNop}, /* START */
277 {SC_STATE_IDLE, switchChannel_smStopWhileWait4Cmd}, /* STOP */
278 {SC_STATE_WAIT_4_SCR, switchChannel_smReqSCR_UpdateCmd}, /* SC_CMD */
279 {SC_STATE_WAIT_4_CMD, switchChannel_smUnexpected}, /* SCR_RUN */
280 {SC_STATE_WAIT_4_CMD, switchChannel_smUnexpected}, /* SCR_FAIL */
281 {SC_STATE_WAIT_4_CMD, switchChannel_smUnexpected}, /* SC_CMPLT */
282 {SC_STATE_WAIT_4_CMD, switchChannel_smUnexpected} /* FW_RESET */
286 /* next state and actions for WAIT_4_SCR state */
287 { {SC_STATE_WAIT_4_SCR, switchChannel_smUnexpected}, /* START */
288 {SC_STATE_IDLE, switchChannel_smStopWhileWait4Scr}, /* STOP */
289 {SC_STATE_WAIT_4_SCR, switchChannel_smNop}, /* SC_CMD */
290 {SC_STATE_SC_IN_PROG, switchChannel_smStartSwitchChannelCmd}, /* SCR_RUN */
291 {SC_STATE_WAIT_4_CMD, switchChannel_smScrFailWhileWait4Scr}, /* SCR_FAIL */
292 {SC_STATE_WAIT_4_SCR, switchChannel_smUnexpected} , /* SC_CMPLT */
293 {SC_STATE_WAIT_4_CMD, switchChannel_smUnexpected} /* FW_RESET */
297 /* next state and actions for switchChannel_IN_PROG state */
298 { {SC_STATE_SC_IN_PROG, switchChannel_smUnexpected}, /* START */
299 {SC_STATE_IDLE, switchChannel_smStopWhileSwitchChannelInProg}, /* STOP */
300 {SC_STATE_SC_IN_PROG, switchChannel_smNop}, /* SC_CMD */
301 {SC_STATE_SC_IN_PROG, switchChannel_smUnexpected}, /* SCR_RUN */
302 {SC_STATE_WAIT_4_CMD, switchChannel_smUnexpected}, /* SCR_FAIL */
303 {SC_STATE_WAIT_4_CMD, switchChannel_smSwitchChannelCmplt}, /* SC_CMPLT */
304 {SC_STATE_WAIT_4_CMD, switchChannel_smFwResetWhileSCInProg} /* FW_RESET */
308 fsm_Config(pSwitchChannel->pSwitchChannelSm,
309 &switchChannel_SM[0][0],
312 switchChannel_smEvent, pSwitchChannel->hOs);
315 pSwitchChannel->hTWD = pStadHandles->hTWD;
316 pSwitchChannel->hSiteMgr = pStadHandles->hSiteMgr;
317 pSwitchChannel->hSCR = pStadHandles->hSCR;
318 pSwitchChannel->hRegulatoryDomain = pStadHandles->hRegulatoryDomain;
319 pSwitchChannel->hApConn = pStadHandles->hAPConnection;
320 pSwitchChannel->hReport = pStadHandles->hReport;
321 pSwitchChannel->hOs = pStadHandles->hOs;
325 TI_STATUS switchChannel_SetDefaults (TI_HANDLE hSwitchChannel, SwitchChannelInitParams_t *SwitchChannelInitParams)
327 switchChannel_t *pSwitchChannel = (switchChannel_t *)hSwitchChannel;
330 pSwitchChannel->dot11SpectrumManagementRequired = SwitchChannelInitParams->dot11SpectrumManagementRequired;
331 pSwitchChannel->currentState = SC_STATE_IDLE;
332 pSwitchChannel->currentChannel = 0;
333 pSwitchChannel->switchChannelStarted = TI_FALSE;
335 /* register to SCR */
336 scr_registerClientCB(pSwitchChannel->hSCR, SCR_CID_SWITCH_CHANNEL,
337 switchChannel_scrStatusCB, pSwitchChannel);
339 /* register to Switch Channel Complete event in HAL */
340 TWD_RegisterEvent (pSwitchChannel->hTWD,
341 TWD_OWN_EVENT_SWITCH_CHANNEL_CMPLT,
342 (void *)switchChannel_SwitchChannelCmdCompleteReturn,
345 TWD_EnableEvent (pSwitchChannel->hTWD, TWD_OWN_EVENT_SWITCH_CHANNEL_CMPLT);
348 pSwitchChannel->debugChannelSwitchCmdParams.hdr[0] = CHANNEL_SWITCH_ANNOUNCEMENT_IE_ID;
349 pSwitchChannel->debugChannelSwitchCmdParams.hdr[1] = SC_SWITCH_CHANNEL_CMD_LEN;
350 pSwitchChannel->ignoreCancelSwitchChannelCmd = 0;
352 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INIT, ".....SwitchChannel configured successfully\n");
358 /************************************************************************
359 * switchChannel_stop *
360 ************************************************************************/
365 * This procedure is called by the SME when the state is changed from CONNECTED.
366 * It generates a STOP event to the SwitchChannel SM.
370 * I - hSwitchChannel - SwitchChannel context \n
374 * TI_OK on success, TI_NOK otherwise
378 TI_STATUS switchChannel_stop(TI_HANDLE hSwitchChannel)
380 switchChannel_t *pSwitchChannel = (switchChannel_t *)hSwitchChannel;
382 pSwitchChannel->switchChannelStarted = TI_FALSE;
383 return (switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_STOP, pSwitchChannel));
387 /************************************************************************
388 * switchChannel_start *
389 ************************************************************************/
394 * This procedure is called by the SME when the state is changed to CONNECTED.
395 * It generates a START event to the SwitchChannel SM.
399 * I - hSwitchChannel - SwitchChannel context \n
403 * TI_OK on success, TI_NOK otherwise
407 TI_STATUS switchChannel_start(TI_HANDLE hSwitchChannel)
409 switchChannel_t *pSwitchChannel = (switchChannel_t *)hSwitchChannel;
410 pSwitchChannel->switchChannelStarted = TI_TRUE;
412 return (switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_START, pSwitchChannel));
417 /************************************************************************
418 * switchChannel_unload *
419 ************************************************************************/
424 * This procedure is called by the config manager when the driver is unloaded.
425 * It frees any memory allocated and timers.
429 * I - hSwitchChannel - SwitchChannel context \n
433 * TI_OK on success, TI_NOK otherwise
437 TI_STATUS switchChannel_unload(TI_HANDLE hSwitchChannel)
440 switchChannel_t *pSwitchChannel = (switchChannel_t *)hSwitchChannel;
442 if (pSwitchChannel == NULL)
446 release_module(pSwitchChannel, initVec);
452 /************************************************************************
453 * switchChannel_recvCmd *
454 ************************************************************************/
455 /*DESCRIPTION: This function is called by MLME Parser upon receiving of
456 Beacon, Probe Response or Action with Switch Channel command,
458 performs the following:
459 - Initializes the switching channel procedure.
460 - Setting timer to the actual switching time(if needed)
462 INPUT: hSwitchChannel - SwitchChannel handle.
463 switchMode - indicates whether to stop transmission
464 until the scheduled channel switch.
465 newChannelNum - indicates the number of the new channel.
466 durationTime - indicates the time (expressed in ms) until
467 the scheduled channel switch should accure.
471 RETURN: TI_OK on success, TI_NOK otherwise
473 ************************************************************************/
475 void switchChannel_recvCmd(TI_HANDLE hSwitchChannel, dot11_CHANNEL_SWITCH_t *channelSwitch, TI_UINT8 channel)
478 switchChannel_t *pSwitchChannel = (switchChannel_t *)hSwitchChannel;
481 if (pSwitchChannel==NULL)
486 param.paramType = REGULATORY_DOMAIN_DFS_CHANNELS_RANGE;
487 regulatoryDomain_getParam(pSwitchChannel->hRegulatoryDomain, ¶m);
489 if (!pSwitchChannel->dot11SpectrumManagementRequired ||
490 (channel < param.content.DFS_ChannelRange.minDFS_channelNum) ||
491 (channel > param.content.DFS_ChannelRange.maxDFS_channelNum))
492 { /* Do not parse Switch Channel IE, when SpectrumManagement is disabled,
493 or the channel is non-DFS channel */
497 /* for debug purposes only */
498 if (pSwitchChannel->ignoreCancelSwitchChannelCmd != 0)
504 if (channelSwitch == NULL)
505 { /* No SC IE, update regDomain */
506 param.paramType = REGULATORY_DOMAIN_UPDATE_CHANNEL_VALIDITY;
507 param.content.channel = channel;
508 regulatoryDomain_setParam(pSwitchChannel->hRegulatoryDomain, ¶m);
512 TRACE3(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_recvFrame, SwitchChannel cmd was found, channel no=%d, mode=%d, TBTT=%d \n", channelSwitch->channelNumber, channelSwitch->channelSwitchMode, channelSwitch->channelSwitchCount);
514 /* Checking channel number validity */
515 param.content.channel = channelSwitch->channelNumber;
516 param.paramType = REGULATORY_DOMAIN_IS_CHANNEL_SUPPORTED;
517 regulatoryDomain_getParam(pSwitchChannel->hRegulatoryDomain,¶m);
518 if ( ( !param.content.bIsChannelSupprted ) ||
519 (channelSwitch->channelSwitchCount == 0) ||
520 (channelSwitch->channelSwitchMode == SC_SWITCH_CHANNEL_MODE_TX_SUS))
521 { /* Trigger Roaming, if TX mode is disabled, the new channel number is invalid,
522 or the TBTT count is 0 */
523 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "report Roaming trigger\n");
524 if (channelSwitch->channelSwitchMode == SC_SWITCH_CHANNEL_MODE_TX_SUS)
526 param.paramType = REGULATORY_DOMAIN_SET_CHANNEL_VALIDITY;
527 param.content.channelValidity.channelNum = channel;
528 param.content.channelValidity.channelValidity = TI_FALSE;
529 regulatoryDomain_setParam(pSwitchChannel->hRegulatoryDomain, ¶m);
532 if (TI_TRUE == pSwitchChannel->switchChannelStarted)
534 apConn_reportRoamingEvent(pSwitchChannel->hApConn, ROAMING_TRIGGER_SWITCH_CHANNEL, NULL);
539 { /* Invoke Switch Channel command */
540 /* update the new SCC params */
541 pSwitchChannel->curChannelSwitchCmdParams.channelNumber = channelSwitch->channelNumber;
542 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount = channelSwitch->channelSwitchCount;
543 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchMode = channelSwitch->channelSwitchMode;
544 switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_SC_CMD, pSwitchChannel);
552 /************************************************************************
553 * switchChannel_powerSaveStatusReturn *
554 ************************************************************************/
559 * This procedure is called when power save status is returned
563 * I/O - hSwitchChannel - SwitchChannel context \n
567 * TI_OK on success, TI_NOK otherwise.
571 void switchChannel_SwitchChannelCmdCompleteReturn(TI_HANDLE hSwitchChannel)
573 switchChannel_t *pSwitchChannel = (switchChannel_t*)hSwitchChannel;
575 if (pSwitchChannel == NULL)
579 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_SwitchChannelCmdCompleteReturn \n");
581 switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_SC_CMPLT, pSwitchChannel);
585 /************************************************************************
586 * switchChannel_enableDisableSpectrumMngmt *
587 ************************************************************************/
592 * This procedure enables or disables the spectrum management
596 * I - hSwitchChannel - SwitchChannel context \n
597 * I - enableDisable - TI_TRUE - Enable, TI_FALSE - Disable
601 * TI_OK on success, TI_NOK otherwise.
605 void switchChannel_enableDisableSpectrumMngmt(TI_HANDLE hSwitchChannel, TI_BOOL enableDisable)
607 switchChannel_t *pSwitchChannel = (switchChannel_t*)hSwitchChannel;
610 if (hSwitchChannel == NULL)
614 TRACE1(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_enableDisableSpectrumMngmt, enableDisable=%d \n", enableDisable);
616 pSwitchChannel->dot11SpectrumManagementRequired = enableDisable;
619 { /* Enable SC, if it was started invoke start event.
620 otherwise, wait for a start event */
621 if (pSwitchChannel->switchChannelStarted)
623 switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_START, pSwitchChannel);
628 switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_STOP, pSwitchChannel);
635 /************************************************************************
636 * SwitchChannel internal functions *
637 ************************************************************************/
639 /************************************************************************
640 * switchChannel_smEvent *
641 ************************************************************************/
646 * SwitchChannel state machine transition function
650 * I/O - currentState - current state in the state machine\n
651 * I - event - specific event for the state machine\n
652 * I - pData - Data for state machine action function\n
656 * TI_OK on success, TI_NOK otherwise.
660 static TI_STATUS switchChannel_smEvent(TI_UINT8 *currState, TI_UINT8 event, void* data)
664 switchChannel_t *pSwitchChannel = (switchChannel_t*)data;
667 status = fsm_GetNextState(pSwitchChannel->pSwitchChannelSm, *currState, event, &nextState);
670 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_ERROR, "switchChannel_smEvent, fsm_GetNextState error\n");
674 TRACE3(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smEvent: <currentState = %d, event = %d> --> nextState = %d\n", *currState, event, nextState);
676 status = fsm_Event(pSwitchChannel->pSwitchChannelSm, currState, event, (void *)pSwitchChannel);
680 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_ERROR, "switchChannel_smEvent fsm_Event error\n");
681 TRACE3(pSwitchChannel->hReport, REPORT_SEVERITY_ERROR, "switchChannel_smEvent: <currentState = %d, event = %d> --> nextState = %d\n", *currState, event, nextState);
688 /************************************************************************
689 * switchChannel_smStart *
690 ************************************************************************/
696 * This function is called when the station becomes connected.
697 * update the current channel.
701 * I - pData - pointer to the SwitchChannel SM context \n
705 * TI_OK if successful, TI_NOK otherwise.
708 *************************************************************************/
709 static TI_STATUS switchChannel_smStart(void *pData)
711 switchChannel_t *pSwitchChannel = (switchChannel_t*)pData;
714 if (pSwitchChannel == NULL)
719 /* get the current channel number */
720 param.paramType = SITE_MGR_CURRENT_CHANNEL_PARAM;
721 siteMgr_getParam(pSwitchChannel->hSiteMgr, ¶m);
722 pSwitchChannel->currentChannel = param.content.siteMgrCurrentChannel;
724 TRACE1(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smStart, channelNo=%d\n", pSwitchChannel->currentChannel);
729 /************************************************************************
730 * switchChannel_smReqSCR_UpdateCmd *
731 ************************************************************************/
737 * Update the Switch Channel command parameters.
738 * Request SCR and wait for SCR return.
739 * if tx status suspend
740 * update regulatory Domain
742 * start periodic timer
747 * I - pData - pointer to the SwitchChannel SM context \n
751 * TI_OK if successful, TI_NOK otherwise.
754 *************************************************************************/
755 static TI_STATUS switchChannel_smReqSCR_UpdateCmd(void *pData)
757 switchChannel_t *pSwitchChannel = (switchChannel_t*)pData;
758 EScrClientRequestStatus scrStatus;
759 EScePendReason scrPendReason;
761 if (pSwitchChannel == NULL)
765 TRACE3(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smReqSCR_UpdateCmd, channelNo=%d, TBTT = %d, Mode = %d\n", pSwitchChannel->curChannelSwitchCmdParams.channelNumber, pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount, pSwitchChannel->curChannelSwitchCmdParams.channelSwitchMode);
768 /* Save the TS when requesting SCR */
769 pSwitchChannel->SCRRequestTimestamp = os_timeStampMs(pSwitchChannel->hOs);
771 scrStatus = scr_clientRequest(pSwitchChannel->hSCR, SCR_CID_SWITCH_CHANNEL,
772 SCR_RESOURCE_SERVING_CHANNEL, &scrPendReason);
773 if ((scrStatus != SCR_CRS_RUN) && (scrStatus != SCR_CRS_PEND))
775 TRACE1(pSwitchChannel->hReport, REPORT_SEVERITY_ERROR, "switchChannel_smReqSCR_UpdateCmd():Abort the switch channel, request Roaming, scrStatus=%d\n", scrStatus);
776 return (switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_SCR_FAIL, pSwitchChannel));
779 if (scrStatus == SCR_CRS_RUN)
781 switchChannel_scrStatusCB(pSwitchChannel, scrStatus, SCR_RESOURCE_SERVING_CHANNEL, scrPendReason);
783 else if ((scrPendReason==SCR_PR_OTHER_CLIENT_RUNNING) ||
784 (scrPendReason==SCR_PR_DIFFERENT_GROUP_RUNNING) )
785 { /* No use to wait for the SCR, invoke FAIL */
786 return (switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_SCR_FAIL, pSwitchChannel));
788 /* wait for the SCR callback function to be called */
794 /************************************************************************
795 * switchChannel_scrStatusCB *
796 ************************************************************************/
802 * This function is called by the SCR when:
803 * the resource is reserved for the SwitchChannel - SCR_CRS_RUN
804 * recovery occurred - SCR_CRS_ABORT
809 * I - hSwitchChannel - pointer to the SwitchChannel SM context \n
810 * I - requestStatus - the SCR request status \n
811 * I - eResource - the resource for which the CB is issued \n
812 * I - pendReason - The SCR pend status in case of pend reply \n
819 *************************************************************************/
820 void switchChannel_scrStatusCB(TI_HANDLE hSwitchChannel, EScrClientRequestStatus requestStatus,
821 EScrResourceId eResource, EScePendReason pendReason )
823 switchChannel_t *pSwitchChannel = (switchChannel_t*)hSwitchChannel;
824 switchChannel_smEvents scEvent;
826 if (pSwitchChannel == NULL)
831 switch (requestStatus)
834 scEvent = SC_EVENT_SCR_RUN;
836 case SCR_CRS_FW_RESET:
837 scEvent = SC_EVENT_FW_RESET;
840 scEvent = SC_EVENT_SCR_FAIL;
844 TRACE2(pSwitchChannel->hReport, REPORT_SEVERITY_ERROR, "switchChannel_scrStatusCB scrStatus = %d, pendReason=%d\n", requestStatus, pendReason);
845 scEvent = SC_EVENT_SCR_FAIL;
849 switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, scEvent, pSwitchChannel);
855 /************************************************************************
856 * switchChannel_smStartSwitchChannelCmd *
857 ************************************************************************/
863 * This function is called once SwitchChannel command was received and the SCR
864 * request returned with reason RUN.
865 * In this case perform the following:
872 * I - pData - pointer to the SwitchChannel SM context \n
876 * TI_OK if successful, TI_NOK otherwise.
879 *************************************************************************/
880 static TI_STATUS switchChannel_smStartSwitchChannelCmd(void *pData)
882 switchChannel_t *pSwitchChannel = (switchChannel_t *)pData;
883 TSwitchChannelParams pSwitchChannelCmd;
884 TI_UINT32 switchChannelTimeDuration;
887 if (pSwitchChannel == NULL)
892 param.paramType = SITE_MGR_BEACON_INTERVAL_PARAM;
893 siteMgr_getParam(pSwitchChannel->hSiteMgr, ¶m);
895 switchChannelTimeDuration = pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount * param.content.beaconInterval * 1024 / 1000;
896 if ( (switchChannelTimeDuration!=0) &&
897 ((os_timeStampMs(pSwitchChannel->hOs) - pSwitchChannel->SCRRequestTimestamp) >= switchChannelTimeDuration ))
898 { /* There's no time to perfrom the SCC, set the Count to 1 */
899 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount = 1;
902 apConn_indicateSwitchChannelInProgress(pSwitchChannel->hApConn);
904 pSwitchChannelCmd.channelNumber = pSwitchChannel->curChannelSwitchCmdParams.channelNumber;
905 pSwitchChannelCmd.switchTime = pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount;
906 pSwitchChannelCmd.txFlag = pSwitchChannel->curChannelSwitchCmdParams.channelSwitchMode;
907 pSwitchChannelCmd.flush = 0;
908 TWD_CmdSwitchChannel (pSwitchChannel->hTWD, &pSwitchChannelCmd);
910 TRACE4(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "TWD_CmdSwitchChannel:Set the cmd in HAL. Params:\n channelNumber=%d, switchTime=%d, txFlag=%d, flush=%d \n", pSwitchChannelCmd.channelNumber, pSwitchChannelCmd.switchTime, pSwitchChannelCmd.txFlag, pSwitchChannelCmd.flush);
916 /************************************************************************
917 * switchChannel_smFwResetWhileSCInProg *
918 ************************************************************************/
924 * This function is called when Switch Channel command is cancelled.
925 * In this case update TX nad regulatory Domain adn HAL.
926 * Release the SCR and exit PS.
930 * I - pData - pointer to the SwitchChannel SM context \n
934 * TI_OK if successful, TI_NOK otherwise.
937 *************************************************************************/
938 static TI_STATUS switchChannel_smFwResetWhileSCInProg(void *pData)
940 switchChannel_t *pSwitchChannel = (switchChannel_t *)pData;
943 if (pSwitchChannel == NULL)
947 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smFwResetWhileSCInProg \n");
949 /* Update new current channel */
950 param.paramType = SITE_MGR_CURRENT_CHANNEL_PARAM;
951 param.content.siteMgrCurrentChannel = pSwitchChannel->curChannelSwitchCmdParams.channelNumber;
952 siteMgr_setParam(pSwitchChannel->hSiteMgr, ¶m);
954 apConn_indicateSwitchChannelFinished(pSwitchChannel->hApConn);
956 switchChannel_zeroDatabase(pSwitchChannel);
958 /* release the SCR */
959 scr_clientComplete(pSwitchChannel->hSCR, SCR_CID_SWITCH_CHANNEL, SCR_RESOURCE_SERVING_CHANNEL);
966 /************************************************************************
967 * switchChannel_smSwitchChannelCmplt *
968 ************************************************************************/
974 * This function is called when SwitchChannel command completed in FW.
975 * In this case release SCR and update current channel.
976 * If TX was sus, it will be enabled only after first Beacon is recieved.
981 * I - pData - pointer to the SwitchChannel SM context \n
985 * TI_OK if successful, TI_NOK otherwise.
988 *************************************************************************/
989 static TI_STATUS switchChannel_smSwitchChannelCmplt(void *pData)
991 switchChannel_t *pSwitchChannel = (switchChannel_t *)pData;
994 if (pSwitchChannel == NULL)
999 /* Update new current channel */
1000 param.paramType = SITE_MGR_CURRENT_CHANNEL_PARAM;
1001 param.content.siteMgrCurrentChannel = pSwitchChannel->curChannelSwitchCmdParams.channelNumber;
1002 siteMgr_setParam(pSwitchChannel->hSiteMgr, ¶m);
1004 TRACE1(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smSwitchChannelCmplt, new channelNum = %d\n", pSwitchChannel->currentChannel);
1006 apConn_indicateSwitchChannelFinished(pSwitchChannel->hApConn);
1007 switchChannel_zeroDatabase(pSwitchChannel);
1009 /* release the SCR */
1010 scr_clientComplete(pSwitchChannel->hSCR, SCR_CID_SWITCH_CHANNEL, SCR_RESOURCE_SERVING_CHANNEL);
1018 /************************************************************************
1019 * switchChannel_smScrFailWhileWait4Scr *
1020 ************************************************************************/
1026 * This function is called when recovery occurred, while waiting for SCR due
1027 * to previous switch channel command.
1033 * I - pData - pointer to the SwitchChannel SM context \n
1037 * TI_OK if successful, TI_NOK otherwise.
1040 *************************************************************************/
1041 static TI_STATUS switchChannel_smScrFailWhileWait4Scr(void *pData)
1043 switchChannel_t *pSwitchChannel = (switchChannel_t*)pData;
1045 if (pSwitchChannel == NULL)
1050 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smScrFailWhileWait4Scr\n");
1052 switchChannel_zeroDatabase(pSwitchChannel);
1054 /* release the SCR is not required !!! */
1055 scr_clientComplete(pSwitchChannel->hSCR, SCR_CID_SWITCH_CHANNEL, SCR_RESOURCE_SERVING_CHANNEL);
1060 /************************************************************************
1061 * switchChannel_smStopWhileWait4Cmd *
1062 ************************************************************************/
1068 * This function is called when the station becomes Disconnected and the current
1069 * state is Wait4Cmd. In this case perfrom:
1071 * Enable TX if it was disabled
1072 * Zero the current command parameters
1077 * I - pData - pointer to the SwitchChannel SM context \n
1081 * TI_OK if successful, TI_NOK otherwise.
1084 *************************************************************************/
1085 static TI_STATUS switchChannel_smStopWhileWait4Cmd(void *pData)
1087 switchChannel_t *pSwitchChannel = (switchChannel_t*)pData;
1089 if (pSwitchChannel == NULL)
1094 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smStopWhileWait4Cmd\n");
1096 switchChannel_zeroDatabase(pSwitchChannel);
1101 /************************************************************************
1102 * switchChannel_smStopWhileWait4Scr *
1103 ************************************************************************/
1109 * This function is called when the station becomes Disconnected and the current
1110 * state is Wait4Scr. In this case perfrom:
1112 * Enable TX if it was disabled
1113 * Zero the current command parameters
1118 * I - pData - pointer to the SwitchChannel SM context \n
1122 * TI_OK if successful, TI_NOK otherwise.
1125 *************************************************************************/
1126 static TI_STATUS switchChannel_smStopWhileWait4Scr(void *pData)
1128 switchChannel_t *pSwitchChannel = (switchChannel_t*)pData;
1130 if (pSwitchChannel == NULL)
1135 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smStopWhileWait4Scr\n");
1138 switchChannel_zeroDatabase(pSwitchChannel);
1140 /* release the SCR */
1141 scr_clientComplete(pSwitchChannel->hSCR, SCR_CID_SWITCH_CHANNEL, SCR_RESOURCE_SERVING_CHANNEL);
1146 /************************************************************************
1147 * switchChannel_smStopWhileSwitchChannelInProg *
1148 ************************************************************************/
1154 * This function is called when the station becomes Disconnected and the current
1155 * state is SwitchChannelInProg. In this case perfrom:
1157 * Enable TX if it was disabled
1158 * Zero the current command parameters
1165 * I - pData - pointer to the SwitchChannel SM context \n
1169 * TI_OK if successful, TI_NOK otherwise.
1172 *************************************************************************/
1173 static TI_STATUS switchChannel_smStopWhileSwitchChannelInProg(void *pData)
1175 switchChannel_t *pSwitchChannel = (switchChannel_t*)pData;
1177 if (pSwitchChannel == NULL)
1182 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_smStopWhileSwitchChannelInProg\n");
1185 /*PowerMgr_exitFromDriverMode(pSwitchChannel->hPowerMngr, "SwitchChannel");*/
1187 apConn_indicateSwitchChannelFinished(pSwitchChannel->hApConn);
1189 TWD_CmdSwitchChannelCancel (pSwitchChannel->hTWD, pSwitchChannel->currentChannel);
1190 switchChannel_zeroDatabase(pSwitchChannel);
1192 /* release the SCR */
1193 scr_clientComplete(pSwitchChannel->hSCR, SCR_CID_SWITCH_CHANNEL, SCR_RESOURCE_SERVING_CHANNEL);
1201 /************************************************************************
1202 * switchChannel_zeroDatabase *
1203 ************************************************************************/
1209 * This function is called when the SwitchChannel internal database should be zero.
1210 * The following parameters are zerod:
1211 * SwitchChannelChannelRange - the timestamps and validity state of channels
1212 * curChannelSwitchCmdParams - the current switch channel command parameters
1216 * I - pSwitchChannel - pointer to the SwitchChannel SM context \n
1217 * I - channelNum - channel number \n
1218 * I - timestamp - required timestamp \n
1225 *************************************************************************/
1226 static void switchChannel_zeroDatabase(switchChannel_t *pSwitchChannel)
1229 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_zeroDatabase\n");
1232 pSwitchChannel->curChannelSwitchCmdParams.channelNumber = 0;
1233 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount = 0;
1234 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchMode = SC_SWITCH_CHANNEL_MODE_NOT_TX_SUS;
1235 pSwitchChannel->currentChannel = 0;
1239 /***********************************************************************
1241 ***********************************************************************/
1243 DESCRIPTION: Called by the destroy function or by the create function (on failure)
1244 Go over the vector, for each bit that is set, release the corresponding module.
1246 INPUT: pSwitchChannel - SwitchChannel pointer.
1247 initVec - Vector that contains a bit set for each module thah had been initiualized
1251 RETURN: TI_OK on success, TI_NOK otherwise
1253 ************************************************************************/
1254 static void release_module(switchChannel_t *pSwitchChannel, TI_UINT32 initVec)
1256 if (pSwitchChannel == NULL)
1260 if (initVec & (1 << SC_SM_INIT_BIT))
1262 fsm_Unload(pSwitchChannel->hOs, pSwitchChannel->pSwitchChannelSm);
1265 if (initVec & (1 << SC_INIT_BIT))
1267 os_memoryFree(pSwitchChannel->hOs, pSwitchChannel, sizeof(switchChannel_t));
1276 * switchChannel_smNop - Do nothing
1280 * Do nothing in the SM.
1284 * I - pData - pointer to the SwitchChannel SM context \n
1288 * TI_OK if successful, TI_NOK otherwise.
1292 static TI_STATUS switchChannel_smNop(void *pData)
1294 switchChannel_t *pSwitchChannel;
1296 pSwitchChannel = (switchChannel_t*)pData;
1297 if (pSwitchChannel == NULL)
1301 TRACE0(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, " switchChannel_smNop\n");
1308 * switchChannel_smUnexpected - Unexpected event
1312 * Unexpected event in the SM.
1316 * I - pData - pointer to the SwitchChannel SM context \n
1320 * TI_OK if successful, TI_NOK otherwise.
1324 static TI_STATUS switchChannel_smUnexpected(void *pData)
1326 switchChannel_t *pSwitchChannel;
1328 pSwitchChannel = (switchChannel_t*)pData;
1329 if (pSwitchChannel == NULL)
1333 TRACE1(pSwitchChannel->hReport, REPORT_SEVERITY_ERROR, " switchChannel_smUnexpected, state = %d\n", pSwitchChannel->currentState);
1338 /*******************************************************************************
1339 *********** Debug functions ***********
1340 *******************************************************************************/
1343 /************************************************************************
1344 * switchChannel_recvCmd *
1345 ************************************************************************/
1346 /*DESCRIPTION: This function is called by MLME Parser upon receiving of
1347 Beacon, Probe Response or Action with Switch Channel command,
1349 performs the following:
1350 - Initializes the switching channel procedure.
1351 - Setting timer to the actual switching time(if needed)
1353 INPUT: hSwitchChannel - SwitchChannel handle.
1354 switchMode - indicates whether to stop transmission
1355 until the scheduled channel switch.
1356 newChannelNum - indicates the number of the new channel.
1357 durationTime - indicates the time (expressed in ms) until
1358 the scheduled channel switch should accure.
1362 RETURN: TI_OK on success, TI_NOK otherwise
1364 ************************************************************************/
1366 static void switchChannel_recvCmd4Debug(TI_HANDLE hSwitchChannel, dot11_CHANNEL_SWITCH_t *channelSwitch, TI_BOOL BeaconPacket, TI_UINT8 channel)
1369 switchChannel_t *pSwitchChannel = (switchChannel_t *)hSwitchChannel;
1372 if (pSwitchChannel==NULL)
1378 /* The following is for debug purposes only
1379 It will be operated when the Switch Channel cmd is opertated from debug CLI */
1380 if (pSwitchChannel->ignoreCancelSwitchChannelCmd != 0)
1382 if (pSwitchChannel->ignoreCancelSwitchChannelCmd == 1)
1384 /* update the new SCC params */
1385 pSwitchChannel->curChannelSwitchCmdParams.channelNumber = channelSwitch->channelNumber;
1386 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount = channelSwitch->channelSwitchCount;
1387 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchMode = channelSwitch->channelSwitchMode;
1389 pSwitchChannel->ignoreCancelSwitchChannelCmd = 2;
1391 else if (channelSwitch->channelSwitchCount>0)
1393 channelSwitch->channelSwitchCount --;
1397 pSwitchChannel->ignoreCancelSwitchChannelCmd = 0;
1401 /* search in the buffer pointer to the beginning of the
1402 Switch Cahnnel Announcement IE according to the IE ID */
1404 /* SC IE exists on the serving channel */
1405 TRACE3(pSwitchChannel->hReport, REPORT_SEVERITY_INFORMATION, "switchChannel_recvFrame, SwitchChannel cmd was found, channel no=%d, mode=%d, TBTT=%d \n", channelSwitch->channelNumber, channelSwitch->channelSwitchMode, channelSwitch->channelSwitchCount);
1407 /* Checking channel number validity */
1408 param.content.channel = channelSwitch->channelNumber;
1409 param.paramType = REGULATORY_DOMAIN_IS_CHANNEL_SUPPORTED;
1410 regulatoryDomain_getParam(pSwitchChannel->hRegulatoryDomain,¶m);
1411 if (( !param.content.bIsChannelSupprted ) ||
1412 (channelSwitch->channelSwitchCount == 0) ||
1413 (channelSwitch->channelSwitchMode == SC_SWITCH_CHANNEL_MODE_TX_SUS))
1414 { /* Trigger Roaming, if TX mode is disabled, the new channel number is invalid,
1415 or the TBTT count is 0 */
1416 apConn_reportRoamingEvent(pSwitchChannel->hApConn, ROAMING_TRIGGER_SWITCH_CHANNEL, NULL);
1419 { /* Invoke Switch Channel command */
1420 /* update the new SCC params */
1421 pSwitchChannel->curChannelSwitchCmdParams.channelNumber = channelSwitch->channelNumber;
1422 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount = channelSwitch->channelSwitchCount;
1423 pSwitchChannel->curChannelSwitchCmdParams.channelSwitchMode = channelSwitch->channelSwitchMode;
1424 switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_SC_CMD, pSwitchChannel);
1430 void switchChannelDebug_setCmdParams(TI_HANDLE hSwitchChannel, SC_switchChannelCmdParam_e switchChannelCmdParam, TI_UINT8 param)
1432 switchChannel_t *pSwitchChannel = (switchChannel_t*)hSwitchChannel;
1434 if (pSwitchChannel == NULL)
1439 switch (switchChannelCmdParam)
1441 case SC_SWITCH_CHANNEL_NUM:
1442 WLAN_OS_REPORT(("SwitchChannelDebug_setSwitchChannelCmdParams, channelNum=%d \n ", param));
1443 pSwitchChannel->debugChannelSwitchCmdParams.channelNumber = param;
1445 case SC_SWITCH_CHANNEL_TBTT:
1446 WLAN_OS_REPORT(("SwitchChannelDebug_setSwitchChannelCmdParams, channelSwitchCount=%d \n ", param));
1447 pSwitchChannel->debugChannelSwitchCmdParams.channelSwitchCount = param;
1449 case SC_SWITCH_CHANNEL_MODE:
1450 WLAN_OS_REPORT(("SwitchChannelDebug_setSwitchChannelCmdParams, channelSwitchMode=%d \n ", param));
1451 pSwitchChannel->debugChannelSwitchCmdParams.channelSwitchMode = param;
1454 WLAN_OS_REPORT(("ERROR: SwitchChannelDebug_setSwitchChannelCmdParams, wrong switchChannelCmdParam=%d \n ",
1455 switchChannelCmdParam));
1460 void switchChannelDebug_SwitchChannelCmdTest(TI_HANDLE hSwitchChannel, TI_BOOL BeaconPacket)
1462 switchChannel_t *pSwitchChannel = (switchChannel_t*)hSwitchChannel;
1464 if (pSwitchChannel == NULL)
1469 WLAN_OS_REPORT(("SwitchChannelDebug_SwitchChannelCmdTest, BeaconPacket=%d \n cmd params: channelNumber=%d, channelSwitchCount=%d, channelSwitchMode=%d \n",
1471 pSwitchChannel->debugChannelSwitchCmdParams.channelNumber,
1472 pSwitchChannel->debugChannelSwitchCmdParams.channelSwitchCount,
1473 pSwitchChannel->debugChannelSwitchCmdParams.channelSwitchMode));
1476 pSwitchChannel->ignoreCancelSwitchChannelCmd= 1;
1477 switchChannel_recvCmd4Debug(hSwitchChannel, &pSwitchChannel->debugChannelSwitchCmdParams, BeaconPacket, pSwitchChannel->currentChannel);
1480 void switchChannelDebug_CancelSwitchChannelCmdTest(TI_HANDLE hSwitchChannel, TI_BOOL BeaconPacket)
1483 switchChannel_t *pSwitchChannel = (switchChannel_t*)hSwitchChannel;
1485 if (pSwitchChannel == NULL)
1490 WLAN_OS_REPORT(("SwitchChannelDebug_SwitchChannelCmdTest, BeaconPacket=%d \n",BeaconPacket));
1492 pSwitchChannel->ignoreCancelSwitchChannelCmd= 0;
1493 switchChannel_recvCmd4Debug(hSwitchChannel, NULL, BeaconPacket, pSwitchChannel->currentChannel);
1497 void switchChannelDebug_printStatus(TI_HANDLE hSwitchChannel)
1499 switchChannel_t *pSwitchChannel = (switchChannel_t*)hSwitchChannel;
1501 if (pSwitchChannel == NULL)
1506 WLAN_OS_REPORT(("SwitchChannel debug params are: channelNumber=%d, channelSwitchCount=%d , channelSwitchMode=%d \n",
1507 pSwitchChannel->debugChannelSwitchCmdParams.channelNumber,
1508 pSwitchChannel->debugChannelSwitchCmdParams.channelSwitchCount,
1509 pSwitchChannel->debugChannelSwitchCmdParams.channelSwitchMode));
1511 WLAN_OS_REPORT(("SwitchChannel state=%d, currentChannel=%d \n", pSwitchChannel->currentState, pSwitchChannel->currentChannel));
1516 void switchChannelDebug_setChannelValidity(TI_HANDLE hSwitchChannel, TI_UINT8 channelNum, TI_BOOL validity)
1520 switchChannel_t *pSwitchChannel = (switchChannel_t*)hSwitchChannel;
1522 if (pSwitchChannel == NULL)
1527 param.paramType = REGULATORY_DOMAIN_SET_CHANNEL_VALIDITY;
1528 param.content.channelValidity.channelNum = channelNum;
1529 param.content.channelValidity.channelValidity = validity;
1530 regulatoryDomain_setParam(pSwitchChannel->hRegulatoryDomain, ¶m);