/*++
 ****************************************************************************
 * Copyright (c) 1999-2002 Digi International Inc., All Rights Reserved
 *
 * This software contains proprietary and confidential information of Digi
 * International Inc.  By accepting transfer of this copy, Recipient agrees
 * to retain this software in confidence, to prevent disclosure to others,
 * and to make no use of this software other than that for which it was
 * delivered.  This is an unpublished copyrighted work of Digi International
 * Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
 * prohibited.
 *
 * Restricted Rights Legend
 *
 * Use, duplication, or disclosure by the Government is subject to
 * restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
 * Technical Data and Computer Software clause at DFARS 252.227-7031 or
 * subparagraphs (c)(1) and (2) of the Commercial Computer Software -
 * Restricted Rights at 48 CFR 52.227-19, as applicable.
 *
 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
 *
 ****************************************************************************

Module Name:

   DxbQDump.h
   
--*/
#ifndef DXBQDUMP
#define DXBQDUMP

#ifdef _NTDDK_
#include <devioctl.h>		// Kernelmode drivers need this.  Resides in ddk.
#else
#include <winioctl.h>		// Usermode apps need this.  Resides in msdev\include.
#endif

#include "DgDevice.h"

// Define RSVD.  RSVD is used in struct definitions to identify fields which
// are reserved for the Driver.  These fields should be initialized to zero 
// before passing the request to the driver.
#define RSVD

#define IOCTL_DXBQ_GET_STATE          CTL_CODE(FILE_DEVICE_DXBQ, DIGI_FUNCTION_CODE_START    , METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DXBQ_GET_TRACE          CTL_CODE(FILE_DEVICE_DXBQ, DIGI_FUNCTION_CODE_START + 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DXBQ_GET_DUMP           CTL_CODE(FILE_DEVICE_DXBQ, DIGI_FUNCTION_CODE_START + 2, METHOD_BUFFERED, FILE_ANY_ACCESS)

#if !NT5_BUILD && !_M_IA64
// NT5 and newer DDKs define these types.  They float (at compile time) from 32 to 64
// bit width depending on the size of pointers in the system being compiled for.
// Define it for NT4.
typedef ULONG        ULONG_PTR, *PULONG_PTR;
typedef LONG         LONG_PTR,  *PLONG_PTR;
typedef int          INT_PTR,   *PINT_PTR;
typedef unsigned int UINT_PTR,  *PUINT_PTR;
#endif

#ifdef _NTDDK_
NTSTATUS
DxbQueueTrace(
	PDXB_DEVICE_EXTENSION pExt, 
	PIRP                  pIrp );
#else
typedef enum 
{
    DXB_EVENT_QUEUE,
    DXB_CMD_QUEUE,
    DXB_QUEUE_TYPE_COUNT
} DXB_QUEUE_TYPE;
#endif

typedef struct _TRACE_HEADER
{
    IN      ULONG_PTR       QueueType;
    IN      ULONG_PTR       Length;
	IN OUT  PUCHAR          pBuffer;        // Output buffer for read request
    OUT     ULONG_PTR       InPtr;
    OUT     ULONG_PTR       OutPtr;
    OUT     LARGE_INTEGER   TimeStamp;
	OUT     ULONG           BytesRead;		// Output count of bytes read
	RSVD    PUCHAR          pLockedBuffer;	// Driver private locked pointer to data buffer
} TRACE_HEADER,* PTRACE_HEADER;
    
typedef struct _QUEUE_STATE
{
    ULONG_PTR       nPages;
    ULONG_PTR       PageSize;
    ULONG_PTR       QSize;
    ULONG_PTR       Mask;
    ULONG_PTR       Page0;
} QUEUE_STATE;        

#endif    
