Corrected comments in QView examples (dpp.py and dpp1.py)
This commit is contained in:
MMS 2021-06-15 14:27:05 -04:00
parent cbf328b511
commit d51d8c511b
19 changed files with 309 additions and 162 deletions

View File

@ -37,6 +37,7 @@
@echo usage: @echo usage:
@echo make @echo make
@echo make -CHM @echo make -CHM
@echo make -DOC
:: Doxygen tool (adjust to your system) ...................................... :: Doxygen tool (adjust to your system) ......................................
@set DOXYGEN=doxygen @set DOXYGEN=doxygen
@ -54,7 +55,7 @@
@echo /** @page metrics Code Metrics > %METRICS_OUT% @echo /** @page metrics Code Metrics > %METRICS_OUT%
@echo.>> %METRICS_OUT% @echo.>> %METRICS_OUT%
@echo @code{cpp} >> %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% %LIZARD% -m -L500 -a10 -C20 -V %METRICS_INP% >> %METRICS_OUT%
@ -90,7 +91,7 @@ if "%1"=="-CHM" (
copy images\favicon.ico ..\html copy images\favicon.ico ..\html
@echo Generating HTML... @echo Generating HTML...
%DOXYGEN% Doxyfile %DOXYGEN% Doxyfile%1
@qclean ..\html @qclean ..\html
) )

View File

@ -6,8 +6,12 @@
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the application-specific # 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: class DPP:
def __init__(self): def __init__(self):
@ -47,7 +51,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback
def on_reset(self): def on_reset(self):
@ -83,10 +92,10 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_USER_00 application-specific packet # Intercept the QS_USER_00 application-specific trace record.
# this packet has the following structure (see bsp.c:displayPhilStat()): # This record has the following structure (see bsp.c:displayPhilStat()):
# record-ID, seq-num, Timestamp, format-byte, Philo-num, # Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
# format-bye, Zero-terminated string (status) # format-byte, Zero-terminated string (status)
def QS_USER_00(self, packet): def QS_USER_00(self, packet):
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3] # unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
data = qunpack("xxTxBxZ", packet) data = qunpack("xxTxBxZ", packet)

View File

@ -5,13 +5,16 @@
# A second click on the button, "un-pauses" the DPP ("forks" are served # A second click on the button, "un-pauses" the DPP ("forks" are served
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY # This version of the DPP customization uses the predefined QS_QEP_TRAN
# packet, which provides information about the current states of the dining # trace record, which provides information about the state transitions of
# Philosophers. The example also demonstrates how to intercept the QS # the Dining Philosophers. The example also demonstrates how to intercept
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information # the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
# about the addresses of the Philosopher objects and the states of their # information about the addresses of the Philosopher objects and the states
# state machines. # 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: class DPP:
def __init__(self): def __init__(self):
@ -51,7 +54,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback invoked when Target-reset packet is received
# NOTE: the QS dictionaries are not known at this time yet, so # NOTE: the QS dictionaries are not known at this time yet, so
@ -91,9 +99,9 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_OBJ_DICT stadard packet # Intercept the QS_OBJ_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Object-ptr, Zero-terminated string # Seq-Num, Record-ID, Object-ptr, Zero-terminated string
def QS_OBJ_DICT(self, packet): def QS_OBJ_DICT(self, packet):
data = qunpack("xxOZ", packet) data = qunpack("xxOZ", packet)
try: try:
@ -108,9 +116,9 @@ class DPP:
except: except:
pass # dictionary for a different object pass # dictionary for a different object
# intercept the QS_FUN_DICT stadard packet # Intercept the QS_FUN_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Function-ptr, Zero-terminated string # Seq-Num, Record-ID, Function-ptr, Zero-terminated string
def QS_FUN_DICT(self, packet): def QS_FUN_DICT(self, packet):
data = qunpack("xxFZ", packet) data = qunpack("xxFZ", packet)
try: try:
@ -123,9 +131,9 @@ class DPP:
except: except:
pass # dictionary for a different state pass # dictionary for a different state
# intercept the QS_QEP_TRAN stadard packet # Intercept the QS_QEP_TRAN predefined trace record.
# this packet has the following structure: # This record has the following structure (see qep_hsm.c):
# record-ID, seq-num, Timestamp, Signal, Object-ptr, # Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
# Function-ptr (source state), Function-ptr (new active state) # Function-ptr (source state), Function-ptr (new active state)
def QS_QEP_TRAN(self, packet): def QS_QEP_TRAN(self, packet):
data = qunpack("xxTSOFF", packet) data = qunpack("xxTSOFF", packet)

View File

@ -6,8 +6,12 @@
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the application-specific # 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: class DPP:
def __init__(self): def __init__(self):
@ -47,7 +51,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback
def on_reset(self): def on_reset(self):
@ -83,10 +92,10 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_USER_00 application-specific packet # Intercept the QS_USER_00 application-specific trace record.
# this packet has the following structure (see bsp.c:displayPhilStat()): # This record has the following structure (see bsp.c:displayPhilStat()):
# record-ID, seq-num, Timestamp, format-byte, Philo-num, # Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
# format-bye, Zero-terminated string (status) # format-byte, Zero-terminated string (status)
def QS_USER_00(self, packet): def QS_USER_00(self, packet):
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3] # unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
data = qunpack("xxTxBxZ", packet) data = qunpack("xxTxBxZ", packet)

View File

@ -5,13 +5,16 @@
# A second click on the button, "un-pauses" the DPP ("forks" are served # A second click on the button, "un-pauses" the DPP ("forks" are served
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY # This version of the DPP customization uses the predefined QS_QEP_TRAN
# packet, which provides information about the current states of the dining # trace record, which provides information about the state transitions of
# Philosophers. The example also demonstrates how to intercept the QS # the Dining Philosophers. The example also demonstrates how to intercept
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information # the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
# about the addresses of the Philosopher objects and the states of their # information about the addresses of the Philosopher objects and the states
# state machines. # 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: class DPP:
def __init__(self): def __init__(self):
@ -51,7 +54,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback invoked when Target-reset packet is received
# NOTE: the QS dictionaries are not known at this time yet, so # NOTE: the QS dictionaries are not known at this time yet, so
@ -91,9 +99,9 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_OBJ_DICT stadard packet # Intercept the QS_OBJ_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Object-ptr, Zero-terminated string # Seq-Num, Record-ID, Object-ptr, Zero-terminated string
def QS_OBJ_DICT(self, packet): def QS_OBJ_DICT(self, packet):
data = qunpack("xxOZ", packet) data = qunpack("xxOZ", packet)
try: try:
@ -108,9 +116,9 @@ class DPP:
except: except:
pass # dictionary for a different object pass # dictionary for a different object
# intercept the QS_FUN_DICT stadard packet # Intercept the QS_FUN_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Function-ptr, Zero-terminated string # Seq-Num, Record-ID, Function-ptr, Zero-terminated string
def QS_FUN_DICT(self, packet): def QS_FUN_DICT(self, packet):
data = qunpack("xxFZ", packet) data = qunpack("xxFZ", packet)
try: try:
@ -123,9 +131,9 @@ class DPP:
except: except:
pass # dictionary for a different state pass # dictionary for a different state
# intercept the QS_QEP_TRAN stadard packet # Intercept the QS_QEP_TRAN predefined trace record.
# this packet has the following structure: # This record has the following structure (see qep_hsm.c):
# record-ID, seq-num, Timestamp, Signal, Object-ptr, # Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
# Function-ptr (source state), Function-ptr (new active state) # Function-ptr (source state), Function-ptr (new active state)
def QS_QEP_TRAN(self, packet): def QS_QEP_TRAN(self, packet):
data = qunpack("xxTSOFF", packet) data = qunpack("xxTSOFF", packet)

View File

@ -6,8 +6,12 @@
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the application-specific # 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: class DPP:
def __init__(self): def __init__(self):
@ -47,7 +51,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback
def on_reset(self): def on_reset(self):
@ -83,10 +92,10 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_USER_00 application-specific packet # Intercept the QS_USER_00 application-specific trace record.
# this packet has the following structure (see bsp.c:displayPhilStat()): # This record has the following structure (see bsp.c:displayPhilStat()):
# record-ID, seq-num, Timestamp, format-byte, Philo-num, # Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
# format-bye, Zero-terminated string (status) # format-byte, Zero-terminated string (status)
def QS_USER_00(self, packet): def QS_USER_00(self, packet):
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3] # unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
data = qunpack("xxTxBxZ", packet) data = qunpack("xxTxBxZ", packet)

View File

@ -5,13 +5,16 @@
# A second click on the button, "un-pauses" the DPP ("forks" are served # A second click on the button, "un-pauses" the DPP ("forks" are served
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY # This version of the DPP customization uses the predefined QS_QEP_TRAN
# packet, which provides information about the current states of the dining # trace record, which provides information about the state transitions of
# Philosophers. The example also demonstrates how to intercept the QS # the Dining Philosophers. The example also demonstrates how to intercept
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information # the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
# about the addresses of the Philosopher objects and the states of their # information about the addresses of the Philosopher objects and the states
# state machines. # 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: class DPP:
def __init__(self): def __init__(self):
@ -51,7 +54,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback invoked when Target-reset packet is received
# NOTE: the QS dictionaries are not known at this time yet, so # NOTE: the QS dictionaries are not known at this time yet, so
@ -91,9 +99,9 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_OBJ_DICT stadard packet # Intercept the QS_OBJ_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Object-ptr, Zero-terminated string # Seq-Num, Record-ID, Object-ptr, Zero-terminated string
def QS_OBJ_DICT(self, packet): def QS_OBJ_DICT(self, packet):
data = qunpack("xxOZ", packet) data = qunpack("xxOZ", packet)
try: try:
@ -108,9 +116,9 @@ class DPP:
except: except:
pass # dictionary for a different object pass # dictionary for a different object
# intercept the QS_FUN_DICT stadard packet # Intercept the QS_FUN_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Function-ptr, Zero-terminated string # Seq-Num, Record-ID, Function-ptr, Zero-terminated string
def QS_FUN_DICT(self, packet): def QS_FUN_DICT(self, packet):
data = qunpack("xxFZ", packet) data = qunpack("xxFZ", packet)
try: try:
@ -123,9 +131,9 @@ class DPP:
except: except:
pass # dictionary for a different state pass # dictionary for a different state
# intercept the QS_QEP_TRAN stadard packet # Intercept the QS_QEP_TRAN predefined trace record.
# this packet has the following structure: # This record has the following structure (see qep_hsm.c):
# record-ID, seq-num, Timestamp, Signal, Object-ptr, # Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
# Function-ptr (source state), Function-ptr (new active state) # Function-ptr (source state), Function-ptr (new active state)
def QS_QEP_TRAN(self, packet): def QS_QEP_TRAN(self, packet):
data = qunpack("xxTSOFF", packet) data = qunpack("xxTSOFF", packet)

View File

@ -6,8 +6,12 @@
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the application-specific # 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: class DPP:
def __init__(self): def __init__(self):
@ -47,7 +51,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback
def on_reset(self): def on_reset(self):
@ -83,10 +92,10 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_USER_00 application-specific packet # Intercept the QS_USER_00 application-specific trace record.
# this packet has the following structure (see bsp.c:displayPhilStat()): # This record has the following structure (see bsp.c:displayPhilStat()):
# record-ID, seq-num, Timestamp, format-byte, Philo-num, # Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
# format-bye, Zero-terminated string (status) # format-byte, Zero-terminated string (status)
def QS_USER_00(self, packet): def QS_USER_00(self, packet):
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3] # unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
data = qunpack("xxTxBxZ", packet) data = qunpack("xxTxBxZ", packet)

View File

@ -5,13 +5,16 @@
# A second click on the button, "un-pauses" the DPP ("forks" are served # A second click on the button, "un-pauses" the DPP ("forks" are served
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY # This version of the DPP customization uses the predefined QS_QEP_TRAN
# packet, which provides information about the current states of the dining # trace record, which provides information about the state transitions of
# Philosophers. The example also demonstrates how to intercept the QS # the Dining Philosophers. The example also demonstrates how to intercept
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information # the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
# about the addresses of the Philosopher objects and the states of their # information about the addresses of the Philosopher objects and the states
# state machines. # 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: class DPP:
def __init__(self): def __init__(self):
@ -51,7 +54,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback invoked when Target-reset packet is received
# NOTE: the QS dictionaries are not known at this time yet, so # NOTE: the QS dictionaries are not known at this time yet, so
@ -91,9 +99,9 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_OBJ_DICT stadard packet # Intercept the QS_OBJ_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Object-ptr, Zero-terminated string # Seq-Num, Record-ID, Object-ptr, Zero-terminated string
def QS_OBJ_DICT(self, packet): def QS_OBJ_DICT(self, packet):
data = qunpack("xxOZ", packet) data = qunpack("xxOZ", packet)
try: try:
@ -108,9 +116,9 @@ class DPP:
except: except:
pass # dictionary for a different object pass # dictionary for a different object
# intercept the QS_FUN_DICT stadard packet # Intercept the QS_FUN_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Function-ptr, Zero-terminated string # Seq-Num, Record-ID, Function-ptr, Zero-terminated string
def QS_FUN_DICT(self, packet): def QS_FUN_DICT(self, packet):
data = qunpack("xxFZ", packet) data = qunpack("xxFZ", packet)
try: try:
@ -123,9 +131,9 @@ class DPP:
except: except:
pass # dictionary for a different state pass # dictionary for a different state
# intercept the QS_QEP_TRAN stadard packet # Intercept the QS_QEP_TRAN predefined trace record.
# this packet has the following structure: # This record has the following structure (see qep_hsm.c):
# record-ID, seq-num, Timestamp, Signal, Object-ptr, # Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
# Function-ptr (source state), Function-ptr (new active state) # Function-ptr (source state), Function-ptr (new active state)
def QS_QEP_TRAN(self, packet): def QS_QEP_TRAN(self, packet):
data = qunpack("xxTSOFF", packet) data = qunpack("xxTSOFF", packet)

View File

@ -6,8 +6,12 @@
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the application-specific # 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: class DPP:
def __init__(self): def __init__(self):
@ -47,7 +51,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback
def on_reset(self): def on_reset(self):
@ -83,10 +92,10 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_USER_00 application-specific packet # Intercept the QS_USER_00 application-specific trace record.
# this packet has the following structure (see bsp.c:displayPhilStat()): # This record has the following structure (see bsp.c:displayPhilStat()):
# record-ID, seq-num, Timestamp, format-byte, Philo-num, # Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
# format-bye, Zero-terminated string (status) # format-byte, Zero-terminated string (status)
def QS_USER_00(self, packet): def QS_USER_00(self, packet):
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3] # unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
data = qunpack("xxTxBxZ", packet) data = qunpack("xxTxBxZ", packet)

View File

@ -5,13 +5,16 @@
# A second click on the button, "un-pauses" the DPP ("forks" are served # A second click on the button, "un-pauses" the DPP ("forks" are served
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY # This version of the DPP customization uses the predefined QS_QEP_TRAN
# packet, which provides information about the current states of the dining # trace record, which provides information about the state transitions of
# Philosophers. The example also demonstrates how to intercept the QS # the Dining Philosophers. The example also demonstrates how to intercept
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information # the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
# about the addresses of the Philosopher objects and the states of their # information about the addresses of the Philosopher objects and the states
# state machines. # 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: class DPP:
def __init__(self): def __init__(self):
@ -51,7 +54,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback invoked when Target-reset packet is received
# NOTE: the QS dictionaries are not known at this time yet, so # NOTE: the QS dictionaries are not known at this time yet, so
@ -91,9 +99,9 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_OBJ_DICT stadard packet # Intercept the QS_OBJ_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Object-ptr, Zero-terminated string # Seq-Num, Record-ID, Object-ptr, Zero-terminated string
def QS_OBJ_DICT(self, packet): def QS_OBJ_DICT(self, packet):
data = qunpack("xxOZ", packet) data = qunpack("xxOZ", packet)
try: try:
@ -108,9 +116,9 @@ class DPP:
except: except:
pass # dictionary for a different object pass # dictionary for a different object
# intercept the QS_FUN_DICT stadard packet # Intercept the QS_FUN_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Function-ptr, Zero-terminated string # Seq-Num, Record-ID, Function-ptr, Zero-terminated string
def QS_FUN_DICT(self, packet): def QS_FUN_DICT(self, packet):
data = qunpack("xxFZ", packet) data = qunpack("xxFZ", packet)
try: try:
@ -123,9 +131,9 @@ class DPP:
except: except:
pass # dictionary for a different state pass # dictionary for a different state
# intercept the QS_QEP_TRAN stadard packet # Intercept the QS_QEP_TRAN predefined trace record.
# this packet has the following structure: # This record has the following structure (see qep_hsm.c):
# record-ID, seq-num, Timestamp, Signal, Object-ptr, # Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
# Function-ptr (source state), Function-ptr (new active state) # Function-ptr (source state), Function-ptr (new active state)
def QS_QEP_TRAN(self, packet): def QS_QEP_TRAN(self, packet):
data = qunpack("xxTSOFF", packet) data = qunpack("xxTSOFF", packet)

View File

@ -6,8 +6,12 @@
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the application-specific # 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: class DPP:
def __init__(self): def __init__(self):
@ -47,7 +51,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback
def on_reset(self): def on_reset(self):
@ -83,10 +92,10 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_USER_00 application-specific packet # Intercept the QS_USER_00 application-specific trace record.
# this packet has the following structure (see bsp.c:displayPhilStat()): # This record has the following structure (see bsp.c:displayPhilStat()):
# record-ID, seq-num, Timestamp, format-byte, Philo-num, # Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
# format-bye, Zero-terminated string (status) # format-byte, Zero-terminated string (status)
def QS_USER_00(self, packet): def QS_USER_00(self, packet):
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3] # unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
data = qunpack("xxTxBxZ", packet) data = qunpack("xxTxBxZ", packet)

View File

@ -5,13 +5,16 @@
# A second click on the button, "un-pauses" the DPP ("forks" are served # A second click on the button, "un-pauses" the DPP ("forks" are served
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY # This version of the DPP customization uses the predefined QS_QEP_TRAN
# packet, which provides information about the current states of the dining # trace record, which provides information about the state transitions of
# Philosophers. The example also demonstrates how to intercept the QS # the Dining Philosophers. The example also demonstrates how to intercept
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information # the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
# about the addresses of the Philosopher objects and the states of their # information about the addresses of the Philosopher objects and the states
# state machines. # 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: class DPP:
def __init__(self): def __init__(self):
@ -51,7 +54,12 @@ class DPP:
# NOTE: Normally, for an embedded application you would like # NOTE: Normally, for an embedded application you would like
# to start with resetting the Target, to start clean with # to start with resetting the Target, to start clean with
# Qs dictionaries, etc. # 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 # on_reset() callback invoked when Target-reset packet is received
# NOTE: the QS dictionaries are not known at this time yet, so # NOTE: the QS dictionaries are not known at this time yet, so
@ -91,9 +99,9 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_OBJ_DICT stadard packet # Intercept the QS_OBJ_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Object-ptr, Zero-terminated string # Seq-Num, Record-ID, Object-ptr, Zero-terminated string
def QS_OBJ_DICT(self, packet): def QS_OBJ_DICT(self, packet):
data = qunpack("xxOZ", packet) data = qunpack("xxOZ", packet)
try: try:
@ -108,9 +116,9 @@ class DPP:
except: except:
pass # dictionary for a different object pass # dictionary for a different object
# intercept the QS_FUN_DICT stadard packet # Intercept the QS_FUN_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Function-ptr, Zero-terminated string # Seq-Num, Record-ID, Function-ptr, Zero-terminated string
def QS_FUN_DICT(self, packet): def QS_FUN_DICT(self, packet):
data = qunpack("xxFZ", packet) data = qunpack("xxFZ", packet)
try: try:
@ -123,9 +131,9 @@ class DPP:
except: except:
pass # dictionary for a different state pass # dictionary for a different state
# intercept the QS_QEP_TRAN stadard packet # Intercept the QS_QEP_TRAN predefined trace record.
# this packet has the following structure: # This record has the following structure (see qep_hsm.c):
# record-ID, seq-num, Timestamp, Signal, Object-ptr, # Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
# Function-ptr (source state), Function-ptr (new active state) # Function-ptr (source state), Function-ptr (new active state)
def QS_QEP_TRAN(self, packet): def QS_QEP_TRAN(self, packet):
data = qunpack("xxTSOFF", packet) data = qunpack("xxTSOFF", packet)

View File

@ -1,7 +1,7 @@
############################################################################## ##############################################################################
# Product: Makefile for QUTEST; QP/C on POSIX *Target* # Product: Makefile for QUTEST; QP/C on POSIX *Target*
# Last updated for version 6.8.2 # Last updated for version 6.8.3
# Last updated on 2020-06-23 # Last updated on 2021-04-16
# #
# Q u a n t u m L e a P s # Q u a n t u m L e a P s
# ------------------------ # ------------------------
@ -144,7 +144,7 @@ RM := rm -f
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# build options... # build options...
BIN_DIR := build_$(TARGET BIN_DIR := build_posix
CFLAGS = -c -g -O -Wall -Wstrict-prototypes -W $(INCLUDES) $(DEFINES) \ CFLAGS = -c -g -O -Wall -Wstrict-prototypes -W $(INCLUDES) $(DEFINES) \
-DQ_SPY -DQ_UTEST -DQ_HOST -DQ_SPY -DQ_UTEST -DQ_HOST
@ -218,6 +218,8 @@ ifneq ($(MAKECMDGOALS),clean)
endif endif
endif endif
test :
$(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST)
clean : clean :
-$(RM) $(BIN_DIR)/*.o \ -$(RM) $(BIN_DIR)/*.o \
$(BIN_DIR)/*.d \ $(BIN_DIR)/*.d \

View File

@ -1,7 +1,7 @@
############################################################################## ##############################################################################
# Product: Makefile for QUTEST; QP/C on POSIX *Target* # Product: Makefile for QUTEST; QP/C on POSIX *Target*
# Last updated for version 6.8.2 # Last updated for version 6.8.3
# Last updated on 2020-06-23 # Last updated on 2021-04-16
# #
# Q u a n t u m L e a P s # Q u a n t u m L e a P s
# ------------------------ # ------------------------
@ -140,7 +140,7 @@ RM := rm -f
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# build options... # build options...
BIN_DIR := build_$(TARGET BIN_DIR := build_posix
CFLAGS = -c -g -O -Wall -Wstrict-prototypes -W $(INCLUDES) $(DEFINES) \ CFLAGS = -c -g -O -Wall -Wstrict-prototypes -W $(INCLUDES) $(DEFINES) \
-DQ_SPY -DQ_UTEST -DQ_HOST -DQ_SPY -DQ_UTEST -DQ_HOST

View 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")

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
* Purpose: Fixture for QUTEST self-test * Purpose: Fixture for QUTEST self-test
* Last Updated for Version: 6.9.2a * Last Updated for Version: 6.9.3
* Date of the Last Update: 2021-01-28 * Date of the Last Update: 2021-05-31
* *
* Q u a n t u m L e a P s * Q u a n t u m L e a P s
* ------------------------ * ------------------------
@ -43,6 +43,7 @@ enum {
FIXTURE_SETUP = QS_USER, FIXTURE_SETUP = QS_USER,
FIXTURE_TEARDOWN, FIXTURE_TEARDOWN,
COMMAND_A, COMMAND_A,
COMMAND_B,
COMMAND_X, COMMAND_X,
COMMAND_Y, COMMAND_Y,
COMMAND_Z, COMMAND_Z,
@ -67,6 +68,7 @@ int main(int argc, char *argv[]) {
QS_USR_DICTIONARY(FIXTURE_SETUP); QS_USR_DICTIONARY(FIXTURE_SETUP);
QS_USR_DICTIONARY(FIXTURE_TEARDOWN); QS_USR_DICTIONARY(FIXTURE_TEARDOWN);
QS_USR_DICTIONARY(COMMAND_A); QS_USR_DICTIONARY(COMMAND_A);
QS_USR_DICTIONARY(COMMAND_B);
QS_USR_DICTIONARY(COMMAND_X); QS_USR_DICTIONARY(COMMAND_X);
QS_USR_DICTIONARY(COMMAND_Y); QS_USR_DICTIONARY(COMMAND_Y);
QS_USR_DICTIONARY(COMMAND_Z); QS_USR_DICTIONARY(COMMAND_Z);
@ -103,6 +105,17 @@ void QS_onCommand(uint8_t cmdId,
QS_END() QS_END()
break; 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: { case COMMAND_X: {
uint32_t x = myFun(); uint32_t x = myFun();
QS_BEGIN_ID(COMMAND_X, 0U) /* app-specific record */ QS_BEGIN_ID(COMMAND_X, 0U) /* app-specific record */

View File

@ -6,8 +6,12 @@
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the application-specific # 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: class DPP:
def __init__(self): def __init__(self):
@ -88,10 +92,10 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_USER_00 application-specific packet # Intercept the QS_USER_00 application-specific trace record.
# this packet has the following structure (see bsp.c:displayPhilStat()): # This record has the following structure (see bsp.c:displayPhilStat()):
# record-ID, seq-num, Timestamp, format-byte, Philo-num, # Seq-Num, Record-ID, Timestamp, format-byte, Philo-num,
# format-bye, Zero-terminated string (status) # format-byte, Zero-terminated string (status)
def QS_USER_00(self, packet): def QS_USER_00(self, packet):
# unpack: Timestamp->data[0], Philo-num->data[1], status->data[3] # unpack: Timestamp->data[0], Philo-num->data[1], status->data[3]
data = qunpack("xxTxBxZ", packet) data = qunpack("xxTxBxZ", packet)

View File

@ -5,13 +5,16 @@
# A second click on the button, "un-pauses" the DPP ("forks" are served # A second click on the button, "un-pauses" the DPP ("forks" are served
# to all hungry Philosophers). # to all hungry Philosophers).
# #
# This version of the DPP customization uses the standard QS_QEP_STATE_ENTRY # This version of the DPP customization uses the predefined QS_QEP_TRAN
# packet, which provides information about the current states of the dining # trace record, which provides information about the state transitions of
# Philosophers. The example also demonstrates how to intercept the QS # the Dining Philosophers. The example also demonstrates how to intercept
# "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the information # the QS "dictionary" records QS_OBJ_DICT and QS_FUN_DICT to extract the
# about the addresses of the Philosopher objects and the states of their # information about the addresses of the Philosopher objects and the states
# state machines. # 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: class DPP:
def __init__(self): def __init__(self):
@ -96,9 +99,9 @@ class DPP:
post("PAUSE_SIG") post("PAUSE_SIG")
QView.print_text("Table PAUSED") QView.print_text("Table PAUSED")
# intercept the QS_OBJ_DICT stadard packet # Intercept the QS_OBJ_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Object-ptr, Zero-terminated string # Seq-Num, Record-ID, Object-ptr, Zero-terminated string
def QS_OBJ_DICT(self, packet): def QS_OBJ_DICT(self, packet):
data = qunpack("xxOZ", packet) data = qunpack("xxOZ", packet)
try: try:
@ -113,9 +116,9 @@ class DPP:
except: except:
pass # dictionary for a different object pass # dictionary for a different object
# intercept the QS_FUN_DICT stadard packet # Intercept the QS_FUN_DICT predefined trace record.
# this packet has the following structure: # This record has the following structure:
# record-ID, seq-num, Function-ptr, Zero-terminated string # Seq-Num, Record-ID, Function-ptr, Zero-terminated string
def QS_FUN_DICT(self, packet): def QS_FUN_DICT(self, packet):
data = qunpack("xxFZ", packet) data = qunpack("xxFZ", packet)
try: try:
@ -128,9 +131,9 @@ class DPP:
except: except:
pass # dictionary for a different state pass # dictionary for a different state
# intercept the QS_QEP_TRAN stadard packet # Intercept the QS_QEP_TRAN predefined trace record.
# this packet has the following structure: # This record has the following structure (see qep_hsm.c):
# record-ID, seq-num, Timestamp, Signal, Object-ptr, # Seq-Num, Record-ID, Timestamp, Signal, Object-ptr,
# Function-ptr (source state), Function-ptr (new active state) # Function-ptr (source state), Function-ptr (new active state)
def QS_QEP_TRAN(self, packet): def QS_QEP_TRAN(self, packet):
data = qunpack("xxTSOFF", packet) data = qunpack("xxTSOFF", packet)