wlan_dsc_psoc.h 4.6 KB

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