Skip to content

Commit 1c63248

Browse files
committed
7.1.0-beta3
1 parent 55b51e3 commit 1c63248

File tree

10 files changed

+1177
-73
lines changed

10 files changed

+1177
-73
lines changed

include/qf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ typedef struct QActiveVtable {
885885
/*! @private virtual function to start the AO/thread
886886
* @sa QACTIVE_START()
887887
*/
888-
void (*start)(QActive * const me, uint_fast16_t prio,
888+
void (*start)(QActive * const me, QPrioSpec prio,
889889
QEvt const * * const qSto, uint_fast16_t const qLen,
890890
void * const stkSto, uint_fast16_t const stkSize,
891891
void const * const par);

qpc.qm

Lines changed: 1142 additions & 37 deletions
Large diffs are not rendered by default.

src/qf/qep_hsm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static QEvt const QEP_reservedEvt_[] = {
9393
#ifdef Q_SPY
9494
#define QEP_EXIT_(state_, qs_id_) do { \
9595
if ((*(state_))(me, &QEP_reservedEvt_[Q_EXIT_SIG]) \
96-
== Q_RET_HANDLED) { \
96+
== Q_RET_HANDLED) { \
9797
QS_BEGIN_PRE_(QS_QEP_STATE_EXIT, (qs_id_)) \
9898
QS_OBJ_PRE_(me); \
9999
QS_FUN_PRE_(state_); \
@@ -103,7 +103,7 @@ static QEvt const QEP_reservedEvt_[] = {
103103

104104
#define QEP_ENTER_(state_, qs_id_) do { \
105105
if ((*(state_))(me, &QEP_reservedEvt_[Q_ENTRY_SIG]) \
106-
== Q_RET_HANDLED) { \
106+
== Q_RET_HANDLED) { \
107107
QS_BEGIN_PRE_(QS_QEP_STATE_ENTRY, (qs_id_)) \
108108
QS_OBJ_PRE_(me); \
109109
QS_FUN_PRE_(state_); \

src/qf/qf_ps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void QActive_publish_(
130130
QActive *a = QActive_registry_[p];
131131
QF_SCHED_STAT_
132132

133-
QF_SCHED_LOCK_(a->pthre); /* lock the scheduler up to ceiling */
133+
QF_SCHED_LOCK_(a->pthre); /* lock the scheduler up to threshold */
134134
do { /* loop over all subscribers */
135135
/* the prio of the AO must be registered with the framework */
136136
Q_ASSERT_ID(210, a != (QActive *)0);

src/qf/qf_qact.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,28 @@ void QActive_register_(QActive * const me) {
137137
if (me->pthre == 0U) { /* preemption-threshold not defined? */
138138
me->pthre = me->prio; /* apply the default */
139139
}
140-
uint8_t prev_ceil = me->pthre;
141-
uint8_t next_ceil = me->pthre;
140+
uint8_t prev_thre = me->pthre;
141+
uint8_t next_thre = me->pthre;
142142

143143
uint_fast8_t p;
144144
for (p = (uint_fast8_t)prio - 1U; p > 0U; --p) {
145145
if (QActive_registry_[p] != (QActive *)0) {
146-
prev_ceil = QActive_registry_[p]->pthre;
146+
prev_thre = QActive_registry_[p]->pthre;
147147
break;
148148
}
149149
}
150150
for (p = (uint_fast8_t)prio + 1U; p <= QF_MAX_ACTIVE; ++p) {
151151
if (QActive_registry_[p] != (QActive *)0) {
152-
next_ceil = QActive_registry_[p]->pthre;
152+
next_thre = QActive_registry_[p]->pthre;
153153
break;
154154
}
155155
}
156156

157-
/* @post The preemption threshold of the AO (me->pthre) must be
157+
/*! @post The preemption threshold of the AO (me->pthre) must be
158158
* between the threshold of the previous AO and the next AO
159159
*/
160-
Q_ENSURE_ID(101, (prev_ceil <= me->pthre)
161-
&& (me->pthre <= next_ceil));
160+
Q_ENSURE_ID(101, (prev_thre <= me->pthre)
161+
&& (me->pthre <= next_thre));
162162
QF_CRIT_STAT_
163163
QF_CRIT_E_();
164164
QActive_registry_[prio] = me; /* register the AO at this QF priority */
@@ -169,17 +169,17 @@ void QActive_register_(QActive * const me) {
169169

170170
/*${QF::QActive::unregister_} ..............................................*/
171171
void QActive_unregister_(QActive * const me) {
172-
uint_fast8_t const prio = (uint_fast8_t)me->prio;
172+
uint_fast8_t const p = (uint_fast8_t)me->prio;
173173

174174
/*! @pre the priority of the active object must not be zero and cannot
175175
* exceed the maximum #QF_MAX_ACTIVE. Also, the priority of the active
176176
* object must be already registered with the framework.
177177
*/
178-
Q_REQUIRE_ID(200, (0U < prio) && (prio <= QF_MAX_ACTIVE)
179-
&& (QActive_registry_[prio] == me));
178+
Q_REQUIRE_ID(200, (0U < p) && (p <= QF_MAX_ACTIVE)
179+
&& (QActive_registry_[p] == me));
180180
QF_CRIT_STAT_
181181
QF_CRIT_E_();
182-
QActive_registry_[prio] = (QActive *)0; /* free-up the priority level */
182+
QActive_registry_[p] = (QActive *)0; /* free-up the priority level */
183183
me->super.state.fun = Q_STATE_CAST(0); /* invalidate the state */
184184
QF_CRIT_X_();
185185
}

src/qk/qk.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,14 @@ void QActive_start_(QActive * const me,
349349
/*! @pre AO cannot be started from an ISR and the stack storage must
350350
* NOT be provided because the QK kernel does not need per-AO stacks.
351351
*/
352-
Q_REQUIRE_ID(300, (!QK_ISR_CONTEXT_())
353-
&& (stkSto == (void *)0));
354-
355-
QEQueue_init(&me->eQueue, qSto, qLen); /* initialize the built-in queue */
352+
Q_REQUIRE_ID(300, (!QK_ISR_CONTEXT_()) && (stkSto == (void *)0));
356353

357354
me->prio = (uint8_t)(prio & 0xFFU); /* QF-priority of the AO */
358355
me->pthre = (uint8_t)(prio >> 8U); /* preemption-ceiling of the AO */
359356
QActive_register_(me); /* make QF aware of this AO */
360357

358+
QEQueue_init(&me->eQueue, qSto, qLen); /* initialize the built-in queue */
359+
361360
QHSM_INIT(&me->super, par, me->prio); /* top-most initial tran. */
362361
QS_FLUSH(); /* flush the trace buffer to the host */
363362

src/qs/qs_rx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ void QS_rxHandleGoodFrame_(uint8_t const state) {
391391
#ifdef Q_UTEST
392392
#if Q_UTEST != 0
393393
QS_processTestEvts_(); /* process all events produced */
394-
#endif /* Q_UTEST != 0*/
394+
#endif /* Q_UTEST != 0 */
395395
#endif /* Q_UTEST */
396396
QS_rxReportDone_((int8_t)QS_RX_COMMAND);
397397
break;
@@ -402,7 +402,7 @@ void QS_rxHandleGoodFrame_(uint8_t const state) {
402402
QTimeEvt_tick1_((uint_fast8_t)l_rx.var.tick.rate, &QS_rxPriv_);
403403
#if Q_UTEST != 0
404404
QS_processTestEvts_(); /* process all events produced */
405-
#endif /* Q_UTEST != 0*/
405+
#endif /* Q_UTEST != 0 */
406406
#else
407407
QTimeEvt_tick_((uint_fast8_t)l_rx.var.tick.rate, &QS_rxPriv_);
408408
#endif /* Q_UTEST */

src/qs/qutest.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,14 @@ void QActive_start_(QActive * const me,
214214
uint_fast16_t const stkSize,
215215
void const * const par)
216216
{
217-
(void)stkSto; /* unused parameter */
218-
(void)stkSize; /* unused parameter */
217+
Q_UNUSED_PAR(stkSto);
218+
Q_UNUSED_PAR(stkSize);
219219

220-
/* priority must be in range */
221-
Q_REQUIRE_ID(200, (0U < prio) && (prio <= QF_MAX_ACTIVE));
220+
me->prio = (uint8_t)(prio & 0xFFU); /* QF-priority of the AO */
221+
me->pthre = (uint8_t)(prio >> 8U); /* preemption-ceiling of the AO */
222+
QActive_register_(me); /* make QF aware of this active object */
222223

223224
QEQueue_init(&me->eQueue, qSto, qLen); /* initialize the built-in queue */
224-
me->prio = (uint8_t)prio; /* set the current priority of the AO */
225-
226-
QActive_register_(me); /* make QF aware of this active object */
227225

228226
QHSM_INIT(&me->super, par, me->prio); /* the top-most initial tran. */
229227
}

src/qv/qv.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,16 @@ void QActive_start_(QActive * const me,
183183
{
184184
Q_UNUSED_PAR(stkSize);
185185

186-
/*! @pre The priority must be in range and the stack storage must not
187-
* be provided, because the QV kernel does not need per-AO stacks.
186+
/*! @pre Stack storage must not be provided because the QV kernel
187+
* does not need per-AO stacks.
188188
*/
189-
Q_REQUIRE_ID(500, (0U < prio) && (prio <= QF_MAX_ACTIVE)
190-
&& (stkSto == (void *)0));
189+
Q_REQUIRE_ID(500, stkSto == (void *)0);
190+
191+
me->prio = (uint8_t)(prio & 0xFFU); /* QF-priority of the AO */
192+
me->pthre = (uint8_t)(prio >> 8U); /* preemption-ceiling of the AO */
193+
QActive_register_(me); /* make QF aware of this AO */
191194

192195
QEQueue_init(&me->eQueue, qSto, qLen); /* initialize the built-in queue */
193-
me->prio = (uint8_t)prio; /* set the current priority of the AO */
194-
QActive_register_(me); /* register this active object */
195196

196197
QHSM_INIT(&me->super, par, me->prio); /* top-most initial tran. */
197198
QS_FLUSH(); /* flush the trace buffer to the host */

src/qxk/qxk.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,13 @@ void QActive_start_(QActive * const me,
452452
&& (stkSto == (void *)0)
453453
&& (stkSize == 0U));
454454

455-
QEQueue_init(&me->eQueue, qSto, qLen); /* initialize the built-in queue */
456-
me->osObject = (void *)0; /* no private stack for the AO */
457455
me->prio = (uint8_t)(prio & 0xFFU); /* QF-priority of the AO */
458456
me->pthre = (uint8_t)(prio >> 8U); /* preemption-threshold of the AO */
459457
QActive_register_(me); /* register this AO */
460458

459+
QEQueue_init(&me->eQueue, qSto, qLen); /* initialize the built-in queue */
460+
me->osObject = (void *)0; /* no private stack for the AO */
461+
461462
QHSM_INIT(&me->super, par, me->prio); /* top-most initial tran. */
462463
QS_FLUSH(); /* flush the trace buffer to the host */
463464

0 commit comments

Comments
 (0)