wmi_unified_rtt.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /*
  2. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /*
  17. * Structure and macros in this file are copied from rtt_oem_interface.h FW
  18. * header file.
  19. */
  20. #ifndef _WMI_UNIFIED_RTT_H_
  21. #define _WMI_UNIFIED_RTT_H_
  22. /* For backward compatibility reason, CIVIC_INFO_MAX_LENGTH shouldn't be changed
  23. * from value 64.
  24. */
  25. #define CIVIC_INFO_MAX_LENGTH 64
  26. /* TLV Helper macro to set the TLV Header given the pointer to the TLV buffer */
  27. #define WMIRTT_TLV_SET_HDR(tlv_buf, tag, len) \
  28. ((((A_UINT32 *)(tlv_buf))[0]) = ((tag << 16) | (len & 0x0000FFFF)))
  29. #define WMIRTT_TLV_TAG_STRUC_wmi_rtt_oem_req_head 32
  30. #define WMIRTT_TLV_TAG_STRUC_wmi_rtt_oem_lcr_cfg_head 46
  31. #define WMIRTT_TLV_TAG_STRUC_wmi_rtt_oem_lci_cfg_head 47
  32. /* Set/get RTT request ID*/
  33. #define WMI_RTT_REQ_ID_S 0
  34. #define WMI_RTT_REQ_ID (0xffff << WMI_RTT_REQ_ID_S)
  35. #define WMI_RTT_REQ_ID_GET(x) WMI_F_MS(x, WMI_RTT_REQ_ID)
  36. #define WMI_RTT_REQ_ID_SET(x, z) WMI_F_RMW(x, z, WMI_RTT_REQ_ID)
  37. /* Set/get latitude */
  38. #define WMI_RTT_LCI_LAT_UNC_S 0
  39. #define WMI_RTT_LCI_LAT_UNC (0xff << WMI_RTT_LCI_LAT_UNC_S)
  40. #define WMI_RTT_LCI_LAT_UNC_GET(x) WMI_F_MS(x, WMI_RTT_LCI_LAT_UNC)
  41. #define WMI_RTT_LCI_LAT_UNC_SET(x, z) WMI_F_RMW(x, z, WMI_RTT_LCI_LAT_UNC)
  42. /* Set/get longitude */
  43. #define WMI_RTT_LCI_LON_UNC_S 8
  44. #define WMI_RTT_LCI_LON_UNC (0xff << WMI_RTT_LCI_LON_UNC_S)
  45. #define WMI_RTT_LCI_LON_UNC_GET(x) WMI_F_MS(x, WMI_RTT_LCI_LON_UNC)
  46. #define WMI_RTT_LCI_LON_UNC_SET(x, z) WMI_F_RMW(x, z, WMI_RTT_LCI_LON_UNC)
  47. /* Set/get altitude */
  48. #define WMI_RTT_LCI_ALT_UNC_S 16
  49. #define WMI_RTT_LCI_ALT_UNC (0xff << WMI_RTT_LCI_ALT_UNC_S)
  50. #define WMI_RTT_LCI_ALT_UNC_GET(x) WMI_F_MS(x, WMI_RTT_LCI_ALT_UNC)
  51. #define WMI_RTT_LCI_ALT_UNC_SET(x, z) WMI_F_RMW(x, z, WMI_RTT_LCI_ALT_UNC)
  52. /* Set/get motion pattern */
  53. #define WMI_RTT_LCI_Z_MOTION_PAT_S 24
  54. #define WMI_RTT_LCI_Z_MOTION_PAT (0xff << WMI_RTT_LCI_Z_MOTION_PAT_S)
  55. #define WMI_RTT_LCI_Z_MOTION_PAT_GET(x) WMI_F_MS(x, WMI_RTT_LCI_Z_MOTION_PAT)
  56. #define WMI_RTT_LCI_Z_MOTION_PAT_SET(x, z) \
  57. WMI_F_RMW(x, z, WMI_RTT_LCI_Z_MOTION_PAT)
  58. /* Set/get hight above floor */
  59. #define WMI_RTT_LCI_Z_HEIGHT_ABV_FLR_S 0
  60. #define WMI_RTT_LCI_Z_HEIGHT_ABV_FLR (0xffff << WMI_RTT_LCI_Z_HEIGHT_ABV_FLR_S)
  61. #define WMI_RTT_LCI_Z_HEIGHT_ABV_FLR_GET(x) \
  62. WMI_F_MS(x, WMI_RTT_LCI_Z_HEIGHT_ABV_FLR)
  63. #define WMI_RTT_LCI_Z_HEIGHT_ABV_FLR_SET(x, z) \
  64. WMI_F_RMW(x, z, WMI_RTT_LCI_Z_HEIGHT_ABV_FLR)
  65. /* Set/get hight uncertainty value */
  66. #define WMI_RTT_LCI_Z_HEIGHT_UNC_S 16
  67. #define WMI_RTT_LCI_Z_HEIGHT_UNC (0xff << WMI_RTT_LCI_Z_HEIGHT_UNC_S)
  68. #define WMI_RTT_LCI_Z_HEIGHT_UNC_GET(x) WMI_F_MS(x, WMI_RTT_LCI_Z_HEIGHT_UNC)
  69. #define WMI_RTT_LCI_Z_HEIGHT_UNC_SET(x, z) \
  70. WMI_F_RMW(x, z, WMI_RTT_LCI_Z_HEIGHT_UNC)
  71. /* Set/get civic info */
  72. #define WMI_RTT_LOC_CIVIC_LENGTH_S 0
  73. #define WMI_RTT_LOC_CIVIC_LENGTH (0xff << WMI_RTT_LOC_CIVIC_LENGTH_S)
  74. #define WMI_RTT_LOC_CIVIC_LENGTH_GET(x) WMI_F_MS(x, WMI_RTT_LOC_CIVIC_LENGTH)
  75. #define WMI_RTT_LOC_CIVIC_LENGTH_SET(x, z) \
  76. WMI_F_RMW(x, z, WMI_RTT_LOC_CIVIC_LENGTH)
  77. /**
  78. * WMIRTT_OEM_MSG_SUBTYPE - RTT message subtype definitions
  79. * @RTT_MSG_SUBTYPE_INVALID: Invalid message subtype
  80. * @RTT_MSG_SUBTYPE_CAPABILITY_REQ: Capability request
  81. * @RTT_MSG_SUBTYPE_CAPABILITY_RSP: Capability response
  82. * @RTT_MSG_SUBTYPE_MEASUREMENT_REQ: Measurement request
  83. * @RTT_MSG_SUBTYPE_MEASUREMENT_RSP: Measurement response
  84. * @RTT_MSG_SUBTYPE_ERROR_REPORT_RSP: Error report response
  85. * @RTT_MSG_SUBTYPE_CONFIGURE_LCR: Configure LCR
  86. * @RTT_MSG_SUBTYPE_CONFIGURE_LCI: Configure LCI
  87. * @RTT_MSG_SUBTYPE_CLEANUP_REQ: Cleanup request
  88. * @RTT_MSG_SUBTYPE_CLEANUP_RSP: Cleanup response
  89. * @RTT_MSG_SUBTYPE_GET_CHANNEL_INFO_REQ: Request for channel info
  90. * @RTT_MSG_SUBTYPE_GET_CHANNEL_INFO_RSP: RESPONSE for channel info
  91. * @RTT_MSG_SUBTYPE_CFG_RESPONDER_MODE_REQ: Request to enable/disable responder
  92. * mode
  93. * @RTT_MSG_SUBTYPE_CFG_RESPONDER_MODE_RSP: Response for enable mode
  94. * @RTT_MSG_SUBTYPE_CANCEL_MEASUREMENT_REQ: Request to cancel measurement
  95. * request
  96. * @RTT_MSG_SUBTYPE_CANCEL_MEASUREMENT_RSP: Response for cancel measurement
  97. * request
  98. * @RTT_MSG_SUBTYPE_CFG_RESPONDER_MEASUREMENT_REQ: Request to enable or disable
  99. * responder measurement
  100. * @RTT_MSG_SUBTYPE_CFG_RESPONDER_MEASUREMENT_RSP: Response to responder
  101. * measurement enable/disable request
  102. * @RTT_MSG_SUBTYPE_RESPONDER_MEASUREMENT_RSP: Responder measurement report
  103. */
  104. enum WMIRTT_OEM_MSG_SUBTYPE {
  105. RTT_MSG_SUBTYPE_INVALID = 0x00,
  106. RTT_MSG_SUBTYPE_CAPABILITY_REQ = 0x01,
  107. RTT_MSG_SUBTYPE_CAPABILITY_RSP = 0x02,
  108. RTT_MSG_SUBTYPE_MEASUREMENT_REQ = 0x03,
  109. RTT_MSG_SUBTYPE_MEASUREMENT_RSP = 0x04,
  110. RTT_MSG_SUBTYPE_ERROR_REPORT_RSP = 0x05,
  111. RTT_MSG_SUBTYPE_CONFIGURE_LCR = 0x06,
  112. RTT_MSG_SUBTYPE_CONFIGURE_LCI = 0x07,
  113. RTT_MSG_SUBTYPE_CLEANUP_REQ = 0x08,
  114. RTT_MSG_SUBTYPE_CLEANUP_RSP = 0x09,
  115. RTT_MSG_SUBTYPE_GET_CHANNEL_INFO_REQ = 0x10,
  116. RTT_MSG_SUBTYPE_GET_CHANNEL_INFO_RSP = 0x11,
  117. RTT_MSG_SUBTYPE_CFG_RESPONDER_MODE_REQ = 0x12,
  118. RTT_MSG_SUBTYPE_CFG_RESPONDER_MODE_RSP = 0x13,
  119. RTT_MSG_SUBTYPE_CANCEL_MEASUREMENT_REQ = 0x14,
  120. RTT_MSG_SUBTYPE_CANCEL_MEASUREMENT_RSP = 0x15,
  121. RTT_MSG_SUBTYPE_CFG_RESPONDER_MEASUREMENT_REQ = 0x16,
  122. RTT_MSG_SUBTYPE_CFG_RESPONDER_MEASUREMENT_RSP = 0x17,
  123. RTT_MSG_SUBTYPE_RESPONDER_MEASUREMENT_RSP = 0x18,
  124. };
  125. /**
  126. * wmi_rtt_oem_req_head - RTT OEM request head structure
  127. * @tlv_header: TLV tag and len; tag equals
  128. * WMIRTT_TLV_TAG_STRUC_wmi_rtt_oem_req_head
  129. * @sub_type: WMIRTT_OEM_MSG_SUBTYPE
  130. * @req_id: Unique request ID for this RTT oem req;
  131. * bit 15:0 Request ID
  132. * bit 16: sps enable 0- disable 1--enable
  133. * bit 31:17 reserved
  134. * @pdev_id: pdev_id for identifying the MAC.
  135. */
  136. struct wmi_rtt_oem_req_head {
  137. A_UINT32 tlv_header;
  138. A_UINT32 sub_type;
  139. A_UINT32 req_id;
  140. A_UINT32 pdev_id;
  141. };
  142. /**
  143. * wmi_rtt_oem_lci_cfg_head - LCI config structure
  144. * @tlv_header: TLV tag and len; tag equals
  145. * WMIRTT_TLV_TAG_STRUC_wmi_rtt_oem_lci_cfg_head
  146. * @latitude: LS 34 bits - latitude in degrees * 2^25 , 2's complement; Lower
  147. * 32 bits comes first followed by higher 32 bytes
  148. * @longitude: LS 34 bits - latitude in degrees * 2^25 , 2's complement; Lower
  149. * 32 bits comes first followed by higher 32 bytes
  150. * @altitude: LS 30bits - Altitude in units of 1/256 m
  151. * @lci_cfg_param_info: Uncertainities & motion pattern cfg
  152. * bits 7:0 - Latitude_uncertainity as defined in Section
  153. 2.3.2 of IETF RFC 6225
  154. * bits 15:8 - Longitude_uncertainity as defined in Section
  155. * 2.3.2 of IETF RFC 6225
  156. * bits 23:16 - Altitude_uncertainity as defined in Section
  157. * 2.4.5 of IETF RFC 6225
  158. * bits 31:24 - motion_pattern for use with z subelement
  159. * cfg as per wmi_rtt_z_subelem_motion_pattern
  160. * @floor: in units 1/16th of floor # if known.
  161. * value is 80000000 if unknown
  162. * @floor_param_info: height_above_floor & uncertainity
  163. * bits 15:0 - Height above floor in units of 1/64 m
  164. * bits 23:16 - Height uncertainity as defined in 802.11REVmc
  165. * D4.0 Z subelem format.
  166. * value 0 means unknown, values 1-18 are valid
  167. * and 19 and above are reserved.
  168. * bits 31:24 - reserved
  169. * @usage_rules:
  170. * bit 0 - usage_rules: retransmittion allowed: 0-No 1-Yes
  171. * bit 1 - usage_rules: retention expires relative present: 0-No 1-Yes
  172. * bit 2 - usage_rules: STA Location policy for Additional neighbor info:
  173. * 0-No 1-Yes
  174. * bits 7:3 - usage_rules: reserved
  175. * bits 23:8 - usage_rules: retention expires relative, if present, as per
  176. * IETF RFC 4119
  177. * bits 31:24 - reserved
  178. */
  179. struct wmi_rtt_oem_lci_cfg_head {
  180. A_UINT32 tlv_header;
  181. A_UINT64 latitude;
  182. A_UINT64 longitude;
  183. A_UINT32 altitude;
  184. A_UINT32 lci_cfg_param_info;
  185. A_UINT32 floor;
  186. A_UINT32 floor_param_info;
  187. A_UINT32 usage_rules;
  188. };
  189. /**
  190. * wmi_rtt_oem_lcr_cfg_head - LCR config structure
  191. * @tlv_header: TLV tag and len; tag equals
  192. * WMIRTT_TLV_TAG_STRUC_wmi_rtt_oem_lcr_cfg_head
  193. * @loc_civic_params:
  194. * bit 7:0 - len in bytes. civic_info to be used in reference to this.
  195. * bit 31:8 - reserved
  196. * @civic_info: Civic info including country_code to be copied in FTM frame.
  197. * 256 bytes max. Based on len, FW will copy byte-wise into
  198. * local buffers and transfer OTA. This is packed as a 4 bytes
  199. * aligned buffer at this interface for transfer to FW though.
  200. */
  201. struct wmi_rtt_oem_lcr_cfg_head {
  202. A_UINT32 tlv_header;
  203. A_UINT32 loc_civic_params;
  204. A_UINT32 civic_info[CIVIC_INFO_MAX_LENGTH];
  205. };
  206. #endif