wl1251_event.h 3.9 KB

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