wlan_dsc_driver.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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) driver-level APIs
  20. */
  21. #ifndef __WLAN_DSC_DRIVER_H
  22. #define __WLAN_DSC_DRIVER_H
  23. #include "qdf_status.h"
  24. /**
  25. * struct dsc_driver - opaque dsc driver context
  26. */
  27. struct dsc_driver;
  28. /**
  29. * dsc_driver_create() - create a dsc driver context
  30. * @out_driver: opaque double pointer to assign the new context to
  31. *
  32. * Return: QDF_STATUS
  33. */
  34. QDF_STATUS dsc_driver_create(struct dsc_driver **out_driver);
  35. /**
  36. * dsc_driver_destroy() - destroy a dsc driver context
  37. * @out_driver: opaque double pointer to context to destroy and NULL
  38. *
  39. * Note, this:
  40. * - aborts all queued transitions on @driver
  41. * - asserts @driver has no attached psoc's
  42. * - asserts @driver has no operations in flight
  43. *
  44. * Return: None
  45. */
  46. void dsc_driver_destroy(struct dsc_driver **out_driver);
  47. /**
  48. * dsc_driver_trans_start() - start a transition on @driver
  49. * @driver: the driver to start a transition on
  50. * @desc: a unique description of the transition to start
  51. *
  52. * This API immediately aborts if a transition on @driver is already in flight
  53. *
  54. * Call dsc_driver_trans_stop() to complete the transition.
  55. *
  56. * Return:
  57. * QDF_STATUS_SUCCESS - transition started succcessfully
  58. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  59. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  60. * QDF_STATUS_E_ALREADY - transition with @desc already in flight
  61. */
  62. QDF_STATUS dsc_driver_trans_start(struct dsc_driver *driver, const char *desc);
  63. /**
  64. * dsc_driver_trans_start_wait() - start a transition on @driver, blocking if a
  65. * transition is already in flight
  66. * @driver: the driver to start a transition on
  67. * @desc: a unique description of the transition to start
  68. *
  69. * Call dsc_driver_trans_stop() to complete the transition.
  70. *
  71. * Return:
  72. * QDF_STATUS_SUCCESS - transition started succcessfully
  73. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  74. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  75. * QDF_STATUS_E_ALREADY - transition with @desc already queued or in flight
  76. */
  77. QDF_STATUS
  78. dsc_driver_trans_start_wait(struct dsc_driver *driver, const char *desc);
  79. /**
  80. * dsc_driver_trans_stop() - complete current transition in flight on @driver
  81. * @driver: the driver to complete the transition on
  82. *
  83. * Note: this asserts a transition is currently in flight on @driver
  84. *
  85. * Return: None
  86. */
  87. void dsc_driver_trans_stop(struct dsc_driver *driver);
  88. /**
  89. * dsc_driver_trans_assert() - assert transition in flight on @driver
  90. * @driver: the driver to assert transition in flight on
  91. *
  92. * Return: None
  93. */
  94. void dsc_driver_trans_assert(struct dsc_driver *driver);
  95. /**
  96. * dsc_driver_op_start() - start an operation on @driver
  97. * @driver: the driver to start an operation on
  98. *
  99. * Return:
  100. * QDF_STATUS_SUCCESS - operation started succcessfully
  101. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  102. * QDF_STATUS_E_AGAIN - operation cannot currently be started
  103. * QDF_STATUS_E_NOMEM - out of memory
  104. */
  105. #define dsc_driver_op_start(driver) _dsc_driver_op_start(driver, __func__)
  106. QDF_STATUS _dsc_driver_op_start(struct dsc_driver *driver, const char *func);
  107. /**
  108. * dsc_driver_op_stop() - complete operation with matching @func on @driver
  109. * @driver: the driver to stop an operation on
  110. *
  111. * Note: this asserts @func was previously started
  112. *
  113. * Return: None
  114. */
  115. #define dsc_driver_op_stop(driver) _dsc_driver_op_stop(driver, __func__)
  116. void _dsc_driver_op_stop(struct dsc_driver *driver, const char *func);
  117. /**
  118. * dsc_driver_wait_for_ops() - blocks until all operations on @driver have
  119. * stopped
  120. * @driver: the driver to wait for operations on
  121. *
  122. * Note: this asserts that @driver cannot currently transition
  123. *
  124. * Return: None
  125. */
  126. void dsc_driver_wait_for_ops(struct dsc_driver *driver);
  127. #endif /* __WLAN_DSC_DRIVER_H */