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