Skip to content

Commit 585b615

Browse files
committed
8.0.2
Added examples/stm32cube - Improved examples/arm-cm/blinky_xxx - Updated qp_config.h header file comments to reference generic "QP"
1 parent 81a0392 commit 585b615

File tree

655 files changed

+20633
-155938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

655 files changed

+20633
-155938
lines changed

arm-cm/blinky_ek-tm4c123gxl/blinky.c

Lines changed: 78 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,145 @@
11
//============================================================================
2-
// Product: "Blinky" example
3-
// Last updated for version 7.3.0
4-
// Last updated on 2023-08-15
5-
//
6-
// Q u a n t u m L e a P s
7-
// ------------------------
8-
// Modern Embedded Software
2+
// "Blinky" example
93
//
104
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
115
//
12-
// This program is open source software: you can redistribute it and/or
13-
// modify it under the terms of the GNU General Public License as published
14-
// by the Free Software Foundation, either version 3 of the License, or
15-
// (at your option) any later version.
6+
// Q u a n t u m L e a P s
7+
// ------------------------
8+
// Modern Embedded Software
9+
//
10+
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
1611
//
17-
// Alternatively, this program may be distributed and modified under the
18-
// terms of Quantum Leaps commercial licenses, which expressly supersede
19-
// the GNU General Public License and are specifically designed for
20-
// licensees interested in retaining the proprietary status of their code.
12+
// This software is dual-licensed under the terms of the open-source GNU
13+
// General Public License (GPL) or under the terms of one of the closed-
14+
// source Quantum Leaps commercial licenses.
2115
//
22-
// This program is distributed in the hope that it will be useful,
23-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
24-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25-
// GNU General Public License for more details.
16+
// Redistributions in source code must retain this top-level comment block.
17+
// Plagiarizing this software to sidestep the license obligations is illegal.
2618
//
27-
// You should have received a copy of the GNU General Public License
28-
// along with this program. If not, see <www.gnu.org/licenses/>.
19+
// NOTE:
20+
// The GPL does NOT permit the incorporation of this code into proprietary
21+
// programs. Please contact Quantum Leaps for commercial licensing options,
22+
// which expressly supersede the GPL and are designed explicitly for
23+
// closed-source distribution.
2924
//
30-
// Contact information:
25+
// Quantum Leaps contact information:
3126
// <www.state-machine.com/licensing>
3227
3328
//============================================================================
3429
#include "qpc.h" // QP/C real-time embedded framework
3530
#include "blinky.h" // Blinky Application interface
3631
#include "bsp.h" // Board Support Package
3732

38-
#ifdef Q_SPY
39-
#error The Simple Blinky Application does not support Spy build configuration
40-
#endif
41-
4233
//Q_DEFINE_THIS_FILE
4334

35+
// NOTES:
36+
// 1. This is a simple "Blinky" Active Object (AO) coded manually;
37+
// 2. Code like this can be generated automatically from state diagrams
38+
// by the QM modeling tool;
39+
// 3. For more complex AOs automatic code generation avoids mistakes.
40+
//
4441
//............................................................................
45-
// Blinky class...
42+
// Blinky Active Object (AO) class...
4643
typedef struct {
47-
// protected:
48-
QActive super; // inherit QActive
44+
QActive super; // QActive superclass (inheritance)
4945

50-
// private:
46+
// data members added to the QActive superclass...
5147
QTimeEvt timeEvt; // private time event generator
48+
//...
5249
} Blinky;
53-
extern Blinky Blinky_inst; // the Blinky active object
50+
extern Blinky Blinky_inst; // Blinky instance declaration
5451

55-
// protected:
52+
// Blinky state machine declaration...
53+
//
54+
// top-most initial transition:
5655
static QState Blinky_initial(Blinky * const me, void const * const par);
56+
// states:
5757
static QState Blinky_off(Blinky * const me, QEvt const * const e);
5858
static QState Blinky_on(Blinky * const me, QEvt const * const e);
5959

6060
//----------------------------------------------------------------------------
61-
Blinky Blinky_inst;
62-
QActive * const AO_Blinky = &Blinky_inst.super;
61+
Blinky Blinky_inst; // the Blinky AO instance definition
62+
QActive * const AO_Blinky = &Blinky_inst.super; // global opaque pointer
6363

6464
//............................................................................
65+
// Blinky "constructor"
6566
void Blinky_ctor(void) {
66-
Blinky * const me = &Blinky_inst;
67+
Blinky * const me = &Blinky_inst; // 'me' points to the Blinky instance
68+
69+
// call the superclass' constructor
6770
QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial));
71+
72+
// call the members' constructors
6873
QTimeEvt_ctorX(&me->timeEvt, &me->super, TIMEOUT_SIG, 0U);
74+
//...
6975
}
7076

71-
// HSM definition ----------------------------------------------------------
77+
//----------------------------------------------------------------------------
78+
// Blinky state machine definition...
79+
//
80+
// +--------------------+ +--------------------+
81+
// O----->| off |---TIMEOUT-->| on |
82+
// +--------------------+ +--------------------+
83+
// |entry: BSP_ledOff() | |entry: BSP_ledOn() |
84+
// | |<--TIMEOUT---| |
85+
// +--------------------+ +--------------------+
86+
87+
//............................................................................
88+
// top-most initial transition:
7289
QState Blinky_initial(Blinky * const me, void const * const par) {
73-
Q_UNUSED_PAR(par);
90+
Q_UNUSED_PAR(par); // initialization parameter unused in this case
7491

7592
// arm the time event to expire in half a second and every half second
7693
QTimeEvt_armX(&me->timeEvt, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U);
7794

78-
return Q_TRAN(&Blinky_off);
95+
// QS software tracing instrumentation (active only when Q_SPY is defined)
96+
QS_OBJ_DICTIONARY(AO_Blinky);
97+
QS_OBJ_DICTIONARY(&Blinky_inst.timeEvt);
98+
QS_SIG_DICTIONARY(TIMEOUT_SIG, me);
99+
100+
QS_FUN_DICTIONARY(&Blinky_initial);
101+
QS_FUN_DICTIONARY(&Blinky_off);
102+
QS_FUN_DICTIONARY(&Blinky_on);
103+
104+
return Q_TRAN(&Blinky_off); // transition to "off"
79105
}
80106
//............................................................................
107+
// the "off" state
81108
QState Blinky_off(Blinky * const me, QEvt const * const e) {
82109
QState status;
83110
switch (e->sig) {
84-
case Q_ENTRY_SIG: {
85-
BSP_ledOff();
86-
status = Q_HANDLED();
111+
case Q_ENTRY_SIG: { // state entry action
112+
BSP_ledOff(); // action to execute
113+
status = Q_HANDLED(); // entry action handled
87114
break;
88115
}
89-
case TIMEOUT_SIG: {
90-
status = Q_TRAN(&Blinky_on);
116+
case TIMEOUT_SIG: { // TIMEOUT event
117+
status = Q_TRAN(&Blinky_on); // transition to "on"
91118
break;
92119
}
93120
default: {
94-
status = Q_SUPER(&QHsm_top);
121+
status = Q_SUPER(&QHsm_top); // superstate of this state
95122
break;
96123
}
97124
}
98125
return status;
99126
}
100127
//............................................................................
128+
// the "on" state
101129
QState Blinky_on(Blinky * const me, QEvt const * const e) {
102130
QState status;
103131
switch (e->sig) {
104-
case Q_ENTRY_SIG: {
105-
BSP_ledOn();
106-
status = Q_HANDLED();
132+
case Q_ENTRY_SIG: { // state entry action
133+
BSP_ledOn(); // action to execute
134+
status = Q_HANDLED(); // entry action handled
107135
break;
108136
}
109-
case TIMEOUT_SIG: {
110-
status = Q_TRAN(&Blinky_off);
137+
case TIMEOUT_SIG: { // TIMEOUT event
138+
status = Q_TRAN(&Blinky_off); // transition to "off"
111139
break;
112140
}
113141
default: {
114-
status = Q_SUPER(&QHsm_top);
142+
status = Q_SUPER(&QHsm_top); // superstate of this state
115143
break;
116144
}
117145
}
Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
//============================================================================
2-
// Product: "Blinky" example
3-
// Last updated for version 7.2.0
4-
// Last updated on 2023-01-08
5-
//
6-
// Q u a n t u m L e a P s
7-
// ------------------------
8-
// Modern Embedded Software
2+
// "Blinky" example
93
//
104
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
115
//
12-
// This program is open source software: you can redistribute it and/or
13-
// modify it under the terms of the GNU General Public License as published
14-
// by the Free Software Foundation, either version 3 of the License, or
15-
// (at your option) any later version.
6+
// Q u a n t u m L e a P s
7+
// ------------------------
8+
// Modern Embedded Software
9+
//
10+
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
1611
//
17-
// Alternatively, this program may be distributed and modified under the
18-
// terms of Quantum Leaps commercial licenses, which expressly supersede
19-
// the GNU General Public License and are specifically designed for
20-
// licensees interested in retaining the proprietary status of their code.
12+
// This software is dual-licensed under the terms of the open-source GNU
13+
// General Public License (GPL) or under the terms of one of the closed-
14+
// source Quantum Leaps commercial licenses.
2115
//
22-
// This program is distributed in the hope that it will be useful,
23-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
24-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25-
// GNU General Public License for more details.
16+
// Redistributions in source code must retain this top-level comment block.
17+
// Plagiarizing this software to sidestep the license obligations is illegal.
2618
//
27-
// You should have received a copy of the GNU General Public License
28-
// along with this program. If not, see <www.gnu.org/licenses/>.
19+
// NOTE:
20+
// The GPL does NOT permit the incorporation of this code into proprietary
21+
// programs. Please contact Quantum Leaps for commercial licensing options,
22+
// which expressly supersede the GPL and are designed explicitly for
23+
// closed-source distribution.
2924
//
30-
// Contact information:
25+
// Quantum Leaps contact information:
3126
// <www.state-machine.com/licensing>
3227
3328
//============================================================================
@@ -36,13 +31,21 @@
3631

3732
enum BlinkySignals {
3833
DUMMY_SIG = Q_USER_SIG,
39-
MAX_PUB_SIG, // the last published signal
34+
//...
35+
MAX_PUB_SIG, // the last published signal
4036

4137
TIMEOUT_SIG,
42-
MAX_SIG // the last signal
38+
//...
39+
MAX_SIG // the last signal
4340
};
4441

4542
void Blinky_ctor(void);
46-
extern QActive * const AO_Blinky; // opaque pointer
43+
extern QActive * const AO_Blinky; // global opaque pointer
44+
45+
// for the QXK kernel only...
46+
#ifdef QXK_H_
47+
void XThr_ctor(void);
48+
extern QXThread * const XT_thr; // global opaque pointer
49+
#endif
4750

4851
#endif // BLINKY_H_

arm-cm/blinky_ek-tm4c123gxl/bsp.h

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
//============================================================================
2-
// Product: Board Support Package example
3-
// Last Updated for Version: 7.3.0
4-
// Date of the Last Update: 2023-08-12
5-
//
6-
// Q u a n t u m L e a P s
7-
// ------------------------
8-
// Modern Embedded Software
2+
// "Blinky" example
93
//
104
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
115
//
12-
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
13-
//
14-
// This software is dual-licensed under the terms of the open source GNU
15-
// General Public License version 3 (or any later version), or alternatively,
16-
// under the terms of one of the closed source Quantum Leaps commercial
17-
// licenses.
6+
// Q u a n t u m L e a P s
7+
// ------------------------
8+
// Modern Embedded Software
189
//
19-
// The terms of the open source GNU General Public License version 3
20-
// can be found at: <www.gnu.org/licenses/gpl-3.0>
10+
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
2111
//
22-
// The terms of the closed source Quantum Leaps commercial licenses
23-
// can be found at: <www.state-machine.com/licensing>
12+
// This software is dual-licensed under the terms of the open-source GNU
13+
// General Public License (GPL) or under the terms of one of the closed-
14+
// source Quantum Leaps commercial licenses.
2415
//
2516
// Redistributions in source code must retain this top-level comment block.
2617
// Plagiarizing this software to sidestep the license obligations is illegal.
2718
//
28-
// Contact information:
19+
// NOTE:
20+
// The GPL does NOT permit the incorporation of this code into proprietary
21+
// programs. Please contact Quantum Leaps for commercial licensing options,
22+
// which expressly supersede the GPL and are designed explicitly for
23+
// closed-source distribution.
24+
//
25+
// Quantum Leaps contact information:
2926
// <www.state-machine.com/licensing>
3027
3128
//============================================================================
@@ -36,13 +33,8 @@
3633

3734
void BSP_init(void);
3835
void BSP_start(void);
39-
void BSP_displayPaused(uint8_t paused);
40-
void BSP_displayPhilStat(uint8_t n, char const *stat);
4136
void BSP_terminate(int16_t result);
4237

43-
void BSP_randomSeed(uint32_t seed); // random seed
44-
uint32_t BSP_random(void); // pseudo-random generator
45-
4638
void BSP_ledOn(void);
4739
void BSP_ledOff(void);
4840

arm-cm/blinky_ek-tm4c123gxl/main.c

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
//============================================================================
2-
// APP example
3-
// Last updated for version 7.3.0
4-
// Last updated on 2023-08-09
2+
// QP/C application example
53
//
6-
// Q u a n t u m L e a P s
7-
// ------------------------
8-
// Modern Embedded Software
4+
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
95
//
10-
// Copyright (C) 2005 Quantum Leaps, LLC. <www.state-machine.com>
6+
// Q u a n t u m L e a P s
7+
// ------------------------
8+
// Modern Embedded Software
119
//
12-
// This program is open source software: you can redistribute it and/or
13-
// modify it under the terms of the GNU General Public License as published
14-
// by the Free Software Foundation, either version 3 of the License, or
15-
// (at your option) any later version.
10+
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
1611
//
17-
// Alternatively, this program may be distributed and modified under the
18-
// terms of Quantum Leaps commercial licenses, which expressly supersede
19-
// the GNU General Public License and are specifically designed for
20-
// licensees interested in retaining the proprietary status of their code.
12+
// This software is dual-licensed under the terms of the open-source GNU
13+
// General Public License (GPL) or under the terms of one of the closed-
14+
// source Quantum Leaps commercial licenses.
2115
//
22-
// This program is distributed in the hope that it will be useful,
23-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
24-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25-
// GNU General Public License for more details.
16+
// Redistributions in source code must retain this top-level comment block.
17+
// Plagiarizing this software to sidestep the license obligations is illegal.
2618
//
27-
// You should have received a copy of the GNU General Public License
28-
// along with this program. If not, see <www.gnu.org/licenses/>.
19+
// NOTE:
20+
// The GPL does NOT permit the incorporation of this code into proprietary
21+
// programs. Please contact Quantum Leaps for commercial licensing options,
22+
// which expressly supersede the GPL and are designed explicitly for
23+
// closed-source distribution.
2924
//
30-
// Contact information:
25+
// Quantum Leaps contact information:
3126
// <www.state-machine.com/licensing>
3227
3328
//============================================================================

0 commit comments

Comments
 (0)