Merge branch 'for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa...
[linux-2.6] / drivers / net / wireless / wl12xx / event.h
1 /*
2  * This file is part of wl12xx
3  *
4  * Copyright (c) 1998-2007 Texas Instruments Incorporated
5  * Copyright (C) 2008 Nokia Corporation
6  *
7  * Contact: Kalle Valo <kalle.valo@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
25 #ifndef __WL12XX_EVENT_H__
26 #define __WL12XX_EVENT_H__
27
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
40 enum {
41         RESERVED1_EVENT_ID                       = BIT(0),
42         RESERVED2_EVENT_ID                       = BIT(1),
43         MEASUREMENT_START_EVENT_ID               = BIT(2),
44         SCAN_COMPLETE_EVENT_ID                   = BIT(3),
45         CALIBRATION_COMPLETE_EVENT_ID            = BIT(4),
46         ROAMING_TRIGGER_LOW_RSSI_EVENT_ID        = BIT(5),
47         PS_REPORT_EVENT_ID                       = BIT(6),
48         SYNCHRONIZATION_TIMEOUT_EVENT_ID         = BIT(7),
49         HEALTH_REPORT_EVENT_ID                   = BIT(8),
50         ACI_DETECTION_EVENT_ID                   = BIT(9),
51         DEBUG_REPORT_EVENT_ID                    = BIT(10),
52         MAC_STATUS_EVENT_ID                      = BIT(11),
53         DISCONNECT_EVENT_COMPLETE_ID             = BIT(12),
54         JOIN_EVENT_COMPLETE_ID                   = BIT(13),
55         CHANNEL_SWITCH_COMPLETE_EVENT_ID         = BIT(14),
56         BSS_LOSE_EVENT_ID                        = BIT(15),
57         ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID    = BIT(16),
58         MEASUREMENT_COMPLETE_EVENT_ID            = BIT(17),
59         AP_DISCOVERY_COMPLETE_EVENT_ID           = BIT(18),
60         SCHEDULED_SCAN_COMPLETE_EVENT_ID         = BIT(19),
61         PSPOLL_DELIVERY_FAILURE_EVENT_ID         = BIT(20),
62         RESET_BSS_EVENT_ID                       = BIT(21),
63         REGAINED_BSS_EVENT_ID                    = BIT(22),
64         ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID   = BIT(23),
65         ROAMING_TRIGGER_LOW_SNR_EVENT_ID         = BIT(24),
66         ROAMING_TRIGGER_REGAINED_SNR_EVENT_ID    = BIT(25),
67
68         DBG_EVENT_ID                             = BIT(26),
69         BT_PTA_SENSE_EVENT_ID                    = BIT(27),
70         BT_PTA_PREDICTION_EVENT_ID               = BIT(28),
71         BT_PTA_AVALANCHE_EVENT_ID                = BIT(29),
72
73         PLT_RX_CALIBRATION_COMPLETE_EVENT_ID     = BIT(30),
74
75         EVENT_MBOX_ALL_EVENT_ID                  = 0x7fffffff,
76 };
77
78 struct event_debug_report {
79         u8 debug_event_id;
80         u8 num_params;
81         u16 pad;
82         u32 report_1;
83         u32 report_2;
84         u32 report_3;
85 } __attribute__ ((packed));
86
87 struct event_mailbox {
88         u32 events_vector;
89         u32 events_mask;
90         u32 reserved_1;
91         u32 reserved_2;
92
93         char average_rssi_level;
94         u8 ps_status;
95         u8 channel_switch_status;
96         u8 scheduled_scan_status;
97
98         /* Channels scanned by the scheduled scan */
99         u16 scheduled_scan_channels;
100
101         /* If bit 0 is set -> target's fatal error */
102         u16 health_report;
103         u16 bad_fft_counter;
104         u8 bt_pta_sense_info;
105         u8 bt_pta_protective_info;
106         u32 reserved;
107         u32 debug_report[2];
108
109         /* Number of FCS errors since last event */
110         u32 fcs_err_counter;
111
112         struct event_debug_report report;
113         u8 average_snr_level;
114         u8 padding[19];
115 } __attribute__ ((packed));
116
117 int wl12xx_event_unmask(struct wl12xx *wl);
118 void wl12xx_event_mbox_config(struct wl12xx *wl);
119 int wl12xx_event_handle(struct wl12xx *wl, u8 mbox);
120
121 #endif