xref: /linux/drivers/net/wireless/ti/wl12xx/event.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 /*
2  * This file is part of wl12xx
3  *
4  * Copyright (C) 2012 Texas Instruments. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * version 2 as published by the Free Software Foundation.
9  *
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.  See the GNU
13  * General Public License for more details.
14  *
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
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18  * 02110-1301 USA
19  *
20  */
21 
22 #ifndef __WL12XX_EVENT_H__
23 #define __WL12XX_EVENT_H__
24 
25 #include "../wlcore/wlcore.h"
26 
27 enum {
28 	MEASUREMENT_START_EVENT_ID		 = BIT(8),
29 	MEASUREMENT_COMPLETE_EVENT_ID		 = BIT(9),
30 	SCAN_COMPLETE_EVENT_ID			 = BIT(10),
31 	WFD_DISCOVERY_COMPLETE_EVENT_ID		 = BIT(11),
32 	AP_DISCOVERY_COMPLETE_EVENT_ID		 = BIT(12),
33 	RESERVED1			         = BIT(13),
34 	PSPOLL_DELIVERY_FAILURE_EVENT_ID	 = BIT(14),
35 	ROLE_STOP_COMPLETE_EVENT_ID		 = BIT(15),
36 	RADAR_DETECTED_EVENT_ID                  = BIT(16),
37 	CHANNEL_SWITCH_COMPLETE_EVENT_ID	 = BIT(17),
38 	BSS_LOSE_EVENT_ID			 = BIT(18),
39 	REGAINED_BSS_EVENT_ID			 = BIT(19),
40 	MAX_TX_RETRY_EVENT_ID			 = BIT(20),
41 	DUMMY_PACKET_EVENT_ID			 = BIT(21),
42 	SOFT_GEMINI_SENSE_EVENT_ID		 = BIT(22),
43 	CHANGE_AUTO_MODE_TIMEOUT_EVENT_ID	 = BIT(23),
44 	SOFT_GEMINI_AVALANCHE_EVENT_ID		 = BIT(24),
45 	PLT_RX_CALIBRATION_COMPLETE_EVENT_ID	 = BIT(25),
46 	INACTIVE_STA_EVENT_ID			 = BIT(26),
47 	PEER_REMOVE_COMPLETE_EVENT_ID		 = BIT(27),
48 	PERIODIC_SCAN_COMPLETE_EVENT_ID		 = BIT(28),
49 	PERIODIC_SCAN_REPORT_EVENT_ID		 = BIT(29),
50 	BA_SESSION_RX_CONSTRAINT_EVENT_ID	 = BIT(30),
51 	REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID	 = BIT(31),
52 };
53 
54 struct wl12xx_event_mailbox {
55 	__le32 events_vector;
56 	__le32 events_mask;
57 	__le32 reserved_1;
58 	__le32 reserved_2;
59 
60 	u8 number_of_scan_results;
61 	u8 scan_tag;
62 	u8 completed_scan_status;
63 	u8 reserved_3;
64 
65 	u8 soft_gemini_sense_info;
66 	u8 soft_gemini_protective_info;
67 	s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS];
68 	u8 change_auto_mode_timeout;
69 	u8 scheduled_scan_status;
70 	u8 reserved4;
71 	/* tuned channel (roc) */
72 	u8 roc_channel;
73 
74 	__le16 hlid_removed_bitmap;
75 
76 	/* bitmap of aged stations (by HLID) */
77 	__le16 sta_aging_status;
78 
79 	/* bitmap of stations (by HLID) which exceeded max tx retries */
80 	__le16 sta_tx_retry_exceeded;
81 
82 	/* discovery completed results */
83 	u8 discovery_tag;
84 	u8 number_of_preq_results;
85 	u8 number_of_prsp_results;
86 	u8 reserved_5;
87 
88 	/* rx ba constraint */
89 	u8 role_id; /* 0xFF means any role. */
90 	u8 rx_ba_allowed;
91 	u8 reserved_6[2];
92 
93 	/* Channel switch results */
94 
95 	u8 channel_switch_role_id;
96 	u8 channel_switch_status;
97 	u8 reserved_7[2];
98 
99 	u8 ps_poll_delivery_failure_role_ids;
100 	u8 stopped_role_ids;
101 	u8 started_role_ids;
102 
103 	u8 reserved_8[9];
104 } __packed;
105 
106 int wl12xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
107 			  bool *timeout);
108 int wl12xx_process_mailbox_events(struct wl1271 *wl);
109 
110 #endif
111 
112