wlan_ftm_ucfg_api.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
  3. *
  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. /**
  20. * DOC: declare the ftm service data structure and apis
  21. */
  22. #ifndef _WLAN_FTM_UCFG_API_H_
  23. #define _WLAN_FTM_UCFG_API_H_
  24. #include <qdf_types.h>
  25. #include <qdf_status.h>
  26. #include <wlan_objmgr_cmn.h>
  27. #define FTM_DEBUG 0
  28. #if FTM_DEBUG
  29. #define ftm_log(level, args...) \
  30. QDF_TRACE(QDF_MODULE_ID_FTM, level, ## args)
  31. #define ftm_logfl(level, format, args...) \
  32. ftm_log(level, FL(format), ## args)
  33. #define ftm_alert(format, args...) \
  34. ftm_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
  35. #define ftm_err(format, args...) \
  36. ftm_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
  37. #define ftm_warn(format, args...) \
  38. ftm_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
  39. #define ftm_notice(format, args...) \
  40. ftm_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
  41. #define ftm_debug(format, args...) \
  42. ftm_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
  43. #else
  44. #define ftm_alert(format, args...)
  45. #define ftm_err(format, args...)
  46. #define ftm_warn(format, args...)
  47. #define ftm_notice(format, args...)
  48. #define ftm_debug(format, args...)
  49. #endif
  50. #define FTM_IOCTL_UNIFIED_UTF_CMD 0x1000
  51. #define FTM_IOCTL_UNIFIED_UTF_RSP 0x1001
  52. #define FTM_CMD_MAX_BUF_LENGTH 2048
  53. /**
  54. * enum wifi_ftm_cmd_type - the enumeration of the command source per pdev
  55. * @WIFI_FTM_CMD_IOCTL: command from ioctl on the pdev
  56. * @WIFI_FTM_CMD_NL80211: command from nl80211 on the pdev
  57. *
  58. */
  59. enum wifi_ftm_pdev_cmd_type {
  60. WIFI_FTM_CMD_IOCTL = 1,
  61. WIFI_FTM_CMD_NL80211,
  62. /* command should be added above */
  63. WIFI_FTM_CMD_UNKNOWN,
  64. };
  65. /**
  66. * struct wifi_ftm_pdev_priv_obj - wifi ftm pdev utf event info
  67. * @pdev: pointer to pdev
  68. * @data: data ptr
  69. * @current_seq: curent squence
  70. * @expected_seq: expected sequence
  71. * @length: length
  72. * @offset: offset
  73. * @cmd_type: command type from either ioctl or nl80211
  74. */
  75. struct wifi_ftm_pdev_priv_obj {
  76. struct wlan_objmgr_pdev *pdev;
  77. uint8_t *data;
  78. uint8_t current_seq;
  79. uint8_t expected_seq;
  80. qdf_size_t length;
  81. qdf_size_t offset;
  82. enum wifi_ftm_pdev_cmd_type cmd_type;
  83. };
  84. /**
  85. * wlan_ftm_testmode_cmd() - handle FTM testmode command
  86. * @pdev: pdev pointer
  87. * @data: data
  88. * @len: data length
  89. *
  90. * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
  91. */
  92. QDF_STATUS ucfg_wlan_ftm_testmode_cmd(struct wlan_objmgr_pdev *pdev,
  93. uint8_t *data, uint32_t len);
  94. /**
  95. * wlan_ftm_testmode_rsp() - handle FTM testmode command
  96. * @pdev: pdev pointer
  97. * @data: data
  98. *
  99. * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
  100. */
  101. QDF_STATUS ucfg_wlan_ftm_testmode_rsp(struct wlan_objmgr_pdev *pdev,
  102. uint8_t *data);
  103. /**
  104. * wlan_ftm_process_utf_event() - process ftm UTF event
  105. * @scn_handle: scn handle
  106. * @event: event buffer
  107. * @len: event length
  108. *
  109. * return: QDF_STATUS_SUCCESS for success or error code
  110. */
  111. QDF_STATUS wlan_ftm_process_utf_event(struct wlan_objmgr_pdev *pdev,
  112. uint8_t *event_buf, uint32_t len);
  113. #endif /* _WLAN_FTM_UCFG_API_H_ */