Skip to content

Commit

Permalink
Protocol name migration from OTAG to orbflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Aug 23, 2024
1 parent 7fe0a87 commit 89ed9e8
Show file tree
Hide file tree
Showing 18 changed files with 247 additions and 247 deletions.
4 changes: 2 additions & 2 deletions Inc/itmfifos.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "tpiuDecoder.h"
#include "itmDecoder.h"
#include "otag.h"
#include "oflow.h"

#include "generics.h"

Expand All @@ -27,7 +27,7 @@ extern "C" {
struct Channel;
struct itmfifosHandle;

enum Prot { PROT_OTAG, PROT_ITM, PROT_TPIU, PROT_UNKNOWN };
enum Prot { PROT_OFLOW, PROT_ITM, PROT_TPIU, PROT_UNKNOWN };

/* Fifos running */
void itmfifoForceSync( struct itmfifosHandle *f, bool synced ); /* Force sync status */
Expand Down
44 changes: 22 additions & 22 deletions Inc/otag.h → Inc/oflow.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* SPDX-License-Identifier: BSD-3-Clause */

/*
* OTAG Module
* ===========
* ORBFLOW Module
* ==============
*
*/

#ifndef _OTAG_
#define _OTAG_
#ifndef _ORBFLOW_
#define _ORBFLOW_

#include <stdint.h>
#include <stdbool.h>
Expand All @@ -18,7 +18,7 @@
extern "C" {
#endif

struct OTAGFrame
struct OFLOWFrame
{
unsigned int len; /* Received length (after pre-processing) */
uint8_t tag; /* Tag (packet type) */
Expand All @@ -29,41 +29,41 @@ struct OTAGFrame
uint8_t *d; /* ...pointer to the data itself */
};

struct OTAG
struct OFLOW
{
bool selfAllocated; /* Flag indicating that memory was allocated by the library */
struct COBS c;
struct OTAGFrame f;
struct OFLOWFrame f;

/* Materials for callback */
void ( *cb )( struct OTAGFrame *p, void *param );
void ( *cb )( struct OFLOWFrame *p, void *param );
void *param;
};

#define OTAG_MAX_PACKET_LEN (COBS_MAX_PACKET_LEN-2)
#define OTAG_MAX_ENC_PACKET_LEN (COBS_MAX_ENC_PACKET_LEN)
#define OTAG_EOP_LEN (COBS_EOP_LEN)
#define OTAG_TS_RESOLUTION (1000000000L)
#define OFLOW_MAX_PACKET_LEN (COBS_MAX_PACKET_LEN-2)
#define OFLOW_MAX_ENC_PACKET_LEN (COBS_MAX_ENC_PACKET_LEN)
#define OFLOW_EOP_LEN (COBS_EOP_LEN)
#define OFLOW_TS_RESOLUTION (1000000000L)

// ====================================================================================================

static inline uint64_t OTAGResolution( struct OTAG *t )
static inline uint64_t OFLOWResolution( struct OFLOW *t )
{
return OTAG_TS_RESOLUTION;
return OFLOW_TS_RESOLUTION;
}

const uint8_t *OTAGgetFrameExtent( const uint8_t *inputEnc, int len );
bool OTAGisEOFRAME( const uint8_t *inputEnc );
const uint8_t *OFLOWgetFrameExtent( const uint8_t *inputEnc, int len );
bool OFLOWisEOFRAME( const uint8_t *inputEnc );

void OTAGEncode( const uint8_t channel, const uint64_t tstamp, const uint8_t *inputMsg, int len, struct Frame *o );
void OFLOWEncode( const uint8_t channel, const uint64_t tstamp, const uint8_t *inputMsg, int len, struct Frame *o );

/* Context free functions */
void OTAGPump( struct OTAG *t, const uint8_t *incoming, int len,
void ( *packetRxed )( struct OTAGFrame *p, void *param ),
void *param );
void OFLOWPump( struct OFLOW *t, const uint8_t *incoming, int len,
void ( *packetRxed )( struct OFLOWFrame *p, void *param ),
void *param );

void OTAGDelete( struct OTAG *t );
struct OTAG *OTAGInit( struct OTAG *t );
void OFLOWDelete( struct OFLOW *t );
struct OFLOW *OFLOWInit( struct OFLOW *t );
// ====================================================================================================
#ifdef __cplusplus
}
Expand Down
8 changes: 4 additions & 4 deletions Inc/orbtraceIf.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct OrbtraceIf
uint8_t ep; /* Endpoint used for data transfer */
uint8_t iface; /* ...and the interface */
bool isOrbtrace; /* Is this an orbtrace device? */
bool supportsOTAG; /* ...and does it support OTAG for transfer? */
bool supportsOFLOW; /* ...and does it support OFLOW for transfer? */

int numDevices; /* Number of matching devices found */
struct OrbtraceIfDevice *devices; /* List of matching devices found */
Expand Down Expand Up @@ -142,9 +142,9 @@ static inline libusb_device_handle *OrbtraceIfGetHandle( struct OrbtraceIf *o )
return o->handle;
}

static inline bool OrbtraceSupportsOTAG( struct OrbtraceIf *o )
static inline bool OrbtraceSupportsOFLOW( struct OrbtraceIf *o )
{
return o->supportsOTAG;
return o->supportsOFLOW;
}

/* Device selection management */
Expand All @@ -156,7 +156,7 @@ bool OrbtraceGetIfandEP( struct OrbtraceIf *o );
void OrbtraceIfCloseDevice( struct OrbtraceIf *o );
enum Channel OrbtraceIfNameToChannel( char *x );
bool OrbtraceIsOrbtrace( struct OrbtraceIf *o );
bool OrbtraceSupportsOTAG( struct OrbtraceIf *o );
bool OrbtraceSupportsOFLOW( struct OrbtraceIf *o );

/* Device manipulation */
bool OrbtraceIfSetTraceWidth( struct OrbtraceIf *o, int width );
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,21 +335,21 @@ Some debug drivers (e.g. openocd, pyocd) can now create an orbuculum-compatible
allows you to connect the rest of the suite to that directly, without needing to use the orbuculum mux itself.

However, times have moved on. Passing all those data through transparently was wasteful as a fair bit of it
was 'nothing to see here', so Orbuculum now supports a new protocol, OTAG. OTAG is always carried on TCP/3402 and
was 'nothing to see here', so Orbuculum now supports a new protocol, orbflow (OFLOW). Orbflow is always carried on TCP/3402 and
is a bit more intelligent than simply passing through the messages from the probe. It turns the stream of data into
COBS encoded sequenced messages with defined message boundries and it also removes the redundant data. When used
in conjunction with an ORBTrace probe the OTAG messages are created in the probe itself, providing a further
in conjunction with an ORBTrace probe the orbflow messages are created in the probe itself, providing a further
performance improvement.

Basically, all of this is mostly transparent to the regular end user. OTAG is automatically used for communication
Basically, all of this is mostly transparent to the regular end user. Orbflow is automatically used for communication
between orbuculum and its clients if it's available, and Orbuculum still provides the TCP/3443 port it always did,
which you can connect to in the same way as you used to if you've got custom clients. OTAG will give you a performance
which you can connect to in the same way as you used to if you've got custom clients. Orbflow will give you a performance
improvement, but it's otherwise mostly transparent.

There are come slight changes to the command line options though. Historically, when using TPIU decoding,
you had to specify the channels to be decoded with an option like `-T 1,2`. You now simply need to tell orbuculum
which tags to process with `-t 1,2` and, if your probe doesn't remove TPIU framing automatically, specify the `-T`
option on its own....if you try to specify the `-T` option and you've got an ORBTrace that supports OTAG protocol
option on its own....if you try to specify the `-T` option and you've got an ORBTrace that supports Orbflow protocol
then you'll get a warning, because TPIU framing removal is done automatically in the probe in that case, so you
don't generally need it.

Expand Down
16 changes: 8 additions & 8 deletions Src/itmfifos.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "generics.h"
#include "tpiuDecoder.h"
#include "itmDecoder.h"
#include "otag.h"
#include "oflow.h"
#include "fileWriter.h"
#include "itmfifos.h"
#include "msgDecoder.h"
Expand Down Expand Up @@ -61,7 +61,7 @@ struct itmfifosHandle
struct ITMPacket h;
struct TPIUDecoder t;
struct TPIUPacket p;
struct OTAG ot;
struct OFLOW ot;
enum timeDelay timeStatus; /* Indicator of if this time is exact */
uint64_t timeStamp; /* Latest received time */

Expand All @@ -73,10 +73,10 @@ struct itmfifosHandle
bool filewriter; /* Is the filewriter in use? */
bool forceITMSync; /* Is ITM to be forced into sync? */
bool permafile; /* Use permanent files rather than fifos */
int tag; /* Which OTAG or TPIU stream are we decoding? */
int tag; /* Which OFLOW or TPIU stream are we decoding? */
bool amEnding; /* Flag indicating end is in progress */

enum Prot protocol; /* What protocol to communicate (default to OTAG (== orbuculum)) */
enum Prot protocol; /* What protocol to communicate (default to OFLOW (== orbuculum)) */

struct Channel c[NUM_CHANNELS + 1]; /* Output for each channel */
};
Expand Down Expand Up @@ -553,7 +553,7 @@ static void _tpiuProtocolPump( struct itmfifosHandle *f, uint8_t c )

// ====================================================================================================

static void _OTAGpacketRxed ( struct OTAGFrame *p, void *param )
static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param )

{
struct itmfifosHandle *f = ( struct itmfifosHandle * )param;
Expand Down Expand Up @@ -705,9 +705,9 @@ void itmfifoProtocolPump( struct itmfifosHandle *f, uint8_t *c, int len )

{

if ( PROT_OTAG == f->protocol )
if ( PROT_OFLOW == f->protocol )
{
OTAGPump( &f->ot, c, len, _OTAGpacketRxed, f );
OFLOWPump( &f->ot, c, len, _OFLOWpacketRxed, f );
}
else
while ( len-- )
Expand Down Expand Up @@ -745,7 +745,7 @@ bool itmfifoCreate( struct itmfifosHandle *f )

/* Reset the TPIU handler before we start */
TPIUDecoderInit( &f->t );
OTAGInit( &f->ot );
OFLOWInit( &f->ot );
ITMDecoderInit( &f->i, f->forceITMSync );

/* Cycle through channels and create a fifo for each one that is enabled */
Expand Down
38 changes: 19 additions & 19 deletions Src/otag.c → Src/oflow.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: BSD-3-Clause */

/*
* OTAG Encoder/Decoder Module
* ===========================
* ORBFLOW Encoder/Decoder Module
* ==============================
*
*
*/
Expand All @@ -12,17 +12,17 @@
#include <assert.h>
#include <time.h>
#include "cobs.h"
#include "otag.h"
#include "oflow.h"

// ====================================================================================================
struct OTAG *OTAGInit( struct OTAG *t )
struct OFLOW *OFLOWInit( struct OFLOW *t )

/* Reset a OTAG instance */
/* Reset a OFLOW instance */

{
if ( !t )
{
t = ( struct OTAG * )calloc( 1, sizeof( struct OTAG ) );
t = ( struct OFLOW * )calloc( 1, sizeof( struct OFLOW ) );
t->selfAllocated = true;
}

Expand All @@ -32,9 +32,9 @@ struct OTAG *OTAGInit( struct OTAG *t )
return t;
}
// ====================================================================================================
void OTAGDelete( struct OTAG *t )
void OFLOWDelete( struct OFLOW *t )

/* Destroy a OTAG instance, but only if we created it */
/* Destroy a OFLOW instance, but only if we created it */

{
/* Need to remove the containing COBS instance */
Expand All @@ -49,7 +49,7 @@ void OTAGDelete( struct OTAG *t )

// ====================================================================================================

void OTAGEncode( const uint8_t channel, const uint64_t tstamp, const uint8_t *inputMsg, int len, struct Frame *o )
void OFLOWEncode( const uint8_t channel, const uint64_t tstamp, const uint8_t *inputMsg, int len, struct Frame *o )

/* Encode frame and write into provided output Frame buffer */

Expand All @@ -71,7 +71,7 @@ void OTAGEncode( const uint8_t channel, const uint64_t tstamp, const uint8_t *in

// ====================================================================================================

bool OTAGisEOFRAME( const uint8_t *inputEnc )
bool OFLOWisEOFRAME( const uint8_t *inputEnc )

{
return ( COBS_SYNC_CHAR == *inputEnc );
Expand All @@ -82,11 +82,11 @@ static void _pumpcb( struct Frame *p, void *param )

{
/* Callback function when a COBS packet is complete */
struct OTAG *t = ( struct OTAG * )param;
struct OFLOW *t = ( struct OFLOW * )param;

t->f.len = p->len - 2; /* OTAG frames have the first element representing the tag and last element the checksum */
t->f.tag = p->d[0]; /* First byte of an OTAG frame is the tag */
t->f.sum = p->d[p->len - 1]; /* Last byte of an OTAG frame is the sum */
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 */
Expand All @@ -104,8 +104,8 @@ static void _pumpcb( struct Frame *p, void *param )
( t->cb )( &t->f, t->param );
}

void OTAGPump( struct OTAG *t, const uint8_t *incoming, int len,
void ( *packetRxed )( struct OTAGFrame *p, void *param ),
void OFLOWPump( struct OFLOW *t, const uint8_t *incoming, int len,
void ( *packetRxed )( struct OFLOWFrame *p, void *param ),
void *param )


Expand All @@ -115,20 +115,20 @@ void OTAGPump( struct OTAG *t, const uint8_t *incoming, int len,
struct timespec ts;
t->cb = packetRxed;
clock_gettime( CLOCK_REALTIME, &ts );
t->f.tstamp = ts.tv_sec * OTAG_TS_RESOLUTION + ts.tv_nsec; /* For now, fake the timestamp */
t->f.tstamp = ts.tv_sec * OFLOW_TS_RESOLUTION + ts.tv_nsec; /* For now, fake the timestamp */
t->param = param;
COBSPump( &t->c, incoming, len, _pumpcb, t );
}

// ====================================================================================================

const uint8_t *OTAGgetFrameExtent( const uint8_t *inputEnc, int len )
const uint8_t *OFLOWgetFrameExtent( const uint8_t *inputEnc, int len )

/* Look through memory until an end of frame marker is found, or memory is exhausted. */

{
/* Go find the next sync */
while ( !OTAGisEOFRAME( inputEnc ) && --len )
while ( !OFLOWisEOFRAME( inputEnc ) && --len )
{
inputEnc++;
}
Expand Down
Loading

0 comments on commit 89ed9e8

Please sign in to comment.