diff --git a/examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/.project b/examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/.project index 131a6a82..b828bdee 100644 --- a/examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/.project +++ b/examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/.project @@ -83,7 +83,7 @@ qstamp.c 1 - PARENT-5-PROJECT_LOC/include/qstamp.c + PARENT-5-PROJECT_LOC/src/qs/qstamp.c rom.h diff --git a/examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/.project b/examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/.project index 994b7a66..4a77cd23 100644 --- a/examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/.project +++ b/examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/.project @@ -83,7 +83,7 @@ qstamp.c 1 - PARENT-5-PROJECT_LOC/include/qstamp.c + PARENT-5-PROJECT_LOC/src/qs/qstamp.c rom.h diff --git a/examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/.project b/examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/.project index 13ddf88c..678a1806 100644 --- a/examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/.project +++ b/examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/.project @@ -83,7 +83,7 @@ qstamp.c 1 - PARENT-5-PROJECT_LOC/include/qstamp.c + PARENT-5-PROJECT_LOC/src/qs/qstamp.c rom.h diff --git a/examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/.project b/examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/.project index 14714df8..54ab2706 100644 --- a/examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/.project +++ b/examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/.project @@ -83,7 +83,7 @@ qstamp.c 1 - PARENT-5-PROJECT_LOC/include/qstamp.c + PARENT-5-PROJECT_LOC/src/qs/qstamp.c rom.h diff --git a/examples/arm-cm/dpp_ek-tm4c123gxl/qxk/gnu/.project b/examples/arm-cm/dpp_ek-tm4c123gxl/qxk/gnu/.project index 32f08a01..42070f85 100644 --- a/examples/arm-cm/dpp_ek-tm4c123gxl/qxk/gnu/.project +++ b/examples/arm-cm/dpp_ek-tm4c123gxl/qxk/gnu/.project @@ -83,7 +83,7 @@ qstamp.c 1 - PARENT-5-PROJECT_LOC/include/qstamp.c + PARENT-5-PROJECT_LOC/src/qs/qstamp.c rom.h diff --git a/examples/posix-win32/history_qmsm/proj.vcxproj b/examples/posix-win32/history_qmsm/proj.vcxproj index 488088fd..f0fdbaa4 100644 --- a/examples/posix-win32/history_qmsm/proj.vcxproj +++ b/examples/posix-win32/history_qmsm/proj.vcxproj @@ -146,7 +146,7 @@ - + true diff --git a/examples/posix-win32/history_qmsm/proj.vcxproj.filters b/examples/posix-win32/history_qmsm/proj.vcxproj.filters index 921ffc79..ea54c005 100644 --- a/examples/posix-win32/history_qmsm/proj.vcxproj.filters +++ b/examples/posix-win32/history_qmsm/proj.vcxproj.filters @@ -2,7 +2,7 @@ - + QP_port diff --git a/examples/posix-win32/reminder2/Makefile b/examples/posix-win32/reminder2/Makefile index 24ea6745..dbc6e3e2 100644 --- a/examples/posix-win32/reminder2/Makefile +++ b/examples/posix-win32/reminder2/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.2.0 -# Last updated on 2022-11-13 +# Last updated for version 7.3.0 +# Last updated on 2023-09-25 # # Q u a n t u m L e a P s # ------------------------ @@ -83,7 +83,8 @@ LIBS := # defines... # QP_API_VERSION controls the QP API compatibility; 9999 means the latest API -DEFINES := -DQP_API_VERSION=9999 +DEFINES := -DQP_API_VERSION=9999 \ + $(DEF) ifeq (,$(CONF)) CONF := dbg diff --git a/examples/posix-win32/reminder2/reminder2.c b/examples/posix-win32/reminder2/reminder2.c index 8d3142df..d16b38bb 100644 --- a/examples/posix-win32/reminder2/reminder2.c +++ b/examples/posix-win32/reminder2/reminder2.c @@ -55,6 +55,21 @@ typedef struct { // the next iteration to perform uint32_t iter; } ReminderEvt; + +// public: + +#ifdef QEVT_DYN_CTOR +static inline ReminderEvt * ReminderEvt_ctor(ReminderEvt * const me, + uint32_t iter) +{ + if (me != (ReminderEvt *)0) { + // don't call QEvt_ctor() because the initialization of all + // QEvt attributes is already done in QF_QF_newX_() + me->iter = iter; + } + return me; +} +#endif // def QEVT_DYN_CTOR //$enddecl${Events::ReminderEvt} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //.......................................................................... @@ -113,8 +128,13 @@ static QState Cruncher_processing(Cruncher * const me, QEvt const * const e) { switch (e->sig) { //${Components::Cruncher::SM::processing} case Q_ENTRY_SIG: { + #ifdef QEVT_DYN_CTOR + ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG, 0U); + #else ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); reminder->iter = 0U; + #endif + QACTIVE_POST(&me->super, &reminder->super, me); me->sum = 0.0; status_ = Q_HANDLED(); @@ -135,8 +155,13 @@ static QState Cruncher_processing(Cruncher * const me, QEvt const * const e) { } //${Components::Cruncher::SM::processing::CRUNCH::[i<0x07000000U]} if (i < 0x07000000U) { + #ifdef QEVT_DYN_CTOR + ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG, i); + #else ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); reminder->iter = i; + #endif + QACTIVE_POST(&me->super, &reminder->super, me); status_ = Q_HANDLED(); } @@ -223,8 +248,18 @@ int main(int argc, char *argv[]) { void BSP_onKeyboardInput(uint8_t key) { switch (key) { case 'e': { // echo the progress so far - static QEvt const echoEvt = QEVT_INITIALIZER(ECHO_SIG); - QACTIVE_POST((QActive *)&l_cruncher, &echoEvt, (void *)0); + // NOTE: + // The following Q_NEW_X() allocation might potentially fail + // because the "ECHO" event is not considered critical. This + // code illustrates the Q_NEW_X() API and its use. + #ifdef QEVT_DYN_CTOR + QEvt const *echoEvt = Q_NEW_X(QEvt, 2U, ECHO_SIG, QEVT_DYNAMIC); + #else + QEvt const *echoEvt = Q_NEW_X(QEvt, 2U, ECHO_SIG); + #endif + if (echoEvt != (QEvt *)0) { // event allocated successfully? + QACTIVE_POST((QActive *)&l_cruncher, echoEvt, (void *)0); + } break; } case '\033': { // ESC pressed? diff --git a/examples/posix-win32/reminder2/reminder2.qm b/examples/posix-win32/reminder2/reminder2.qm index a581bb23..5b3a95bd 100644 --- a/examples/posix-win32/reminder2/reminder2.qm +++ b/examples/posix-win32/reminder2/reminder2.qm @@ -11,6 +11,17 @@ // the next iteration to perform + + + + + if (me != (ReminderEvt *)0) { + // don't call QEvt_ctor() because the initialization of all + // QEvt attributes is already done in QF_QF_newX_() + me->iter = iter; +} +return me; + @@ -38,8 +49,13 @@ - ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); + #ifdef QEVT_DYN_CTOR +ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG, 0U); +#else +ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); reminder->iter = 0U; +#endif + QACTIVE_POST(&me->super, &reminder->super, me); me->sum = 0.0; @@ -66,8 +82,13 @@ for (; n < i; ++n) { i < 0x07000000U - ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); + #ifdef QEVT_DYN_CTOR +ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG, i); +#else +ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); reminder->iter = i; +#endif + QACTIVE_POST(&me->super, &reminder->super, me); @@ -169,8 +190,19 @@ int main(int argc, char *argv[]) { void BSP_onKeyboardInput(uint8_t key) { switch (key) { case 'e': { // echo the progress so far - static QEvt const echoEvt = QEVT_INITIALIZER(ECHO_SIG); - QACTIVE_POST((QActive *)&l_cruncher, &echoEvt, (void *)0); + // NOTE: + // The following Q_NEW_X() allocation might potentially fail + // but this is acceptable becasue the "ECHO" event is not + // considered critical. This code illustrates the Q_NEW_X() + // API and its use. + #ifdef QEVT_DYN_CTOR + QEvt const *echoEvt = Q_NEW_X(QEvt, 2U, ECHO_SIG, QEVT_DYNAMIC); + #else + QEvt const *echoEvt = Q_NEW_X(QEvt, 2U, ECHO_SIG); + #endif + if (echoEvt != (QEvt *)0) { // event allocated successfully? + QACTIVE_POST((QActive *)&l_cruncher, echoEvt, (void *)0); + } break; } case '\033': { // ESC pressed? diff --git a/examples/zephyr/blinky/src/qp_config.h b/examples/zephyr/blinky/src/qp_config.h index 0aeffde2..f2b86242 100644 --- a/examples/zephyr/blinky/src/qp_config.h +++ b/examples/zephyr/blinky/src/qp_config.h @@ -1,7 +1,7 @@ //============================================================================ // QP configuration file example // Last updated for version: 7.3.0 -// Last updated on: 2023-09-02 +// Last updated on: 2023-09-26 // // Q u a n t u m L e a P s // ------------------------ @@ -33,9 +33,9 @@ #define QP_CONFIG_H_ // NOTE: -// The QP configuration takes effect only when the macro QP_CONFIG -// is defined on the command-line to the compiler for all QP source files. - -#define QF_MAX_ACTIVE 64U +// This QP configuration header file must be provided in the QP applications +// for the Zephyr RTOS. This file might be empty, if the default settings of +// the QP framework are adequate. The configuration options for QP framework +// ared documented at: https://www.state-machine.com/qpc/qp__config_8h.html #endif // QP_CONFIG_H_ diff --git a/examples/zephyr/dpp/src/qp_config.h b/examples/zephyr/dpp/src/qp_config.h index 0aeffde2..f2b86242 100644 --- a/examples/zephyr/dpp/src/qp_config.h +++ b/examples/zephyr/dpp/src/qp_config.h @@ -1,7 +1,7 @@ //============================================================================ // QP configuration file example // Last updated for version: 7.3.0 -// Last updated on: 2023-09-02 +// Last updated on: 2023-09-26 // // Q u a n t u m L e a P s // ------------------------ @@ -33,9 +33,9 @@ #define QP_CONFIG_H_ // NOTE: -// The QP configuration takes effect only when the macro QP_CONFIG -// is defined on the command-line to the compiler for all QP source files. - -#define QF_MAX_ACTIVE 64U +// This QP configuration header file must be provided in the QP applications +// for the Zephyr RTOS. This file might be empty, if the default settings of +// the QP framework are adequate. The configuration options for QP framework +// ared documented at: https://www.state-machine.com/qpc/qp__config_8h.html #endif // QP_CONFIG_H_ diff --git a/include/qp.h b/include/qp.h index 4c544b00..12d20b30 100644 --- a/include/qp.h +++ b/include/qp.h @@ -1149,7 +1149,7 @@ void QF_gcFromISR(QEvt const * const e); //${QF-macros::Q_NEW_X} ...................................................... #ifndef QEVT_DYN_CTOR #define Q_NEW_X(evtT_, margin_, sig_) \ - (evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \ + ((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \ (margin_), (enum_t)(sig_))) #endif // ndef QEVT_DYN_CTOR diff --git a/qpc.qm b/qpc.qm index 41ebf080..082e56f7 100644 --- a/qpc.qm +++ b/qpc.qm @@ -2922,7 +2922,7 @@ QF_CRIT_EXIT(); // This default event constructor initializes the event // as NOT allocated from any event-pool, which must be // the case for Time Events. -QEvt_ctor(&me->super, sig); +(void)QEvt_ctor(&me->super, sig); // The refCtr_ attribute is not used in time events, so it is // reused to hold the tickRate as well as other information @@ -4360,7 +4360,7 @@ QF_gc(e); // recycle the referenced event \ - (evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \ + ((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \ (margin_), (enum_t)(sig_))) @@ -10089,7 +10089,7 @@ void QS_glbFilter_(int_fast16_t const filter) { break; case (uint8_t)QS_U4_RECORDS: if (isRemove) { - QS_filt_.glb[15] &= 0x1FU; + QS_filt_.glb[15] &= (uint8_t)(~0x1FU & 0xFFU); } else { QS_filt_.glb[15] |= 0x1FU; diff --git a/qpc.sha256 b/qpc.sha256 index ef8bc597..78bd4c5b 100644 --- a/qpc.sha256 +++ b/qpc.sha256 @@ -1,7 +1,7 @@ 8b8d56e339046359297fac0a6855b9d530797780a933e2530c3acb75ebe06162 include/qequeue.h 67d00443d954d590baa4d95645ea7853f89c545e7d0d83f8cbcb435e2b7db58a include/qk.h 051d7f3547da2b1ca6c6ae9135020fd19364d4815adb6b4e89d08d1d690cb460 include/qmpool.h -89aba05e758d79dd723d3b2dac8daf5e40d738da6b80d78e59a922e061bcdee4 include/qp.h +9f55badeb862f3112b8bc3f4d31ff5f394ece3efc3632e6b1511a6d2a1119d7e include/qp.h 81958d337c9de3adc09c6b2029eb7c0ecc1971bd4c91d88e8f7f3f5d1e35cec3 include/qpc.h d80140d884ab56d772aebbddc4261562f2fbd9c311fa14d632d7853798c1a43f include/qp_pkg.h 88e91affbdbe31acbce8b5393be8135415c0467821cc3cd1ecb13f23b79b4d19 include/qs.h @@ -74,11 +74,6 @@ c86621018906ede714a8a4ddd0f54e77588d8b787b84627f9e40d48aa04dccd7 ports/lint-plu f021b228f0af091270e17333f35cc4d56678aae5c6efcebb39c64ae6d1ac6a21 ports/lint-plus/au-ds.lnt 2032fbfc41eeac759180330cbd598f08d41cfe9ae4cd71ab595ff8b796ea9cc5 ports/lint-plus/au-misra4.lnt cd7c2b0574a9be5f74d5e2d51066153b115a293f159e72cf3c720194b64e2038 ports/lint-plus/au-ql-c99.lnt -09ad76eb3778ab87cd0d20ae2c96791f2564c9728efc2d6d8b40cf8e496390d9 ports/lint-plus/lint_qf.log -5ae1e46b7367ce70f45f213b4f28743e8ad5100109b76929223633e7e0281b82 ports/lint-plus/lint_qk.log -073f1ba7b65ddfbd534fd84dc6c698d4a6e4f03162d336cf8cef628c53ba5868 ports/lint-plus/lint_qs.log -d43f388ad47cdc6ccc148ee8adeb580154c44377542f043f16d33ee1aed0d180 ports/lint-plus/lint_qv.log -fdbfb6a485e2c3c19e2359a997c0fe08b8e9ab70cc8decb8796928e350e5bed7 ports/lint-plus/lint_qxk.log 2d7e4acf2c02e07120b0854b1141f9023094ce9164258be9503fd2b85202ae42 ports/lint-plus/make.bat 024d0a692399635b1bdecb38b919f12636359b150fa2f7eaaae452561e8184b2 ports/lint-plus/options.lnt 460af8fac27d52c1427c4c1181eb251590478717ddbc873b1ea6c1ec6ece3488 ports/lint-plus/qk/qp_port.h @@ -159,7 +154,7 @@ db47cddcf144bf28c90649304ec79bc88b50c1b6847bcb52046af399ed22824c ports/win32-qv 0a7285b6c324b65f77b913ab514b7c88a2c5c382815ef4646be16f446badd6b3 ports/win32-qv/README.md 36571350408c0588430d2a84a1e29111a932bc0bf11caa4edd765026c7c03ef8 ports/win32-qv/safe_std.h ca5fb4ef580f327eb2225a85186c197727fb190af2401721a31ffc505214b6f3 ports/zephyr/README.md -bcf48052bc36d144fdac107fdb99e95a4463cd9d1c9a7174023ffbc9d00e4e08 qpc.qm +58e67a8c1a1e1f040027c432f278840da3e63820f05e4312236d830b9ffed26c qpc.qm 0604a30da57f900e111856a410056659c935c96ee4b74a11b4d1283af8d861ef src/qf/qep_hsm.c 569e2219d2aa4a9c4d9fcaf469e03aee21e30ab47e3c95bd6906f71fd5151186 src/qf/qep_msm.c 7efa2d38ea4e4cd31b2978518083955d1d2cd454fa5b970f84ac3bd745be36ea src/qf/qf_act.c @@ -171,9 +166,9 @@ a2670891ccaec58952373c3f674a18aa611856ccf2e20d837be61463076ef0d4 src/qf/qf_ps.c 211099c73b80a83206809cd29f82eb1a4300e4d2ed9c76eb730e0e9ed126648a src/qf/qf_qact.c ac60466c58ce79c208620060bee2198e70ec8709f5887034dfc62e3aa930eae2 src/qf/qf_qeq.c 04886ebb5bdeddc0d935f7e22cae8f7180085f9ef36821cd8e012d0fafed01e7 src/qf/qf_qmact.c -0a706f9d1c830aef243ea94b0fecd83d221a35cf001251c64130d15ce082f489 src/qf/qf_time.c +23da9d6017556b9f8da974bf6369f72de464a76c99a1daff21b48eebfec5f5ce src/qf/qf_time.c d4d0a2d00ba8e46ef73f876aea023f142f314a6c075e2859717d2ee9594819d7 src/qk/qk.c -089120593cf6f2c83ec7fff0c40004728b3e06f374eaea88f974eadcaa4f1697 src/qs/qs.c +d811897d335ce952e01eae76420612a1fcb547f32f698039b89da9af598aaaa8 src/qs/qs.c e920c00c47eeefca8912b0bfcfe3cbe8fc33f4cbe8581cdadea87aef2311c45e src/qs/qstamp.c 5a463c1e0d1d36c5b0f0a316838623ed0873c86fd2e65cd840cbda088aaca80c src/qs/qs_64bit.c bfcf373f22651aaba53cf50bb4d449c24f4f7910f8d34d6ecd4fb88757838242 src/qs/qs_fp.c diff --git a/src/qf/qf_time.c b/src/qf/qf_time.c index e2939a08..733ff4a8 100644 --- a/src/qf/qf_time.c +++ b/src/qf/qf_time.c @@ -86,7 +86,7 @@ void QTimeEvt_ctorX(QTimeEvt * const me, // This default event constructor initializes the event // as NOT allocated from any event-pool, which must be // the case for Time Events. - QEvt_ctor(&me->super, sig); + (void)QEvt_ctor(&me->super, sig); // The refCtr_ attribute is not used in time events, so it is // reused to hold the tickRate as well as other information diff --git a/src/qs/qs.c b/src/qs/qs.c index e085ec99..1ab8f69a 100644 --- a/src/qs/qs.c +++ b/src/qs/qs.c @@ -326,7 +326,7 @@ void QS_glbFilter_(int_fast16_t const filter) { break; case (uint8_t)QS_U4_RECORDS: if (isRemove) { - QS_filt_.glb[15] &= 0x1FU; + QS_filt_.glb[15] &= (uint8_t)(~0x1FU & 0xFFU); } else { QS_filt_.glb[15] |= 0x1FU;