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

   Pnp.c

Abstract:

   This is the header include file for DSTREAMS PnP and Power Management
   functionality.

Author:

   Jeff Romatoski

--*/

#ifndef _PNP_H_
#define _PNP_H_

#include "digilib.h"
#include "dxbreg.h"
#include "DgDevice.h"

// PnP State
typedef enum 
{
	PNP_ADDED,
	PNP_STARTED,
	PNP_REMOVED,
	PNP_COUNT
} PNP_STATE;


// Device Types Supported by PnP
typedef enum PNP_DEVICE_TYPE
{
	PNP_DEVICE_TYPE_FDO = 0x00AAAA00,
	PNP_DEVICE_TYPE_PDO,
	PNP_DEVICE_TYPE_USER,
	PNP_DEVICE_TYPE_MAX
} PNP_DEVICE_TYPE, *PPNP_DEVICE_TYPE;

static PDRIVER_OBJECT	gpDriverObject;

typedef
NTSTATUS
(*PPNP_START_DEVICE) (
    IN PDEVICE_OBJECT		pDeviceObject,
	IN PDIGI_RESOURCE_LIST	pResources,
	IN HANDLE				hKeyDriver,
	IN HANDLE				KeyParameter,
	IN PUNICODE_STRING		Option
	);


typedef
NTSTATUS
(*PPNP_REMOVE_DEVICE) (
    IN PDEVICE_OBJECT		pDeviceObject
	);

typedef
NTSTATUS
(*PPNP_QUERY_REMOVE_DEVICE) (
    IN PDEVICE_OBJECT		pDeviceObject
	);

typedef
NTSTATUS
(*PPNP_STOP_DEVICE) (
    IN PVOID				DeviceSPecificFdo
	);

//
// DSTREAMS FDO Initialization Data
//
typedef struct _PNP_DEV_INFO {

    PPNP_START_DEVICE				CallbackStartDevice;
    PPNP_QUERY_REMOVE_DEVICE		CallbackQueryRemoveDevice;
    PPNP_REMOVE_DEVICE				CallbackRemoveDevice;
    PPNP_STOP_DEVICE				CallbackStopDevice;

} PNP_DEV_INFO, *PPNP_DEV_INFO;


//
// DSTREAMS Initialization Structure
//
typedef struct _PNP_INIT_DATA {
	
	// BUS Name
    WCHAR BusName[8];

    // FDO Device Data
    PNP_DEV_INFO FdoData;

} PNP_INIT_DATA, *PPNP_INIT_DATA;

//
// DSTREAMS Driver Data
//

typedef struct _PNP_DRIVER_DATA {

    PNP_INIT_DATA	InitData;

	PDRIVER_OBJECT	DriverObject;

} PNP_DRIVER_DATA, *PPNP_DRIVER_DATA;


//
// Common PnP routines
//

STATIC __inline VOID 
DsPnpIoCompleteRequest( PIRP pIrp, NTSTATUS Status, ULONG_PTR Information )
{
	pIrp->IoStatus.Status = Status;
	pIrp->IoStatus.Information = Information;
	IoCompleteRequest( pIrp, IO_NO_INCREMENT );
}


extern PNP_DRIVER_DATA		gDriverData;

#include "fdo.h"
#include "pdo.h"
#include "power.h"


#endif /* _PNP_H_ */

