📄 gpio.h
字号:
/*
* The content of this file or document is CONFIDENTIAL and PROPRIETARY
* to Jade Technologies Co., Ltd. It is subjected to the terms of a
* License Agreement between Licensee and Jade Technologies Co., Ltd.
* restricting among other things, the use, reproduction, distribution
* and transfer. Each of the embodiments, including this information
* and any derivative work shall retain this copyright notice.
*
* Copyright (c) 2004 - 2005 Jade Technologies Co., Ltd.
* All rights reserved.
* ----------------------------------------------------------------
* File: gpio.h,v
* Revision: 1.0
* ----------------------------------------------------------------
* $
*/
#include <windows.h>
#define FILE_DEVICE_GIO 32769 // The device id for the GIO driver
#define GIO_IOCTL_FUNCTION_BASE 2048 // The base function code for OEM HAL IOCTL functions
// The GPIO IOCTL function list
#define GIO_IOCTL_ALLOCATE_IO_PINS (GIO_IOCTL_FUNCTION_BASE + 0)
#define GIO_IOCTL_FREE_IO_PINS (GIO_IOCTL_FUNCTION_BASE + 1)
#define GIO_IOCTL_CONFIGURE_IO_INTERRUPTS (GIO_IOCTL_FUNCTION_BASE + 2)
#define GIO_IOCTL_GET_PORTS (GIO_IOCTL_FUNCTION_BASE + 3)
#define GIO_IOCTL_SET_PORT (GIO_IOCTL_FUNCTION_BASE + 4)
#define GIO_IOCTL_CLEAR_PORT (GIO_IOCTL_FUNCTION_BASE + 5)
#define GIO_IOCTL_MODIFY_PORT (GIO_IOCTL_FUNCTION_BASE + 6)
#define GIO_IOCTL_GET_DDR (GIO_IOCTL_FUNCTION_BASE + 7)
#define GIO_IOCTL_SET_PORT_AS_INPUT (GIO_IOCTL_FUNCTION_BASE + 8)
#define GIO_IOCTL_SET_PORT_AS_OUTPUT (GIO_IOCTL_FUNCTION_BASE + 9)
#define GIO_IOCTL_GET_PORT_ALTERNATE_FUNCTION (GIO_IOCTL_FUNCTION_BASE + 10)
#define GIO_IOCTL_SET_PORT_ALTERNATE_FUNCTION (GIO_IOCTL_FUNCTION_BASE + 11)
#define GIO_IOCTL_CLEAR_PORT_ALTERNATE_FUNCTION (GIO_IOCTL_FUNCTION_BASE + 12)
#define GIO_IOCTL_GET_EVENT_PINS (GIO_IOCTL_FUNCTION_BASE + 13)
#define GIO_IOCTL_REGISTER_EVENT (GIO_IOCTL_FUNCTION_BASE + 14)
#define GIO_IOCTL_CLEAR_EVENT_PINS (GIO_IOCTL_FUNCTION_BASE + 15)
// The GPIO IOCTLs
#define IOCTL_GIO_ALLOCATE_IO_PINS CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_ALLOCATE_IO_PINS, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_FREE_IO_PINS CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_FREE_IO_PINS, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_CONFIGURE_IO_INTERRUPTS CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_CONFIGURE_IO_INTERRUPTS, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_GET_PORTS CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_GET_PORTS, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_SET_PORT CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_SET_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_CLEAR_PORT CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_CLEAR_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_MODIFY_PORT CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_MODIFY_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_GET_DDR CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_GET_DDR, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_SET_PORT_AS_INPUT CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_SET_PORT_AS_INPUT, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_SET_PORT_AS_OUTPUT CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_SET_PORT_AS_OUTPUT, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_GET_PORT_ALTERNATE_FUNCTION CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_GET_PORT_ALTERNATE_FUNCTION, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_SET_PORT_ALTERNATE_FUNCTION CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_SET_PORT_ALTERNATE_FUNCTION, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_CLEAR_PORT_ALTERNATE_FUNCTION CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_CLEAR_PORT_ALTERNATE_FUNCTION, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_GET_EVENT_PINS CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_GET_EVENT_PINS, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_REGISTER_EVENT CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_REGISTER_EVENT, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GIO_CLEAR_EVENT_PINS CTL_CODE(FILE_DEVICE_GIO, GIO_IOCTL_CLEAR_EVENT_PINS, METHOD_BUFFERED, FILE_ANY_ACCESS)
//
// Parameters for AllocateIOPins
//
typedef struct tagAllocateIOParams {
DWORD dwPinMask;
}ALLOCATE_IO_PARAMS, *PALLOCATE_IO_PARAMS;
//
// Result data for AllocateIOPins
//
typedef struct tagAllocateIOResult {
UCHAR ucPad; // Keep the compiler happy
}ALLOCATE_IO_RESULT, *PALLOCATE_IO_RESULT;
//
// Parameters for FreeIOPins
//
typedef struct tagFreeIOParams {
DWORD dwPinMask;
}FREE_IO_PARAMS, *PFREE_IO_PARAMS;
//
// Result data for FreeIOPins
//
typedef struct tagFreeIOResult {
UCHAR ucPad; // Keep the compiler happy
}FREE_IO_RESULT, *PFREE_IO_RESULT;
//
// Parameters for ConfigureIOPins
//
typedef struct tagConfigureIOParams {
DWORD dwSenseMask;
DWORD dwEdgeMask;
DWORD dwEventMask;
DWORD dwInterruptEnableMask;
}CONFIGURE_IO_PARAMS, *PCONFIGURE_IO_PARAMS;
//
// Result data for ConfigureIOPins
//
typedef struct tagConfigureIOResult {
UCHAR ucPad; // Keep the compiler happy
}CONFIGURE_IO_RESULT, *PCONFIGURE_IO_RESULT;
//
// Parameters for GetPorts
//
typedef struct tagGetPortsParams {
UCHAR ucPad; // Keep the compiler happy
}GET_PORTS_PARAMS, *PGET_PORTS_PARAMS;
//
// Result data for GetPorts
//
typedef struct tagGetPortsResult {
DWORD dwPinData;
}GET_PORTS_RESULT, *PGET_PORTS_RESULT;
//
// Parameters for SetPort
//
typedef struct tagSetPortParams {
DWORD dwPinMask;
}SET_PORT_PARAMS, *PSET_PORT_PARAMS;
//
// Result data for SetPort
//
typedef struct tagSetPortResult {
UCHAR ucPad; // Keep the compiler happy
}SET_PORT_RESULT, *PSET_PORT_RESULT;
//
// Parameters for ClearPort
//
typedef struct tagClearPortParams {
DWORD dwPinMask;
}CLEAR_PORT_PARAMS, *PCLEAR_PORT_PARAMS;
//
// Result data for ClearPort
//
typedef struct tagClearPortResult {
UCHAR ucPad; // Keep the compiler happy
}CLEAR_PORT_RESULT, *PCLEAR_PORT_RESULT;
//
// Parameters for ModifyPort
//
typedef struct tagModifyPortParams {
DWORD dwClearMask;
DWORD dwSetMask;
}MODIFY_PORT_PARAMS, *PMODIFY_PORT_PARAMS;
//
// Result data for ModifyPort
//
typedef struct tagModifyPortResult {
UCHAR ucPad; // Keep the compiler happy
}MODIFY_PORT_RESULT, *PMODIFY_PORT_RESULT;
//
// Parameters for GetDDR
//
typedef struct tagGetDDRParams {
UCHAR ucPad; // Keep the compiler happy
}GET_DDR_PARAMS, *PGET_DDR_PARAMS;
//
// Result data for GetDDR
//
typedef struct tagGetDDRResult {
DWORD dwDirectionMask;
}GET_DDR_RESULT, *PGET_DDR_RESULT;
//
// Parameters for SetAsInput
//
typedef struct tagSetInputParams {
DWORD dwSetMask;
}SET_INPUT_PARAMS, *PSET_INPUT_PARAMS;
//
// Result data for SetAsInput
//
typedef struct tagSetInputResult {
UCHAR ucPad; // Keep the compiler happy
}SET_INPUT_RESULT, *PSET_INPUT_RESULT;
//
// Parameters for SetAsOutput
//
typedef struct tagSetOutputParams {
DWORD dwSetMask;
}SET_OUTPUT_PARAMS, *PSET_OUTPUT_PARAMS;
//
// Result data for SetAsOutput
//
typedef struct tagSetOutputResult {
UCHAR ucPad; // Keep the compiler happy
}SET_OUTPUT_RESULT, *PSET_OUTPUT_RESULT;
//
// Parameters for GetAltFunction
//
typedef struct tagGetAltFunctionParams {
UCHAR ucPad; // Keep the compiler happy
}GET_ALT_FUNCTION_PARAMS, *PGET_ALT_FUNCTION_PARAMS;
//
// Result data for GetAltFunction
//
typedef struct tagGetAltFunctionResult {
DWORD dwFunctionMask;
}GET_ALT_FUNCTION_RESULT, *PGET_ALT_FUNCTION_RESULT;
//
// Parameters for SetAltFunction
//
typedef struct tagSetAltFunctionParams {
DWORD dwFunctionMask;
}SET_ALT_FUNCTION_PARAMS, *PSET_ALT_FUNCTION_PARAMS;
//
// Result data for SetAltFunction
//
typedef struct tagSetAltFunctionResult {
UCHAR ucPad; // Keep the compiler happy
}SET_ALT_FUNCTION_RESULT, *PSET_ALT_FUNCTION_RESULT;
//
// Parameters for ClearAltFunction
//
typedef struct tagClearAltFunctionParams {
DWORD dwFunctionMask;
}CLEAR_ALT_FUNCTION_PARAMS, *PCLEAR_ALT_FUNCTION_PARAMS;
//
// Result data for ClearAltFunction
//
typedef struct tagClearAltFunctionResult {
UCHAR ucPad; // Keep the compiler happy
}CLEAR_ALT_FUNCTION_RESULT, *PCLEAR_ALT_FUNCTION_RESULT;
//
// Parameters for GetEventPins
//
typedef struct tagGetEventPinsParams {
UCHAR ucPad; // Keep the compiler happy
}GET_EVENT_PINS_PARAMS, *PGET_EVENT_PINS_PARAMS;
//
// Result data for GetEventPins
//
typedef struct tagGetEventPinsResult {
DWORD dwPinMask;
}GET_EVENT_PINS_RESULT, *PGET_EVENT_PINS_RESULT;
//
// Parameters for RegisterEvent
//
typedef struct tagRegisterEventParams {
LPTSTR lpszEventName;
}REGISTER_EVENT_PARAMS, *PREGISTER_EVENT_PARAMS;
//
// Result data for RegisterEvent
//
typedef struct tagRegisterEventResult {
UCHAR ucPad; // Keep the compiler happy
}REGISTER_EVENT_RESULT, *PREGISTER_EVENT_RESULT;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -