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

Committer:
QL
Date:
2011-09-25
Revision:
5:949864ba515c
Parent:
3:c22aff7cdddc
Child:
9:ca2e6010d9e2

File content as of revision 5:949864ba515c:

//////////////////////////////////////////////////////////////////////////////
// Product: QP/C++ port to ARM Cortex, selectable Vanilla/QK, mbed compiler
// Last Updated for QP ver: 4.1.06 (modified to fit in one file)
// Date of the Last Update: Feb 08, 2011
//
//                    Q u a n t u m     L e a P s
//                    ---------------------------
//                    innovating embedded systems
//
// Copyright (C) 2002-2011 Quantum Leaps, LLC. All rights reserved.
//
// This software may be distributed and modified under the terms of the GNU
// General Public License version 2 (GPL) as published by the Free Software
// Foundation and appearing in the file GPL.TXT included in the packaging of
// this file. Please note that GPL Section 2[b] requires that all works based
// on this software must also be made publicly available under the terms of
// the GPL ("Copyleft").
//
// Alternatively, this software may be distributed and modified under the
// terms of Quantum Leaps commercial licenses, which expressly supersede
// the GPL and are specifically designed for licensees interested in
// retaining the proprietary status of their code.
//
// Contact information:
// Quantum Leaps Web site:  http://www.quantum-leaps.com
// e-mail:                  info@quantum-leaps.com
//////////////////////////////////////////////////////////////////////////////
#ifndef qp_port_h
#define qp_port_h

#include "qp_config.h"    // QP configuration defined at the application level

//............................................................................
                                             // QF critical section entry/exit
// QF_INT_KEY_TYPE not defined
#define QF_INT_LOCK(dummy)      __disable_irq()
#define QF_INT_UNLOCK(dummy)    __enable_irq()

#ifdef QK_PREEMPTIVE
                                                // QK interrupt entry and exit
    #define QK_ISR_ENTRY() do { \
        __disable_irq(); \
        ++QK_intNest_; \
        QF_QS_ISR_ENTRY(QK_intNest_, QK_currPrio_); \
        __enable_irq(); \
    } while (0)

    #define QK_ISR_EXIT()  do { \
        __disable_irq(); \
        QF_QS_ISR_EXIT(QK_intNest_, QK_currPrio_); \
        --QK_intNest_; \
        *((uint32_t volatile *)0xE000ED04) = 0x10000000; \
        __enable_irq(); \
    } while (0)
#else
    #define QK_ISR_ENTRY() ((void)0)
    #define QK_ISR_EXIT()  ((void)0)
#endif

#ifdef Q_SPY
    #define QS_TIME_SIZE        4
    #define QS_OBJ_PTR_SIZE     4
    #define QS_FUN_PTR_SIZE     4
#endif

#include <stdint.h>    // mbed compiler supports standard exact-width integers

#include "qp.h"                           // QP platform-independent interface

#endif                                                            // qp_port_h