Ryan Malloy bbdcb243dc Normalize line endings to LF across entire repository
Apply .gitattributes normalization to convert all CRLF line
endings inherited from Windows-origin source files to Unix LF.
175 files, zero content changes.
2026-02-20 10:55:50 -07:00

126 lines
4.1 KiB
C++

/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1Usb.h
Author :
Date :
Purpose : This File Holds all the USB Device access related declarations
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_USB_H
#define __SKYWALKER1_USB_H
/* Include the Library and Other header file */
extern "C"
{
//USB Related Headers
#include <initguid.h>
#pragma warning(disable:4200)
#include <usbdi.h>
#include <usbdlib.h>
#include <stdio.h>
#include <usb100.h>
#include "SkyWalker1Device.h"
}
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
#define MAX_BULK_PACKET_SIZE 8 * 512
#define MAX_BULK_TRANSFER_SIZE (TRANSPORT_PACKET_COUNT * TRANSPORT_PACKET_SIZE) //Suppoting max Frame Size
/* End of Macro Definitions */
/* Declare Enumerations here */
typedef enum __USBSTATE {
NotStarted, // not started
Stopped, // device stopped
Working, // started and working
PendingStop, // stop pending
PendingRemove, // remove pending
SurpriseRemoved, // removed by surprise
Removed // removed
}USBSTATE;
typedef enum _QUEUE_STATE {
HoldRequests, // device is not started yet
AllowRequests, // device is ready to process
FailRequests // fail both existing and queued up requests
} QUEUE_STATE;
#define INITIALIZE_PNP_STATE(_Data_) \
(_Data_)->UsbDeviceState = NotStarted;\
(_Data_)->PreviousUsbDeviceState = NotStarted;
#define SET_NEW_PNP_STATE(_Data_, _state_) \
(_Data_)->PreviousUsbDeviceState = (_Data_)->UsbDeviceState;\
(_Data_)->UsbDeviceState = (_state_);
#define RESTORE_PREVIOUS_PNP_STATE(_Data_) \
(_Data_)->UsbDeviceState = (_Data_)->PreviousUsbDeviceState;
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//BulkUsb Read Write Context
typedef struct _BULKUSB_RW_CONTEXT {
PURB pUSBRequestBlock;
PUCHAR pTransferBuffer;
ULONG ulRemainingByteTransfer; // remaining to xfer
ULONG ulCompletedByteTransfer; // cumulate xfer
ULONG ulStreamIndex;
class CSkyWalker1Device * pDevice;
} BULKUSB_RW_CONTEXT, * PBULKUSB_RW_CONTEXT;
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
//Usb Access functions
NTSTATUS InitializeUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoReqestPacket);
NTSTATUS DeconfigureUsbDevice(IN PKSDEVICE pKSDeviceObject);
NTSTATUS StopUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS ReadWriteUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN ULONG ulStreamIndex,
IN ULONG ulPacketIndex,
IN PUCHAR pucTransferBuffer,
IN ULONG ulTransferLength,
IN BOOLEAN bRead);
NTSTATUS ControlUsbDevice( IN PKSDEVICE pKSDeviceObject,
IN UCHAR ucRequest,
IN USHORT usValue,
IN USHORT usIndex,
IN PUCHAR pucTransferBuffer,
IN ULONG ulTransferLength,
IN BOOLEAN bRead);
NTSTATUS RemoveUsbDevice( IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS SurpriseUsbDeviceRemoval(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS CancelRemoveUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS QueryRemoveUsbDevice( IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS QueryStopUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS CancelStopUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
/* End of Function prototype definitions */
#endif /*__SKYWALKER1_USB_H*/