rtw_iol.h 5.7 KB

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