view fluid-mnf/trace.h @ 343:917e05f03ad2

fluid-mnf/serial.c: <assert.h> no longer needed
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 13 Mar 2020 05:40:23 +0000
parents 9cecc930d78f
children
line wrap: on
line source

/******************************************************************************
 * Generic tracing library
 *
 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com
 *
 * $Id: trace.h 1.4 Fri, 11 Oct 2002 08:40:21 +0200 mmj $
 *
 ******************************************************************************/

#ifndef _TRACE_H_
#define _TRACE_H_


/******************************************************************************
 * Common
 *****************************************************************************/

enum {
    TrF        = 0x00000000,
    TrC        = 0x40000000,
    TrB        = 0x80000000,
    TrE        = 0xC0000000,
    TrTypeMask = 0xC0000000,

    TrFunc     = TrF,
    TrCont     = TrC,        // Tracing continue
    TrBegin    = TrB,
    TrEnd      = TrE,

    // Trace Module
    TrAny      = 0x3F000000,
    TrModMask  = 0x3F000000,

    // Trace Mask
    TrAll      = 0x00FFFFFF,
    TrBitMask  = 0x00FFFFFF
};

typedef void (* pf_tr_t) (int, char *, ...);
typedef void (* pf_tr_hexdump_t) (int, const void *, int);

typedef struct tr_functions_s {
    pf_tr_t         tr;
    pf_tr_hexdump_t hexdump; //Fixme tr_hexdump?
} tr_functions_t;


// Trace Wrapper. Used for quickly removing tracing from output code.
#define tw(wrapping) wrapping
//#define tw(wrapping)

int  tr_init(int spaces, char *filename);
void tr_enable(int onoff);
int  tr_mask(int mask);
void tr(int mask, char *format, ...);
void tr_hexdump(int mask, const void *p, int size);

#endif // _TRACE_H_