コード例 #1
0
/*----------------------------------------------------------------------------*/
WLAN_STATUS
wlanoidRftestSetTestMode (
    IN  P_ADAPTER_T       prAdapter,
    IN  PVOID             pvSetBuffer,
    IN  UINT_32           u4SetBufferLen,
    OUT PUINT_32          pu4SetInfoLen
    )
{
    P_PARAM_RFTEST_INFO_T  prRfTestInfo;
#if CFG_SDIO_DEVICE_DRIVER_WO_NDIS
    BOOL fgStatus = FALSE;
#endif

    DEBUGFUNC("wlanoidRftestSetTestMode");

    ASSERT(prAdapter);
    ASSERT(pvSetBuffer);
    ASSERT(pu4SetInfoLen);

    *pu4SetInfoLen = 0;

    if (u4SetBufferLen == 0 ||
        u4SetBufferLen == sizeof(prRfTestInfo->u4Length)) {
        /* If setBufferLen is zero, we need to load EEPROM */
        arbFsmRunEventRftestEnterTestMode(prAdapter, NULL, 0);

#if CFG_SDIO_DEVICE_DRIVER_WO_NDIS
        // Calibrate 32K slow clock
        /* meta mode does not run into 32K validation and there is no return code. Therefore, we need to invoke calibration here. */
        fgStatus = nicpmCalSlowClock(prAdapter, &prAdapter->rPmInfo.rSlowClkCnt);

        if(fgStatus == FALSE){
            return WLAN_STATUS_FAILURE;
        }
#endif

#if !(CFG_SDIO_DEVICE_DRIVER_WO_NDIS)
        /* Currently no idea how to handle meta mode. However, in normal build, entering test mode
           means going to test wifi. set preferred antenna path to wifi.
        */
#if PTA_NEW_BOARD_DESIGN
        if(prAdapter->rPtaInfo.fgSingleAntenna){
            nicPtaSetAnt(prAdapter, TRUE);
        }
#endif
#endif

        return WLAN_STATUS_SUCCESS;
    }
    /* MT5921 does not support EEPROM content change by this oid cmd */

    prRfTestInfo = pvSetBuffer;

    DBGLOG(REQ, ERROR, ("Invalid data. nicInfoContentLen: %ld, Length:%ld\n",
        prRfTestInfo->u4NicInfoContentLen,
        prRfTestInfo->u4Length));

    return WLAN_STATUS_INVALID_DATA;
}   /* wlanoidRftestSetTestMode */
コード例 #2
0
/*----------------------------------------------------------------------------*/
BOOLEAN
nicpmRegInit (
    IN P_ADAPTER_T prAdapter
    )
{
    P_PM_INFO_T prPmInfo;
    BOOLEAN fgStatus;

    ASSERT(prAdapter);

    prPmInfo = &prAdapter->rPmInfo;

    // Low power related register initialization
    halpmRegInit(prAdapter);

    /* Set OSC stable time */
    halpmSetOscStableTime(prAdapter, prAdapter->rEEPROMCtrl.u2OscStableTimeUs);

    // Calibrate 32K slow clock
    fgStatus = nicpmCalSlowClock(prAdapter, &prAdapter->rPmInfo.rSlowClkCnt);

    if (fgStatus) {
        /* Low Power instructions */
        if (prAdapter->ucRevID == MTK_CHIP_MP_REVERSION_ID) {
            prPmInfo->au4LowPowerInst_sleep[prPmInfo->ucNumOfInstSleep++] =
                LP_INST_DELAY(25, FALSE, FALSE);
        }
        // Low power instruction programming
        NIC_PM_PROGRAM_LP_INSRUCTION(prAdapter, FALSE);

        // Program wakeup guard time
        nicpmSetupWakeupGuardTime(prAdapter, &prAdapter->rPmInfo.rSlowClkCnt);
    }

    nicSetHwTxByBasicRate(prAdapter, TRUE);

    return fgStatus;
}