wlan_dsc_psoc.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * Copyright (c) 2018-2019 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. /**
  20. * DOC: Driver Synchronization Core (DSC) psoc-level APIs
  21. */
  22. #ifndef __WLAN_DSC_PSOC_H
  23. #define __WLAN_DSC_PSOC_H
  24. #include "qdf_status.h"
  25. #include "wlan_dsc_driver.h"
  26. /*
  27. * struct dsc_psoc - opaque dsc psoc context
  28. */
  29. struct dsc_psoc;
  30. /**
  31. * dsc_psoc_create() - create a dsc psoc context
  32. * @driver: parent dsc driver context
  33. * @out_psoc: opaque double pointer to assign the new context to
  34. *
  35. * Note: this attaches @out_psoc to @driver
  36. *
  37. * Return: QDF_STATUS
  38. */
  39. QDF_STATUS
  40. dsc_psoc_create(struct dsc_driver *driver, struct dsc_psoc **out_psoc);
  41. /**
  42. * dsc_psoc_destroy() - destroy a dsc psoc context
  43. * @out_psoc: opaque double pointer to context to destroy and NULL
  44. *
  45. * Note, this:
  46. * - detaches @out_psoc from its parent driver context
  47. * - aborts all queued transitions on @psoc
  48. * - asserts @psoc has no attached vdev's
  49. * - asserts @psoc has no operations in flight
  50. *
  51. * Return: None
  52. */
  53. void dsc_psoc_destroy(struct dsc_psoc **out_psoc);
  54. /**
  55. * dsc_psoc_trans_start() - start a transition on @psoc
  56. * @psoc: the psoc to start a transition on
  57. * @desc: a unique description of the transition to start
  58. *
  59. * This API immediately aborts if a transition on @psoc is already in flight
  60. *
  61. * Call dsc_psoc_trans_stop() to complete the transition.
  62. *
  63. * Return:
  64. * QDF_STATUS_SUCCESS - transition started successfully
  65. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  66. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  67. * QDF_STATUS_E_ALREADY - transition with @desc already in flight
  68. */
  69. QDF_STATUS dsc_psoc_trans_start(struct dsc_psoc *psoc, const char *desc);
  70. /**
  71. * dsc_psoc_trans_start_wait() - start a transition on @psoc, blocking if a
  72. * transition is already in flight
  73. * @psoc: the psoc to start a transition on
  74. * @desc: a unique description of the transition to start
  75. *
  76. * Call dsc_psoc_trans_stop() to complete the transition.
  77. *
  78. * Return:
  79. * QDF_STATUS_SUCCESS - transition started successfully
  80. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  81. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  82. * QDF_STATUS_E_ALREADY - transition with @desc already queued or in flight
  83. * QDF_STATUS_E_ABORTED - transition was aborted
  84. */
  85. QDF_STATUS dsc_psoc_trans_start_wait(struct dsc_psoc *psoc, const char *desc);
  86. /**
  87. * dsc_psoc_trans_stop() - complete current transition in flight on @psoc
  88. * @psoc: the psoc to complete the transition on
  89. *
  90. * Note: this asserts a transition is currently in flight on @psoc
  91. *
  92. * Return: None
  93. */
  94. void dsc_psoc_trans_stop(struct dsc_psoc *psoc);
  95. /**
  96. * dsc_psoc_assert_trans_protected() - assert @psoc is protected by a transition
  97. * @psoc: the psoc to check
  98. *
  99. * The protecting transition may be in flight on @psoc or its parent.
  100. *
  101. * Return: None
  102. */
  103. void dsc_psoc_assert_trans_protected(struct dsc_psoc *psoc);
  104. /**
  105. * dsc_psoc_op_start() - start an operation on @psoc
  106. * @psoc: the psoc to start an operation on
  107. *
  108. * Return:
  109. * QDF_STATUS_SUCCESS - operation started successfully
  110. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  111. * QDF_STATUS_E_AGAIN - operation cannot currently be started
  112. * QDF_STATUS_E_NOMEM - out of memory
  113. */
  114. #define dsc_psoc_op_start(psoc) _dsc_psoc_op_start(psoc, __func__)
  115. QDF_STATUS _dsc_psoc_op_start(struct dsc_psoc *psoc, const char *func);
  116. /**
  117. * dsc_psoc_op_stop() - complete operation with matching @func on @psoc
  118. * @psoc: the psoc to stop an operation on
  119. *
  120. * Note: this asserts @func was previously started
  121. *
  122. * Return: None
  123. */
  124. #define dsc_psoc_op_stop(psoc) _dsc_psoc_op_stop(psoc, __func__)
  125. void _dsc_psoc_op_stop(struct dsc_psoc *psoc, const char *func);
  126. /**
  127. * dsc_psoc_wait_for_ops() - blocks until all operations on @psoc have stopped
  128. * @psoc: the psoc to wait for operations on
  129. *
  130. * Note: this asserts that @psoc cannot currently transition
  131. *
  132. * Return: None
  133. */
  134. void dsc_psoc_wait_for_ops(struct dsc_psoc *psoc);
  135. #endif /* __WLAN_DSC_PSOC_H */