event.h 3.4 KB

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