event.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * This file is part of wl1251
  3. *
  4. * Copyright (c) 1998-2007 Texas Instruments Incorporated
  5. * Copyright (C) 2008 Nokia Corporation
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. *
  21. */
  22. #ifndef __WL1251_EVENT_H__
  23. #define __WL1251_EVENT_H__
  24. /*
  25. * Mbox events
  26. *
  27. * The event mechanism is based on a pair of event buffers (buffers A and
  28. * B) at fixed locations in the target's memory. The host processes one
  29. * buffer while the other buffer continues to collect events. If the host
  30. * is not processing events, an interrupt is issued to signal that a buffer
  31. * is ready. Once the host is done with processing events from one buffer,
  32. * it signals the target (with an ACK interrupt) that the event buffer is
  33. * free.
  34. */
  35. enum {
  36. RESERVED1_EVENT_ID = BIT(0),
  37. RESERVED2_EVENT_ID = BIT(1),
  38. MEASUREMENT_START_EVENT_ID = BIT(2),
  39. SCAN_COMPLETE_EVENT_ID = BIT(3),
  40. CALIBRATION_COMPLETE_EVENT_ID = BIT(4),
  41. ROAMING_TRIGGER_LOW_RSSI_EVENT_ID = BIT(5),
  42. PS_REPORT_EVENT_ID = BIT(6),
  43. SYNCHRONIZATION_TIMEOUT_EVENT_ID = BIT(7),
  44. HEALTH_REPORT_EVENT_ID = BIT(8),
  45. ACI_DETECTION_EVENT_ID = BIT(9),
  46. DEBUG_REPORT_EVENT_ID = BIT(10),
  47. MAC_STATUS_EVENT_ID = BIT(11),
  48. DISCONNECT_EVENT_COMPLETE_ID = BIT(12),
  49. JOIN_EVENT_COMPLETE_ID = BIT(13),
  50. CHANNEL_SWITCH_COMPLETE_EVENT_ID = BIT(14),
  51. BSS_LOSE_EVENT_ID = BIT(15),
  52. ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID = BIT(16),
  53. MEASUREMENT_COMPLETE_EVENT_ID = BIT(17),
  54. AP_DISCOVERY_COMPLETE_EVENT_ID = BIT(18),
  55. SCHEDULED_SCAN_COMPLETE_EVENT_ID = BIT(19),
  56. PSPOLL_DELIVERY_FAILURE_EVENT_ID = BIT(20),
  57. RESET_BSS_EVENT_ID = BIT(21),
  58. REGAINED_BSS_EVENT_ID = BIT(22),
  59. ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID = BIT(23),
  60. ROAMING_TRIGGER_LOW_SNR_EVENT_ID = BIT(24),
  61. ROAMING_TRIGGER_REGAINED_SNR_EVENT_ID = BIT(25),
  62. DBG_EVENT_ID = BIT(26),
  63. BT_PTA_SENSE_EVENT_ID = BIT(27),
  64. BT_PTA_PREDICTION_EVENT_ID = BIT(28),
  65. BT_PTA_AVALANCHE_EVENT_ID = BIT(29),
  66. PLT_RX_CALIBRATION_COMPLETE_EVENT_ID = BIT(30),
  67. EVENT_MBOX_ALL_EVENT_ID = 0x7fffffff,
  68. };
  69. struct event_debug_report {
  70. u8 debug_event_id;
  71. u8 num_params;
  72. u16 pad;
  73. u32 report_1;
  74. u32 report_2;
  75. u32 report_3;
  76. } __packed;
  77. struct event_mailbox {
  78. u32 events_vector;
  79. u32 events_mask;
  80. u32 reserved_1;
  81. u32 reserved_2;
  82. char average_rssi_level;
  83. u8 ps_status;
  84. u8 channel_switch_status;
  85. u8 scheduled_scan_status;
  86. /* Channels scanned by the scheduled scan */
  87. u16 scheduled_scan_channels;
  88. /* If bit 0 is set -> target's fatal error */
  89. u16 health_report;
  90. u16 bad_fft_counter;
  91. u8 bt_pta_sense_info;
  92. u8 bt_pta_protective_info;
  93. u32 reserved;
  94. u32 debug_report[2];
  95. /* Number of FCS errors since last event */
  96. u32 fcs_err_counter;
  97. struct event_debug_report report;
  98. u8 average_snr_level;
  99. u8 padding[19];
  100. } __packed;
  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. int wl1251_event_unmask(struct wl1251 *wl);
  108. void wl1251_event_mbox_config(struct wl1251 *wl);
  109. int wl1251_event_handle(struct wl1251 *wl, u8 mbox);
  110. int wl1251_event_wait(struct wl1251 *wl, u32 mask, int timeout_ms);
  111. #endif