/**
 * Called when we finished processing a request and want to request the SCR.
 *
 * @date 05-Jan-2006
 */
static TI_STATUS measurementMgrSM_acRequestSCR(void * pData)
{
	measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) pData;
	EScrClientRequestStatus scrStatus;
	EScePendReason scrPendReason;

	/* Request the channel */
	scrStatus = scr_clientRequest(pMeasurementMgr->hScr, SCR_CID_XCC_MEASURE,
	                              SCR_RESOURCE_SERVING_CHANNEL, &scrPendReason);

	if (scrStatus == SCR_CRS_RUN) {
		TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Received RUN response from SCR\n");

		/* The channel is allocated for the measurement */
		return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState),
		                              MEASUREMENTMGR_EVENT_SCR_RUN, pMeasurementMgr);
	} else if ((scrStatus == SCR_CRS_PEND) && (scrPendReason == SCR_PR_DIFFERENT_GROUP_RUNNING)) {
		TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Received PEND/DIFFGROUP response from SCR\n");

		/* No need to wait for the channel allocation */
		return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState),
		                              MEASUREMENTMGR_EVENT_ABORT, pMeasurementMgr);
	}

	TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Going to wait for SCR callback...\n");

	/* In all other cases wait for the callback function to be called */
	return TI_OK;
}
示例#2
0
/**
 * \fn     scanCncnSmApp1Shot_ScrRequest
 * \brief  Request the SCR for one-shot application scan
 *
 * Request the SCR for one-shot application scan. handle different results.
 *
 * \param  hScanCncnClient - handle to the specific client object
 * \return None
 */
void scanCncnSmApp1Shot_ScrRequest (TI_HANDLE hScanCncnClient)
{
	TScanCncnClient         *pScanCncnClient = (TScanCncnClient*)hScanCncnClient;
	EScrClientRequestStatus eScrReplyStatus;
	EScePendReason          eScrPendReason;

	/* request the SCR as application scan client, and act according to return status */
	switch (eScrReplyStatus = scr_clientRequest (pScanCncnClient->hSCR, SCR_CID_APP_SCAN,
	                          SCR_RESOURCE_SERVING_CHANNEL, &eScrPendReason))
	{
	case SCR_CRS_PEND:
		/* send a reject event to the SM */
		TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmApp1Shot_ScrRequest: SCR pending, pend reason: %d.\n", eScrPendReason);
		pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED;
		genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient);
		break;

	case SCR_CRS_RUN:
		/* send a run event to the SM */
		TRACE0(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmApp1Shot_ScrRequest: SCR acquired.\n");
		genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_RUN, hScanCncnClient);
		break;

	default:
		TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmApp1Shot_ScrRequest: SCR returned unrecognized status: %d.\n", eScrReplyStatus);
		/* Send a reject event to recover from this error */
		pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED;
		genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient);
		break;
	}
}
示例#3
0
/**
*
*
* \b Description:
*
* Update the Switch Channel command parameters.
 * Request SCR and wait for SCR return.
 * if tx status suspend
 *  update regulatory Domain
 *  update tx
 *  start periodic timer

*
* \b ARGS:
*
*  I   - pData - pointer to the SwitchChannel SM context  \n
*
* \b RETURNS:
*
*  TI_OK if successful, TI_NOK otherwise.
*
*
*************************************************************************/
static TI_STATUS switchChannel_smReqSCR_UpdateCmd(void *pData)
{
	switchChannel_t             *pSwitchChannel = (switchChannel_t*)pData;
	EScrClientRequestStatus     scrStatus;
	EScePendReason              scrPendReason;

	if (pSwitchChannel == NULL) {
		return TI_NOK;
	}


	/* Save the TS when requesting SCR */
	pSwitchChannel->SCRRequestTimestamp = os_timeStampMs(pSwitchChannel->hOs);

	scrStatus = scr_clientRequest(pSwitchChannel->hSCR, SCR_CID_SWITCH_CHANNEL,
	                              SCR_RESOURCE_SERVING_CHANNEL, &scrPendReason);
	if ((scrStatus != SCR_CRS_RUN) && (scrStatus != SCR_CRS_PEND)) {
		return (switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_SCR_FAIL, pSwitchChannel));

	}
	if (scrStatus == SCR_CRS_RUN) {
		switchChannel_scrStatusCB(pSwitchChannel, scrStatus, SCR_RESOURCE_SERVING_CHANNEL, scrPendReason);
	} else if ((scrPendReason==SCR_PR_OTHER_CLIENT_RUNNING) ||
	           (scrPendReason==SCR_PR_DIFFERENT_GROUP_RUNNING) ) {  /* No use to wait for the SCR, invoke FAIL */
		return (switchChannel_smEvent((TI_UINT8*)&pSwitchChannel->currentState, SC_EVENT_SCR_FAIL, pSwitchChannel));
	}
	/* wait for the SCR callback function to be called */
	return TI_OK;

}
示例#4
0
/**
 * \\n
 * \date 29-March-2005\n
 * \brief Request the SCR with a given client ID.\n
 *
 * Function Scope \e Public.\n
 * \param hScr - handle to the SCR object.\n
 * \param client - the client to request as.\n\
 * \param eResource - the requested resource.\n
 */
void requestAsClient(TI_HANDLE hScr, EScrClientId client,
		     EScrResourceId eResource)
{
	EScePendReason pendReason;
	EScrClientRequestStatus requestStatus;

	requestStatus = scr_clientRequest(hScr, client, eResource, &pendReason);
	WLAN_OS_REPORT(("Resource %s was requested as client %s, result %s, pend reason %s\n", resourceDesc[eResource], clientDesc[client], requestStatusDesc[requestStatus], pendReasonDesc[pendReason]));
}
示例#5
0
static TI_STATUS connInfra_ScrWait(void *pData)
{
    conn_t *pConn = (conn_t *)pData;
    EScrClientRequestStatus scrReplyStatus[ SCR_RESOURCE_NUM_OF_RESOURCES ];
    EScePendReason          scrPendReason[ SCR_RESOURCE_NUM_OF_RESOURCES ];
    EScrResourceId          uResourceIndex;

    TRACE0( pConn->hReport, REPORT_SEVERITY_INFORMATION, "Infra Connnect SM: Requesting SCR.\n");

    /* request the SCR for both resources, and act according to return status */
    for (uResourceIndex = SCR_RESOURCE_SERVING_CHANNEL;
         uResourceIndex < SCR_RESOURCE_NUM_OF_RESOURCES;
         uResourceIndex++)
    {
        scrReplyStatus[ uResourceIndex ] = scr_clientRequest( pConn->hScr, SCR_CID_CONNECT, 
                                                              uResourceIndex, 
                                                              &(scrPendReason[ uResourceIndex ]));
        pConn->scrRequested[ uResourceIndex ] = TI_TRUE;

        /* sanity check */
        if (scrReplyStatus[ uResourceIndex ] > SCR_CRS_PEND)
        {
            TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR , "Idle_to_ScrWait: SCR for resource %d returned status %d\n", uResourceIndex, scrReplyStatus[ uResourceIndex ]);
            return TI_NOK;
        }
    }

    /* analyze SCR results: */
    /* both returned run - continue to next stage */
    if ((SCR_CRS_RUN == scrReplyStatus[ SCR_RESOURCE_SERVING_CHANNEL ]) &&
        (SCR_CRS_RUN == scrReplyStatus[ SCR_RESOURCE_PERIODIC_SCAN ]))
    {
        /* send an SCR SUCCESS event to the SM */
        TRACE0( pConn->hReport, REPORT_SEVERITY_INFORMATION, "Infra Conn: SCR acquired.\n");
        conn_infraSMEvent(&pConn->state, CONN_INFRA_SCR_SUCC, (TI_HANDLE) pConn);
    }
    else
    {
        /* mark which resource is pending (or both) */
        for (uResourceIndex = SCR_RESOURCE_SERVING_CHANNEL;
             uResourceIndex < SCR_RESOURCE_NUM_OF_RESOURCES;
             uResourceIndex++)
        {
            if (SCR_CRS_PEND == scrReplyStatus[ uResourceIndex ])
            {
                TRACE2( pConn->hReport, REPORT_SEVERITY_INFORMATION, "Infra Conn: SCR pending for resource %d with pend reason: %d, stay in wait SCR state.\n", uResourceIndex, scrPendReason);
                pConn->bScrAcquired[ uResourceIndex ] = TI_FALSE;
            }
            else
            {
                pConn->bScrAcquired[ uResourceIndex ] = TI_TRUE;
            }
        }
    }
    return TI_OK;
}
示例#6
0
static TI_STATUS connInfra_ScrWait(void *pData)
{
    conn_t *pConn = (conn_t *)pData;
    EScrClientRequestStatus scrReplyStatus[ SCR_RESOURCE_NUM_OF_RESOURCES ];
    EScePendReason          scrPendReason[ SCR_RESOURCE_NUM_OF_RESOURCES ];
    EScrResourceId          uResourceIndex;

    /* request the SCR for both resources, and act according to return status */
    for (uResourceIndex = SCR_RESOURCE_SERVING_CHANNEL;
         uResourceIndex < SCR_RESOURCE_NUM_OF_RESOURCES;
         uResourceIndex++)
    {
        scrReplyStatus[ uResourceIndex ] = scr_clientRequest( pConn->hScr, SCR_CID_CONNECT, 
                                                              uResourceIndex, 
                                                              &(scrPendReason[ uResourceIndex ]));
        pConn->scrRequested[ uResourceIndex ] = TI_TRUE;

        /* sanity check */
        if ((scrReplyStatus[ uResourceIndex ] > SCR_CRS_PEND) ||
            (scrReplyStatus[ uResourceIndex ] < SCR_CRS_RUN))
        {
            return TI_NOK;
        }
    }

    /* analyze SCR results: */
    /* both returned run - continue to next stage */
    if ((SCR_CRS_RUN == scrReplyStatus[ SCR_RESOURCE_SERVING_CHANNEL ]) &&
        (SCR_CRS_RUN == scrReplyStatus[ SCR_RESOURCE_PERIODIC_SCAN ]))
    {
        /* send an SCR SUCCESS event to the SM */
        conn_infraSMEvent(&pConn->state, CONN_INFRA_SCR_SUCC, (TI_HANDLE) pConn);
    }
    else
    {
        /* mark which resource is pending (or both) */
        for (uResourceIndex = SCR_RESOURCE_PERIODIC_SCAN;
             uResourceIndex < SCR_RESOURCE_NUM_OF_RESOURCES;
             uResourceIndex++)
        {
            if (SCR_CRS_PEND == scrReplyStatus[ uResourceIndex ])
            {
                pConn->bScrAcquired[ uResourceIndex ] = TI_FALSE;
            }
            else
            {
                pConn->bScrAcquired[ uResourceIndex ] = TI_TRUE;
            }
        }
    }
    return TI_OK;
}
示例#7
0
/**
 * \fn     scanCncnSmDrvP_ScrRequest
 * \brief  Request the SCR for periodic driver scan
 *
 * Request the SCR for periodic driver scan. Handle different results
 *
 * \param  hScanCncnClient - handle to the specific client object
 * \return None
 */
void scanCncnSmDrvP_ScrRequest (TI_HANDLE hScanCncnClient)
{
	TScanCncnClient         *pScanCncnClient = (TScanCncnClient*)hScanCncnClient;
	EScrClientRequestStatus eScrReplyStatus;
	EScePendReason          eScrPendReason;

	/* request the SCR as driver scan client, and act according to return status */
	switch (eScrReplyStatus = scr_clientRequest( pScanCncnClient->hSCR, SCR_CID_DRIVER_FG_SCAN,
	                          SCR_RESOURCE_PERIODIC_SCAN, &eScrPendReason ) )
	{
	case SCR_CRS_PEND:
		TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmAppP_ScrRequest: SCR pending, pend reason: %d.\n", eScrPendReason);

		/* check the pending reason */
		if (SCR_PR_OTHER_CLIENT_ABORTING != eScrPendReason)
		{
			/*
			 * send a reject event to the SM - would not scan if not in a different group or
			 * another un-abortable client is running
			 */
			pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED;
			genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient);
		}
		/* if the pending reason is another client aborting wait untill it finish abort */
		break;

	case SCR_CRS_RUN:
		/* send a run event to the SM */
		TRACE0(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmAppP_ScrRequest: SCR acquired.\n");
		genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_RUN, hScanCncnClient);
		break;

	default:
		TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmAppP_ScrRequest: SCR returned unrecognized status: %d\n", eScrReplyStatus);
		/* Send a reject event to recover from this error */
		pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED;
		genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient);
		break;
	}
}
static TI_STATUS Idle_to_ScrWait(void *pData)
{
    scr_clientRequestStatus_e scrReplyStatus;
    scr_pendReason_e scrPendReason;
    
    conn_t *pConn = (conn_t *)pData;

    WLAN_REPORT_INFORMATION( pConn->hReport, CONN_MODULE_LOG,
                             ("Infra Connnect SM: Requesting SCR.\n") );
 
    scrReplyStatus = scr_clientRequest( pConn->hScr, SCR_CID_CONNECT, &scrPendReason );

    pConn->scrRequested = TRUE;

    /* request the SCR as application (either BG or FG) client, and act according to return status */
    switch ( scrReplyStatus )
    {
    case SCR_CRS_PEND:
        /* send a pend event to the SM */
        WLAN_REPORT_INFORMATION( pConn->hReport, CONN_MODULE_LOG, 
                                 ("Infra Conn: SCR pending with pend reason: %d, stay in wait SCR state.\n",
                                  scrPendReason) );
        break;

    case SCR_CRS_RUN:
        /* send an SCR SUCCESS event to the SM */
        WLAN_REPORT_INFORMATION( pConn->hReport, CONN_MODULE_LOG, ("Infra Conn: SCR acquired.\n") );
        
        conn_infraSMEvent(&pConn->state, CONN_INFRA_SCR_SUCC, (TI_HANDLE) pConn);
        break;

    default:
        WLAN_REPORT_ERROR( pConn->hReport, CONN_MODULE_LOG,
                             ("Infra Conn: SCR returned unrecognized status: %d.\n", scrReplyStatus) );
        return NOK;
    }

    return OK;
}
示例#9
0
/**
 * \fn     scanCncnSmImmed1Shot_ScrRequest
 * \brief  Request the SCR for one-shot immediate scan
 *
 * Request the SCR for one-shot immediate scan. Handle different results
 *
 * \param  hScanCncnClient - handle to the specific client object
 * \return None
 */
void scanCncnSmImmed1Shot_ScrRequest (TI_HANDLE hScanCncnClient)
{
	TScanCncnClient         *pScanCncnClient = (TScanCncnClient*)hScanCncnClient;
	EScrClientRequestStatus eScrReplyStatus;
	EScePendReason          eScrPendReason;

	/* request the SCR as immediate roaming client, and act according to return status */
	switch (eScrReplyStatus = scr_clientRequest (pScanCncnClient->hSCR, SCR_CID_IMMED_SCAN,
	                          SCR_RESOURCE_SERVING_CHANNEL, &eScrPendReason))
	{
	case SCR_CRS_PEND:
		TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmImmed1Shot_ScrRequest: SCR pending, pend Reason: %d.\n", eScrPendReason);

		/* check pend reason */
		if ( SCR_PR_DIFFERENT_GROUP_RUNNING == eScrPendReason )
		{
			/* send a reject event to the SM - will not scan if not in the correct group */
			pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED;
			genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient);
		}
		/* for other pending reasons wait untill current client finishes */
		break;

	case SCR_CRS_RUN:
		/* send a run event to the SM */
		TRACE0(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmImmed1Shot_ScrRequest: SCR acquired.\n");
		genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_RUN, hScanCncnClient);
		break;

	default:
		TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmImmed1Shot_ScrRequest: SCR returned unrecognized status: %d.\n", eScrReplyStatus);
		pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED;
		/* Send a reject event to recover from this error */
		genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient);
		break;
	}
}