fw_common.h 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2012 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. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *
  24. *****************************************************************************/
  25. #ifndef __RTL92C__FW__COMMON__H__
  26. #define __RTL92C__FW__COMMON__H__
  27. #define FW_8192C_SIZE 0x3000
  28. #define FW_8192C_START_ADDRESS 0x1000
  29. #define FW_8192C_END_ADDRESS 0x1FFF
  30. #define FW_8192C_PAGE_SIZE 4096
  31. #define FW_8192C_POLLING_DELAY 5
  32. #define FW_8192C_POLLING_TIMEOUT_COUNT 100
  33. #define NORMAL_CHIP BIT(4)
  34. #define H2C_92C_KEEP_ALIVE_CTRL 48
  35. #define IS_FW_HEADER_EXIST(_pfwhdr) \
  36. ((le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x92C0 ||\
  37. (le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x88C0)
  38. #define CUT_VERSION_MASK (BIT(6)|BIT(7))
  39. #define CHIP_VENDOR_UMC BIT(5)
  40. #define CHIP_VENDOR_UMC_B_CUT BIT(6) /* Chip version for ECO */
  41. #define IS_CHIP_VER_B(version) ((version & CHIP_VER_B) ? true : false)
  42. #define RF_TYPE_MASK (BIT(0)|BIT(1))
  43. #define GET_CVID_RF_TYPE(version) \
  44. ((version) & RF_TYPE_MASK)
  45. #define GET_CVID_CUT_VERSION(version) \
  46. ((version) & CUT_VERSION_MASK)
  47. #define IS_NORMAL_CHIP(version) \
  48. ((version & NORMAL_CHIP) ? true : false)
  49. #define IS_2T2R(version) \
  50. (((GET_CVID_RF_TYPE(version)) == \
  51. CHIP_92C_BITMASK) ? true : false)
  52. #define IS_92C_SERIAL(version) \
  53. ((IS_2T2R(version)) ? true : false)
  54. #define IS_CHIP_VENDOR_UMC(version) \
  55. ((version & CHIP_VENDOR_UMC) ? true : false)
  56. #define IS_VENDOR_UMC_A_CUT(version) \
  57. ((IS_CHIP_VENDOR_UMC(version)) ? \
  58. ((GET_CVID_CUT_VERSION(version)) ? false : true) : false)
  59. #define IS_81XXC_VENDOR_UMC_B_CUT(version) \
  60. ((IS_CHIP_VENDOR_UMC(version)) ? \
  61. ((GET_CVID_CUT_VERSION(version) == \
  62. CHIP_VENDOR_UMC_B_CUT) ? true : false) : false)
  63. #define pagenum_128(_len) (u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0))
  64. #define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \
  65. SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
  66. #define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__ph2ccmd, __val) \
  67. SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val)
  68. #define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__ph2ccmd, __val) \
  69. SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val)
  70. #define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \
  71. SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
  72. #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \
  73. SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
  74. #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \
  75. SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val)
  76. #define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \
  77. SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val)
  78. int rtl92c_download_fw(struct ieee80211_hw *hw);
  79. void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
  80. u32 cmd_len, u8 *p_cmdbuffer);
  81. void rtl92c_firmware_selfreset(struct ieee80211_hw *hw);
  82. void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
  83. void rtl92c_set_fw_rsvdpagepkt
  84. (struct ieee80211_hw *hw,
  85. bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *));
  86. void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
  87. void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len);
  88. void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state);
  89. #endif