xref: /linux/drivers/net/wireless/ti/wl1251/event.h (revision 2b27bdcc)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * This file is part of wl1251
4  *
5  * Copyright (c) 1998-2007 Texas Instruments Incorporated
6  * Copyright (C) 2008 Nokia Corporation
7  */
8 
9 #ifndef __WL1251_EVENT_H__
10 #define __WL1251_EVENT_H__
11 
12 /*
13  * Mbox events
14  *
15  * The event mechanism is based on a pair of event buffers (buffers A and
16  * B) at fixed locations in the target's memory. The host processes one
17  * buffer while the other buffer continues to collect events. If the host
18  * is not processing events, an interrupt is issued to signal that a buffer
19  * is ready. Once the host is done with processing events from one buffer,
20  * it signals the target (with an ACK interrupt) that the event buffer is
21  * free.
22  */
23 
24 enum {
25 	RESERVED1_EVENT_ID                       = BIT(0),
26 	RESERVED2_EVENT_ID                       = BIT(1),
27 	MEASUREMENT_START_EVENT_ID               = BIT(2),
28 	SCAN_COMPLETE_EVENT_ID                   = BIT(3),
29 	CALIBRATION_COMPLETE_EVENT_ID            = BIT(4),
30 	ROAMING_TRIGGER_LOW_RSSI_EVENT_ID        = BIT(5),
31 	PS_REPORT_EVENT_ID                       = BIT(6),
32 	SYNCHRONIZATION_TIMEOUT_EVENT_ID         = BIT(7),
33 	HEALTH_REPORT_EVENT_ID                   = BIT(8),
34 	ACI_DETECTION_EVENT_ID                   = BIT(9),
35 	DEBUG_REPORT_EVENT_ID                    = BIT(10),
36 	MAC_STATUS_EVENT_ID                      = BIT(11),
37 	DISCONNECT_EVENT_COMPLETE_ID             = BIT(12),
38 	JOIN_EVENT_COMPLETE_ID                   = BIT(13),
39 	CHANNEL_SWITCH_COMPLETE_EVENT_ID         = BIT(14),
40 	BSS_LOSE_EVENT_ID                        = BIT(15),
41 	ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID    = BIT(16),
42 	MEASUREMENT_COMPLETE_EVENT_ID            = BIT(17),
43 	AP_DISCOVERY_COMPLETE_EVENT_ID           = BIT(18),
44 	SCHEDULED_SCAN_COMPLETE_EVENT_ID         = BIT(19),
45 	PSPOLL_DELIVERY_FAILURE_EVENT_ID 	 = BIT(20),
46 	RESET_BSS_EVENT_ID                       = BIT(21),
47 	REGAINED_BSS_EVENT_ID                    = BIT(22),
48 	ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID   = BIT(23),
49 	ROAMING_TRIGGER_LOW_SNR_EVENT_ID         = BIT(24),
50 	ROAMING_TRIGGER_REGAINED_SNR_EVENT_ID    = BIT(25),
51 
52 	DBG_EVENT_ID                             = BIT(26),
53 	BT_PTA_SENSE_EVENT_ID                    = BIT(27),
54 	BT_PTA_PREDICTION_EVENT_ID               = BIT(28),
55 	BT_PTA_AVALANCHE_EVENT_ID                = BIT(29),
56 
57 	PLT_RX_CALIBRATION_COMPLETE_EVENT_ID     = BIT(30),
58 
59 	EVENT_MBOX_ALL_EVENT_ID                  = 0x7fffffff,
60 };
61 
62 struct event_debug_report {
63 	u8 debug_event_id;
64 	u8 num_params;
65 	u16 pad;
66 	u32 report_1;
67 	u32 report_2;
68 	u32 report_3;
69 } __packed;
70 
71 struct event_mailbox {
72 	u32 events_vector;
73 	u32 events_mask;
74 	u32 reserved_1;
75 	u32 reserved_2;
76 
77 	char average_rssi_level;
78 	u8 ps_status;
79 	u8 channel_switch_status;
80 	u8 scheduled_scan_status;
81 
82 	/* Channels scanned by the scheduled scan */
83 	u16 scheduled_scan_channels;
84 
85 	/* If bit 0 is set -> target's fatal error */
86 	u16 health_report;
87 	u16 bad_fft_counter;
88 	u8 bt_pta_sense_info;
89 	u8 bt_pta_protective_info;
90 	u32 reserved;
91 	u32 debug_report[2];
92 
93 	/* Number of FCS errors since last event */
94 	u32 fcs_err_counter;
95 
96 	struct event_debug_report report;
97 	u8 average_snr_level;
98 	u8 padding[19];
99 } __packed;
100 
101 enum {
102 	EVENT_ENTER_POWER_SAVE_FAIL = 0,
103 	EVENT_ENTER_POWER_SAVE_SUCCESS,
104 	EVENT_EXIT_POWER_SAVE_FAIL,
105 	EVENT_EXIT_POWER_SAVE_SUCCESS,
106 };
107 
108 int wl1251_event_unmask(struct wl1251 *wl);
109 void wl1251_event_mbox_config(struct wl1251 *wl);
110 int wl1251_event_handle(struct wl1251 *wl, u8 mbox);
111 int wl1251_event_wait(struct wl1251 *wl, u32 mask, int timeout_ms);
112 
113 #endif
114