mirror of
https://github.com/QuantumLeaps/qpc.git
synced 2025-01-14 06:43:19 +08:00
6.9.3
Corrected comments in QView examples (dpp.py and dpp1.py)
This commit is contained in:
parent
cbf328b511
commit
d51d8c511b
@ -37,6 +37,7 @@
|
||||
@echo usage:
|
||||
@echo make
|
||||
@echo make -CHM
|
||||
@echo make -DOC
|
||||
|
||||
:: Doxygen tool (adjust to your system) ......................................
|
||||
@set DOXYGEN=doxygen
|
||||
@ -54,7 +55,7 @@
|
||||
@echo /** @page metrics Code Metrics > %METRICS_OUT%
|
||||
@echo.>> %METRICS_OUT%
|
||||
@echo @code{cpp} >> %METRICS_OUT%
|
||||
@echo Code Metrics for QP/C >> %METRICS_OUT%
|
||||
@echo Code Metrics >> %METRICS_OUT%
|
||||
|
||||
%LIZARD% -m -L500 -a10 -C20 -V %METRICS_INP% >> %METRICS_OUT%
|
||||
|
||||
@ -90,7 +91,7 @@ if "%1"=="-CHM" (
|
||||
copy images\favicon.ico ..\html
|
||||
|
||||
@echo Generating HTML...
|
||||
%DOXYGEN% Doxyfile
|
||||
%DOXYGEN% Doxyfile%1
|
||||
@qclean ..\html
|
||||
)
|
||||
|
||||
|
@ -6,8 +6,12 @@
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the application-specific
|
||||
# packet QS_USER_00 (PHILO_STAT) produced when the status of a Philo changes.
|
||||
# trace record QS_USER_00 (PHILO_STAT) produced when the status of
|
||||
# a Philo changes.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -47,7 +51,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback
|
||||
def on_reset(self):
|
||||
@ -83,10 +92,10 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_USER_00 application-specific packet
|
||||
# this packet has the following structure (see bsp.c:displayPhilStat()):
|
||||
# record-ID, seq-num, Timestamp, format-byte, Philo-num,
|
||||
# format-bye, Zero-terminated string (status)
|
||||
# Intercept the QS_USER_00 application-specific trace record.
|
||||
# This record has the following structure (see bsp.c:displayPhilStat()):
|
||||
# Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
|
||||
# format-byte, Zero-terminated string (status)
|
||||
def QS_USER_00(self, packet):
|
||||
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
|
||||
data = qunpack("xxTxBxZ", packet)
|
||||
|
@ -5,13 +5,16 @@
|
||||
# A second click on the button, "un-pauses" the DPP ("forks" are served
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY
|
||||
# packet, which provides information about the current states of the dining
|
||||
# Philosophers. The example also demonstrates how to intercept the QS
|
||||
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information
|
||||
# about the addresses of the Philosopher objects and the states of their
|
||||
# state machines.
|
||||
# This version of the DPP customization uses the predefined QS_QEP_TRAN
|
||||
# trace record, which provides information about the state transitions of
|
||||
# the Dining Philosophers. The example also demonstrates how to intercept
|
||||
# the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
|
||||
# information about the addresses of the Philosopher objects and the states
|
||||
# of their state machines.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -51,7 +54,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback invoked when Target-reset packet is received
|
||||
# NOTE: the QS dictionaries are not known at this time yet, so
|
||||
@ -91,9 +99,9 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_OBJ_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Object-ptr, Zero-terminated string
|
||||
# Intercept the QS_OBJ_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Object-ptr, Zero-terminated string
|
||||
def QS_OBJ_DICT(self, packet):
|
||||
data = qunpack("xxOZ", packet)
|
||||
try:
|
||||
@ -108,9 +116,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different object
|
||||
|
||||
# intercept the QS_FUN_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Function-ptr, Zero-terminated string
|
||||
# Intercept the QS_FUN_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Function-ptr, Zero-terminated string
|
||||
def QS_FUN_DICT(self, packet):
|
||||
data = qunpack("xxFZ", packet)
|
||||
try:
|
||||
@ -123,9 +131,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different state
|
||||
|
||||
# intercept the QS_QEP_TRAN stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Timestamp, Signal, Object-ptr,
|
||||
# Intercept the QS_QEP_TRAN predefined trace record.
|
||||
# This record has the following structure (see qep_hsm.c):
|
||||
# Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
|
||||
# Function-ptr (source state), Function-ptr (new active state)
|
||||
def QS_QEP_TRAN(self, packet):
|
||||
data = qunpack("xxTSOFF", packet)
|
||||
|
@ -6,8 +6,12 @@
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the application-specific
|
||||
# packet QS_USER_00 (PHILO_STAT) produced when the status of a Philo changes.
|
||||
# trace record QS_USER_00 (PHILO_STAT) produced when the status of
|
||||
# a Philo changes.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -47,7 +51,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback
|
||||
def on_reset(self):
|
||||
@ -83,10 +92,10 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_USER_00 application-specific packet
|
||||
# this packet has the following structure (see bsp.c:displayPhilStat()):
|
||||
# record-ID, seq-num, Timestamp, format-byte, Philo-num,
|
||||
# format-bye, Zero-terminated string (status)
|
||||
# Intercept the QS_USER_00 application-specific trace record.
|
||||
# This record has the following structure (see bsp.c:displayPhilStat()):
|
||||
# Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
|
||||
# format-byte, Zero-terminated string (status)
|
||||
def QS_USER_00(self, packet):
|
||||
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
|
||||
data = qunpack("xxTxBxZ", packet)
|
||||
|
@ -5,13 +5,16 @@
|
||||
# A second click on the button, "un-pauses" the DPP ("forks" are served
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY
|
||||
# packet, which provides information about the current states of the dining
|
||||
# Philosophers. The example also demonstrates how to intercept the QS
|
||||
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information
|
||||
# about the addresses of the Philosopher objects and the states of their
|
||||
# state machines.
|
||||
# This version of the DPP customization uses the predefined QS_QEP_TRAN
|
||||
# trace record, which provides information about the state transitions of
|
||||
# the Dining Philosophers. The example also demonstrates how to intercept
|
||||
# the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
|
||||
# information about the addresses of the Philosopher objects and the states
|
||||
# of their state machines.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -51,7 +54,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback invoked when Target-reset packet is received
|
||||
# NOTE: the QS dictionaries are not known at this time yet, so
|
||||
@ -91,9 +99,9 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_OBJ_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Object-ptr, Zero-terminated string
|
||||
# Intercept the QS_OBJ_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Object-ptr, Zero-terminated string
|
||||
def QS_OBJ_DICT(self, packet):
|
||||
data = qunpack("xxOZ", packet)
|
||||
try:
|
||||
@ -108,9 +116,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different object
|
||||
|
||||
# intercept the QS_FUN_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Function-ptr, Zero-terminated string
|
||||
# Intercept the QS_FUN_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Function-ptr, Zero-terminated string
|
||||
def QS_FUN_DICT(self, packet):
|
||||
data = qunpack("xxFZ", packet)
|
||||
try:
|
||||
@ -123,9 +131,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different state
|
||||
|
||||
# intercept the QS_QEP_TRAN stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Timestamp, Signal, Object-ptr,
|
||||
# Intercept the QS_QEP_TRAN predefined trace record.
|
||||
# This record has the following structure (see qep_hsm.c):
|
||||
# Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
|
||||
# Function-ptr (source state), Function-ptr (new active state)
|
||||
def QS_QEP_TRAN(self, packet):
|
||||
data = qunpack("xxTSOFF", packet)
|
||||
|
@ -6,8 +6,12 @@
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the application-specific
|
||||
# packet QS_USER_00 (PHILO_STAT) produced when the status of a Philo changes.
|
||||
# trace record QS_USER_00 (PHILO_STAT) produced when the status of
|
||||
# a Philo changes.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -47,7 +51,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback
|
||||
def on_reset(self):
|
||||
@ -83,10 +92,10 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_USER_00 application-specific packet
|
||||
# this packet has the following structure (see bsp.c:displayPhilStat()):
|
||||
# record-ID, seq-num, Timestamp, format-byte, Philo-num,
|
||||
# format-bye, Zero-terminated string (status)
|
||||
# Intercept the QS_USER_00 application-specific trace record.
|
||||
# This record has the following structure (see bsp.c:displayPhilStat()):
|
||||
# Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
|
||||
# format-byte, Zero-terminated string (status)
|
||||
def QS_USER_00(self, packet):
|
||||
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
|
||||
data = qunpack("xxTxBxZ", packet)
|
||||
|
@ -5,13 +5,16 @@
|
||||
# A second click on the button, "un-pauses" the DPP ("forks" are served
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY
|
||||
# packet, which provides information about the current states of the dining
|
||||
# Philosophers. The example also demonstrates how to intercept the QS
|
||||
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information
|
||||
# about the addresses of the Philosopher objects and the states of their
|
||||
# state machines.
|
||||
# This version of the DPP customization uses the predefined QS_QEP_TRAN
|
||||
# trace record, which provides information about the state transitions of
|
||||
# the Dining Philosophers. The example also demonstrates how to intercept
|
||||
# the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
|
||||
# information about the addresses of the Philosopher objects and the states
|
||||
# of their state machines.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -51,7 +54,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback invoked when Target-reset packet is received
|
||||
# NOTE: the QS dictionaries are not known at this time yet, so
|
||||
@ -91,9 +99,9 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_OBJ_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Object-ptr, Zero-terminated string
|
||||
# Intercept the QS_OBJ_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Object-ptr, Zero-terminated string
|
||||
def QS_OBJ_DICT(self, packet):
|
||||
data = qunpack("xxOZ", packet)
|
||||
try:
|
||||
@ -108,9 +116,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different object
|
||||
|
||||
# intercept the QS_FUN_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Function-ptr, Zero-terminated string
|
||||
# Intercept the QS_FUN_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Function-ptr, Zero-terminated string
|
||||
def QS_FUN_DICT(self, packet):
|
||||
data = qunpack("xxFZ", packet)
|
||||
try:
|
||||
@ -123,9 +131,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different state
|
||||
|
||||
# intercept the QS_QEP_TRAN stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Timestamp, Signal, Object-ptr,
|
||||
# Intercept the QS_QEP_TRAN predefined trace record.
|
||||
# This record has the following structure (see qep_hsm.c):
|
||||
# Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
|
||||
# Function-ptr (source state), Function-ptr (new active state)
|
||||
def QS_QEP_TRAN(self, packet):
|
||||
data = qunpack("xxTSOFF", packet)
|
||||
|
@ -6,8 +6,12 @@
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the application-specific
|
||||
# packet QS_USER_00 (PHILO_STAT) produced when the status of a Philo changes.
|
||||
# trace record QS_USER_00 (PHILO_STAT) produced when the status of
|
||||
# a Philo changes.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -47,7 +51,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback
|
||||
def on_reset(self):
|
||||
@ -83,10 +92,10 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_USER_00 application-specific packet
|
||||
# this packet has the following structure (see bsp.c:displayPhilStat()):
|
||||
# record-ID, seq-num, Timestamp, format-byte, Philo-num,
|
||||
# format-bye, Zero-terminated string (status)
|
||||
# Intercept the QS_USER_00 application-specific trace record.
|
||||
# This record has the following structure (see bsp.c:displayPhilStat()):
|
||||
# Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
|
||||
# format-byte, Zero-terminated string (status)
|
||||
def QS_USER_00(self, packet):
|
||||
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
|
||||
data = qunpack("xxTxBxZ", packet)
|
||||
|
@ -5,13 +5,16 @@
|
||||
# A second click on the button, "un-pauses" the DPP ("forks" are served
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY
|
||||
# packet, which provides information about the current states of the dining
|
||||
# Philosophers. The example also demonstrates how to intercept the QS
|
||||
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information
|
||||
# about the addresses of the Philosopher objects and the states of their
|
||||
# state machines.
|
||||
# This version of the DPP customization uses the predefined QS_QEP_TRAN
|
||||
# trace record, which provides information about the state transitions of
|
||||
# the Dining Philosophers. The example also demonstrates how to intercept
|
||||
# the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
|
||||
# information about the addresses of the Philosopher objects and the states
|
||||
# of their state machines.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -51,7 +54,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback invoked when Target-reset packet is received
|
||||
# NOTE: the QS dictionaries are not known at this time yet, so
|
||||
@ -91,9 +99,9 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_OBJ_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Object-ptr, Zero-terminated string
|
||||
# Intercept the QS_OBJ_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Object-ptr, Zero-terminated string
|
||||
def QS_OBJ_DICT(self, packet):
|
||||
data = qunpack("xxOZ", packet)
|
||||
try:
|
||||
@ -108,9 +116,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different object
|
||||
|
||||
# intercept the QS_FUN_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Function-ptr, Zero-terminated string
|
||||
# Intercept the QS_FUN_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Function-ptr, Zero-terminated string
|
||||
def QS_FUN_DICT(self, packet):
|
||||
data = qunpack("xxFZ", packet)
|
||||
try:
|
||||
@ -123,9 +131,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different state
|
||||
|
||||
# intercept the QS_QEP_TRAN stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Timestamp, Signal, Object-ptr,
|
||||
# Intercept the QS_QEP_TRAN predefined trace record.
|
||||
# This record has the following structure (see qep_hsm.c):
|
||||
# Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
|
||||
# Function-ptr (source state), Function-ptr (new active state)
|
||||
def QS_QEP_TRAN(self, packet):
|
||||
data = qunpack("xxTSOFF", packet)
|
||||
|
@ -6,8 +6,12 @@
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the application-specific
|
||||
# packet QS_USER_00 (PHILO_STAT) produced when the status of a Philo changes.
|
||||
# trace record QS_USER_00 (PHILO_STAT) produced when the status of
|
||||
# a Philo changes.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -47,7 +51,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback
|
||||
def on_reset(self):
|
||||
@ -83,10 +92,10 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_USER_00 application-specific packet
|
||||
# this packet has the following structure (see bsp.c:displayPhilStat()):
|
||||
# record-ID, seq-num, Timestamp, format-byte, Philo-num,
|
||||
# format-bye, Zero-terminated string (status)
|
||||
# Intercept the QS_USER_00 application-specific trace record.
|
||||
# This record has the following structure (see bsp.c:displayPhilStat()):
|
||||
# Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
|
||||
# format-byte, Zero-terminated string (status)
|
||||
def QS_USER_00(self, packet):
|
||||
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
|
||||
data = qunpack("xxTxBxZ", packet)
|
||||
|
@ -5,13 +5,16 @@
|
||||
# A second click on the button, "un-pauses" the DPP ("forks" are served
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY
|
||||
# packet, which provides information about the current states of the dining
|
||||
# Philosophers. The example also demonstrates how to intercept the QS
|
||||
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information
|
||||
# about the addresses of the Philosopher objects and the states of their
|
||||
# state machines.
|
||||
# This version of the DPP customization uses the predefined QS_QEP_TRAN
|
||||
# trace record, which provides information about the state transitions of
|
||||
# the Dining Philosophers. The example also demonstrates how to intercept
|
||||
# the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
|
||||
# information about the addresses of the Philosopher objects and the states
|
||||
# of their state machines.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -51,7 +54,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback invoked when Target-reset packet is received
|
||||
# NOTE: the QS dictionaries are not known at this time yet, so
|
||||
@ -91,9 +99,9 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_OBJ_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Object-ptr, Zero-terminated string
|
||||
# Intercept the QS_OBJ_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Object-ptr, Zero-terminated string
|
||||
def QS_OBJ_DICT(self, packet):
|
||||
data = qunpack("xxOZ", packet)
|
||||
try:
|
||||
@ -108,9 +116,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different object
|
||||
|
||||
# intercept the QS_FUN_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Function-ptr, Zero-terminated string
|
||||
# Intercept the QS_FUN_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Function-ptr, Zero-terminated string
|
||||
def QS_FUN_DICT(self, packet):
|
||||
data = qunpack("xxFZ", packet)
|
||||
try:
|
||||
@ -123,9 +131,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different state
|
||||
|
||||
# intercept the QS_QEP_TRAN stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Timestamp, Signal, Object-ptr,
|
||||
# Intercept the QS_QEP_TRAN predefined trace record.
|
||||
# This record has the following structure (see qep_hsm.c):
|
||||
# Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
|
||||
# Function-ptr (source state), Function-ptr (new active state)
|
||||
def QS_QEP_TRAN(self, packet):
|
||||
data = qunpack("xxTSOFF", packet)
|
||||
|
@ -6,8 +6,12 @@
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the application-specific
|
||||
# packet QS_USER_00 (PHILO_STAT) produced when the status of a Philo changes.
|
||||
# trace record QS_USER_00 (PHILO_STAT) produced when the status of
|
||||
# a Philo changes.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -47,7 +51,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback
|
||||
def on_reset(self):
|
||||
@ -83,10 +92,10 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_USER_00 application-specific packet
|
||||
# this packet has the following structure (see bsp.c:displayPhilStat()):
|
||||
# record-ID, seq-num, Timestamp, format-byte, Philo-num,
|
||||
# format-bye, Zero-terminated string (status)
|
||||
# Intercept the QS_USER_00 application-specific trace record.
|
||||
# This record has the following structure (see bsp.c:displayPhilStat()):
|
||||
# Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
|
||||
# format-byte, Zero-terminated string (status)
|
||||
def QS_USER_00(self, packet):
|
||||
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
|
||||
data = qunpack("xxTxBxZ", packet)
|
||||
|
@ -5,13 +5,16 @@
|
||||
# A second click on the button, "un-pauses" the DPP ("forks" are served
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY
|
||||
# packet, which provides information about the current states of the dining
|
||||
# Philosophers. The example also demonstrates how to intercept the QS
|
||||
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information
|
||||
# about the addresses of the Philosopher objects and the states of their
|
||||
# state machines.
|
||||
# This version of the DPP customization uses the predefined QS_QEP_TRAN
|
||||
# trace record, which provides information about the state transitions of
|
||||
# the Dining Philosophers. The example also demonstrates how to intercept
|
||||
# the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
|
||||
# information about the addresses of the Philosopher objects and the states
|
||||
# of their state machines.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -51,7 +54,12 @@ class DPP:
|
||||
# NOTE: Normally, for an embedded application you would like
|
||||
# to start with resetting the Target, to start clean with
|
||||
# Qs dictionaries, etc.
|
||||
reset_target()
|
||||
#
|
||||
# Howver, this is a desktop appliction, which you cannot reset
|
||||
# (and restart). Therefore, the desktop applications must be started
|
||||
# *after* the QView is already running.
|
||||
#reset_target()
|
||||
|
||||
|
||||
# on_reset() callback invoked when Target-reset packet is received
|
||||
# NOTE: the QS dictionaries are not known at this time yet, so
|
||||
@ -91,9 +99,9 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_OBJ_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Object-ptr, Zero-terminated string
|
||||
# Intercept the QS_OBJ_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Object-ptr, Zero-terminated string
|
||||
def QS_OBJ_DICT(self, packet):
|
||||
data = qunpack("xxOZ", packet)
|
||||
try:
|
||||
@ -108,9 +116,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different object
|
||||
|
||||
# intercept the QS_FUN_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Function-ptr, Zero-terminated string
|
||||
# Intercept the QS_FUN_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Function-ptr, Zero-terminated string
|
||||
def QS_FUN_DICT(self, packet):
|
||||
data = qunpack("xxFZ", packet)
|
||||
try:
|
||||
@ -123,9 +131,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different state
|
||||
|
||||
# intercept the QS_QEP_TRAN stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Timestamp, Signal, Object-ptr,
|
||||
# Intercept the QS_QEP_TRAN predefined trace record.
|
||||
# This record has the following structure (see qep_hsm.c):
|
||||
# Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
|
||||
# Function-ptr (source state), Function-ptr (new active state)
|
||||
def QS_QEP_TRAN(self, packet):
|
||||
data = qunpack("xxTSOFF", packet)
|
||||
|
@ -1,7 +1,7 @@
|
||||
##############################################################################
|
||||
# Product: Makefile for QUTEST; QP/C on POSIX *Target*
|
||||
# Last updated for version 6.8.2
|
||||
# Last updated on 2020-06-23
|
||||
# Last updated for version 6.8.3
|
||||
# Last updated on 2021-04-16
|
||||
#
|
||||
# Q u a n t u m L e a P s
|
||||
# ------------------------
|
||||
@ -144,7 +144,7 @@ RM := rm -f
|
||||
#-----------------------------------------------------------------------------
|
||||
# build options...
|
||||
|
||||
BIN_DIR := build_$(TARGET
|
||||
BIN_DIR := build_posix
|
||||
|
||||
CFLAGS = -c -g -O -Wall -Wstrict-prototypes -W $(INCLUDES) $(DEFINES) \
|
||||
-DQ_SPY -DQ_UTEST -DQ_HOST
|
||||
@ -218,6 +218,8 @@ ifneq ($(MAKECMDGOALS),clean)
|
||||
endif
|
||||
endif
|
||||
|
||||
test :
|
||||
$(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST)
|
||||
clean :
|
||||
-$(RM) $(BIN_DIR)/*.o \
|
||||
$(BIN_DIR)/*.d \
|
||||
|
@ -1,7 +1,7 @@
|
||||
##############################################################################
|
||||
# Product: Makefile for QUTEST; QP/C on POSIX *Target*
|
||||
# Last updated for version 6.8.2
|
||||
# Last updated on 2020-06-23
|
||||
# Last updated for version 6.8.3
|
||||
# Last updated on 2021-04-16
|
||||
#
|
||||
# Q u a n t u m L e a P s
|
||||
# ------------------------
|
||||
@ -140,7 +140,7 @@ RM := rm -f
|
||||
#-----------------------------------------------------------------------------
|
||||
# build options...
|
||||
|
||||
BIN_DIR := build_$(TARGET
|
||||
BIN_DIR := build_posix
|
||||
|
||||
CFLAGS = -c -g -O -Wall -Wstrict-prototypes -W $(INCLUDES) $(DEFINES) \
|
||||
-DQ_SPY -DQ_UTEST -DQ_HOST
|
||||
|
22
examples/qutest/self_test/test/test_lact-rec.py
Normal file
22
examples/qutest/self_test/test/test_lact-rec.py
Normal file
@ -0,0 +1,22 @@
|
||||
# test-script for QUTest unit testing harness
|
||||
# see https://www.state-machine.com/qtools/qutest.html
|
||||
|
||||
include("test_include.pyi")
|
||||
|
||||
def print_params():
|
||||
global p1, p2, p3
|
||||
print("params:", p1, p2, p3, p4)
|
||||
|
||||
# tests...
|
||||
test("Last-record")
|
||||
command("COMMAND_B", 123, 23456, 3456789)
|
||||
expect("@timestamp COMMAND_B *")
|
||||
last = last_rec().split()
|
||||
p1 = int(last[2])
|
||||
s1 = last[3]
|
||||
p2 = int(last[4])
|
||||
s2 = last[5]
|
||||
p3 = int(last[6])
|
||||
p4 = float(last[7])
|
||||
print_params()
|
||||
expect("@timestamp Trg-Done QS_RX_COMMAND")
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* Purpose: Fixture for QUTEST self-test
|
||||
* Last Updated for Version: 6.9.2a
|
||||
* Date of the Last Update: 2021-01-28
|
||||
* Last Updated for Version: 6.9.3
|
||||
* Date of the Last Update: 2021-05-31
|
||||
*
|
||||
* Q u a n t u m L e a P s
|
||||
* ------------------------
|
||||
@ -43,6 +43,7 @@ enum {
|
||||
FIXTURE_SETUP = QS_USER,
|
||||
FIXTURE_TEARDOWN,
|
||||
COMMAND_A,
|
||||
COMMAND_B,
|
||||
COMMAND_X,
|
||||
COMMAND_Y,
|
||||
COMMAND_Z,
|
||||
@ -67,6 +68,7 @@ int main(int argc, char *argv[]) {
|
||||
QS_USR_DICTIONARY(FIXTURE_SETUP);
|
||||
QS_USR_DICTIONARY(FIXTURE_TEARDOWN);
|
||||
QS_USR_DICTIONARY(COMMAND_A);
|
||||
QS_USR_DICTIONARY(COMMAND_B);
|
||||
QS_USR_DICTIONARY(COMMAND_X);
|
||||
QS_USR_DICTIONARY(COMMAND_Y);
|
||||
QS_USR_DICTIONARY(COMMAND_Z);
|
||||
@ -103,6 +105,17 @@ void QS_onCommand(uint8_t cmdId,
|
||||
QS_END()
|
||||
break;
|
||||
}
|
||||
case COMMAND_B: {
|
||||
QS_BEGIN_ID(COMMAND_B, 0U) /* app-specific record */
|
||||
QS_U8(0, param1);
|
||||
QS_STR("BAR");
|
||||
QS_U16(0, param2);
|
||||
QS_STR("FOO");
|
||||
QS_U32(0, param3);
|
||||
QS_F64(param1, -6.02214076E23);
|
||||
QS_END()
|
||||
break;
|
||||
}
|
||||
case COMMAND_X: {
|
||||
uint32_t x = myFun();
|
||||
QS_BEGIN_ID(COMMAND_X, 0U) /* app-specific record */
|
||||
|
@ -6,8 +6,12 @@
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the application-specific
|
||||
# packet QS_USER_00 (PHILO_STAT) produced when the status of a Philo changes.
|
||||
# trace record QS_USER_00 (PHILO_STAT) produced when the status of
|
||||
# a Philo changes.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -88,10 +92,10 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_USER_00 application-specific packet
|
||||
# this packet has the following structure (see bsp.c:displayPhilStat()):
|
||||
# record-ID, seq-num, Timestamp, format-byte, Philo-num,
|
||||
# format-bye, Zero-terminated string (status)
|
||||
# Intercept the QS_USER_00 application-specific trace record.
|
||||
# This record has the following structure (see bsp.c:displayPhilStat()):
|
||||
# Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
|
||||
# format-byte, Zero-terminated string (status)
|
||||
def QS_USER_00(self, packet):
|
||||
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
|
||||
data = qunpack("xxTxBxZ", packet)
|
||||
|
@ -5,13 +5,16 @@
|
||||
# A second click on the button, "un-pauses" the DPP ("forks" are served
|
||||
# to all hungry Philosophers).
|
||||
#
|
||||
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY
|
||||
# packet, which provides information about the current states of the dining
|
||||
# Philosophers. The example also demonstrates how to intercept the QS
|
||||
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information
|
||||
# about the addresses of the Philosopher objects and the states of their
|
||||
# state machines.
|
||||
# This version of the DPP customization uses the predefined QS_QEP_TRAN
|
||||
# trace record, which provides information about the state transitions of
|
||||
# the Dining Philosophers. The example also demonstrates how to intercept
|
||||
# the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
|
||||
# information about the addresses of the Philosopher objects and the states
|
||||
# of their state machines.
|
||||
#
|
||||
# NOTE: this is a desktop appliction, which you cannot reset (and restarted).
|
||||
# Therefore, the desktop applications must be started *after* the QView is
|
||||
# already running and is attached to the QSPY host application.
|
||||
|
||||
class DPP:
|
||||
def __init__(self):
|
||||
@ -96,9 +99,9 @@ class DPP:
|
||||
post("PAUSE_SIG")
|
||||
QView.print_text("Table PAUSED")
|
||||
|
||||
# intercept the QS_OBJ_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Object-ptr, Zero-terminated string
|
||||
# Intercept the QS_OBJ_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Object-ptr, Zero-terminated string
|
||||
def QS_OBJ_DICT(self, packet):
|
||||
data = qunpack("xxOZ", packet)
|
||||
try:
|
||||
@ -113,9 +116,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different object
|
||||
|
||||
# intercept the QS_FUN_DICT stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Function-ptr, Zero-terminated string
|
||||
# Intercept the QS_FUN_DICT predefined trace record.
|
||||
# This record has the following structure:
|
||||
# Seq-Num, Record-ID, Function-ptr, Zero-terminated string
|
||||
def QS_FUN_DICT(self, packet):
|
||||
data = qunpack("xxFZ", packet)
|
||||
try:
|
||||
@ -128,9 +131,9 @@ class DPP:
|
||||
except:
|
||||
pass # dictionary for a different state
|
||||
|
||||
# intercept the QS_QEP_TRAN stadard packet
|
||||
# this packet has the following structure:
|
||||
# record-ID, seq-num, Timestamp, Signal, Object-ptr,
|
||||
# Intercept the QS_QEP_TRAN predefined trace record.
|
||||
# This record has the following structure (see qep_hsm.c):
|
||||
# Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
|
||||
# Function-ptr (source state), Function-ptr (new active state)
|
||||
def QS_QEP_TRAN(self, packet):
|
||||
data = qunpack("xxTSOFF", packet)
|
||||
|
Loading…
x
Reference in New Issue
Block a user