1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * This file is part of wl12xx
4  *
5  * Copyright (C) 2012 Texas Instruments. All rights reserved.
6  */
7 
8 #ifndef __WL12XX_EVENT_H__
9 #define __WL12XX_EVENT_H__
10 
11 #include "../wlcore/wlcore.h"
12 
13 enum {
14 	MEASUREMENT_START_EVENT_ID		 = BIT(8),
15 	MEASUREMENT_COMPLETE_EVENT_ID		 = BIT(9),
16 	SCAN_COMPLETE_EVENT_ID			 = BIT(10),
17 	WFD_DISCOVERY_COMPLETE_EVENT_ID		 = BIT(11),
18 	AP_DISCOVERY_COMPLETE_EVENT_ID		 = BIT(12),
19 	RESERVED1			         = BIT(13),
20 	PSPOLL_DELIVERY_FAILURE_EVENT_ID	 = BIT(14),
21 	ROLE_STOP_COMPLETE_EVENT_ID		 = BIT(15),
22 	RADAR_DETECTED_EVENT_ID                  = BIT(16),
23 	CHANNEL_SWITCH_COMPLETE_EVENT_ID	 = BIT(17),
24 	BSS_LOSE_EVENT_ID			 = BIT(18),
25 	REGAINED_BSS_EVENT_ID			 = BIT(19),
26 	MAX_TX_RETRY_EVENT_ID			 = BIT(20),
27 	DUMMY_PACKET_EVENT_ID			 = BIT(21),
28 	SOFT_GEMINI_SENSE_EVENT_ID		 = BIT(22),
29 	CHANGE_AUTO_MODE_TIMEOUT_EVENT_ID	 = BIT(23),
30 	SOFT_GEMINI_AVALANCHE_EVENT_ID		 = BIT(24),
31 	PLT_RX_CALIBRATION_COMPLETE_EVENT_ID	 = BIT(25),
32 	INACTIVE_STA_EVENT_ID			 = BIT(26),
33 	PEER_REMOVE_COMPLETE_EVENT_ID		 = BIT(27),
34 	PERIODIC_SCAN_COMPLETE_EVENT_ID		 = BIT(28),
35 	PERIODIC_SCAN_REPORT_EVENT_ID		 = BIT(29),
36 	BA_SESSION_RX_CONSTRAINT_EVENT_ID	 = BIT(30),
37 	REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID	 = BIT(31),
38 };
39 
40 struct wl12xx_event_mailbox {
41 	__le32 events_vector;
42 	__le32 events_mask;
43 	__le32 reserved_1;
44 	__le32 reserved_2;
45 
46 	u8 number_of_scan_results;
47 	u8 scan_tag;
48 	u8 completed_scan_status;
49 	u8 reserved_3;
50 
51 	u8 soft_gemini_sense_info;
52 	u8 soft_gemini_protective_info;
53 	s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS];
54 	u8 change_auto_mode_timeout;
55 	u8 scheduled_scan_status;
56 	u8 reserved4;
57 	/* tuned channel (roc) */
58 	u8 roc_channel;
59 
60 	__le16 hlid_removed_bitmap;
61 
62 	/* bitmap of aged stations (by HLID) */
63 	__le16 sta_aging_status;
64 
65 	/* bitmap of stations (by HLID) which exceeded max tx retries */
66 	__le16 sta_tx_retry_exceeded;
67 
68 	/* discovery completed results */
69 	u8 discovery_tag;
70 	u8 number_of_preq_results;
71 	u8 number_of_prsp_results;
72 	u8 reserved_5;
73 
74 	/* rx ba constraint */
75 	u8 role_id; /* 0xFF means any role. */
76 	u8 rx_ba_allowed;
77 	u8 reserved_6[2];
78 
79 	/* Channel switch results */
80 
81 	u8 channel_switch_role_id;
82 	u8 channel_switch_status;
83 	u8 reserved_7[2];
84 
85 	u8 ps_poll_delivery_failure_role_ids;
86 	u8 stopped_role_ids;
87 	u8 started_role_ids;
88 
89 	u8 reserved_8[9];
90 } __packed;
91 
92 int wl12xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
93 			  bool *timeout);
94 int wl12xx_process_mailbox_events(struct wl1271 *wl);
95 
96 #endif
97 
98