rklog.h 3.92 KB
/*
 * rklog.h
 *
 *      Unobtrusive settop logging utility
 *
 *
 * Copyright 1994, Silicon Graphics, Inc.
 * All Rights Reserved.
 *
 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
 * the contents of this file may not be disclosed to third parties, copied or
 * duplicated in any form, in whole or in part, without the prior written
 * permission of Silicon Graphics, Inc.
 *
 * RESTRICTED RIGHTS LEGEND:
 * Use, duplication or disclosure by the Government is subject to restrictions
 * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
 * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
 * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
 * rights reserved under the Copyright Laws of the United States.
 */

#ifndef _rklog_h_
#define _rklog_h_

#ifdef __cplusplus
extern "C" {
#endif

#include <rkapi.h>
#include <rklogcodes.h>
#include <utilities/tvlogger.h>

#define TV_LOG_DEFAULT_BUF_SIZE (8*1024)  	/* 8KB Buffer */

/*
 * Maximum number of arguments supprted with the vararg interface used by 
 * tvLogEvent. Additional arguments will be dropped.  
 */
#define	TV_LOG_MAX_ARGS		16

#define TV_LOG_ONCE       	(1)   /* ignore events when full */
#define TV_LOG_AUTO_FLUSH 	(2)   /* write buffer to server when full */
#define TV_LOG_CIRCULAR   	(3)   /* use circular buffer */
#define TV_LOG_NOT_OVERWRITE  	(4)   /* use circular but not overwrite mode */

#ifdef __TV_LOG
#define tvLogEventDebug(c) 		tvLogEvent c
#define tvLogEventDebugStr(c,s,n)	tvLogEventStr(c,s,n)
#define tvLogEventDebug0(c) 		tvLogEvent0(c)
#define tvLogEventDebug1(c,a0) 		tvLogEvent1(c,a0)
#define tvLogEventDebug2(c,a0,a1) 	tvLogEvent2(c,a0,a1)
#define tvLogEventDebug3(c,a0,a1,a2) 	tvLogEvent3(c,a0,a1,a2)
#define tvLogDataDebug(c,n,d) 		tvLogData(c,n,d)
#define tvLogKernDataDebug1(c,a0) 	tvLogKernData1(c,a0)
#define tvLogKernDataDebug2(c,a0,a1) 	tvLogKernData2(c,a0,a1)
#define tvLogKernDataDebug3(c,a0,a1,a2) tvLogKernData3(c,a0,a1,a2)
#else 
#define tvLogEventDebug(c)
#define tvLogEventDebugStr(c,s,n)
#define tvLogEventDebug0(c)
#define tvLogEventDebug1(c,a0)
#define tvLogEventDebug2(c,a0,a1)
#define tvLogEventDebug3(c,a0,a1,a2)
#define tvLogDataDebug(c,n,d)
#define tvLogKernDataDebug1(c,a0)
#define tvLogKernDataDebug2(c,a0,a1)
#define tvLogKernDataDebug3(c,a0,a1,a2)
#endif 

/*
 * When you pass a float to tvLogEvent functions, you must first stick the float
 * in a variable, then stick it in this macro.
 */
#define	TV_LOG_FLOAT(x)		(*(int *) &(x))

typedef	unsigned char TVLogMask[TV_LOG_NUM_CODES/8];  /* one bit for each code */

#define TV_LOG_MAX_EVENT_SETS 	3

typedef struct {
	int	from;
	int	to;
} TVLogEventSet;

typedef union {
    struct {
        TVushort 	type;
        TVushort 	reason;
        TVushort 	numSet;
	TVLogEventSet 	set[TV_LOG_MAX_EVENT_SETS];
    } event;
    TVMessage notused;
} TVLogMsg;

extern void tvLogEvent(short code, short numargs, ...);
extern void tvLogEventStr(short code, const char *str, int len);
extern void tvLogEvent0(short code);
extern void tvLogEvent1(short code, long arg0);
extern void tvLogEvent2(short code, long arg0, long arg1);
extern void tvLogEvent3(short code, long arg0, long arg1, long arg2);
extern void tvLogKernData1(short code, unsigned arg0);
extern void tvLogKernData2(short code, unsigned arg0, unsigned arg1);
extern void tvLogKernData3(short code, unsigned arg0, unsigned arg1, unsigned arg2);
extern void tvLogData(short code, short numargs, void *data);
extern void tvLogFlushBuffer(void);

extern int tvLogSet(TVLogMask mask, int code);
extern int tvLogClear(TVLogMask mask, int code);
extern int tvLogSetRange(TVLogMask mask, int firstCode, int lastCode);
extern int tvLogClearRange(TVLogMask mask, int firstCode, int lastCode);

extern void tvLogInit(TVLogMask mask);
extern void tvLogUseMask(TVLogMask mask);
extern void tvLogHandleMessage(TVLogMask mask, TVLogMsg *msg, TVid replyID);
 
#ifdef __cplusplus
}
#endif

#endif /* _rklog_h_ */