ホーム › Devices.DeviceAndDriverInstallation › DMA_DES
DMA_DES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| DD_Count | DWORD | 4 | +0 | +0 | 後続のDMA_RANGE配列の要素数。 |
| DD_Type | DWORD | 4 | +4 | +4 | DMA記述子の種別を示す値。 |
| DD_Flags | DD_FLAGS | 4 | +8 | +8 | DMA記述子のフラグ群(DD_FLAGS)。 |
| DD_Alloc_Chan | DWORD | 4 | +12 | +12 | 割り当てられたDMAチャネル番号。 |
各言語での定義
#include <windows.h>
// DMA_DES (x64 16 / x86 16 バイト)
#pragma pack(push, 1)
typedef struct DMA_DES {
DWORD DD_Count;
DWORD DD_Type;
DD_FLAGS DD_Flags;
DWORD DD_Alloc_Chan;
} DMA_DES;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DMA_DES
{
public uint DD_Count;
public uint DD_Type;
public uint DD_Flags;
public uint DD_Alloc_Chan;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DMA_DES
Public DD_Count As UInteger
Public DD_Type As UInteger
Public DD_Flags As UInteger
Public DD_Alloc_Chan As UInteger
End Structureimport ctypes
from ctypes import wintypes
class DMA_DES(ctypes.Structure):
_pack_ = 1
_fields_ = [
("DD_Count", wintypes.DWORD),
("DD_Type", wintypes.DWORD),
("DD_Flags", wintypes.DWORD),
("DD_Alloc_Chan", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct DMA_DES {
pub DD_Count: u32,
pub DD_Type: u32,
pub DD_Flags: u32,
pub DD_Alloc_Chan: u32,
}import "golang.org/x/sys/windows"
type DMA_DES struct {
DD_Count uint32
DD_Type uint32
DD_Flags uint32
DD_Alloc_Chan uint32
}type
DMA_DES = packed record
DD_Count: DWORD;
DD_Type: DWORD;
DD_Flags: DWORD;
DD_Alloc_Chan: DWORD;
end;const DMA_DES = extern struct {
DD_Count: u32,
DD_Type: u32,
DD_Flags: u32,
DD_Alloc_Chan: u32,
};type
DMA_DES {.packed.} = object
DD_Count: uint32
DD_Type: uint32
DD_Flags: uint32
DD_Alloc_Chan: uint32align(1)
struct DMA_DES
{
uint DD_Count;
uint DD_Type;
uint DD_Flags;
uint DD_Alloc_Chan;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DMA_DES サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; DD_Count : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DD_Type : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; DD_Flags : DD_FLAGS (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; DD_Alloc_Chan : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DMA_DES, pack=1
#field int DD_Count
#field int DD_Type
#field int DD_Flags
#field int DD_Alloc_Chan
#endstruct
stdim st, DMA_DES ; NSTRUCT 変数を確保
st->DD_Count = 100
mes "DD_Count=" + st->DD_Count