QP/C  7.2.2
Real-Time Embedded Framework
No Matches
API Reference

Low-Power ExampleDeprecated APIs

QEP (Hierarchical State Machines)

QEP is a universal, UML-compliant event processor that enables developers to code UML state machines in highly readable ANSI-C, in which every state machine element is mapped to code precisely, unambiguously, and exactly once (traceability). QEP fully supports hierarchical state nesting, which is the fundamental mechanism for reusing behavior across many states instead of repeating the same actions and transitions over and over again.

Hierarchical State Machines

QHsm class

QMsm class derived from QHsm

QF (Active Object Framework)

QF is a portable, event-driven, real-time framework for execution of active objects (concurrent state machines) specifically designed for real-time embedded (RTE) systems.

Active Objects (QActive)

QActive class


Active Objects (QMActive)

QMActive class (derived from QActive)

Event Management

QEvt class

Time Management

QTimeEvt class

QTicker active object (derived from QTimeEvt)

Event Queues (raw thread-safe)

QEQueue class

Memory Pools

QMPool class

QS (Software Tracing)

QS is a software tracing system that enables developers to monitor live event-driven QP applications with minimal target system resources and without stopping or significantly slowing down the code. QS is an ideal tool for testing, troubleshooting, and optimizing QP applications. QS can even be used to support acceptance testing in product manufacturing.

QS-Transmit (QS-TX)

QS Filters

QS Dictionaries

QS Application-Specific Records

QS Receive-Channel (QS-RX)

QV (Cooperative Kernel)

QV is a simple cooperative kernel (previously called "Vanilla" kernel). This kernel executes active objects one at a time, with priority-based scheduling performed before processing of each event. Due to naturally short duration of event processing in state machines, the simple QV kernel is often adequate for many real-time systems.

The QV scheduler is engaged after every RTC step of any active object to choose the next active object to execute. The QV scheduler always chooses the highest-priority active object that has any events in its event queue. The QV scheduler then extracts the next event from this queue and dispatches it to the state machine associated with the active object. The state machine runs to completion, after which the QV scheduler runs and the cycle repeats.

Please note that because the state machines always return to the QV scheduler after each RTC step, a single stack can be used to process all state machines (memory-friendly architecture).

The QV scheduler can also very easily detect when all event queues are empty, at which point it can call the idle callback to let the application put the CPU and peripherals to a low-power sleep mode (power-friendly architecture).

Given the simplicity, portability, and low-resource consumption, the QV scheduler is very attractive. It allows you to partition the problem into active objects and execute these active objects orderly. The task-level response of this scheduler is the longest RTC step in the whole system, but because event-driven active objects don’t block, the RTC steps tend to be very short (typically just a few microseconds). Also, often you can break up longer RTC steps into shorter pieces, by posting an event to self and returning (“Reminder” state pattern). The self-posted event then triggers the continuation of longer processing.

Kernel Initialization and Control

QK (Preemptive RTC Kernel)

QK is a tiny preemptive, run-to-completion (RTC) kernel designed specifically for executing active objects. QK runs active objects in the same way as prioritized interrupt controller (such as NVIC in ARM Cortex-M) runs interrupts using the single stack. Active objects process their events in run-to-completion (RTC) fashion and remove themselves from the call stack, the same way as nested interrupts remove themselves from the stack upon completion. At the same time high-priority active objects can preempt lower-priority active objects, just like interrupts can preempt each other under a prioritized interrupt controller. QK meets all the requirement of the Rate Monotonic Scheduling (a.k.a. Rate Monotonic Analysis RMA) and can be used in hard real-time systems.

Kernel Initialization and Control

QK Interrupt Management

QXK (Dual-Mode Kernel)

QXK is a small, preemptive, priority-based, dual-mode (run-to-completion/blocking) kernel that executes active objects like the QK kernel, but can also execute traditional blocking threads (extended threads). In this respect, QXK behaves exactly as a conventional RTOS (Real-Time Operating System). QXK has been designed specifically for mixing event-driven active objects with traditional blocking code, such as commercial middleware (TCP/IP stacks, UDP stacks, embedded file systems, etc.) or legacy software.

Kernel Initialization and Control

QXK Interrupt Management


QXThread class

QXThread Message Queues

QXSemaphore class

QXMutex class

Low-Power ExampleDeprecated APIs