target_if_cfr.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /*
  2. * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _TARGET_IF_CFR_H_
  20. #define _TARGET_IF_CFR_H_
  21. #include <wlan_objmgr_cmn.h>
  22. #include <wlan_objmgr_psoc_obj.h>
  23. #include <wlan_objmgr_pdev_obj.h>
  24. #include <wlan_objmgr_vdev_obj.h>
  25. #include <wlan_objmgr_peer_obj.h>
  26. #include "wmi_unified_cfr_api.h"
  27. #include "wmi_unified_param.h"
  28. #include "wmi_unified_cfr_param.h"
  29. #define PEER_CFR_CAPTURE_ENABLE 1
  30. #define PEER_CFR_CAPTURE_DISABLE 0
  31. #define PEER_CFR_CAPTURE_EVT_STATUS_MASK 0x80000000
  32. #define PEER_CFR_CAPTURE_EVT_PS_STATUS_MASK 0x40000000
  33. #define CFR_TX_EVT_STATUS_MASK 0x00000003
  34. /* Status codes used by correlate and relay function */
  35. #define STATUS_STREAM_AND_RELEASE 0
  36. #define STATUS_HOLD 1
  37. #define STATUS_ERROR -1
  38. /* Module IDs using corrlation function */
  39. #define CORRELATE_DBR_MODULE_ID 0
  40. /*
  41. * HKV2 - Tx completion event for one-shot capture
  42. * Cypress - Tx completion event for one-shot capture (or) RXTLV event for RCC
  43. */
  44. #define CORRELATE_TX_EV_MODULE_ID 1
  45. #define get_u16_lsb(value) (uint16_t)(value)
  46. #define get_u16_msb(value) (uint16_t)(((uint32_t)value) >> 16)
  47. #define get_gain_db(value) ((value) & 0xFF)
  48. #define get_gain_table_idx(value) (((value) >> 8) & 0x3)
  49. #define INVALID_PHASE_DELTA 0xFFFF
  50. /**
  51. * target_if_cfr_init_pdev() - Inits cfr pdev and registers necessary handlers.
  52. * @psoc: pointer to psoc object
  53. * @pdev: pointer to pdev object
  54. *
  55. * Return: Registration status for necessary handlers
  56. */
  57. QDF_STATUS
  58. target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc,
  59. struct wlan_objmgr_pdev *pdev);
  60. /**
  61. * target_if_cfr_deinit_pdev() - De-inits corresponding pdev and handlers.
  62. * @psoc: pointer to psoc object
  63. * @pdev: pointer to pdev object
  64. *
  65. * Return: De-registration status for necessary handlers
  66. */
  67. QDF_STATUS
  68. target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc,
  69. struct wlan_objmgr_pdev *pdev);
  70. /**
  71. * target_if_cfr_tx_ops_register() - Registers tx ops for cfr module
  72. * @tx_ops: pointer to tx_ops structure.
  73. */
  74. void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops);
  75. /**
  76. * target_if_cfr_enable_cfr_timer() - Enables cfr timer
  77. * @pdev: pointer to pdev object
  78. * @cfr_timer: Amount of time this timer has to run
  79. *
  80. * Return: status of timer
  81. */
  82. int target_if_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev,
  83. uint32_t cfr_timer);
  84. /**
  85. * target_if_cfr_periodic_peer_cfr_enable() - Function to set params
  86. * for cfr config
  87. * @pdev: pointer to pdev object
  88. * @param_value: value of param being set
  89. *
  90. * Return: success/failure of setting param
  91. */
  92. int target_if_cfr_periodic_peer_cfr_enable(struct wlan_objmgr_pdev *pdev,
  93. uint32_t param_value);
  94. /**
  95. * target_if_cfr_start_capture() - Function to start cfr capture for a peer
  96. * @pdev: pointer to pdev object
  97. * @peer: pointer to peer object
  98. * @cfr_params: capture parameters for this peer
  99. *
  100. * Return: success/failure status of start capture
  101. */
  102. int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
  103. struct wlan_objmgr_peer *peer,
  104. struct cfr_capture_params *cfr_params);
  105. /**
  106. * target_if_cfr_stop_capture() - Function to stop cfr capture for a peer
  107. * @pdev: pointer to pdev object
  108. * @peer: pointer to peer object
  109. *
  110. * Return: success/failure status of stop capture
  111. */
  112. int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
  113. struct wlan_objmgr_peer *peer);
  114. /**
  115. * target_if_cfr_get_target_type() - Function to get target type
  116. * @psoc: pointer to psoc object
  117. *
  118. * Return: target type of target
  119. */
  120. int target_if_cfr_get_target_type(struct wlan_objmgr_psoc *psoc);
  121. /**
  122. * target_if_cfr_set_cfr_support() - Function to set cfr support
  123. * @psoc: pointer to psoc object
  124. * @value: value to be set
  125. */
  126. void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc,
  127. uint8_t value);
  128. /**
  129. * target_if_cfr_set_capture_count_support() - Function to set capture count
  130. * support.
  131. * @psoc: pointer to psoc object
  132. * @value: value to be set
  133. *
  134. * Return: success/failure
  135. */
  136. QDF_STATUS
  137. target_if_cfr_set_capture_count_support(struct wlan_objmgr_psoc *psoc,
  138. uint8_t value);
  139. /**
  140. * target_if_cfr_set_mo_marking_support() - Function to set MO marking support
  141. * @psoc: pointer to psoc object
  142. * @value: value to be set
  143. *
  144. * Return: success/failure
  145. */
  146. QDF_STATUS
  147. target_if_cfr_set_mo_marking_support(struct wlan_objmgr_psoc *psoc,
  148. uint8_t value);
  149. /**
  150. * target_if_cfr_set_aoa_for_rcc_support() - Function to set AoA for RCC
  151. * @psoc: pointer to psoc object
  152. * @value: value to be set
  153. *
  154. * Return: success/failure
  155. */
  156. QDF_STATUS
  157. target_if_cfr_set_aoa_for_rcc_support(struct wlan_objmgr_psoc *psoc,
  158. uint8_t value);
  159. /**
  160. * target_if_cfr_info_send() - Function to send cfr info to upper layers
  161. * @pdev: pointer to pdev object
  162. * @head: pointer to cfr info head
  163. * @hlen: head len
  164. * @data: pointer to cfr info data
  165. * @dlen: data len
  166. * @tail: pointer to cfr info tail
  167. * @tlen: tail len
  168. */
  169. void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head,
  170. size_t hlen, void *data, size_t dlen, void *tail,
  171. size_t tlen);
  172. /**
  173. * target_if_cfr_fill_header() - Function to fill cfr header cmn section
  174. * @hdr: pointer to the csi_cfr_header
  175. * @is_wifi_2_0: flag to indicate legacy and non legacy radio
  176. * @target_type: target type of the radio
  177. * @is_rcc: flag to denote fill header request from periodic cfr/rcc
  178. */
  179. void target_if_cfr_fill_header(struct csi_cfr_header *hdr,
  180. bool is_wifi_2_0,
  181. uint32_t target_type,
  182. bool is_rcc);
  183. #endif