This commit is contained in:
Quantum Leaps 2016-11-08 12:48:44 -05:00
parent c06e502988
commit 38cca09ce3
14 changed files with 430 additions and 190 deletions

1
.gitignore vendored
View File

@ -47,6 +47,7 @@ targetConfigs/
Debug/ Debug/
Release/ Release/
Spy/ Spy/
QSpy/
lib/ lib/
obj/ obj/

View File

@ -9,7 +9,7 @@
License Type: Windows Single User License License Type: Windows Single User License
Licensed To : Quantum Leaps, LLC Licensed To : Quantum Leaps, LLC
License No. : WS2975 License Date: Dec 15, 2013 License No. : WS2975 License Date: Dec 15, 2013
Build Date : Sep 2 2009 Run Date: Nov 01, 2016 Build Date : Sep 2 2009 Run Date: Nov 02, 2016
(C)1996-2009 M Squared Technologies LLC (C)1996-2009 M Squared Technologies LLC
________________________________________________________________________ ________________________________________________________________________
@ -150,7 +150,7 @@
~~ Total File Summary ~~ ~~ Total File Summary ~~
LOC 254 eLOC 222 lLOC 130 Comment 311 Lines 651 LOC 255 eLOC 223 lLOC 131 Comment 311 Lines 652
------------------------------------------------------------------------ ------------------------------------------------------------------------
~~ File Functional Summary ~~ ~~ File Functional Summary ~~
@ -826,8 +826,9 @@
Loops for / foreach : 1 Loops for / foreach : 1
Conditional if / else if: 5 Conditional if / else if: 5
Logical or ( || ) : 1 Logical or ( || ) : 1
Complexity Param 1 Return 1 Cyclo Vg 13 Total 15 Logical and ( && ) : 1
LOC 111 eLOC 98 lLOC 63 Comment 67 Lines 152 Complexity Param 1 Return 1 Cyclo Vg 14 Total 16
LOC 112 eLOC 99 lLOC 63 Comment 68 Lines 154
Function: QP::QHsm::hsm_tran Function: QP::QHsm::hsm_tran
Parameters: (QStateHandler (&path)[MAX_NEST_DEPTH_]) Parameters: (QStateHandler (&path)[MAX_NEST_DEPTH_])
@ -860,27 +861,27 @@
~~ Total File Summary ~~ ~~ Total File Summary ~~
LOC 339 eLOC 292 lLOC 166 Comment 282 Lines 599 LOC 340 eLOC 293 lLOC 166 Comment 283 Lines 601
------------------------------------------------------------------------ ------------------------------------------------------------------------
~~ File Functional Summary ~~ ~~ File Functional Summary ~~
File Function Count....: 7 File Function Count....: 7
Total Function LOC.....: 288 Total Function Pts LOC : 6.4 Total Function LOC.....: 289 Total Function Pts LOC : 6.4
Total Function eLOC....: 244 Total Function Pts eLOC: 5.5 Total Function eLOC....: 245 Total Function Pts eLOC: 5.5
Total Function lLOC....: 160 Total Function Pts lLOC: 3.1 Total Function lLOC....: 160 Total Function Pts lLOC: 3.1
Total Function Params .: 8 Total Function Return .: 7 Total Function Params .: 8 Total Function Return .: 7
Total Cyclo Complexity : 41 Total Function Complex.: 56 Total Cyclo Complexity : 42 Total Function Complex.: 57
------ ----- ----- ------ ------ ----- ------ ----- ----- ------ ------ -----
Max Function LOC ......: 111 Average Function LOC ..: 41.14 Max Function LOC ......: 112 Average Function LOC ..: 41.29
Max Function eLOC .....: 98 Average Function eLOC .: 34.86 Max Function eLOC .....: 99 Average Function eLOC .: 35.00
Max Function lLOC .....: 63 Average Function lLOC .: 22.86 Max Function lLOC .....: 63 Average Function lLOC .: 22.86
------ ----- ----- ------ ------ ----- ------ ----- ----- ------ ------ -----
Max Function Parameters: 2 Avg Function Parameters: 1.14 Max Function Parameters: 2 Avg Function Parameters: 1.14
Max Function Returns ..: 1 Avg Function Returns ..: 1.00 Max Function Returns ..: 1 Avg Function Returns ..: 1.00
Max Interface Complex. : 3 Avg Interface Complex. : 2.14 Max Interface Complex. : 3 Avg Interface Complex. : 2.14
Max Cyclomatic Complex.: 15 Avg Cyclomatic Complex.: 5.86 Max Cyclomatic Complex.: 15 Avg Cyclomatic Complex.: 6.00
Max Total Complexity ..: 17 Avg Total Complexity ..: 8.00 Max Total Complexity ..: 17 Avg Total Complexity ..: 8.14
________________________________________________________________________ ________________________________________________________________________
End of File: ..\source\qep_hsm.cpp End of File: ..\source\qep_hsm.cpp
@ -1002,12 +1003,12 @@
LOC 15 eLOC 14 lLOC 8 Comment 17 Lines 20 LOC 15 eLOC 14 lLOC 8 Comment 17 Lines 20
Function: QP::QF::remove_ Function: QP::QF::remove_
Parameters: (QMActive const * const a) Parameters: (QMActive * const a)
Cyclomatic Complexity Vg Detail Cyclomatic Complexity Vg Detail
Function Base : 1 Function Base : 1
Logical and ( && ) : 2 Logical and ( && ) : 2
Complexity Param 1 Return 1 Cyclo Vg 3 Total 5 Complexity Param 1 Return 1 Cyclo Vg 3 Total 5
LOC 15 eLOC 14 lLOC 8 Comment 17 Lines 20 LOC 16 eLOC 15 lLOC 9 Comment 18 Lines 21
Function: QP::QF::bzero Function: QP::QF::bzero
Parameters: (void * const start, uint_fast16_t len) Parameters: (void * const start, uint_fast16_t len)
@ -1021,21 +1022,21 @@
~~ Total File Summary ~~ ~~ Total File Summary ~~
LOC 146 eLOC 140 lLOC 22 Comment 104 Lines 255 LOC 147 eLOC 141 lLOC 23 Comment 105 Lines 256
------------------------------------------------------------------------ ------------------------------------------------------------------------
~~ File Functional Summary ~~ ~~ File Functional Summary ~~
File Function Count....: 3 File Function Count....: 3
Total Function LOC.....: 38 Total Function Pts LOC : 2.8 Total Function LOC.....: 39 Total Function Pts LOC : 2.8
Total Function eLOC....: 34 Total Function Pts eLOC: 2.6 Total Function eLOC....: 35 Total Function Pts eLOC: 2.7
Total Function lLOC....: 20 Total Function Pts lLOC: 0.4 Total Function lLOC....: 21 Total Function Pts lLOC: 0.4
Total Function Params .: 4 Total Function Return .: 3 Total Function Params .: 4 Total Function Return .: 3
Total Cyclo Complexity : 8 Total Function Complex.: 15 Total Cyclo Complexity : 8 Total Function Complex.: 15
------ ----- ----- ------ ------ ----- ------ ----- ----- ------ ------ -----
Max Function LOC ......: 15 Average Function LOC ..: 12.67 Max Function LOC ......: 16 Average Function LOC ..: 13.00
Max Function eLOC .....: 14 Average Function eLOC .: 11.33 Max Function eLOC .....: 15 Average Function eLOC .: 11.67
Max Function lLOC .....: 8 Average Function lLOC .: 6.67 Max Function lLOC .....: 9 Average Function lLOC .: 7.00
------ ----- ----- ------ ------ ----- ------ ----- ----- ------ ------ -----
Max Function Parameters: 2 Avg Function Parameters: 1.33 Max Function Parameters: 2 Avg Function Parameters: 1.33
Max Function Returns ..: 1 Avg Function Returns ..: 1.00 Max Function Returns ..: 1 Avg Function Returns ..: 1.00
@ -2551,9 +2552,9 @@
~~ Total Project Summary ~~ ~~ Total Project Summary ~~
LOC 5657 eLOC 4949 lLOC 2330 Comment 6658 Lines 12599 LOC 5660 eLOC 4952 lLOC 2332 Comment 6660 Lines 12603
Average per File, metric/41 files Average per File, metric/41 files
LOC 137 eLOC 120 lLOC 56 Comment 162 Lines 307 LOC 138 eLOC 120 lLOC 56 Comment 162 Lines 307
------------------------------------------------------------------------ ------------------------------------------------------------------------
@ -2903,8 +2904,8 @@
Function: QP::QHsm::dispatch Function: QP::QHsm::dispatch
Parameters: (QEvt const * const e) Parameters: (QEvt const * const e)
Complexity Param 1 Return 1 Cyclo Vg 13 Total 15 Complexity Param 1 Return 1 Cyclo Vg 14 Total 16
LOC 111 eLOC 98 lLOC 63 Comment 67 Lines 152 LOC 112 eLOC 99 lLOC 63 Comment 68 Lines 154
Function: QP::QHsm::hsm_tran Function: QP::QHsm::hsm_tran
Parameters: (QStateHandler (&path)[MAX_NEST_DEPTH_]) Parameters: (QStateHandler (&path)[MAX_NEST_DEPTH_])
@ -2972,9 +2973,9 @@
LOC 15 eLOC 14 lLOC 8 Comment 17 Lines 20 LOC 15 eLOC 14 lLOC 8 Comment 17 Lines 20
Function: QP::QF::remove_ Function: QP::QF::remove_
Parameters: (QMActive const * const a) Parameters: (QMActive * const a)
Complexity Param 1 Return 1 Cyclo Vg 3 Total 5 Complexity Param 1 Return 1 Cyclo Vg 3 Total 5
LOC 15 eLOC 14 lLOC 8 Comment 17 Lines 20 LOC 16 eLOC 15 lLOC 9 Comment 18 Lines 21
Function: QP::QF::bzero Function: QP::QF::bzero
Parameters: (void * const start, uint_fast16_t len) Parameters: (void * const start, uint_fast16_t len)
@ -3581,26 +3582,26 @@
LOC 14 eLOC 11 lLOC 7 Comment 2 Lines 16 LOC 14 eLOC 11 lLOC 7 Comment 2 Lines 16
Total: Functions Total: Functions
LOC 3492 eLOC 2895 lLOC 1769 InCmp 404 CycloCmp 573 LOC 3494 eLOC 2897 lLOC 1770 InCmp 404 CycloCmp 574
Function Points FP(LOC) 61.1 FP(eLOC) 51.2 FP(lLOC) 31.6 Function Points FP(LOC) 61.1 FP(eLOC) 51.2 FP(lLOC) 31.6
------------------------------------------------------------------------ ------------------------------------------------------------------------
~~ Project Functional Analysis ~~ ~~ Project Functional Analysis ~~
Total Functions .......: 200 Total Physical Lines ..: 4517 Total Functions .......: 200 Total Physical Lines ..: 4520
Total LOC .............: 3492 Total Function Pts LOC : 61.1 Total LOC .............: 3494 Total Function Pts LOC : 61.1
Total eLOC ............: 2895 Total Function Pts eLOC: 51.2 Total eLOC ............: 2897 Total Function Pts eLOC: 51.2
Total lLOC.............: 1769 Total Function Pts lLOC: 31.6 Total lLOC.............: 1770 Total Function Pts lLOC: 31.6
Total Cyclomatic Comp. : 573 Total Interface Comp. .: 404 Total Cyclomatic Comp. : 574 Total Interface Comp. .: 404
Total Parameters ......: 204 Total Return Points ...: 200 Total Parameters ......: 204 Total Return Points ...: 200
Total Comment Lines ...: 2816 Total Blank Lines .....: 533 Total Comment Lines ...: 2818 Total Blank Lines .....: 533
------ ----- ----- ------ ------ ----- ------ ----- ----- ------ ------ -----
Avg Physical Lines ....: 22.59 Avg Physical Lines ....: 22.60
Avg LOC ...............: 17.46 Avg eLOC ..............: 14.48 Avg LOC ...............: 17.47 Avg eLOC ..............: 14.48
Avg lLOC ..............: 8.85 Avg Cyclomatic Comp. ..: 2.87 Avg lLOC ..............: 8.85 Avg Cyclomatic Comp. ..: 2.87
Avg Interface Comp. ...: 2.02 Avg Parameters ........: 1.02 Avg Interface Comp. ...: 2.02 Avg Parameters ........: 1.02
Avg Return Points .....: 1.00 Avg Comment Lines .....: 14.08 Avg Return Points .....: 1.00 Avg Comment Lines .....: 14.09
------ ----- ----- ------ ------ ----- ------ ----- ----- ------ ------ -----
Max LOC ...............: 260 Max LOC ...............: 260
Max eLOC ..............: 202 Max lLOC ..............: 125 Max eLOC ..............: 202 Max lLOC ..............: 125

View File

@ -1,13 +1,13 @@
//**************************************************************************** //****************************************************************************
// DPP example // DPP example for Windows
// Last updated for version 5.6.0 // Last updated for version 5.7.5
// Last updated on 2015-12-26 // Last updated on 2016-11-08
// //
// Q u a n t u m L e a P s // Q u a n t u m L e a P s
// --------------------------- // ---------------------------
// innovating embedded systems // innovating embedded systems
// //
// Copyright (C) Quantum Leaps, www.state-machine.com. // Copyright (C) Quantum Leaps, LLC. All rights reserved.
// //
// This program is open source software: you can redistribute it and/or // This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published // modify it under the terms of the GNU General Public License as published
@ -28,24 +28,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
// Contact information: // Contact information:
// Web: www.state-machine.com // http://www.state-machine.com
// Email: info@state-machine.com // mailto:info@state-machine.com
//**************************************************************************** //****************************************************************************
#include "qpcpp.h" #include "qpcpp.h"
#include "dpp.h" #include "dpp.h"
#include "bsp.h" #include "bsp.h"
// "fudge factor" for Windows, see NOTE1
enum { WIN_FUDGE_FACTOR = 10 };
//............................................................................ //............................................................................
int main() { int main() {
static QP::QEvt const *tableQueueSto[N_PHILO]; static QP::QEvt const *tableQueueSto[N_PHILO*WIN_FUDGE_FACTOR];
static QP::QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static QP::QEvt const *philoQueueSto[N_PHILO][N_PHILO*WIN_FUDGE_FACTOR];
static QF_MPOOL_EL(DPP::TableEvt) smlPoolSto[2*N_PHILO*WIN_FUDGE_FACTOR];
static QP::QSubscrList subscrSto[DPP::MAX_PUB_SIG]; static QP::QSubscrList subscrSto[DPP::MAX_PUB_SIG];
static QF_MPOOL_EL(DPP::TableEvt) smlPoolSto[2*N_PHILO];
QP::QF::init(); // initialize the framework and the underlying RT kernel QP::QF::init(); // initialize the framework and the underlying RT kernel
DPP::BSP::init(); // initialize the BSP DPP::BSP::init(); // initialize the BSP
// object dictionaries... // object dictionaries...
@ -76,3 +77,24 @@ int main() {
return QP::QF::run(); // run the QF application return QP::QF::run(); // run the QF application
} }
//****************************************************************************
// NOTE1:
// Windows is not a deterministic real-time system, which means that the
// system can occasionally and unexpectedly "choke and freeze" for a number
// of seconds. The designers of Windows have dealt with these sort of issues
// by massively oversizing the resources available to the applications. For
// example, the default Windows GUI message queues size is 10,000 entries,
// which can dynamically grow to an even larger number. Also the stacks of
// Win32 threads can dynamically grow to several megabytes.
//
// In contrast, the event queues, event pools, and stack size inside the
// real-time embedded (RTE) systems can be (and must be) much smaller,
// because you typically can put an upper bound on the real-time behavior
// and the resulting delays.
//
// To be able to run the unmodified applications designed originally for
// RTE systems on Windows, and to reduce the odds of resource shortages in
// this case, the generous WIN_FUDGE_FACTOR is used to oversize the
// event queues and event pools.
//

View File

@ -1,13 +1,13 @@
//**************************************************************************** //****************************************************************************
// DPP example // DPP example for Windows
// Last updated for version 5.6.0 // Last updated for version 5.7.5
// Last updated on 2015-12-26 // Last updated on 2016-11-08
// //
// Q u a n t u m L e a P s // Q u a n t u m L e a P s
// --------------------------- // ---------------------------
// innovating embedded systems // innovating embedded systems
// //
// Copyright (C) Quantum Leaps, www.state-machine.com. // Copyright (C) Quantum Leaps, LLC. All rights reserved.
// //
// This program is open source software: you can redistribute it and/or // This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published // modify it under the terms of the GNU General Public License as published
@ -28,24 +28,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
// Contact information: // Contact information:
// Web: www.state-machine.com // http://www.state-machine.com
// Email: info@state-machine.com // mailto:info@state-machine.com
//**************************************************************************** //****************************************************************************
#include "qpcpp.h" #include "qpcpp.h"
#include "dpp.h" #include "dpp.h"
#include "bsp.h" #include "bsp.h"
// "fudge factor" for Windows, see NOTE1
enum { WIN_FUDGE_FACTOR = 10 };
//............................................................................ //............................................................................
int main() { int main() {
static QP::QEvt const *tableQueueSto[N_PHILO]; static QP::QEvt const *tableQueueSto[N_PHILO*WIN_FUDGE_FACTOR];
static QP::QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static QP::QEvt const *philoQueueSto[N_PHILO][N_PHILO*WIN_FUDGE_FACTOR];
static QF_MPOOL_EL(DPP::TableEvt) smlPoolSto[2*N_PHILO*WIN_FUDGE_FACTOR];
static QP::QSubscrList subscrSto[DPP::MAX_PUB_SIG]; static QP::QSubscrList subscrSto[DPP::MAX_PUB_SIG];
static QF_MPOOL_EL(DPP::TableEvt) smlPoolSto[2*N_PHILO];
QP::QF::init(); // initialize the framework and the underlying RT kernel QP::QF::init(); // initialize the framework and the underlying RT kernel
DPP::BSP::init(); // initialize the BSP DPP::BSP::init(); // initialize the BSP
// object dictionaries... // object dictionaries...
@ -76,3 +77,24 @@ int main() {
return QP::QF::run(); // run the QF application return QP::QF::run(); // run the QF application
} }
//****************************************************************************
// NOTE1:
// Windows is not a deterministic real-time system, which means that the
// system can occasionally and unexpectedly "choke and freeze" for a number
// of seconds. The designers of Windows have dealt with these sort of issues
// by massively oversizing the resources available to the applications. For
// example, the default Windows GUI message queues size is 10,000 entries,
// which can dynamically grow to an even larger number. Also the stacks of
// Win32 threads can dynamically grow to several megabytes.
//
// In contrast, the event queues, event pools, and stack size inside the
// real-time embedded (RTE) systems can be (and must be) much smaller,
// because you typically can put an upper bound on the real-time behavior
// and the resulting delays.
//
// To be able to run the unmodified applications designed originally for
// RTE systems on Windows, and to reduce the odds of resource shortages in
// this case, the generous WIN_FUDGE_FACTOR is used to oversize the
// event queues and event pools.
//

View File

@ -0,0 +1,113 @@
//****************************************************************************
// Product: "Fly 'n' Shoot" game example for Windows
// Last updated for version 5.7.5
// Last updated on 2016-11-08
//
// Q u a n t u m L e a P s
// ---------------------------
// innovating embedded systems
//
// Copyright (C) Quantum Leaps, LLC. All rights reserved.
//
// This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Alternatively, this program may be distributed and modified under the
// terms of Quantum Leaps commercial licenses, which expressly supersede
// the GNU General Public License and are specifically designed for
// licensees interested in retaining the proprietary status of their code.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Contact information:
// http://www.state-machine.com
// mailto:info@state-machine.com
//****************************************************************************
#include "qpcpp.h"
#include "bsp.h"
#include "game.h"
// "fudge factor" for Windows, see NOTE1
enum { WIN_FUDGE_FACTOR = 10 };
//............................................................................
int main() {
static QP::QEvt const *missileQueueSto[2*WIN_FUDGE_FACTOR];
static QP::QEvt const *shipQueueSto[3*WIN_FUDGE_FACTOR];
static QP::QEvt const *tunnelQueueSto[(GAME_MINES_MAX + 5)*WIN_FUDGE_FACTOR];
static QF_MPOOL_EL(QP::QEvt) smlPoolSto[10*WIN_FUDGE_FACTOR];
static QF_MPOOL_EL(GAME::ObjectImageEvt)
medPoolSto[(2*GAME_MINES_MAX + 10)*WIN_FUDGE_FACTOR];
static QP::QSubscrList subscrSto[GAME::MAX_PUB_SIG];
QP::QF::init(); // initialize the framework and the underlying RT kernel
GAME::BSP_init(); // initialize the Board Support Package
// initialize the event pools...
QP::QF::poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0]));
QP::QF::poolInit(medPoolSto, sizeof(medPoolSto), sizeof(medPoolSto[0]));
// init publish-subscribe
QP::QF::psInit(subscrSto, Q_DIM(subscrSto));
// send object dictionaries for event queues...
QS_OBJ_DICTIONARY(missileQueueSto);
QS_OBJ_DICTIONARY(shipQueueSto);
QS_OBJ_DICTIONARY(tunnelQueueSto);
// send object dictionaries for event pools...
QS_OBJ_DICTIONARY(smlPoolSto);
QS_OBJ_DICTIONARY(medPoolSto);
// send signal dictionaries for globally published events...
QS_SIG_DICTIONARY(GAME::TIME_TICK_SIG, static_cast<void *>(0));
QS_SIG_DICTIONARY(GAME::PLAYER_TRIGGER_SIG, static_cast<void *>(0));
QS_SIG_DICTIONARY(GAME::PLAYER_QUIT_SIG, static_cast<void *>(0));
QS_SIG_DICTIONARY(GAME::GAME_OVER_SIG, static_cast<void *>(0));
// start the active objects...
GAME::AO_Tunnel ->start(1U, // priority
tunnelQueueSto, Q_DIM(tunnelQueueSto), // evt queue
static_cast<void *>(0), 0U); // no per-thread stack
GAME::AO_Ship ->start(2U, // priority
shipQueueSto, Q_DIM(shipQueueSto), // evt queue
static_cast<void *>(0), 0U); // no per-thread stack
GAME::AO_Missile->start(3U, // priority
missileQueueSto, Q_DIM(missileQueueSto), // evt queue
static_cast<void *>(0), 0U); // no per-thread stack
return QP::QF::run(); // run the QF application
}
//****************************************************************************
// NOTE1:
// Windows is not a deterministic real-time system, which means that the
// system can occasionally and unexpectedly "choke and freeze" for a number
// of seconds. The designers of Windows have dealt with these sort of issues
// by massively oversizing the resources available to the applications. For
// example, the default Windows GUI message queues size is 10,000 entries,
// which can dynamically grow to an even larger number. Also the stacks of
// Win32 threads can dynamically grow to several megabytes.
//
// In contrast, the event queues, event pools, and stack size inside the
// real-time embedded (RTE) systems can be (and must be) much smaller,
// because you typically can put an upper bound on the real-time behavior
// and the resulting delays.
//
// To be able to run the unmodified applications designed originally for
// RTE systems on Windows, and to reduce the odds of resource shortages in
// this case, the generous WIN_FUDGE_FACTOR is used to oversize the
// event queues and event pools.
//

View File

@ -0,0 +1,113 @@
//****************************************************************************
// Product: "Fly 'n' Shoot" game example for Windows
// Last updated for version 5.7.5
// Last updated on 2016-11-08
//
// Q u a n t u m L e a P s
// ---------------------------
// innovating embedded systems
//
// Copyright (C) Quantum Leaps, LLC. All rights reserved.
//
// This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Alternatively, this program may be distributed and modified under the
// terms of Quantum Leaps commercial licenses, which expressly supersede
// the GNU General Public License and are specifically designed for
// licensees interested in retaining the proprietary status of their code.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Contact information:
// http://www.state-machine.com
// mailto:info@state-machine.com
//****************************************************************************
#include "qpcpp.h"
#include "bsp.h"
#include "game.h"
// "fudge factor" for Windows, see NOTE1
enum { WIN_FUDGE_FACTOR = 10 };
//............................................................................
int main() {
static QP::QEvt const *missileQueueSto[2*WIN_FUDGE_FACTOR];
static QP::QEvt const *shipQueueSto[3*WIN_FUDGE_FACTOR];
static QP::QEvt const *tunnelQueueSto[(GAME_MINES_MAX + 5)*WIN_FUDGE_FACTOR];
static QF_MPOOL_EL(QP::QEvt) smlPoolSto[10*WIN_FUDGE_FACTOR];
static QF_MPOOL_EL(GAME::ObjectImageEvt)
medPoolSto[(2*GAME_MINES_MAX + 10)*WIN_FUDGE_FACTOR];
static QP::QSubscrList subscrSto[GAME::MAX_PUB_SIG];
QP::QF::init(); // initialize the framework and the underlying RT kernel
GAME::BSP_init(); // initialize the Board Support Package
// initialize the event pools...
QP::QF::poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0]));
QP::QF::poolInit(medPoolSto, sizeof(medPoolSto), sizeof(medPoolSto[0]));
// init publish-subscribe
QP::QF::psInit(subscrSto, Q_DIM(subscrSto));
// send object dictionaries for event queues...
QS_OBJ_DICTIONARY(missileQueueSto);
QS_OBJ_DICTIONARY(shipQueueSto);
QS_OBJ_DICTIONARY(tunnelQueueSto);
// send object dictionaries for event pools...
QS_OBJ_DICTIONARY(smlPoolSto);
QS_OBJ_DICTIONARY(medPoolSto);
// send signal dictionaries for globally published events...
QS_SIG_DICTIONARY(GAME::TIME_TICK_SIG, static_cast<void *>(0));
QS_SIG_DICTIONARY(GAME::PLAYER_TRIGGER_SIG, static_cast<void *>(0));
QS_SIG_DICTIONARY(GAME::PLAYER_QUIT_SIG, static_cast<void *>(0));
QS_SIG_DICTIONARY(GAME::GAME_OVER_SIG, static_cast<void *>(0));
// start the active objects...
GAME::AO_Tunnel ->start(1U, // priority
tunnelQueueSto, Q_DIM(tunnelQueueSto), // evt queue
static_cast<void *>(0), 0U); // no per-thread stack
GAME::AO_Ship ->start(2U, // priority
shipQueueSto, Q_DIM(shipQueueSto), // evt queue
static_cast<void *>(0), 0U); // no per-thread stack
GAME::AO_Missile->start(3U, // priority
missileQueueSto, Q_DIM(missileQueueSto), // evt queue
static_cast<void *>(0), 0U); // no per-thread stack
return QP::QF::run(); // run the QF application
}
//****************************************************************************
// NOTE1:
// Windows is not a deterministic real-time system, which means that the
// system can occasionally and unexpectedly "choke and freeze" for a number
// of seconds. The designers of Windows have dealt with these sort of issues
// by massively oversizing the resources available to the applications. For
// example, the default Windows GUI message queues size is 10,000 entries,
// which can dynamically grow to an even larger number. Also the stacks of
// Win32 threads can dynamically grow to several megabytes.
//
// In contrast, the event queues, event pools, and stack size inside the
// real-time embedded (RTE) systems can be (and must be) much smaller,
// because you typically can put an upper bound on the real-time behavior
// and the resulting delays.
//
// To be able to run the unmodified applications designed originally for
// RTE systems on Windows, and to reduce the odds of resource shortages in
// this case, the generous WIN_FUDGE_FACTOR is used to oversize the
// event queues and event pools.
//

View File

@ -1,13 +1,13 @@
//**************************************************************************** //****************************************************************************
// DPP example // DPP example for Windows
// Last updated for version 5.4.0 // Last updated for version 5.7.5
// Last updated on 2015-04-29 // Last updated on 2016-11-08
// //
// Q u a n t u m L e a P s // Q u a n t u m L e a P s
// --------------------------- // ---------------------------
// innovating embedded systems // innovating embedded systems
// //
// Copyright (C) Quantum Leaps, www.state-machine.com. // Copyright (C) Quantum Leaps, LLC. All rights reserved.
// //
// This program is open source software: you can redistribute it and/or // This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published // modify it under the terms of the GNU General Public License as published
@ -28,20 +28,23 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
// Contact information: // Contact information:
// Web: www.state-machine.com // http://www.state-machine.com
// Email: info@state-machine.com // mailto:info@state-machine.com
//**************************************************************************** //****************************************************************************
#include "qpcpp.h" #include "qpcpp.h"
#include "dpp.h" #include "dpp.h"
#include "bsp.h" #include "bsp.h"
// "fudge factor" for Windows, see NOTE1
enum { WIN_FUDGE_FACTOR = 10 };
//............................................................................ //............................................................................
int main() { int main() {
static QP::QEvt const *tableQueueSto[N_PHILO]; static QP::QEvt const *tableQueueSto[N_PHILO*WIN_FUDGE_FACTOR];
static QP::QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static QP::QEvt const *philoQueueSto[N_PHILO][N_PHILO*WIN_FUDGE_FACTOR];
static QP::QSubscrList subscrSto[DPP::MAX_PUB_SIG]; static QF_MPOOL_EL(DPP::TableEvt) smlPoolSto[2*N_PHILO*WIN_FUDGE_FACTOR];
static QF_MPOOL_EL(DPP::TableEvt) smlPoolSto[2*N_PHILO]; static QP::QSubscrList subscrSto[DPP::MAX_PUB_SIG];
QP::QF::init(); // initialize the framework and the underlying RT kernel QP::QF::init(); // initialize the framework and the underlying RT kernel
@ -75,3 +78,24 @@ int main() {
return QP::QF::run(); // run the QF application return QP::QF::run(); // run the QF application
} }
//****************************************************************************
// NOTE1:
// Windows is not a deterministic real-time system, which means that the
// system can occasionally and unexpectedly "choke and freeze" for a number
// of seconds. The designers of Windows have dealt with these sort of issues
// by massively oversizing the resources available to the applications. For
// example, the default Windows GUI message queues size is 10,000 entries,
// which can dynamically grow to an even larger number. Also the stacks of
// Win32 threads can dynamically grow to several megabytes.
//
// In contrast, the event queues, event pools, and stack size inside the
// real-time embedded (RTE) systems can be (and must be) much smaller,
// because you typically can put an upper bound on the real-time behavior
// and the resulting delays.
//
// To be able to run the unmodified applications designed originally for
// RTE systems on Windows, and to reduce the odds of resource shortages in
// this case, the generous WIN_FUDGE_FACTOR is used to oversize the
// event queues and event pools.
//

View File

@ -1,13 +1,13 @@
//**************************************************************************** //****************************************************************************
// DPP example // DPP example for Windows
// Last updated for version 5.4.0 // Last updated for version 5.7.5
// Last updated on 2015-04-29 // Last updated on 2016-11-08
// //
// Q u a n t u m L e a P s // Q u a n t u m L e a P s
// --------------------------- // ---------------------------
// innovating embedded systems // innovating embedded systems
// //
// Copyright (C) Quantum Leaps, www.state-machine.com. // Copyright (C) Quantum Leaps, LLC. All rights reserved.
// //
// This program is open source software: you can redistribute it and/or // This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published // modify it under the terms of the GNU General Public License as published
@ -28,24 +28,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
// Contact information: // Contact information:
// Web: www.state-machine.com // http://www.state-machine.com
// Email: info@state-machine.com // mailto:info@state-machine.com
//**************************************************************************** //****************************************************************************
#include "qpcpp.h" #include "qpcpp.h"
#include "dpp.h" #include "dpp.h"
#include "bsp.h" #include "bsp.h"
// "fudge factor" for Windows, see NOTE1
enum { WIN_FUDGE_FACTOR = 10 };
//............................................................................ //............................................................................
int main() { int main() {
static QP::QEvt const *tableQueueSto[N_PHILO]; static QP::QEvt const *tableQueueSto[N_PHILO*WIN_FUDGE_FACTOR];
static QP::QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static QP::QEvt const *philoQueueSto[N_PHILO][N_PHILO*WIN_FUDGE_FACTOR];
static QF_MPOOL_EL(DPP::TableEvt) smlPoolSto[2*N_PHILO*WIN_FUDGE_FACTOR];
static QP::QSubscrList subscrSto[DPP::MAX_PUB_SIG]; static QP::QSubscrList subscrSto[DPP::MAX_PUB_SIG];
static QF_MPOOL_EL(DPP::TableEvt) smlPoolSto[2*N_PHILO];
QP::QF::init(); // initialize the framework and the underlying RT kernel QP::QF::init(); // initialize the framework and the underlying RT kernel
DPP::BSP_init(); // initialize the BSP DPP::BSP_init(); // initialize the BSP
// object dictionaries... // object dictionaries...
@ -75,3 +76,24 @@ int main() {
return QP::QF::run(); // run the QF application return QP::QF::run(); // run the QF application
} }
//****************************************************************************
// NOTE1:
// Windows is not a deterministic real-time system, which means that the
// system can occasionally and unexpectedly "choke and freeze" for a number
// of seconds. The designers of Windows have dealt with these sort of issues
// by massively oversizing the resources available to the applications. For
// example, the default Windows GUI message queues size is 10,000 entries,
// which can dynamically grow to an even larger number. Also the stacks of
// Win32 threads can dynamically grow to several megabytes.
//
// In contrast, the event queues, event pools, and stack size inside the
// real-time embedded (RTE) systems can be (and must be) much smaller,
// because you typically can put an upper bound on the real-time behavior
// and the resulting delays.
//
// To be able to run the unmodified applications designed originally for
// RTE systems on Windows, and to reduce the odds of resource shortages in
// this case, the generous WIN_FUDGE_FACTOR is used to oversize the
// event queues and event pools.
//

Binary file not shown.

View File

@ -2,14 +2,14 @@
/// \brief QF/C++ port to Win32 API with cooperative QV scheduler (win32-qv) /// \brief QF/C++ port to Win32 API with cooperative QV scheduler (win32-qv)
/// \cond /// \cond
///*************************************************************************** ///***************************************************************************
/// Last updated for version 5.7.1 /// Last updated for version 5.7.5
/// Last updated on 2016-09-23 /// Last updated on 2016-11-08
/// ///
/// Q u a n t u m L e a P s /// Q u a n t u m L e a P s
/// --------------------------- /// ---------------------------
/// innovating embedded systems /// innovating embedded systems
/// ///
/// Copyright (C) Quantum Leaps, www.state-machine.com. /// Copyright (C) Quantum Leaps, LLC. All rights reserved.
/// ///
/// This program is open source software: you can redistribute it and/or /// This program is open source software: you can redistribute it and/or
/// modify it under the terms of the GNU General Public License as published /// modify it under the terms of the GNU General Public License as published
@ -155,18 +155,8 @@ void QMActive::start(uint_fast8_t prio,
m_prio = prio; // set the QF priority of this AO m_prio = prio; // set the QF priority of this AO
QF::add_(this); // make QF aware of this AO QF::add_(this); // make QF aware of this AO
// ignore the original storage for the event queue 'qSto' and m_eQueue.init(qSto, qLen);
// instead allocate an oversized "fudged" storage for the queue.
// See also NOTE2 in qf_port.h.
Q_ASSERT_ID(710, static_cast<uint32_t>(qLen) * QF_WIN32_FUDGE_FACTOR
< USHRT_MAX);
// fudged the queue length
uint_fast16_t fudgedQLen = qLen * QF_WIN32_FUDGE_FACTOR;
// fudged queue storage
void *fudgedQSto = new QEvt*[fudgedQLen];
// allocation must succeed
Q_ASSERT_ID(720, fudgedQSto != static_cast<void *>(0));
m_eQueue.init(static_cast<QEvt const **>(fudgedQSto), fudgedQLen);
this->init(ie); // execute initial transition (virtual call) this->init(ie); // execute initial transition (virtual call)
QS_FLUSH(); // flush the QS trace buffer to the host QS_FLUSH(); // flush the QS trace buffer to the host
@ -175,7 +165,6 @@ void QMActive::start(uint_fast8_t prio,
void QMActive::stop(void) { void QMActive::stop(void) {
unsubscribeAll(); unsubscribeAll();
QF::remove_(this); QF::remove_(this);
delete[] m_eQueue.m_ring; // free the fudged queue storage
} }
//**************************************************************************** //****************************************************************************

View File

@ -2,8 +2,8 @@
/// \brief QF/C++ port to Win32 API with cooperative QV scheduler (win32-qv) /// \brief QF/C++ port to Win32 API with cooperative QV scheduler (win32-qv)
/// \cond /// \cond
///*************************************************************************** ///***************************************************************************
/// Last updated for version 5.7.2 /// Last updated for version 5.7.5
/// Last updated on 2016-09-28 /// Last updated on 2016-11-08
/// ///
/// Q u a n t u m L e a P s /// Q u a n t u m L e a P s
/// --------------------------- /// ---------------------------
@ -67,8 +67,8 @@
#ifdef _MSC_VER // Microsoft C/C++ compiler? #ifdef _MSC_VER // Microsoft C/C++ compiler?
// use built-in intrinsic function for fast LOG2 // use built-in intrinsic function for fast LOG2
#define QF_LOG2(x_) ((uint_fast8_t)(32U - __lzcnt(x_))) #define QF_LOG2(x_) (static_cast<uint_fast8_t>(32U - __lzcnt(x_)))
#include <intrin.h> /* VC++ intrinsic functions */ #include <intrin.h> // VC++ intrinsic functions
#elif __GNUC__ // GNU C/C++ compiler? #elif __GNUC__ // GNU C/C++ compiler?
// use built-in intrinsic function for fast LOG2 // use built-in intrinsic function for fast LOG2
#define QF_LOG2(x_) ((uint_fast8_t)(32U - __builtin_clz(x_))) #define QF_LOG2(x_) ((uint_fast8_t)(32U - __builtin_clz(x_)))
@ -163,13 +163,8 @@ void QF_onClockTick(void);
// Win32-QV specific event pool operations // Win32-QV specific event pool operations
#define QF_EPOOL_TYPE_ QMPool #define QF_EPOOL_TYPE_ QMPool
#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) do { \ #define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \
uint_fast32_t fudgedSize = (poolSize_) * QF_WIN32_FUDGE_FACTOR; \ (p_).init((poolSto_), (poolSize_), (evtSize_))
uint8_t *fudgedSto = new uint8_t[(poolSize_)*QF_WIN32_FUDGE_FACTOR]; \
Q_ASSERT_ID(210, fudgedSto != (uint8_t *)0); \
(void)(poolSto_); \
(p_).init(fudgedSto, fudgedSize, evtSize_); \
} while (false)
#define QF_EPOOL_EVENT_SIZE_(p_) ((p_).getBlockSize()) #define QF_EPOOL_EVENT_SIZE_(p_) ((p_).getBlockSize())
#define QF_EPOOL_GET_(p_, e_, m_) \ #define QF_EPOOL_GET_(p_, e_, m_) \
@ -182,11 +177,6 @@ void QF_onClockTick(void);
namespace QP { namespace QP {
extern QPSet QV_readySet_; // QV-ready set of active objects extern QPSet QV_readySet_; // QV-ready set of active objects
extern HANDLE QV_win32Event_; // Win32 event to signal events extern HANDLE QV_win32Event_; // Win32 event to signal events
// Windows "fudge factor" for oversizing the resources, see NOTE2
enum {
QF_WIN32_FUDGE_FACTOR = 100
};
} // namespace QP } // namespace QP
#endif // QP_IMPL #endif // QP_IMPL
@ -225,24 +215,5 @@ void QF_onClockTick(void);
// Scheduler locking (used inside QF_publish_()) is not needed in the single- // Scheduler locking (used inside QF_publish_()) is not needed in the single-
// threaded Win32-QV port, because event multicasting is already atomic. // threaded Win32-QV port, because event multicasting is already atomic.
// //
// NOTE3:
// Windows is not a deterministic real-time system, which means that the
// system can occasionally and unexpectedly "choke and freeze" for a number
// of seconds. The designers of Windows have dealt with these sort of issues
// by massively oversizing the resources available to the applications. For
// example, the default Windows GUI message queues size is 10,000 entries,
// which can dynamically grow to an even larger number. Also the stacks of
// Win32 threads can dynamically grow to several megabytes.
//
// In contrast, the event queues, event pools, and stack size inside the
// real-time embedded (RTE) systems can be (and must be) much smaller,
// because you typically can put an upper bound on the real-time behavior
// and the resulting delays.
//
// To be able to run the unmodified applications designed originally for
// RTE systems on Windows, and to reduce the odds of resource shortages in
// this case, the generous QF_WIN32_FUDGE_FACTOR is used to oversize the
// event queues and event pools.
//
#endif // qf_port_h #endif // qf_port_h

Binary file not shown.

View File

@ -2,14 +2,14 @@
/// \brief QF/C++ port to Win32 API /// \brief QF/C++ port to Win32 API
/// \cond /// \cond
///*************************************************************************** ///***************************************************************************
/// Last updated for version 5.6.2 /// Last updated for version 5.7.5
/// Last updated on 2016-01-22 /// Last updated on 2016-11-08
/// ///
/// Q u a n t u m L e a P s /// Q u a n t u m L e a P s
/// --------------------------- /// ---------------------------
/// innovating embedded systems /// innovating embedded systems
/// ///
/// Copyright (C) Quantum Leaps, www.state-machine.com. /// Copyright (C) Quantum Leaps, LLC. All rights reserved.
/// ///
/// This program is open source software: you can redistribute it and/or /// This program is open source software: you can redistribute it and/or
/// modify it under the terms of the GNU General Public License as published /// modify it under the terms of the GNU General Public License as published
@ -94,7 +94,6 @@ void QF::thread_(QMActive *act) {
act->unsubscribeAll(); // make sure that no events are subscribed act->unsubscribeAll(); // make sure that no events are subscribed
QF::remove_(act); // remove this object from any subscriptions QF::remove_(act); // remove this object from any subscriptions
CloseHandle(act->m_osObject); // cleanup the OS event CloseHandle(act->m_osObject); // cleanup the OS event
delete[] act->m_eQueue.m_ring; // free the fudged queue storage
} }
//**************************************************************************** //****************************************************************************
// helper function to match the signature expeced by CreateThread() Win32 API // helper function to match the signature expeced by CreateThread() Win32 API
@ -122,7 +121,6 @@ int_t QF::run(void) {
onCleanup(); // cleanup callback onCleanup(); // cleanup callback
QS_EXIT(); // cleanup the QSPY connection QS_EXIT(); // cleanup the QSPY connection
//DeleteCriticalSection(&l_win32CritSect); //DeleteCriticalSection(&l_win32CritSect);
//free all "fudged" event pools...
return static_cast<int_t>(0); // return success return static_cast<int_t>(0); // return success
} }
//**************************************************************************** //****************************************************************************
@ -154,25 +152,14 @@ void QMActive::start(uint_fast8_t prio,
m_prio = prio; // set the QF priority of this AO m_prio = prio; // set the QF priority of this AO
QF::add_(this); // make QF aware of this AO QF::add_(this); // make QF aware of this AO
// ignore the original storage for the event queue 'qSto' and m_eQueue.init(qSto, qLen);
// instead allocate an oversized "fudged" storage for the queue.
// See also NOTE2 in qf_port.h.
//
Q_ASSERT_ID(710, static_cast<uint32_t>(qLen) * QF_WIN32_FUDGE_FACTOR
< USHRT_MAX);
// fudge the queue length
uint_fast16_t fudgedQLen = qLen * QF_WIN32_FUDGE_FACTOR;
QEvt const **fudgedQSto = new QEvt const *[fudgedQLen]; // fudged queue storage
// allocation must succeed
Q_ASSERT_ID(720, fudgedQSto != static_cast<QEvt const * *>(0));
m_eQueue.init(fudgedQSto, fudgedQLen);
// save osObject as integer, in case it contains the Win32 priority // save osObject as integer, in case it contains the Win32 priority
int win32Prio = (m_osObject != static_cast<void *>(0)) int win32Prio = (m_osObject != static_cast<void *>(0))
? reinterpret_cast<int>(m_osObject) ? reinterpret_cast<int>(m_osObject)
: THREAD_PRIORITY_NORMAL; : THREAD_PRIORITY_NORMAL;
/* create the Win32 "event" to throttle the AO's event queue */ // create the Win32 "event" to throttle the AO's event queue
m_osObject = CreateEvent(NULL, FALSE, FALSE, NULL); m_osObject = CreateEvent(NULL, FALSE, FALSE, NULL);
this->init(ie); // execute initial transition (virtual call) this->init(ie); // execute initial transition (virtual call)
@ -182,10 +169,16 @@ void QMActive::start(uint_fast8_t prio,
if (stkSize == 0U) { if (stkSize == 0U) {
stkSize = 1024U; // NOTE: will be rounded up to the nearest page stkSize = 1024U; // NOTE: will be rounded up to the nearest page
} }
m_thread = CreateThread(NULL, stkSize, &ao_thread, this, 0, NULL);
Q_ASSERT_ID(730, m_thread != NULL); // thread must be created
SetThreadPriority(m_thread, win32Prio); // create a Win32 thread for the AO;
// The thread is created with THREAD_PRIORITY_NORMAL
m_thread = CreateThread(NULL, stkSize, &ao_thread, this, 0, NULL);
Q_ASSERT_ID(730, m_thread != static_cast<HANDLE>(0)); // must succeed
// was the thread priority provided?
if (win32Prio != 0) {
SetThreadPriority(m_thread, win32Prio);
}
} }
//**************************************************************************** //****************************************************************************
void QMActive::stop(void) { void QMActive::stop(void) {

View File

@ -2,8 +2,8 @@
/// \brief QF/C++ port to Win32 API /// \brief QF/C++ port to Win32 API
/// \cond /// \cond
///*************************************************************************** ///***************************************************************************
/// Last updated for version 5.7.2 /// Last updated for version 5.7.5
/// Last updated on 2016-09-28 /// Last updated on 2016-11-08
/// ///
/// Q u a n t u m L e a P s /// Q u a n t u m L e a P s
/// --------------------------- /// ---------------------------
@ -172,13 +172,8 @@ void QF_onClockTick(void);
// Win32-specific event pool operations // Win32-specific event pool operations
#define QF_EPOOL_TYPE_ QMPool #define QF_EPOOL_TYPE_ QMPool
#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) do { \ #define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \
uint_fast32_t fudgedSize = (poolSize_) * QF_WIN32_FUDGE_FACTOR; \ (p_).init((poolSto_), (poolSize_), (evtSize_))
uint8_t *fudgedSto = new uint8_t[(poolSize_)*QF_WIN32_FUDGE_FACTOR]; \
Q_ASSERT_ID(210, fudgedSto != (uint8_t *)0); \
(void)(poolSto_); \
(p_).init(fudgedSto, fudgedSize, evtSize_); \
} while (false)
#define QF_EPOOL_EVENT_SIZE_(p_) ((p_).getBlockSize()) #define QF_EPOOL_EVENT_SIZE_(p_) ((p_).getBlockSize())
#define QF_EPOOL_GET_(p_, e_, m_) \ #define QF_EPOOL_GET_(p_, e_, m_) \
@ -188,13 +183,6 @@ void QF_onClockTick(void);
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> // Win32 API #include <windows.h> // Win32 API
namespace QP {
// Windows "fudge factor" for oversizing the resources, see NOTE2
enum {
QF_WIN32_FUDGE_FACTOR = 100
};
} // namespace QP
#endif // QP_IMPL #endif // QP_IMPL
// NOTES: ==================================================================== // NOTES: ====================================================================
@ -233,24 +221,5 @@ void QF_onClockTick(void);
// will appear atomic, in the sense that no thread will be able to post // will appear atomic, in the sense that no thread will be able to post
// events during multicasting. // events during multicasting.
// //
// NOTE3:
// Windows is not a deterministic real-time system, which means that the
// system can occasionally and unexpectedly "choke and freeze" for a number
// of seconds. The designers of Windows have dealt with these sort of issues
// by massively oversizing the resources available to the applications. For
// example, the default Windows GUI message queues size is 10,000 entries,
// which can dynamically grow to an even larger number. Also the stacks of
// Win32 threads can dynamically grow to several megabytes.
//
// In contrast, the event queues, event pools, and stack size inside the
// real-time embedded (RTE) systems can be (and must be) much smaller,
// because you typically can put an upper bound on the real-time behavior
// and the resulting delays.
//
// To be able to run the unmodified applications designed originally for
// RTE systems on Windows, and to reduce the odds of resource shortages in
// this case, the generous QF_WIN32_FUDGE_FACTOR is used to oversize the
// event queues and event pools.
//
#endif // qf_port_h #endif // qf_port_h