47#error "Q_SPY must be defined to include qs.h"
58#define QS_TIME_SIZE 4U
259#if (QS_OBJ_PTR_SIZE == 2U)
260typedef uint16_t QSObj;
264#if (QS_OBJ_PTR_SIZE == 4U)
265typedef uint32_t QSObj;
269#if (QS_OBJ_PTR_SIZE == 8U)
270typedef uint64_t QSObj;
274#if (QS_FUN_PTR_SIZE == 2U)
275typedef uint16_t QSFun;
279#if (QS_FUN_PTR_SIZE == 4U)
280typedef uint32_t QSFun;
284#if (QS_FUN_PTR_SIZE == 8U)
285typedef uint64_t QSFun;
290typedef void (* QSpyFunPtr )(void);
293#if (QS_CTR_SIZE == 2U)
294typedef uint16_t QSCtr;
298#if (QS_CTR_SIZE == 4U)
299typedef uint32_t QSCtr;
303#if (QS_TIME_SIZE == 2U)
308#if (QS_TIME_SIZE == 4U)
329#define QS_INIT(arg_) (QS_onStartup(arg_))
332#define QS_EXIT() (QS_onCleanup())
335#define QS_OUTPUT() (QS_output())
338#define QS_RX_INPUT() (QS_rx_input())
341#define QS_GLB_FILTER(rec_) (QS_glbFilter_((int_fast16_t)(rec_)))
344#define QS_LOC_FILTER(qsId_) (QS_locFilter_((int_fast16_t)(qsId_)))
347#define QS_BEGIN_ID(rec_, qsId_) \
348if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qsId_)) { \
352 QS_beginRec_((uint_fast8_t)(rec_)); \
363#define QS_FLUSH() (QS_onFlush())
366#define QS_BEGIN_INCRIT(rec_, qsId_) \
367if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qsId_)) { \
368 QS_beginRec_((uint_fast8_t)(rec_)); \
372#define QS_END_INCRIT() } \
377#define QS_GLB_CHECK_(rec_) \
378 (((uint_fast8_t)QS_filt_.glb[(uint_fast8_t)(rec_) >> 3U] \
379 & ((uint_fast8_t)1U << ((uint_fast8_t)(rec_) & 7U))) != 0U)
382#define QS_LOC_CHECK_(qsId_) \
383 (((uint_fast8_t)QS_filt_.loc[(uint_fast8_t)(qsId_) >> 3U] \
384 & ((uint_fast8_t)1U << ((uint_fast8_t)(qsId_) & 7U))) != 0U)
388#define QS_REC_DONE() ((void)0)
392#define QS_I8(width_, data_) \
393 (QS_u8_fmt_((uint8_t)(((width_) << 4U) & 0x7U) | (uint8_t)QS_I8_ENUM_T, \
397#define QS_U8(width_, data_) \
398 (QS_u8_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_U8_T, (data_)))
401#define QS_I16(width_, data_) \
402 (QS_u16_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I16_T, (data_)))
405#define QS_U16(width_, data_) \
406 (QS_u16_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_U16_T, (data_)))
409#define QS_I32(width_, data_) \
410 (QS_u32_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I32_T, (data_)))
413#define QS_U32(width_, data_) \
414 (QS_u32_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_U32_T, (data_)))
417#define QS_I64(width_, data_) \
418 (QS_u64_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I64_T, (data_)))
421#define QS_U64(width_, data_) \
422 (QS_u64_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_U64_T, (data_)))
425#define QS_F32(width_, data_) \
426 (QS_f32_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_F32_T, (data_)))
429#define QS_F64(width_, data_) \
430 (QS_f64_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_F64_T, (data_)))
433#define QS_STR(str_) (QS_str_fmt_((str_)))
436#define QS_MEM(mem_, size_) (QS_mem_fmt_((mem_), (size_)))
439#define QS_ENUM(group_, value_) \
440 (QS_u8_fmt_((uint8_t)(0x80U | ((group_) << 4U)) | (uint8_t)QS_I8_ENUM_T,\
444#if (QS_TIME_SIZE == 2U)
445#define QS_TIME_PRE_() (QS_u16_raw_(QS_onGetTime()))
449#if (QS_TIME_SIZE == 4U)
450#define QS_TIME_PRE_() (QS_u32_raw_(QS_onGetTime()))
454#if (QS_OBJ_PTR_SIZE == 2U)
455#define QS_OBJ(obj_) (QS_u16_fmt_(QS_OBJ_T, (uint16_t)(obj_)))
459#if (QS_OBJ_PTR_SIZE == 4U)
460#define QS_OBJ(obj_) (QS_u32_fmt_(QS_OBJ_T, (uint32_t)(obj_)))
464#if (QS_OBJ_PTR_SIZE == 8U)
465#define QS_OBJ(obj_) (QS_u64_fmt_(QS_OBJ_T, (uint64_t)(obj_)))
469#if (QS_FUN_PTR_SIZE == 2U)
470#define QS_FUN(fun_) (QS_u16_fmt_(QS_FUN_T, (uint16_t)(fun_)))
474#if (QS_FUN_PTR_SIZE == 4U)
475#define QS_FUN(fun_) (QS_u32_fmt_(QS_FUN_T, (uint32_t)(fun_)))
479#if (QS_FUN_PTR_SIZE == 8U)
480#define QS_FUN(fun_) (QS_u64_fmt_(QS_FUN_T, (uint64_t)(fun_)))
484#if (Q_SIGNAL_SIZE == 1U)
485#define QS_SIG(sig_, obj_) \
486 QS_u8_fmt_(QS_SIG_T, (sig_)); \
491#if (Q_SIGNAL_SIZE == 2U)
492#define QS_SIG(sig_, obj_) \
493 QS_u16_fmt_(QS_SIG_T, (sig_)); \
498#if (Q_SIGNAL_SIZE == 4U)
499#define QS_SIG(sig_, obj_) \
500 QS_u32_fmt_(QS_SIG_T, (sig_)); \
505#define QS_SIG_DICTIONARY(sig_, obj_) \
506 (QS_sig_dict_pre_((QSignal)(sig_), (obj_), #sig_))
509#define QS_OBJ_DICTIONARY(obj_) \
510 (QS_obj_dict_pre_((obj_), #obj_))
513#define QS_OBJ_ARR_DICTIONARY(obj_, idx_) \
514 (QS_obj_arr_dict_pre_((obj_), (idx_), #obj_))
517#define QS_FUN_DICTIONARY(fun_) \
518 (QS_fun_dict_pre_((void (*)(void))(fun_), #fun_))
521#define QS_USR_DICTIONARY(rec_) \
522 (QS_usr_dict_pre_((rec_), #rec_))
525#define QS_ENUM_DICTIONARY(value_, group_) \
526 (QS_enum_dict_pre_((value_), (group_), #value_))
529#define QS_RX_PUT(b_) (QS_rxPut((b_)))
532#define QS_TR_CRIT_ENTRY()
535#define QS_TR_CRIT_EXIT()
538#define QS_TR_ISR_ENTRY(isrnest, prio) do { \
539 QS_BEGIN_PRE_(QS_QF_ISR_ENTRY, 0U) \
541 QS_2u8_raw_(isrnest, prio); \
547 uint_fast8_t isrnest,
551#define QS_ONLY(code_) (code_)
554#define QS_ASSERTION(module_, id_, delay_) \
555 (QS_assertion_pre_((module_), (id_), (delay_)))
558#define QS_EOD ((uint16_t)0xFFFFU)
561#define QS_CMD ((uint8_t)7U)
564#define QS_HEX_FMT ((uint8_t)0x0FU)
568#define QS_CRIT_STAT QF_CRIT_STAT
573#define QS_CRIT_ENTRY() QF_CRIT_ENTRY()
578#define QS_CRIT_EXIT() QF_CRIT_EXIT()
583#define QS_MEM_SYS() QF_MEM_SYS()
588#define QS_MEM_APP() QF_MEM_APP()
596 void const * locFilter_AP;
602 uint8_t
volatile seq;
603 uint8_t
volatile chksum;
604 uint8_t
volatile critNest;
608extern QS_Attr QS_priv_;
610void QS_glbFilter_(int_fast16_t
const filter);
611void QS_locFilter_(int_fast16_t
const filter);
613void QS_beginRec_(uint_fast8_t
const rec);
614void QS_endRec_(
void);
616void QS_u8_raw_(uint8_t
const d);
617void QS_2u8_raw_(uint8_t
const d1, uint8_t
const d2);
618void QS_u16_raw_(uint16_t
const d);
619void QS_u32_raw_(uint32_t
const d);
620void QS_u64_raw_(uint64_t
const d);
621void QS_obj_raw_(
void const *
const obj);
622void QS_str_raw_(
char const *
const str);
624void QS_u8_fmt_(uint8_t
const format, uint8_t
const d);
625void QS_u16_fmt_(uint8_t
const format, uint16_t
const d);
626void QS_u32_fmt_(uint8_t
const format, uint32_t
const d);
627void QS_u64_fmt_(uint8_t
const format, uint64_t
const d);
628void QS_f32_fmt_(uint8_t
const format,
float32_t const f);
629void QS_f64_fmt_(uint8_t
const format,
float64_t const d);
630void QS_str_fmt_(
char const *
const str);
631void QS_mem_fmt_(uint8_t
const *
const blk, uint8_t
const size);
633void QS_sig_dict_pre_(
QSignal const sig,
void const *
const obj,
634 char const *
const name);
635void QS_obj_dict_pre_(
void const *
const obj,
char const *
const name);
636void QS_obj_arr_dict_pre_(
void const *
const obj, uint_fast16_t
const idx,
637 char const *
const name);
638void QS_fun_dict_pre_(QSpyFunPtr
const fun,
char const *
const name);
639void QS_usr_dict_pre_(
enum_t const rec,
char const *
const name);
640void QS_enum_dict_pre_(
enum_t const value, uint8_t
const group,
641 char const *
const name);
643void QS_assertion_pre_(
char const *
const module,
int_t const id,
644 uint32_t
const delay);
646void QS_target_info_pre_(uint8_t
const isReset);
677 uint_fast32_t
const stoSize);
681uint16_t QS_getByte(
void);
685uint8_t
const * QS_getBlock(uint16_t *
const pNbytes);
746#define QUTEST_ON_POST 124
757 uint_fast8_t intLock;
760extern QSTestAttr QS_tstPriv_;
762void QS_test_pause_(
void);
763uint32_t QS_getTestProbe_(QSpyFunPtr
const api);
786void QHsmDummy_ctor(
QHsmDummy *
const me);
791 void const *
const par,
792 uint_fast8_t
const qsId);
797void QHsmDummy_dispatch_(
799 QEvt const *
const e,
800 uint_fast8_t
const qsId);
820void QActiveDummy_init_(
822 void const *
const par,
823 uint_fast8_t
const qsId);
826void QActiveDummy_dispatch_(
828 QEvt const *
const e,
829 uint_fast8_t
const qsId);
832bool QActiveDummy_fakePost_(
834 QEvt const *
const e,
835 uint_fast16_t
const margin,
836 void const *
const sender);
839void QActiveDummy_fakePostLIFO_(
841 QEvt const *
const e);
846#define QS_TEST_PROBE_DEF(fun_) \
847 uint32_t const qs_tp_ = QS_getTestProbe_((void (*)(void))(fun_));
849#define QS_TEST_PROBE(code_) \
850 if (qs_tp_ != 0U) { code_ }
852#define QS_TEST_PROBE_ID(id_, code_) \
853 if (qs_tp_ == (uint32_t)(id_)) { code_ }
855#define QS_TEST_PAUSE() (QS_test_pause_())
860#define QS_TEST_PROBE_DEF(fun_)
861#define QS_TEST_PROBE(code_)
862#define QS_TEST_PROBE_ID(id_, code_)
863#define QS_TEST_PAUSE() ((void)0)
980 uint16_t
const stoSize);
988 QSCtr head = QS_rxPriv_.head + 1U;
989 if (head == QS_rxPriv_.end) {
992 if (head != QS_rxPriv_.tail) {
993 QS_rxPriv_.buf[QS_rxPriv_.head] = b;
994 QS_rxPriv_.head = head;
1004void QS_rxParse(
void);
1009 uint8_t
const obj_kind,
1010 void *
const obj_ptr);
1014uint16_t QS_rxGetNfree(
void);
@ QS_ASSERT_FAIL
assertion failed in the code
@ QS_QF_TIMEEVT_AUTO_DISARM
a time event expired and was disarmed
@ QS_QF_INT_ENABLE
interrupts were enabled
@ QS_QF_RUN
QF_run() was entered.
@ QS_USER0
offset for User Group 0
@ QS_QF_MPOOL_GET_ATTEMPT
attempt to get a memory block failed
@ QS_U2_RECORDS
User Group 110-114 records.
@ QS_QF_DELETE_REF
an event reference is about to be deleted
@ QS_QF_ACTIVE_RECALL
AO recalled an event.
@ QS_QF_EQUEUE_GET_LAST
get the last event from the queue
@ QS_QF_TIMEEVT_DISARM
true disarming of an armed time event
@ QS_TEST_PROBE_GET
reports that Test-Probe has been used
@ QS_SEM_BLOCK
a semaphore blocked a thread
@ QS_QEP_STATE_INIT
an initial transition was taken in a state
@ QS_QEP_TRAN_HIST
a tran to history was taken
@ QS_ENUM_DICT
enumeration dictionary entry
@ QS_QF_TIMEEVT_REARM
rearming of a time event
@ QS_FUN_DICT
function dictionary entry
@ QS_USER3
offset for User Group 3
@ QS_MP_RECORDS
Memory Pools QS records.
@ QS_QF_PUBLISH
an event was published to active objects
@ QS_USER1
offset for User Group 1
@ QS_MTX_UNLOCK
a mutex was unlocked
QS_preType
Enumerates data elements for app-specific trace records.
@ QS_STR_T
zero-terminated ASCII string format
@ QS_U64_T
unsigned 64-bit integer format
@ QS_MEM_T
up to 255-bytes memory block format
@ QS_OBJ_T
object pointer format
@ QS_F32_T
32-bit floating point format
@ QS_SIG_T
event signal format
@ QS_I8_ENUM_T
signed 8-bit integer or enum format
@ QS_U8_T
unsigned 8-bit integer format
@ QS_I64_T
signed 64-bit integer format
@ QS_FUN_T
function pointer format
@ QS_F64_T
64-bit floating point format
@ QS_U32_T
unsigned 32-bit integer format
@ QS_I32_T
signed 32-bit integer format
@ QS_I16_T
signed 16-bit integer format
@ QS_U16_T
unsigned 16-bit integer format
@ QS_TE_RECORDS
Time Events QS records.
@ QS_MTX_BLOCK
a mutex blocked a thread
@ QS_SEM_BLOCK_ATTEMPT
a semaphore blocked was attempted
@ SM_OBJ
state machine object
@ QS_QF_ACTIVE_POST_LIFO
an event was posted (LIFO) directly to AO
@ QS_QEP_TRAN_EP
a tran to entry point into a submachine
@ QS_QEP_STATE_EXIT
a state was exited
@ QS_TARGET_DONE
reports completion of a user callback
@ QS_EP_IDS
event-pool IDs
@ QS_USER
the first record available to QS users
@ QS_MTX_LOCK_ATTEMPT
a mutex lock was attempted
@ QS_QF_GC_ATTEMPT
garbage collection attempt
@ QS_QF_CRIT_ENTRY
critical section was entered
@ QS_QF_MPOOL_PUT
a memory block was returned to memory pool
@ QS_QF_EQUEUE_POST_ATTEMPT
attempt to post evt to QEQueue failed
@ QS_PRE_MAX
the # predefined signals
@ QS_QF_GC
garbage collection
@ QS_QF_ACTIVE_GET
AO got an event and its queue is not empty.
@ QS_AO_IDS
AO IDs (priorities)
@ QS_QF_CRIT_EXIT
critical section was exited
@ QS_SM_RECORDS
State Machine QS records.
@ QS_QF_TIMEEVT_POST
a time event posted itself directly to an AO
@ QS_QF_INT_DISABLE
interrupts were disabled
@ QS_OBJ_DICT
object dictionary entry
@ QS_QF_MPOOL_GET
a memory block was removed from memory pool
@ QS_MTX_UNLOCK_ATTEMPT
a mutex unlock was attempted
@ QS_QF_TIMEEVT_DISARM_ATTEMPT
attempt to disarm a disarmed QTimeEvt
void QS_TR_ISR_EXIT(uint_fast8_t isrnest, uint_fast8_t prio)
@ QS_SEM_TAKE
a semaphore was taken by a thread
@ QS_U0_RECORDS
User Group 100-104 records.
@ QS_QF_ACTIVE_RECALL_ATTEMPT
AO attempted to recall an event.
@ QS_QEP_INIT_TRAN
the top-most initial transition was taken
@ QS_TARGET_INFO
reports the Target information
@ QS_QEP_INTERN_TRAN
an internal transition was taken
@ QS_SEM_SIGNAL
a semaphore was signaled
@ QS_QEP_TRAN_XP
a tran to exit point out of a submachine
@ QS_RX_STATUS
reports QS data receive status
@ QS_EQ_ID
offset for event-queue IDs
@ QS_U3_RECORDS
User Group 115-119 records.
@ QS_SCHED_IDLE
scheduler restored the idle task
@ QS_QF_EQUEUE_POST_LIFO
an event was posted (LIFO) to a raw queue
@ QS_QEP_STATE_ENTRY
a state was entered
@ QS_MTX_RECORDS
Mutex QS records.
@ QS_SCHED_PREEMPT
scheduler asynchronously preempted a task
@ QS_EP_ID
offset for event-pool IDs
@ QS_QEP_UNHANDLED
an event was un-handled due to a guard
@ QS_QF_ACTIVE_POST_ATTEMPT
attempt to post an evt to AO failed
@ QS_QEP_TRAN
a regular transition was taken
@ QS_U4_RECORDS
User Group 120-124 records.
@ QS_QF_EQUEUE_GET
get an event and queue still not empty
@ QS_QF_ISR_ENTRY
an ISR was entered
@ QS_AO_RECORDS
Active Object QS records.
@ QS_QF_NEW_ATTEMPT
an attempt to allocate an event failed
@ TE_OBJ
time event object
@ QS_QF_ISR_EXIT
an ISR was exited
@ QS_QF_TICK
QTimeEvt tick was called.
@ QS_SEM_RECORDS
Semaphore QS records.
@ QS_QF_ACTIVE_UNSUBSCRIBE
an AO unsubscribed to an event
@ QS_QEP_DISPATCH
an event was dispatched (begin of RTC step)
@ QS_QF_ACTIVE_DEFER
AO deferred an event.
@ QS_AP_ID
offset for Application-specific IDs
@ QS_SCHED_LOCK
scheduler was locked
@ QS_QF_RECORDS
QF QS records.
@ QS_QF_NEW_REF
new event reference was created
@ QS_TEST_PAUSED
test has been paused
@ QS_SC_RECORDS
Scheduler QS records.
@ QS_SCHED_UNLOCK
scheduler was unlocked
@ QS_AO_ID
offset for AO priorities
@ AP_OBJ
generic Application-specific object
@ QS_EMPTY
QS record for cleanly starting a session.
@ QS_EQ_IDS
event-queue IDs
@ QS_USER2
offset for User Group 2
@ QS_QF_ACTIVE_POST
an event was posted (FIFO) directly to AO
@ QS_SIG_DICT
signal dictionary entry
@ SM_AO_OBJ
combination of SM and AO
@ QS_U1_RECORDS
User Group 105-109 records.
@ QS_EQ_RECORDS
Event Queues QS records.
@ QS_QUERY_DATA
reports the data from "current object" query
@ QS_QF_TIMEEVT_ARM
a time event was armed
@ QS_QEP_IGNORED
an event was ignored (silently discarded)
@ QS_USR_DICT
user QS record dictionary entry
@ QS_QF_NEW
new event was created
@ QS_QF_EQUEUE_POST
an event was posted (FIFO) to a raw queue
@ QS_QF_ACTIVE_GET_LAST
AO got an event and its queue is empty.
@ QS_ALL_RECORDS
all maskable QS records
@ QS_SCHED_NEXT
scheduler started next task
@ QS_PEEK_DATA
reports the data from the PEEK query
@ QS_MTX_LOCK
a mutex was locked
@ QS_SCHED_RESTORE
scheduler restored preempted task
@ QS_UA_RECORDS
All User records.
@ MP_OBJ
event pool object
@ QS_USER4
offset for User Group 4
@ QS_QF_ACTIVE_SUBSCRIBE
an AO subscribed to an event
@ QS_MTX_BLOCK_ATTEMPT
a mutex blocking was attempted
@ QS_AP_IDS
Application-specific IDs.
Dummy Active Object for testing.
Active object class (based on the QHsm implementation strategy)
Abstract State Machine class (state machine interface)
Dummy HSM class for testing.
Set of Active Objects of up to QF_MAX_ACTIVE elements.
QS type for output filters (global and local)
QUTest Test-Probe attributes.
Software tracing instrumentation, target-resident component (QS namespace emulated as a "class" in C)
void QS_onTestPost(void const *sender, QActive *recipient, QEvt const *e, bool status)
void QS_onTestSetup(void)
QSTimeCtr QS_onGetTime(void)
uint8_t QS_onStartup(void const *arg)
void QS_onTestTeardown(void)
void QS_initBuf(uint8_t *const sto, uint_fast32_t const stoSize)
void QS_onTestEvt(QEvt *e)
static bool QS_rxPut(uint8_t const b)
void QS_onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3)
QS ID type for applying local filtering.