rtw_iol.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 __RTW_IOL_H_
  16. #define __RTW_IOL_H_
  17. struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter);
  18. int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len);
  19. int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary);
  20. int rtw_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt);
  21. bool rtw_IOL_applied(ADAPTER *adapter);
  22. int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us);
  23. int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms);
  24. int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame);
  25. #ifdef CONFIG_IOL_NEW_GENERATION
  26. #define IOREG_CMD_END_LEN 4
  27. struct ioreg_cfg {
  28. u8 length;
  29. u8 cmd_id;
  30. u16 address;
  31. u32 data;
  32. u32 mask;
  33. };
  34. enum ioreg_cmd {
  35. IOREG_CMD_LLT = 0x01,
  36. IOREG_CMD_REFUSE = 0x02,
  37. IOREG_CMD_EFUSE_PATH = 0x03,
  38. IOREG_CMD_WB_REG = 0x04,
  39. IOREG_CMD_WW_REG = 0x05,
  40. IOREG_CMD_WD_REG = 0x06,
  41. IOREG_CMD_W_RF = 0x07,
  42. IOREG_CMD_DELAY_US = 0x10,
  43. IOREG_CMD_DELAY_MS = 0x11,
  44. IOREG_CMD_END = 0xFF,
  45. };
  46. void read_efuse_from_txpktbuf(ADAPTER *adapter, int bcnhead, u8 *content, u16 *size);
  47. int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask);
  48. int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask);
  49. int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask);
  50. int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask);
  51. #define rtw_IOL_append_WB_cmd(xmit_frame, addr, value, mask) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value), (mask))
  52. #define rtw_IOL_append_WW_cmd(xmit_frame, addr, value, mask) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), (mask))
  53. #define rtw_IOL_append_WD_cmd(xmit_frame, addr, value, mask) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), (mask))
  54. #define rtw_IOL_append_WRF_cmd(xmit_frame, rf_path, addr, value, mask) _rtw_IOL_append_WRF_cmd((xmit_frame), (rf_path), (addr), (value), (mask))
  55. u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame);
  56. void rtw_IOL_cmd_buf_dump(ADAPTER *Adapter, int buf_len, u8 *pbuf);
  57. #ifdef CONFIG_IOL_IOREG_CFG_DBG
  58. struct cmd_cmp {
  59. u16 addr;
  60. u32 value;
  61. };
  62. #endif
  63. #else /* CONFIG_IOL_NEW_GENERATION */
  64. typedef struct _io_offload_cmd {
  65. u8 rsvd0;
  66. u8 cmd;
  67. u16 address;
  68. u32 value;
  69. } IO_OFFLOAD_CMD, IOL_CMD;
  70. #define IOL_CMD_LLT 0x00
  71. /* #define IOL_CMD_R_EFUSE 0x01 */
  72. #define IOL_CMD_WB_REG 0x02
  73. #define IOL_CMD_WW_REG 0x03
  74. #define IOL_CMD_WD_REG 0x04
  75. /* #define IOL_CMD_W_RF 0x05 */
  76. #define IOL_CMD_DELAY_US 0x80
  77. #define IOL_CMD_DELAY_MS 0x81
  78. /* #define IOL_CMD_DELAY_S 0x82 */
  79. #define IOL_CMD_END 0x83
  80. /*****************************************************
  81. CMD Address Value
  82. (B1) (B2/B3:H/L addr) (B4:B7 : MSB:LSB)
  83. ******************************************************
  84. IOL_CMD_LLT - B7: PGBNDY
  85. IOL_CMD_R_EFUSE - -
  86. IOL_CMD_WB_REG 0x0~0xFFFF B7
  87. IOL_CMD_WW_REG 0x0~0xFFFF B6~B7
  88. IOL_CMD_WD_REG 0x0~0xFFFF B4~B7
  89. IOL_CMD_W_RF RF Reg B5~B7
  90. IOL_CMD_DELAY_US - B6~B7
  91. IOL_CMD_DELAY_MS - B6~B7
  92. IOL_CMD_DELAY_S - B6~B7
  93. IOL_CMD_END - -
  94. ******************************************************/
  95. int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value);
  96. int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value);
  97. int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value);
  98. int rtw_IOL_exec_cmd_array_sync(PADAPTER adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms);
  99. int rtw_IOL_exec_empty_cmds_sync(ADAPTER *adapter, u32 max_wating_ms);
  100. #ifdef DBG_IO
  101. int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line);
  102. int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line);
  103. int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line);
  104. #define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
  105. #define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
  106. #define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
  107. #else
  108. #define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value))
  109. #define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value))
  110. #define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value))
  111. #endif /* DBG_IO */
  112. #endif /* CONFIG_IOL_NEW_GENERATION */
  113. #endif /* __RTW_IOL_H_ */