/* LED indication for normal connection completion. */ VOID LEDConnectionCompletion(RTMP_ADAPTER *pAd, BOOLEAN bSuccess) { /* LED indication. */ /*if (pAd->StaCfg.WscControl.bWPSSession == FALSE) */ if (pAd->StaCfg.WscControl.WscConfMode == WSC_DISABLE) { if (LED_MODE(pAd) == WPS_LED_MODE_9) /* LED mode 9. */ { UCHAR WPSLEDStatus = 0; if (bSuccess == TRUE) /* Successful connenction. */ { /* The AP uses OPEN-NONE. */ if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeOpen) && (pAd->StaCfg.WepStatus == Ndis802_11WEPDisabled)) WPSLEDStatus = LED_NORMAL_CONNECTION_WITHOUT_SECURITY; else /* The AP uses an encryption algorithm. */ WPSLEDStatus = LED_NORMAL_CONNECTION_WITH_SECURITY; } else /* Connection failure. */ WPSLEDStatus = LED_WPS_TURN_LED_OFF; RTMPSetLED(pAd, WPSLEDStatus); MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s: %d\n", __FUNCTION__, WPSLEDStatus)); } } }
/* LED indication for normal connection start. */ VOID LEDConnectionStart(RTMP_ADAPTER *pAd) { /* LED indication. */ /*if (pAd->StaCfg.WscControl.bWPSSession == FALSE) */ /*if (pAd->StaCfg.WscControl.WscConfMode != WSC_DISABLE && pAd->StaCfg.WscControl.bWscTrigger) */ if (pAd->StaCfg.WscControl.WscConfMode == WSC_DISABLE) { if (LED_MODE(pAd) == WPS_LED_MODE_9) /* LED mode 9. */ { UCHAR WPSLEDStatus = 0; /* The AP uses OPEN-NONE. */ if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeOpen) && (pAd->StaCfg.WepStatus == Ndis802_11WEPDisabled)) WPSLEDStatus = LED_WPS_TURN_LED_OFF; else /* The AP uses an encryption algorithm. */ WPSLEDStatus = LED_WPS_IN_PROCESS; RTMPSetLED(pAd, WPSLEDStatus); MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s: %d\n", __FUNCTION__, WPSLEDStatus)); } } }
/* ======================================================================== Routine Description: Set LED Status Arguments: pAd Pointer to our adapter Status LED Status Return Value: None IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL Note: ======================================================================== */ VOID RTMPSetLEDStatus(RTMP_ADAPTER *pAd, UCHAR Status) { /*ULONG data; */ UCHAR LinkStatus = 0; UCHAR LedMode; UCHAR MCUCmd = 0; BOOLEAN bIgnored = FALSE; #ifdef MT7628 INT LED_CMD = -1; #endif /*MT7628*/ #ifdef WSC_INCLUDED #ifdef WSC_LED_SUPPORT PWSC_CTRL pWscControl = NULL; #ifdef CONFIG_AP_SUPPORT pWscControl = &pAd->ApCfg.MBSSID[MAIN_MBSSID].WscControl; #endif /* CONFIG_AP_SUPPORT */ #ifdef CONFIG_STA_SUPPORT pWscControl = &pAd->StaCfg.WscControl; #endif /* CONFIG_STA_SUPPORT */ #endif /* WSC_LED_SUPPORT */ #endif /* WSC_INCLUDED */ #ifdef CONFIG_ATE /* In ATE mode of RT2860 AP/STA, we have erased 8051 firmware. So LED mode is not supported when ATE is running. */ if (!IS_RT3572(pAd)) { if (ATE_ON(pAd)) return; } #endif /* CONFIG_ATE */ LedMode = 1;//LED_MODE(pAd); #ifdef MT7628 if (IS_MT7603(pAd) || IS_MT7628(pAd)) { if (LedMode < 0 || Status <0 || LedMode > 15 || Status > 11) return; else LED_CMD = LED_Array[LedMode][Status]; } #endif /*MT7628*/ switch (Status) { case LED_LINK_DOWN: LinkStatus = LINK_STATUS_LINK_DOWN; pAd->LedCntl.LedIndicatorStrength = 0; MCUCmd = MCU_SET_LED_MODE; break; case LED_LINK_UP: if (pAd->CommonCfg.Channel > 14) LinkStatus = LINK_STATUS_ABAND_LINK_UP; else LinkStatus = LINK_STATUS_GBAND_LINK_UP; MCUCmd = MCU_SET_LED_MODE; break; case LED_RADIO_ON: LinkStatus = LINK_STATUS_RADIO_ON; MCUCmd = MCU_SET_LED_MODE; break; case LED_HALT: LedMode = 0; /* Driver sets MAC register and MAC controls LED */ case LED_RADIO_OFF: LinkStatus = LINK_STATUS_RADIO_OFF; MCUCmd = MCU_SET_LED_MODE; break; case LED_WPS: LinkStatus = LINK_STATUS_WPS; MCUCmd = MCU_SET_LED_MODE; break; case LED_ON_SITE_SURVEY: LinkStatus = LINK_STATUS_ON_SITE_SURVEY; MCUCmd = MCU_SET_LED_MODE; break; case LED_POWER_UP: LinkStatus = LINK_STATUS_POWER_UP; MCUCmd = MCU_SET_LED_MODE; break; #ifdef CONFIG_ATE #endif /* CONFIG_ATE */ #ifdef WSC_INCLUDED #ifdef WSC_LED_SUPPORT case LED_WPS_IN_PROCESS: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_IN_PROCESS; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_IN_PROCESS; MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s: LED_WPS_IN_PROCESS\n", __FUNCTION__)); } else bIgnored = TRUE; break; case LED_WPS_ERROR: if (WscSupportWPSLEDMode(pAd)) { /* In the case of LED mode 9, the error LED should be turned on only after WPS walk time expiration. */ if ((pWscControl->bWPSWalkTimeExpiration == FALSE) && (LED_MODE(pAd) == WPS_LED_MODE_9)) { /* do nothing. */ } else { LinkStatus = LINK_STATUS_WPS_ERROR; MCUCmd = MCU_SET_WPS_LED_MODE; } pWscControl->WscLEDMode = LED_WPS_ERROR; pWscControl->WscLastWarningLEDMode = LED_WPS_ERROR; } else bIgnored = TRUE; break; case LED_WPS_SESSION_OVERLAP_DETECTED: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_SESSION_OVERLAP_DETECTED; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SESSION_OVERLAP_DETECTED; pWscControl->WscLastWarningLEDMode = LED_WPS_SESSION_OVERLAP_DETECTED; } else bIgnored = TRUE; break; case LED_WPS_SUCCESS: if (WscSupportWPSLEDMode(pAd)) { if ((LED_MODE(pAd) == WPS_LED_MODE_7) || (LED_MODE(pAd) == WPS_LED_MODE_11) || (LED_MODE(pAd) == WPS_LED_MODE_12) ) { /* In the WPS LED mode 7, 11 and 12, the blue LED would last 300 seconds regardless of the AP's security settings. */ LinkStatus = LINK_STATUS_WPS_SUCCESS_WITH_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; /* Turn off the WPS successful LED pattern after 300 seconds. */ RTMPSetTimer(&pWscControl->WscLEDTimer, WSC_SUCCESSFUL_LED_PATTERN_TIMEOUT); } else if (LED_MODE(pAd) == WPS_LED_MODE_8) /* The WPS LED mode 8 */ { if (WscAPHasSecuritySetting(pAd, pWscControl)) /* The WPS AP has the security setting. */ { LinkStatus = LINK_STATUS_WPS_SUCCESS_WITH_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; /* Turn off the WPS successful LED pattern after 300 seconds. */ RTMPSetTimer(&pWscControl->WscLEDTimer, WSC_SUCCESSFUL_LED_PATTERN_TIMEOUT); } else /* The WPS AP does not have the secuirty setting. */ { LinkStatus = LINK_STATUS_WPS_SUCCESS_WITHOUT_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; /* Turn off the WPS successful LED pattern after 300 seconds. */ RTMPSetTimer(&pWscControl->WscLEDTimer, WSC_SUCCESSFUL_LED_PATTERN_TIMEOUT); } } else if (LED_MODE(pAd) == WPS_LED_MODE_9) /* The WPS LED mode 9. */ { /* Always turn on the WPS blue LED for 300 seconds. */ LinkStatus = LINK_STATUS_WPS_BLUE_LED; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; /* Turn off the WPS successful LED pattern after 300 seconds. */ RTMPSetTimer(&pWscControl->WscLEDTimer, WSC_SUCCESSFUL_LED_PATTERN_TIMEOUT); } else { MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s: LED_WPS_SUCCESS (Incorrect LED mode = %d)\n", __FUNCTION__, LED_MODE(pAd))); ASSERT(FALSE); } } else bIgnored = TRUE; break; case LED_WPS_TURN_LED_OFF: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_TURN_LED_OFF; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_TURN_LED_OFF; } else bIgnored = TRUE; break; case LED_WPS_TURN_ON_BLUE_LED: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_BLUE_LED; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; } else bIgnored = TRUE; break; case LED_NORMAL_CONNECTION_WITHOUT_SECURITY: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_NORMAL_CONNECTION_WITHOUT_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; } else bIgnored = TRUE; break; case LED_NORMAL_CONNECTION_WITH_SECURITY: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_NORMAL_CONNECTION_WITH_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; } else bIgnored = TRUE; break; /*WPS LED Mode 10 */ case LED_WPS_MODE10_TURN_ON: if(WscSupportWPSLEDMode10(pAd)) { LinkStatus = LINK_STATUS_WPS_MODE10_TURN_ON; MCUCmd = MCU_SET_WPS_LED_MODE; } else bIgnored = TRUE; break; case LED_WPS_MODE10_FLASH: if(WscSupportWPSLEDMode10(pAd)) { LinkStatus = LINK_STATUS_WPS_MODE10_FLASH; MCUCmd = MCU_SET_WPS_LED_MODE; } else bIgnored = TRUE; break; case LED_WPS_MODE10_TURN_OFF: if(WscSupportWPSLEDMode10(pAd)) { LinkStatus = LINK_STATUS_WPS_MODE10_TURN_OFF; MCUCmd = MCU_SET_WPS_LED_MODE;; } else bIgnored = TRUE; break; #endif /* WSC_LED_SUPPORT */ #endif /* WSC_INCLUDED */ default: MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_WARN, ("RTMPSetLED::Unknown Status 0x%x\n", Status)); break; } #ifdef MT7628 if (IS_MT7628(pAd)) { AndesLedEnhanceOP(pAd, 0, 0, 0, LED_CMD); MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s: LED_CMD:0x%x, LED Mode:0x%x, LinkStatus:0x%x\n", __FUNCTION__, LED_CMD, LedMode, LinkStatus)); } else #endif /*MT7628*/ if (MCUCmd) { AsicSendCommandToMcu(pAd, MCUCmd, 0xff, LedMode, LinkStatus, FALSE); MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s: MCUCmd:0x%x, LED Mode:0x%x, LinkStatus:0x%x\n", __FUNCTION__, MCUCmd, LedMode, LinkStatus)); } /* Keep LED status for LED SiteSurvey mode. After SiteSurvey, we will set the LED mode to previous status. */ if ((Status != LED_ON_SITE_SURVEY) && (Status != LED_POWER_UP) && (bIgnored == FALSE)) pAd->LedCntl.LedStatus = Status; }
/* ======================================================================== Routine Description: Set LED Status Arguments: pAd Pointer to our adapter Status LED Status Return Value: None IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL Note: ======================================================================== */ VOID RTMPSetLEDStatus( IN PRTMP_ADAPTER pAd, IN UCHAR Status) { /*ULONG data; */ UCHAR LinkStatus = 0; UCHAR LedMode; UCHAR MCUCmd = 0; BOOLEAN bIgnored = FALSE; #ifdef WSC_INCLUDED #ifdef WSC_LED_SUPPORT PWSC_CTRL pWscControl = NULL; #ifdef CONFIG_AP_SUPPORT pWscControl = &pAd->ApCfg.MBSSID[MAIN_MBSSID].WscControl; #endif /* CONFIG_AP_SUPPORT */ #ifdef CONFIG_STA_SUPPORT pWscControl = &pAd->StaCfg.WscControl; #endif /* CONFIG_STA_SUPPORT */ #endif /* WSC_LED_SUPPORT */ #endif /* WSC_INCLUDED */ #ifdef RALINK_ATE /* In ATE mode of RT2860 AP/STA, we have erased 8051 firmware. So LED mode is not supported when ATE is running. */ if (!IS_RT3572(pAd)) { if (ATE_ON(pAd)) return; } #endif /* RALINK_ATE */ LedMode = LED_MODE(pAd); switch (Status) { case LED_LINK_DOWN: LinkStatus = LINK_STATUS_LINK_DOWN; pAd->LedCntl.LedIndicatorStrength = 0; MCUCmd = MCU_SET_LED_MODE; break; case LED_LINK_UP: if (pAd->CommonCfg.Channel > 14) LinkStatus = LINK_STATUS_ABAND_LINK_UP; else LinkStatus = LINK_STATUS_GBAND_LINK_UP; MCUCmd = MCU_SET_LED_MODE; break; case LED_RADIO_ON: LinkStatus = LINK_STATUS_RADIO_ON; MCUCmd = MCU_SET_LED_MODE; break; case LED_HALT: LedMode = 0; /* Driver sets MAC register and MAC controls LED */ case LED_RADIO_OFF: LinkStatus = LINK_STATUS_RADIO_OFF; MCUCmd = MCU_SET_LED_MODE; break; case LED_WPS: LinkStatus = LINK_STATUS_WPS; MCUCmd = MCU_SET_LED_MODE; break; case LED_ON_SITE_SURVEY: LinkStatus = LINK_STATUS_ON_SITE_SURVEY; MCUCmd = MCU_SET_LED_MODE; break; case LED_POWER_UP: LinkStatus = LINK_STATUS_POWER_UP; MCUCmd = MCU_SET_LED_MODE; break; #ifdef RALINK_ATE #endif /* RALINK_ATE */ #ifdef WSC_INCLUDED #ifdef WSC_LED_SUPPORT #ifdef CONFIG_WIFI_LED_SHARE case LED_WPS_PRE_STAGE: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_PRE_STAGE; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_PRE_STAGE; } else bIgnored = TRUE; break; case LED_WPS_POST_STAGE: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_PRE_STAGE; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_POST_STAGE; } else bIgnored = TRUE; break; #endif /* CONFIG_WIFI_LED_SHARE */ case LED_WPS_IN_PROCESS: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_IN_PROCESS; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_IN_PROCESS; DBGPRINT(RT_DEBUG_TRACE, ("%s: LED_WPS_IN_PROCESS\n", __FUNCTION__)); } else bIgnored = TRUE; break; case LED_WPS_ERROR: if (WscSupportWPSLEDMode(pAd)) { /* In the case of LED mode 9, the error LED should be turned on only after WPS walk time expiration. */ if ((pWscControl->bWPSWalkTimeExpiration == FALSE) && (LED_MODE(pAd) == WPS_LED_MODE_9)) { /* do nothing. */ } else { LinkStatus = LINK_STATUS_WPS_ERROR; MCUCmd = MCU_SET_WPS_LED_MODE; } pWscControl->WscLEDMode = LED_WPS_ERROR; pWscControl->WscLastWarningLEDMode = LED_WPS_ERROR; } else bIgnored = TRUE; break; case LED_WPS_SESSION_OVERLAP_DETECTED: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_SESSION_OVERLAP_DETECTED; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SESSION_OVERLAP_DETECTED; pWscControl->WscLastWarningLEDMode = LED_WPS_SESSION_OVERLAP_DETECTED; } else bIgnored = TRUE; break; case LED_WPS_SUCCESS: if (WscSupportWPSLEDMode(pAd)) { if ((LED_MODE(pAd) == WPS_LED_MODE_7) || (LED_MODE(pAd) == WPS_LED_MODE_11) || (LED_MODE(pAd) == WPS_LED_MODE_12) #ifdef CONFIG_WIFI_LED_SHARE ||(LED_MODE(pAd) == WPS_LED_MODE_SHARE) #endif /* CONFIG_WIFI_LED_SHARE */ ) { /* In the WPS LED mode 7, 11 and 12, the blue LED would last 300 seconds regardless of the AP's security settings. */ LinkStatus = LINK_STATUS_WPS_SUCCESS_WITH_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; /* Turn off the WPS successful LED pattern after 300 seconds. */ RTMPSetTimer(&pWscControl->WscLEDTimer, WSC_SUCCESSFUL_LED_PATTERN_TIMEOUT); } else if (LED_MODE(pAd) == WPS_LED_MODE_8) /* The WPS LED mode 8 */ { if (WscAPHasSecuritySetting(pAd, pWscControl)) /* The WPS AP has the security setting. */ { LinkStatus = LINK_STATUS_WPS_SUCCESS_WITH_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; /* Turn off the WPS successful LED pattern after 300 seconds. */ RTMPSetTimer(&pWscControl->WscLEDTimer, WSC_SUCCESSFUL_LED_PATTERN_TIMEOUT); } else /* The WPS AP does not have the secuirty setting. */ { LinkStatus = LINK_STATUS_WPS_SUCCESS_WITHOUT_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; /* Turn off the WPS successful LED pattern after 300 seconds. */ RTMPSetTimer(&pWscControl->WscLEDTimer, WSC_SUCCESSFUL_LED_PATTERN_TIMEOUT); } } else if (LED_MODE(pAd) == WPS_LED_MODE_9) /* The WPS LED mode 9. */ { /* Always turn on the WPS blue LED for 300 seconds. */ LinkStatus = LINK_STATUS_WPS_BLUE_LED; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; /* Turn off the WPS successful LED pattern after 300 seconds. */ RTMPSetTimer(&pWscControl->WscLEDTimer, WSC_SUCCESSFUL_LED_PATTERN_TIMEOUT); } else { DBGPRINT(RT_DEBUG_TRACE, ("%s: LED_WPS_SUCCESS (Incorrect LED mode = %d)\n", __FUNCTION__, LED_MODE(pAd))); ASSERT(FALSE); } } else bIgnored = TRUE; break; case LED_WPS_TURN_LED_OFF: if (WscSupportWPSLEDMode(pAd)) { #ifdef CONFIG_WIFI_LED_SHARE USHORT value; RT28xx_EEPROM_READ16(pAd, EEPROM_FREQ_OFFSET, value); pAd->LedCntl.MCULedCntl.word = (value >> 8); #endif /* CONFIG_WIFI_LED_SHARE */ LinkStatus = LINK_STATUS_WPS_TURN_LED_OFF; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_TURN_LED_OFF; } else bIgnored = TRUE; break; case LED_WPS_TURN_ON_BLUE_LED: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_WPS_BLUE_LED; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; } else bIgnored = TRUE; break; case LED_NORMAL_CONNECTION_WITHOUT_SECURITY: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_NORMAL_CONNECTION_WITHOUT_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; } else bIgnored = TRUE; break; case LED_NORMAL_CONNECTION_WITH_SECURITY: if (WscSupportWPSLEDMode(pAd)) { LinkStatus = LINK_STATUS_NORMAL_CONNECTION_WITH_SECURITY; MCUCmd = MCU_SET_WPS_LED_MODE; pWscControl->WscLEDMode = LED_WPS_SUCCESS; } else bIgnored = TRUE; break; /*WPS LED Mode 10 */ case LED_WPS_MODE10_TURN_ON: if(WscSupportWPSLEDMode10(pAd)) { LinkStatus = LINK_STATUS_WPS_MODE10_TURN_ON; MCUCmd = MCU_SET_WPS_LED_MODE; } else bIgnored = TRUE; break; case LED_WPS_MODE10_FLASH: if(WscSupportWPSLEDMode10(pAd)) { LinkStatus = LINK_STATUS_WPS_MODE10_FLASH; MCUCmd = MCU_SET_WPS_LED_MODE; } else bIgnored = TRUE; break; case LED_WPS_MODE10_TURN_OFF: if(WscSupportWPSLEDMode10(pAd)) { LinkStatus = LINK_STATUS_WPS_MODE10_TURN_OFF; MCUCmd = MCU_SET_WPS_LED_MODE;; } else bIgnored = TRUE; break; #endif /* WSC_LED_SUPPORT */ #endif /* WSC_INCLUDED */ default: DBGPRINT(RT_DEBUG_WARN, ("RTMPSetLED::Unknown Status 0x%x\n", Status)); break; }
/* ======================================================================== Routine Description: Set LED Status Arguments: pAd Pointer to our adapter Status LED Status Return Value: None IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL Note: ======================================================================== */ VOID RTMPSetLEDStatus( IN PRTMP_ADAPTER pAd, IN UCHAR Status) { /*ULONG data; */ UCHAR LinkStatus = 0; UCHAR LedMode; UCHAR MCUCmd = 0; BOOLEAN bIgnored = FALSE; #ifdef RALINK_ATE /* In ATE mode of RT2860 AP/STA, we have erased 8051 firmware. So LED mode is not supported when ATE is running. */ if (!IS_RT3572(pAd)) { if (ATE_ON(pAd)) return; } #endif /* RALINK_ATE */ LedMode = LED_MODE(pAd); switch (Status) { case LED_LINK_DOWN: LinkStatus = LINK_STATUS_LINK_DOWN; pAd->LedCntl.LedIndicatorStrength = 0; MCUCmd = MCU_SET_LED_MODE; break; case LED_LINK_UP: if (pAd->CommonCfg.Channel > 14) LinkStatus = LINK_STATUS_ABAND_LINK_UP; else LinkStatus = LINK_STATUS_GBAND_LINK_UP; MCUCmd = MCU_SET_LED_MODE; break; case LED_RADIO_ON: LinkStatus = LINK_STATUS_RADIO_ON; MCUCmd = MCU_SET_LED_MODE; break; case LED_HALT: LedMode = 0; /* Driver sets MAC register and MAC controls LED */ case LED_RADIO_OFF: LinkStatus = LINK_STATUS_RADIO_OFF; MCUCmd = MCU_SET_LED_MODE; break; case LED_WPS: LinkStatus = LINK_STATUS_WPS; MCUCmd = MCU_SET_LED_MODE; break; case LED_ON_SITE_SURVEY: LinkStatus = LINK_STATUS_ON_SITE_SURVEY; MCUCmd = MCU_SET_LED_MODE; break; case LED_POWER_UP: LinkStatus = LINK_STATUS_POWER_UP; MCUCmd = MCU_SET_LED_MODE; break; #ifdef RALINK_ATE #endif /* RALINK_ATE */ default: DBGPRINT(RT_DEBUG_WARN, ("RTMPSetLED::Unknown Status 0x%x\n", Status)); break; } if (MCUCmd) { AsicSendCommandToMcu(pAd, MCUCmd, 0xff, LedMode, LinkStatus); DBGPRINT(RT_DEBUG_TRACE, ("%s: MCUCmd:0x%x, LED Mode:0x%x, LinkStatus:0x%x\n", __FUNCTION__, MCUCmd, LedMode, LinkStatus)); } /* */ /* Keep LED status for LED SiteSurvey mode. */ /* After SiteSurvey, we will set the LED mode to previous status. */ /* */ if ((Status != LED_ON_SITE_SURVEY) && (Status != LED_POWER_UP) && (bIgnored == FALSE)) pAd->LedCntl.LedStatus = Status; }
/* ======================================================================== Routine Description: Set LED Status Arguments: pAd Pointer to our adapter Status LED Status Return Value: None IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL Note: ======================================================================== */ VOID RTMPSetLEDStatus( IN PRTMP_ADAPTER pAd, IN UCHAR Status) { /*ULONG data; */ UCHAR LinkStatus = 0; UCHAR LedMode; UCHAR MCUCmd = 0; unsigned char bIgnored = FALSE; INT LED_CMD = -1; #ifdef RALINK_ATE /* In ATE mode of RT2860 AP/STA, we have erased 8051 firmware. So LED mode is not supported when ATE is running. */ if (!IS_RT3572(pAd)) { if (ATE_ON(pAd)) return; } #endif /* RALINK_ATE */ #ifdef RTMP_MAC_USB #ifdef STATS_COUNT_SUPPORT if(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) return; #endif /* STATS_COUNT_SUPPORT */ #endif /* RTMP_MAC_USB */ LedMode = LED_MODE(pAd); if (IS_MT76x0(pAd)) { if (LedMode < 0 || Status < 0 || LedMode > 15 || Status > 11) return; LED_CMD = LED_Array[LedMode][Status]; } switch (Status) { case LED_LINK_DOWN: LinkStatus = LINK_STATUS_LINK_DOWN; pAd->LedCntl.LedIndicatorStrength = 0; MCUCmd = MCU_SET_LED_MODE; break; case LED_LINK_UP: if (pAd->CommonCfg.Channel > 14) LinkStatus = LINK_STATUS_ABAND_LINK_UP; else LinkStatus = LINK_STATUS_GBAND_LINK_UP; MCUCmd = MCU_SET_LED_MODE; break; case LED_RADIO_ON: LinkStatus = LINK_STATUS_RADIO_ON; MCUCmd = MCU_SET_LED_MODE; break; case LED_HALT: LedMode = 0; /* Driver sets MAC register and MAC controls LED */ case LED_RADIO_OFF: LinkStatus = LINK_STATUS_RADIO_OFF; MCUCmd = MCU_SET_LED_MODE; break; case LED_WPS: LinkStatus = LINK_STATUS_WPS; MCUCmd = MCU_SET_LED_MODE; break; case LED_ON_SITE_SURVEY: LinkStatus = LINK_STATUS_ON_SITE_SURVEY; MCUCmd = MCU_SET_LED_MODE; break; case LED_POWER_UP: LinkStatus = LINK_STATUS_POWER_UP; MCUCmd = MCU_SET_LED_MODE; break; #ifdef RALINK_ATE #endif /* RALINK_ATE */ default: DBGPRINT(RT_DEBUG_WARN, ("RTMPSetLED::Unknown Status 0x%x\n", Status)); break; } if (IS_MT76x0(pAd)) { if (LED_CMD != -1) andes_led_op(pAd, 0, LED_CMD); } else { if (MCUCmd) AsicSendCommandToMcu(pAd, MCUCmd, 0xff, LedMode, LinkStatus, FALSE); } DBGPRINT(RT_DEBUG_TRACE, ("%s: MCUCmd:0x%x, LED Mode:0x%x, LinkStatus:0x%x\n", __FUNCTION__, MCUCmd, LedMode, LinkStatus)); /* */ /* Keep LED status for LED SiteSurvey mode. */ /* After SiteSurvey, we will set the LED mode to previous status. */ /* */ if ((Status != LED_ON_SITE_SURVEY) && (Status != LED_POWER_UP) && (bIgnored == FALSE)) pAd->LedCntl.LedStatus = Status; }