qdf_platform.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: qdf_platform.h
  20. * This file defines platform API abstractions.
  21. */
  22. #ifndef _QDF_PLATFORM_H
  23. #define _QDF_PLATFORM_H
  24. /**
  25. * qdf_self_recovery_callback() - callback for self recovery
  26. * @reason: the reason for the recovery request
  27. * @func: the caller's function name
  28. * @line: the line number of the callsite
  29. *
  30. * Return: none
  31. */
  32. typedef void (*qdf_self_recovery_callback)(enum qdf_hang_reason reason,
  33. const char *func,
  34. const uint32_t line);
  35. /**
  36. * qdf_ssr_callback() - callback for ssr
  37. *
  38. * Return: true if fw is down and false if fw is not down
  39. */
  40. typedef void (*qdf_ssr_callback)(const char *);
  41. /**
  42. * qdf_is_module_state_transitioning_cb() - callback to check module state
  43. *
  44. * Return: true if module is in transition, else false
  45. */
  46. typedef int (*qdf_is_module_state_transitioning_cb)(void);
  47. /**
  48. * qdf_is_fw_down_callback() - callback to query if fw is down
  49. *
  50. * Return: true if fw is down and false if fw is not down
  51. */
  52. typedef bool (*qdf_is_fw_down_callback)(void);
  53. /**
  54. * qdf_register_fw_down_callback() - API to register fw down callback
  55. * @is_fw_down: callback to query if fw is down or not
  56. *
  57. * Return: none
  58. */
  59. void qdf_register_fw_down_callback(qdf_is_fw_down_callback is_fw_down);
  60. /**
  61. * qdf_is_fw_down() - API to check if fw is down or not
  62. *
  63. * Return: true: if fw is down
  64. * false: if fw is not down
  65. */
  66. bool qdf_is_fw_down(void);
  67. /**
  68. * qdf_register_self_recovery_callback() - register self recovery callback
  69. * @callback: self recovery callback
  70. *
  71. * Return: None
  72. */
  73. void qdf_register_self_recovery_callback(qdf_self_recovery_callback callback);
  74. /**
  75. * qdf_trigger_self_recovery () - tirgger self recovery
  76. *
  77. * Return: None
  78. */
  79. #define qdf_trigger_self_recovery() \
  80. __qdf_trigger_self_recovery(__func__, __LINE__)
  81. void __qdf_trigger_self_recovery(const char *func, const uint32_t line);
  82. /**
  83. * qdf_register_ssr_protect_callbacks() - register [un]protect callbacks
  84. *
  85. * Return: None
  86. */
  87. void qdf_register_ssr_protect_callbacks(qdf_ssr_callback protect,
  88. qdf_ssr_callback unprotect);
  89. /**
  90. * qdf_ssr_protect() - start SSR protection
  91. *
  92. * Return: None
  93. */
  94. void qdf_ssr_protect(const char *caller);
  95. /**
  96. * qdf_ssr_unprotect() - remove SSR protection
  97. *
  98. * Return: None
  99. */
  100. void qdf_ssr_unprotect(const char *caller);
  101. /**
  102. * qdf_register_module_state_query_callback() - register module state query
  103. *
  104. * Return: None
  105. */
  106. void qdf_register_module_state_query_callback(
  107. qdf_is_module_state_transitioning_cb query);
  108. /**
  109. * qdf_is_module_state_transitioning() - query module state transition
  110. *
  111. * Return: true if in transition else false
  112. */
  113. bool qdf_is_module_state_transitioning(void);
  114. #endif /*_QDF_PLATFORM_H*/