This commit is contained in:
QL 2018-05-25 12:23:30 -04:00
parent 58f80da3a7
commit a934381e1c
7 changed files with 2376 additions and 2364 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*****************************************************************************
* Purpose: example Mock for IO (Chapter 10 from TDDfEC)
* Last Updated for Version: 5.9.0
* Date of the Last Update: 2017-04-15
* Last Updated for Version: 6.3.1
* Date of the Last Update: 2018-05-25
*
* Q u a n t u m L e a P s
* ---------------------------
@ -28,22 +28,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Contact information:
* https://state-machine.com
* https://www.state-machine.com
* mailto:info@state-machine.com
*****************************************************************************/
#include "qpc.h" /* for QUTEST */
#include "IO.h" /* mocked interface */
enum {
IO_READ = QS_USER1,
IO_WRITE,
IO_CALL = QS_USER1,
};
/*..........................................................................*/
void MockIO_Init(void) {
/* dictionaries... */
QS_USR_DICTIONARY(IO_READ);
QS_USR_DICTIONARY(IO_WRITE);
QS_USR_DICTIONARY(IO_CALL);
QS_FUN_DICTIONARY(&IO_Read);
QS_FUN_DICTIONARY(&IO_Write);
@ -55,7 +53,8 @@ ioData IO_Read(ioAddress offset) {
QS_TEST_PROBE(
ret = (ioData)qs_tp_;
)
QS_BEGIN(IO_READ, (void *)0) /* user-specific record */
QS_BEGIN(IO_CALL, (void *)0) /* user-specific record */
QS_FUN(&IO_Read);
QS_I16(0, ret);
QS_U32(0, offset);
QS_END()
@ -63,7 +62,8 @@ ioData IO_Read(ioAddress offset) {
}
/*..........................................................................*/
void IO_Write(ioAddress offset, ioData data) {
QS_BEGIN(IO_WRITE, (void *)0) /* user-specific record */
QS_BEGIN(IO_CALL, (void *)0) /* user-specific record */
QS_FUN(&IO_Write);
QS_U32(0, offset);
QS_I16(0, data);
QS_END()

View File

@ -46,12 +46,12 @@ test "Write success ready immediately"
probe IO_Read $ReadyBit
probe IO_Read $data
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
expect "%timestamp TstProbe Fun=IO_Read,Data=128"
expect "%timestamp IO_READ $ReadyBit $StatusRegister"
expect "%timestamp IO_CALL IO_Read $ReadyBit $StatusRegister"
expect "%timestamp TstProbe Fun=IO_Read,Data=$data"
expect "%timestamp IO_READ [expr $data] $address"
expect "%timestamp IO_CALL IO_Read [expr $data] $address"
expect "%timestamp FLASH_WRITE $FLASH_SUCCESS"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -63,18 +63,18 @@ probe IO_Read 0
probe IO_Read $ReadyBit
probe IO_Read $data
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
expect "%timestamp TstProbe Fun=IO_Read,Data=0"
expect "%timestamp IO_READ 0 $StatusRegister"
expect "%timestamp IO_CALL IO_Read 0 $StatusRegister"
expect "%timestamp TstProbe Fun=IO_Read,Data=0"
expect "%timestamp IO_READ 0 $StatusRegister"
expect "%timestamp IO_CALL IO_Read 0 $StatusRegister"
expect "%timestamp TstProbe Fun=IO_Read,Data=0"
expect "%timestamp IO_READ 0 $StatusRegister"
expect "%timestamp IO_CALL IO_Read 0 $StatusRegister"
expect "%timestamp TstProbe Fun=IO_Read,Data=128"
expect "%timestamp IO_READ $ReadyBit $StatusRegister"
expect "%timestamp IO_CALL IO_Read $ReadyBit $StatusRegister"
expect "%timestamp TstProbe Fun=IO_Read,Data=$data"
expect "%timestamp IO_READ [expr $data] $address"
expect "%timestamp IO_CALL IO_Read [expr $data] $address"
expect "%timestamp FLASH_WRITE $FLASH_SUCCESS"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -82,11 +82,11 @@ expect "%timestamp Trg-Done QS_RX_COMMAND"
test "Write fails Vpp Error" -noreset
probe IO_Read [expr $ReadyBit | $VppErrorBit]
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr $ReadyBit | $VppErrorBit]"
expect "%timestamp IO_READ [expr $ReadyBit | $VppErrorBit] $StatusRegister"
expect "%timestamp IO_WRITE $CommandRegister $Reset"
expect "%timestamp IO_CALL IO_Read [expr $ReadyBit | $VppErrorBit] $StatusRegister"
expect "%timestamp IO_CALL IO_Write $CommandRegister $Reset"
expect "%timestamp FLASH_WRITE $FLASH_VPP_ERROR"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -94,11 +94,11 @@ expect "%timestamp Trg-Done QS_RX_COMMAND"
test "Write fails Program Error" -noreset
probe IO_Read [expr $ReadyBit | $ProgramErrorBit]
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr $ReadyBit | $ProgramErrorBit]"
expect "%timestamp IO_READ [expr $ReadyBit | $ProgramErrorBit] $StatusRegister"
expect "%timestamp IO_WRITE $CommandRegister $Reset"
expect "%timestamp IO_CALL IO_Read [expr $ReadyBit | $ProgramErrorBit] $StatusRegister"
expect "%timestamp IO_CALL IO_Write $CommandRegister $Reset"
expect "%timestamp FLASH_WRITE $FLASH_PROGRAM_ERROR"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -106,11 +106,11 @@ expect "%timestamp Trg-Done QS_RX_COMMAND"
test "Write fails Protected-Block Error" -noreset
probe IO_Read [expr $ReadyBit | $BlockProtectionErrorBit]
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr $ReadyBit | $BlockProtectionErrorBit]"
expect "%timestamp IO_READ [expr $ReadyBit | $BlockProtectionErrorBit] $StatusRegister"
expect "%timestamp IO_WRITE $CommandRegister $Reset"
expect "%timestamp IO_CALL IO_Read [expr $ReadyBit | $BlockProtectionErrorBit] $StatusRegister"
expect "%timestamp IO_CALL IO_Write $CommandRegister $Reset"
expect "%timestamp FLASH_WRITE $FLASH_PROTECTED_BLOCK_ERROR"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -118,11 +118,11 @@ expect "%timestamp Trg-Done QS_RX_COMMAND"
test "Write fails Unknown Program Error" -noreset
probe IO_Read [expr $ReadyBit | $EraseSuspendBit | $EraseErrorBit | $ProgramSuspendBit | $ReservedBit]
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr $ReadyBit | $EraseSuspendBit | $EraseErrorBit | $ProgramSuspendBit | $ReservedBit]"
expect "%timestamp IO_READ [expr $ReadyBit | $EraseSuspendBit | $EraseErrorBit | $ProgramSuspendBit | $ReservedBit] $StatusRegister"
expect "%timestamp IO_WRITE $CommandRegister $Reset"
expect "%timestamp IO_CALL IO_Read [expr $ReadyBit | $EraseSuspendBit | $EraseErrorBit | $ProgramSuspendBit | $ReservedBit] $StatusRegister"
expect "%timestamp IO_CALL IO_Write $CommandRegister $Reset"
expect "%timestamp FLASH_WRITE $FLASH_UNKNOWN_PROGRAM_ERROR"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -131,12 +131,12 @@ test "Write fails Read-Back Error" -noreset
probe IO_Read $ReadyBit
probe IO_Read [expr $data - 1]
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr $ReadyBit]"
expect "%timestamp IO_READ $ReadyBit $StatusRegister"
expect "%timestamp IO_CALL IO_Read $ReadyBit $StatusRegister"
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr $data - 1]"
expect "%timestamp IO_READ [expr $data - 1] $address"
expect "%timestamp IO_CALL IO_Read [expr $data - 1] $address"
expect "%timestamp FLASH_WRITE $FLASH_READ_BACK_ERROR"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -146,14 +146,14 @@ probe IO_Read [expr ~$ReadyBit]
probe IO_Read $ReadyBit
probe IO_Read $data
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr ~$ReadyBit]"
expect "%timestamp IO_READ [expr ~$ReadyBit] $StatusRegister"
expect "%timestamp IO_CALL IO_Read [expr ~$ReadyBit] $StatusRegister"
expect "%timestamp TstProbe Fun=IO_Read,Data=$ReadyBit"
expect "%timestamp IO_READ $ReadyBit $StatusRegister"
expect "%timestamp IO_CALL IO_Read $ReadyBit $StatusRegister"
expect "%timestamp TstProbe Fun=IO_Read,Data=$data"
expect "%timestamp IO_READ $data $address"
expect "%timestamp IO_CALL IO_Read $data $address"
expect "%timestamp FLASH_WRITE $FLASH_SUCCESS"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -166,11 +166,11 @@ for {set i 0} {$i < 10} {incr i} {
probe IO_Read [expr ~$ReadyBit]
}
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
for {set i 0} {$i < 10} {incr i} {
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr ~$ReadyBit]"
expect "%timestamp IO_READ [expr ~$ReadyBit] $StatusRegister"
expect "%timestamp IO_CALL IO_Read [expr ~$ReadyBit] $StatusRegister"
}
expect "%timestamp FLASH_WRITE $FLASH_TIMEOUT_ERROR"
expect "%timestamp Trg-Done QS_RX_COMMAND"
@ -184,11 +184,11 @@ for {set i 0} {$i < 10} {incr i} {
probe IO_Read [expr ~$ReadyBit]
}
command FLASH_WRITE $address $data
expect "%timestamp IO_WRITE $CommandRegister $ProgramCommand"
expect "%timestamp IO_WRITE $address $data"
expect "%timestamp IO_CALL IO_Write $CommandRegister $ProgramCommand"
expect "%timestamp IO_CALL IO_Write $address $data"
for {set i 0} {$i < 10} {incr i} {
expect "%timestamp TstProbe Fun=IO_Read,Data=[expr ~$ReadyBit]"
expect "%timestamp IO_READ [expr ~$ReadyBit] $StatusRegister"
expect "%timestamp IO_CALL IO_Read [expr ~$ReadyBit] $StatusRegister"
}
expect "%timestamp FLASH_WRITE $FLASH_TIMEOUT_ERROR"
expect "%timestamp Trg-Done QS_RX_COMMAND"

View File

@ -1,7 +1,7 @@
/*****************************************************************************
* Product: DPP example, BSP for QUTest
* Last Updated for Version: 6.2.0
* Date of the Last Update: 2018-03-16
* Last Updated for Version: 6.3.1
* Date of the Last Update: 2018-05-24
*
* Q u a n t u m L e a P s
* ---------------------------
@ -40,9 +40,7 @@ Q_DEFINE_THIS_MODULE("bsp")
static uint32_t l_rnd; /* random seed */
enum {
BSP_DISPLAY_PHIL_STAT = QS_USER,
BSP_DISPLAY_PAUSED,
BSP_RANDOM,
BSP_CALL = QS_USER,
};
/*..........................................................................*/
@ -50,11 +48,13 @@ void BSP_init(int argc, char **argv) {
Q_ALLEGE(QS_INIT(argc <= 1 ? (void *)0 : argv[1]) != (uint8_t)0);
QS_FUN_DICTIONARY(&BSP_displayPaused);
QS_FUN_DICTIONARY(&BSP_displayPhilStat);
QS_FUN_DICTIONARY(&BSP_random);
QS_FUN_DICTIONARY(&BSP_randomSeed);
QS_USR_DICTIONARY(BSP_DISPLAY_PHIL_STAT);
QS_USR_DICTIONARY(BSP_DISPLAY_PAUSED);
QS_USR_DICTIONARY(BSP_RANDOM);
QS_USR_DICTIONARY(BSP_CALL);
BSP_randomSeed(1234U);
}
/*..........................................................................*/
void BSP_displayPaused(uint8_t paused) {
@ -63,15 +63,15 @@ void BSP_displayPaused(uint8_t paused) {
QS_TEST_PROBE(
Q_ASSERT_ID(100, 0);
)
QS_BEGIN(BSP_DISPLAY_PAUSED, (void *)0) /* application-specific record */
QS_BEGIN(BSP_CALL, (void *)0) /* application-specific record */
QS_FUN(&BSP_displayPaused);
QS_U8(0, paused);
QS_END()
}
/*..........................................................................*/
void BSP_displayPhilStat(uint8_t n, char_t const *stat) {
(void)n;
(void)stat;
QS_BEGIN(BSP_DISPLAY_PHIL_STAT, (void *)0) /* application-specific record */
QS_BEGIN(BSP_CALL, (void *)0) /* application-specific record */
QS_FUN(&BSP_displayPhilStat);
QS_U8(0, n);
QS_STR(stat);
QS_END()
@ -84,12 +84,22 @@ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */
QS_TEST_PROBE(
rnd = qs_tp_;
)
QS_BEGIN(BSP_RANDOM, (void *)0) /* application-specific record */
QS_BEGIN(BSP_CALL, (void *)0) /* application-specific record */
QS_FUN(&BSP_random);
QS_U32(0, rnd);
QS_END()
return rnd;
}
/*..........................................................................*/
void BSP_randomSeed(uint32_t seed) {
QS_TEST_PROBE_DEF(&BSP_randomSeed)
QS_TEST_PROBE(
seed = qs_tp_;
)
l_rnd = seed;
QS_BEGIN(BSP_CALL, (void *)0) /* application-specific record */
QS_FUN(&BSP_randomSeed);
QS_U32(0, seed);
QS_END()
}

View File

@ -1,7 +1,7 @@
#-----------------------------------------------------------------------------
# Product: QSPY -- test-script example for qutest.tcl
# Last updated for version 6.2.0
# Last updated on 2018-03-19
# Last updated for version 6.3.1
# Last updated on 2018-05-24
#
# Q u a n t u m L e a P s
# ---------------------------
@ -36,7 +36,7 @@
proc on_reset {} {
expect_pause
continue
glb_filter SM AO
glb_filter SM AO UA
current_obj SM_AO l_philo<2>
}
@ -59,6 +59,7 @@ expect "%timestamp AO-Post Sdr=QS_RX,Obj=l_philo<2>,Evt<Sig=EAT_SIG,*"
expect "%timestamp Trg-Done QS_RX_EVENT"
expect "%timestamp AO-GetL Obj=l_philo<2>,Evt<Sig=EAT_SIG,*"
expect "%timestamp Disp===> Obj=l_philo<2>,Sig=EAT_SIG,State=Philo_hungry"
expect "%timestamp BSP_CALL BSP_random 123"
expect "===RTC===> St-Entry Obj=l_philo<2>,State=Philo_eating"
expect "%timestamp ===>Tran Obj=l_philo<2>,Sig=EAT_SIG,State=Philo_hungry->Philo_eating"
expect "%timestamp Trg-Done QS_RX_EVENT"

View File

@ -1,7 +1,7 @@
#-----------------------------------------------------------------------------
# Product: QSPY -- test-script example for qutest.tcl
# Last updated for version 6.2.0
# Last updated on 2018-03-19
# Last updated for version 6.3.1
# Last updated on 2018-05-25
#
# Q u a n t u m L e a P s
# ---------------------------
@ -36,7 +36,7 @@
proc on_reset {} {
expect_pause
continue
glb_filter SM AO
glb_filter SM AO UA
loc_filter AO l_table
current_obj SM_AO l_table
}
@ -45,6 +45,7 @@ proc on_reset {} {
test "PAUSE->Table"
dispatch PAUSE_SIG
expect "%timestamp Disp===> Obj=l_table,Sig=PAUSE_SIG,State=Table_serving"
expect "%timestamp BSP_CALL BSP_displayPaused 1"
expect "===RTC===> St-Entry Obj=l_table,State=Table_paused"
expect "%timestamp ===>Tran Obj=l_table,Sig=PAUSE_SIG,State=Table_serving->Table_paused"
expect "%timestamp Trg-Done QS_RX_EVENT"

View File

@ -885,7 +885,7 @@ static void QS_rxHandleGoodFrame_(uint8_t state) {
l_rx.var.gFlt.data[7] |= (uint8_t)0xFC;
l_rx.var.gFlt.data[8] |= (uint8_t)0x3F;
/* never disable the last 3 records on (0x7D, 0x7E, 0x7F) */
/* never enable the last 3 records (0x7D, 0x7E, 0x7F) */
l_rx.var.gFlt.data[15] &= (uint8_t)0xE0;
for (i=(uint8_t)0; i < (uint8_t)sizeof(QS_priv_.glbFilter); ++i) {