| |
| |
Preface | |
| |
| |
| |
Statecharts | |
| |
| |
| |
Whirlwind Tour of Programming with Statecharts | |
| |
| |
| |
Why Bother? | |
| |
| |
| |
The Traditional Event-Action Paradigm | |
| |
| |
| |
State Machines ? A Better Way of Programming | |
| |
| |
| |
The Time Bomb Example | |
| |
| |
| |
The Calculator Example | |
| |
| |
| |
Object-Oriented Analogy | |
| |
| |
| |
The Event-driven Framework | |
| |
| |
| |
Summary | |
| |
| |
| |
A Crash Course in Statecharts | |
| |
| |
| |
The Essence of Finite State Machines | |
| |
| |
| |
The Essence of UML Statecharts | |
| |
| |
| |
Examples of State Models | |
| |
| |
| |
Summary | |
| |
| |
| |
Standard State Machine Implementations | |
| |
| |
| |
State Machine Interface | |
| |
| |
| |
Nested switch Statement | |
| |
| |
| |
State Table | |
| |
| |
| |
State Design Pattern | |
| |
| |
| |
Optimal FSM Implementation | |
| |
| |
| |
State Machines and C++ Exception Handling | |
| |
| |
| |
Role of Pointer-to-Member Functions | |
| |
| |
| |
Implementing Guards, Junctions, and Choice Points | |
| |
| |
| |
Implementing Entry and Exit Actions | |
| |
| |
| |
Dealing with State Hierarchy | |
| |
| |
| |
Summary | |
| |
| |
| |
QEP: A Minimal Hierarchical Event Processor | |
| |
| |
| |
General Structure of the QEP Event Processor | |
| |
| |
| |
An Annotated Example (QHsm) | |
| |
| |
| |
QEP Structure | |
| |
| |
| |
QEP Source Code Structure | |
| |
| |
| |
Internal Representation of a State Machine | |
| |
| |
| |
Initialization of a State Machine | |
| |
| |
| |
Dispatching Events to a FSM | |
| |
| |
| |
Executing a Transition in a FSM | |
| |
| |
| |
Dispatching Events to a HSM | |
| |
| |
| |
Executing a Transition in a HSM | |
| |
| |
| |
Static Transition Optimization in a HSM | |
| |
| |
| |
Porting and Configuring QEP | |
| |
| |
| |
Caveats | |
| |
| |
| |
Summary | |
| |
| |
| |
Implementing State Machines with QEP | |
| |
| |
| |
Implementing a HSM with QEP | |
| |
| |
| |
Step 1: Enumerating Signals | |
| |
| |
| |
Step 2: Defining Events | |
| |
| |
| |
Step 3: Defining the QCalc State Machine | |
| |
| |
| |
Step 4: Declaring the QCalc States | |
| |
| |
| |
Step 5: Initializing the HSM | |
| |
| |
| |
Step 6: Implementing the State Handler Functions | |
| |
| |
| |
Implementing a FSM with QEP | |
| |
| |
| |
Pitfalls to Avoid While Coding State Machines with QEP | |
| |
| |
| |
Incomplete State Handlers 2-37 | |
| |
| |
| |
Confusing Statecharts with Flowcharts 2-38 | |
| |
| |
| |
Ill-Formed State Handlers 2-39 | |
| |
| |
| |
Suboptimal Signal Granularity 2-42 | |
| |
| |
| |
Violating the Run To Completion Semantics 2-42 | |
| |
| |
| |
Summary | |
| |
| |
| |
State Patterns | |
| |
| |
| |
Ultimate Hook | |
| |
| |
| |
Reminder | |
| |
| |
| |
Deferred Event | |
| |
| |
| |
Orthogonal Component | |
| |
| |
| |
Transition to History | |
| |
| |
| |
Summary | |
| |
| |
| |
Event-Driven Framework | |
| |
| |
| |
QF: A Minimal Event-Driven Embedded Framework | |
| |
| |
| |
Conventional Approach to Multithreading | |
| |
| |
| |
Computing Model of QF | |
| |
| |
| |
Annotated Example | |
| |
| |
| |
The ?Airplane in the Tunnel? Game | |
| |
| |
| |
The Active Object Design | |
| |
| |
| |
The Implementation | |
| |
| |
| |
The Port for ARM Cortex-M3 | |
| |
| |
| |
Testing | |
| |
| |
| |
Summary | |
| |
| |
| |
Design of QF | |
| |
| |
| |
Handling Errors and Exceptional Conditions | |
| |
| |
| |
Memory Management | |
| |
| |
| |
Mutual Exclusion and Blocking | |
| |
| |
| |
Active Objects | |
| |
| |
| |
Event Management in QF | |
| |
| |
| |
Event Delivery Mechanisms in QF | |
| |
| |
| |
Deferring and Recalling Events in QF | |
| |
| |
| |
Time Events | |
| |
| |
| |
Summary | |
| |
| |
| |
Implementation of QF | |
| |
| |
| |
Code Organization | |
| |
| |
| |
Critical Section in QF | |
| |
| |
| |
General QF Policies Enforced by Assertions | |
| |
| |
| |
Active Object class | |
| |
| |
| |
Native QF Event Queue | |
| |
| |
| |
Native QF Memory Pool | |
| |
| |
| |
Native QF Priority Set | |
| |
| |
| |
Native QF Scheduler | |
| |
| |
| |
Porting QF | |
| |
| |
| |
QF Porting Guide | |
| |
| |
| |
QF on Bare-Metal Targets (the Vanilla Port) | |
| |
| |
| |
Using QF with a preemptive Real-Time Kernel (�C/OS-II) | |
| |
| |
| |
QF port to a POSIX-Compliant OS (Linux) | |
| |
| |
| |
Summary | |
| |
| |
| |
Conclusion | |
| |
| |
| |
Rules for Developing Event-Driven Embedded Applications | |
| |
| |
| |
Heuristics | |
| |
| |
| |
Sizing Event Queues and Event Pools | |
| |
| |
| |
System Integration | |
| |
| |
| |
Summary of Key Elements | |
| |
| |
| |
An Invitation | |
| |
| |
Appendix A QK: A Single-Stack Preemptive Kernel | |
| |
| |
| |
Run-to-Completion Processing | |
| |
| |
| |
Synchronous and Asynchronous Preemptions | |
| |
| |
| |
Sta | |