Commit 0c8d50b6 authored by Armin Schindler's avatar Armin Schindler Committed by Linus Torvalds

[PATCH] eicon ISDN driver: debug

Module now can be build without debug code, necessary
if the module is built-in the kernel.

Fixed spelling typos.
parent d0fd3199
......@@ -49,8 +49,21 @@ dword Adapters = 0; /* Number of adapters */
Shadow IDI_DIMAINT
and 'shadow' debug stuff
-------------------------------------------------------------------------- */
static void no_printf (unsigned char * format, ...) { }
DIVA_DI_PRINTF dprintf = no_printf;
static void no_printf (unsigned char * format, ...)
{
#ifdef EBUG
va_list ap;
va_start (ap, format);
debug((format, ap));
va_end (ap);
#endif
}
/* -------------------------------------------------------------------------
Portable debug Library
------------------------------------------------------------------------- */
#include "debuglib.c"
static DESCRIPTOR MAdapter = {IDI_DIMAINT, /* Adapter Type */
0x00, /* Channels */
0x0000, /* Features */
......@@ -86,6 +99,7 @@ void diva_didd_load_time_init (void) {
Should be called as last step, if driver does unload
-------------------------------------------------------------------------- */
void diva_didd_load_time_finit (void) {
diva_os_destroy_spin_lock (&didd_spin, "didd");
}
/* --------------------------------------------------------------------------
Called in order to register new adapter in adapter array
......@@ -349,7 +363,4 @@ void IDI_CALL_LINK_T DIVA_DIDD_Read (void IDI_CALL_ENTITY_T * buffer,
int length) {
diva_didd_read_adapter_array (buffer, length);
}
/* -------------------------------------------------------------------------
Portable debug Library
------------------------------------------------------------------------- */
#include "debuglib.c"
......@@ -2,7 +2,6 @@
#include "pc.h"
#include "di_defs.h"
#include "debug_if.h"
#include "linux/kernel.h"
#include "divasync.h"
#include "kst_ifc.h"
#include "maintidi.h"
......@@ -96,9 +95,9 @@ static void queueInit (MSG_QUEUE *Q, byte *Buffer, dword sizeBuffer) {
static byte *queueAllocMsg (MSG_QUEUE *Q, word size) {
/* Allocate 'size' bytes at tail of queue which will be filled later
* directly whith callers own message header info and/or message.
* directly with callers own message header info and/or message.
* An 'alloced' message is marked incomplete by oring the 'Size' field
* whith MSG_INCOMPLETE.
* with MSG_INCOMPLETE.
* This must be reset via queueCompleteMsg() after the message is filled.
* As long as a message is marked incomplete queuePeekMsg() will return
* a 'queue empty' condition when it reaches such a message. */
......@@ -160,7 +159,7 @@ static void queueFreeMsg (MSG_QUEUE *Q) {
}
static byte *queuePeekMsg (MSG_QUEUE *Q, word *size) {
/* Show the first valid message in queue BUT DONT free the message.
/* Show the first valid message in queue BUT DON'T free the message.
* After looking on the message contents it can be freed queueFreeMsg()
* or simply remain in message queue. */
......@@ -195,7 +194,7 @@ static dword start_usec;
length: length of the message queue
do_init: perfor queue reset
return: zero on sucess, -1 on error
return: zero on success, -1 on error
*/
int diva_maint_init (byte* base, unsigned long length, int do_init) {
if (dbg_queue || (!base) || (length < (4096*4))) {
......@@ -296,7 +295,7 @@ dword diva_dbg_q_length (void) {
/*
INTERFACE:
Lock messafe queue and return the pointer to the first
Lock message queue and return the pointer to the first
entry.
*/
diva_dbg_entry_head_t* diva_maint_get_message (word* size,
......@@ -725,12 +724,12 @@ int diva_get_driver_info (dword id, byte* data, int data_length) {
if (clients[id].hDbg) {
*p++ = 1;
*p++ = (byte)clients[id].sec; /* save secounds */
*p++ = (byte)clients[id].sec; /* save seconds */
*p++ = (byte)(clients[id].sec >> 8);
*p++ = (byte)(clients[id].sec >> 16);
*p++ = (byte)(clients[id].sec >> 24);
*p++ = (byte)(clients[id].usec/1000); /* save msecounds */
*p++ = (byte)(clients[id].usec/1000); /* save mseconds */
*p++ = (byte)((clients[id].usec/1000) >> 8);
*p++ = (byte)((clients[id].usec/1000) >> 16);
*p++ = (byte)((clients[id].usec/1000) >> 24);
......@@ -1079,7 +1078,7 @@ void diva_mnt_remove_xdi_adapter (const DESCRIPTOR* d) {
}
/* ----------------------------------------------------------------
Low level interface for management interace client
Low level interface for management interface client
---------------------------------------------------------------- */
/*
Return handle to client structure
......@@ -1462,7 +1461,7 @@ static void diva_maint_state_change_notify (void* user_context,
case DIVA_SUPER_TRACE_NOTIFY_STAT_CHANGE:
if (pC->hDbg->dbgMask & DIVA_MGT_DBG_IFC_STATISTICS) {
/*
Incoming Statistices
Incoming Statistics
*/
if (channel->pInterfaceStat->inc.Calls) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
......@@ -1498,7 +1497,7 @@ static void diva_maint_state_change_notify (void* user_context,
}
/*
Outgoing Statistices
Outgoing Statistics
*/
if (channel->pInterfaceStat->outg.Calls) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
......
......@@ -23,8 +23,15 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "debuglib.h"
#ifdef DIVA_NO_DEBUGLIB
static DIVA_DI_PRINTF dprintf;
#else /* DIVA_NO_DEBUGLIB */
_DbgHandle_ myDriverDebugHandle = { 0 /*!Registered*/, DBG_HANDLE_VERSION };
DIVA_DI_PRINTF dprintf = no_printf;
/*****************************************************************************/
#define DBG_FUNC(name) \
void \
......@@ -146,3 +153,4 @@ void xdi_dbg_xlog (char* x, ...) {
va_end(ap);
}
/*****************************************************************************/
#endif /* DIVA_NO_DEBUGLIB */
......@@ -101,6 +101,34 @@
* with _KERNEL_DBG_PRINT_
*/
#define DL_TO_KERNEL 0x40000000
#ifdef DIVA_NO_DEBUGLIB
#define myDbgPrint_LOG(x,...) do { } while(0);
#define myDbgPrint_FTL(x,...) do { } while(0);
#define myDbgPrint_ERR(x,...) do { } while(0);
#define myDbgPrint_TRC(x,...) do { } while(0);
#define myDbgPrint_MXLOG(x,...) do { } while(0);
#define myDbgPrint_EVL(x,...) do { } while(0);
#define myDbgPrint_REG(x,...) do { } while(0);
#define myDbgPrint_MEM(x,...) do { } while(0);
#define myDbgPrint_SPL(x,...) do { } while(0);
#define myDbgPrint_IRP(x,...) do { } while(0);
#define myDbgPrint_TIM(x,...) do { } while(0);
#define myDbgPrint_BLK(x,...) do { } while(0);
#define myDbgPrint_TAPI(x,...) do { } while(0);
#define myDbgPrint_NDIS(x,...) do { } while(0);
#define myDbgPrint_CONN(x,...) do { } while(0);
#define myDbgPrint_STAT(x,...) do { } while(0);
#define myDbgPrint_SEND(x,...) do { } while(0);
#define myDbgPrint_RECV(x,...) do { } while(0);
#define myDbgPrint_PRV0(x,...) do { } while(0);
#define myDbgPrint_PRV1(x,...) do { } while(0);
#define myDbgPrint_PRV2(x,...) do { } while(0);
#define myDbgPrint_PRV3(x,...) do { } while(0);
#define DBG_TEST(func,args) do { } while(0);
#define DBG_EVL_ID(args) do { } while(0);
#else /* DIVA_NO_DEBUGLIB */
/*
* define low level macros for formatted & raw debugging
*/
......@@ -156,6 +184,9 @@ DBG_DECL(PRV3)
{ if ( (myDriverDebugHandle.dbgMask) & (unsigned long)DL_EVL ) \
{ myDbgPrint_EVL args ; \
} }
#endif /* DIVA_NO_DEBUGLIB */
#define DBG_LOG(args) DBG_TEST(LOG, args)
#define DBG_FTL(args) DBG_TEST(FTL, args)
#define DBG_ERR(args) DBG_TEST(ERR, args)
......@@ -182,9 +213,16 @@ DBG_DECL(PRV3)
/*
* prototypes for debug register/deregister functions in "debuglib.c"
*/
#ifdef DIVA_NO_DEBUGLIB
#define DbgRegister(name,tag, mask) do { } while(0)
#define DbgDeregister() do { } while(0)
#define DbgSetLevel(mask) do { } while(0)
#else
extern DIVA_DI_PRINTF dprintf;
extern int DbgRegister (char *drvName, char *drvTag, unsigned long dbgMask) ;
extern void DbgDeregister (void) ;
extern void DbgSetLevel (unsigned long dbgMask) ;
#endif
/*
* driver internal structure for debug handling;
* in client drivers this structure is maintained in "debuglib.c",
......@@ -274,9 +312,11 @@ typedef struct
} CardTrace;
} u1;
} _DbgExtendedInfo_;
#ifndef DIVA_NO_DEBUGLIB
/* -------------------------------------------------------------
Function used for xlog-style debug
------------------------------------------------------------- */
#define XDI_USE_XLOG 1
void xdi_dbg_xlog (char* x, ...);
#endif /* DIVA_NO_DEBUGLIB */
#endif /* __DEBUGLIB_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment