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.
qp_port.h@1:379cf3202ba2, 2011-02-09 (annotated)
- Committer:
- QL
- Date:
- Wed Feb 09 23:41:29 2011 +0000
- Revision:
- 1:379cf3202ba2
- Parent:
- 0:064c79e7311a
- Child:
- 2:5c8be45330ab
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
QL | 0:064c79e7311a | 1 | ////////////////////////////////////////////////////////////////////////////// |
QL | 0:064c79e7311a | 2 | // Product: QP/C++ port to ARM Cortex, selectable Vanilla/QK, mbed compiler |
QL | 0:064c79e7311a | 3 | // Last Updated for QP ver: 4.1.06 (modified to fit in one file) |
QL | 1:379cf3202ba2 | 4 | // Date of the Last Update: Feb 09, 2011 |
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 | 0:064c79e7311a | 10 | // Copyright (C) 2002-2011 Quantum Leaps, LLC. All rights reserved. |
QL | 0:064c79e7311a | 11 | // |
QL | 0:064c79e7311a | 12 | // This software may be distributed and modified under the terms of the GNU |
QL | 0:064c79e7311a | 13 | // General Public License version 2 (GPL) as published by the Free Software |
QL | 0:064c79e7311a | 14 | // Foundation and appearing in the file GPL.TXT included in the packaging of |
QL | 0:064c79e7311a | 15 | // this file. Please note that GPL Section 2[b] requires that all works based |
QL | 0:064c79e7311a | 16 | // on this software must also be made publicly available under the terms of |
QL | 0:064c79e7311a | 17 | // the GPL ("Copyleft"). |
QL | 0:064c79e7311a | 18 | // |
QL | 0:064c79e7311a | 19 | // Alternatively, this software may be distributed and modified under the |
QL | 0:064c79e7311a | 20 | // terms of Quantum Leaps commercial licenses, which expressly supersede |
QL | 0:064c79e7311a | 21 | // the GPL and are specifically designed for licensees interested in |
QL | 0:064c79e7311a | 22 | // retaining the proprietary status of their code. |
QL | 0:064c79e7311a | 23 | // |
QL | 0:064c79e7311a | 24 | // Contact information: |
QL | 0:064c79e7311a | 25 | // Quantum Leaps Web site: http://www.quantum-leaps.com |
QL | 0:064c79e7311a | 26 | // e-mail: info@quantum-leaps.com |
QL | 0:064c79e7311a | 27 | ////////////////////////////////////////////////////////////////////////////// |
QL | 0:064c79e7311a | 28 | #ifndef qp_port_h |
QL | 0:064c79e7311a | 29 | #define qp_port_h |
QL | 0:064c79e7311a | 30 | |
QL | 1:379cf3202ba2 | 31 | #include "qp_config.h" // QP configuration defined at the application level |
QL | 0:064c79e7311a | 32 | |
QL | 0:064c79e7311a | 33 | //............................................................................ |
QL | 0:064c79e7311a | 34 | // QF critical section entry/exit |
QL | 0:064c79e7311a | 35 | // QF_INT_KEY_TYPE not defined |
QL | 0:064c79e7311a | 36 | #define QF_INT_LOCK(dummy) __disable_irq() |
QL | 0:064c79e7311a | 37 | #define QF_INT_UNLOCK(dummy) __enable_irq() |
QL | 0:064c79e7311a | 38 | |
QL | 0:064c79e7311a | 39 | #ifdef QK_PREEMPTIVE |
QL | 0:064c79e7311a | 40 | // QK interrupt entry and exit |
QL | 0:064c79e7311a | 41 | #define QK_ISR_ENTRY() do { \ |
QL | 0:064c79e7311a | 42 | __disable_irq(); \ |
QL | 0:064c79e7311a | 43 | ++QK_intNest_; \ |
QL | 0:064c79e7311a | 44 | QF_QS_ISR_ENTRY(QK_intNest_, QK_currPrio_); \ |
QL | 0:064c79e7311a | 45 | __enable_irq(); \ |
QL | 0:064c79e7311a | 46 | } while (0) |
QL | 0:064c79e7311a | 47 | |
QL | 0:064c79e7311a | 48 | #define QK_ISR_EXIT() do { \ |
QL | 0:064c79e7311a | 49 | __disable_irq(); \ |
QL | 0:064c79e7311a | 50 | QF_QS_ISR_EXIT(QK_intNest_, QK_currPrio_); \ |
QL | 0:064c79e7311a | 51 | --QK_intNest_; \ |
QL | 0:064c79e7311a | 52 | *((uint32_t volatile *)0xE000ED04) = 0x10000000; \ |
QL | 0:064c79e7311a | 53 | __enable_irq(); \ |
QL | 0:064c79e7311a | 54 | } while (0) |
QL | 0:064c79e7311a | 55 | #else |
QL | 0:064c79e7311a | 56 | #define QK_ISR_ENTRY() ((void)0) |
QL | 0:064c79e7311a | 57 | #define QK_ISR_EXIT() ((void)0) |
QL | 0:064c79e7311a | 58 | #endif |
QL | 0:064c79e7311a | 59 | |
QL | 0:064c79e7311a | 60 | #ifdef Q_SPY |
QL | 0:064c79e7311a | 61 | #define QS_TIME_SIZE 4 |
QL | 0:064c79e7311a | 62 | #define QS_OBJ_PTR_SIZE 4 |
QL | 0:064c79e7311a | 63 | #define QS_FUN_PTR_SIZE 4 |
QL | 0:064c79e7311a | 64 | #endif |
QL | 0:064c79e7311a | 65 | |
QL | 0:064c79e7311a | 66 | #include <stdint.h> // mbed compiler supports standard exact-width integers |
QL | 0:064c79e7311a | 67 | |
QL | 0:064c79e7311a | 68 | #include "qp.h" // QP platform-independent interface |
QL | 0:064c79e7311a | 69 | |
QL | 0:064c79e7311a | 70 | #endif // qp_port_h |