hal_com_c2h.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2017 Realtek Corporation.
  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. *****************************************************************************/
  15. #ifndef __COMMON_C2H_H__
  16. #define __COMMON_C2H_H__
  17. #define C2H_TYPE_REG 0
  18. #define C2H_TYPE_PKT 1
  19. /*
  20. * C2H event format:
  21. * Fields TRIGGER PAYLOAD SEQ PLEN ID
  22. * BITS [127:120] [119:16] [15:8] [7:4] [3:0]
  23. */
  24. #define C2H_ID(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 4)
  25. #define C2H_PLEN(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 4, 4)
  26. #define C2H_SEQ(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
  27. #define C2H_PAYLOAD(_c2h) (((u8*)(_c2h)) + 2)
  28. #define SET_C2H_ID(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 4, _val)
  29. #define SET_C2H_PLEN(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 4, 4, _val)
  30. #define SET_C2H_SEQ(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1 , 0, 8, _val)
  31. /*
  32. * C2H event format:
  33. * Fields TRIGGER PLEN PAYLOAD SEQ ID
  34. * BITS [127:120] [119:112] [111:16] [15:8] [7:0]
  35. */
  36. #define C2H_ID_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 8)
  37. #define C2H_SEQ_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
  38. #define C2H_PAYLOAD_88XX(_c2h) (((u8*)(_c2h)) + 2)
  39. #define C2H_PLEN_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 14, 0, 8)
  40. #define C2H_TRIGGER_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 15, 0, 8)
  41. #define SET_C2H_ID_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 8, _val)
  42. #define SET_C2H_SEQ_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1, 0, 8, _val)
  43. #define SET_C2H_PLEN_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 14, 0, 8, _val)
  44. typedef enum _C2H_EVT {
  45. C2H_DBG = 0x00,
  46. C2H_LB = 0x01,
  47. C2H_TXBF = 0x02,
  48. C2H_CCX_TX_RPT = 0x03,
  49. C2H_AP_REQ_TXRPT = 0x04,
  50. C2H_FW_SCAN_COMPLETE = 0x7,
  51. C2H_BT_INFO = 0x09,
  52. C2H_BT_MP_INFO = 0x0B,
  53. C2H_RA_RPT = 0x0C,
  54. C2H_SPC_STAT = 0x0D,
  55. C2H_RA_PARA_RPT = 0x0E,
  56. C2H_FW_CHNL_SWITCH_COMPLETE = 0x10,
  57. C2H_IQK_FINISH = 0x11,
  58. C2H_MAILBOX_STATUS = 0x15,
  59. C2H_P2P_RPORT = 0x16,
  60. C2H_MCC = 0x17,
  61. C2H_MAC_HIDDEN_RPT = 0x19,
  62. C2H_MAC_HIDDEN_RPT_2 = 0x1A,
  63. C2H_BCN_EARLY_RPT = 0x1E,
  64. C2H_DEFEATURE_DBG = 0x22,
  65. C2H_CUSTOMER_STR_RPT = 0x24,
  66. C2H_CUSTOMER_STR_RPT_2 = 0x25,
  67. C2H_WLAN_INFO = 0x27,
  68. #ifdef RTW_PER_CMD_SUPPORT_FW
  69. C2H_PER_RATE_RPT = 0x2c,
  70. #endif
  71. C2H_DEFEATURE_RSVD = 0xFD,
  72. C2H_EXTEND = 0xff,
  73. } C2H_EVT;
  74. typedef enum _EXTEND_C2H_EVT {
  75. EXTEND_C2H_DBG_PRINT = 0
  76. } EXTEND_C2H_EVT;
  77. #define C2H_REG_LEN 16
  78. /* C2H_IQK_FINISH, 0x11 */
  79. #define IQK_OFFLOAD_LEN 1
  80. void c2h_iqk_offload(_adapter *adapter, u8 *data, u8 len);
  81. int c2h_iqk_offload_wait(_adapter *adapter, u32 timeout_ms);
  82. #define rtl8812_iqk_wait c2h_iqk_offload_wait /* TODO: remove this after phydm call c2h_iqk_offload_wait instead */
  83. #ifdef CONFIG_RTW_MAC_HIDDEN_RPT
  84. /* C2H_MAC_HIDDEN_RPT, 0x19 */
  85. #define MAC_HIDDEN_RPT_LEN 8
  86. int c2h_mac_hidden_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
  87. /* C2H_MAC_HIDDEN_RPT_2, 0x1A */
  88. #define MAC_HIDDEN_RPT_2_LEN 5
  89. int c2h_mac_hidden_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
  90. int hal_read_mac_hidden_rpt(_adapter *adapter);
  91. #endif /* CONFIG_RTW_MAC_HIDDEN_RPT */
  92. /* C2H_DEFEATURE_DBG, 0x22 */
  93. #define DEFEATURE_DBG_LEN 1
  94. int c2h_defeature_dbg_hdl(_adapter *adapter, u8 *data, u8 len);
  95. #ifdef CONFIG_RTW_CUSTOMER_STR
  96. /* C2H_CUSTOMER_STR_RPT, 0x24 */
  97. #define CUSTOMER_STR_RPT_LEN 8
  98. int c2h_customer_str_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
  99. /* C2H_CUSTOMER_STR_RPT_2, 0x25 */
  100. #define CUSTOMER_STR_RPT_2_LEN 8
  101. int c2h_customer_str_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
  102. #endif /* CONFIG_RTW_CUSTOMER_STR */
  103. #ifdef RTW_PER_CMD_SUPPORT_FW
  104. /* C2H_PER_RATE_RPT, 0x2c */
  105. int c2h_per_rate_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
  106. #endif
  107. #endif /* __COMMON_C2H_H__ */