1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 ******************************************************************************/
19 #include <osdep_service.h>
20 #include <drv_types.h>
22 #define LED_BLINK_NO_LINK_INTERVAL_ALPHA 1000
23 #define LED_BLINK_LINK_INTERVAL_ALPHA 500 /* 500 */
24 #define LED_BLINK_SCAN_INTERVAL_ALPHA 180 /* 150 */
25 #define LED_BLINK_FASTER_INTERVAL_ALPHA 50
26 #define LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA 5000
36 LED_CTL_START_TO_LINK,
39 LED_CTL_START_WPS_BOTTON,
57 struct adapter *padapter;
59 enum LED_STATE_871x CurrLedState; /* Current LED state. */
60 enum LED_STATE_871x BlinkingLedState; /* Next state for blinking,
61 * either RTW_LED_ON or RTW_LED_OFF are. */
63 u8 bLedOn; /* true if LED is ON, false if LED is OFF. */
65 u8 bLedBlinkInProgress; /* true if it is blinking, false o.w.. */
67 u8 bLedWPSBlinkInProgress;
69 u32 BlinkTimes; /* Number of times to toggle led state for blinking. */
71 struct timer_list BlinkTimer; /* Timer object for led blinking. */
75 /* ALPHA, added by chiyoko, 20090106 */
76 u8 bLedNoLinkBlinkInProgress;
77 u8 bLedLinkBlinkInProgress;
78 u8 bLedStartToLinkBlinkInProgress;
79 u8 bLedScanBlinkInProgress;
80 struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer to
81 * manipulate H/W to blink LED. */
84 #define IS_LED_WPS_BLINKING(_LED_871x) \
85 (((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS || \
86 ((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP || \
87 ((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress)
89 void LedControl8188eu(struct adapter *padapter, enum LED_CTL_MODE LedAction);
92 /* add for led control */
93 struct LED_871x SwLed0;
95 void (*LedControlHandler)(struct adapter *padapter,
96 enum LED_CTL_MODE LedAction);
97 /* add for led control */
100 #define rtw_led_control(adapt, action) \
102 if ((adapt)->ledpriv.LedControlHandler) \
103 (adapt)->ledpriv.LedControlHandler((adapt), (action)); \
106 void BlinkTimerCallback(unsigned long data);
107 void BlinkWorkItemCallback(struct work_struct *work);
109 void ResetLedStatus(struct LED_871x *pLed);
111 void InitLed871x(struct adapter *padapter, struct LED_871x *pLed);
113 void DeInitLed871x(struct LED_871x *pLed);
116 void BlinkHandler(struct LED_871x *pLed);
117 void SwLedOn(struct adapter *padapter, struct LED_871x *pLed);
118 void SwLedOff(struct adapter *padapter, struct LED_871x *pLed);
120 #endif /* __RTW_LED_H_ */