wlan_dsc_psoc.h 4.6 KB

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