rtxDiagBitTrace.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2010 Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00029 #ifndef _RTXDIAGBITTRACE_H_
00030 #define _RTXDIAGBITTRACE_H_
00031 
00032 #include <stdarg.h>
00033 #include "rtxsrc/rtxMemBuf.h"
00034 #include "rtxsrc/rtxSList.h"
00035 #include "rtxsrc/rtxPrintToStream.h"
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00044 typedef struct {
00045    const char*  elemName;
00046    const char*  nameSuffix;
00047    size_t       bitOffset;
00048    size_t       numbits;
00049 } OSRTDiagBitField;
00050 
00051 typedef struct {
00052    OSUINT8 lb, lbm;
00053    char fmtBitBuffer[40], fmtHexBuffer[10], fmtAscBuffer[10];
00054    int  fmtBitCharIdx, fmtHexCharIdx, fmtAscCharIdx;
00055 } OSRTDiagBinDumpBuffer;
00056 
00057 typedef struct {
00058    OSUINT16  disabledCount;
00059    OSRTSList fieldList; /* list of OSRTDiagBitField */
00060    OSRTMEMBUF* pCaptureBuf; /* capture buffer for streams */
00061    OSRTDiagBinDumpBuffer printBuffer;  /* formatted text buffer */
00062    OSRTSListNode* pLastPrinted; /* last node in list that was printed */
00063 } OSRTDiagBitFieldList;
00064 
00065 /* Macros */
00066 
00067 #ifdef _TRACE
00068 #define RTDIAG_INSBITFLDLEN(pctxt)        rtxDiagInsBitFieldLen(pctxt)
00069 #define RTDIAG_NEWBITFIELD(pctxt,suffix)  rtxDiagNewBitField(pctxt,suffix)
00070 #define RTDIAG_SETBITFLDOFFSET(pctxt)     rtxDiagSetBitFldOffset(pctxt)
00071 #define RTDIAG_SETBITFLDCOUNT(pctxt)      rtxDiagSetBitFldCount(pctxt)
00072 #else
00073 #define RTDIAG_INSBITFLDLEN(pctxt)
00074 #define RTDIAG_NEWBITFIELD(pctxt,suffix)
00075 #define RTDIAG_SETBITFLDOFFSET(pctxt)
00076 #define RTDIAG_SETBITFLDCOUNT(pctxt)
00077 #endif
00078 
00083 #define RTDIAG_GETCTXTBITOFFSET(pctxt) \
00084 (((pctxt)->buffer.byteIndex * 8) + (8 - (pctxt)->buffer.bitOffset))
00085 
00093 EXTERNRT OSBOOL rtxDiagSetBitTraceEnabled (OSCTXT* pctxt, OSBOOL value);
00094 
00101 EXTERNRT OSBOOL rtxDiagBitTraceEnabled (OSCTXT* pctxt);
00102 
00109 EXTERNRT void rtxDiagBitFieldListInit
00110 (OSCTXT* pctxt, OSRTDiagBitFieldList* pBFList);
00111 
00118 EXTERNRT void rtxDiagInsBitFieldLen (OSRTDiagBitFieldList* pBFList);
00119 
00128 EXTERNRT OSRTDiagBitField* rtxDiagNewBitField
00129 (OSRTDiagBitFieldList* pBFList, const char* nameSuffix);
00130 
00137 EXTERNRT void rtxDiagSetBitFldOffset (OSRTDiagBitFieldList* pBFList);
00138 
00145 EXTERNRT void rtxDiagSetBitFldCount (OSRTDiagBitFieldList* pBFList);
00146 
00155 EXTERNRT void rtxDiagSetBitFldNameSuffix
00156 (OSRTDiagBitFieldList* pBFList, const char* nameSuffix);
00157 
00168 EXTERNRT OSBOOL rtxDiagSetBitFldDisabled
00169 (OSRTDiagBitFieldList* pBFList, OSBOOL value);
00170 
00179 EXTERNRT void rtxDiagBitTracePrint
00180 (OSRTDiagBitFieldList* pBFList, const char* varname);
00181 
00189 EXTERNRT void rtxDiagBitTracePrintHTML
00190 (const char* filename, OSRTDiagBitFieldList* pBFList, const char* varname);
00191 
00200 EXTERNRT void rtxDiagBitFldAppendNamePart
00201 (OSRTDiagBitFieldList* pBFList, const char* namePart);
00202 
00203 #ifdef __cplusplus
00204 }
00205 #endif
00206 
00207 #endif