/*****************************************************************************
 * Copyright (C) Cinterion Wireless Modules GmbH
 *****************************************************************************
 * Project: CE-MUX-Driver
 *****************************************************************************
 * Author : Siemens AG Berlin COM WM RD SW
 *****************************************************************************
 * $Workfile: O:/mwohler_z_ms-d/z_ms-d/src/working/Classic/MuxDrv/MuxProt/MuxDbg.h $
 * $Revision: /main/ms-d/22 $
 * $Date: 2014-03-14 11:54:22 $
 * $Author: mwohler $
 *****************************************************************************
 * Target:
 *  Microsoft Windows CE 4.2 or 5.0
 *****************************************************************************
 * Description:
 *  Cinterion Multiplex Driver header file for general debug settings
 *****************************************************************************
 *
 * $Log: O:/mwohler_z_ms-d/z_ms-d/src/working/Classic/MuxDrv/MuxProt/MuxDbg.h$ 
 * 
 * /main/ms-d/22   2014-03-14 11:54:22   mwohler 
 * Use latest version of mux protocol implementation based on development for Miami client driver 
 * 
 * /main/ms-d/21   2013-11-04 09:41:13   mwohler 
 * Merged CommEvent handling from USB driver 
 * 
 * /main/ms-d/20   2011-03-01 12:38:01   ctna0450 
 * Added possibility for timestamps in retail trace
 *
 * /main/ms-d/19   2009-12-08 14:52:03   ctna0450
 * Added trace zone for virtual modem signals
 *
 * /main/ms-d/18   2009-08-10 10:02:59   ctna0450
 * Fixed problem with retail trace setting
 *
 * /main/ms-d/17   2009-02-18 11:59:13   ctna0256
 * Set copyright text
 *
 * /main/ms-d/16   2008-11-20 15:12:09   ctna0450
 * Added new debug zones for detailed hdlc tracing
 *
 * /main/ms-d/15   2008-10-17 12:04:04   ctna0450
 * Added debug zone for IOCTLs
 *
 * /main/ms-d/14   2008-08-20 11:38:52   ctna0450
 * Prepared for new disclaimer handling
 *
 * /main/ms-d/13   2006-09-18 11:23:14   wm36264
 * Corrected name of new mux frame error debug zone
 *
 * /main/ms-d/12   2006-09-18 11:20:34   wm36264
 * Added debug zone for mux framing errors
 *
 * /main/ms-d/11   2006-08-24 11:32:55   wm36264
 * Added debug trace for raw data
 *
 * /main/ms-d/10   2006-07-28 17:01:30   kr36712
 * HDLC error correction
 *
 * /main/ms-d/9   2006-07-28 10:57:17   wm36264
 * New debug zone for HDLC, usage of Win CE Siemens file header
 *
 * /main/ms-d/8   2006-05-02 16:52:58   wm36264
 * Removed old debug stuff
 *
 * /main/ms-d/7   2006-05-02 14:31:07   KR36712
 * debug feature implemented (port, file)
 *
 * /main/ms-d/6   2005-10-21 13:09:27   WM36264
 * Removed usage of C++ in mux protocol implementation
 *
 * /main/ms-d/5   2005-10-20 13:52:22   WM36264
 * Added proper copyright header
 *
 * /main/ms-d/4   2005-10-19 10:52:53   WM36264
 * Removed obsolete header files
 *
 * /main/ms-d/3   2005-10-13 11:00:46   wm36264
 * Added some info traces
 *
 * /main/ms-d/2   2005-10-10 16:06:12   wm36264
 * Moved debug macros to where they are needed
 *
 * /main/ms-d/1   2005-10-10 15:33:02   wm36264
 * Created for global debug output settings
 *
*/

//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008 Cinterion Wireless Modules GmbH
// Copyright (C) 2005-2008 Siemens AG
//
// Version: 1.0
// Date:    dummy
//
//////////////////////////////////////////////////////////////////////////////

#ifndef __MUX_MUXDBG_H
#define __MUX_MUXDBG_H

//////////////////////////////////////////////////////////////////////////////

#include <Windows.h>

//////////////////////////////////////////////////////////////////////////////

extern int MuxTrace(LPCTSTR lpszFmt, ...);

#ifdef RETAIL_MUXDRV_INCLUDE_TIMESTAMPS
extern void MuxRetailTraceWithTimestamps(LPCTSTR lpszFmt, ...);
#define MUXRETAILOUTPUT  MuxRetailTraceWithTimestamps
#else
#define MUXRETAILOUTPUT  NKDbgPrintfW
#endif

// Macro for retail trace output of Mux driver
// Sample usage: MUXRetailTrace((TEXT("MuxDrv: Debug-Info %d"), 0x42));
#ifndef DEBUG
  #define RETAIL_MUXDRV_OUTPUT 1
  #ifdef WANT_RETAIL_MUXDRV_OUTPUT
    #if defined(RETAIL_MUXDRV_OUTPUT_PORT) || defined(RETAIL_MUXDRV_OUTPUT_FILE)
      #define MUXRetailTrace(printf_exp)   MUXRETAILOUTPUT printf_exp, MuxTrace printf_exp
    #else // RETAIL_MUXDRV_OUTPUT_PORT || RETAIL_MUXDRV_OUTPUT_FILE
      #define MUXRetailTrace(printf_exp)   MUXRETAILOUTPUT printf_exp
    #endif // RETAIL_USBSER_OUTPUT_PORT || RETAIL_USBSER_OUTPUT_FILE
  #else // WANT_RETAIL_MUXDRV_OUTPUT
    #if defined(RETAIL_MUXDRV_OUTPUT_PORT) || defined(RETAIL_MUXDRV_OUTPUT_FILE)
      #define MUXRetailTrace(printf_exp)   MuxTrace printf_exp
    #else // RETAIL_MUXDRV_OUTPUT_PORT || RETAIL_MUXDRV_OUTPUT_FILE
      #define MUXRetailTrace(printf_exp)   ((void)0)
      #undef RETAIL_MUXDRV_OUTPUT
    #endif // RETAIL_MUXDRV_OUTPUT_PORT || RETAIL_MUXDRV_OUTPUT_FILE
  #endif // WANT_RETAIL_MUXDRV_OUTPUT
  #define RETAIL_DEBUG_BUFSIZE            1024
#else // DEBUG
  #define MUXRetailTrace(printf_exp)   MUXRETAILOUTPUT printf_exp
#endif // DEBUG

#define MUXDBG(a, printf_exp)        ((void)((a) ? (MUXRetailTrace(printf_exp)), 1 : 0))
#define MUX_EXIT(printf_exp)         MUXDBG(ZONE_MUX_EXIT, printf_exp)


//
// Debug Zones.
//
#ifdef RETAIL_DEBUG_BUFSIZE

#define ZONE_GENERAL_INFO            1
#define ZONE_MODULE_EXIT             1
#define ZONE_AT_CMDS                 1
#define ZONE_MUX_FRAME_ERROR         1
#define ZONE_MUX_PROT1               0
#define ZONE_MUX_PROT2               0
#define ZONE_MUX_PROT_HDLC           0
#define ZONE_MUX_RAW_DATA            0
#define ZONE_MUX_EXIT                0
#define ZONE_IOCTL                   0
#define ZONE_MUX_PROT_HDLC_FRM       0
#define ZONE_MUX_PROT_HDLC_ERROR     0
#define ZONE_MUX_VIRT_SIGNAL         0
#define ZONE_PORT_EVENTS             0

#else   // RETAIL_DEBUG_BUFSIZE

#ifdef DEBUG

#define ZONE_GENERAL_INFO            DEBUGZONE( 0)
#define ZONE_MODULE_EXIT             DEBUGZONE( 1)
#define ZONE_AT_CMDS                 DEBUGZONE( 2)
#define ZONE_MUX_FRAME_ERROR         DEBUGZONE( 3)
#define ZONE_MUX_PROT1               DEBUGZONE( 4)
#define ZONE_MUX_PROT2               DEBUGZONE( 5)
#define ZONE_MUX_PROT_HDLC           DEBUGZONE( 6)
#define ZONE_MUX_RAW_DATA            DEBUGZONE( 7)
#define ZONE_MUX_EXIT                DEBUGZONE( 8)
#define ZONE_IOCTL                   DEBUGZONE( 9)
#define ZONE_MUX_PROT_HDLC_FRM       DEBUGZONE(10)
#define ZONE_MUX_PROT_HDLC_ERROR     DEBUGZONE(11)
#define ZONE_MUX_VIRT_SIGNAL         DEBUGZONE(12)
#define ZONE_PORT_EVENTS             DEBUGZONE(13)

#endif // DEBUG

#endif // RETAIL_DEBUG_BUFSIZE

#endif // __MUX_MUXDBG_H
