1f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho/*
2f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * This file is part of wl1271
3f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho *
4f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
5f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * Copyright (C) 2008-2009 Nokia Corporation
6f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho *
7f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * Contact: Luciano Coelho <luciano.coelho@nokia.com>
8f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho *
9f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * This program is free software; you can redistribute it and/or
10f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * modify it under the terms of the GNU General Public License
11f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * version 2 as published by the Free Software Foundation.
12f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho *
13f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * This program is distributed in the hope that it will be useful, but
14f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * WITHOUT ANY WARRANTY; without even the implied warranty of
15f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * General Public License for more details.
17f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho *
18f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * You should have received a copy of the GNU General Public License
19f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * along with this program; if not, write to the Free Software
20f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * 02110-1301 USA
22f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho *
23f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho */
24f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
2500d201001bd4e8a46e3d03c970abcb72256c368bShahar Levi#ifndef __EVENT_H__
2600d201001bd4e8a46e3d03c970abcb72256c368bShahar Levi#define __EVENT_H__
27f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
28f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho/*
29f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * Mbox events
30f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho *
31f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * The event mechanism is based on a pair of event buffers (buffers A and
32f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * B) at fixed locations in the target's memory. The host processes one
33f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * buffer while the other buffer continues to collect events. If the host
34f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * is not processing events, an interrupt is issued to signal that a buffer
35f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * is ready. Once the host is done with processing events from one buffer,
36f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * it signals the target (with an ACK interrupt) that the event buffer is
37f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho * free.
38f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho */
39f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
40f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelhoenum {
4100236aedf1d2c49a18ae9ea00698d97705ff7289Juuso Oikarinen	RSSI_SNR_TRIGGER_0_EVENT_ID              = BIT(0),
4200236aedf1d2c49a18ae9ea00698d97705ff7289Juuso Oikarinen	RSSI_SNR_TRIGGER_1_EVENT_ID              = BIT(1),
4300236aedf1d2c49a18ae9ea00698d97705ff7289Juuso Oikarinen	RSSI_SNR_TRIGGER_2_EVENT_ID              = BIT(2),
4400236aedf1d2c49a18ae9ea00698d97705ff7289Juuso Oikarinen	RSSI_SNR_TRIGGER_3_EVENT_ID              = BIT(3),
4500236aedf1d2c49a18ae9ea00698d97705ff7289Juuso Oikarinen	RSSI_SNR_TRIGGER_4_EVENT_ID              = BIT(4),
4600236aedf1d2c49a18ae9ea00698d97705ff7289Juuso Oikarinen	RSSI_SNR_TRIGGER_5_EVENT_ID              = BIT(5),
4700236aedf1d2c49a18ae9ea00698d97705ff7289Juuso Oikarinen	RSSI_SNR_TRIGGER_6_EVENT_ID              = BIT(6),
4800236aedf1d2c49a18ae9ea00698d97705ff7289Juuso Oikarinen	RSSI_SNR_TRIGGER_7_EVENT_ID              = BIT(7),
49f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	MEASUREMENT_START_EVENT_ID		 = BIT(8),
50f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	MEASUREMENT_COMPLETE_EVENT_ID		 = BIT(9),
51f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	SCAN_COMPLETE_EVENT_ID			 = BIT(10),
52c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	WFD_DISCOVERY_COMPLETE_EVENT_ID		 = BIT(11),
53f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	AP_DISCOVERY_COMPLETE_EVENT_ID		 = BIT(12),
54d6bf9ada92c113e56151b6a993b9b9d5d03f1365Eyal Shapira	RESERVED1			         = BIT(13),
55f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	PSPOLL_DELIVERY_FAILURE_EVENT_ID	 = BIT(14),
568332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller	ROLE_STOP_COMPLETE_EVENT_ID		 = BIT(15),
578332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller	RADAR_DETECTED_EVENT_ID                  = BIT(16),
58f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	CHANNEL_SWITCH_COMPLETE_EVENT_ID	 = BIT(17),
59f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	BSS_LOSE_EVENT_ID			 = BIT(18),
60f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	REGAINED_BSS_EVENT_ID			 = BIT(19),
613618f30f307841dba19f22d9c602a5c59cab30c7Arik Nemtsov	MAX_TX_RETRY_EVENT_ID			 = BIT(20),
62c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	DUMMY_PACKET_EVENT_ID			 = BIT(21),
63f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	SOFT_GEMINI_SENSE_EVENT_ID		 = BIT(22),
64c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	CHANGE_AUTO_MODE_TIMEOUT_EVENT_ID	 = BIT(23),
65f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	SOFT_GEMINI_AVALANCHE_EVENT_ID		 = BIT(24),
66f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	PLT_RX_CALIBRATION_COMPLETE_EVENT_ID	 = BIT(25),
67c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	INACTIVE_STA_EVENT_ID			 = BIT(26),
68c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	PEER_REMOVE_COMPLETE_EVENT_ID		 = BIT(27),
69f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	PERIODIC_SCAN_COMPLETE_EVENT_ID		 = BIT(28),
70f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	PERIODIC_SCAN_REPORT_EVENT_ID		 = BIT(29),
7170559a06657c55aeefe2f06619d3592a08cc68acShahar Levi	BA_SESSION_RX_CONSTRAINT_EVENT_ID	 = BIT(30),
72c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID	 = BIT(31),
73f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	EVENT_MBOX_ALL_EVENT_ID			 = 0x7fffffff,
74f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho};
75f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
7619ad0715d8d9acc259ef02f83df767df2cf1eafeJuuso Oikarinenenum {
7719ad0715d8d9acc259ef02f83df767df2cf1eafeJuuso Oikarinen	EVENT_ENTER_POWER_SAVE_FAIL = 0,
7819ad0715d8d9acc259ef02f83df767df2cf1eafeJuuso Oikarinen	EVENT_ENTER_POWER_SAVE_SUCCESS,
7919ad0715d8d9acc259ef02f83df767df2cf1eafeJuuso Oikarinen};
8019ad0715d8d9acc259ef02f83df767df2cf1eafeJuuso Oikarinen
81f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho#define NUM_OF_RSSI_SNR_TRIGGERS 8
82f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
83f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelhostruct event_mailbox {
84d0f63b202146f3281800ee44823740c8bbf38f11Luciano Coelho	__le32 events_vector;
85d0f63b202146f3281800ee44823740c8bbf38f11Luciano Coelho	__le32 events_mask;
86d0f63b202146f3281800ee44823740c8bbf38f11Luciano Coelho	__le32 reserved_1;
87d0f63b202146f3281800ee44823740c8bbf38f11Luciano Coelho	__le32 reserved_2;
88f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
89f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	u8 number_of_scan_results;
90f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	u8 scan_tag;
91c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 completed_scan_status;
92c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 reserved_3;
93f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
94f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	u8 soft_gemini_sense_info;
95f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	u8 soft_gemini_protective_info;
96f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS];
978332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller	u8 change_auto_mode_timeout;
98f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho	u8 scheduled_scan_status;
99d6bf9ada92c113e56151b6a993b9b9d5d03f1365Eyal Shapira	u8 reserved4;
100c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	/* tuned channel (roc) */
101c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 roc_channel;
102f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
103c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	__le16 hlid_removed_bitmap;
1043618f30f307841dba19f22d9c602a5c59cab30c7Arik Nemtsov
105c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	/* bitmap of aged stations (by HLID) */
106beb6c880720073c233633c45792a4bb5d5fedbd5Arik Nemtsov	__le16 sta_aging_status;
1073618f30f307841dba19f22d9c602a5c59cab30c7Arik Nemtsov
108c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	/* bitmap of stations (by HLID) which exceeded max tx retries */
109beb6c880720073c233633c45792a4bb5d5fedbd5Arik Nemtsov	__le16 sta_tx_retry_exceeded;
110beb6c880720073c233633c45792a4bb5d5fedbd5Arik Nemtsov
111c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	/* discovery completed results */
112c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 discovery_tag;
113c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 number_of_preq_results;
114c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 number_of_prsp_results;
115c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 reserved_5;
116c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller
117c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	/* rx ba constraint */
118c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 role_id; /* 0xFF means any role. */
119c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 rx_ba_allowed;
120c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 reserved_6[2];
121c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller
1228332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller	/* Channel switch results */
1238332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller
1248332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller	u8 channel_switch_role_id;
1258332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller	u8 channel_switch_status;
1268332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller	u8 reserved_7[2];
1278332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller
128c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 ps_poll_delivery_failure_role_ids;
129c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 stopped_role_ids;
130c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller	u8 started_role_ids;
131c690ec816f9fa2ab2b6200c5b79b6933acca49a4Eliad Peller
1328332f0f6dc017aef9aa4a95a6a2bd6eba4c82d0aEliad Peller	u8 reserved_8[9];
133ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
134f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
135f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelhoint wl1271_event_unmask(struct wl1271 *wl);
136f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelhovoid wl1271_event_mbox_config(struct wl1271 *wl);
13713f2dc52c69bcca074cd12d4806953b2af45c386Juuso Oikarinenint wl1271_event_handle(struct wl1271 *wl, u8 mbox);
138f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho
139f5fc0f86b02afef1119b523623b4cde41475bc8cLuciano Coelho#endif
140