QP/C 6.9.0
qs_pkg.h
Go to the documentation of this file.
1 
40 #ifndef QS_PKG_H
41 #define QS_PKG_H
42 
43 /****************************************************************************/
50 #define QS_BEGIN_PRE_(rec_, objFilter_, obj_) \
51  if ((((uint_fast8_t)QS_priv_.glbFilter[(uint8_t)(rec_) >> 3] \
52  & (uint_fast8_t)(1U << ((uint8_t)(rec_) & 7U))) != 0U) \
53  && (((objFilter_) == (void *)0) \
54  || ((objFilter_) == (obj_)))) \
55  { \
56  QS_CRIT_ENTRY_(); \
57  QS_beginRec_((uint_fast8_t)(rec_));
58 
65 #define QS_END_PRE_() \
66  QS_endRec_(); \
67  QS_CRIT_EXIT_(); \
68  }
69 
76 #define QS_BEGIN_NOCRIT_PRE_(rec_, objFilter_, obj_) \
77  if ((((uint_fast8_t)QS_priv_.glbFilter[(uint8_t)(rec_) >> 3]\
78  & (uint_fast8_t)(1U << ((uint8_t)(rec_) & 7U))) != 0U) \
79  && (((objFilter_) == (void *)0) \
80  || ((objFilter_) == (obj_)))) \
81  { \
82  QS_beginRec_((uint_fast8_t)(rec_));
83 
90 #define QS_END_NOCRIT_PRE_() QS_endRec_(); }
91 
93 #define QS_U8_PRE_(data_) (QS_u8_raw_((uint8_t)(data_)))
94 
96 #define QS_2U8_PRE_(data1_, data2_) \
97  (QS_2u8_raw_((uint8_t)(data1_), (uint8_t)(data2_)))
98 
100 #define QS_U16_PRE_(data_) (QS_u16_raw_((uint16_t)(data_)))
101 
103 #define QS_U32_PRE_(data_) (QS_u32_raw_((uint32_t)(data_)))
104 
106 #define QS_STR_PRE_(msg_) (QS_str_raw_((msg_)))
107 
108 
109 #if (Q_SIGNAL_SIZE == 1U)
110 
114  #define QS_SIG_PRE_(sig_) (QS_u8_raw_((uint8_t)sig_))
115 #elif (Q_SIGNAL_SIZE == 2U)
116  #define QS_SIG_PRE_(sig_) (QS_u16_raw_((uint16_t)sig_))
117 #elif (Q_SIGNAL_SIZE == 4U)
118  #define QS_SIG_PRE_(sig_) (QS_u32_raw_((uint32_t)sig_))
119 #endif
120 
121 #define QS_OBJ_PRE_(obj_) (QS_obj_raw_(obj_))
122 
123 #if (QS_FUN_PTR_SIZE == 1U)
124  #define QS_FUN_PRE_(fun_) (QS_u8_raw_((uint8_t)(fun_)))
125 #elif (QS_FUN_PTR_SIZE == 2U)
126  #define QS_FUN_PRE_(fun_) (QS_u16_raw_((uint16_t)(fun_)))
127 #elif (QS_FUN_PTR_SIZE == 4U)
128  #define QS_FUN_PRE_(fun_) (QS_u32_raw_((uint32_t)(fun_)))
129 #elif (QS_FUN_PTR_SIZE == 8U)
130  #define QS_FUN_PRE_(fun_) (QS_u64_raw_((uint64_t)(fun_)))
131 #else
132 
136  #define QS_FUN_PRE_(fun_) (QS_u32_raw_((uint32_t)(fun_)))
137 #endif
138 
139 
140 /****************************************************************************/
141 #if (QF_EQUEUE_CTR_SIZE == 1U)
142 
148  #define QS_EQC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
149 #elif (QF_EQUEUE_CTR_SIZE == 2U)
150  #define QS_EQC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
151 #elif (QF_EQUEUE_CTR_SIZE == 4U)
152  #define QS_EQC_PRE_(ctr_) QS_u32_raw_((uint32_t)(ctr_))
153 #endif
154 
155 
156 #if (QF_EVENT_SIZ_SIZE == 1U)
157 
163  #define QS_EVS_PRE_(size_) QS_u8_raw_((uint8_t)(size_))
164 #elif (QF_EVENT_SIZ_SIZE == 2U)
165  #define QS_EVS_PRE_(size_) QS_u16_raw_((uint16_t)(size_))
166 #elif (QF_EVENT_SIZ_SIZE == 4U)
167  #define QS_EVS_PRE_(size_) QS_u32_raw_((uint32_t)(size_))
168 #endif
169 
170 
171 #if (QF_MPOOL_SIZ_SIZE == 1U)
172 
178  #define QS_MPS_PRE_(size_) QS_u8_raw_((uint8_t)(size_))
179 #elif (QF_MPOOL_SIZ_SIZE == 2U)
180  #define QS_MPS_PRE_(size_) QS_u16_raw_((uint16_t)(size_))
181 #elif (QF_MPOOL_SIZ_SIZE == 4U)
182  #define QS_MPS_PRE_(size_) QS_u32_raw_((uint32_t)(size_))
183 #endif
184 
185 #if (QF_MPOOL_CTR_SIZE == 1U)
186 
192  #define QS_MPC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
193 #elif (QF_MPOOL_CTR_SIZE == 2U)
194  #define QS_MPC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
195 #elif (QF_MPOOL_CTR_SIZE == 4U)
196  #define QS_MPC_PRE_(ctr_) QS_u32_raw_((uint16_t)(ctr_))
197 #endif
198 
199 
200 #if (QF_TIMEEVT_CTR_SIZE == 1U)
201 
207  #define QS_TEC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
208 #elif (QF_TIMEEVT_CTR_SIZE == 2U)
209  #define QS_TEC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
210 #elif (QF_TIMEEVT_CTR_SIZE == 4U)
211  #define QS_TEC_PRE_(ctr_) QS_u32_raw_((uint32_t)(ctr_))
212 #endif
213 
214 
215 /****************************************************************************/
217 #define QS_INSERT_BYTE_(b_) \
218  buf[head] = (b_); \
219  ++head; \
220  if (head == end) { \
221  head = 0U; \
222  }
223 
224 /****************************************************************************/
226 #define QS_INSERT_ESC_BYTE_(b_) \
227  chksum = (uint8_t)(chksum + (b_)); \
228  if (((b_) != QS_FRAME) && ((b_) != QS_ESC)) { \
229  QS_INSERT_BYTE_(b_) \
230  } \
231  else { \
232  QS_INSERT_BYTE_(QS_ESC) \
233  QS_INSERT_BYTE_((uint8_t)((b_) ^ QS_ESC_XOR))\
234  ++QS_priv_.used; \
235  }
236 
237 /****************************************************************************/
239 #define QS_FRAME (0x7EU)
240 
241 /****************************************************************************/
243 #define QS_ESC (0x7DU)
244 
245 /****************************************************************************/
247 #define QS_GOOD_CHKSUM (0xFFU)
248 
249 /****************************************************************************/
256 #define QS_ESC_XOR (0x20U)
257 
258 /****************************************************************************/
261 void QS_target_info_pre_(uint8_t isReset);
262 
263 /****************************************************************************/
264 extern char_t const Q_BUILD_DATE[12];
265 extern char_t const Q_BUILD_TIME[9];
266 
267 /****************************************************************************/
271 typedef struct {
272  void *currObj[MAX_OBJ];
277 #ifdef Q_UTEST
279  bool inTestLoop;
280 #endif
281 } QSrxPrivAttr;
282 
283 extern QSrxPrivAttr QS_rxPriv_; /* QS-RX private attributes */
284 
285 #endif /* QS_PKG_H */
286 
QSrxPrivAttr::end
QSCtr end
offset of the end of the ring buffer
Definition: qs_pkg.h:274
uint8_t
unsigned char uint8_t
exact-width 8-bit unsigned int
Definition: 16bit/stdint.h:29
QSrxPrivAttr::head
QSCtr head
offset to where next byte will be inserted
Definition: qs_pkg.h:275
Q_BUILD_DATE
char_t const Q_BUILD_DATE[12]
the calendar date of the last translation of the form: "Mmm dd yyyy"
Definition: qstamp.c:16
QSrxPrivAttr::inTestLoop
bool inTestLoop
QUTEST event loop is running.
Definition: qs_pkg.h:279
MAX_OBJ
@ MAX_OBJ
Definition: qs.h:981
QSrxPrivAttr::tail
QSCtr tail
offset of where next byte will be extracted
Definition: qs_pkg.h:276
QSCtr
uint_fast16_t QSCtr
QS ring buffer counter and offset type.
Definition: qs.h:971
QSrxPrivAttr
Private QS-RX attributes to keep track of the current objects and the lock-free RX buffer.
Definition: qs_pkg.h:271
Q_BUILD_TIME
char_t const Q_BUILD_TIME[9]
the time of the last translation of the form: "hh:mm:ss"
Definition: qstamp.c:19
QSrxPrivAttr::buf
uint8_t * buf
pointer to the start of the ring buffer
Definition: qs_pkg.h:273
char_t
char char_t
typedef for character strings.
Definition: qassert.h:77
QS_rxPriv_
QSrxPrivAttr QS_rxPriv_
Definition: qs_rx.c:48
QSrxPrivAttr::readySet
QPSet readySet
QUTEST ready-set of active objects.
Definition: qs_pkg.h:278
QPSet
Priority Set of up to 32 elements.
Definition: qpset.h:68
QS_target_info_pre_
void QS_target_info_pre_(uint8_t isReset)
send the predefined target info trace record (object sizes, build time-stamp, QP version)
Definition: qs.c:363