qv.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*$file${include::qv.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
  2. /*
  3. * Model: qpc.qm
  4. * File: ${include::qv.h}
  5. *
  6. * This code has been generated by QM 5.2.5 <www.state-machine.com/qm>.
  7. * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
  8. *
  9. * This code is covered by the following QP license:
  10. * License # : LicenseRef-QL-dual
  11. * Issued to : Any user of the QP/C real-time embedded framework
  12. * Framework(s) : qpc
  13. * Support ends : 2023-12-31
  14. * License scope:
  15. *
  16. * Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
  17. *
  18. * SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
  19. *
  20. * This software is dual-licensed under the terms of the open source GNU
  21. * General Public License version 3 (or any later version), or alternatively,
  22. * under the terms of one of the closed source Quantum Leaps commercial
  23. * licenses.
  24. *
  25. * The terms of the open source GNU General Public License version 3
  26. * can be found at: <www.gnu.org/licenses/gpl-3.0>
  27. *
  28. * The terms of the closed source Quantum Leaps commercial licenses
  29. * can be found at: <www.state-machine.com/licensing>
  30. *
  31. * Redistributions in source code must retain this top-level comment block.
  32. * Plagiarizing this software to sidestep the license obligations is illegal.
  33. *
  34. * Contact information:
  35. * <www.state-machine.com/licensing>
  36. * <info@state-machine.com>
  37. */
  38. /*$endhead${include::qv.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
  39. /*! @file
  40. * @brief QV/C (cooperative "Vanilla" kernel) platform-independent
  41. * public interface
  42. */
  43. #ifndef QV_H_
  44. #define QV_H_
  45. /*==========================================================================*/
  46. /* QF customization for QV -- data members of the QActive class... */
  47. /* QV event-queue used for AOs */
  48. #define QF_EQUEUE_TYPE QEQueue
  49. /*==========================================================================*/
  50. #include "qequeue.h" /* QV kernel uses the native QP event queue */
  51. #include "qmpool.h" /* QV kernel uses the native QP memory pool */
  52. #include "qf.h" /* QF framework integrates directly with QV */
  53. //============================================================================
  54. /*$declare${QV::QV-base} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
  55. /*${QV::QV-base::Attr} .....................................................*/
  56. /*! @brief QV cooperative kernel
  57. * @class QV
  58. */
  59. typedef struct QV_Attr {
  60. uint8_t dummy; /*< dummy attribute */
  61. } QV;
  62. /*${QV::QV-base::onIdle} ...................................................*/
  63. /*! QV idle callback (customized in BSPs)
  64. * @static @public @memberof QV
  65. *
  66. * @details
  67. * QV_onIdle() is called by the cooperative QV kernel (from QF_run()) when
  68. * the scheduler detects that no events are available for active objects
  69. * (the idle condition). This callback gives the application an opportunity
  70. * to enter a power-saving CPU mode, or perform some other idle processing
  71. * (such as QS software tracing output).
  72. *
  73. * @attention
  74. * QV_onIdle() is invoked with interrupts **DISABLED** because the idle
  75. * condition can be asynchronously changed at any time by an interrupt.
  76. * QV_onIdle() MUST enable the interrupts internally, but not before
  77. * putting the CPU into the low-power mode. (Ideally, enabling interrupts and
  78. * low-power mode should happen atomically). At the very least, the function
  79. * MUST enable interrupts, otherwise interrupts will remain disabled
  80. * permanently.
  81. */
  82. void QV_onIdle(void);
  83. /*$enddecl${QV::QV-base} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
  84. /*==========================================================================*/
  85. /* interface used only inside QF, but not in applications */
  86. #ifdef QP_IMPL
  87. /* QV-specific scheduler locking and event queue... */
  88. /*$declare${QV-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
  89. /*${QV-impl::QF_SCHED_STAT_} ...............................................*/
  90. /*! QV scheduler lock status (not needed in QV) */
  91. #define QF_SCHED_STAT_
  92. /*${QV-impl::QF_SCHED_LOCK_} ...............................................*/
  93. /*! QV scheduler locking (not needed in QV) */
  94. #define QF_SCHED_LOCK_(dummy) ((void)0)
  95. /*${QV-impl::QF_SCHED_UNLOCK_} .............................................*/
  96. /*! QV scheduler unlocking (not needed in QV) */
  97. #define QF_SCHED_UNLOCK_() ((void)0)
  98. /*${QV-impl::QACTIVE_EQUEUE_WAIT_} .........................................*/
  99. #define QACTIVE_EQUEUE_WAIT_(me_) \
  100. Q_ASSERT_ID(0, (me_)->eQueue.frontEvt != (QEvt *)0)
  101. /*${QV-impl::QACTIVE_EQUEUE_SIGNAL_} .......................................*/
  102. /*! QV native event queue signaling */
  103. #define QACTIVE_EQUEUE_SIGNAL_(me_) \
  104. QPSet_insert(&QF_readySet_, (uint_fast8_t)(me_)->prio)
  105. /*$enddecl${QV-impl} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
  106. /* Native QF event pool operations... */
  107. /*$declare${QF-QMPool-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
  108. /*${QF-QMPool-impl::QF_EPOOL_TYPE_} ........................................*/
  109. #define QF_EPOOL_TYPE_ QMPool
  110. /*${QF-QMPool-impl::QF_EPOOL_INIT_} ........................................*/
  111. #define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \
  112. (QMPool_init(&(p_), (poolSto_), (poolSize_), (evtSize_)))
  113. /*${QF-QMPool-impl::QF_EPOOL_EVENT_SIZE_} ..................................*/
  114. #define QF_EPOOL_EVENT_SIZE_(p_) ((uint_fast16_t)(p_).blockSize)
  115. /*${QF-QMPool-impl::QF_EPOOL_GET_} .........................................*/
  116. #define QF_EPOOL_GET_(p_, e_, m_, qs_id_) \
  117. ((e_) = (QEvt *)QMPool_get(&(p_), (m_), (qs_id_)))
  118. /*${QF-QMPool-impl::QF_EPOOL_PUT_} .........................................*/
  119. #define QF_EPOOL_PUT_(p_, e_, qs_id_) \
  120. (QMPool_put(&(p_), (e_), (qs_id_)))
  121. /*$enddecl${QF-QMPool-impl} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
  122. #endif /* QP_IMPL */
  123. #endif /* QV_H_ */