qdf_dev.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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: qdf_dev
  20. * QCA driver framework (QDF) device management APIs
  21. */
  22. #if !defined(__QDF_DEV_H)
  23. #define __QDF_DEV_H
  24. /* Include Files */
  25. #include <qdf_types.h>
  26. #include "i_qdf_dev.h"
  27. struct qdf_cpu_mask;
  28. struct qdf_devm;
  29. struct qdf_dev;
  30. #ifdef ENHANCED_OS_ABSTRACTION
  31. /**
  32. * qdf_dev_alloc_mem() - allocate memory
  33. * @qdfdev: Device handle
  34. * @mrptr: Pointer to the allocated memory
  35. * @reqsize: Allocation request in bytes
  36. * @mask: Property mask to be associated to the allocated memory
  37. *
  38. * This function will acquire memory to be associated with a device
  39. *
  40. * Return: QDF_STATUS_SUCCESS on success
  41. */
  42. QDF_STATUS
  43. qdf_dev_alloc_mem(struct qdf_dev *qdfdev, struct qdf_devm **mrptr,
  44. uint32_t reqsize, uint32_t mask);
  45. /**
  46. * qdf_dev_release_mem() - release memory
  47. * @qdfdev: Device handle
  48. * @mrptr: Pointer to the allocated memory
  49. *
  50. * This function will acquire memory to be associated with a device
  51. *
  52. * Return: QDF_STATUS_SUCCESS on success
  53. */
  54. QDF_STATUS
  55. qdf_dev_release_mem(struct qdf_dev *qdfdev, struct qdf_devm *mrptr);
  56. /**
  57. * qdf_dev_modify_irq() - modify irq
  58. * @irnum: irq number
  59. * @cmask: Bitmap to be cleared for the property mask
  60. * @smask: Bitmap to be set for the property mask
  61. *
  62. * This function will acquire memory to be associated with a device
  63. *
  64. * Return: QDF_STATUS_SUCCESS on success
  65. */
  66. QDF_STATUS
  67. qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask,
  68. unsigned long smask);
  69. /**
  70. * qdf_dev_set_irq_affinity() - set irq affinity
  71. * @irnum: irq number
  72. * @cpmask: cpu affinity bitmap
  73. *
  74. * This function will set the affinity level for an irq
  75. *
  76. * Return: QDF_STATUS_SUCCESS on success
  77. */
  78. QDF_STATUS
  79. qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask);
  80. #else
  81. static inline QDF_STATUS
  82. qdf_dev_alloc_mem(struct qdf_dev *qdfdev, struct qdf_devm **mrptr,
  83. uint32_t reqsize, uint32_t mask)
  84. {
  85. return __qdf_dev_alloc_mem(qdfdev, mrptr, reqsize, mask);
  86. }
  87. static inline QDF_STATUS
  88. qdf_dev_release_mem(struct qdf_dev *qdfdev, struct qdf_devm *mrptr)
  89. {
  90. return __qdf_dev_release_mem(qdfdev, mrptr);
  91. }
  92. static inline QDF_STATUS
  93. qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask,
  94. unsigned long smask)
  95. {
  96. return __qdf_dev_modify_irq_status(irnum, cmask, smask);
  97. }
  98. static inline QDF_STATUS
  99. qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask)
  100. {
  101. return __qdf_dev_set_irq_affinity(irnum, cpmask);
  102. }
  103. #endif
  104. #endif /* __QDF_DEV_H */