162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * This file is part of wl1251 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (c) 1998-2007 Texas Instruments Incorporated 662306a36Sopenharmony_ci * Copyright (C) 2008 Nokia Corporation 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef __WL1251_EVENT_H__ 1062306a36Sopenharmony_ci#define __WL1251_EVENT_H__ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci/* 1362306a36Sopenharmony_ci * Mbox events 1462306a36Sopenharmony_ci * 1562306a36Sopenharmony_ci * The event mechanism is based on a pair of event buffers (buffers A and 1662306a36Sopenharmony_ci * B) at fixed locations in the target's memory. The host processes one 1762306a36Sopenharmony_ci * buffer while the other buffer continues to collect events. If the host 1862306a36Sopenharmony_ci * is not processing events, an interrupt is issued to signal that a buffer 1962306a36Sopenharmony_ci * is ready. Once the host is done with processing events from one buffer, 2062306a36Sopenharmony_ci * it signals the target (with an ACK interrupt) that the event buffer is 2162306a36Sopenharmony_ci * free. 2262306a36Sopenharmony_ci */ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_cienum { 2562306a36Sopenharmony_ci RESERVED1_EVENT_ID = BIT(0), 2662306a36Sopenharmony_ci RESERVED2_EVENT_ID = BIT(1), 2762306a36Sopenharmony_ci MEASUREMENT_START_EVENT_ID = BIT(2), 2862306a36Sopenharmony_ci SCAN_COMPLETE_EVENT_ID = BIT(3), 2962306a36Sopenharmony_ci CALIBRATION_COMPLETE_EVENT_ID = BIT(4), 3062306a36Sopenharmony_ci ROAMING_TRIGGER_LOW_RSSI_EVENT_ID = BIT(5), 3162306a36Sopenharmony_ci PS_REPORT_EVENT_ID = BIT(6), 3262306a36Sopenharmony_ci SYNCHRONIZATION_TIMEOUT_EVENT_ID = BIT(7), 3362306a36Sopenharmony_ci HEALTH_REPORT_EVENT_ID = BIT(8), 3462306a36Sopenharmony_ci ACI_DETECTION_EVENT_ID = BIT(9), 3562306a36Sopenharmony_ci DEBUG_REPORT_EVENT_ID = BIT(10), 3662306a36Sopenharmony_ci MAC_STATUS_EVENT_ID = BIT(11), 3762306a36Sopenharmony_ci DISCONNECT_EVENT_COMPLETE_ID = BIT(12), 3862306a36Sopenharmony_ci JOIN_EVENT_COMPLETE_ID = BIT(13), 3962306a36Sopenharmony_ci CHANNEL_SWITCH_COMPLETE_EVENT_ID = BIT(14), 4062306a36Sopenharmony_ci BSS_LOSE_EVENT_ID = BIT(15), 4162306a36Sopenharmony_ci ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID = BIT(16), 4262306a36Sopenharmony_ci MEASUREMENT_COMPLETE_EVENT_ID = BIT(17), 4362306a36Sopenharmony_ci AP_DISCOVERY_COMPLETE_EVENT_ID = BIT(18), 4462306a36Sopenharmony_ci SCHEDULED_SCAN_COMPLETE_EVENT_ID = BIT(19), 4562306a36Sopenharmony_ci PSPOLL_DELIVERY_FAILURE_EVENT_ID = BIT(20), 4662306a36Sopenharmony_ci RESET_BSS_EVENT_ID = BIT(21), 4762306a36Sopenharmony_ci REGAINED_BSS_EVENT_ID = BIT(22), 4862306a36Sopenharmony_ci ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID = BIT(23), 4962306a36Sopenharmony_ci ROAMING_TRIGGER_LOW_SNR_EVENT_ID = BIT(24), 5062306a36Sopenharmony_ci ROAMING_TRIGGER_REGAINED_SNR_EVENT_ID = BIT(25), 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci DBG_EVENT_ID = BIT(26), 5362306a36Sopenharmony_ci BT_PTA_SENSE_EVENT_ID = BIT(27), 5462306a36Sopenharmony_ci BT_PTA_PREDICTION_EVENT_ID = BIT(28), 5562306a36Sopenharmony_ci BT_PTA_AVALANCHE_EVENT_ID = BIT(29), 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci PLT_RX_CALIBRATION_COMPLETE_EVENT_ID = BIT(30), 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci EVENT_MBOX_ALL_EVENT_ID = 0x7fffffff, 6062306a36Sopenharmony_ci}; 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_cistruct event_debug_report { 6362306a36Sopenharmony_ci u8 debug_event_id; 6462306a36Sopenharmony_ci u8 num_params; 6562306a36Sopenharmony_ci u16 pad; 6662306a36Sopenharmony_ci u32 report_1; 6762306a36Sopenharmony_ci u32 report_2; 6862306a36Sopenharmony_ci u32 report_3; 6962306a36Sopenharmony_ci} __packed; 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_cistruct event_mailbox { 7262306a36Sopenharmony_ci u32 events_vector; 7362306a36Sopenharmony_ci u32 events_mask; 7462306a36Sopenharmony_ci u32 reserved_1; 7562306a36Sopenharmony_ci u32 reserved_2; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci char average_rssi_level; 7862306a36Sopenharmony_ci u8 ps_status; 7962306a36Sopenharmony_ci u8 channel_switch_status; 8062306a36Sopenharmony_ci u8 scheduled_scan_status; 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci /* Channels scanned by the scheduled scan */ 8362306a36Sopenharmony_ci u16 scheduled_scan_channels; 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci /* If bit 0 is set -> target's fatal error */ 8662306a36Sopenharmony_ci u16 health_report; 8762306a36Sopenharmony_ci u16 bad_fft_counter; 8862306a36Sopenharmony_ci u8 bt_pta_sense_info; 8962306a36Sopenharmony_ci u8 bt_pta_protective_info; 9062306a36Sopenharmony_ci u32 reserved; 9162306a36Sopenharmony_ci u32 debug_report[2]; 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci /* Number of FCS errors since last event */ 9462306a36Sopenharmony_ci u32 fcs_err_counter; 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci struct event_debug_report report; 9762306a36Sopenharmony_ci u8 average_snr_level; 9862306a36Sopenharmony_ci u8 padding[19]; 9962306a36Sopenharmony_ci} __packed; 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_cienum { 10262306a36Sopenharmony_ci EVENT_ENTER_POWER_SAVE_FAIL = 0, 10362306a36Sopenharmony_ci EVENT_ENTER_POWER_SAVE_SUCCESS, 10462306a36Sopenharmony_ci EVENT_EXIT_POWER_SAVE_FAIL, 10562306a36Sopenharmony_ci EVENT_EXIT_POWER_SAVE_SUCCESS, 10662306a36Sopenharmony_ci}; 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ciint wl1251_event_unmask(struct wl1251 *wl); 10962306a36Sopenharmony_civoid wl1251_event_mbox_config(struct wl1251 *wl); 11062306a36Sopenharmony_ciint wl1251_event_handle(struct wl1251 *wl, u8 mbox); 11162306a36Sopenharmony_ciint wl1251_event_wait(struct wl1251 *wl, u32 mask, int timeout_ms); 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci#endif 114