📄 usbfx2lk_ioctl.h
字号:
///////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2005 OSR Open Systems Resources, Inc.
// All Rights Reserved
//
// This sofware is supplied for instructional purposes only.
//
// OSR Open Systems Resources, Inc. (OSR) expressly disclaims any warranty
// for this software. THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
// THE IMPLIED WARRANTIES OF MECHANTABILITY OR FITNESS FOR A PARTICULAR
// PURPOSE. THE ENTIRE RISK ARISING FROM THE USE OF THIS SOFTWARE REMAINS
// WITH YOU. OSR's entire liability and your exclusive remedy shall not
// exceed the price paid for this material. In no event shall OSR or its
// suppliers be liable for any damages whatsoever (including, without
// limitation, damages for loss of business profit, business interruption,
// loss of business information, or any other pecuniary loss) arising out
// of the use or inability to use this software, even if OSR has been
// advised of the possibility of such damages. Because some states/
// jurisdictions do not allow the exclusion or limitation of liability for
// consequential or incidental damages, the above limitation may not apply
// to you.
//
// OSR Open Systems Resources, Inc.
// 105 Route 101A Suite 19
// Amherst, NH 03031 (603) 595-6500 FAX: (603) 595-6503
// email bugs to: bugs@osr.com
//
//
// MODULE:
//
// USBFX2LK_Ioctl.h
//
// ABSTRACT:
//
//
// AUTHOR(S):
//
// OSR Open Systems Resources, Inc.
//
///////////////////////////////////////////////////////////////////////////////
//
// This header file contains all declarations shared between driver and user
// applications.
//
#ifndef __USBFX2LK_IOCTL_H__
#define __USBFX2LK_IOCTL_H__ (1)
#include <basetsd.h>
//
// The following value is arbitrarily chosen from the space defined by Microsoft
// as being "for non-Microsoft use"
//
#define FILE_DEVICE_OSRUSBFX2LK 65500
//
// OSRUSBFX2LK Interface Guid.
// {C5B7F228-CAFF-42d5-A472-6B9EDA7982EC}
//
DEFINE_GUID(GUID_OSR_USBFX2LK_INTERFACE,
0xc5b7f228, 0xcaff, 0x42d5, 0xa4, 0x72, 0x6b, 0x9e, 0xda, 0x79, 0x82, 0xec);
//
// Define the structures that will be used by the IOCTL
// interface to the driver
//
//
// USBFX2_PIPE_ENUM
//
// For any IOCTL that works on a specific pipe
// (IOCTL_OSRUSBFX2_RESET_PIPE, for example)
// the input parameter will be a USBFX2_PIPE_ENUM
// value to indicate which pipe the IOCTL is directed
// to
//
typedef enum _USBFX2_PIPE_ENUM {
USBFx2BulkInPipe = 0x5301979,
USBFx2BulkOutPipe,
USBFx2InterruptPipe
}USBFX2_PIPE_ENUM, *PUSBFX2_PIPE_ENUM;
//
// BAR_GRAPH_STATE
//
// BAR_GRAPH_STATE is a bit field structure with each
// bit corresponding to one of the bar graph on the
// OSRFX2 Development Board
//
#include <pshpack1.h>
typedef struct _BAR_GRAPH_STATE {
union {
struct {
//
// Individual bars starting from the
// top of the stack of bars
//
// NOTE: There are actually 10 bars,
// but the very top two do not light
// and are not counted here. Also
// note that the bars aren't actually
// wired the way that you might think
// that they are. Sending a "1" to the
// device actually lights the fourth
// bar from the bottom
//
UCHAR Bar4 : 1;
UCHAR Bar5 : 1;
UCHAR Bar6 : 1;
UCHAR Bar7 : 1;
UCHAR Bar8 : 1;
UCHAR Bar1 : 1;
UCHAR Bar2 : 1;
UCHAR Bar3 : 1;
};
//
// The state of all the bar graph as a single
// UCHAR
//
UCHAR BarsAsUChar;
};
}BAR_GRAPH_STATE, *PBAR_GRAPH_STATE;
//
// SWITCH_STATE
//
// SWITCH_STATE is a bit field structure with each
// bit corresponding to one of the switches on the
// OSRFX2 Development Board
//
typedef struct _SWITCH_STATE {
union {
struct {
//
// Individual switches starting from the
// left of the set of switches
//
UCHAR Switch1 : 1;
UCHAR Switch2 : 1;
UCHAR Switch3 : 1;
UCHAR Switch4 : 1;
UCHAR Switch5 : 1;
UCHAR Switch6 : 1;
UCHAR Switch7 : 1;
UCHAR Switch8 : 1;
};
//
// The state of all the switches as a single
// UCHAR
//
UCHAR SwitchesAsUChar;
};
}SWITCH_STATE, *PSWITCH_STATE;
//
// IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY
//
// This IOCTL allows the user to get the state of the bar graph.
//
// Input:
// None.
//
// Output:
// BAR_GRAPH_STATE
//
// Access Required:
// Read.
//
#define IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x801, METHOD_BUFFERED, FILE_READ_ACCESS)
//
// IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY
//
// This IOCTL allows the user to set the state of the bar graph.
//
// Input:
// BAR_GRAPH_STATE.
//
// Output:
// None.
//
// Access Required:
// Write.
//
#define IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x802, METHOD_BUFFERED, FILE_WRITE_ACCESS)
//
// IOCTL_OSRUSBFX2_READ_SWITCHES
//
// This IOCTL allows the user to get the state of the switches.
//
// Input:
// None.
//
// Output:
// SWITCH_STATE
//
// Access Required:
// Read.
//
#define IOCTL_OSRUSBFX2_READ_SWITCHES \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x802, METHOD_BUFFERED, FILE_READ_ACCESS)
//
// IOCTL_OSRUSBFX2_RESET_PIPE
//
// This IOCTL allows the user to reset a pipe. The pipe that
// is reset is the pipe that corresponds to the open handle
// to which this IOCTL is sent
//
// Input:
// PUSBFX2_PIPE_ENUM indicating which pipe to reset
//
// Output:
// None.
//
// Access Required:
// Write.
//
#define IOCTL_OSRUSBFX2_RESET_PIPE \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x803, METHOD_BUFFERED, FILE_WRITE_ACCESS)
//
// IOCTL_OSRUSBFX2_GET_DEVICE_DESCRIPTOR
//
// This IOCTL allows the user to get the USB device descriptor
// for the device
//
// Input:
// None.
//
// Output:
// USB_DEVICE_DESCRIPTOR.
//
// Access Required:
// Read.
//
#define IOCTL_OSRUSBFX2_GET_DEVICE_DESCRIPTOR \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x804, METHOD_BUFFERED, FILE_READ_ACCESS)
//
// IOCTL_OSRUSBFX2_GET_CONFIGURATION_DESCRIPTOR
//
// This IOCTL allows the user to get the USB configuration descriptor
// for the device
//
// Input:
// None.
//
// Output:
// USB_CONFIGURATION_DESCRIPTOR.
//
// Access Required:
// Read.
//
#define IOCTL_OSRUSBFX2_GET_CONFIGURATION_DESCRIPTOR \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x805, METHOD_BUFFERED, FILE_READ_ACCESS)
//
// IOCTL_OSRUSBFX2_GET_PIPE_INFORMATION
//
// This IOCTL allows the user to get the USB pipe descriptor
// for the open pipe
//
// Input:
// PUSBFX2_PIPE_ENUM indicating which pipe
//
// Output:
// USBD_PIPE_INFORMATION.
//
// Access Required:
// Read.
//
#define IOCTL_OSRUSBFX2_GET_PIPE_INFORMATION \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x806, METHOD_BUFFERED, FILE_READ_ACCESS)
//
// IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY
//
// This IOCTL allows the user to get the state of the 7 Segment Display.
//
// Input:
// None.
//
// Output:
// 7 SEGMENT STATE
//
// Access Required:
// Read.
//
#define IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x808, METHOD_BUFFERED, FILE_READ_ACCESS)
//
// IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY
//
// This IOCTL allows the user to set the state of the 7 Segment display.
//
// Input:
// 7 SEGMENT STATE.
//
// Output:
// None.
//
// Access Required:
// Write.
//
#define IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x809, METHOD_BUFFERED, FILE_WRITE_ACCESS)
//
// IOCTL_OSRUSBFX2_GET_INTERFACE_INFORMATION
//
// This IOCTL allows the user to get the USB Interface Information
// for the device
//
// Input:
// None.
//
// Output:
// USB_CONFIGURATION_DESCRIPTOR.
//
// Access Required:
// Read.
//
#define IOCTL_OSRUSBFX2_GET_INTERFACE_INFORMATION \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x810, METHOD_BUFFERED, FILE_READ_ACCESS)
//
// IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE
//
// This IOCTL allows the user to get a USB Interrupt Message
// from the device
//
// Input:
// None.
//
// Output:
// Interrupt Message
//
// Access Required:
// Read.
//
#define IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE \
CTL_CODE(FILE_DEVICE_OSRUSBFX2LK, 0x811, METHOD_BUFFERED, FILE_READ_ACCESS)
#endif /* __USBFX2LK_IOCTL_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -