int RtmpAsicSendCommandToSwMcu( IN RTMP_ADAPTER *pAd, IN UCHAR Command, IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1) { BBP_CSR_CFG_STRUC BbpCsr, BbpCsr2; int j, k; UINT16 Temp; #ifdef LED_CONTROL_SUPPORT PSWMCU_LED_CONTROL pSWMCULedCntl = &pAd->LedCntl.SWMCULedCntl; #endif // LED_CONTROL_SUPPORT // switch(Command) { case 0x80: RTMP_IO_READ32(pAd, H2M_BBP_AGENT, &BbpCsr.word); if ((BbpCsr.field.Busy != 1) || (BbpCsr.field.BBP_RW_MODE != 1)) DBGPRINT(RT_DEBUG_ERROR, ("error read write BBP 1\n")); for (j=0; j<MAX_BUSY_COUNT; j++) { RTMP_IO_READ32(pAd, BBP_CSR_CFG, &BbpCsr2.word); if (BbpCsr2.field.Busy == BUSY) { continue; } BbpCsr2.word = BbpCsr.word; RTMP_IO_WRITE32(pAd, BBP_CSR_CFG, BbpCsr2.word); if (BbpCsr.field.fRead == 1) { // read for (k=0; k<MAX_BUSY_COUNT; k++) { RTMP_IO_READ32(pAd, BBP_CSR_CFG, &BbpCsr2.word); if (BbpCsr2.field.Busy == IDLE) break; } if (k == MAX_BUSY_COUNT) DBGPRINT(RT_DEBUG_ERROR, ("error read write BBP 2\n")); if ((BbpCsr2.field.Busy == IDLE) && (BbpCsr2.field.RegNum == BbpCsr.field.RegNum)) { BbpCsr.field.Value = BbpCsr2.field.Value; BbpCsr.field.Busy = IDLE; RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, BbpCsr.word); break; } } else { //write BbpCsr.field.Busy = IDLE; RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, BbpCsr.word); pAd->BbpWriteLatch[BbpCsr.field.RegNum] = BbpCsr2.field.Value; break; } } if (j == MAX_BUSY_COUNT) { DBGPRINT(RT_DEBUG_ERROR, ("error read write BBP 3\n")); if (BbpCsr.field.Busy != IDLE) { BbpCsr.field.Busy = IDLE; RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, BbpCsr.word); } } break; case 0x30: break; case 0x31: break; #ifdef LED_CONTROL_SUPPORT #ifdef CONFIG_WIFI_LED_SHARE case MCU_SET_WPS_LED_MODE: pSWMCULedCntl->LedParameter.LedMode = Arg0; pSWMCULedCntl->LinkStatus = Arg1; SetWPSLinkStatus(pAd); break; #endif // CONFIG_WIFI_LED_SHARE // case MCU_SET_LED_MODE: pSWMCULedCntl->LedParameter.LedMode = Arg0; pSWMCULedCntl->LinkStatus = Arg1; SetLedLinkStatus(pAd); break; case MCU_SET_LED_GPIO_SIGNAL_CFG: pSWMCULedCntl->GPIOPolarity = Arg1; pSWMCULedCntl->SignalStrength = Arg0; break; case MCU_SET_LED_AG_CFG: Temp = ((UINT16)Arg1 << 8) | (UINT16)Arg0; NdisMoveMemory(&pSWMCULedCntl->LedParameter.LedAgCfg, &Temp, 2); break; case MCU_SET_LED_ACT_CFG: Temp = ((UINT16)Arg1 << 8) | (UINT16)Arg0; NdisMoveMemory(&pSWMCULedCntl->LedParameter.LedActCfg, &Temp, 2); break; case MCU_SET_LED_POLARITY: Temp = ((UINT16)Arg1 << 8) | (UINT16)Arg0; NdisMoveMemory(&pSWMCULedCntl->LedParameter.LedPolarityCfg, &Temp, 2); break; #endif // LED_CONTROL_SUPPORT // // 2880-SW-MCU #ifdef CONFIG_AP_SUPPORT #ifdef DFS_SUPPORT case 0x60: if (Arg0 == 0 && Arg1 == 0) { ULONG Value; pAd->CommonCfg.McuRadarCmd &= ~(RADAR_DETECTION); if (pAd->CommonCfg.McuRadarCmd == DETECTION_STOP) { DBGPRINT(RT_DEBUG_TRACE, ("AsicSendCommandToMcu 0x60 ==> stop detection\n")); #ifdef RTMP_RBUS_SUPPORT unregister_tmr_service(); #else BOOLEAN Cancelled; RTMPCancelTimer(&pAd->CommonCfg.CSWatchDogTimer, &Cancelled); #endif // RTMP_RBUS_SUPPORT // RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); Value |= 0x04; RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); } } else { if (!(pAd->CommonCfg.McuRadarCmd & RADAR_DETECTION)) { pAd->CommonCfg.McuRadarPeriod = Arg0; pAd->CommonCfg.McuRadarDetectPeriod = Arg1 & 0x1f; pAd->CommonCfg.McuRadarCtsProtect = (Arg1 & 0x60) >> 5; pAd->CommonCfg.McuRadarState = WAIT_CTS_BEING_SENT; pAd->CommonCfg.McuRadarTick = pAd->CommonCfg.McuRadarPeriod; pAd->CommonCfg.McuRadarDetectCount = 0; RTMPPrepareRDCTSFrame(pAd, pAd->CurrentAddress, (pAd->CommonCfg.McuRadarDetectPeriod * 1000 + 100), pAd->CommonCfg.RtsRate, HW_DFS_CTS_BASE, IFS_SIFS); if (pAd->CommonCfg.McuRadarCmd == DETECTION_STOP) { pAd->CommonCfg.McuRadarCmd |= RADAR_DETECTION; pAd->CommonCfg.McuRadarProtection = 0; #ifdef RTMP_RBUS_SUPPORT request_tmr_service(1, &TimerCB, pAd); #else RTMPInitTimer(pAd, &pAd->CommonCfg.CSWatchDogTimer, GET_TIMER_FUNCTION(TimerCB), pAd, TRUE); RTMPSetTimer(&pAd->CommonCfg.DFSWatchDogTimer, NEW_DFS_WATCH_DOG_TIME); #endif // DFS_ARCH_TEAM // } else pAd->CommonCfg.McuRadarCmd |= RADAR_DETECTION; #ifdef RTMP_RBUS_SUPPORT request_tmr_service(1, &TimerCB, pAd); #else RTMPInitTimer(pAd, &pAd->CommonCfg.CSWatchDogTimer, GET_TIMER_FUNCTION(TimerCB), pAd, TRUE); RTMPSetTimer(&pAd->CommonCfg.DFSWatchDogTimer, NEW_DFS_WATCH_DOG_TIME); #endif // DFS_ARCH_TEAM // } else { pAd->CommonCfg.McuRadarPeriod = Arg0; pAd->CommonCfg.McuRadarDetectPeriod = Arg1 & 0x1f; pAd->CommonCfg.McuRadarCtsProtect = (Arg1 & 0x60) >> 5; RTMPPrepareRDCTSFrame(pAd, pAd->CurrentAddress, (pAd->CommonCfg.McuRadarDetectPeriod * 1000 + 100), pAd->CommonCfg.RtsRate, HW_DFS_CTS_BASE, IFS_SIFS); } }
void __exit timer_cleanup_module(void) { printk("Unload Ralink DFS Timer Module\n"); unregister_tmr_service(); }