target_if_cfr.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*
  2. * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022 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_pdev_set_param() - Function to set params for cfr config
  86. * @pdev: pointer to pdev object
  87. * @param_value: value of param being set
  88. *
  89. * Return: success/failure of setting param
  90. */
  91. int target_if_cfr_periodic_peer_cfr_enable(struct wlan_objmgr_pdev *pdev,
  92. uint32_t param_value);
  93. /**
  94. * target_if_cfr_start_capture() - Function to start cfr capture for a peer
  95. * @pdev: pointer to pdev object
  96. * @peer: pointer to peer object
  97. * @cfr_params: capture parameters for this peer
  98. *
  99. * Return: success/failure status of start capture
  100. */
  101. int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
  102. struct wlan_objmgr_peer *peer,
  103. struct cfr_capture_params *cfr_params);
  104. /**
  105. * target_if_cfr_stop_capture() - Function to stop cfr capture for a peer
  106. * @pdev: pointer to pdev object
  107. * @peer: pointer to peer object
  108. *
  109. * Return: success/failure status of stop capture
  110. */
  111. int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
  112. struct wlan_objmgr_peer *peer);
  113. /**
  114. * target_if_cfr_get_target_type() - Function to get target type
  115. * @psoc: pointer to psoc object
  116. *
  117. * Return: target type of target
  118. */
  119. int target_if_cfr_get_target_type(struct wlan_objmgr_psoc *psoc);
  120. /**
  121. * target_if_cfr_set_cfr_support() - Function to set cfr support
  122. * @psoc: pointer to psoc object
  123. * @value: value to be set
  124. */
  125. void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc,
  126. uint8_t value);
  127. /**
  128. * target_if_cfr_set_capture_count_support() - Function to set capture count
  129. * support.
  130. * @psoc: pointer to psoc object
  131. * @value: value to be set
  132. *
  133. * Return: success/failure
  134. */
  135. QDF_STATUS
  136. target_if_cfr_set_capture_count_support(struct wlan_objmgr_psoc *psoc,
  137. uint8_t value);
  138. /**
  139. * target_if_cfr_set_mo_marking_support() - Function to set MO marking support
  140. * @psoc: pointer to psoc object
  141. * @value: value to be set
  142. *
  143. * Return: success/failure
  144. */
  145. QDF_STATUS
  146. target_if_cfr_set_mo_marking_support(struct wlan_objmgr_psoc *psoc,
  147. uint8_t value);
  148. /**
  149. * target_if_cfr_set_aoa_for_rcc_support() - Function to set AoA for RCC
  150. * @psoc: pointer to psoc object
  151. * @value: value to be set
  152. *
  153. * Return: success/failure
  154. */
  155. QDF_STATUS
  156. target_if_cfr_set_aoa_for_rcc_support(struct wlan_objmgr_psoc *psoc,
  157. uint8_t value);
  158. /**
  159. * target_if_cfr_info_send() - Function to send cfr info to upper layers
  160. * @pdev: pointer to pdev object
  161. * @head: pointer to cfr info head
  162. * @hlen: head len
  163. * @data: pointer to cfr info data
  164. * @dlen: data len
  165. * @tail: pointer to cfr info tail
  166. * @tlen: tail len
  167. */
  168. void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head,
  169. size_t hlen, void *data, size_t dlen, void *tail,
  170. size_t tlen);
  171. /**
  172. * target_if_cfr_fill_header() - Function to fill cfr header cmn section
  173. * @hdr: pointer to the csi_cfr_header
  174. * @is_wifi_2_0: flag to indicate legacy and non legacy radio
  175. * @target_type: target type of the radio
  176. * @is_rcc: flag to denote fill header request from periodic cfr/rcc
  177. */
  178. void target_if_cfr_fill_header(struct csi_cfr_header *hdr,
  179. bool is_wifi_2_0,
  180. uint32_t target_type,
  181. bool is_rcc);
  182. #endif