/*++
*******************************************************************************
* Copyright (c) 1990-97 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:

   DgDevice.h

Abstract:

   Header file to define all Digi FILE_DEVICE_xxx types of devices for NT.

Author:

   Ron Gredvig

--*/

#ifndef _DGDEVICE_
#define _DGDEVICE_

///////////////////////////////////////////////////////////////////////////////
//
// IOCTL Constants
// 
// Every NT driver which exposes Devices (DeviceObjects) that accept IOCTL 
// requests expects a given set of IOCTL commands.  For new device types, a new
// set of IOCTL commands will likely be necessary.  Each device type may define
// a unique FILE_DEVICE_xxx value.  Using this value, a completely independent 
// set of IOCTLs can then be defined for that device type, ensuring that IOCTL 
// commands for different devices do not overlap.  Use the constants below as
// shown in the following example:
//
//		#define IOCTL_DS_OPEN	CTL_CODE(FILE_DEVICE_DS,		\
//										DIGI_FUNCTION_CODE_START,		\
//										METHOD_BUFFERED, 					\
//										FILE_ANY_ACCESS)
//

//
// Define the Digi device type values.  Note that values used by Microsoft
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
// by customers. So we picked 0x9000 (36864) as our starting point.
//

#define FILE_DEVICE_DS			0x9000	// DStreams Driver Device
#define FILE_DEVICE_DSMP		0x9001	// DStreams Miniport Device
#define FILE_DEVICE_KME			0x9002	// Kme Device
#define FILE_DEVICE_PERF		0x9003	// Performance monitoring Ioctls
#define FILE_DEVICE_DIGIPCI	0x9004	// Digi Pci info gathering driver

//
// We start our own function codes at 2048, because Microsoft has reserved
// 0-2047 for itself, and 2048-4095 for others.
//

#define DIGI_FUNCTION_CODE_START		0x0800



///////////////////////////////////////////////////////////////////////////////
//
// STATUS Constants
// 
// Use the constants and macros below to define driver specific STATUS_xxx 
// values.  These values should *ONLY* be used for private interfaces between
// Digi drivers.  The higher level driver must map any private STATUS_xxx
// value to a system-defined NTSTATUS value when it completes an IRP if an 
// existing higher-level driver's IoCompletion routine might be called for
// that IRP.
//
// Example use:
//
//		#define STATUS_DS_OPEN_FAILED		DIGI_STATUS( DIGI_ERROR, DIGI_FAC_DS, 1 )
//		#define STATUS_DS_CLOSE_FAILED	DIGI_STATUS( DIGI_ERROR, DIGI_FAC_DS, 2 )
//

// Customer code bit is required to be set in all privately defined Status values
#define CUSTOMER_CODE          0x20000000


#define  DIGI_STATUS( severity, facility, code ) \
	( (severity) | (CUSTOMER_CODE) | ((facility)<<16) | (code) )


// Severity values for STATUS_CODE macro
#define DIGI_SUCCESS       ( ERROR_SEVERITY_SUCCESS       | CUSTOMER_CODE )
#define DIGI_INFORMATIONAL ( ERROR_SEVERITY_INFORMATIONAL | CUSTOMER_CODE )
#define DIGI_WARNING       ( ERROR_SEVERITY_WARNING       | CUSTOMER_CODE )
#define DIGI_ERROR         ( ERROR_SEVERITY_ERROR         | CUSTOMER_CODE )


// Facility values for STATUS_CODE macro
#define DIGI_FAC_DS		0x0	// DStreams driver uses this facility code
#define DIGI_FAC_DSMP	0x1	// DStreams miniport driver 
#define DIGI_FAC_DSAPI	0x3	// DSAPI Library uses this facility code

#endif // _DGDEVICE_
