#ifndef _PROTO_INCLUDED #define _PROTO_INCLUDED /************************************************************************** Basic types and includes **************************************************************************/ #include /* #include */ /* for size_t */ #if defined(WIN32) || defined(WIN64) # ifndef _WINDOWS_ # include # endif # define DLLMOD __declspec(dllexport) # if defined(WIN64) typedef __int64 protoSizeT; # else typedef int protoSizeT; # endif # define PROTOAPI __cdecl #else typedef int protoSizeT; # define PROTOAPI #endif #ifndef INT8_MIN # if defined(T32HOST_T32) || defined(WIN32) || defined(WIN64) typedef unsigned int uint32_t; # ifdef T32HOST_T32_PPC typedef long long int64_t; typedef unsigned long long uint64_t; # endif # if defined(WIN32) || defined(WIN64) typedef __int64 int64_t; typedef unsigned __int64 uint64_t; # endif # else # define __STDC_LIMIT_MACROS 1 # define __STDC_CONSTANT_MACROS 1 # if defined(__SUNPRO_C) || defined(__hpux) # include # else # include # endif # endif #endif /*typedef size_t protoSizeT;*/ typedef uint32_t protoWord32; typedef uint64_t protoWord64; typedef int64_t protoTime; #define PROTO_VERSION 2 #define PROTO_MAXLEVELS 16 #define PROTO_MAXCHANNELS 256 typedef void * protoContext; typedef void * protoPtr; #ifdef __cplusplus extern "C" { #endif /************************************************************************** Internal callback structure (DO NOT ACCESS THIS STRUCTURE) **************************************************************************/ typedef struct { int version; void * (PROTOAPI *alloc)(protoContext context, protoSizeT size); void (PROTOAPI *free)(protoContext context, void * ptr); void (PROTOAPI *setDefaultLevel)(protoContext context, int level); void (PROTOAPI *parse)(protoContext context, protoPtr result, char * names, int flags); int (PROTOAPI *cancel)(protoContext context); protoSizeT (PROTOAPI *readTrace)(protoContext context, protoSizeT index, protoTime * timestamp, int * data); void (PROTOAPI *puts)(protoContext context, const char *text); void (PROTOAPI *printf)(protoContext context, const char *format, va_list ap); void (PROTOAPI *control)(protoContext context, int controlcode); void (PROTOAPI *registerProcessCallback)(protoContext context, protoSizeT (PROTOAPI *callback)(protoContext context, protoPtr arrayOut, protoSizeT arrayOutSize, protoPtr arrayIn, protoSizeT arrayInSize, protoPtr localdata), protoPtr localdata, protoSizeT size, int flags); void (PROTOAPI *registerDisplayCallback)(protoContext context, void (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata), protoPtr localdata, int flags); void (PROTOAPI *registerChartCallback)(protoContext context, const char * (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata), protoPtr localdata, int flags); void (PROTOAPI *registerDrawCallback)(protoContext context, int (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata, int * result), protoPtr localdata, int flags, int channels, int low, int high); void (PROTOAPI *registerFindCallback)(protoContext context, int (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata), protoPtr localdata, int flags); void (PROTOAPI *registerExportCallback)(protoContext context, void (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata), protoPtr localdata, int flags); void (PROTOAPI *registerShareCallback)(protoContext context, int (PROTOAPI *callback)(protoContext context, protoPtr sharedata, protoPtr localdata), protoPtr localdata, int flags); void (PROTOAPI *registerProfileChartCallback)(protoContext context, const char * (PROTOAPI *callback)(protoContext context, protoPtr data, int * color, protoPtr localdata), protoPtr localdata, int flags); protoSizeT (PROTOAPI *findTrace)(protoContext context, protoSizeT index, int signal, protoTime * timestamp, int * data); int apiversion; } protoInfo; /************************************************************************** Time functions (the processing functions are not required) **************************************************************************/ #define PROTO_TIME_ONEMICROSECOND ((protoTime)(50*256)) #define PROTO_TIME_ONEMILLISECOND (PROTO_TIME_ONEMICROSECOND*1000) #define PROTO_TIME_ONESECOND (PROTO_TIME_ONEMICROSECOND*1000000) #define PROTO_TIME_TOINT(x) (x) #define PROTO_TIME_DIV(x,y) ((x)/(y)) #define PROTO_TIME_DIVINT(x,y) ((x)/(y)) #define PROTO_TIME_MULT(x,y) ((x)*(y)) #define PROTO_TIME_MULTINT(x,y) ((x)*(y)) #define PROTO_TIME_ADD(x,y) ((x)+(y)) #define PROTO_TIME_SUB(x,y) ((x)-(y)) #define PROTO_TIME_ABS(x) (((x)<0)?-(x):(x)) #define PROTO_TIME_ISSMALLER(x,y) ((x)<(y)) #define PROTO_TIME_ISZERO(x) ((x)==0) /************************************************************************** Library entry and parser function **************************************************************************/ #define PROTO_OK 1 #define PROTO_FAIL -1 #define PROTO_COMMAND_LIST 0 #define PROTO_COMMAND_CHART 1 #define PROTO_COMMAND_DRAW 2 #define PROTO_COMMAND_FIND 3 #define PROTO_COMMAND_FINDNEXT 4 #define PROTO_COMMAND_EXPORT 5 #define PROTO_COMMAND_DISCONFIG 6 extern int PROTOAPI PROTO_Init(protoContext context, int command); /************************************************************************** Parameter Parser functions **************************************************************************/ #define PROTO_PARSE_CHANNEL 0x0100 #define PROTO_PARSE_INTEGER 0x0200 #define PROTO_PARSE_INTEGER64 0x0300 #define PROTO_PARSE_TIME 0x0400 #define PROTO_PARSE_FREQUENCY 0x0500 #define PROTO_PARSE_SELECTION 0x0600 #define PROTO_PARSE_STRING 0x0700 #define PROTO_PARSE_OK 0x0800 #define PROTO_PARSE_OPTIONAL 0x1000 #define PROTO_PARSE_CHECKRANGE 0x2000 extern DLLMOD void PROTOAPI PROTO_Parse(protoContext context, protoPtr result, char * names, int flags); extern DLLMOD int PROTOAPI PROTO_RequestVersion(protoContext context, int version); /************************************************************************** Generic functions **************************************************************************/ extern DLLMOD void * PROTOAPI PROTO_Alloc(protoContext context, protoSizeT size); extern DLLMOD void PROTOAPI PROTO_Free(protoContext context, void * ptr); extern DLLMOD void PROTOAPI PROTO_SetDefaultLevel(protoContext context, int level); /************************************************************************** Callback register functions **************************************************************************/ #define PROTO_PROCESS_OUTOFMEMORY -1 #define PROTO_PROCESS_CANCEL -2 #define PROTO_PROCESS_ENDOFTRACE -3 #define PROTO_NOTFOUND 0 #define PROTO_FOUND 1 extern DLLMOD void PROTOAPI PROTO_RegisterProcessCallback(protoContext context, protoSizeT (PROTOAPI *callback)(protoContext context, protoPtr arrayOut, protoSizeT arrayOutSize, protoPtr arrayIn, protoSizeT arrayInSize, protoPtr localdata), protoPtr localdata, protoSizeT size, int flags); extern DLLMOD void PROTOAPI PROTO_RegisterDisplayCallback(protoContext context, void (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata), protoPtr localdata, int flags); extern DLLMOD void PROTOAPI PROTO_RegisterChartCallback(protoContext context, const char * (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata), protoPtr localdata, int flags); extern DLLMOD void PROTOAPI PROTO_RegisterProfileChartCallback(protoContext context, const char * (PROTOAPI *callback)(protoContext context, protoPtr data, int * color, protoPtr localdata), protoPtr localdata, int flags); extern DLLMOD void PROTOAPI PROTO_RegisterDrawCallback(protoContext context, int (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata, int * result), protoPtr localdata, int flags, int channels, int low, int high); extern DLLMOD void PROTOAPI PROTO_RegisterFindCallback(protoContext context, int (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata), protoPtr localdata, int flags); extern DLLMOD void PROTOAPI PROTO_RegisterExportCallback(protoContext context, void (PROTOAPI *callback)(protoContext context, protoPtr data, protoPtr localdata), protoPtr localdata, int flags); extern DLLMOD void PROTOAPI PROTO_RegisterShareCallback(protoContext context, int (PROTOAPI *callback)(protoContext context, protoPtr sharedata, protoPtr localdata), protoPtr localdata, int flags); /************************************************************************** Functions callable from processing function **************************************************************************/ extern DLLMOD int PROTOAPI PROTO_Cancel(protoContext context); extern DLLMOD protoSizeT PROTOAPI PROTO_ReadTrace(protoContext context, protoSizeT index, protoTime * timestamp, int * data); extern DLLMOD protoSizeT PROTOAPI PROTO_FindTrace(protoContext context, protoSizeT index, int signal, protoTime * timestamp, int * data); /************************************************************************** Output functions for LIST command **************************************************************************/ #define PROTO_ATTRIBUTE_LEVEL0 0 #define PROTO_ATTRIBUTE_LEVEL1 1 #define PROTO_ATTRIBUTE_LEVEL2 2 #define PROTO_ATTRIBUTE_LEVEL3 3 #define PROTO_ATTRIBUTE_LEVEL4 4 #define PROTO_ATTRIBUTE_LEVEL5 5 #define PROTO_ATTRIBUTE_NORM 16 #define PROTO_ATTRIBUTE_LIGHT 17 #define PROTO_ATTRIBUTE_BOLD 18 #define PROTO_ATTRIBUTE_ERROR 19 #define PROTO_ATTRIBUTE_ASCII 20 #define PROTO_CONTROL_LINEFEED 30 #define PROTO_CONTROL_INDENT 31 #define PROTO_CONTROL_LINETILLEND 32 #define PROTO_CONTROL_PRINTNIL 33 extern DLLMOD void PROTOAPI PROTO_Puts(protoContext context, const char *text); extern DLLMOD void PROTOAPI PROTO_Printf(protoContext context, const char *format, ...); extern DLLMOD void PROTOAPI PROTO_Control(protoContext context, int controlcode); typedef struct { protoTime time; protoWord32 cycle; unsigned char datamask; unsigned char resv1; unsigned char flags; unsigned char resv2; protoWord64 address; protoWord64 data; } protoDiscycle, * protoDiscyclePtr; #define PROTO_DISCYCLE_FETCH 0x00000002 #define PROTO_DISCYCLE_READ 0x00000001 #define PROTO_DISCYCLE_READWIDE 0x00000101 #define PROTO_DISCYCLE_READORFETCH 0x00002001 #define PROTO_DISCYCLE_READORFETCHWIDE 0x00002101 #define PROTO_DISCYCLE_WRITE 0x00000041 /************************************************************************** End of Include **************************************************************************/ #ifdef __cplusplus } #endif #endif