1 #ifndef _LED_CONTROL_H
2 #define _LED_CONTROL_H
3 
4 /*************************TYPE DEF**********************/
5 #define NUM_OF_LEDS 4
6 
7 #define DSD_START_OFFSET			0x0200
8 #define EEPROM_VERSION_OFFSET			0x020E
9 #define EEPROM_HW_PARAM_POINTER_ADDRESS		0x0218
10 #define EEPROM_HW_PARAM_POINTER_ADDRRES_MAP5	0x0220
11 #define GPIO_SECTION_START_OFFSET		0x03
12 
13 #define COMPATIBILITY_SECTION_LENGTH         42
14 #define COMPATIBILITY_SECTION_LENGTH_MAP5    84
15 
16 
17 #define EEPROM_MAP5_MAJORVERSION             5
18 #define EEPROM_MAP5_MINORVERSION             0
19 
20 
21 #define MAX_NUM_OF_BLINKS			10
22 #define NUM_OF_GPIO_PINS			16
23 
24 #define DISABLE_GPIO_NUM			0xFF
25 #define EVENT_SIGNALED				1
26 
27 #define MAX_FILE_NAME_BUFFER_SIZE		100
28 
29 #define TURN_ON_LED(GPIO, index) do { \
30 							UINT gpio_val = GPIO; \
31 							(Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \
32 							wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)) : \
33 							wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \
34 						} while (0);
35 
36 #define TURN_OFF_LED(GPIO, index)  do { \
37 							UINT gpio_val = GPIO; \
38 							(Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \
39 							wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)) : \
40 							wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val));  \
41 						} while (0);
42 
43 #define B_ULONG32 unsigned long
44 
45 /*******************************************************/
46 
47 
48 typedef enum _LEDColors{
49 	RED_LED = 1,
50 	BLUE_LED = 2,
51 	YELLOW_LED = 3,
52 	GREEN_LED = 4
53 } LEDColors;	/*Enumerated values of different LED types*/
54 
55 typedef enum LedEvents {
56 	SHUTDOWN_EXIT = 0x00,
57 	DRIVER_INIT = 0x1,
58 	FW_DOWNLOAD = 0x2,
59 	FW_DOWNLOAD_DONE = 0x4,
60 	NO_NETWORK_ENTRY = 0x8,
61 	NORMAL_OPERATION = 0x10,
62 	LOWPOWER_MODE_ENTER = 0x20,
63 	IDLEMODE_CONTINUE = 0x40,
64 	IDLEMODE_EXIT = 0x80,
65 	LED_THREAD_INACTIVE = 0x100,  /* Makes the LED thread Inactivce. It wil be equivallent to putting the thread on hold. */
66 	LED_THREAD_ACTIVE = 0x200,    /* Makes the LED Thread Active back. */
67 	DRIVER_HALT = 0xff
68 } LedEventInfo_t;	/* Enumerated values of different driver states */
69 
70 /*
71  * Structure which stores the information of different LED types
72  * and corresponding LED state information of driver states
73  */
74 typedef struct LedStateInfo_t {
75 	UCHAR LED_Type; /* specify GPIO number - use 0xFF if not used */
76 	UCHAR LED_On_State; /* Bits set or reset for different states */
77 	UCHAR LED_Blink_State; /* Bits set or reset for blinking LEDs for different states */
78 	UCHAR GPIO_Num;
79 	UCHAR BitPolarity; /* To represent whether H/W is normal polarity or reverse polarity */
80 } LEDStateInfo, *pLEDStateInfo;
81 
82 
83 typedef struct _LED_INFO_STRUCT {
84 	LEDStateInfo	LEDState[NUM_OF_LEDS];
85 	BOOLEAN		bIdleMode_tx_from_host; /* Variable to notify whether driver came out from idlemode due to Host or target*/
86 	BOOLEAN			bIdle_led_off;
87 	wait_queue_head_t   notify_led_event;
88 	wait_queue_head_t	idleModeSyncEvent;
89 	struct task_struct  *led_cntrl_threadid;
90 	int                 led_thread_running;
91 	BOOLEAN			bLedInitDone;
92 
93 } LED_INFO_STRUCT, *PLED_INFO_STRUCT;
94 /* LED Thread state. */
95 #define BCM_LED_THREAD_DISABLED		0 /* LED Thread is not running. */
96 #define BCM_LED_THREAD_RUNNING_ACTIVELY	1 /* LED thread is running. */
97 #define BCM_LED_THREAD_RUNNING_INACTIVELY 2 /*LED thread has been put on hold*/
98 
99 
100 
101 #endif
102 
103