phydm_hal_api8821c.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2016 - 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 __INC_PHYDM_API_H_8821C__
  16. #define __INC_PHYDM_API_H_8821C__
  17. #if (RTL8821C_SUPPORT == 1)
  18. #define PHY_CONFIG_VERSION_8821C "3.1.27" /*2017.08.08 (HW user guide version: R03, SW user guide version: R01, Modification: R27)*/
  19. #define INVALID_RF_DATA 0xffffffff
  20. #define INVALID_TXAGC_DATA 0xff
  21. #define config_phydm_read_rf_check_8821c(data) (data != INVALID_RF_DATA)
  22. #define config_phydm_read_txagc_check_8821c(data) (data != INVALID_TXAGC_DATA)
  23. enum rf_set_8821c {
  24. SWITCH_TO_BTG = 0x0,
  25. SWITCH_TO_WLG = 0x1,
  26. SWITCH_TO_WLA = 0x2,
  27. SWITCH_TO_BT = 0x3
  28. };
  29. enum ant_num_8821c {
  30. SWITCH_TO_ANT1 = 0x0,
  31. SWITCH_TO_ANT2 = 0x1
  32. };
  33. enum ant_num_map_8821c {
  34. BOTH_AVAILABLE = 0x1,
  35. ONLY_ANT1 = 0x2,
  36. ONLY_ANT2 = 0x3,
  37. DONT_CARE = 0x4
  38. };
  39. s8 phydm_cck_rssi_8821c(struct dm_struct *dm, u8 lna_idx, u8 vga_idx);
  40. u32 config_phydm_read_rf_reg_8821c(struct dm_struct *dm, enum rf_path path,
  41. u32 reg_addr, u32 bit_mask);
  42. boolean
  43. config_phydm_write_rf_reg_8821c(struct dm_struct *dm, enum rf_path path,
  44. u32 reg_addr, u32 bit_mask, u32 data);
  45. boolean
  46. config_phydm_write_txagc_8821c(struct dm_struct *dm, u32 power_index,
  47. enum rf_path path, u8 hw_rate);
  48. u8 config_phydm_read_txagc_8821c(struct dm_struct *dm, enum rf_path path,
  49. u8 hw_rate);
  50. boolean
  51. config_phydm_switch_band_8821c(struct dm_struct *dm, u8 central_ch);
  52. boolean
  53. config_phydm_switch_channel_8821c(struct dm_struct *dm, u8 central_ch);
  54. boolean
  55. config_phydm_switch_bandwidth_8821c(struct dm_struct *dm, u8 primary_ch_idx,
  56. enum channel_width bandwidth);
  57. boolean
  58. config_phydm_switch_channel_bw_8821c(struct dm_struct *dm, u8 central_ch,
  59. u8 primary_ch_idx,
  60. enum channel_width bandwidth);
  61. boolean
  62. config_phydm_trx_mode_8821c(struct dm_struct *dm, enum bb_path tx_path,
  63. enum bb_path rx_path, boolean is_tx2_path);
  64. boolean
  65. config_phydm_parameter_init_8821c(struct dm_struct *dm,
  66. enum odm_parameter_init type);
  67. void config_phydm_switch_rf_set_8821c(struct dm_struct *dm, u8 rf_set);
  68. void config_phydm_set_ant_path(struct dm_struct *dm, u8 rf_set, u8 ant_num);
  69. /* ======================================================================== */
  70. /* These following functions can be used for PHY DM only*/
  71. boolean
  72. phydm_write_txagc_1byte_8821c(struct dm_struct *dm, u32 power_index,
  73. enum rf_path path, u8 hw_rate);
  74. void phydm_init_hw_info_by_rfe_type_8821c(struct dm_struct *dm);
  75. void phydm_set_gnt_state_8821c(struct dm_struct *dm, boolean gnt_wl_state,
  76. boolean gnt_bt_state);
  77. /* ======================================================================== */
  78. u32 query_phydm_trx_capability_8821c(struct dm_struct *dm);
  79. u32 query_phydm_stbc_capability_8821c(struct dm_struct *dm);
  80. u32 query_phydm_ldpc_capability_8821c(struct dm_struct *dm);
  81. u32 query_phydm_txbf_parameters_8821c(struct dm_struct *dm);
  82. u32 query_phydm_txbf_capability_8821c(struct dm_struct *dm);
  83. u8 query_phydm_default_rf_set_8821c(struct dm_struct *dm);
  84. u8 query_phydm_current_rf_set_8821c(struct dm_struct *dm);
  85. u8 query_phydm_rfetype_8821c(struct dm_struct *dm);
  86. u8 query_phydm_current_ant_num_8821c(struct dm_struct *dm);
  87. u8 query_phydm_ant_num_map_8821c(struct dm_struct *dm);
  88. #endif /* RTL8821C_SUPPORT == 1 */
  89. #endif /* __INC_PHYDM_API_H_8821C__ */