1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * This file is part of wl1271
4  *
5  * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
6  * Copyright (C) 2008-2009 Nokia Corporation
7  *
8  * Contact: Luciano Coelho <luciano.coelho@nokia.com>
9  */
10 
11 #ifndef __EVENT_H__
12 #define __EVENT_H__
13 
14 /*
15  * Mbox events
16  *
17  * The event mechanism is based on a pair of event buffers (buffers A and
18  * B) at fixed locations in the target's memory. The host processes one
19  * buffer while the other buffer continues to collect events. If the host
20  * is not processing events, an interrupt is issued to signal that a buffer
21  * is ready. Once the host is done with processing events from one buffer,
22  * it signals the target (with an ACK interrupt) that the event buffer is
23  * free.
24  */
25 
26 enum {
27 	RSSI_SNR_TRIGGER_0_EVENT_ID              = BIT(0),
28 	RSSI_SNR_TRIGGER_1_EVENT_ID              = BIT(1),
29 	RSSI_SNR_TRIGGER_2_EVENT_ID              = BIT(2),
30 	RSSI_SNR_TRIGGER_3_EVENT_ID              = BIT(3),
31 	RSSI_SNR_TRIGGER_4_EVENT_ID              = BIT(4),
32 	RSSI_SNR_TRIGGER_5_EVENT_ID              = BIT(5),
33 	RSSI_SNR_TRIGGER_6_EVENT_ID              = BIT(6),
34 	RSSI_SNR_TRIGGER_7_EVENT_ID              = BIT(7),
35 
36 	EVENT_MBOX_ALL_EVENT_ID			 = 0x7fffffff,
37 };
38 
39 /* events the driver might want to wait for */
40 enum wlcore_wait_event {
41 	WLCORE_EVENT_ROLE_STOP_COMPLETE,
42 	WLCORE_EVENT_PEER_REMOVE_COMPLETE,
43 	WLCORE_EVENT_DFS_CONFIG_COMPLETE
44 };
45 
46 enum {
47 	EVENT_ENTER_POWER_SAVE_FAIL = 0,
48 	EVENT_ENTER_POWER_SAVE_SUCCESS,
49 };
50 
51 #define NUM_OF_RSSI_SNR_TRIGGERS 8
52 
53 struct fw_logger_information {
54 	__le32 max_buff_size;
55 	__le32 actual_buff_size;
56 	__le32 num_trace_drop;
57 	__le32 buff_read_ptr;
58 	__le32 buff_write_ptr;
59 } __packed;
60 
61 struct wl1271;
62 
63 int wl1271_event_unmask(struct wl1271 *wl);
64 int wl1271_event_handle(struct wl1271 *wl, u8 mbox);
65 
66 void wlcore_event_soft_gemini_sense(struct wl1271 *wl, u8 enable);
67 void wlcore_event_sched_scan_completed(struct wl1271 *wl,
68 				       u8 status);
69 void wlcore_event_ba_rx_constraint(struct wl1271 *wl,
70 				   unsigned long roles_bitmap,
71 				   unsigned long allowed_bitmap);
72 void wlcore_event_channel_switch(struct wl1271 *wl,
73 				 unsigned long roles_bitmap,
74 				 bool success);
75 void wlcore_event_beacon_loss(struct wl1271 *wl, unsigned long roles_bitmap);
76 void wlcore_event_dummy_packet(struct wl1271 *wl);
77 void wlcore_event_max_tx_failure(struct wl1271 *wl, unsigned long sta_bitmap);
78 void wlcore_event_inactive_sta(struct wl1271 *wl, unsigned long sta_bitmap);
79 void wlcore_event_roc_complete(struct wl1271 *wl);
80 void wlcore_event_rssi_trigger(struct wl1271 *wl, s8 *metric_arr);
81 int  wlcore_event_fw_logger(struct wl1271 *wl);
82 #endif
83