2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
2013-05-19 04:28:07 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
2013-05-19 04:28:07 +00:00
|
|
|
******************************************************************************/
|
|
|
|
#ifndef __RTW_LED_H_
|
|
|
|
#define __RTW_LED_H_
|
|
|
|
|
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
|
2013-08-15 21:11:51 +00:00
|
|
|
#define LED_BLINK_NO_LINK_INTERVAL_ALPHA 1000
|
|
|
|
#define LED_BLINK_LINK_INTERVAL_ALPHA 500 /* 500 */
|
2013-08-12 04:36:23 +00:00
|
|
|
#define LED_BLINK_SCAN_INTERVAL_ALPHA 180 /* 150 */
|
2013-05-19 04:28:07 +00:00
|
|
|
#define LED_BLINK_FASTER_INTERVAL_ALPHA 50
|
|
|
|
#define LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA 5000
|
|
|
|
|
2013-07-22 21:45:04 +00:00
|
|
|
enum LED_CTL_MODE {
|
2014-11-16 00:18:30 +00:00
|
|
|
LED_CTL_POWER_ON,
|
|
|
|
LED_CTL_LINK,
|
|
|
|
LED_CTL_NO_LINK,
|
|
|
|
LED_CTL_TX,
|
|
|
|
LED_CTL_RX ,
|
|
|
|
LED_CTL_SITE_SURVEY,
|
|
|
|
LED_CTL_POWER_OFF,
|
|
|
|
LED_CTL_START_TO_LINK,
|
|
|
|
LED_CTL_START_WPS,
|
|
|
|
LED_CTL_STOP_WPS,
|
|
|
|
LED_CTL_START_WPS_BOTTON,
|
|
|
|
LED_CTL_STOP_WPS_FAIL
|
2013-07-22 21:45:04 +00:00
|
|
|
};
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-22 21:49:13 +00:00
|
|
|
enum LED_STATE_871x {
|
2014-11-16 00:18:30 +00:00
|
|
|
LED_UNKNOWN,
|
|
|
|
RTW_LED_ON,
|
|
|
|
RTW_LED_OFF,
|
|
|
|
LED_BLINK_NORMAL,
|
|
|
|
LED_BLINK_SLOWLY,
|
|
|
|
LED_BLINK_POWER_ON,
|
|
|
|
LED_BLINK_SCAN,
|
|
|
|
LED_BLINK_TXRX,
|
|
|
|
LED_BLINK_WPS,
|
|
|
|
LED_BLINK_WPS_STOP
|
2013-07-22 21:52:57 +00:00
|
|
|
};
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-22 22:07:13 +00:00
|
|
|
struct LED_871x {
|
2013-08-15 21:11:51 +00:00
|
|
|
struct adapter *padapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-12 04:36:23 +00:00
|
|
|
enum LED_STATE_871x CurrLedState; /* Current LED state. */
|
2013-08-15 21:11:51 +00:00
|
|
|
enum LED_STATE_871x BlinkingLedState; /* Next state for blinking,
|
|
|
|
* either RTW_LED_ON or RTW_LED_OFF are. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-15 21:11:51 +00:00
|
|
|
u8 bLedOn; /* true if LED is ON, false if LED is OFF. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-15 21:11:51 +00:00
|
|
|
u8 bLedBlinkInProgress; /* true if it is blinking, false o.w.. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-15 21:11:51 +00:00
|
|
|
u8 bLedWPSBlinkInProgress;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-15 21:11:51 +00:00
|
|
|
u32 BlinkTimes; /* Number of times to toggle led state for blinking. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-12 04:36:23 +00:00
|
|
|
struct timer_list BlinkTimer; /* Timer object for led blinking. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-15 21:11:51 +00:00
|
|
|
u8 bSWLedCtrl;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-12 04:36:23 +00:00
|
|
|
/* ALPHA, added by chiyoko, 20090106 */
|
2013-08-15 21:11:51 +00:00
|
|
|
u8 bLedNoLinkBlinkInProgress;
|
|
|
|
u8 bLedLinkBlinkInProgress;
|
|
|
|
u8 bLedStartToLinkBlinkInProgress;
|
|
|
|
u8 bLedScanBlinkInProgress;
|
|
|
|
struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer to
|
|
|
|
* manipulate H/W to blink LED. */
|
2013-07-22 22:07:13 +00:00
|
|
|
};
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-15 21:11:51 +00:00
|
|
|
#define IS_LED_WPS_BLINKING(_LED_871x) \
|
|
|
|
(((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS || \
|
|
|
|
((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP || \
|
|
|
|
((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress)
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-10-19 17:45:47 +00:00
|
|
|
void LedControl8188eu(struct adapter *padapter, enum LED_CTL_MODE LedAction);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-28 17:08:37 +00:00
|
|
|
struct led_priv{
|
2013-11-29 22:10:20 +00:00
|
|
|
/* add for led control */
|
2013-07-22 22:07:13 +00:00
|
|
|
struct LED_871x SwLed0;
|
2013-08-15 21:11:51 +00:00
|
|
|
u8 bRegUseLed;
|
|
|
|
void (*LedControlHandler)(struct adapter *padapter,
|
|
|
|
enum LED_CTL_MODE LedAction);
|
2013-11-29 22:10:20 +00:00
|
|
|
/* add for led control */
|
2013-05-19 04:28:07 +00:00
|
|
|
};
|
|
|
|
|
2013-08-15 21:11:51 +00:00
|
|
|
#define rtw_led_control(adapt, action) \
|
2013-05-19 04:28:07 +00:00
|
|
|
do { \
|
2013-08-15 21:11:51 +00:00
|
|
|
if ((adapt)->ledpriv.LedControlHandler) \
|
|
|
|
(adapt)->ledpriv.LedControlHandler((adapt), (action)); \
|
2013-05-19 04:28:07 +00:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
void BlinkTimerCallback(void *data);
|
|
|
|
void BlinkWorkItemCallback(struct work_struct *work);
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
void ResetLedStatus(struct LED_871x *pLed);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
void InitLed871x(struct adapter *padapter, struct LED_871x *pLed);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
void DeInitLed871x(struct LED_871x *pLed);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-12 04:36:23 +00:00
|
|
|
/* hal... */
|
2014-11-16 00:18:30 +00:00
|
|
|
void BlinkHandler(struct LED_871x *pLed);
|
2013-08-15 21:11:51 +00:00
|
|
|
void SwLedOn(struct adapter *padapter, struct LED_871x *pLed);
|
2013-07-29 20:06:54 +00:00
|
|
|
void SwLedOff(struct adapter *padapter, struct LED_871x *pLed);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-12 04:36:23 +00:00
|
|
|
#endif /* __RTW_LED_H_ */
|