/****************************************************************************
 * DESCRIPTION: Configure the TNET Driver Module callback
 *
 * INPUTS:  
 *
 * OUTPUT:  
 *
 * RETURNS: OK if succeeded, NOK if failed in HW configuration. 
 ****************************************************************************/
void TnetwDrv_ConfigureCb (TI_HANDLE hTnetwDrv)
{
    TnetwDrv_t *pTnetwDrv = (TnetwDrv_t *)hTnetwDrv;

    /* Configure the Tx-HW-Queue module */
    txHwQueue_Config (pTnetwDrv->hTxHwQueue, pTnetwDrv->pInitTableCopy);
    
    /* Configure the TX XFER module */
    txXfer_config(pTnetwDrv->hTxXfer, pTnetwDrv->pInitTableCopy);
    
    /* Configure the MAC services */ 
    MacServices_config (pTnetwDrv->hMacServices, pTnetwDrv->pInitTableCopy);
    
#if !defined(GWSI_DRIVER) && !defined(GWSI_LIB)
    recoveryCtrl_config(pTnetwDrv->hRecoveryCtrl, 
                        pTnetwDrv->hReport,
                        pTnetwDrv->hTNETWIF,
                        pTnetwDrv->hTxXfer,     
                        pTnetwDrv->hRxXfer,     
                        pTnetwDrv->hTxResult,   
                        pTnetwDrv->hMacServices,
                        pTnetwDrv->hTxCtrlBlk,  
                        pTnetwDrv->hTxHwQueue,  
                        pTnetwDrv->hHalCtrl,    
                        pTnetwDrv->hHwIntr,     
                        pTnetwDrv->hWhalParams, 
                        pTnetwDrv->hCmdQueue,   
                        pTnetwDrv->hFwEvent,    
                        pTnetwDrv->hCmdMBox,
                        pTnetwDrv->hHwInit);

    hwInit_config(pTnetwDrv->hHwInit, pTnetwDrv->hReport, pTnetwDrv->hTNETWIF);
#endif
    /* Register the Data Path callback functions */
    TnetwDrv_Register_CB (pTnetwDrv, TNETW_DRIVER_TX_XFER_SEND_PKT_TRANSFER, (void *)TnetwDrv_TxXferDone, hTnetwDrv);

    /* Register the send packet debug callback */
  #ifdef TI_DBG
    TnetwDrv_Register_CB (pTnetwDrv, TNETW_DRIVER_TX_XFER_SEND_PKT_DEBUG, (void *)TnetwDrv_TxXferDebug, hTnetwDrv);
  #endif

    /* Register the send packet complete callback */
    TnetwDrv_Register_CB (pTnetwDrv, TNETW_DRIVER_TX_RESULT_SEND_PKT_COMPLETE, (void *)TnetwDrv_TxComplete, hTnetwDrv);

    /* Call user application configuration callback */
    if (pTnetwDrv->fUserConf)
        (*pTnetwDrv->fUserConf) (pTnetwDrv->hUser);

}
Esempio n. 2
0
TI_STATUS TWD_SetDefaults (TI_HANDLE hTWD, TTwdInitParams *pInitParams)
{
    TTwd         *pTWD = (TTwd *)hTWD;

    TWlanParams         *pWlanParams = &DB_WLAN(pTWD->hCmdBld);
    TKeepAliveList      *pKlvParams = &DB_KLV(pTWD->hCmdBld);
    IniFileRadioParam   *pRadioParams = &DB_RADIO(pTWD->hCmdBld);
    IniFileGeneralParam *pGenParams = &DB_GEN(pTWD->hCmdBld);
    TRateMngParams      *pRateMngParams = &DB_RM(pTWD->hCmdBld);
    TDmaParams          *pDmaParams = &DB_DMA(pTWD->hCmdBld);

    TI_UINT32            k, uIndex;
    int iParam;


    pTWD->bRecoveryEnabled = pInitParams->tGeneral.halCtrlRecoveryEnable;

    pWlanParams->PacketDetectionThreshold   = pInitParams->tGeneral.packetDetectionThreshold;
    pWlanParams->qosNullDataTemplateSize    = pInitParams->tGeneral.qosNullDataTemplateSize;
    pWlanParams->PsPollTemplateSize         = pInitParams->tGeneral.PsPollTemplateSize;
    pWlanParams->probeResponseTemplateSize  = pInitParams->tGeneral.probeResponseTemplateSize;
    pWlanParams->probeRequestTemplateSize   = pInitParams->tGeneral.probeRequestTemplateSize;
    pWlanParams->beaconTemplateSize         = pInitParams->tGeneral.beaconTemplateSize;
    pWlanParams->nullTemplateSize           = pInitParams->tGeneral.nullTemplateSize;
    pWlanParams->disconnTemplateSize        = pInitParams->tGeneral.disconnTemplateSize;
    pWlanParams->ArpRspTemplateSize         = pInitParams->tGeneral.ArpRspTemplateSize;

    /* Beacon broadcast options */
    pWlanParams->BcnBrcOptions.BeaconRxTimeout      = pInitParams->tGeneral.BeaconRxTimeout;
    pWlanParams->BcnBrcOptions.BroadcastRxTimeout   = pInitParams->tGeneral.BroadcastRxTimeout;
    pWlanParams->BcnBrcOptions.RxBroadcastInPs      = pInitParams->tGeneral.RxBroadcastInPs;
    pWlanParams->ConsecutivePsPollDeliveryFailureThreshold = pInitParams->tGeneral.ConsecutivePsPollDeliveryFailureThreshold;

    pWlanParams->RxDisableBroadcast         = pInitParams->tGeneral.halCtrlRxDisableBroadcast;
    pWlanParams->calibrationChannel2_4      = pInitParams->tGeneral.halCtrlCalibrationChannel2_4;
    pWlanParams->calibrationChannel5_0      = pInitParams->tGeneral.halCtrlCalibrationChannel5_0;

    /* Not used but need by Palau */
    pWlanParams->RtsThreshold               = pInitParams->tGeneral.halCtrlRtsThreshold;
    pWlanParams->CtsToSelf                  = CTS_TO_SELF_DISABLE;

    pWlanParams->WiFiWmmPS                  = pInitParams->tGeneral.WiFiWmmPS;

    pWlanParams->MaxTxMsduLifetime          = pInitParams->tGeneral.halCtrlMaxTxMsduLifetime;
    pWlanParams->MaxRxMsduLifetime          = pInitParams->tGeneral.halCtrlMaxRxMsduLifetime;

    pWlanParams->rxTimeOut.psPoll           = pInitParams->tGeneral.rxTimeOut.psPoll;
    pWlanParams->rxTimeOut.UPSD             = pInitParams->tGeneral.rxTimeOut.UPSD;

    /* RSSI/SNR Weights for Average calculations */
    pWlanParams->tRssiSnrWeights.rssiBeaconAverageWeight = pInitParams->tGeneral.uRssiBeaconAverageWeight;
    pWlanParams->tRssiSnrWeights.rssiPacketAverageWeight = pInitParams->tGeneral.uRssiPacketAverageWeight;
    pWlanParams->tRssiSnrWeights.snrBeaconAverageWeight  = pInitParams->tGeneral.uSnrBeaconAverageWeight ;
    pWlanParams->tRssiSnrWeights.snrPacketAverageWeight  = pInitParams->tGeneral.uSnrPacketAverageWeight ;

    /* PM config params */
    pWlanParams->uHostClkSettlingTime       = pInitParams->tGeneral.uHostClkSettlingTime;
    pWlanParams->uHostFastWakeupSupport     = pInitParams->tGeneral.uHostFastWakeupSupport;

    /* No used */
    pWlanParams->FragmentThreshold          = pInitParams->tGeneral.halCtrlFragThreshold;
    pWlanParams->ListenInterval             = (TI_UINT8)pInitParams->tGeneral.halCtrlListenInterval;
    pWlanParams->RateFallback               = pInitParams->tGeneral.halCtrlRateFallbackRetry;
    pWlanParams->MacClock                   = pInitParams->tGeneral.halCtrlMacClock;
    pWlanParams->ArmClock                   = pInitParams->tGeneral.halCtrlArmClock;

    /* Data interrupts pacing */
    pWlanParams->TxCompletePacingThreshold  = pInitParams->tGeneral.TxCompletePacingThreshold;
    pWlanParams->TxCompletePacingTimeout    = pInitParams->tGeneral.TxCompletePacingTimeout;
    pWlanParams->RxIntrPacingThreshold      = pInitParams->tGeneral.RxIntrPacingThreshold;
    pWlanParams->RxIntrPacingTimeout        = pInitParams->tGeneral.RxIntrPacingTimeout;

    /* Number of Rx mem-blocks to allocate in FW */
    pDmaParams->NumRxBlocks                 = pInitParams->tGeneral.uRxMemBlksNum;


    /* Configure ARP IP */
    pWlanParams->arpFilterType    = pInitParams->tArpIpFilter.filterType;
    IP_COPY (pWlanParams->arp_IP_addr, pInitParams->tArpIpFilter.addr);

    /* Configure address group */
    pWlanParams->numGroupAddrs = pInitParams->tMacAddrFilter.numOfMacAddresses;
    pWlanParams->isMacAddrFilteringnabled = pInitParams->tMacAddrFilter.isFilterEnabled;

    for (k = 0; k < pWlanParams->numGroupAddrs; k++)
    {
        MAC_COPY (pWlanParams->aGroupAddr[k], pInitParams->tMacAddrFilter.macAddrTable[k]);
    }


    /* CoexActivity Table */

    pWlanParams->tWlanParamsCoexActivityTable.numOfElements = 0;
    for (iParam=0; iParam < (int)pInitParams->tGeneral.halCoexActivityTable.numOfElements; iParam++)
    {
        TCoexActivity *pSaveCoex = &pWlanParams->tWlanParamsCoexActivityTable.entry[0];
        TCoexActivity *pParmCoex = &pInitParams->tGeneral.halCoexActivityTable.entry[0];
        int i, saveIndex;

        /* Check if to overwrite existing entry or put on last index */
        for (i=0; i<iParam; i++)
        {
            if ((pSaveCoex[i].activityId == pParmCoex[iParam].activityId) && (pSaveCoex[i].coexIp == pParmCoex[iParam].coexIp))
            {
                break;
            }
        }

        if (i == iParam)
        {
            /* new entry */
            saveIndex = pWlanParams->tWlanParamsCoexActivityTable.numOfElements;
            pWlanParams->tWlanParamsCoexActivityTable.numOfElements++;
        }
        else
        {
            /* overwrite existing */
            saveIndex = i;
        }


        pSaveCoex[saveIndex].coexIp          = pParmCoex[iParam].coexIp;
        pSaveCoex[saveIndex].activityId      = pParmCoex[iParam].activityId;
        pSaveCoex[saveIndex].defaultPriority = pParmCoex[iParam].defaultPriority;
        pSaveCoex[saveIndex].raisedPriority  = pParmCoex[iParam].raisedPriority;
        pSaveCoex[saveIndex].minService      = pParmCoex[iParam].minService;
        pSaveCoex[saveIndex].maxService      = pParmCoex[iParam].maxService;
    }

    /* configure keep-alive default mode to enabled */
    pKlvParams->enaDisFlag = TI_TRUE;
    for (uIndex = 0; uIndex < KLV_MAX_TMPL_NUM; uIndex++)
    {
        pKlvParams->keepAliveParams[ uIndex ].enaDisFlag = TI_FALSE;
    }

    /* Configure the TWD modules */
    rxXfer_SetDefaults (pTWD->hRxXfer, pInitParams);
    txXfer_SetDefaults (pTWD->hTxXfer, pInitParams);
    txHwQueue_Config (pTWD->hTxHwQueue, pInitParams);
    MacServices_config (pTWD->hMacServices, pInitParams);

    /*
     * 802.11n
     */
    pWlanParams->tTwdHtCapabilities.b11nEnable =            pInitParams->tGeneral.b11nEnable;
    /* Configure HT capabilities setting */
    pWlanParams->tTwdHtCapabilities.uChannelWidth =         CHANNEL_WIDTH_20MHZ;
    pWlanParams->tTwdHtCapabilities.uRxSTBC =               RXSTBC_SUPPORTED_ONE_SPATIAL_STREAM;
    pWlanParams->tTwdHtCapabilities.uMaxAMSDU =             MAX_MSDU_3839_OCTETS;
    pWlanParams->tTwdHtCapabilities.uMaxAMPDU =             MAX_MPDU_8191_OCTETS;
    pWlanParams->tTwdHtCapabilities.uAMPDUSpacing =         AMPDU_SPC_8_MICROSECONDS;
    pWlanParams->tTwdHtCapabilities.aRxMCS[0] =             (MCS_SUPPORT_MCS_0 |
            MCS_SUPPORT_MCS_1 |
            MCS_SUPPORT_MCS_2 |
            MCS_SUPPORT_MCS_3 |
            MCS_SUPPORT_MCS_4 |
            MCS_SUPPORT_MCS_5 |
            MCS_SUPPORT_MCS_6 |
            MCS_SUPPORT_MCS_7);
    os_memoryZero (pTWD->hOs, pWlanParams->tTwdHtCapabilities.aRxMCS + 1, RX_TX_MCS_BITMASK_SIZE - 1);
    pWlanParams->tTwdHtCapabilities.aTxMCS[0]  =             (MCS_SUPPORT_MCS_0 |
            MCS_SUPPORT_MCS_1 |
            MCS_SUPPORT_MCS_2 |
            MCS_SUPPORT_MCS_3 |
            MCS_SUPPORT_MCS_4 |
            MCS_SUPPORT_MCS_5 |
            MCS_SUPPORT_MCS_6 |
            MCS_SUPPORT_MCS_7);
    os_memoryZero (pTWD->hOs, pWlanParams->tTwdHtCapabilities.aTxMCS + 1, RX_TX_MCS_BITMASK_SIZE - 1);
    pWlanParams->tTwdHtCapabilities.uRxMaxDataRate =         MCS_HIGHEST_SUPPORTED_RECEPTION_DATA_RATE_IN_MBIT_S;
    pWlanParams->tTwdHtCapabilities.uPCOTransTime =          PCO_TRANS_TIME_NO_TRANSITION;
    pWlanParams->tTwdHtCapabilities.uHTCapabilitiesBitMask = (CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT |
            CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS);
    pWlanParams->tTwdHtCapabilities.uMCSFeedback =           MCS_FEEDBACK_NO;

    os_memoryCopy(pTWD->hOs, (void*)pRadioParams, (void*)&pInitParams->tIniFileRadioParams, sizeof(IniFileRadioParam));
    os_memoryCopy(pTWD->hOs, (void*)pGenParams, (void*)&pInitParams->tPlatformGenParams, sizeof(IniFileGeneralParam));

    os_memoryCopy (pTWD->hOs,
                   (void*)&(pWlanParams->tFmCoexParams),
                   (void*)&(pInitParams->tGeneral.tFmCoexParams),
                   sizeof(TFmCoexParams));

    /* Rate management params */
    pRateMngParams->rateMngParams.InverseCuriosityFactor = pInitParams->tRateMngParams.InverseCuriosityFactor;
    pRateMngParams->rateMngParams.MaxPer = pInitParams->tRateMngParams.MaxPer;
    pRateMngParams->rateMngParams.PerAdd = pInitParams->tRateMngParams.PerAdd;
    pRateMngParams->rateMngParams.PerAddShift = pInitParams->tRateMngParams.PerAddShift;
    pRateMngParams->rateMngParams.PerAlphaShift = pInitParams->tRateMngParams.PerAlphaShift;
    pRateMngParams->rateMngParams.PerBeta1Shift = pInitParams->tRateMngParams.PerBeta1Shift;
    pRateMngParams->rateMngParams.PerBeta2Shift = pInitParams->tRateMngParams.PerBeta2Shift;
    pRateMngParams->rateMngParams.PerTh1 = pInitParams->tRateMngParams.PerTh1;
    pRateMngParams->rateMngParams.PerTh2 = pInitParams->tRateMngParams.PerTh2;
    pRateMngParams->rateMngParams.RateCheckDown = pInitParams->tRateMngParams.RateCheckDown;
    pRateMngParams->rateMngParams.RateCheckUp = pInitParams->tRateMngParams.RateCheckUp;
    pRateMngParams->rateMngParams.RateRetryScore = pInitParams->tRateMngParams.RateRetryScore;
    pRateMngParams->rateMngParams.TxFailHighTh = pInitParams->tRateMngParams.TxFailHighTh;
    pRateMngParams->rateMngParams.TxFailLowTh = pInitParams->tRateMngParams.TxFailLowTh;

    /* RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN */
    for (uIndex = 0; uIndex < 13; uIndex++)
    {
        pRateMngParams->rateMngParams.RateRetryPolicy[uIndex] = pInitParams->tRateMngParams.RateRetryPolicy[uIndex];
    }

    /* DCO Itrim params */
    pWlanParams->dcoItrimEnabled = pInitParams->tDcoItrimParams.enable;
    pWlanParams->dcoItrimModerationTimeoutUsec = pInitParams->tDcoItrimParams.moderationTimeoutUsec;

    return TI_OK;
}