//
// complete.c
//
void AsynPutMsgComplete( IN HANDLE HOwner, IN PVOID Context,
                         IN PVOID PControlBuffer, IN ULONG ControlLength,
                         IN PVOID PDataBuffer, IN ULONG DataLength,
                         IN NTSTATUS Status);
void AsynGetMsgComplete( IN HANDLE HOwner, IN PVOID Context,
                         IN PVOID PControlBuffer, IN ULONG ControlLength,
                         IN PVOID PDataBuffer, IN ULONG DataLength,
                         IN NTSTATUS Status);
void AsynPutMsgCompleteFlush( IN HANDLE HOwner, IN PVOID Context,
                              IN PVOID PControlBuffer, IN ULONG ControlLength,
                              IN PVOID PDataBuffer, IN ULONG DataLength,
                              IN NTSTATUS Status);
VOID AsynPostGetMsg( IN PPORT_EXT      pPortExt,
                     IN NTSTATUS       LastGetMsgStatus);

//
// dispatch.c
//
NTSTATUS AsynDispatchEntry( IN PDEVICE_OBJECT PortDevice, IN PIRP Irp );
VOID AsynSchedulerLoop( IN PPORT_EXT pPortExt );

//
// init.c
//
NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath );
#if !NT5_BUILD
NTSTATUS AsynInitAdapters( IN PUNICODE_STRING RegistryPath);
#endif
NTSTATUS AsynGetDeviceKey( IN OUT PUNICODE_STRING PsPath, OUT PUNICODE_STRING Key );
NTSTATUS AsynGetDeviceKeyValues( IN PUNICODE_STRING PsPath, IN PCARD_EXT CardExt, 
                                 IN OUT PUNICODE_STRING pDxbInstPath);
NTSTATUS AsynFindPortsOnDevice( IN PDEVICE_OBJECT Card,
                                IN PUNICODE_STRING pCardName,
                                IN PUNICODE_STRING PsKeyName,
                                IN HANDLE hKey);
NTSTATUS AsynGetPortKeyValues( IN PUNICODE_STRING PortKey, 
										 IN HANDLE				hParentKey,	
                               IN OUT REGISTRY_PORT_VALUES *PortValues );
NTSTATUS AsynInitPort( IN PPORT_EXT pPortExt,
							  IN PUNICODE_STRING   	pCardName,
   						  IN REGISTRY_PORT_VALUES	*PortValues );
VOID AsynFreePortResources( PPORT_EXT pPortExt );


//
// ioctl.c
//
VOID AsynCancelIoctl( IN PPORT_EXT pPortExt, IN PIRP pIrp );
NTSTATUS AsynIoPurge( IN PPORT_EXT pPortExt, IN PIRP pIrp, 
                      IN ULONG BufferSize, IN PULONG pPurgeFlag);
NTSTATUS AsynIoctl( IN PPORT_EXT pPortExt, IN PIRP pIrp);
VOID AsynCancelXnGetIrp(IN PDEVICE_OBJECT pDevice, IN PIRP pIrp);


//
// open.c
//
NTSTATUS AsynPortOpen( IN PPORT_EXT pPortExt, IN PIRP pIrp);
NTSTATUS AsynInitSDXBDevice( IN PPORT_EXT	pPortExt, IN PIRP pIrp );
NTSTATUS AsynPortClose( IN PPORT_EXT pPortExt, IN PIRP pIrp);
VOID AsynCloseTimedOut( IN PKDPC PortDpc, IN PPORT_EXT PortExt,
                        IN PVOID SystemArg1, IN PVOID SystemArg2);
VOID AsynCancelClose( IN PPORT_EXT pPortExt, IN IRP *Irp);
VOID AsynCloseRsp( IN PPORT_EXT PortExt);
VOID AsynCloseComplete( IN HANDLE HOwner, IN NTSTATUS Status);
NTSTATUS AsynCleanup( IN PPORT_EXT pPortExt, IN PIRP pIrp);

//
// read.c
//
NTSTATUS AsynRead( IN DEVICE_OBJECT *PortDevice, IN IRP *Irp);
NTSTATUS AsynPortRead( PPORT_EXT pPortExt, IN PIRP pReadIrp);
VOID AsynCancelRead( IN PPORT_EXT pPortExt, IN PIRP pIrp );
VOID AsynProcessData( IN PPORT_EXT pPortExt, IN PUCHAR Data, IN ULONG Length, IN PRX_BUF pRxBuf);
VOID AsynReadTimedOut( IN PKDPC pPortDpc, IN PPORT_EXT pPortExt,
                       IN PVOID SystemArg1, IN PVOID SystemArg2);
VOID AsynReadIntervalTimedOut( IN PKDPC pPortDpc, IN PPORT_EXT pPortExt,
                               IN PVOID SystemArg1, IN PVOID SystemArg2);

//
// sdxb.c
//
USHORT AsynBuildSyncCmd( PPORT_EXT pPortExt, PSDXB_CMD SdxbCmd);
USHORT AsynBuildBufferSizeCmd( PPORT_EXT pPortExt, PSDXB_CMD pSdxbCmd);
USHORT AsynBuildModemCmd( PPORT_EXT pPortExt, PSDXB_CMD SdxbCmd);
USHORT AsynBuildEventCmd( PPORT_EXT pPortExt, PSDXB_CMD SdxbCmd);
USHORT AsynBuildLineErrorCmd( PPORT_EXT pPortExt, PSDXB_CMD SdxbCmd);
USHORT AsynBuildSetPortCmd( PPORT_EXT pPortExt, PSDXB_CMD SdxbCmd);
USHORT AsynBuildSeqNumberCmd( PPORT_EXT pPortExt, PSDXB_CMD SdxbCmd);
USHORT AsynBuildBreakCmd( PPORT_EXT pPortExt, PSDXB_CMD pSdxbCmd);
USHORT AsynBuildImmedCharCmd( PPORT_EXT pPortExt, PSDXB_CMD pSdxbCmd);
USHORT AsynBuildFlush( PPORT_EXT pPortExt, PSDXB_CMD SdxbCmd);
USHORT AsynBuildPauseCmd( PPORT_EXT pPortExt, PSDXB_CMD pSdxbCmd);
void AsynProcessSync( PPORT_EXT PortExt, PVOID Context);
void AsynProcessBufferSize( PPORT_EXT PortExt, PVOID Context);
void AsynProcessModemCtrl( PPORT_EXT PortExt, PVOID Context);
void AsynProcessEvent( PPORT_EXT PortExt, PVOID Context);
void AsynProcessLineErr( PPORT_EXT PortExt, PVOID Context);
void AsynProcessPortCap( PPORT_EXT PortExt, PVOID Context);
void AsynProcessPortParam( PPORT_EXT PortExt, PVOID Context);
void AsynProcessSeqNum( PPORT_EXT PortExt, PVOID Context);
void AsynProcessSpecialChar( PPORT_EXT PortExt, PVOID Context);
void AsynProcessProtocolError( PPORT_EXT PortExt, PVOID Context);
ULONG AsynCompressSdxbRsp( IN PPORT_EXT pPortExt, IN PVOID pControlBuffer,
                           IN ULONG ControlLength, OUT PSDXB_COMP_RSP pRsp);
NTSTATUS AsynSdxbValidateLength( IN PPORT_EXT pPortExt, IN ULONG RspLength,
                                 IN ULONG SdxbLength, IN PUCHAR DebugStr);
NTSTATUS AsynPutMsgEx( IN HANDLE   hStream, IN PUCHAR   pControlBuffer,
                       IN ULONG    ControlLength, IN PUCHAR   pDataBuffer,
                       IN ULONG    DataLength, IN HANDLE   Context, 
                       IN DS_PRIORITY  Priority, 
                       IN PDSL_PUTMSG_COMPLETION_ROUTINE CompletionRoutine);

//
// trace.c
//
NTSTATUS AsynIoCard( IN PDEVICE_OBJECT pDevice, IN PIRP pIrp);
VOID AsynGetDeviceStatus( PPORT_EXT pPortExt, PPORT_STATUS pPortStatus);
VOID AsynTraceTimeout( IN PKDPC Dpc, IN PVOID DeferredContext,
                       IN PVOID SystemContext1, IN PVOID SystemContext2);
void AsynTraceWriteIrp( PPORT_EXT pPortExt, PIRP pIrp);
void AsynTraceReadIrp( PPORT_EXT pPortExt, PIRP pIrp);
void AsynTraceIoctlIrp( PPORT_EXT pPortExt, PIRP pIrp, BOOLEAN In, BOOLEAN Out);
void AsynTraceModemStatus( PPORT_EXT pPortExt);


//
// utils.c
//
NTSTATUS AsynUniStringInit( IN PUNICODE_STRING BaseString, IN USHORT BaseSize);
void AsynUniStringInitBuffer( IN PUNICODE_STRING BaseString, IN USHORT BaseSize,
                              IN PWSTR Buffer);
NTSTATUS AsynInitPool(PPOOL_LIST  pPool, USHORT      Size );
NTSTATUS AsynAllocPool( PPOOL_LIST Pool, USHORT Count, USHORT Size);
void AsynFreePool( PPOOL_LIST Pool);
PLIST_ENTRY AsynAllocEntry( PPOOL_LIST Pool, PNTSTATUS Status);
PRX_BUF_HEADER AsynAllocVarRxBufEntry( PPOOL_LIST Pool, ULONG Size, PNTSTATUS Status);
void AsynFreeEntry( PPOOL_LIST Pool, PLIST_ENTRY Entry);
void AsynLogError( DRIVER_OBJECT *DriverObject, NTSTATUS Error,
                   IN PWSTR LogMessage, NTSTATUS ErrorStatus );
NTSTATUS AsynPutEventMsg( IN PPORT_EXT pPortExt, IN OUT PPUT_MSG_EV *pPutEvent,
                          IN PIRP pIrp, IN SDXB_PUT_CMD Command,
                          IN IRP_REASON Reason, IN DS_PRIORITY Priority,
                          IN PUT_EV_STATE, IN USHORT (*BuildFunc)());
VOID AsynPutEventCleanup( IN OUT PPUT_MSG_EV *pPutEvent);
PPUT_MSG_EV AsynUtilFindPutEvent( PPORT_EXT pPortExt, PIRP pIrp,
                                  PLIST_ENTRY pPutQueue);
VOID AsynFindAndCompletePut( PPORT_EXT pPortExt, SDXB_PUT_CMD CommandType,
                             NTSTATUS Status);
VOID AsynCompleteIrp( IN PPORT_EXT pPortExt, IN PIRP pIrp);
VOID AsynCompleteQueuedIrps( IN PPORT_EXT pPortExt);

//
// wait.c
//
void AsynCheckWaitEvents( PPORT_EXT PortExt);
NTSTATUS AsynIoSetWaitMask( IN PPORT_EXT pPortExt, IN PIRP pIrp,
                            IN ULONG BufferSize, IN PULONG pWaitMask );
NTSTATUS AsynIoGetWaitMask( IN PPORT_EXT pPortExt, IN PIRP pIrp, 
                            IN ULONG BufferSize, OUT PULONG pWaitMask );
NTSTATUS AsynIoWaitOnMask( IN PPORT_EXT pPortExt, IN PIRP pIrp,
                           IN ULONG BufferSize );

//
// write.c
//
NTSTATUS AsynPortWrite( PPORT_EXT pPortExt);
VOID AsynWriteTimedOut( IN PKDPC PortDpc, IN PPORT_EXT PortExt,
                        IN PVOID SystemArg1, IN PVOID SystemArg2);
VOID AsynWriteTimedoutCleanup( IN PPORT_EXT pPortExt, IN PIRP pIrp);
VOID AsynCancelWrite( IN PPORT_EXT pPortExt, IN PIRP pIrp);

#if NT5_BUILD
//
// asynpnp.c
//
NTSTATUS AsynPnpDispatch( IN PDEVICE_OBJECT pDevice, PIRP pIrp );
NTSTATUS AsynPowerDispatch( IN PDEVICE_OBJECT pDevice, IN PIRP pIrp );
NTSTATUS AsynPnpStopDevice( IN PPORT_EXT pExt, PIRP pIrp, BOOLEAN fPowerStateChange );
NTSTATUS AsynAddDevice( IN PDRIVER_OBJECT pDriverObject, IN PDEVICE_OBJECT pPhysicalDeviceObject );
#endif