diff --git a/Inc/nw.h b/Inc/nw.h index 479c589e..ba6dd506 100644 --- a/Inc/nw.h +++ b/Inc/nw.h @@ -17,9 +17,9 @@ extern "C" { // ==================================================================================================== -#define OTCLIENT_SERVER_PORT (3402) /* ORBTrace COBS server port definition */ -#define NWCLIENT_SERVER_PORT (3443) /* Server port definition */ -#define LEGACY_SERVER_PORT_OFS (NWCLIENT_SERVER_PORT-OTCLIENT_SERVER_PORT) +#define OFCLIENT_SERVER_PORT (3402) /* orbflow server port definition */ +#define NWCLIENT_SERVER_PORT (3443) /* legacy server port definition */ +#define LEGACY_SERVER_PORT_OFS (NWCLIENT_SERVER_PORT-OFCLIENT_SERVER_PORT) #define TRANSFER_SIZE (65536*4) diff --git a/Inc/oflow.h b/Inc/oflow.h index 1093b22b..8554e4bc 100644 --- a/Inc/oflow.h +++ b/Inc/oflow.h @@ -34,6 +34,7 @@ struct OFLOW bool selfAllocated; /* Flag indicating that memory was allocated by the library */ struct COBS c; struct OFLOWFrame f; + uint64_t perror; /* Materials for callback */ void ( *cb )( struct OFLOWFrame *p, void *param ); diff --git a/Inc/tpiuDecoder.h b/Inc/tpiuDecoder.h index df2bfcd4..b3941183 100644 --- a/Inc/tpiuDecoder.h +++ b/Inc/tpiuDecoder.h @@ -82,18 +82,15 @@ struct TPIUPacket }; // ==================================================================================================== -/* LEGACY */ bool TPIUGetPacket( struct TPIUDecoder *t, struct TPIUPacket *p ); -/* LEGACY */ enum TPIUPumpEvent TPIUPump( struct TPIUDecoder *t, uint8_t d ); - void TPIUDecoderForceSync( struct TPIUDecoder *t, uint8_t offset ); void TPIUDecoderZeroStats( struct TPIUDecoder *t ); bool TPIUDecoderSynced( struct TPIUDecoder *t ); struct TPIUDecoderStats *TPIUDecoderGetStats( struct TPIUDecoder *t ); struct TPIUCommsStats *TPIUGetCommsStats( struct TPIUDecoder *t ); -void TPIUPump2( struct TPIUDecoder *t, uint8_t *frame, int len, - void ( *packetRxed )( enum TPIUPumpEvent e, struct TPIUPacket *p, void *param ), - void *param ); +void TPIUPump( struct TPIUDecoder *t, uint8_t *frame, int len, + void ( *packetRxed )( enum TPIUPumpEvent e, struct TPIUPacket *p, void *param ), + void *param ); struct TPIUDecoder *TPIUDecoderCreate( void ); void TPIUDecoderInit( struct TPIUDecoder *t ); diff --git a/Inc/uicolours_default.h b/Inc/uicolours_default.h index afe23638..3a7db7eb 100644 --- a/Inc/uicolours_default.h +++ b/Inc/uicolours_default.h @@ -14,6 +14,8 @@ #define C_SUPPORT2 C_LCYAN /* Output data secondary value alternate */ #define C_CONTEXT C_CYAN /* Context (e.g. units) for output data value */ +#define C_TSTAMP C_YELLOW /* Colour stamp in orbcat output */ + #define C_VERB_ERROR C_LRED /* Verbal level error */ #define C_VERB_WARN C_YELLOW /* Verbal level warning */ #define C_VERB_INFO C_LCYAN /* Verbal level info */ diff --git a/Src/itmfifos.c b/Src/itmfifos.c index cc48c91a..d4de0f2d 100644 --- a/Src/itmfifos.c +++ b/Src/itmfifos.c @@ -498,7 +498,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { diff --git a/Src/oflow.c b/Src/oflow.c index 48bb463b..4b5dfe3b 100644 --- a/Src/oflow.c +++ b/Src/oflow.c @@ -84,24 +84,32 @@ static void _pumpcb( struct Frame *p, void *param ) /* Callback function when a COBS packet is complete */ struct OFLOW *t = ( struct OFLOW * )param; - t->f.len = p->len - 2; /* OFLOW frames have the first element representing the tag and last element the checksum */ - t->f.tag = p->d[0]; /* First byte of an OFLOW frame is the tag */ - t->f.sum = p->d[p->len - 1]; /* Last byte of an OFLOW frame is the sum */ - t->f.d = &p->d[1]; /* This is the rest of the data */ - - /* Calculate received packet sum and insert good status into packet */ - uint8_t sum = t->f.tag; - - for ( int i = 0; i < t->f.len; i++ ) + if ( p->len < 2 ) { - sum += t->f.d[i]; + t->perror++; } + else + { + t->f.len = p->len - 2; /* OFLOW frames have the first element representing the tag and last element the checksum */ + t->f.tag = p->d[0]; /* First byte of an OFLOW frame is the tag */ + t->f.sum = p->d[p->len - 1]; /* Last byte of an OFLOW frame is the sum */ + t->f.d = &p->d[1]; /* This is the rest of the data */ - sum += t->f.sum; - t->f.good = ( sum == 0 ); + /* Calculate received packet sum and insert good status into packet */ + uint8_t sum = t->f.tag; - /* Timestamp was already set for this cluster */ - ( t->cb )( &t->f, t->param ); + for ( int i = 0; i < t->f.len; i++ ) + { + sum += t->f.d[i]; + } + + sum += t->f.sum; + t->f.good = ( sum == 0 ); + t->perror += !( t->f.good ); + + /* Timestamp was already set for this cluster */ + ( t->cb )( &t->f, t->param ); + } } void OFLOWPump( struct OFLOW *t, const uint8_t *incoming, int len, diff --git a/Src/orbcat.c b/Src/orbcat.c index cf28ac7c..66951182 100644 --- a/Src/orbcat.c +++ b/Src/orbcat.c @@ -34,19 +34,19 @@ #define DEFAULT_TS_TRIGGER '\n' /* Default trigger character for timestamp output */ #define MSG_REORDER_BUFLEN (10) /* Maximum number of samples to re-order for timekeeping */ -#define ONE_SEC_IN_USEC (1000000) /* Used for time conversions...usec in one sec */ +#define ONE_SEC_IN_USEC (1000000L) /* Used for time conversions...usec in one sec */ /* Formats for timestamping */ -#define REL_FORMAT "%6" PRIu64 ".%01" PRIu64 "|" -#define REL_FORMAT_INIT " Initial|" -#define DEL_FORMAT "%3" PRIu64 ".%03" PRIu64 "|" -#define DEL_FORMAT_CTD " +|" -#define DEL_FORMAT_INIT "Initial|" +#define REL_FORMAT C_TSTAMP "%6" PRIu64 ".%03" PRIu64 "|" C_RESET +#define REL_FORMAT_INIT C_TSTAMP " R-Initial|" C_RESET +#define DEL_FORMAT C_TSTAMP "%5" PRIu64 ".%03" PRIu64 "|" C_RESET +#define DEL_FORMAT_CTD C_TSTAMP " +|" C_RESET +#define DEL_FORMAT_INIT C_TSTAMP "D-Initial|" C_RESET #define ABS_FORMAT_TM "%d/%b/%y %H:%M:%S" -#define ABS_FORMAT "%s.%03" PRIu64" |" -#define STAMP_FORMAT "%12" PRIu64 "|" -#define STAMP_FORMAT_MS "%8" PRIu64 ".%03" PRIu64 "_%03" PRIu64 "|" -#define STAMP_FORMAT_MS_DELTA "%5" PRIu64 ".%03" PRIu64 "_%03" PRIu64 "|" +#define ABS_FORMAT C_TSTAMP "%s.%03" PRIu64"|" C_RESET +#define STAMP_FORMAT C_TSTAMP "%12" PRIu64 "|" C_RESET +#define STAMP_FORMAT_MS C_TSTAMP "%8" PRIu64 ".%03" PRIu64 "_%03" PRIu64 "|" C_RESET +#define STAMP_FORMAT_MS_DELTA C_TSTAMP "%5" PRIu64 ".%03" PRIu64 "_%03" PRIu64 "|" C_RESET enum TSType { TSNone, TSAbsolute, TSRelative, TSDelta, TSStamp, TSStampDelta, TSNumTypes }; @@ -66,7 +66,7 @@ struct enum TSType tsType; char *tsLineFormat; char tsTrigger; - + bool mono; /* Supress colour in output */ /* Sink information */ char *presFormat[NUM_CHANNELS + 1]; /* Format string for each channel */ @@ -83,7 +83,7 @@ struct { .forceITMSync = true, .tag = 1, - .port = OTCLIENT_SERVER_PORT, + .port = OFCLIENT_SERVER_PORT, .server = "localhost", .tsTrigger = DEFAULT_TS_TRIGGER }; @@ -112,7 +112,7 @@ struct #define DWT_TO_US (100000L) // ==================================================================================================== -int64_t _timestamp( void ) +uint64_t _timestamp( void ) { struct timeval te; @@ -152,7 +152,7 @@ static void _printTimestamp( char *strstore ) } else { - res = _r.oldte - _timestamp(); + res = _timestamp() - _r.oldte; sprintf( strstore, REL_FORMAT, res / ONE_SEC_IN_USEC, ( res / ( ONE_SEC_IN_USEC / 1000 ) ) % 1000 ); } @@ -246,7 +246,7 @@ static void _outputText( char *p ) if ( !_r.inLine ) { _printTimestamp( opConstruct ); - fputs( opConstruct, stdout ); + genericsPrintf( "%s", opConstruct ); _r.inLine = true; } @@ -256,21 +256,21 @@ static void _outputText( char *p ) if ( q ) { *q = 0; - fprintf( stdout, "%s" EOL, p ); + genericsPrintf( "%s" EOL, p ); /* Once we've output these data then we're not in a line any more */ _r.inLine = false; /* ...and if there were any DWT messages to print we'd better output those */ if ( _r.dwtText[0] ) { - fprintf( stdout, "%s" EOL, _r.dwtText ); + genericsPrintf( "%s" EOL, _r.dwtText ); _r.dwtText[0] = 0; } } else { /* Just output the whole of the data we've got, then we're done */ - fputs( p, stdout ); + genericsPrintf( "%s", p ); break; } @@ -296,7 +296,7 @@ void _expex( const char *fmt, ... ) /* See if we exceeded max length...if so then output what we have and start a fresh buffer */ if ( MAX_STRING_LENGTH - strlen( _r.dwtText ) < 100 ) { - fputs( _r.dwtText, stdout ); + genericsPrintf( "%s", _r.dwtText ); _r.dwtText[0] = 0; } @@ -310,7 +310,7 @@ void _expex( const char *fmt, ... ) if ( !_r.inLine ) { - fputs( _r.dwtText, stdout ); + genericsPrintf( "%s", _r.dwtText ); _r.dwtText[0] = 0; } } @@ -549,24 +549,24 @@ static void _itmPumpProcess( char c ) static void _printHelp( const char *const progName ) { - fprintf( stdout, "Usage: %s [options]" EOL, progName ); - fprintf( stdout, " -c, --channel: , of channel to add into output stream (repeat per channel)" EOL ); - fprintf( stdout, " -C, --cpufreq: (Scaled) speed of the CPU" EOL - " generally /1, /4, /16 or /64 of the real CPU speed," EOL ); - fprintf( stdout, " -E, --eof: Terminate when the file/socket ends/is closed, or wait for more/reconnect" EOL ); - fprintf( stdout, " -f, --input-file: Take input from specified file" EOL ); - fprintf( stdout, " -g, --trigger: to use to trigger timestamp (default is newline)" EOL ); - fprintf( stdout, " -h, --help: This help" EOL ); - fprintf( stdout, " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needs to issue syncs)" EOL ); - fprintf( stdout, " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM" EOL ); - fprintf( stdout, " -s, --server: : to use" EOL ); - fprintf( stdout, " -t, --tag: : Which orbflow tag to use (normally 1)" EOL ); - fprintf( stdout, " -T, --timestamp: : Add absolute, relative (to session start)," EOL - " delta, system timestamp or system timestamp delta to output. Note" EOL - " a,r & d are host dependent and you may need to run orbuculum with -H." EOL ); - fprintf( stdout, " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); - fprintf( stdout, " -V, --version: Print version and exit" EOL ); - fprintf( stdout, " -x, --exceptions: Include exception information in output, in time order" EOL ); + genericsPrintf( "Usage: %s [options]" EOL, progName ); + genericsPrintf( " -c, --channel: , of channel to add into output stream (repeat per channel)" EOL ); + genericsPrintf( " -C, --cpufreq: (Scaled) speed of the CPU" EOL + " generally /1, /4, /16 or /64 of the real CPU speed," EOL ); + genericsPrintf( " -E, --eof: Terminate when the file/socket ends/is closed, or wait for more/reconnect" EOL ); + genericsPrintf( " -f, --input-file: Take input from specified file" EOL ); + genericsPrintf( " -g, --trigger: to use to trigger timestamp (default is newline)" EOL ); + genericsPrintf( " -h, --help: This help" EOL ); + genericsPrintf( " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needs to issue syncs)" EOL ); + genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM" EOL ); + genericsPrintf( " -s, --server: : to use" EOL ); + genericsPrintf( " -t, --tag: : Which orbflow tag to use (normally 1)" EOL ); + genericsPrintf( " -T, --timestamp: : Add absolute, relative (to session start)," EOL + " delta, system timestamp or system timestamp delta to output. Note" EOL + " the accuracy of a,r & d are host dependent." EOL ); + genericsPrintf( " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); + genericsPrintf( " -V, --version: Print version and exit" EOL ); + genericsPrintf( " -x, --exceptions: Include exception information in output, in time order" EOL ); } // ==================================================================================================== static void _printVersion( void ) @@ -584,6 +584,8 @@ static struct option _longOptions[] = {"help", no_argument, NULL, 'h'}, {"trigger", required_argument, NULL, 'g' }, {"itm-sync", no_argument, NULL, 'n'}, + {"no-colour", no_argument, NULL, 'M'}, + {"no-color", no_argument, NULL, 'M'}, {"protocol", required_argument, NULL, 'p'}, {"server", required_argument, NULL, 's'}, {"tag", required_argument, NULL, 't'}, @@ -606,7 +608,7 @@ bool _processOptions( int argc, char *argv[] ) #define DELIMITER ',' - while ( ( c = getopt_long ( argc, argv, "c:C:Ef:g:hVnp:s:t:T:v:x", _longOptions, &optionIndex ) ) != -1 ) + while ( ( c = getopt_long ( argc, argv, "c:C:Ef:g:hVnMp:s:t:T:v:x", _longOptions, &optionIndex ) ) != -1 ) switch ( c ) { // ------------------------------------ @@ -651,6 +653,11 @@ bool _processOptions( int argc, char *argv[] ) options.forceITMSync = false; break; + // ------------------------------------ + case 'M': + options.mono = true; + break; + // ------------------------------------ case 'p': @@ -920,7 +927,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) { if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { @@ -982,8 +989,7 @@ static void _feedStream( struct Stream *stream ) /* Check if an exception report timed out */ if ( ( _r.inLine ) && _r.dwtText[0] && ( _timestamp() - _r.dwtte > DWT_TO_US ) ) { - fputs( EOL, stdout ); - fputs( _r.dwtText, stdout ); + genericsPrintf( EOL "%s", _r.dwtText ); _r.dwtText[0] = 0; _r.inLine = false; } @@ -1011,6 +1017,8 @@ int main( int argc, char *argv[] ) exit( -1 ); } + genericsScreenHandling( !options.mono ); + /* Reset the handlers before we start */ ITMDecoderInit( &_r.i, options.forceITMSync ); OFLOWInit( &_r.c ); @@ -1052,7 +1060,7 @@ int main( int argc, char *argv[] ) break; } - /* Checking every 100ms for a connection is quite often enough */ + /* Checking every 10ms for a connection is quite often enough */ usleep( 10000 ); } diff --git a/Src/orbdump.c b/Src/orbdump.c index ef810296..3722f076 100644 --- a/Src/orbdump.c +++ b/Src/orbdump.c @@ -16,7 +16,6 @@ #include "uthash.h" #include "git_version_info.h" #include "generics.h" -#include "tpiuDecoder.h" #include "oflow.h" #include "itmDecoder.h" #include "stream.h" @@ -28,8 +27,8 @@ #define DEFAULT_OUTFILE "/dev/stdout" #define DEFAULT_TIMELEN 10000 -enum Prot { PROT_OFLOW, PROT_ITM, PROT_TPIU, PROT_UNKNOWN }; -const char *protString[] = {"OFLOW", "ITM", "TPIU", NULL}; +enum Prot { PROT_OFLOW, PROT_ITM, PROT_UNKNOWN }; +const char *protString[] = {"OFLOW", "ITM", NULL}; /* ---------- CONFIGURATION ----------------- */ @@ -60,7 +59,7 @@ struct /* Record for options, either defaul .tag = 1, .outfile = DEFAULT_OUTFILE, .timelen = DEFAULT_TIMELEN, - .port = OTCLIENT_SERVER_PORT, + .port = OFCLIENT_SERVER_PORT, .server = "localhost" }; @@ -70,8 +69,6 @@ struct /* The decoders and the packets from them */ struct ITMDecoder i; struct ITMPacket h; - struct TPIUDecoder t; - struct TPIUPacket p; struct OFLOW c; bool ending; } _r; @@ -98,68 +95,6 @@ uint64_t _timestamp( void ) // ==================================================================================================== // ==================================================================================================== // ==================================================================================================== -void _protocolPump( uint8_t c ) - -/* Top level protocol pump */ - -{ - if ( PROT_TPIU == options.protocol ) - { - switch ( TPIUPump( &_r.t, c ) ) - { - // ------------------------------------ - case TPIU_EV_NEWSYNC: - case TPIU_EV_SYNCED: - ITMDecoderForceSync( &_r.i, true ); - break; - - // ------------------------------------ - case TPIU_EV_RXING: - case TPIU_EV_NONE: - break; - - // ------------------------------------ - case TPIU_EV_UNSYNCED: - ITMDecoderForceSync( &_r.i, false ); - break; - - // ------------------------------------ - case TPIU_EV_RXEDPACKET: - if ( !TPIUGetPacket( &_r.t, &_r.p ) ) - { - genericsReport( V_WARN, "TPIUGetPacket fell over" EOL ); - } - - for ( uint32_t g = 0; g < _r.p.len; g++ ) - { - if ( _r.p.packet[g].s == options.tag ) - { - ITMPump( &_r.i, _r.p.packet[g].d ); - continue; - } - - if ( _r.p.packet[g].s != 0 ) - { - genericsReport( V_DEBUG, "Unknown TPIU channel %02x" EOL, _r.p.packet[g].s ); - } - } - - break; - - // ------------------------------------ - case TPIU_EV_ERROR: - genericsReport( V_WARN, "****ERROR****" EOL ); - break; - // ------------------------------------ - } - } - else - { - /* There's no TPIU in use, so this goes straight to the ITM layer */ - ITMPump( &_r.i, c ); - } -} -// ==================================================================================================== void _printHelp( const char *const progName ) { @@ -169,10 +104,9 @@ void _printHelp( const char *const progName ) genericsPrintf( " -M, --no-colour: Supress colour in output" EOL ); genericsPrintf( " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needs to issue syncs)" EOL ); genericsPrintf( " -o, --output-file: to be used for dump file (defaults to %s)" EOL, options.outfile ); - genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM unless" EOL \ - " explicitly set to TPIU to decode TPIU frames on channel set by -t" EOL ); + genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM unless" EOL ); genericsPrintf( " -s, --server: : to use" EOL ); - genericsPrintf( " -t, --tag: Which TPIU stream or OFLOW tag to use (normally 1)" EOL ); + genericsPrintf( " -t, --tag: Which Orbflow tag to use (normally 1)" EOL ); genericsPrintf( " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); genericsPrintf( " -V, --version: Print version and exit" EOL ); genericsPrintf( " -w, --sync-write: Write synchronously to the output file after every packet" EOL ); @@ -332,7 +266,7 @@ bool _processOptions( int argc, char *argv[] ) options.protocol = PROT_ITM; } - if ( ( options.protocol == PROT_TPIU ) && !portExplicit ) + if ( ( options.protocol == PROT_ITM ) && !portExplicit ) { options.port = NWCLIENT_SERVER_PORT; } @@ -363,10 +297,6 @@ bool _processOptions( int argc, char *argv[] ) genericsReport( V_INFO, "Decoding ITM" EOL ); break; - case PROT_TPIU: - genericsReport( V_INFO, "Using TPIU with ITM in stream %d" EOL, options.tag ); - break; - default: genericsReport( V_INFO, "Decoding unknown" EOL ); break; @@ -382,7 +312,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) { if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { @@ -431,9 +361,7 @@ int main( int argc, char *argv[] ) genericsScreenHandling( !options.mono ); - /* Reset the TPIU handler before we start */ - TPIUDecoderInit( &_r.t ); - ITMDecoderInit( &_r.i, options.forceITMSync ); + /* Reset the OFLOW handler before we start */ OFLOWInit( &_r.c ); stream = _tryOpenStream(); @@ -517,7 +445,7 @@ int main( int argc, char *argv[] ) while ( t-- ) { - _protocolPump( *c++ ); + ITMPump( &_r.i, *c++ ); } } diff --git a/Src/orbfifo.c b/Src/orbfifo.c index e74f5dc2..b3802de3 100644 --- a/Src/orbfifo.c +++ b/Src/orbfifo.c @@ -51,7 +51,7 @@ struct } options = { - .port = OTCLIENT_SERVER_PORT, + .port = OFCLIENT_SERVER_PORT, .server = "localhost" }; diff --git a/Src/orblcd.c b/Src/orblcd.c index 42ccfc8f..a6661c0a 100644 --- a/Src/orblcd.c +++ b/Src/orblcd.c @@ -23,7 +23,6 @@ #include "git_version_info.h" #include "generics.h" -#include "tpiuDecoder.h" #include "itmDecoder.h" #include "msgDecoder.h" #include "oflow.h" @@ -66,8 +65,8 @@ struct TApp }; /************** APPLICATION SPECIFIC ENDS ***************************************************************/ -enum Prot { PROT_OFLOW, PROT_ITM, PROT_TPIU, PROT_UNKNOWN }; -const char *protString[] = {"OFLOW", "ITM", "TPIU", NULL}; +enum Prot { PROT_OFLOW, PROT_ITM, PROT_UNKNOWN }; +const char *protString[] = {"OFLOW", "ITM", NULL}; /* Record for options, either defaults or from command line */ struct Options @@ -80,18 +79,16 @@ struct Options bool fileTerminate; /* Terminate when file read isn't successful */ /* Demux information */ - uint32_t tag; /* Which TPIU or OFLOW stream are we decoding? */ + uint32_t tag; /* Which OFLOW stream are we decoding? */ bool forceITMSync; /* Do we need ITM syncs? */ -} _options = {.forceITMSync = true, .tag = 1, .port = OTCLIENT_SERVER_PORT, .server = "localhost"}; +} _options = {.forceITMSync = true, .tag = 1, .port = OFCLIENT_SERVER_PORT, .server = "localhost"}; struct RunTime { /* The decoders and the packets from them */ struct ITMDecoder i; struct ITMPacket h; - struct TPIUDecoder t; - struct TPIUPacket p; struct OFLOW c; bool ending; /* Flag indicating app is terminating */ @@ -325,41 +322,6 @@ void _itmPumpProcess( char c, struct RunTime *r ) } // ==================================================================================================== -static void _TPIUpacketRxed( enum TPIUPumpEvent e, struct TPIUPacket *p, void *param ) - -/* Callback for when a TPIU frame has been assembled */ - -{ - struct RunTime *r = ( struct RunTime * )param; - - switch ( e ) - { - case TPIU_EV_RXEDPACKET: - for ( uint32_t g = 0; g < p->len; g++ ) - { - if ( r->options->tag == p->packet[g].s ) - { - _itmPumpProcess( p->packet[g].d, r ); - } - } - - break; - - case TPIU_EV_ERROR: - genericsReport( V_WARN, "****ERROR****" EOL ); - break; - - case TPIU_EV_NEWSYNC: - case TPIU_EV_SYNCED: - case TPIU_EV_RXING: - case TPIU_EV_NONE: - case TPIU_EV_UNSYNCED: - default: - break; - } -} -// ==================================================================================================== - static struct Stream *_tryOpenStream( struct RunTime *r ) { if ( r->options->file != NULL ) @@ -380,7 +342,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { @@ -444,16 +406,9 @@ static bool _feedStream( struct Stream *stream, struct RunTime *r ) { unsigned char *c = cbw; - if ( PROT_TPIU == _r.options->tag ) + while ( receivedSize-- ) { - TPIUPump2( &r->t, cbw, receivedSize, _TPIUpacketRxed, r ); - } - else - { - while ( receivedSize-- ) - { - _itmPumpProcess( *c++, r ); - } + _itmPumpProcess( *c++, r ); } } } @@ -471,12 +426,11 @@ void _printHelp( const char *const progName ) genericsPrintf( " -c, --channel: of first channel in pair containing display data" EOL ); genericsPrintf( " -f, --input-file: Take input from specified file" EOL ); genericsPrintf( " -h, --help: This help" EOL ); - genericsPrintf( " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needsd to issue syncs)" EOL ); - genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM unless" EOL \ - " explicitly set to TPIU to decode TPIU frames on channel set by -t" EOL ); + genericsPrintf( " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needs to issue syncs)" EOL ); + genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM" EOL ); genericsPrintf( " -s, --server: : to use" EOL ); genericsPrintf( " -S, --sbcolour: to be used for single bit renders, ignored for other bit depths" EOL ); - genericsPrintf( " -t, --tag: : Which TPIU stream or OFLOW tag to use (normally 1)" EOL ); + genericsPrintf( " -t, --tag: : Which OFLOW tag to use (normally 1)" EOL ); genericsPrintf( " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); genericsPrintf( " -V, --version: Print version and exit" EOL ); genericsPrintf( " -w, --window: Set title for output window" EOL ); @@ -501,7 +455,7 @@ static struct option _longOptions[] = {"server", required_argument, NULL, 's'}, {"sbcolour", required_argument, NULL, 'S'}, {"sbcolor", required_argument, NULL, 'S'}, - {"tpiu", required_argument, NULL, 't'}, + {"tag", required_argument, NULL, 't'}, {"verbose", required_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, {"window", required_argument, NULL, 'w'}, @@ -664,7 +618,7 @@ bool _processOptions( int argc, char *argv[], struct RunTime *r ) r->options->protocol = PROT_ITM; } - if ( ( r->options->protocol == PROT_TPIU ) && !portExplicit ) + if ( ( r->options->protocol == PROT_ITM ) && !portExplicit ) { r->options->port = NWCLIENT_SERVER_PORT; } @@ -709,10 +663,6 @@ bool _processOptions( int argc, char *argv[], struct RunTime *r ) genericsReport( V_INFO, "Decoding ITM" EOL ); break; - case PROT_TPIU: - genericsReport( V_INFO, "Using TPIU with ITM in stream %d" EOL, r->options->tag ); - break; - default: genericsReport( V_INFO, "Decoding unknown" EOL ); break; @@ -745,8 +695,7 @@ int main( int argc, char *argv[] ) exit( -1 ); } - /* Reset the TPIU handler before we start */ - TPIUDecoderInit( &_r.t ); + /* Reset the handlers before we start */ ITMDecoderInit( &_r.i, _r.options->forceITMSync ); OFLOWInit( &_r.c ); diff --git a/Src/orbmortem.c b/Src/orbmortem.c index fe480a40..25192fff 100644 --- a/Src/orbmortem.c +++ b/Src/orbmortem.c @@ -23,7 +23,6 @@ #include "generics.h" #include "nw.h" #include "traceDecoder.h" -#include "tpiuDecoder.h" #include "oflow.h" #include "loadelf.h" #include "sio.h" @@ -33,8 +32,8 @@ typedef unsigned long int symbolMemaddr; -enum Prot { PROT_OFLOW, PROT_ITM, PROT_TPIU, PROT_UNKNOWN }; -const char *protString[] = {"OFLOW", "ITM", "TPIU", NULL}; +enum Prot { PROT_OFLOW, PROT_ETM, PROT_UNKNOWN }; +const char *protString[] = {"OFLOW", "ETM", NULL}; #define SCRATCH_STRING_LEN (65535) /* Max length for a string under construction */ //#define DUMP_BLOCK @@ -58,8 +57,7 @@ struct Options char *odoptions; /* Options to pass directly to objdump */ int buflen; /* Length of post-mortem buffer, in bytes */ - int channel; /* When TPIU is in use, which channel to decode? */ - int tag; /* which TPIU or OFLOW stream are we decoding? */ + int tag; /* which OFLOW stream are we decoding? */ int port; /* Source information */ char *server; enum Prot commProt; @@ -71,7 +69,7 @@ struct Options bool withDebugText; /* Include debug text (hidden in) output...screws line numbering a bit */ } _options = { - .port = OTCLIENT_SERVER_PORT, + .port = OFCLIENT_SERVER_PORT, .server = REMOTE_SERVER, .demangle = true, .traceProt = TRACE_PROT_ETM35, @@ -101,7 +99,6 @@ struct opConstruct struct RunTime { struct TRACEDecoder i; - struct TPIUDecoder t; struct OFLOW c; const char *progName; /* Name by which this program was called */ @@ -184,7 +181,7 @@ static void _printHelp( const char *const progName ) genericsPrintf( " -h, --help: This help" EOL ); genericsPrintf( " -M, --no-colour: Supress colour in output" EOL ); genericsPrintf( " -O, --objdump-opts: Options to pass directly to objdump" EOL ); - genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise TPIU" EOL ); + genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ETM" EOL ); genericsPrintf( " -P, --trace-proto: { " ); for ( int i = TRACE_PROT_LIST_START; i < TRACE_PROT_NUM; i++ ) @@ -194,11 +191,11 @@ static void _printHelp( const char *const progName ) genericsPrintf( "} trace protocol to use, default is %s" EOL, TRACEDecodeGetProtocolName( TRACE_PROT_LIST_START ) ); genericsPrintf( " -s, --server: : to use" EOL ); - genericsPrintf( " -t, --tag: : Which TPIU stream or OFLOW tag to use (normally 2)" EOL ); + genericsPrintf( " -t, --tag: : Which OFLOW tag to use (normally 2)" EOL ); genericsPrintf( " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); genericsPrintf( " -V, --version: Print version and exit" EOL ); - genericsPrintf( EOL "(Will connect one port higher than that set in -s when TPIU is not used)" EOL ); - genericsPrintf( "(this will automatically select the second output stream from orb TPIU.)" EOL ); + genericsPrintf( EOL "(Will connect one port higher than that set in -s for legacy protocol)" EOL ); + genericsPrintf( "(this will automatically select the second output stream from orbuculum.)" EOL ); genericsPrintf( EOL "Environment Variables;" EOL ); genericsPrintf( " OBJDUMP: to use non-standard objdump binary" EOL ); } @@ -226,7 +223,7 @@ static struct option _longOptions[] = {"trace-proto", required_argument, NULL, 'P'}, {"protocol", required_argument, NULL, 'p'}, {"server", required_argument, NULL, 's'}, - {"tpiu", required_argument, NULL, 't'}, + {"tag", required_argument, NULL, 't'}, {"verbose", required_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, {NULL, no_argument, NULL, 0} @@ -412,11 +409,11 @@ static bool _processOptions( int argc, char *argv[], struct RunTime *r ) // ------------------------------------ } - /* If we set an explicit server and port and didn't set a protocol chances are we want TPIU, not OFLOW */ - if ( serverExplicit && !protExplicit && r->options->port != OTCLIENT_SERVER_PORT ) + /* If we set an explicit server and port and didn't set a protocol chances are we want ETM, not OFLOW */ + if ( serverExplicit && !protExplicit && r->options->port != OFCLIENT_SERVER_PORT ) { - r->options->commProt = PROT_TPIU; - genericsReport( V_INFO, "(Auto-set ETM over TPIU for TCP::%s:%d, override by setting protocol explicitly)" EOL, r->options->server, r->options->port ); + r->options->commProt = PROT_ETM; + genericsReport( V_INFO, "(Auto-set ETM3.5 for TCP::%s:%d, override by setting protocol explicitly)" EOL, r->options->server, r->options->port ); } /* ... and dump the config if we're being verbose */ @@ -468,14 +465,10 @@ static bool _processOptions( int argc, char *argv[], struct RunTime *r ) genericsReport( V_INFO, "Decoding OFLOW with ETM in stream %d" EOL, r->options->tag ); break; - case PROT_ITM: - genericsReport( V_INFO, "Decoding ITM...not legal for TRACE" EOL ); + case PROT_ETM: + genericsReport( V_INFO, "Decoding ETM directly in legacy flow" EOL ); return false; - case PROT_TPIU: - genericsReport( V_INFO, "Using TPIU with ETM in stream %d" EOL, r->options->tag ); - break; - default: genericsReport( V_INFO, "Decoding unknown" EOL ); break; @@ -513,73 +506,27 @@ static void _processBlock( struct RunTime *r ) y = r->rawBlock.fillLevel; #endif - if ( PROT_TPIU == r->options->commProt ) + r->newTotalBytes += y; + + while ( y-- ) { - struct TPIUPacket p; + r->pmBuffer[r->wp] = *c++; + uint32_t nwp = ( r->wp + 1 ) % r->options->buflen; - while ( y-- ) + if ( nwp == r->rp ) { - if ( TPIU_EV_RXEDPACKET == TPIUPump( &r->t, *c++ ) ) + if ( r->singleShot ) { - if ( !TPIUGetPacket( &r->t, &p ) ) - { - genericsReport( V_WARN, "TPIUGetPacket fell over" EOL ); - } - else - { - /* Iterate through the packet, putting bytes for TRACE into the processing buffer */ - for ( uint32_t g = 0; g < p.len; g++ ) - { - if ( r->options->channel == p.packet[g].s ) - { - r->pmBuffer[r->wp] = p.packet[g].d; - r->newTotalBytes++; - uint32_t nwp = ( r->wp + 1 ) % r->options->buflen; - - if ( nwp == r->rp ) - { - if ( r->singleShot ) - { - r->held = true; - return; - } - else - { - r->rp = ( r->rp + 1 ) % r->options->buflen; - } - } - - r->wp = nwp; - } - } - } + r->held = true; + return; } - } - } - else - { - r->newTotalBytes += y; - - while ( y-- ) - { - r->pmBuffer[r->wp] = *c++; - uint32_t nwp = ( r->wp + 1 ) % r->options->buflen; - - if ( nwp == r->rp ) + else { - if ( r->singleShot ) - { - r->held = true; - return; - } - else - { - r->rp = ( r->rp + 1 ) % r->options->buflen; - } + r->rp = ( r->rp + 1 ) % r->options->buflen; } - - r->wp = nwp; } + + r->wp = nwp; } } } @@ -619,7 +566,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { @@ -1432,11 +1379,6 @@ int main( int argc, char *argv[] ) TRACEDecoderInit( &_r.i, _r.options->traceProt, !( _r.options->noAltAddr ), _traceReport ); - if ( PROT_TPIU == _r.options->commProt ) - { - TPIUDecoderInit( &_r.t ); - } - OFLOWInit( &_r.c ); /* Create a screen and interaction handler */ @@ -1452,7 +1394,7 @@ int main( int argc, char *argv[] ) /* Keep trying to open a network connection at half second intervals */ while ( 1 ) { - stream = streamCreateSocket( _r.options->server, _r.options->port + ( ( PROT_TPIU == _r.options->commProt ) ? 1 : 0 ) ); + stream = streamCreateSocket( _r.options->server, _r.options->port + ( ( PROT_OFLOW != _r.options->commProt ) ? 1 : 0 ) ); if ( stream ) { diff --git a/Src/orbprofile.c b/Src/orbprofile.c index 78593d1c..fefdb262 100644 --- a/Src/orbprofile.c +++ b/Src/orbprofile.c @@ -31,8 +31,8 @@ #define DEFAULT_DURATION_MS (1000) /* Default time to sample, in mS */ #define HANDLE_MASK (0xFFFFFF) /* cachegrind cannot cope with large file handle numbers */ -enum Prot { PROT_OFLOW, PROT_ITM, PROT_TPIU, PROT_UNKNOWN }; -const char *protString[] = {"OFLOW", "ITM", "TPIU", NULL}; +enum Prot { PROT_OFLOW, PROT_ETM, PROT_UNKNOWN }; +const char *protString[] = {"OFLOW", "ETM", NULL}; /* How many transfer buffers from the source to allocate */ #define NUM_RAW_BLOCKS (1000) @@ -65,8 +65,8 @@ struct Options /* Record for options, either defaults int sampleDuration; /* How long we are going to sample for */ bool mono; /* Supress colour in output */ bool noaltAddr; /* Dont use alternate addressing */ - int tag; /* Which TPIU or OFLOW stream are we decoding? */ - enum TRACEprotocol tProtocol; /* Encoding protocol to use */ + int tag; /* Which OFLOW stream are we decoding? */ + enum TRACEprotocol tProtocol; /* Encoding protocol to use */ int port; /* Source information for where to connect to */ char *server; @@ -77,7 +77,7 @@ struct Options /* Record for options, either defaults { .demangle = true, .sampleDuration = DEFAULT_DURATION_MS, - .port = OTCLIENT_SERVER_PORT, + .port = OFCLIENT_SERVER_PORT, .tProtocol = TRACE_PROT_ETM35, .tag = 2, .server = "localhost" @@ -469,15 +469,15 @@ static void _printHelp( const char *const progName ) genericsPrintf( " -M, --no-colour: Supress colour in output" EOL ); genericsPrintf( " -O, --objdump-opts: Options to pass directly to objdump" EOL ); genericsPrintf( " -P, --trace-proto: {ETM35|MTB} trace protocol to use, default is ETM35" EOL ); - genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise TPIU" EOL ); + genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise raw ETM" EOL ); genericsPrintf( " -s, --server: : to use" EOL ); - genericsPrintf( " -t, --tag: : Which TPIU stream or OFLOW tag to use (normally 2)" EOL ); + genericsPrintf( " -t, --tag: : Which OFLOW tag to use (normally 2)" EOL ); genericsPrintf( " -T, --all-truncate: truncate -d material off all references (i.e. make output relative)" EOL ); genericsPrintf( " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); genericsPrintf( " -V, --version: Print version and exit" EOL ); genericsPrintf( " -y, --graph-file: dotty filename for structured callgraph output" EOL ); genericsPrintf( " -z, --cache-file: profile filename for kcachegrind output" EOL ); - genericsPrintf( EOL "(Will connect one port higher than that set in -s when TPIU is not used)" EOL ); + genericsPrintf( EOL "(Will connect one port higher than that set in -s when Orbflow is not used)" EOL ); } // ==================================================================================================== void _printVersion( void ) @@ -691,10 +691,10 @@ static bool _processOptions( int argc, char *argv[], struct RunTime *r ) // ------------------------------------ } - /* If we set an explicit server and port and didn't set a protocol chances are we want TPIU, not OFLOW */ + /* If we set an explicit server and port and didn't set a protocol chances are we want ETM, not OFLOW */ if ( serverExplicit && !protExplicit ) { - r->options->protocol = PROT_TPIU; + r->options->protocol = PROT_ETM; } if ( !r->options->elffile ) @@ -719,7 +719,7 @@ static bool _processOptions( int argc, char *argv[], struct RunTime *r ) genericsReport( V_INFO, "Elf File : %s (%s Names)" EOL, r->options->elffile, r->options->truncateDeleteMaterial ? "Truncate" : "Don't Truncate" ); genericsReport( V_INFO, "Objdump options : %s" EOL, r->options->odoptions ? r->options->odoptions : "None" ); genericsReport( V_INFO, "Protocol : %s" EOL, TRACEDecodeGetProtocolName( r->options->tProtocol ) ); - genericsReport( V_INFO, "Tag (TPIU/OFLOW) : %d" EOL, r->options->tag ); + genericsReport( V_INFO, "Orbflow Tag : %d" EOL, r->options->tag ); genericsReport( V_INFO, "DOT file : %s" EOL, r->options->dotfile ? r->options->dotfile : "None" ); genericsReport( V_INFO, "Sample Duration : %d mS" EOL, r->options->sampleDuration ); @@ -729,12 +729,8 @@ static bool _processOptions( int argc, char *argv[], struct RunTime *r ) genericsReport( V_INFO, "Decoding OFLOW (Orbuculum) with ITM in stream %d" EOL, r->options->tag ); break; - case PROT_ITM: - genericsReport( V_INFO, "Decoding ITM. Not sensible for this application" EOL ); - return false; - - case PROT_TPIU: - genericsReport( V_INFO, "Using TPIU with ITM in stream %d" EOL, r->options->tag ); + case PROT_ETM: + genericsReport( V_INFO, "Using raw ETM" EOL ); break; default: @@ -771,7 +767,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) { if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { diff --git a/Src/orbstat.c b/Src/orbstat.c index b9349dc1..f78224fe 100644 --- a/Src/orbstat.c +++ b/Src/orbstat.c @@ -19,7 +19,6 @@ #include "uthash.h" #include "generics.h" #include "itmDecoder.h" -#include "tpiuDecoder.h" #include "msgDecoder.h" #include "oflow.h" #include "symbols.h" @@ -38,8 +37,8 @@ #define IN_EVENT (0x40000000) #define OUT_EVENT (0x50000000) -enum Prot { PROT_OFLOW, PROT_ITM, PROT_TPIU, PROT_UNKNOWN }; -const char *protString[] = {"OFLOW", "ITM", "TPIU", NULL}; +enum Prot { PROT_OFLOW, PROT_ITM, PROT_UNKNOWN }; +const char *protString[] = {"OFLOW", "ITM", NULL}; /* States for sample reception state machine */ enum CDState { CD_waitinout, CD_waitsrc, CD_waitdst }; @@ -66,7 +65,7 @@ struct Options /* Record for options, either defaults bool forceITMSync; /* Do we assume ITM starts synced? */ bool mono; /* Supress colour in output */ - uint32_t tag; /* Which TPIU or OFLOW stream are we decoding? */ + uint32_t tag; /* Which OFLOW stream are we decoding? */ int port; /* Source information for where to connect to */ char *server; @@ -76,7 +75,7 @@ struct Options /* Record for options, either defaults { .demangle = true, .sampleDuration = DEFAULT_DURATION_MS, - .port = OTCLIENT_SERVER_PORT, + .port = OFCLIENT_SERVER_PORT, .traceChannel = DEFAULT_TRACE_CHANNEL, .fileChannel = DEFAULT_FILE_CHANNEL, .forceITMSync = true, @@ -96,8 +95,6 @@ struct RunTime { struct ITMDecoder i; /* The decoders and the packets from them */ struct ITMPacket h; - struct TPIUDecoder t; - struct TPIUPacket p; struct OFLOW c; struct msg m; /* Decoded message out of ITM layer */ @@ -404,71 +401,6 @@ void _itmPumpProcess( struct RunTime *r, char c ) } } // ==================================================================================================== -void _protocolPump( struct RunTime *r, uint8_t c ) - -/* Top level protocol pump */ - -{ - if ( PROT_TPIU == r->options->protocol ) - { - switch ( TPIUPump( &r->t, c ) ) - { - // ------------------------------------ - case TPIU_EV_NEWSYNC: - genericsReport( V_INFO, "TPIU In Sync (%d)" EOL, TPIUDecoderGetStats( &r->t )->syncCount ); - - case TPIU_EV_SYNCED: - ITMDecoderForceSync( &r->i, true ); - break; - - // ------------------------------------ - case TPIU_EV_RXING: - case TPIU_EV_NONE: - break; - - // ------------------------------------ - case TPIU_EV_UNSYNCED: - genericsReport( V_INFO, "TPIU Lost Sync (%d)" EOL, TPIUDecoderGetStats( &r->t )->lostSync ); - ITMDecoderForceSync( &r->i, false ); - break; - - // ------------------------------------ - case TPIU_EV_RXEDPACKET: - if ( !TPIUGetPacket( &r->t, &r->p ) ) - { - genericsReport( V_WARN, "TPIUGetPacket fell over" EOL ); - } - - for ( uint32_t g = 0; g < r->p.len; g++ ) - { - if ( r->p.packet[g].s == r->options->tag ) - { - _itmPumpProcess( r, r->p.packet[g].d ); - continue; - } - - if ( r->p.packet[g].s != 0 ) - { - genericsReport( V_DEBUG, "Unknown TPIU channel %02x" EOL, r->p.packet[g].s ); - } - } - - break; - - // ------------------------------------ - case TPIU_EV_ERROR: - genericsReport( V_WARN, "****ERROR****" EOL ); - break; - // ------------------------------------ - } - } - else - { - /* There's no TPIU in use, so this goes straight to the ITM layer */ - _itmPumpProcess( r, c ); - } -} -// ==================================================================================================== static void _printHelp( struct RunTime *r ) { @@ -484,16 +416,15 @@ static void _printHelp( struct RunTime *r ) genericsPrintf( " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needs to issue syncs)" EOL ); genericsPrintf( " -M, --no-colour: Supress colour in output" EOL ); genericsPrintf( " -O, --objdump-opts: Options to pass directly to objdump" EOL ); - genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM unless" EOL \ - " explicitly set to TPIU to decode TPIU frames on channel set by -t" EOL ); + genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM" EOL ); genericsPrintf( " -s, --server: : to use" EOL ); - genericsPrintf( " -t, --tag: : Which TPIU stream or OFLOW tag to use (normally 1)" EOL ); + genericsPrintf( " -t, --tag: : Which OFLOW tag to use (normally 1)" EOL ); genericsPrintf( " -T, --all-truncate: truncate -d material off all references (i.e. make output relative)" EOL ); genericsPrintf( " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); genericsPrintf( " -V, --version: Print version and exit" EOL ); genericsPrintf( " -y, --graph-file: dotty filename for structured callgraph output" EOL ); genericsPrintf( " -z, --cache-file: profile filename for kcachegrind output" EOL ); - genericsPrintf( EOL "(Will connect one port higher than that set in -s when TPIU is not used)" EOL ); + genericsPrintf( EOL "(Will connect one port higher than that set in -s when Orbflow is not used)" EOL ); } // ==================================================================================================== @@ -519,7 +450,7 @@ static struct option _longOptions[] = {"objdump-opts", required_argument, NULL, 'O'}, {"protocol", required_argument, NULL, 'p'}, {"server", required_argument, NULL, 's'}, - {"tpiu", required_argument, NULL, 't'}, + {"tag", required_argument, NULL, 't'}, {"all-truncate", no_argument, NULL, 'T'}, {"verbose", required_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, @@ -710,7 +641,7 @@ static bool _processOptions( int argc, char *argv[], struct RunTime *r ) r->options->protocol = PROT_ITM; } - if ( ( r->options->protocol == PROT_TPIU ) && !portExplicit ) + if ( ( r->options->protocol == PROT_ITM ) && !portExplicit ) { r->options->port = NWCLIENT_SERVER_PORT; } @@ -746,10 +677,6 @@ static bool _processOptions( int argc, char *argv[], struct RunTime *r ) genericsReport( V_INFO, "Decoding ITM" EOL ); break; - case PROT_TPIU: - genericsReport( V_INFO, "Using TPIU with ITM in stream %d" EOL, r->options->tag ); - break; - default: genericsReport( V_INFO, "Decoding unknown" EOL ); break; @@ -774,7 +701,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { @@ -826,8 +753,7 @@ int main( int argc, char *argv[] ) #endif - /* Reset the TPIU handler before we start */ - TPIUDecoderInit( &_r.t ); + /* Reset the handlers before we start */ ITMDecoderInit( &_r.i, _r.options->forceITMSync ); OFLOWInit( &_r.c ); @@ -921,7 +847,7 @@ int main( int argc, char *argv[] ) while ( _r.rawBlock.fillLevel > 0 ) { - _protocolPump( &_r, *c++ ); + _itmPumpProcess( &_r, *c++ ); _r.rawBlock.fillLevel--; } } diff --git a/Src/orbtop.c b/Src/orbtop.c index e2473067..f8cf205b 100644 --- a/Src/orbtop.c +++ b/Src/orbtop.c @@ -21,7 +21,6 @@ #include "generics.h" #include "uthash.h" #include "git_version_info.h" -#include "tpiuDecoder.h" #include "itmDecoder.h" #include "oflow.h" #include "symbols.h" @@ -52,8 +51,8 @@ struct reportLine struct nameEntry *n; }; -enum Prot { PROT_OFLOW, PROT_ITM, PROT_TPIU, PROT_UNKNOWN }; -const char *protString[] = {"OFLOW", "ITM", "TPIU", NULL}; +enum Prot { PROT_OFLOW, PROT_ITM, PROT_UNKNOWN }; +const char *protString[] = {"OFLOW", "ITM", NULL}; struct exceptionRecord /* Record of exception activity */ @@ -76,7 +75,7 @@ struct exceptionRecord /* Record of exception activity */ /* ---------- CONFIGURATION ----------------- */ struct /* Record for options, either defaults or from command line */ { - uint32_t tag; /* Which TPIU or OFLOW stream are we decoding? */ + uint32_t tag; /* Which OFLOW stream are we decoding? */ bool reportFilenames; /* Report filenames for each routine? */ bool outputExceptions; /* Set to include exceptions in output flow */ bool forceITMSync; /* Must ITM start synced? */ @@ -113,7 +112,7 @@ struct /* Record for options, either defau .maxRoutines = 8, .demangle = true, .displayInterval = TOP_UPDATE_INTERVAL * 1000, - .port = OTCLIENT_SERVER_PORT, + .port = OFCLIENT_SERVER_PORT, .server = "localhost" }; @@ -123,8 +122,6 @@ struct struct ITMDecoder i; /* The decoders and the packets from them */ struct MSGSeq d; /* Message (re-)sequencer */ struct ITMPacket h; - struct TPIUDecoder t; - struct TPIUPacket p; struct OFLOW c; enum timeDelay timeStatus; /* Indicator of if this time is exact */ uint64_t timeStamp; /* Latest received time */ @@ -487,9 +484,6 @@ static void _outputJson( FILE *f, uint32_t total, uint32_t reportLines, struct r jsonElement = cJSON_CreateNumber( ITMDecoderGetStats( &_r.i )->syncCount ); assert( jsonElement ); cJSON_AddItemToObject( jsonStatsTable, "itmsync", jsonElement ); - jsonElement = cJSON_CreateNumber( TPIUDecoderGetStats( &_r.t )->syncCount ); - assert( jsonElement ); - cJSON_AddItemToObject( jsonStatsTable, "tpiusync", jsonElement ); jsonElement = cJSON_CreateNumber( ITMDecoderGetStats( &_r.i )->ErrorPkt ); assert( jsonElement ); cJSON_AddItemToObject( jsonStatsTable, "error", jsonElement ); @@ -762,10 +756,9 @@ static void _outputTop( uint32_t total, uint32_t reportLines, struct reportLine genericsPrintf( C_RESET "Interval = " C_DATA "%" PRIu64 C_RESET "ms" EOL, ( ( lastTime - _r.lastReportus ) ) / 1000 ); } - genericsReport( V_INFO, " Ovf=%3d ITMSync=%3d TPIUSync=%3d ITMErrors=%3d" EOL, + genericsReport( V_INFO, " Ovf=%3d ITMSync=%3d ITMErrors=%3d" EOL, ITMDecoderGetStats( &_r.i )->overflow, ITMDecoderGetStats( &_r.i )->syncCount, - TPIUDecoderGetStats( &_r.t )->syncCount, ITMDecoderGetStats( &_r.i )->ErrorPkt ); } @@ -885,71 +878,6 @@ void _itmPumpProcess( uint8_t c ) // Protocol pump for decoding messages // ==================================================================================================== // ==================================================================================================== -void _protocolPump( uint8_t c ) - -/* Top level protocol pump */ - -{ - if ( PROT_TPIU == options.protocol ) - { - switch ( TPIUPump( &_r.t, c ) ) - { - // ------------------------------------ - case TPIU_EV_NEWSYNC: - genericsReport( V_INFO, "TPIU In Sync (%d)" EOL, TPIUDecoderGetStats( &_r.t )->syncCount ); - - case TPIU_EV_SYNCED: - ITMDecoderForceSync( &_r.i, true ); - break; - - // ------------------------------------ - case TPIU_EV_RXING: - case TPIU_EV_NONE: - break; - - // ------------------------------------ - case TPIU_EV_UNSYNCED: - genericsReport( V_WARN, "TPIU Lost Sync (%d)" EOL, TPIUDecoderGetStats( &_r.t )->lostSync ); - ITMDecoderForceSync( &_r.i, false ); - break; - - // ------------------------------------ - case TPIU_EV_RXEDPACKET: - if ( !TPIUGetPacket( &_r.t, &_r.p ) ) - { - genericsReport( V_WARN, "TPIUGetPacket fell over" EOL ); - } - - for ( uint32_t g = 0; g < _r.p.len; g++ ) - { - if ( _r.p.packet[g].s == options.tag ) - { - _itmPumpProcess( _r.p.packet[g].d ); - continue; - } - - if ( _r.p.packet[g].s != 0 ) - { - genericsReport( V_DEBUG, "Unknown TPIU channel %02x" EOL, _r.p.packet[g].s ); - } - } - - break; - - // ------------------------------------ - case TPIU_EV_ERROR: - genericsReport( V_WARN, "****ERROR****" EOL ); - break; - // ------------------------------------ - } - } - else - { - /* There's no TPIU in use, so this goes straight to the ITM layer */ - _itmPumpProcess( c ); - } -} -// ==================================================================================================== void _printHelp( const char *const progName ) { @@ -969,12 +897,11 @@ void _printHelp( const char *const progName ) genericsPrintf( " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needs to issue syncs)" EOL ); genericsPrintf( " -o, --output-file: to be used for output live file" EOL ); genericsPrintf( " -O, --objdump-opts: Options to pass directly to objdump" EOL ); - genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM unless" EOL \ - " explicitly set to TPIU to decode TPIU frames on channel set by -t" EOL ); + genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM" EOL ); genericsPrintf( " -r, --routines: to record in live file (default %d routines)" EOL, options.maxRoutines ); genericsPrintf( " -R, --report-files: Report filenames as part of function discriminator" EOL ); genericsPrintf( " -s, --server: : to use" EOL ); - genericsPrintf( " -t, --tag: Which TPIU stream or OFLOW tag to use (normally 1)" EOL ); + genericsPrintf( " -t, --tag: Which OFLOW tag to use (normally 1)" EOL ); genericsPrintf( " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); genericsPrintf( " -V, --version: Print version and exit" EOL ); genericsPrintf( EOL "Environment Variables;" EOL ); @@ -1009,7 +936,7 @@ static struct option _longOptions[] = {"routines", required_argument, NULL, 'r'}, {"report-files", no_argument, NULL, 'R'}, {"server", required_argument, NULL, 's'}, - {"tpiu", required_argument, NULL, 't'}, + {"tag", required_argument, NULL, 't'}, {"verbose", required_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, {NULL, no_argument, NULL, 0} @@ -1244,10 +1171,6 @@ bool _processOptions( int argc, char *argv[] ) genericsReport( V_INFO, "Decoding ITM" EOL ); break; - case PROT_TPIU: - genericsReport( V_INFO, "Using TPIU with ITM in stream %d" EOL, options.tag ); - break; - default: genericsReport( V_INFO, "Decoding unknown" EOL ); break; @@ -1262,7 +1185,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) { if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { @@ -1352,8 +1275,7 @@ int main( int argc, char *argv[] ) genericsReport( V_WARN, "Loaded %s" EOL, options.elffile ); - /* Reset the TPIU handler before we start */ - TPIUDecoderInit( &_r.t ); + /* Reset the handlers before we start */ ITMDecoderInit( &_r.i, options.forceITMSync ); OFLOWInit( &_r.c ); MSGSeqInit( &_r.d, &_r.i, MSG_REORDER_BUFLEN ); @@ -1494,7 +1416,7 @@ int main( int argc, char *argv[] ) while ( receivedSize > 0 ) { - _protocolPump( *c++ ); + _itmPumpProcess( *c++ ); receivedSize--; } } diff --git a/Src/orbuculum.c b/Src/orbuculum.c index 17d16266..329f19e1 100644 --- a/Src/orbuculum.c +++ b/Src/orbuculum.c @@ -72,7 +72,7 @@ /* Number of potential tags */ #define NUM_TAGS (256) -#define LAST_TAG_SEEN_TIME_NS (2L*1000*1000*1000) +#define LAST_TAG_SEEN_TIME_NS (500L*1000L*1000L) /* Record of transferred data per tag */ struct TagDataCount @@ -163,7 +163,7 @@ struct RunTime struct Options _options = { - .listenPort = OTCLIENT_SERVER_PORT, + .listenPort = OFCLIENT_SERVER_PORT, .nwserverHost = NWSERVER_HOST, .channelList = "1", }; @@ -910,13 +910,13 @@ static void _OFLOWpacketRxed( struct OFLOWFrame *p, void *param ) if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else if ( ( r->options->useTPIU ) && ( h->channel == DEFAULT_ITM_STREAM ) ) { /* Deal with the bizzare combination of OFLOW and TPIU in channel 1 */ - /* Accounting will be done in TPIUPump2 */ - TPIUPump2( &r->t, p->d, p->len, _TPIUpacketRxed, r ); + /* Accounting will be done in TPIUPump */ + TPIUPump( &r->t, p->d, p->len, _TPIUpacketRxed, r ); } else { @@ -967,7 +967,7 @@ static void _processNonOFLOWBlock( struct RunTime *r, ssize_t fillLevel, uint8_t if ( r-> options->useTPIU ) { /* Strip the TPIU framing from this input */ - TPIUPump2( &r->t, buffer, fillLevel, _TPIUpacketRxed, r ); + TPIUPump( &r->t, buffer, fillLevel, _TPIUpacketRxed, r ); } else { diff --git a/Src/orbzmq.c b/Src/orbzmq.c index e76704bb..a83030ae 100644 --- a/Src/orbzmq.c +++ b/Src/orbzmq.c @@ -15,7 +15,6 @@ #include "git_version_info.h" #include "nw.h" #include "stream.h" -#include "tpiuDecoder.h" #include "itmDecoder.h" #include "msgDecoder.h" #include "oflow.h" @@ -26,8 +25,8 @@ #define DEFAULT_ZMQ_BIND_URL "tcp://*:3442" /* by default bind to all source interfaces */ -enum Prot { PROT_OFLOW, PROT_ITM, PROT_TPIU, PROT_UNKNOWN }; -const char *protString[] = {"OFLOW", "ITM", "TPIU", NULL}; +enum Prot { PROT_OFLOW, PROT_ITM, PROT_UNKNOWN }; +const char *protString[] = {"OFLOW", "ITM", NULL}; // Record for options, either defaults or from command line @@ -62,7 +61,7 @@ struct .forceITMSync = true, .tag = 1, .bindUrl = DEFAULT_ZMQ_BIND_URL, - .port = OTCLIENT_SERVER_PORT, + .port = OFCLIENT_SERVER_PORT, .server = "localhost" }; @@ -71,8 +70,6 @@ struct /* The decoders and the packets from them */ struct ITMDecoder i; struct ITMPacket h; - struct TPIUDecoder t; - struct TPIUPacket p; struct OFLOW c; /* Timestamp info */ @@ -414,58 +411,6 @@ void _itmPumpProcess( char c ) // ==================================================================================================== // ==================================================================================================== // ==================================================================================================== -void _protocolPump( uint8_t c ) -{ - if ( PROT_TPIU == options.protocol ) - { - switch ( TPIUPump( &_r.t, c ) ) - { - case TPIU_EV_NEWSYNC: - case TPIU_EV_SYNCED: - ITMDecoderForceSync( &_r.i, true ); - break; - - case TPIU_EV_RXING: - case TPIU_EV_NONE: - break; - - case TPIU_EV_UNSYNCED: - ITMDecoderForceSync( &_r.i, false ); - break; - - case TPIU_EV_RXEDPACKET: - if ( !TPIUGetPacket( &_r.t, &_r.p ) ) - { - genericsReport( V_WARN, "TPIUGetPacket fell over" EOL ); - } - - for ( uint32_t g = 0; g < _r.p.len; g++ ) - { - if ( _r.p.packet[g].s == options.tag ) - { - _itmPumpProcess( _r.p.packet[g].d ); - continue; - } - - if ( _r.p.packet[g].s != 0 ) - { - genericsReport( V_DEBUG, "Unknown TPIU channel %02x" EOL, _r.p.packet[g].s ); - } - } - - break; - - case TPIU_EV_ERROR: - genericsReport( V_WARN, "****ERROR****" EOL ); - break; - } - } - else - { - _itmPumpProcess( c ); - } -} -// ==================================================================================================== void _printHelp( const char *const progName ) { @@ -475,12 +420,11 @@ void _printHelp( const char *const progName ) genericsPrintf( " -E, --eof: Terminate when the file/socket ends/is closed, otherwise wait to reconnect" EOL ); genericsPrintf( " -f, --input-file: Take input from specified file" EOL ); genericsPrintf( " -h, --help: This help" EOL ); - genericsPrintf( " -M, --no-colour: Supress colour in output" EOL ); + genericsPrintf( " -M, --no-colour: Supress colour in output" EOL ); genericsPrintf( " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needs to issue syncs)" EOL ); - genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM unless" EOL \ - " explicitly set to TPIU to decode TPIU frames on channel set by -t" EOL ); + genericsPrintf( " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM" EOL ); genericsPrintf( " -s, --server: : to use, default %s:%d" EOL, options.server, options.port ); - genericsPrintf( " -t, --tag: : Which TPIU stream or OFLOW tag to use (normally 1)" EOL ); + genericsPrintf( " -t, --tag: : Which Orbflow tag to use (normally 1)" EOL ); genericsPrintf( " -v, --verbose: Verbose mode 0(errors)..3(debug)" EOL ); genericsPrintf( " -V, --version: Print version and exit" EOL ); genericsPrintf( " -z, --zbind: : ZeroMQ bind URL, default %s" EOL, options.bindUrl ); @@ -565,7 +509,7 @@ static struct option _longOptions[] = {"no-color", no_argument, NULL, 'M'}, {"protocol", required_argument, NULL, 'p'}, {"server", required_argument, NULL, 's'}, - {"tpiu", required_argument, NULL, 't'}, + {"tag", required_argument, NULL, 't'}, {"verbose", required_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, {NULL, no_argument, NULL, 0} @@ -792,7 +736,7 @@ bool _processOptions( int argc, char *argv[] ) options.protocol = PROT_ITM; } - if ( ( options.protocol == PROT_TPIU ) && !portExplicit ) + if ( ( options.protocol == PROT_ITM ) && !portExplicit ) { options.port = NWCLIENT_SERVER_PORT; } @@ -855,10 +799,6 @@ bool _processOptions( int argc, char *argv[] ) genericsReport( V_INFO, "Decoding ITM" EOL ); break; - case PROT_TPIU: - genericsReport( V_INFO, "Using TPIU with ITM in stream %d" EOL, options.tag ); - break; - default: genericsReport( V_INFO, "Decoding unknown" EOL ); break; @@ -887,7 +827,7 @@ static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param ) { if ( !p->good ) { - genericsReport( V_WARN, "Bad packet received" EOL ); + genericsReport( V_INFO, "Bad packet received" EOL ); } else { @@ -937,7 +877,7 @@ static void _feedStream( struct Stream *stream ) while ( receivedSize-- ) { - _protocolPump( *c++ ); + _itmPumpProcess( *c++ ); } fflush( stdout ); @@ -971,9 +911,7 @@ int main( int argc, char *argv[] ) _r.zmqSocket = zmq_socket( _r.zmqContext, ZMQ_PUB ); zmq_bind( _r.zmqSocket, "tcp://*:3442" ); //options.bindUrl ); - /* Reset the TPIU handler before we start */ - TPIUDecoderInit( &_r.t ); - ITMDecoderInit( &_r.i, options.forceITMSync ); + /* Reset the OFLOW handler before we start */ OFLOWInit( &_r.c ); /* This ensures the signal handler gets called */ diff --git a/Src/tpiuDecoder.c b/Src/tpiuDecoder.c index 396d2699..756ccf79 100644 --- a/Src/tpiuDecoder.c +++ b/Src/tpiuDecoder.c @@ -94,7 +94,7 @@ void TPIUDecoderForceSync( struct TPIUDecoder *t, uint8_t offset ) gettimeofday( &t->lastPacket, NULL ); } // ==================================================================================================== -bool TPIUGetPacket( struct TPIUDecoder *t, struct TPIUPacket *p ) +bool _getPacket( struct TPIUDecoder *t, struct TPIUPacket *p ) /* Copy received packet into transfer buffer, and reset receiver */ @@ -179,117 +179,9 @@ void _decodeCommsStats( struct TPIUDecoder *t ) t->commsStats.totalFrames = ( t->rxedPacket[11] << 24 ) | ( t->rxedPacket[10] << 16 ) | ( t->rxedPacket[9] << 8 ) | ( t->rxedPacket[8] ); } // ==================================================================================================== -enum TPIUPumpEvent TPIUPump( struct TPIUDecoder *t, uint8_t d ) - -/* LEGACY:: Pump next byte into the protocol decoder */ - -{ - struct timeval nowTime, diffTime; - - t->syncMonitor = ( t->syncMonitor << 8 ) | d; - - if ( t->syncMonitor == SYNCPATTERN ) - { - - enum TPIUPumpEvent r; - - if ( t->state != TPIU_UNSYNCED ) - { - r = TPIU_EV_SYNCED; - } - else - { - r = TPIU_EV_NEWSYNC; - } - - /* Deal with the special state that these are communication stats from the link */ - /* ...it is still a reset though! */ - if ( ( t->byteCount == 14 ) && ( t->rxedPacket[0] == STAT_SYNC_BYTE ) ) - { - _decodeCommsStats( t ); - } - - t->state = TPIU_RXING; - t->stats.syncCount++; - t->byteCount = 0; - t->got_lowbits = false; - genericsReport( V_DEBUG, "!!!! " EOL ); - - /* Consider this a valid timestamp */ - gettimeofday( &t->lastPacket, NULL ); - - return r; - } - - switch ( t->state ) - { - // ----------------------------------- - case TPIU_UNSYNCED: - return TPIU_EV_NONE; - - // ----------------------------------- - case TPIU_RXING: - - // We collect in sets of 16 bits, in order to filter halfsyncs (0x7fff) - if ( !t->got_lowbits ) - { - t->got_lowbits = true; - t->rxedPacket[t->byteCount] = d; - return TPIU_EV_NONE; - } - - t->got_lowbits = false; - - if ( ( d == HALFSYNC_HIGH ) && ( t->rxedPacket[t->byteCount] == HALFSYNC_LOW ) ) - { - // A halfsync, waste of space, to be ignored - t->stats.halfSyncCount++; - return TPIU_EV_NONE; - } - - // Pre-increment for the low byte we already got, post increment for this one - genericsReport( V_DEBUG, "[%02x %02x] ", t->rxedPacket[t->byteCount], d ); - t->byteCount++; - t->rxedPacket[t->byteCount++] = d; - - if ( t->byteCount != TPIU_PACKET_LEN ) - { - return TPIU_EV_RXING; - } - - /* Check if this packet arrived a sensible time since the last one */ - gettimeofday( &nowTime, NULL ); - timersub( &nowTime, &t->lastPacket, &diffTime ); - memcpy( &t->lastPacket, &nowTime, sizeof( struct timeval ) ); - t->byteCount = 0; - - /* If it was less than the timeout period then it's valid */ - if ( ( diffTime.tv_sec == 0 ) && ( diffTime.tv_usec < TPIU_TIMEOUT_US ) ) - { - t->stats.packets++; - genericsReport( V_DEBUG, EOL ); - return TPIU_EV_RXEDPACKET; - } - else - { - genericsReport( V_WARN, ">>>>>>>>> PACKET INTERVAL TOO LONG <<<<<<<<<<<<<<" EOL ); - t->state = TPIU_UNSYNCED; - t->stats.lostSync++; - return TPIU_EV_UNSYNCED; - } - - // ----------------------------------- - default: - genericsReport( V_WARN, "In illegal state %d" EOL, t->state ); - t->stats.error++; - return TPIU_EV_ERROR; - // ----------------------------------- - } -} -// ==================================================================================================== -void TPIUPump2( struct TPIUDecoder *t, uint8_t *frame, int len, - void ( *packetRxed )( enum TPIUPumpEvent e, struct TPIUPacket *p, void *param ), - void *param ) +void TPIUPump( struct TPIUDecoder *t, uint8_t *frame, int len, + void ( *packetRxed )( enum TPIUPumpEvent e, struct TPIUPacket *p, void *param ), + void *param ) /* Assemble this packet into TPIU frames and call them back */ @@ -387,7 +279,7 @@ void TPIUPump2( struct TPIUDecoder *t, uint8_t *frame, int len, t->byteCount = 0; genericsReport( V_DEBUG, EOL ); - if ( TPIUGetPacket( t, &_packet ) ) + if ( _getPacket( t, &_packet ) ) { packetRxed( TPIU_EV_RXEDPACKET, &_packet, param ); } diff --git a/Support/gdbtrace.init b/Support/gdbtrace.init index 794c3170..00d5b728 100644 --- a/Support/gdbtrace.init +++ b/Support/gdbtrace.init @@ -1572,89 +1572,6 @@ enableSAMD5XTRACE : Enable TRACE on SAM5x pins : Number of bits wide (1,2 or 4 only) : Drive strength (0=normal, 1=strong) end -# ==================================================================== -define enableSAMD5XTRACE - #set language c - - set $bits=4 - set $drive=1 - - if $argc >= 1 - set $bits = $arg0 - end - if (($bits<1) || ($bits==3) || ($bits>4)) - help enableSAMD5XTRACE - end - - if $argc >= 2 - set $drive = $arg1 - end - - if ($drive > 1) - help enableSAMD5XTRACE - end - - set $bits = $bits-1 - set $CPU=$CPU_SAMD5x - - # Enable peripheral channel clock on GCLK#0 - # GCLK->PHCTRL[47] = GCLK_PCHCTRL_GEN(0) - set *(unsigned char *)0x40001D3C = 0 - # GCLK->PHCTRL[47] |= GCLK_PCHCTRL_CHEN - set *(unsigned char *)0x40001D3C |= 0x40 - - # Setup PC28 - pmux 7 - set *(unsigned char *)(0x41008000+0x80*2+0x30+28/2) &= ~0x0f - set *(unsigned char *)(0x41008000+0x80*2+0x30+28/2) |= 0x07 - set *(unsigned char *)(0x41008000+0x80*2+0x40+28) = (($drive) << 6) | 1 - - # Setup PC27 - pmux 7 - set *(unsigned char *)(0x41008000+0x80*2+0x30+27/2) &= ~0xf0 - set *(unsigned char *)(0x41008000+0x80*2+0x30+27/2) |= 0x70 - set *(unsigned char *)(0x41008000+0x80*2+0x40+27) = (($drive) << 6) | 1 - - if ($bits>0) - # Setup PC26 - pmux 7 - set *(unsigned char *)(0x41008000+0x80*2+0x30+26/2) &= ~0x0f - set *(unsigned char *)(0x41008000+0x80*2+0x30+26/2) |= 0x07 - set *(unsigned char *)(0x41008000+0x80*2+0x40+26) = (($drive) << 6) | 1 - end - - if ($bits>1) - # Setup PC25 - pmux 7 - set *(unsigned char *)(0x41008000+0x80*2+0x30+25/2) &= ~0xf0 - set *(unsigned char *)(0x41008000+0x80*2+0x30+25/2) |= 0x70 - set *(unsigned char *)(0x41008000+0x80*2+0x40+25) = (($drive) << 6) | 1 - - # Setup PC24 - pmux 7 - set *(unsigned char *)(0x41008000+0x80*2+0x30+24/2) &= ~0x0f - set *(unsigned char *)(0x41008000+0x80*2+0x30+24/2) |= 0x07 - set *(unsigned char *)(0x41008000+0x80*2+0x40+24) = (($drive) << 6) | 1 - end - - # Set number of bits in DBGMCU_CR - set *0xE0042004 &= ~(3<<6) - - if ($bits<3) - set *0xE0042004 |= ((($bits+1)<<6) | (1<<5)) - else - set *0xE0042004 |= ((3<<6) | (1<<5)) - end - - # Enable Trace TRCENA (DCB DEMCR) - set *($CDBBASE+0xC)=(1<<24) - - # Finally start the trace output - _doTRACE - - #set language auto -end -document enableSAMD5XTRACE -enableSAMD5XTRACE : Enable TRACE on SAM5x pins - : Number of bits wide (1,2 or 4 only) - : Drive strength (0=normal, 1=strong) -end - # ==================================================================== define dwtPOSTCNT #set language c