RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / include / Common / led_control.h
blob042981e01be7606905a1dec85f1c928ecb36098f
1 /*
2 * led_control.h
4 *Copyright (C) 2010 Beceem Communications, Inc.
6 *This program is free software: you can redistribute it and/or modify
7 *it under the terms of the GNU General Public License version 2 as
8 *published by the Free Software Foundation.
10 *This program is distributed in the hope that it will be useful,but
11 *WITHOUT ANY WARRANTY; without even the implied warranty of
12 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *See the GNU General Public License for more details.
15 *You should have received a copy of the GNU General Public License
16 *along with this program. If not, write to the Free Software Foundation, Inc.,
17 *51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef _LED_CONTROL_H
23 #define _LED_CONTROL_H
25 /*************************TYPE DEF**********************/
26 #define NUM_OF_LEDS 4
28 #define DSD_START_OFFSET 0x0200
29 #define EEPROM_VERSION_OFFSET 0x020E
30 #define EEPROM_HW_PARAM_POINTER_ADDRESS 0x0218
31 #define EEPROM_HW_PARAM_POINTER_ADDRRES_MAP5 0x0220
32 #define GPIO_SECTION_START_OFFSET 0x03
34 #define COMPATIBILITY_SECTION_LENGTH 42
35 #define COMPATIBILITY_SECTION_LENGTH_MAP5 84
38 #define EEPROM_MAP5_MAJORVERSION 5
39 #define EEPROM_MAP5_MINORVERSION 0
42 #define MAX_NUM_OF_BLINKS 10
43 #define NUM_OF_GPIO_PINS 16
45 #define DISABLE_GPIO_NUM 0xFF
46 #define EVENT_SIGNALED 1
48 #define MAX_FILE_NAME_BUFFER_SIZE 100
50 #define TURN_ON_LED(GPIO, index) do{ \
51 UINT gpio_val = GPIO; \
52 (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \
53 wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_SET_REG, &gpio_val ,sizeof(gpio_val)) : \
54 wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \
55 }while(0);
57 #define TURN_OFF_LED(GPIO, index) do { \
58 UINT gpio_val = GPIO; \
59 (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \
60 wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_CLR_REG,&gpio_val ,sizeof(gpio_val)) : \
61 wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_SET_REG,&gpio_val ,sizeof(gpio_val)); \
62 }while(0);
64 #define B_ULONG32 unsigned long
66 /*******************************************************/
69 typedef enum _LEDColors{
70 RED_LED = 1,
71 BLUE_LED = 2,
72 YELLOW_LED = 3,
73 GREEN_LED = 4
74 } LEDColors; /*Enumerated values of different LED types*/
76 typedef enum LedEvents {
77 SHUTDOWN_EXIT = 0x00,
78 DRIVER_INIT = 0x1,
79 FW_DOWNLOAD = 0x2,
80 FW_DOWNLOAD_DONE = 0x4,
81 NO_NETWORK_ENTRY = 0x8,
82 NORMAL_OPERATION = 0x10,
83 LOWPOWER_MODE_ENTER = 0x20,
84 IDLEMODE_CONTINUE = 0x40,
85 IDLEMODE_EXIT = 0x80,
86 LED_THREAD_INACTIVE = 0x100, //Makes the LED thread Inactivce. It wil be equivallent to putting the thread on hold.
87 LED_THREAD_ACTIVE = 0x200 //Makes the LED Thread Active back.
88 } LedEventInfo_t; /*Enumerated values of different driver states*/
90 #define DRIVER_HALT 0xff
93 /*Structure which stores the information of different LED types
94 * and corresponding LED state information of driver states*/
95 typedef struct LedStateInfo_t
97 UCHAR LED_Type; /* specify GPIO number - use 0xFF if not used */
98 UCHAR LED_On_State; /* Bits set or reset for different states */
99 UCHAR LED_Blink_State; /* Bits set or reset for blinking LEDs for different states */
100 UCHAR GPIO_Num;
101 UCHAR BitPolarity; /*To represent whether H/W is normal polarity or reverse
102 polarity*/
103 }LEDStateInfo, *pLEDStateInfo;
106 typedef struct _LED_INFO_STRUCT
108 LEDStateInfo LEDState[NUM_OF_LEDS];
109 BOOLEAN bIdleMode_tx_from_host; /*Variable to notify whether driver came out
110 from idlemode due to Host or target*/
111 BOOLEAN bIdle_led_off;
112 wait_queue_head_t notify_led_event;
113 wait_queue_head_t idleModeSyncEvent;
114 struct task_struct *led_cntrl_threadid;
115 int led_thread_running;
116 BOOLEAN bLedInitDone;
118 } LED_INFO_STRUCT, *PLED_INFO_STRUCT;
119 //LED Thread state.
120 #define BCM_LED_THREAD_DISABLED 0 //LED Thread is not running.
121 #define BCM_LED_THREAD_RUNNING_ACTIVELY 1 //LED thread is running.
122 #define BCM_LED_THREAD_RUNNING_INACTIVELY 2 //LED thread has been put on hold
126 #endif