QP is an event-driven, RTOS-like, active object framework for microcontrollers, such as mbed. The QP framework provides thread-safe execution of active objects (concurrent state machines) and support both manual and automatic coding of UML statecharts in readable, production-quality C or C++. Automatic code generation of QP code is supported by the free QM modeling tool.

Dependents:   qp_hangman qp_dpp qp_blinky

QP/C++ (Quantum Platform in C++) is a lightweight, open source active object (actor) framework for building responsive and modular real-time embedded applications as systems of asynchronous event-driven active objects (actors). The QP/C++ framework is a member of a larger family consisting of QP/C++, QP/C, and QP-nano frameworks, which are all strictly quality controlled, thoroughly documented, and available under GPLv3 with a special Exception for mbed (see http://www.state-machine.com/licensing/QP-mbed_GPL_Exception.txt).

The behavior of active objects is specified in QP/C++ by means of hierarchical state machines (UML statecharts). The framework supports manual coding of UML state machines in C++ as well as automatic code generation by means of the free QM modeling tool (http://www.state-machine.com/qm).

Please see the "QP/C++ Reference Manual" (http://www.state-machine.com/qpcpp) for more information.

Committer:
QL
Date:
Tue Sep 04 22:20:52 2012 +0000
Revision:
9:ca2e6010d9e2
Parent:
5:949864ba515c
QP/C++ 4.5.02 compatible with QM 2.2.xx

Who changed what in which revision?

UserRevisionLine numberNew contents of line
QL 0:064c79e7311a 1 //////////////////////////////////////////////////////////////////////////////
QL 0:064c79e7311a 2 // Product: QP/C++ port to ARM Cortex, selectable Vanilla/QK, mbed compiler
QL 9:ca2e6010d9e2 3 // Last Updated for Version: 4.5.02
QL 9:ca2e6010d9e2 4 // Date of the Last Update: Sep 04, 2012
QL 0:064c79e7311a 5 //
QL 0:064c79e7311a 6 // Q u a n t u m L e a P s
QL 0:064c79e7311a 7 // ---------------------------
QL 0:064c79e7311a 8 // innovating embedded systems
QL 0:064c79e7311a 9 //
QL 9:ca2e6010d9e2 10 // Copyright (C) 2002-2012 Quantum Leaps, LLC. All rights reserved.
QL 9:ca2e6010d9e2 11 //
QL 9:ca2e6010d9e2 12 // This program is open source software: you can redistribute it and/or
QL 9:ca2e6010d9e2 13 // modify it under the terms of the GNU General Public License as published
QL 9:ca2e6010d9e2 14 // by the Free Software Foundation, either version 2 of the License, or
QL 9:ca2e6010d9e2 15 // (at your option) any later version.
QL 0:064c79e7311a 16 //
QL 9:ca2e6010d9e2 17 // Alternatively, this program may be distributed and modified under the
QL 9:ca2e6010d9e2 18 // terms of Quantum Leaps commercial licenses, which expressly supersede
QL 9:ca2e6010d9e2 19 // the GNU General Public License and are specifically designed for
QL 9:ca2e6010d9e2 20 // licensees interested in retaining the proprietary status of their code.
QL 0:064c79e7311a 21 //
QL 9:ca2e6010d9e2 22 // This program is distributed in the hope that it will be useful,
QL 9:ca2e6010d9e2 23 // but WITHOUT ANY WARRANTY; without even the implied warranty of
QL 9:ca2e6010d9e2 24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
QL 9:ca2e6010d9e2 25 // GNU General Public License for more details.
QL 9:ca2e6010d9e2 26 //
QL 9:ca2e6010d9e2 27 // You should have received a copy of the GNU General Public License
QL 9:ca2e6010d9e2 28 // along with this program. If not, see <http://www.gnu.org/licenses/>.
QL 0:064c79e7311a 29 //
QL 0:064c79e7311a 30 // Contact information:
QL 9:ca2e6010d9e2 31 // Quantum Leaps Web sites: http://www.quantum-leaps.com
QL 9:ca2e6010d9e2 32 // http://www.state-machine.com
QL 0:064c79e7311a 33 // e-mail: info@quantum-leaps.com
QL 0:064c79e7311a 34 //////////////////////////////////////////////////////////////////////////////
QL 0:064c79e7311a 35 #ifndef qp_port_h
QL 0:064c79e7311a 36 #define qp_port_h
QL 0:064c79e7311a 37
QL 5:949864ba515c 38 #include "qp_config.h" // QP configuration defined at the application level
QL 0:064c79e7311a 39
QL 0:064c79e7311a 40 //............................................................................
QL 9:ca2e6010d9e2 41
QL 9:ca2e6010d9e2 42 // QF interrupt disable/enable
QL 9:ca2e6010d9e2 43 #define QF_INT_DISABLE() __disable_irq()
QL 9:ca2e6010d9e2 44 #define QF_INT_ENABLE() __enable_irq()
QL 9:ca2e6010d9e2 45
QL 0:064c79e7311a 46 // QF critical section entry/exit
QL 9:ca2e6010d9e2 47 // QF_CRIT_STAT_TYPE not defined: "unconditional interrupt unlocking" policy
QL 9:ca2e6010d9e2 48 #define QF_CRIT_ENTRY(dummy) __disable_irq()
QL 9:ca2e6010d9e2 49 #define QF_CRIT_EXIT(dummy) __enable_irq()
QL 0:064c79e7311a 50
QL 0:064c79e7311a 51 #ifdef QK_PREEMPTIVE
QL 0:064c79e7311a 52 // QK interrupt entry and exit
QL 0:064c79e7311a 53 #define QK_ISR_ENTRY() do { \
QL 0:064c79e7311a 54 __disable_irq(); \
QL 0:064c79e7311a 55 ++QK_intNest_; \
QL 0:064c79e7311a 56 QF_QS_ISR_ENTRY(QK_intNest_, QK_currPrio_); \
QL 0:064c79e7311a 57 __enable_irq(); \
QL 9:ca2e6010d9e2 58 } while (false)
QL 0:064c79e7311a 59
QL 0:064c79e7311a 60 #define QK_ISR_EXIT() do { \
QL 0:064c79e7311a 61 __disable_irq(); \
QL 0:064c79e7311a 62 QF_QS_ISR_EXIT(QK_intNest_, QK_currPrio_); \
QL 0:064c79e7311a 63 --QK_intNest_; \
QL 9:ca2e6010d9e2 64 *Q_UINT2PTR_CAST(uint32_t, 0xE000ED04U) = \
QL 9:ca2e6010d9e2 65 static_cast<uint32_t>(0x10000000U); \
QL 9:ca2e6010d9e2 66 __enable_irq(); \
QL 9:ca2e6010d9e2 67 } while (false)
QL 9:ca2e6010d9e2 68
QL 0:064c79e7311a 69 #else
QL 0:064c79e7311a 70 #define QK_ISR_ENTRY() ((void)0)
QL 0:064c79e7311a 71 #define QK_ISR_EXIT() ((void)0)
QL 0:064c79e7311a 72 #endif
QL 0:064c79e7311a 73
QL 0:064c79e7311a 74 #ifdef Q_SPY
QL 0:064c79e7311a 75 #define QS_TIME_SIZE 4
QL 0:064c79e7311a 76 #define QS_OBJ_PTR_SIZE 4
QL 0:064c79e7311a 77 #define QS_FUN_PTR_SIZE 4
QL 0:064c79e7311a 78 #endif
QL 0:064c79e7311a 79
QL 0:064c79e7311a 80 #include <stdint.h> // mbed compiler supports standard exact-width integers
QL 0:064c79e7311a 81
QL 0:064c79e7311a 82 #include "qp.h" // QP platform-independent interface
QL 0:064c79e7311a 83
QL 0:064c79e7311a 84 #endif // qp_port_h