📄 dmaform.frm
字号:
VERSION 5.00
Begin VB.Form DmaForm
Caption = "DMA buffer test for TVicHW32.DLL 4.0"
ClientHeight = 5355
ClientLeft = 60
ClientTop = 345
ClientWidth = 7185
LinkTopic = "Form1"
ScaleHeight = 5355
ScaleWidth = 7185
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Allocate DMA Buffer"
Height = 435
Left = 180
TabIndex = 23
Top = 3660
Width = 1815
End
Begin VB.TextBox E_Size
Height = 375
Left = 3480
TabIndex = 21
Text = "16"
Top = 3660
Width = 915
End
Begin VB.Frame Frame3
Caption = "DMA of type: "
Height = 855
Left = 180
TabIndex = 18
Top = 2580
Width = 4215
Begin VB.OptionButton C_Busmaster
Caption = "Busmaster DMA"
Height = 255
Left = 2280
TabIndex = 20
Top = 360
Width = 1455
End
Begin VB.OptionButton C_System
Caption = "System (Slave) DMA"
Height = 255
Left = 180
TabIndex = 19
Top = 360
Value = -1 'True
Width = 1815
End
End
Begin VB.Frame Frame2
Caption = "Alignment "
Height = 2235
Left = 180
TabIndex = 11
Top = 120
Width = 4215
Begin VB.OptionButton R_Align
Caption = "Physical address is a multiple of 128 KByte"
Height = 195
Index = 5
Left = 180
TabIndex = 17
Top = 1740
Width = 3375
End
Begin VB.OptionButton R_Align
Caption = "Physical address is a multiple of 64 KByte"
Height = 195
Index = 4
Left = 180
TabIndex = 16
Top = 1464
Width = 3255
End
Begin VB.OptionButton R_Align
Caption = "Physical address is a multiple of 32 KByte"
Height = 195
Index = 3
Left = 180
TabIndex = 15
Top = 1188
Width = 3315
End
Begin VB.OptionButton R_Align
Caption = "Physical address is a multiple of 16 KByte"
Height = 195
Index = 2
Left = 180
TabIndex = 14
Top = 912
Width = 3255
End
Begin VB.OptionButton R_Align
Caption = "Physical address is a multiple of 8 KByte"
Height = 195
Index = 1
Left = 180
TabIndex = 13
Top = 636
Width = 3195
End
Begin VB.OptionButton R_Align
Caption = "Physical address is a multiple of 4 KByte"
Height = 195
Index = 0
Left = 180
TabIndex = 12
Top = 360
Value = -1 'True
Width = 3195
End
End
Begin VB.Frame Dentry
Caption = "Driver Entry Point"
Height = 1035
Left = 4620
TabIndex = 8
Top = 1740
Width = 2415
Begin VB.OptionButton TVicDevice0
Caption = "TVicDevice0"
Height = 255
Left = 240
TabIndex = 10
Top = 300
Value = -1 'True
Width = 1575
End
Begin VB.OptionButton TVicDevice1
Caption = "TVicDevice1"
Height = 255
Left = 240
TabIndex = 9
Top = 660
Width = 1575
End
End
Begin VB.CommandButton B_Exit
Caption = "Exit"
Height = 495
Left = 4620
TabIndex = 7
Top = 4740
Width = 2415
End
Begin VB.Frame Frame1
Height = 1455
Left = 4620
TabIndex = 2
Top = 120
Width = 2415
Begin VB.Label Label6
Alignment = 2 'Center
Caption = "mailto: ivi@ufanet.ru"
Height = 255
Left = 120
TabIndex = 6
Top = 1080
Width = 2175
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "Copyright (c) Victor Ishikeev"
Height = 255
Left = 120
TabIndex = 5
Top = 840
Width = 2175
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "Shareware v.m. 4.0"
Height = 255
Index = 0
Left = 120
TabIndex = 4
Top = 600
Width = 1935
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "TVicHW32"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 204
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 240
TabIndex = 3
Top = 240
Width = 1935
End
End
Begin VB.CommandButton Close_Driver
Caption = "Close TVicHW32"
Height = 495
Left = 4620
TabIndex = 1
Top = 3540
Width = 2415
End
Begin VB.CommandButton Open_Driver
Caption = "Open TVicHW32"
Height = 495
Left = 4620
TabIndex = 0
Top = 2940
Width = 2415
End
Begin VB.Label L_Physical
Caption = "???"
Height = 255
Left = 1800
TabIndex = 27
Top = 4740
Width = 1815
End
Begin VB.Label L_Linear
Caption = "???"
Height = 315
Left = 1800
TabIndex = 26
Top = 4260
Width = 1695
End
Begin VB.Label Label7
Caption = "Physical Address:"
Height = 315
Left = 180
TabIndex = 25
Top = 4680
Width = 1395
End
Begin VB.Label Label2
Caption = "Linear Address:"
Height = 315
Left = 180
TabIndex = 24
Top = 4260
Width = 1455
End
Begin VB.Label Label1
Caption = " Size (KBytes)"
Height = 315
Left = 2220
TabIndex = 22
Top = 3720
Width = 1155
End
End
Attribute VB_Name = "DmaForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim HW32 As Long
Dim ActiveHW As Boolean
Dim AlignIndex As Integer
Private Sub B_Exit_Click()
If ActiveHW Then HW32 = CloseTVicHW32(HW32)
ActiveHW = False
Unload DmaForm
End Sub
Private Sub Close_Driver_Click()
HW32 = CloseTVicHW32(HW32)
Open_Driver.Enabled = True
Close_Driver.Enabled = False
ActiveHW = False
AlignIndex = 0
End Sub
Private Sub Command1_Click()
Dim Req As TDmaBufferRequest
Req.LengthOfBuffer = 1024 * E_Size.Text
Select Case AlignIndex
Case 0: Req.AlignMask = &H0 ' // 4K
Case 1: Req.AlignMask = &H1 ' 8K
Case 2: Req.AlignMask = &H3 ' 16K
Case 3: Req.AlignMask = &H7 ' 32K
Case 4: Req.AlignMask = &HF ' 64K
Case 5: Req.AlignMask = &H1F ' 128K
End Select
If C_System.Value Then
Allocated = GetSysDmaBuffer(HW32, Req)
Else
Allocated = GetBusmasterDmaBuffer(HW32, Req)
End If
L_Linear.Caption = IntToHex8(Req.LinDmaAddress) + "h"
L_Physical.Caption = IntToHex8(Req.PhysDmaAddress) + "h"
Call FreeDmaBuffer(HW32, Req)
End Sub
Private Sub Form_Load()
Open_Driver.Enabled = True
Close_Driver.Enabled = False
End Sub
Private Sub Open_Driver_Click()
HW32 = 0
If TVicDevice0 Then
HW32 = OpenTVicHW32(HW32, "TVICHW32", "TVicDevice0")
Else
HW32 = OpenTVicHW32(HW32, "TVICHW32", "TVicDevice1")
End If
If GetActiveHW(HW32) Then
Open_Driver.Enabled = False
Close_Driver.Enabled = True
ActiveHW = True
Else
Call MsgBox("Can't open the driver!", 0, "Warning!")
End If
End Sub
Private Sub R_Align_Click(Index As Integer)
AlignIndex = Index
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -