blob: e524ad6fe4e32214eec711bd86213b2b3e7f6de5 [file] [log] [blame]
Luciano Coelhof5fc0f82009-08-06 16:25:28 +03001/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
5 * Copyright (C) 2008-2009 Nokia Corporation
6 *
7 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
Shahar Levi00d20102010-11-08 11:20:10 +000025#ifndef __EVENT_H__
26#define __EVENT_H__
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030027
28/*
29 * Mbox events
30 *
31 * The event mechanism is based on a pair of event buffers (buffers A and
32 * B) at fixed locations in the target's memory. The host processes one
33 * buffer while the other buffer continues to collect events. If the host
34 * is not processing events, an interrupt is issued to signal that a buffer
35 * is ready. Once the host is done with processing events from one buffer,
36 * it signals the target (with an ACK interrupt) that the event buffer is
37 * free.
38 */
39
40enum {
Juuso Oikarinen00236aed2010-04-09 11:07:30 +030041 RSSI_SNR_TRIGGER_0_EVENT_ID = BIT(0),
42 RSSI_SNR_TRIGGER_1_EVENT_ID = BIT(1),
43 RSSI_SNR_TRIGGER_2_EVENT_ID = BIT(2),
44 RSSI_SNR_TRIGGER_3_EVENT_ID = BIT(3),
45 RSSI_SNR_TRIGGER_4_EVENT_ID = BIT(4),
46 RSSI_SNR_TRIGGER_5_EVENT_ID = BIT(5),
47 RSSI_SNR_TRIGGER_6_EVENT_ID = BIT(6),
48 RSSI_SNR_TRIGGER_7_EVENT_ID = BIT(7),
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030049 MEASUREMENT_START_EVENT_ID = BIT(8),
50 MEASUREMENT_COMPLETE_EVENT_ID = BIT(9),
51 SCAN_COMPLETE_EVENT_ID = BIT(10),
52 SCHEDULED_SCAN_COMPLETE_EVENT_ID = BIT(11),
53 AP_DISCOVERY_COMPLETE_EVENT_ID = BIT(12),
54 PS_REPORT_EVENT_ID = BIT(13),
55 PSPOLL_DELIVERY_FAILURE_EVENT_ID = BIT(14),
56 DISCONNECT_EVENT_COMPLETE_ID = BIT(15),
57 JOIN_EVENT_COMPLETE_ID = BIT(16),
58 CHANNEL_SWITCH_COMPLETE_EVENT_ID = BIT(17),
59 BSS_LOSE_EVENT_ID = BIT(18),
60 REGAINED_BSS_EVENT_ID = BIT(19),
Arik Nemtsov3618f302011-06-26 10:36:03 +030061 MAX_TX_RETRY_EVENT_ID = BIT(20),
Shahar Leviae47c452011-03-06 16:32:14 +020062 /* STA: dummy paket for dynamic mem blocks */
63 DUMMY_PACKET_EVENT_ID = BIT(21),
64 /* AP: STA remove complete */
65 STA_REMOVE_COMPLETE_EVENT_ID = BIT(21),
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030066 SOFT_GEMINI_SENSE_EVENT_ID = BIT(22),
Arik Nemtsov3618f302011-06-26 10:36:03 +030067 /* STA: SG prediction */
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030068 SOFT_GEMINI_PREDICTION_EVENT_ID = BIT(23),
Arik Nemtsov3618f302011-06-26 10:36:03 +030069 /* AP: Inactive STA */
70 INACTIVE_STA_EVENT_ID = BIT(23),
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030071 SOFT_GEMINI_AVALANCHE_EVENT_ID = BIT(24),
72 PLT_RX_CALIBRATION_COMPLETE_EVENT_ID = BIT(25),
73 DBG_EVENT_ID = BIT(26),
74 HEALTH_CHECK_REPLY_EVENT_ID = BIT(27),
75 PERIODIC_SCAN_COMPLETE_EVENT_ID = BIT(28),
76 PERIODIC_SCAN_REPORT_EVENT_ID = BIT(29),
Shahar Levi70559a02011-05-22 16:10:22 +030077 BA_SESSION_RX_CONSTRAINT_EVENT_ID = BIT(30),
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030078 EVENT_MBOX_ALL_EVENT_ID = 0x7fffffff,
79};
80
Juuso Oikarinen19ad0712009-11-02 20:22:11 +020081enum {
82 EVENT_ENTER_POWER_SAVE_FAIL = 0,
83 EVENT_ENTER_POWER_SAVE_SUCCESS,
Juuso Oikarinen19ad0712009-11-02 20:22:11 +020084};
85
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030086struct event_debug_report {
87 u8 debug_event_id;
88 u8 num_params;
Luciano Coelhod0f63b22009-10-15 10:33:29 +030089 __le16 pad;
90 __le32 report_1;
91 __le32 report_2;
92 __le32 report_3;
Eric Dumazetba2d3582010-06-02 18:10:09 +000093} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030094
95#define NUM_OF_RSSI_SNR_TRIGGERS 8
96
97struct event_mailbox {
Luciano Coelhod0f63b22009-10-15 10:33:29 +030098 __le32 events_vector;
99 __le32 events_mask;
100 __le32 reserved_1;
101 __le32 reserved_2;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300102
103 u8 dbg_event_id;
104 u8 num_relevant_params;
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300105 __le16 reserved_3;
106 __le32 event_report_p1;
107 __le32 event_report_p2;
108 __le32 event_report_p3;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300109
110 u8 number_of_scan_results;
111 u8 scan_tag;
112 u8 reserved_4[2];
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300113 __le32 compl_scheduled_scan_status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300114
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300115 __le16 scheduled_scan_attended_channels;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300116 u8 soft_gemini_sense_info;
117 u8 soft_gemini_protective_info;
118 s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS];
119 u8 channel_switch_status;
120 u8 scheduled_scan_status;
121 u8 ps_status;
122
Arik Nemtsovbeb6c882010-10-16 18:53:48 +0200123 /* AP FW only */
124 u8 hlid_removed;
Arik Nemtsov3618f302011-06-26 10:36:03 +0300125
126 /* a bitmap of hlids for stations that have been inactive too long */
Arik Nemtsovbeb6c882010-10-16 18:53:48 +0200127 __le16 sta_aging_status;
Arik Nemtsov3618f302011-06-26 10:36:03 +0300128
129 /* a bitmap of hlids for stations which didn't respond to TX */
Arik Nemtsovbeb6c882010-10-16 18:53:48 +0200130 __le16 sta_tx_retry_exceeded;
131
Shahar Levi70559a02011-05-22 16:10:22 +0300132 /*
133 * Bitmap, Each bit set represents the Role ID for which this constraint
134 * is set. Range: 0 - FF, FF means ANY role
135 */
136 u8 ba_role_id;
137 /*
138 * Bitmap, Each bit set represents the Link ID for which this constraint
139 * is set. Not applicable if ba_role_id is set to ANY role (FF).
140 * Range: 0 - FFFF, FFFF means ANY link in that role
141 */
142 u8 ba_link_id;
143 u8 ba_allowed;
144
145 u8 reserved_5[21];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000146} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300147
148int wl1271_event_unmask(struct wl1271 *wl);
149void wl1271_event_mbox_config(struct wl1271 *wl);
Juuso Oikarinen13f2dc52009-12-11 15:40:59 +0200150int wl1271_event_handle(struct wl1271 *wl, u8 mbox);
Juuso Oikarinen90494a92010-07-08 17:50:00 +0300151void wl1271_pspoll_work(struct work_struct *work);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300152
Arik Nemtsov3618f302011-06-26 10:36:03 +0300153/* Functions from main.c */
154bool wl1271_is_active_sta(struct wl1271 *wl, u8 hlid);
155
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300156#endif