QTools  7.0.0
Collection of Host-Based Tools
qspy.h File Reference

Host API. More...

Go to the source code of this file.

Data Structures

struct  QSpyRecord
 
struct  QSpyConfig
 
struct  QSPY_LastOutput
 
struct  QSpyRecRender
 
struct  DictEntry
 
struct  Dictionary
 
struct  SigDictEntry
 
struct  SigDictionary
 

Macros

#define QSPY_VER   "7.0.0"
 
#define QS_LINE_OFFSET   8
 
#define SNPRINTF_LINE(format_, ...)
 
#define SNPRINTF_APPEND(format_, ...)
 
#define CONFIG_UPDATE(member_, new_, diff_)
 

Typedefs

typedef int(* QSPY_CustParseFun) (QSpyRecord *const me)
 
typedef void(* QSPY_resetFun) (void)
 
typedef uint64_t KeyType
 
typedef uint32_t SigType
 
typedef uint64_t ObjType
 

Enumerations

enum  QSpyStatus { QSPY_ERROR , QSPY_SUCCESS }
 
enum  {
  QS_RECORD_SIZE_MAX = 512 , QS_LINE_LEN_MAX = 1000 , QS_FNAME_LEN_MAX = 256 , QS_SEQ_LIST_LEN_MAX = 300 ,
  QS_DNAME_LEN_MAX = 64
}
 
enum  QSPY_LastOutputType { REG_OUT , INF_OUT , ERR_OUT }
 
enum  QSRreRecGroup {
  GRP_ERR , GRP_INF , GRP_DIC , GRP_TST ,
  GRP_SM , GRP_AO , GRP_EQ , GRP_MP ,
  GRP_TE , GRP_QF , GRP_SC , GRP_USR
}
 

Functions

void QSpyRecord_init (QSpyRecord *const me, uint8_t const *start, uint32_t tot_len)
 
QSpyStatus QSpyRecord_OK (QSpyRecord *const me)
 
uint32_t QSpyRecord_getUint32 (QSpyRecord *const me, uint8_t size)
 
int32_t QSpyRecord_getInt32 (QSpyRecord *const me, uint8_t size)
 
uint64_t QSpyRecord_getUint64 (QSpyRecord *const me, uint8_t size)
 
int64_t QSpyRecord_getInt64 (QSpyRecord *const me, uint8_t size)
 
char const * QSpyRecord_getStr (QSpyRecord *const me)
 
uint8_t const * QSpyRecord_getMem (QSpyRecord *const me, uint8_t size, uint32_t *pNum)
 
void QSPY_config (QSpyConfig const *config, QSPY_CustParseFun custParseFun)
 
void QSPY_configTxReset (QSPY_resetFun txResetFun)
 
void QSPY_configMatFile (void *matFile)
 
void QSPY_reset (void)
 
void QSPY_parse (uint8_t const *buf, uint32_t nBytes)
 
void QSPY_txReset (void)
 
bool QSPY_command (uint8_t cmdId)
 
void QSPY_sendEvt (QSpyRecord const *const qrec)
 
void QSPY_sendObj (QSpyRecord const *const qrec)
 
void QSPY_sendCmd (QSpyRecord const *const qrec)
 
void QSPY_sendTP (QSpyRecord const *const qrec)
 
uint32_t QSPY_encode (uint8_t *dstBuf, uint32_t dstSize, uint8_t const *srcBuf, uint32_t srcBytes)
 
uint32_t QSPY_encodeResetCmd (uint8_t *dstBuf, uint32_t dstSize)
 
uint32_t QSPY_encodeInfoCmd (uint8_t *dstBuf, uint32_t dstSize)
 
uint32_t QSPY_encodeTickCmd (uint8_t *dstBuf, uint32_t dstSize, uint8_t rate)
 
SigType QSPY_findSig (char const *name, ObjType obj)
 
KeyType QSPY_findObj (char const *name)
 
KeyType QSPY_findFun (char const *name)
 
KeyType QSPY_findUsr (char const *name)
 
void QSPY_cleanup (void)
 
char const * QSPY_tstampStr (void)
 
void QSPY_onPrintLn (void)
 
void QSPY_printInfo (void)
 
void QSPY_printError (void)
 
void Dictionary_ctor (Dictionary *const me, DictEntry *sto, uint32_t capacity)
 
void Dictionary_config (Dictionary *const me, int keySize)
 
char const * Dictionary_at (Dictionary *const me, unsigned idx)
 
void Dictionary_put (Dictionary *const me, KeyType key, char const *name)
 
char const * Dictionary_get (Dictionary *const me, KeyType key, char *buf)
 
int Dictionary_find (Dictionary *const me, KeyType key)
 
KeyType Dictionary_findKey (Dictionary *const me, char const *name)
 
void Dictionary_reset (Dictionary *const me)
 
void SigDictionary_ctor (SigDictionary *const me, SigDictEntry *sto, uint32_t capacity)
 
void SigDictionary_config (SigDictionary *const me, int ptrSize)
 
void SigDictionary_put (SigDictionary *const me, SigType sig, ObjType obj, char const *name)
 
char const * SigDictionary_get (SigDictionary *const me, SigType sig, ObjType obj, char *buf)
 
int SigDictionary_find (SigDictionary *const me, SigType sig, ObjType obj)
 
SigType SigDictionary_findSig (SigDictionary *const me, char const *name, ObjType obj)
 
void SigDictionary_reset (SigDictionary *const me)
 
void QSPY_resetAllDictionaries (void)
 

Variables

QSPY_LastOutput QSPY_output
 
char const *const QSPY_line
 
QSpyRecRender const QSPY_rec []
 

Detailed Description

Date
Last updated on: 2022-03-12
Version
Last updated for version: 7.0.0

Definition in file qspy.h.


Data Structure Documentation

◆ QSpyRecord

struct QSpyRecord

QSPY record being processed

Definition at line 49 of file qspy.h.

Data Fields
uint8_t const * start

start of the record

uint8_t const * pos

current position in the stream

uint32_t tot_len

total length of the record, including chksum

int32_t len

current length of the stream

uint8_t rec

the record-ID (see enum QSpyRecords in qs.h)

◆ QSpyConfig

struct QSpyConfig

QSPY configuration parameters.

See also
QSPY_config()

Definition at line 84 of file qspy.h.

Data Fields
uint16_t version
uint8_t endianness
uint8_t objPtrSize
uint8_t funPtrSize
uint8_t tstampSize
uint8_t sigSize
uint8_t evtSize
uint8_t queueCtrSize
uint8_t poolCtrSize
uint8_t poolBlkSize
uint8_t tevtCtrSize
uint8_t tstamp[6]

◆ QSPY_LastOutput

struct QSPY_LastOutput

Definition at line 144 of file qspy.h.

Data Fields
char buf[QS_LINE_OFFSET+QS_LINE_LEN_MAX]
int len
int rec
int type
int rx_status

◆ QSpyRecRender

struct QSpyRecRender

Definition at line 167 of file qspy.h.

Data Fields
char const * name
int const group

◆ DictEntry

struct DictEntry

Definition at line 213 of file qspy.h.

Data Fields
KeyType key
char name[QS_DNAME_LEN_MAX]

◆ Dictionary

struct Dictionary

Definition at line 218 of file qspy.h.

Data Fields
DictEntry notFound
DictEntry * sto
int capacity
int entries
int keySize

◆ SigDictEntry

struct SigDictEntry

Definition at line 236 of file qspy.h.

Data Fields
SigType sig
ObjType obj
char name[QS_DNAME_LEN_MAX]

◆ SigDictionary

struct SigDictionary

Definition at line 242 of file qspy.h.

Data Fields
SigDictEntry notFound
SigDictEntry * sto
int capacity
int entries
int ptrSize

Macro Definition Documentation

◆ QSPY_VER

#define QSPY_VER   "7.0.0"

Definition at line 36 of file qspy.h.

◆ QS_LINE_OFFSET

#define QS_LINE_OFFSET   8

Definition at line 142 of file qspy.h.

◆ SNPRINTF_LINE

#define SNPRINTF_LINE (   format_,
  ... 
)
Value:
do { \
int n_ = SNPRINTF_S(&QSPY_output.buf[QS_LINE_OFFSET], \
format_, ##__VA_ARGS__); \
if ((0 < n_) && (n_ < QS_LINE_LEN_MAX - QS_LINE_OFFSET)) { \
QSPY_output.len = n_; \
} \
else { \
QSPY_output.len = QS_LINE_LEN_MAX - QS_LINE_OFFSET; \
} \
} while (0)
@ QS_LINE_LEN_MAX
Definition: qspy.h:60
char buf[QS_LINE_OFFSET+QS_LINE_LEN_MAX]
Definition: qspy.h:145
QSPY_LastOutput QSPY_output
#define QS_LINE_OFFSET
Definition: qspy.h:142

Definition at line 181 of file qspy.h.

◆ SNPRINTF_APPEND

#define SNPRINTF_APPEND (   format_,
  ... 
)
Value:
do { \
int n_ = SNPRINTF_S(&QSPY_output.buf[QS_LINE_OFFSET + QSPY_output.len],\
format_, ##__VA_ARGS__); \
if ((0 < n_) \
QSPY_output.len += n_; \
} \
else { \
QSPY_output.len = QS_LINE_LEN_MAX - QS_LINE_OFFSET; \
} \
} while (0)

Definition at line 193 of file qspy.h.

◆ CONFIG_UPDATE

#define CONFIG_UPDATE (   member_,
  new_,
  diff_ 
)
Value:
if (QSPY_conf.member_ != (new_)) { \
QSPY_conf.member_ = (new_); \
(diff_) = 1U; \
} else (void)0

Definition at line 206 of file qspy.h.

Typedef Documentation

◆ QSPY_CustParseFun

typedef int(* QSPY_CustParseFun) (QSpyRecord *const me)

Definition at line 67 of file qspy.h.

◆ QSPY_resetFun

typedef void(* QSPY_resetFun) (void)

Definition at line 68 of file qspy.h.

◆ KeyType

typedef uint64_t KeyType

Definition at line 99 of file qspy.h.

◆ SigType

typedef uint32_t SigType

Definition at line 100 of file qspy.h.

◆ ObjType

typedef uint64_t ObjType

Definition at line 101 of file qspy.h.

Enumeration Type Documentation

◆ QSpyStatus

enum QSpyStatus

low-level facilities for configuring QSpy and parsing QS records ...

Enumerator
QSPY_ERROR 
QSPY_SUCCESS 

Definition at line 43 of file qspy.h.

◆ anonymous enum

anonymous enum
Enumerator
QS_RECORD_SIZE_MAX 
QS_LINE_LEN_MAX 
QS_FNAME_LEN_MAX 
QS_SEQ_LIST_LEN_MAX 
QS_DNAME_LEN_MAX 

Definition at line 58 of file qspy.h.

◆ QSPY_LastOutputType

Enumerator
REG_OUT 
INF_OUT 
ERR_OUT 

Definition at line 143 of file qspy.h.

◆ QSRreRecGroup

Enumerator
GRP_ERR 
GRP_INF 
GRP_DIC 
GRP_TST 
GRP_SM 
GRP_AO 
GRP_EQ 
GRP_MP 
GRP_TE 
GRP_QF 
GRP_SC 
GRP_USR 

Definition at line 152 of file qspy.h.

Function Documentation

◆ QSpyRecord_init()

void QSpyRecord_init ( QSpyRecord *const  me,
uint8_t const *  start,
uint32_t  tot_len 
)

◆ QSpyRecord_OK()

QSpyStatus QSpyRecord_OK ( QSpyRecord *const  me)

◆ QSpyRecord_getUint32()

uint32_t QSpyRecord_getUint32 ( QSpyRecord *const  me,
uint8_t  size 
)

◆ QSpyRecord_getInt32()

int32_t QSpyRecord_getInt32 ( QSpyRecord *const  me,
uint8_t  size 
)

◆ QSpyRecord_getUint64()

uint64_t QSpyRecord_getUint64 ( QSpyRecord *const  me,
uint8_t  size 
)

◆ QSpyRecord_getInt64()

int64_t QSpyRecord_getInt64 ( QSpyRecord *const  me,
uint8_t  size 
)

◆ QSpyRecord_getStr()

char const * QSpyRecord_getStr ( QSpyRecord *const  me)

◆ QSpyRecord_getMem()

uint8_t const * QSpyRecord_getMem ( QSpyRecord *const  me,
uint8_t  size,
uint32_t *  pNum 
)

◆ QSPY_config()

void QSPY_config ( QSpyConfig const *  config,
QSPY_CustParseFun  custParseFun 
)

◆ QSPY_configTxReset()

void QSPY_configTxReset ( QSPY_resetFun  txResetFun)

◆ QSPY_configMatFile()

void QSPY_configMatFile ( void *  matFile)

◆ QSPY_reset()

void QSPY_reset ( void  )

◆ QSPY_parse()

void QSPY_parse ( uint8_t const *  buf,
uint32_t  nBytes 
)

◆ QSPY_txReset()

void QSPY_txReset ( void  )

◆ QSPY_command()

bool QSPY_command ( uint8_t  cmdId)

◆ QSPY_sendEvt()

void QSPY_sendEvt ( QSpyRecord const *const  qrec)

◆ QSPY_sendObj()

void QSPY_sendObj ( QSpyRecord const *const  qrec)

◆ QSPY_sendCmd()

void QSPY_sendCmd ( QSpyRecord const *const  qrec)

◆ QSPY_sendTP()

void QSPY_sendTP ( QSpyRecord const *const  qrec)

◆ QSPY_encode()

uint32_t QSPY_encode ( uint8_t *  dstBuf,
uint32_t  dstSize,
uint8_t const *  srcBuf,
uint32_t  srcBytes 
)

◆ QSPY_encodeResetCmd()

uint32_t QSPY_encodeResetCmd ( uint8_t *  dstBuf,
uint32_t  dstSize 
)

◆ QSPY_encodeInfoCmd()

uint32_t QSPY_encodeInfoCmd ( uint8_t *  dstBuf,
uint32_t  dstSize 
)

◆ QSPY_encodeTickCmd()

uint32_t QSPY_encodeTickCmd ( uint8_t *  dstBuf,
uint32_t  dstSize,
uint8_t  rate 
)

◆ QSPY_findSig()

SigType QSPY_findSig ( char const *  name,
ObjType  obj 
)

◆ QSPY_findObj()

KeyType QSPY_findObj ( char const *  name)

◆ QSPY_findFun()

KeyType QSPY_findFun ( char const *  name)

◆ QSPY_findUsr()

KeyType QSPY_findUsr ( char const *  name)

◆ QSPY_cleanup()

void QSPY_cleanup ( void  )

◆ QSPY_tstampStr()

char const * QSPY_tstampStr ( void  )

◆ QSPY_onPrintLn()

void QSPY_onPrintLn ( void  )

◆ QSPY_printInfo()

void QSPY_printInfo ( void  )

◆ QSPY_printError()

void QSPY_printError ( void  )

◆ Dictionary_ctor()

void Dictionary_ctor ( Dictionary *const  me,
DictEntry sto,
uint32_t  capacity 
)

◆ Dictionary_config()

void Dictionary_config ( Dictionary *const  me,
int  keySize 
)

◆ Dictionary_at()

char const * Dictionary_at ( Dictionary *const  me,
unsigned  idx 
)

◆ Dictionary_put()

void Dictionary_put ( Dictionary *const  me,
KeyType  key,
char const *  name 
)

◆ Dictionary_get()

char const * Dictionary_get ( Dictionary *const  me,
KeyType  key,
char *  buf 
)

◆ Dictionary_find()

int Dictionary_find ( Dictionary *const  me,
KeyType  key 
)

◆ Dictionary_findKey()

KeyType Dictionary_findKey ( Dictionary *const  me,
char const *  name 
)

◆ Dictionary_reset()

void Dictionary_reset ( Dictionary *const  me)

◆ SigDictionary_ctor()

void SigDictionary_ctor ( SigDictionary *const  me,
SigDictEntry sto,
uint32_t  capacity 
)

◆ SigDictionary_config()

void SigDictionary_config ( SigDictionary *const  me,
int  ptrSize 
)

◆ SigDictionary_put()

void SigDictionary_put ( SigDictionary *const  me,
SigType  sig,
ObjType  obj,
char const *  name 
)

◆ SigDictionary_get()

char const * SigDictionary_get ( SigDictionary *const  me,
SigType  sig,
ObjType  obj,
char *  buf 
)

◆ SigDictionary_find()

int SigDictionary_find ( SigDictionary *const  me,
SigType  sig,
ObjType  obj 
)

◆ SigDictionary_findSig()

SigType SigDictionary_findSig ( SigDictionary *const  me,
char const *  name,
ObjType  obj 
)

◆ SigDictionary_reset()

void SigDictionary_reset ( SigDictionary *const  me)

◆ QSPY_resetAllDictionaries()

void QSPY_resetAllDictionaries ( void  )

Variable Documentation

◆ QSPY_output

QSPY_LastOutput QSPY_output
extern

◆ QSPY_line

char const* const QSPY_line
extern

◆ QSPY_rec

QSpyRecRender const QSPY_rec[]
extern