QP/C
qs.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 * Product: QP/C
00003 * Last Updated for Version: 4.5.04
00004 * Date of the Last Update:  Feb 01, 2013
00005 *
00006 *                    Q u a n t u m     L e a P s
00007 *                    ---------------------------
00008 *                    innovating embedded systems
00009 *
00010 * Copyright (C) 2002-2013 Quantum Leaps, LLC. All rights reserved.
00011 *
00012 * This program is open source software: you can redistribute it and/or
00013 * modify it under the terms of the GNU General Public License as published
00014 * by the Free Software Foundation, either version 2 of the License, or
00015 * (at your option) any later version.
00016 *
00017 * Alternatively, this program may be distributed and modified under the
00018 * terms of Quantum Leaps commercial licenses, which expressly supersede
00019 * the GNU General Public License and are specifically designed for
00020 * licensees interested in retaining the proprietary status of their code.
00021 *
00022 * This program is distributed in the hope that it will be useful,
00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00025 * GNU General Public License for more details.
00026 *
00027 * You should have received a copy of the GNU General Public License
00028 * along with this program. If not, see <http://www.gnu.org/licenses/>.
00029 *
00030 * Contact information:
00031 * Quantum Leaps Web sites: http://www.quantum-leaps.com
00032 *                          http://www.state-machine.com
00033 * e-mail:                  info@quantum-leaps.com
00034 *****************************************************************************/
00035 #ifndef qs_h
00036 #define qs_h
00037 
00047 #ifndef Q_SPY
00048     #error "Q_SPY must be defined to include qs.h"
00049 #endif
00050 
00051 /****************************************************************************/
00059 enum QSpyRecords {
00060     QS_QP_RESET,              
00062     /* QEP records */
00063     QS_QEP_STATE_ENTRY,                            
00064     QS_QEP_STATE_EXIT,                              
00065     QS_QEP_STATE_INIT,       
00066     QS_QEP_INIT_TRAN,        
00067     QS_QEP_INTERN_TRAN,               
00068     QS_QEP_TRAN,                        
00069     QS_QEP_IGNORED,          
00070     QS_QEP_DISPATCH,       
00071     QS_QEP_UNHANDLED,            
00073     /* QF records */
00074     QS_QF_ACTIVE_ADD,             
00075     QS_QF_ACTIVE_REMOVE,      
00076     QS_QF_ACTIVE_SUBSCRIBE,               
00077     QS_QF_ACTIVE_UNSUBSCRIBE,           
00078     QS_QF_ACTIVE_POST_FIFO,  
00079     QS_QF_ACTIVE_POST_LIFO,  
00080     QS_QF_ACTIVE_GET, 
00081     QS_QF_ACTIVE_GET_LAST,      
00082     QS_QF_EQUEUE_INIT,                  
00083     QS_QF_EQUEUE_POST_FIFO,  
00084     QS_QF_EQUEUE_POST_LIFO,  
00085     QS_QF_EQUEUE_GET,           
00086     QS_QF_EQUEUE_GET_LAST,           
00087     QS_QF_MPOOL_INIT,                    
00088     QS_QF_MPOOL_GET,     
00089     QS_QF_MPOOL_PUT,      
00090     QS_QF_PUBLISH,                              
00091     QS_QF_RESERVED8,
00092     QS_QF_NEW,                                      
00093     QS_QF_GC_ATTEMPT,                       
00094     QS_QF_GC,                                       
00095     QS_QF_TICK,                                   
00096     QS_QF_TIMEEVT_ARM,                          
00097     QS_QF_TIMEEVT_AUTO_DISARM,   
00098     QS_QF_TIMEEVT_DISARM_ATTEMPT,
00099     QS_QF_TIMEEVT_DISARM,        
00100     QS_QF_TIMEEVT_REARM,                      
00101     QS_QF_TIMEEVT_POST,   
00102     QS_QF_TIMEEVT_CTR,              
00103     QS_QF_CRIT_ENTRY,                     
00104     QS_QF_CRIT_EXIT,                       
00105     QS_QF_ISR_ENTRY,                                
00106     QS_QF_ISR_EXIT,                                  
00107     QS_QF_INT_DISABLE,                        
00108     QS_QF_INT_ENABLE,                          
00109     QS_QF_RESERVED4,
00110     QS_QF_RESERVED3,
00111     QS_QF_RESERVED2,
00112     QS_QF_RESERVED1,
00113     QS_QF_RESERVED0,
00114 
00115     /* QK records */
00116     QS_QK_MUTEX_LOCK,                          
00117     QS_QK_MUTEX_UNLOCK,                      
00118     QS_QK_SCHEDULE,             
00119     QS_QK_RESERVED6,
00120     QS_QK_RESERVED5,
00121     QS_QK_RESERVED4,
00122     QS_QK_RESERVED3,
00123     QS_QK_RESERVED2,
00124     QS_QK_RESERVED1,
00125     QS_QK_RESERVED0,
00126 
00127     /* Miscellaneous QS records */
00128     QS_SIG_DIC,                                
00129     QS_OBJ_DIC,                                
00130     QS_FUN_DIC,                              
00131     QS_USR_DIC,                        
00132     QS_RESERVED4,
00133     QS_RESERVED3,
00134     QS_RESERVED2,
00135     QS_RESERVED1,
00136     QS_RESERVED0,
00137     QS_ASSERT,                             
00139     /* User records */
00140     QS_USER             
00141 };
00142 
00143 /* Global and Local QS filters .............................................*/
00144 extern uint8_t QS_glbFilter_[32];              
00145 extern void const *QS_smObj_;       
00146 extern void const *QS_aoObj_;        
00147 extern void const *QS_mpObj_;          
00148 extern void const *QS_eqObj_;           
00149 extern void const *QS_teObj_;          
00150 extern void const *QS_apObj_; 
00155 #define QS_ALL_RECORDS          ((uint8_t)0xFF)
00156 
00157 #ifndef QS_TIME_SIZE
00158 
00166     #define QS_TIME_SIZE 4
00167 #endif
00168 
00169 #if (QS_TIME_SIZE == 1)
00170     typedef uint8_t QSTimeCtr;
00171     #define QS_TIME_()          (QS_u8_(QS_onGetTime()))
00172 #elif (QS_TIME_SIZE == 2)
00173     typedef uint16_t QSTimeCtr;
00174     #define QS_TIME_()          (QS_u16_(QS_onGetTime()))
00175 #elif (QS_TIME_SIZE == 4)
00176 
00180     typedef uint32_t QSTimeCtr;
00183     #define QS_TIME_()          (QS_u32_(QS_onGetTime()))
00184 #else
00185     #error "QS_TIME_SIZE defined incorrectly, expected 1, 2, or 4"
00186 #endif
00187 
00189 extern QSTimeCtr QS_tickCtr_;
00190 
00191 #ifndef Q_ROM                   /* provide the default if Q_ROM NOT defined */
00192     #define Q_ROM
00193 #endif
00194 #ifndef Q_ROM_VAR           /* provide the default if Q_ROM_VAR NOT defined */
00195     #define Q_ROM_VAR
00196 #endif
00197 #ifndef Q_ROM_BYTE         /* provide the default if Q_ROM_BYTE NOT defined */
00198     #define Q_ROM_BYTE(rom_var_)   (rom_var_)
00199 #endif
00200 
00201 /*****************************************************************************
00202 * QS services.
00203 */
00204 /* public methods */
00211 char_t const Q_ROM * Q_ROM_VAR QS_getVersion(void);
00212 
00231 void QS_initBuf(uint8_t sto[], uint32_t stoSize);
00232 
00245 void QS_filterOn(uint8_t rec);
00246 
00258 void QS_filterOff(uint8_t rec);
00259 
00267 void QS_begin(uint8_t rec);
00268 
00276 void QS_end(void);
00277 
00278 /* unformatted data elements output ........................................*/
00283 void QS_u8_(uint8_t d);
00284 
00289 void QS_u16_(uint16_t d);
00290 
00295 void QS_u32_(uint32_t d);
00296 
00302 void QS_str_(char_t const *s);
00303 
00309 void QS_str_ROM_(char_t const Q_ROM * Q_ROM_VAR s);
00310 
00311 /* formatted data elements output ..........................................*/
00316 void QS_u8(uint8_t format, uint8_t d);
00317 
00322 void QS_u16(uint8_t format, uint16_t d);
00323 
00328 void QS_u32(uint8_t format, uint32_t d);
00329 
00334 void QS_f32(uint8_t format, float32_t f);
00335 
00340 void QS_f64(uint8_t format, float64_t d);
00341 
00346 void QS_str(char_t const *s);
00347 
00353 void QS_str_ROM(char_t const Q_ROM * Q_ROM_VAR s);
00354 
00359 void QS_mem(uint8_t const *blk, uint8_t size);
00360 
00361 #if (QS_OBJ_PTR_SIZE == 8) || (QS_FUN_PTR_SIZE == 8)
00362 
00366     void QS_u64_(uint64_t d);
00367 
00372     void QS_u64(uint8_t format, uint64_t d);
00373 #endif
00374 
00375 /* QS buffer access ........................................................*/
00385 uint16_t QS_getByte(void);
00386 
00390 #define QS_EOD ((uint16_t)0xFFFF)
00391 
00412 uint8_t const *QS_getBlock(uint16_t *pNbytes);
00413 
00414 /* platform-specific callback functions, need to be implemented by clients  */
00430 uint8_t QS_onStartup(void const *arg);
00431 
00439 void QS_onCleanup(void);
00440 
00448 void QS_onFlush(void);
00449 
00464 QSTimeCtr QS_onGetTime(void);
00465 
00466 
00467 /* Macros for adding QS instrumentation to the client code .................*/
00468 
00475 #define QS_INIT(arg_)           (QS_onStartup(arg_) != (uint8_t)0)
00476 
00483 #define QS_EXIT()               (QS_onCleanup())
00484 
00493 #define QS_FILTER_ON(rec_)      (QS_filterOn((uint8_t)(rec_)))
00494 
00502 #define QS_FILTER_OFF(rec_)     (QS_filterOff((uint8_t)(rec_)))
00503 
00528 #define QS_FILTER_SM_OBJ(obj_)  (QS_smObj_ = (obj_))
00529 
00548 #define QS_FILTER_AO_OBJ(obj_)  (QS_aoObj_ = (obj_))
00549 
00567 #define QS_FILTER_MP_OBJ(obj_)  (QS_mpObj_ = (obj_))
00568 
00586 #define QS_FILTER_EQ_OBJ(obj_)  (QS_eqObj_ = (obj_))
00587 
00606 #define QS_FILTER_TE_OBJ(obj_)  (QS_teObj_ = (obj_))
00607 
00622 #define QS_FILTER_AP_OBJ(obj_)  (QS_apObj_ = (obj_))
00623 
00624 /* Macros to generate user QS records ......................................*/
00625 
00628 #define QS_BEGIN_NOCRIT(rec_, obj_) \
00629     if (((QS_glbFilter_[(rec_) >> 3] \
00630           & (uint8_t)(1U << ((uint8_t)(rec_) & (uint8_t)7))) != (uint8_t)0) \
00631         && ((QS_apObj_ == (void *)0) || (QS_apObj_ == (obj_)))) \
00632     { \
00633         QS_begin((uint8_t)(rec_)); \
00634         QS_TIME_(); {
00635 
00638 #define QS_END_NOCRIT() } \
00639     QS_END_NOCRIT_()
00640 
00641                                             /* QS-specific critical section */
00642 #ifndef QF_CRIT_STAT_TYPE
00643 
00653     #define QS_CRIT_STAT_
00654 
00664     #define QS_CRIT_ENTRY_()    QF_CRIT_ENTRY(dummy)
00665 
00675     #define QS_CRIT_EXIT_()     QF_CRIT_EXIT(dummy)
00676 
00677 #else
00678     #define QS_CRIT_STAT_       QF_CRIT_STAT_TYPE critStat_;
00679     #define QS_CRIT_ENTRY_()    QF_CRIT_ENTRY(critStat_)
00680     #define QS_CRIT_EXIT_()     QF_CRIT_EXIT(critStat_)
00681 #endif
00682 
00691 #define QS_BEGIN(rec_, obj_) \
00692     if (((QS_glbFilter_[(uint8_t)(rec_) >> 3] \
00693           & (uint8_t)(1U << ((uint8_t)(rec_) & (uint8_t)7))) != (uint8_t)0) \
00694         && ((QS_apObj_ == (void *)0) || (QS_apObj_ == (obj_)))) \
00695     { \
00696         QS_CRIT_STAT_ \
00697         QS_CRIT_ENTRY_(); \
00698         QS_begin((uint8_t)(rec_)); \
00699         QS_TIME_(); {
00700 
00705 #define QS_END() } \
00706     QS_END_()
00707 
00708 
00709 /*****************************************************************************
00710 * Macros for use inside other macros or internally in the QP code
00711 */
00712 
00719 #define QS_BEGIN_(rec_, objFilter_, obj_) \
00720     if (((QS_glbFilter_[(uint8_t)(rec_) >> 3] \
00721           & (uint8_t)(1U << ((uint8_t)(rec_) & (uint8_t)7))) != (uint8_t)0) \
00722         && (((objFilter_) == (void *)0) || ((objFilter_) == (obj_)))) \
00723     { \
00724         QS_CRIT_ENTRY_(); \
00725         QS_begin((uint8_t)(rec_));
00726 
00733 #define QS_END_() \
00734         QS_end(); \
00735         QS_CRIT_EXIT_(); \
00736     }
00737 
00744 #define QS_BEGIN_NOCRIT_(rec_, objFilter_, obj_) \
00745     if (((QS_glbFilter_[(uint8_t)(rec_) >> 3] \
00746           & (uint8_t)(1U << ((uint8_t)(rec_) & (uint8_t)7))) != (uint8_t)0) \
00747         && (((objFilter_) == (void *)0) || ((objFilter_) == (obj_)))) \
00748     { \
00749         QS_begin((uint8_t)(rec_));
00750 
00756 #define QS_END_NOCRIT_() \
00757         QS_end(); \
00758     }
00759 
00761 #define QS_U8_(data_)           (QS_u8_(data_))
00762 
00764 #define QS_U16_(data_)          (QS_u16_(data_))
00765 
00767 #define QS_U32_(data_)          (QS_u32_(data_))
00768 
00769 
00770 #if (Q_SIGNAL_SIZE == 1)
00771 
00775     #define QS_SIG_(sig_)       (QS_u8_(sig_))
00776 #elif (Q_SIGNAL_SIZE == 2)
00777     #define QS_SIG_(sig_)       (QS_u16_(sig_))
00778 #elif (Q_SIGNAL_SIZE == 4)
00779     #define QS_SIG_(sig_)       (QS_u32_(sig_))
00780 #endif
00781 
00782 
00783 #if (QS_OBJ_PTR_SIZE == 1)
00784     #define QS_OBJ_(obj_)       (QS_u8_((uint8_t)(obj_)))
00785 #elif (QS_OBJ_PTR_SIZE == 2)
00786     #define QS_OBJ_(obj_)       (QS_u16_((uint16_t)(obj_)))
00787 #elif (QS_OBJ_PTR_SIZE == 4)
00788     #define QS_OBJ_(obj_)       (QS_u32_((uint32_t)(obj_)))
00789 #elif (QS_OBJ_PTR_SIZE == 8)
00790     #define QS_OBJ_(obj_)       (QS_u64_((uint64_t)(obj_)))
00791 #else
00792 
00798     #define QS_OBJ_(obj_)       (QS_u32_((uint32_t)(obj_))
00799 #endif
00800 
00801 
00802 #if (QS_FUN_PTR_SIZE == 1)
00803     #define QS_FUN_(fun_)       (QS_u8_((uint8_t)(fun_)))
00804 #elif (QS_FUN_PTR_SIZE == 2)
00805     #define QS_FUN_(fun_)       (QS_u16_((uint16_t)(fun_)))
00806 #elif (QS_FUN_PTR_SIZE == 4)
00807     #define QS_FUN_(fun_)       (QS_u32_((uint32_t)(fun_)))
00808 #elif (QS_FUN_PTR_SIZE == 8)
00809     #define QS_FUN_(fun_)       (QS_u64_((uint64_t)(fun_)))
00810 #else
00811 
00817     #define QS_FUN_(fun_)       (QS_u32_((uint32_t)(fun_)))
00818 #endif
00819 
00820 
00824 #define QS_STR_(msg_)           (QS_str_(msg_))
00825 
00829 #define QS_STR_ROM_(msg_)       (QS_str_ROM_(msg_))
00830 
00831 /*****************************************************************************
00832 * Macros for use in the client code
00833 */
00834 
00840 enum QSType {
00841     QS_I8_T,                               
00842     QS_U8_T,                             
00843     QS_I16_T,                             
00844     QS_U16_T,                           
00845     QS_I32_T,                             
00846     QS_U32_T,                           
00847     QS_F32_T,                             
00848     QS_F64_T,                             
00849     QS_STR_T,                      
00850     QS_MEM_T,                      
00851     QS_SIG_T,                                      
00852     QS_OBJ_T,                                    
00853     QS_FUN_T,                                  
00854     QS_I64_T,                             
00855     QS_U64_T,                           
00856     QS_U32_HEX_T                 
00857 };
00858 
00860 #define QS_I8(width_, data_) \
00861     (QS_u8((uint8_t)(((width_) << 4)) | (uint8_t)QS_I8_T, (data_)))
00862 
00864 #define QS_U8(width_, data_) \
00865     (QS_u8((uint8_t)(((width_) << 4)) | (uint8_t)QS_U8_T, (data_)))
00866 
00868 #define QS_I16(width_, data_) \
00869     (QS_u16((uint8_t)(((width_) << 4)) | (uint8_t)QS_I16_T, (data_)))
00870 
00872 #define QS_U16(width_, data_) \
00873     (QS_u16((uint8_t)(((width_) << 4)) | (uint8_t)QS_U16_T, (data_)))
00874 
00876 #define QS_I32(width_, data_) \
00877     (QS_u32((uint8_t)(((width_) << 4)) | (uint8_t)QS_I32_T, (data_)))
00878 
00880 #define QS_U32(width_, data_) \
00881     (QS_u32((uint8_t)(((width_) << 4)) | (uint8_t)QS_U32_T, (data_)))
00882 
00884 #define QS_F32(width_, data_) \
00885     (QS_f32((uint8_t)(((width_) << 4)) | (uint8_t)QS_F32_T, (data_)))
00886 
00888 #define QS_F64(width_, data_) \
00889     (QS_f64((uint8_t)(((width_) << 4)) | (uint8_t)QS_F64_T, (data_)))
00890 
00892 #define QS_I64(width_, data_) \
00893     (QS_u64((uint8_t)(((width_) << 4)) | (uint8_t)QS_I64_T, (data_)))
00894 
00896 #define QS_U64(width_, data_) \
00897     (QS_u64((uint8_t)(((width_) << 4)) | (uint8_t)QS_U64_T, (data_)))
00898 
00900 #define QS_U32_HEX(width_, data_) \
00901     (QS_u32((uint8_t)(((width_) << 4)) | (uint8_t)QS_U32_HEX_T, (data_)))
00902 
00904 #define QS_STR(str_)            (QS_str(str_))
00905 
00909 #define QS_STR_ROM(str_)        (QS_str_ROM(str_))
00910 
00914 #define QS_MEM(mem_, size_)     (QS_mem((mem_), (size_)))
00915 
00916 
00917 #if (QS_OBJ_PTR_SIZE == 1)
00918     #define QS_OBJ(obj_)        (QS_u8(QS_OBJ_T, (uint8_t)(obj_)))
00919 #elif (QS_OBJ_PTR_SIZE == 2)
00920     #define QS_OBJ(obj_)        (QS_u16(QS_OBJ_T, (uint16_t)(obj_)))
00921 #elif (QS_OBJ_PTR_SIZE == 4)
00922     #define QS_OBJ(obj_)        (QS_u32(QS_OBJ_T, (uint32_t)(obj_)))
00923 #elif (QS_OBJ_PTR_SIZE == 8)
00924     #define QS_OBJ(obj_)        (QS_u64(QS_OBJ_T, (uint64_t)(obj_)))
00925 #else
00926 
00927     #define QS_OBJ(obj_)        (QS_u32(QS_OBJ_T, (uint32_t)(obj_)))
00928 #endif
00929 
00930 
00931 #if (QS_FUN_PTR_SIZE == 1)
00932     #define QS_FUN(fun_)        (QS_u8(QS_FUN_T, (uint8_t)(fun_)))
00933 #elif (QS_FUN_PTR_SIZE == 2)
00934     #define QS_FUN(fun_)        (QS_u16(QS_FUN_T, (uint16_t)(fun_)))
00935 #elif (QS_FUN_PTR_SIZE == 4)
00936     #define QS_FUN(fun_)        (QS_u32(QS_FUN_T, (uint32_t)(fun_)))
00937 #elif (QS_FUN_PTR_SIZE == 8)
00938     #define QS_FUN(fun_)        (QS_u64(QS_FUN_T, (uint64_t)(fun_)))
00939 #else
00940 
00941     #define QS_FUN(fun_)        (QS_u32(QS_FUN_T, (uint32_t)(fun_)))
00942 #endif
00943 
00944 
00945 #if (Q_SIGNAL_SIZE == 1)
00946 
00950     #define QS_SIG(sig_, obj_) \
00951         QS_u8(QS_SIG_T, (sig_)); \
00952         QS_OBJ_(obj_)
00953 #elif (Q_SIGNAL_SIZE == 2)
00954     #define QS_SIG(sig_, obj_) \
00955         QS_u16(QS_SIG_T, (sig_)); \
00956         QS_OBJ_(obj_)
00957 #elif (Q_SIGNAL_SIZE == 4)
00958     #define QS_SIG(sig_, obj_) \
00959         QS_u32(QS_SIG_T, (sig_)); \
00960         QS_OBJ_(obj_)
00961 #endif
00962 
00963 
00969 #define QS_RESET() do { \
00970     if (((QS_glbFilter_[(uint8_t)QS_QP_RESET >> 3] \
00971       & (uint8_t)(1U << ((uint8_t)QS_QP_RESET & (uint8_t)7))) != (uint8_t)0))\
00972     { \
00973         QS_CRIT_STAT_ \
00974         QS_CRIT_ENTRY_(); \
00975         QS_begin((uint8_t)QS_QP_RESET); \
00976         QS_end(); \
00977         QS_CRIT_EXIT_(); \
00978         QS_onFlush(); \
00979     } \
00980 } while (0)
00981 
01022 #define QS_SIG_DICTIONARY(sig_, obj_) do { \
01023     if (((QS_glbFilter_[(uint8_t)QS_SIG_DIC >> 3] \
01024       & (uint8_t)(1U << ((uint8_t)QS_SIG_DIC & (uint8_t)7))) != (uint8_t)0)) \
01025     { \
01026         static char_t const Q_ROM Q_ROM_VAR sig_name__[] = #sig_; \
01027         QS_CRIT_STAT_ \
01028         QS_CRIT_ENTRY_(); \
01029         QS_begin((uint8_t)QS_SIG_DIC); \
01030         QS_SIG_((QSignal)(sig_)); \
01031         QS_OBJ_(obj_); \
01032         QS_STR_ROM_(&sig_name__[0]); \
01033         QS_end(); \
01034         QS_CRIT_EXIT_(); \
01035         QS_onFlush(); \
01036     } \
01037 } while (0)
01038 
01052 #define QS_OBJ_DICTIONARY(obj_) do { \
01053     if (((QS_glbFilter_[(uint8_t)QS_OBJ_DIC >> 3] \
01054       & (uint8_t)(1U << ((uint8_t)QS_OBJ_DIC & (uint8_t)7))) != (uint8_t)0)) \
01055     { \
01056         static char_t const Q_ROM Q_ROM_VAR obj_name__[] = #obj_; \
01057         QS_CRIT_STAT_ \
01058         QS_CRIT_ENTRY_(); \
01059         QS_begin((uint8_t)QS_OBJ_DIC); \
01060         QS_OBJ_(obj_); \
01061         QS_STR_ROM_(&obj_name__[0]); \
01062         QS_end(); \
01063         QS_CRIT_EXIT_(); \
01064         QS_onFlush(); \
01065     } \
01066 } while (0)
01067 
01080 #define QS_FUN_DICTIONARY(fun_) do { \
01081     if (((QS_glbFilter_[(uint8_t)QS_FUN_DIC >> 3] \
01082       & (uint8_t)(1U << ((uint8_t)QS_FUN_DIC & (uint8_t)7))) != (uint8_t)0)) \
01083     { \
01084         static char_t const Q_ROM Q_ROM_VAR fun_name__[] = #fun_; \
01085         QS_CRIT_STAT_ \
01086         QS_CRIT_ENTRY_(); \
01087         QS_begin((uint8_t)QS_FUN_DIC); \
01088         QS_FUN_(fun_); \
01089         QS_STR_ROM_(&fun_name__[0]); \
01090         QS_end(); \
01091         QS_CRIT_EXIT_(); \
01092         QS_onFlush(); \
01093     } \
01094 } while (0)
01095 
01101 #define QS_USR_DICTIONARY(rec_) do { \
01102     if (((QS_glbFilter_[(uint8_t)QS_USR_DIC >> 3] \
01103       & (uint8_t)(1U << ((uint8_t)QS_USR_DIC & (uint8_t)7))) != (uint8_t)0)) \
01104     { \
01105         static char_t const Q_ROM Q_ROM_VAR usr_name__[] = #rec_; \
01106         QS_CRIT_STAT_ \
01107         QS_CRIT_ENTRY_(); \
01108         QS_begin((uint8_t)QS_USR_DIC); \
01109         QS_U8_((uint8_t)(rec_)); \
01110         QS_STR_ROM_(&usr_name__[0]); \
01111         QS_end(); \
01112         QS_CRIT_EXIT_(); \
01113         QS_onFlush(); \
01114     } \
01115 } while (0)
01116 
01118 #define QS_ASSERTION(module_, loc_) do { \
01119     QS_BEGIN_NOCRIT_(QS_ASSERT, (void *)0, (void *)0) \
01120         QS_TIME_(); \
01121         QS_U16_((uint16_t)(loc_)); \
01122         QS_STR_ROM_(module_); \
01123     QS_END_NOCRIT_() \
01124     QS_onFlush(); \
01125 } while (0)
01126 
01134 #define QS_FLUSH()   (QS_onFlush())
01135 
01137 #define QF_QS_CRIT_ENTRY() \
01138     QS_BEGIN_NOCRIT_(QS_QF_CRIT_ENTRY, (void *)0, (void *)0) \
01139         QS_TIME_(); \
01140         QS_U8_((uint8_t)(++QF_critNest_)); \
01141     QS_END_NOCRIT_()
01142 
01144 #define QF_QS_CRIT_EXIT() \
01145     QS_BEGIN_NOCRIT_(QS_QF_CRIT_EXIT, (void *)0, (void *)0) \
01146         QS_TIME_(); \
01147         QS_U8_((uint8_t)(QF_critNest_--)); \
01148     QS_END_NOCRIT_()
01149 
01151 #define QF_QS_ISR_ENTRY(isrnest_, prio_) \
01152     QS_BEGIN_NOCRIT_(QS_QF_ISR_ENTRY, (void *)0, (void *)0) \
01153         QS_TIME_(); \
01154         QS_U8_(isrnest_); \
01155         QS_U8_(prio_); \
01156     QS_END_NOCRIT_()
01157 
01159 #define QF_QS_ISR_EXIT(isrnest_, prio_) \
01160     QS_BEGIN_NOCRIT_(QS_QF_ISR_EXIT, (void *)0, (void *)0) \
01161         QS_TIME_(); \
01162         QS_U8_(isrnest_); \
01163         QS_U8_(prio_); \
01164     QS_END_NOCRIT_()
01165 
01167 #define QF_QS_ACTION(act_)      (act_)
01168 
01173 extern uint8_t QF_critNest_;
01174 
01175 #endif                                                             /* qs_h  */
01176