hal_com_c2h.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #ifndef __COMMON_C2H_H__
  21. #define __COMMON_C2H_H__
  22. #define C2H_TYPE_REG 0
  23. #define C2H_TYPE_PKT 1
  24. /*
  25. * C2H event format:
  26. * Fields TRIGGER PAYLOAD SEQ PLEN ID
  27. * BITS [127:120] [119:16] [15:8] [7:4] [3:0]
  28. */
  29. #define C2H_ID(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 4)
  30. #define C2H_PLEN(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 4, 4)
  31. #define C2H_SEQ(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
  32. #define C2H_PAYLOAD(_c2h) (((u8*)(_c2h)) + 2)
  33. #define SET_C2H_ID(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 4, _val)
  34. #define SET_C2H_PLEN(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 4, 4, _val)
  35. #define SET_C2H_SEQ(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1 , 0, 8, _val)
  36. /*
  37. * C2H event format:
  38. * Fields TRIGGER PLEN PAYLOAD SEQ ID
  39. * BITS [127:120] [119:112] [111:16] [15:8] [7:0]
  40. */
  41. #define C2H_ID_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 8)
  42. #define C2H_SEQ_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
  43. #define C2H_PAYLOAD_88XX(_c2h) (((u8*)(_c2h)) + 2)
  44. #define C2H_PLEN_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 14, 0, 8)
  45. #define C2H_TRIGGER_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 15, 0, 8)
  46. #define SET_C2H_ID_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 8, _val)
  47. #define SET_C2H_SEQ_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1, 0, 8, _val)
  48. #define SET_C2H_PLEN_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 14, 0, 8, _val)
  49. typedef enum _C2H_EVT {
  50. C2H_DBG = 0x00,
  51. C2H_LB = 0x01,
  52. C2H_TXBF = 0x02,
  53. C2H_CCX_TX_RPT = 0x03,
  54. C2H_AP_REQ_TXRPT = 0x04,
  55. C2H_FW_SCAN_COMPLETE = 0x7,
  56. C2H_BT_INFO = 0x09,
  57. C2H_BT_MP_INFO = 0x0B,
  58. C2H_RA_RPT = 0x0C,
  59. C2H_SPC_STAT = 0x0D,
  60. C2H_RA_PARA_RPT = 0x0E,
  61. C2H_FW_CHNL_SWITCH_COMPLETE = 0x10,
  62. C2H_IQK_FINISH = 0x11,
  63. C2H_MAILBOX_STATUS = 0x15,
  64. C2H_P2P_RPORT = 0x16,
  65. C2H_MCC = 0x17,
  66. C2H_MAC_HIDDEN_RPT = 0x19,
  67. C2H_MAC_HIDDEN_RPT_2 = 0x1A,
  68. C2H_BCN_EARLY_RPT = 0x1E,
  69. C2H_DEFEATURE_DBG = 0x22,
  70. C2H_CUSTOMER_STR_RPT = 0x24,
  71. C2H_CUSTOMER_STR_RPT_2 = 0x25,
  72. C2H_DEFEATURE_RSVD = 0xFD,
  73. C2H_EXTEND = 0xff,
  74. } C2H_EVT;
  75. typedef enum _EXTEND_C2H_EVT {
  76. EXTEND_C2H_DBG_PRINT = 0
  77. } EXTEND_C2H_EVT;
  78. #define C2H_REG_LEN 16
  79. /* C2H_IQK_FINISH, 0x11 */
  80. #define IQK_OFFLOAD_LEN 1
  81. void c2h_iqk_offload(_adapter *adapter, u8 *data, u8 len);
  82. int c2h_iqk_offload_wait(_adapter *adapter, u32 timeout_ms);
  83. #define rtl8812_iqk_wait c2h_iqk_offload_wait /* TODO: remove this after phydm call c2h_iqk_offload_wait instead */
  84. #ifdef CONFIG_RTW_MAC_HIDDEN_RPT
  85. /* C2H_MAC_HIDDEN_RPT, 0x19 */
  86. #define MAC_HIDDEN_RPT_LEN 8
  87. int c2h_mac_hidden_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
  88. /* C2H_MAC_HIDDEN_RPT_2, 0x1A */
  89. #define MAC_HIDDEN_RPT_2_LEN 5
  90. int c2h_mac_hidden_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
  91. int hal_read_mac_hidden_rpt(_adapter *adapter);
  92. #endif /* CONFIG_RTW_MAC_HIDDEN_RPT */
  93. /* C2H_DEFEATURE_DBG, 0x22 */
  94. #define DEFEATURE_DBG_LEN 1
  95. int c2h_defeature_dbg_hdl(_adapter *adapter, u8 *data, u8 len);
  96. #ifdef CONFIG_RTW_CUSTOMER_STR
  97. /* C2H_CUSTOMER_STR_RPT, 0x24 */
  98. #define CUSTOMER_STR_RPT_LEN 8
  99. int c2h_customer_str_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
  100. /* C2H_CUSTOMER_STR_RPT_2, 0x25 */
  101. #define CUSTOMER_STR_RPT_2_LEN 8
  102. int c2h_customer_str_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
  103. #endif /* CONFIG_RTW_CUSTOMER_STR */
  104. #endif /* __COMMON_C2H_H__ */