hal_halmac.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2015 - 2016 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 _HAL_HALMAC_H_
  21. #define _HAL_HALMAC_H_
  22. #include <drv_types.h> /* adapter_to_dvobj(), struct intf_hdl and etc. */
  23. #include <hal_data.h> /* struct hal_spec_t */
  24. #include "halmac/halmac_api.h" /* PHALMAC_ADAPTER and etc. */
  25. /* HALMAC Definition for Driver */
  26. #define RTW_HALMAC_H2C_MAX_SIZE HALMAC_H2C_CMD_ORIGINAL_SIZE_88XX
  27. #define RTW_HALMAC_BA_SSN_RPT_SIZE 4
  28. #define dvobj_set_halmac(d, mac) ((d)->halmac = (mac))
  29. #define dvobj_to_halmac(d) ((PHALMAC_ADAPTER)((d)->halmac))
  30. #define adapter_to_halmac(p) dvobj_to_halmac(adapter_to_dvobj(p))
  31. /* for H2C cmd */
  32. #define MAX_H2C_BOX_NUMS 4
  33. #define MESSAGE_BOX_SIZE 4
  34. #define EX_MESSAGE_BOX_SIZE 4
  35. typedef enum _RTW_HALMAC_MODE {
  36. RTW_HALMAC_MODE_NORMAL,
  37. RTW_HALMAC_MODE_WIFI_TEST,
  38. } RTW_HALMAC_MODE;
  39. extern HALMAC_PLATFORM_API rtw_halmac_platform_api;
  40. /* HALMAC API for Driver(HAL) */
  41. u8 rtw_halmac_read8(struct intf_hdl *, u32 addr);
  42. u16 rtw_halmac_read16(struct intf_hdl *, u32 addr);
  43. u32 rtw_halmac_read32(struct intf_hdl *, u32 addr);
  44. void rtw_halmac_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
  45. #ifdef CONFIG_SDIO_INDIRECT_ACCESS
  46. u8 rtw_halmac_iread8(struct intf_hdl *pintfhdl, u32 addr);
  47. u16 rtw_halmac_iread16(struct intf_hdl *pintfhdl, u32 addr);
  48. u32 rtw_halmac_iread32(struct intf_hdl *pintfhdl, u32 addr);
  49. #endif
  50. int rtw_halmac_write8(struct intf_hdl *, u32 addr, u8 value);
  51. int rtw_halmac_write16(struct intf_hdl *, u32 addr, u16 value);
  52. int rtw_halmac_write32(struct intf_hdl *, u32 addr, u32 value);
  53. void rtw_dump_halmac_info(void *sel);
  54. int rtw_halmac_init_adapter(struct dvobj_priv *, PHALMAC_PLATFORM_API);
  55. int rtw_halmac_deinit_adapter(struct dvobj_priv *);
  56. int rtw_halmac_poweron(struct dvobj_priv *);
  57. int rtw_halmac_poweroff(struct dvobj_priv *);
  58. int rtw_halmac_init_hal(struct dvobj_priv *);
  59. int rtw_halmac_init_hal_fw(struct dvobj_priv *, u8 *fw, u32 fwsize);
  60. int rtw_halmac_init_hal_fw_file(struct dvobj_priv *, u8 *fwpath);
  61. int rtw_halmac_deinit_hal(struct dvobj_priv *);
  62. int rtw_halmac_self_verify(struct dvobj_priv *);
  63. int rtw_halmac_dlfw(struct dvobj_priv *, u8 *fw, u32 fwsize);
  64. int rtw_halmac_dlfw_from_file(struct dvobj_priv *, u8 *fwpath);
  65. int rtw_halmac_dlfw_mem(struct dvobj_priv *d, u8 *fw, u32 fwsize, enum fw_mem mem);
  66. int rtw_halmac_dlfw_mem_from_file(struct dvobj_priv *d, u8 *fwpath, enum fw_mem mem);
  67. int rtw_halmac_phy_power_switch(struct dvobj_priv *, u8 enable);
  68. int rtw_halmac_send_h2c(struct dvobj_priv *, u8 *h2c);
  69. int rtw_halmac_c2h_handle(struct dvobj_priv *, u8 *c2h, u32 size);
  70. int rtw_halmac_get_available_efuse_size(struct dvobj_priv *d, u32 *size);
  71. int rtw_halmac_get_physical_efuse_size(struct dvobj_priv *, u32 *size);
  72. int rtw_halmac_read_physical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
  73. int rtw_halmac_read_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
  74. int rtw_halmac_write_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
  75. int rtw_halmac_get_logical_efuse_size(struct dvobj_priv *, u32 *size);
  76. int rtw_halmac_read_logical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
  77. int rtw_halmac_write_logical_efuse_map(struct dvobj_priv *, u8 *map, u32 size, u8 *maskmap, u32 masksize);
  78. int rtw_halmac_read_logical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
  79. int rtw_halmac_write_logical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
  80. int rtw_halmac_write_bt_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
  81. int rtw_halmac_read_bt_physical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
  82. int rtw_halmac_config_rx_info(struct dvobj_priv *, HALMAC_DRV_INFO);
  83. int rtw_halmac_set_mac_address(struct dvobj_priv *, enum _hw_port, u8 *addr);
  84. int rtw_halmac_set_bssid(struct dvobj_priv *, enum _hw_port hwport, u8 *addr);
  85. int rtw_halmac_set_bandwidth(struct dvobj_priv *, u8 channel, u8 pri_ch_idx, u8 bw);
  86. int rtw_halmac_dump_fifo(struct dvobj_priv *d, u8 fifo_sel, u32 addr, u32 size, u8 *buffer);
  87. int rtw_halmac_rx_agg_switch(struct dvobj_priv *, u8 enable);
  88. int rtw_halmac_get_hw_value(struct dvobj_priv *, HALMAC_HW_ID hw_id, VOID *pvalue);
  89. int rtw_halmac_get_wow_reason(struct dvobj_priv *, u8 *reason);
  90. int rtw_halmac_get_drv_info_sz(struct dvobj_priv *, u8 *sz);
  91. int rtw_halmac_get_rsvd_drv_pg_bndy(struct dvobj_priv *dvobj, u16 *drv_pg);
  92. int rtw_halmac_download_rsvd_page(struct dvobj_priv *dvobj, u8 pg_offset, u8 *pbuf, u32 size);
  93. int rtw_halmac_fill_hal_spec(struct dvobj_priv *, struct hal_spec_t *);
  94. int rtw_halmac_p2pps(struct dvobj_priv *dvobj, PHAL_P2P_PS_PARA pp2p_ps_para);
  95. #ifdef CONFIG_SDIO_HCI
  96. int rtw_halmac_query_tx_page_num(struct dvobj_priv *);
  97. int rtw_halmac_get_tx_queue_page_num(struct dvobj_priv *, u8 queue, u32 *page);
  98. u32 rtw_halmac_sdio_get_tx_addr(struct dvobj_priv *, u8 *desc, u32 size);
  99. int rtw_halmac_sdio_tx_allowed(struct dvobj_priv *, u8 *buf, u32 size);
  100. u32 rtw_halmac_sdio_get_rx_addr(struct dvobj_priv *, u8 *seq);
  101. #endif /* CONFIG_SDIO_HCI */
  102. #ifdef CONFIG_USB_HCI
  103. u8 rtw_halmac_usb_get_bulkout_id(struct dvobj_priv *, u8 *buf, u32 size);
  104. u8 rtw_halmac_switch_usb_mode(struct dvobj_priv *d, enum RTW_USB_SPEED usb_mode);
  105. #endif /* CONFIG_USB_HCI */
  106. #ifdef CONFIG_SUPPORT_TRX_SHARED
  107. void dump_trx_share_mode(void *sel, _adapter *adapter);
  108. #endif
  109. #endif /* _HAL_HALMAC_H_ */