60 lines
4.2 KiB
QBasic
60 lines
4.2 KiB
QBasic
Attribute VB_Name = "Module2"
|
||
Option Explicit
|
||
|
||
|
||
'######################## 常量定义 #################################
|
||
' CreateFileObject所用的文件操作方式控制字(可通过或指令实现多种方式并操作)
|
||
Public Const PCI2312_modeRead = &H0 ' 只读文件方式
|
||
Public Const PCI2312_modeWrite = &H1 ' 只写文件方式
|
||
Public Const PCI2312_modeReadWrite = &H2 ' 既读又写文件方式
|
||
Public Const PCI2312_modeCreate = &H3 ' 如果文件不存可以创建该文件,如果存在,则重建此文件,并清0
|
||
Public Const PCI2312_typeText = &H4 ' 以文本方式操作文件
|
||
|
||
|
||
'######################## Common function ##############################
|
||
Declare Function PCI2312_CreateDevice Lib "PCI2312_32" (ByVal DeviceID As Integer) As Long ' create device object
|
||
Declare Function PCI2312_GetDeviceCount Lib "PCI2312_32" (ByVal hDevice As Long) As Integer ' get the amount of this kind of device from this system
|
||
Declare Function PCI2312_GetDeviceCurrentID Lib "PCI2312_32" (ByVal hDevice As Long) As Boolean
|
||
Declare Function PCI2312_ListDeviceDlg Lib "PCI2312_32" (ByVal hDevice As Long) As Boolean ' list all PCI devices in the system
|
||
Declare Function PCI2312_ReleaseDevice Lib "PCI2312_32" (ByVal hDevice As Long) As Boolean ' reset the whole PCI device
|
||
|
||
'####################### DI/DO function #################################
|
||
'Applicable to the equipment control that is more direct and specific, low-level, more complex.
|
||
' For example, if it needs special control process and control efficiency in accordance with the special control object , users can achieve by using these interfaces.
|
||
|
||
Declare Function PCI2312_SetDeviceDO Lib "PCI2312_32" (ByVal hDevice As Long, ByRef bDOSts As Byte) As Boolean
|
||
Declare Function PCI2312_GetDeviceDI Lib "PCI2312_32" (ByVal hDevice As Long, ByRef bDISts As Byte) As Boolean
|
||
' Get on/off status
|
||
' device handle
|
||
' on/off status
|
||
|
||
'####################### The trigger interrupt function #################################
|
||
' It consists of hardware signal of the state change CPU produce interruption hEventInt.。
|
||
Declare Function PCI2312_InitDeviceInt Lib "PCI2312_32" ( _
|
||
ByVal hDevice As Long, _
|
||
ByVal hEventInt As Long) As Boolean ' initialize interruption
|
||
|
||
|
||
Declare Function PCI2312_GetDeviceIntCount Lib "PCI2312_32" (ByVal hDevice As Long) As Long ' In interrupt is initialized, using it to get the interrupt service routine produce number of times
|
||
|
||
Declare Function PCI2312_ReleaseDeviceInt Lib "PCI2312_32" (ByVal hDevice As Long) As Boolean ' Release interruption resource
|
||
|
||
|
||
' # # # # # # # # # # # # # # # # # memory mapping registers direct operation and read and write functions # # # # # # # # # # # # # # # # # # # # # # # #
|
||
' suitable for user more directly, this equipment more special, more low, and more complex control. According to the special such as
|
||
' control object need special control flow and control efficiency, the user can use these interface to achieve.
|
||
Declare Function PCI2312_GetDeviceBar Lib "PCI2312_32" (ByVal hDevice As Long, ByRef pbPCIBar As Long) As Boolean
|
||
|
||
Declare Function PCI2312_WritePortByte Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long, ByVal Value As Byte) As Boolean
|
||
Declare Function PCI2312_WritePortWord Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long, ByVal Value As Integer) As Boolean
|
||
Declare Function PCI2312_WritePortULong Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long, ByVal Value As Long) As Boolean
|
||
Declare Function PCI2312_ReadPortByte Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long) As Byte
|
||
Declare Function PCI2312_ReadPortWord Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long) As Integer
|
||
Declare Function PCI2312_ReadPortULong Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long) As Long
|
||
|
||
'########################### Thread operation function ######################################
|
||
Declare Function PCI2312_CreateSystemEvent Lib "PCI2312_32" () As Long ' create the (kernel) system event object
|
||
Declare Function PCI2312_ReleaseSystemEvent Lib "PCI2312_32" (ByVal hEvent As Long) As Boolean ' release (kernel) system event object
|
||
|
||
|