Win32 API 日本語リファレンス
ホームStorage.Nvme › NVME_CONTROLLER_REGISTERS

NVME_CONTROLLER_REGISTERS

構造体
サイズx64: 4104 バイト / x86: 4104 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
CAPNVME_CONTROLLER_CAPABILITIES8+0+0コントローラ能力レジスタ(CAP)。
VSNVME_VERSION4+8+8バージョンレジスタ(VS)。
INTMSDWORD4+12+12割り込みマスク設定レジスタ(INTMS)。書き込んだビットの割り込みをマスクする。
INTMCDWORD4+16+16割り込みマスク解除レジスタ(INTMC)。書き込んだビットのマスクを解除する。
CCNVME_CONTROLLER_CONFIGURATION4+20+20コントローラ構成レジスタ(CC)。
Reserved0DWORD4+24+24予約領域。未使用。
CSTSNVME_CONTROLLER_STATUS4+28+28コントローラ状態レジスタ(CSTS)。
NSSRNVME_NVM_SUBSYSTEM_RESET4+32+32NVMサブシステムリセットレジスタ(NSSR)。
AQANVME_ADMIN_QUEUE_ATTRIBUTES4+36+36管理キュー属性レジスタ(AQA)。
ASQNVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS8+40+40管理送信キュー基底アドレスレジスタ(ASQ)。
ACQNVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS8+48+48管理完了キュー基底アドレスレジスタ(ACQ)。
CMBLOCNVME_CONTROLLER_MEMORY_BUFFER_LOCATION4+56+56コントローラメモリバッファ位置レジスタ(CMBLOC)。
CMBSZNVME_CONTROLLER_MEMORY_BUFFER_SIZE4+60+60コントローラメモリバッファサイズレジスタ(CMBSZ)。
Reserved1DWORD36+64+64予約領域。未使用。
NSSDNVME_NVM_SUBSYSTEM_SHUTDOWN4+100+100NVMサブシステムシャットダウンレジスタ(NSSD)。
CRTONVME_CONTROLLER_READY_TIMEOUTS4+104+104コントローラ準備完了タイムアウトレジスタ(CRTO)。
Reserved2DWORD3732+108+108予約領域。未使用。
Reserved3DWORD256+3840+3840予約領域。未使用。
DoorbellsDWORD4+4096+4096送信/完了キューのドアベルレジスタが続く先頭領域。

各言語での定義

#include <windows.h>

// NVME_CONTROLLER_CAPABILITIES  (x64 8 / x86 8 バイト)
typedef struct NVME_CONTROLLER_CAPABILITIES {
    _Anonymous_e__Struct Anonymous;
    ULONGLONG AsUlonglong;
} NVME_CONTROLLER_CAPABILITIES;

// NVME_VERSION  (x64 4 / x86 4 バイト)
typedef struct NVME_VERSION {
    _Anonymous_e__Struct Anonymous;
    DWORD AsUlong;
} NVME_VERSION;

// NVME_CONTROLLER_CONFIGURATION  (x64 4 / x86 4 バイト)
typedef struct NVME_CONTROLLER_CONFIGURATION {
    _Anonymous_e__Struct Anonymous;
    DWORD AsUlong;
} NVME_CONTROLLER_CONFIGURATION;

// NVME_CONTROLLER_STATUS  (x64 4 / x86 4 バイト)
typedef struct NVME_CONTROLLER_STATUS {
    _Anonymous_e__Struct Anonymous;
    DWORD AsUlong;
} NVME_CONTROLLER_STATUS;

// NVME_NVM_SUBSYSTEM_RESET  (x64 4 / x86 4 バイト)
typedef struct NVME_NVM_SUBSYSTEM_RESET {
    DWORD NSSRC;
} NVME_NVM_SUBSYSTEM_RESET;

// NVME_ADMIN_QUEUE_ATTRIBUTES  (x64 4 / x86 4 バイト)
typedef struct NVME_ADMIN_QUEUE_ATTRIBUTES {
    _Anonymous_e__Struct Anonymous;
    DWORD AsUlong;
} NVME_ADMIN_QUEUE_ATTRIBUTES;

// NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS  (x64 8 / x86 8 バイト)
typedef struct NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS {
    _Anonymous_e__Struct Anonymous;
    ULONGLONG AsUlonglong;
} NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS;

// NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS  (x64 8 / x86 8 バイト)
typedef struct NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS {
    _Anonymous_e__Struct Anonymous;
    ULONGLONG AsUlonglong;
} NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS;

// NVME_CONTROLLER_MEMORY_BUFFER_LOCATION  (x64 4 / x86 4 バイト)
typedef struct NVME_CONTROLLER_MEMORY_BUFFER_LOCATION {
    _Anonymous_e__Struct Anonymous;
    DWORD AsUlong;
} NVME_CONTROLLER_MEMORY_BUFFER_LOCATION;

// NVME_CONTROLLER_MEMORY_BUFFER_SIZE  (x64 4 / x86 4 バイト)
typedef struct NVME_CONTROLLER_MEMORY_BUFFER_SIZE {
    _Anonymous_e__Struct Anonymous;
    DWORD AsUlong;
} NVME_CONTROLLER_MEMORY_BUFFER_SIZE;

// NVME_NVM_SUBSYSTEM_SHUTDOWN  (x64 4 / x86 4 バイト)
typedef struct NVME_NVM_SUBSYSTEM_SHUTDOWN {
    DWORD NSSC;
} NVME_NVM_SUBSYSTEM_SHUTDOWN;

// NVME_CONTROLLER_READY_TIMEOUTS  (x64 4 / x86 4 バイト)
typedef struct NVME_CONTROLLER_READY_TIMEOUTS {
    _Anonymous_e__Struct Anonymous;
    DWORD AsUlong;
} NVME_CONTROLLER_READY_TIMEOUTS;

// NVME_CONTROLLER_REGISTERS  (x64 4104 / x86 4104 バイト)
typedef struct NVME_CONTROLLER_REGISTERS {
    NVME_CONTROLLER_CAPABILITIES CAP;
    NVME_VERSION VS;
    DWORD INTMS;
    DWORD INTMC;
    NVME_CONTROLLER_CONFIGURATION CC;
    DWORD Reserved0;
    NVME_CONTROLLER_STATUS CSTS;
    NVME_NVM_SUBSYSTEM_RESET NSSR;
    NVME_ADMIN_QUEUE_ATTRIBUTES AQA;
    NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS ASQ;
    NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS ACQ;
    NVME_CONTROLLER_MEMORY_BUFFER_LOCATION CMBLOC;
    NVME_CONTROLLER_MEMORY_BUFFER_SIZE CMBSZ;
    DWORD Reserved1[9];
    NVME_NVM_SUBSYSTEM_SHUTDOWN NSSD;
    NVME_CONTROLLER_READY_TIMEOUTS CRTO;
    DWORD Reserved2[933];
    DWORD Reserved3[64];
    DWORD Doorbells[1];
} NVME_CONTROLLER_REGISTERS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_CONTROLLER_CAPABILITIES
{
    public _Anonymous_e__Struct Anonymous;
    public ulong AsUlonglong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_VERSION
{
    public _Anonymous_e__Struct Anonymous;
    public uint AsUlong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_CONTROLLER_CONFIGURATION
{
    public _Anonymous_e__Struct Anonymous;
    public uint AsUlong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_CONTROLLER_STATUS
{
    public _Anonymous_e__Struct Anonymous;
    public uint AsUlong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_NVM_SUBSYSTEM_RESET
{
    public uint NSSRC;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_ADMIN_QUEUE_ATTRIBUTES
{
    public _Anonymous_e__Struct Anonymous;
    public uint AsUlong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS
{
    public _Anonymous_e__Struct Anonymous;
    public ulong AsUlonglong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS
{
    public _Anonymous_e__Struct Anonymous;
    public ulong AsUlonglong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_CONTROLLER_MEMORY_BUFFER_LOCATION
{
    public _Anonymous_e__Struct Anonymous;
    public uint AsUlong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_CONTROLLER_MEMORY_BUFFER_SIZE
{
    public _Anonymous_e__Struct Anonymous;
    public uint AsUlong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_NVM_SUBSYSTEM_SHUTDOWN
{
    public uint NSSC;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_CONTROLLER_READY_TIMEOUTS
{
    public _Anonymous_e__Struct Anonymous;
    public uint AsUlong;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_CONTROLLER_REGISTERS
{
    public NVME_CONTROLLER_CAPABILITIES CAP;
    public NVME_VERSION VS;
    public uint INTMS;
    public uint INTMC;
    public NVME_CONTROLLER_CONFIGURATION CC;
    public uint Reserved0;
    public NVME_CONTROLLER_STATUS CSTS;
    public NVME_NVM_SUBSYSTEM_RESET NSSR;
    public NVME_ADMIN_QUEUE_ATTRIBUTES AQA;
    public NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS ASQ;
    public NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS ACQ;
    public NVME_CONTROLLER_MEMORY_BUFFER_LOCATION CMBLOC;
    public NVME_CONTROLLER_MEMORY_BUFFER_SIZE CMBSZ;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public uint[] Reserved1;
    public NVME_NVM_SUBSYSTEM_SHUTDOWN NSSD;
    public NVME_CONTROLLER_READY_TIMEOUTS CRTO;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 933)] public uint[] Reserved2;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public uint[] Reserved3;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] Doorbells;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_CONTROLLER_CAPABILITIES
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlonglong As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_VERSION
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlong As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_CONTROLLER_CONFIGURATION
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlong As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_CONTROLLER_STATUS
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlong As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_NVM_SUBSYSTEM_RESET
    Public NSSRC As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_ADMIN_QUEUE_ATTRIBUTES
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlong As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlonglong As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlonglong As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_CONTROLLER_MEMORY_BUFFER_LOCATION
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlong As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_CONTROLLER_MEMORY_BUFFER_SIZE
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlong As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_NVM_SUBSYSTEM_SHUTDOWN
    Public NSSC As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_CONTROLLER_READY_TIMEOUTS
    Public Anonymous As _Anonymous_e__Struct
    Public AsUlong As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_CONTROLLER_REGISTERS
    Public CAP As NVME_CONTROLLER_CAPABILITIES
    Public VS As NVME_VERSION
    Public INTMS As UInteger
    Public INTMC As UInteger
    Public CC As NVME_CONTROLLER_CONFIGURATION
    Public Reserved0 As UInteger
    Public CSTS As NVME_CONTROLLER_STATUS
    Public NSSR As NVME_NVM_SUBSYSTEM_RESET
    Public AQA As NVME_ADMIN_QUEUE_ATTRIBUTES
    Public ASQ As NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS
    Public ACQ As NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS
    Public CMBLOC As NVME_CONTROLLER_MEMORY_BUFFER_LOCATION
    Public CMBSZ As NVME_CONTROLLER_MEMORY_BUFFER_SIZE
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=9)> Public Reserved1() As UInteger
    Public NSSD As NVME_NVM_SUBSYSTEM_SHUTDOWN
    Public CRTO As NVME_CONTROLLER_READY_TIMEOUTS
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=933)> Public Reserved2() As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public Reserved3() As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Doorbells() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class NVME_CONTROLLER_CAPABILITIES(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlonglong", ctypes.c_ulonglong),
    ]

class NVME_VERSION(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlong", wintypes.DWORD),
    ]

class NVME_CONTROLLER_CONFIGURATION(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlong", wintypes.DWORD),
    ]

class NVME_CONTROLLER_STATUS(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlong", wintypes.DWORD),
    ]

class NVME_NVM_SUBSYSTEM_RESET(ctypes.Structure):
    _fields_ = [
        ("NSSRC", wintypes.DWORD),
    ]

class NVME_ADMIN_QUEUE_ATTRIBUTES(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlong", wintypes.DWORD),
    ]

class NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlonglong", ctypes.c_ulonglong),
    ]

class NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlonglong", ctypes.c_ulonglong),
    ]

class NVME_CONTROLLER_MEMORY_BUFFER_LOCATION(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlong", wintypes.DWORD),
    ]

class NVME_CONTROLLER_MEMORY_BUFFER_SIZE(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlong", wintypes.DWORD),
    ]

class NVME_NVM_SUBSYSTEM_SHUTDOWN(ctypes.Structure):
    _fields_ = [
        ("NSSC", wintypes.DWORD),
    ]

class NVME_CONTROLLER_READY_TIMEOUTS(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUlong", wintypes.DWORD),
    ]

class NVME_CONTROLLER_REGISTERS(ctypes.Structure):
    _fields_ = [
        ("CAP", NVME_CONTROLLER_CAPABILITIES),
        ("VS", NVME_VERSION),
        ("INTMS", wintypes.DWORD),
        ("INTMC", wintypes.DWORD),
        ("CC", NVME_CONTROLLER_CONFIGURATION),
        ("Reserved0", wintypes.DWORD),
        ("CSTS", NVME_CONTROLLER_STATUS),
        ("NSSR", NVME_NVM_SUBSYSTEM_RESET),
        ("AQA", NVME_ADMIN_QUEUE_ATTRIBUTES),
        ("ASQ", NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS),
        ("ACQ", NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS),
        ("CMBLOC", NVME_CONTROLLER_MEMORY_BUFFER_LOCATION),
        ("CMBSZ", NVME_CONTROLLER_MEMORY_BUFFER_SIZE),
        ("Reserved1", wintypes.DWORD * 9),
        ("NSSD", NVME_NVM_SUBSYSTEM_SHUTDOWN),
        ("CRTO", NVME_CONTROLLER_READY_TIMEOUTS),
        ("Reserved2", wintypes.DWORD * 933),
        ("Reserved3", wintypes.DWORD * 64),
        ("Doorbells", wintypes.DWORD * 1),
    ]
#[repr(C)]
pub struct NVME_CONTROLLER_CAPABILITIES {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlonglong: u64,
}

#[repr(C)]
pub struct NVME_VERSION {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlong: u32,
}

#[repr(C)]
pub struct NVME_CONTROLLER_CONFIGURATION {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlong: u32,
}

#[repr(C)]
pub struct NVME_CONTROLLER_STATUS {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlong: u32,
}

#[repr(C)]
pub struct NVME_NVM_SUBSYSTEM_RESET {
    pub NSSRC: u32,
}

#[repr(C)]
pub struct NVME_ADMIN_QUEUE_ATTRIBUTES {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlong: u32,
}

#[repr(C)]
pub struct NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlonglong: u64,
}

#[repr(C)]
pub struct NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlonglong: u64,
}

#[repr(C)]
pub struct NVME_CONTROLLER_MEMORY_BUFFER_LOCATION {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlong: u32,
}

#[repr(C)]
pub struct NVME_CONTROLLER_MEMORY_BUFFER_SIZE {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlong: u32,
}

#[repr(C)]
pub struct NVME_NVM_SUBSYSTEM_SHUTDOWN {
    pub NSSC: u32,
}

#[repr(C)]
pub struct NVME_CONTROLLER_READY_TIMEOUTS {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUlong: u32,
}

#[repr(C)]
pub struct NVME_CONTROLLER_REGISTERS {
    pub CAP: NVME_CONTROLLER_CAPABILITIES,
    pub VS: NVME_VERSION,
    pub INTMS: u32,
    pub INTMC: u32,
    pub CC: NVME_CONTROLLER_CONFIGURATION,
    pub Reserved0: u32,
    pub CSTS: NVME_CONTROLLER_STATUS,
    pub NSSR: NVME_NVM_SUBSYSTEM_RESET,
    pub AQA: NVME_ADMIN_QUEUE_ATTRIBUTES,
    pub ASQ: NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS,
    pub ACQ: NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS,
    pub CMBLOC: NVME_CONTROLLER_MEMORY_BUFFER_LOCATION,
    pub CMBSZ: NVME_CONTROLLER_MEMORY_BUFFER_SIZE,
    pub Reserved1: [u32; 9],
    pub NSSD: NVME_NVM_SUBSYSTEM_SHUTDOWN,
    pub CRTO: NVME_CONTROLLER_READY_TIMEOUTS,
    pub Reserved2: [u32; 933],
    pub Reserved3: [u32; 64],
    pub Doorbells: [u32; 1],
}
import "golang.org/x/sys/windows"

type NVME_CONTROLLER_CAPABILITIES struct {
	Anonymous _Anonymous_e__Struct
	AsUlonglong uint64
}

type NVME_VERSION struct {
	Anonymous _Anonymous_e__Struct
	AsUlong uint32
}

type NVME_CONTROLLER_CONFIGURATION struct {
	Anonymous _Anonymous_e__Struct
	AsUlong uint32
}

type NVME_CONTROLLER_STATUS struct {
	Anonymous _Anonymous_e__Struct
	AsUlong uint32
}

type NVME_NVM_SUBSYSTEM_RESET struct {
	NSSRC uint32
}

type NVME_ADMIN_QUEUE_ATTRIBUTES struct {
	Anonymous _Anonymous_e__Struct
	AsUlong uint32
}

type NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS struct {
	Anonymous _Anonymous_e__Struct
	AsUlonglong uint64
}

type NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS struct {
	Anonymous _Anonymous_e__Struct
	AsUlonglong uint64
}

type NVME_CONTROLLER_MEMORY_BUFFER_LOCATION struct {
	Anonymous _Anonymous_e__Struct
	AsUlong uint32
}

type NVME_CONTROLLER_MEMORY_BUFFER_SIZE struct {
	Anonymous _Anonymous_e__Struct
	AsUlong uint32
}

type NVME_NVM_SUBSYSTEM_SHUTDOWN struct {
	NSSC uint32
}

type NVME_CONTROLLER_READY_TIMEOUTS struct {
	Anonymous _Anonymous_e__Struct
	AsUlong uint32
}

type NVME_CONTROLLER_REGISTERS struct {
	CAP NVME_CONTROLLER_CAPABILITIES
	VS NVME_VERSION
	INTMS uint32
	INTMC uint32
	CC NVME_CONTROLLER_CONFIGURATION
	Reserved0 uint32
	CSTS NVME_CONTROLLER_STATUS
	NSSR NVME_NVM_SUBSYSTEM_RESET
	AQA NVME_ADMIN_QUEUE_ATTRIBUTES
	ASQ NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS
	ACQ NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS
	CMBLOC NVME_CONTROLLER_MEMORY_BUFFER_LOCATION
	CMBSZ NVME_CONTROLLER_MEMORY_BUFFER_SIZE
	Reserved1 [9]uint32
	NSSD NVME_NVM_SUBSYSTEM_SHUTDOWN
	CRTO NVME_CONTROLLER_READY_TIMEOUTS
	Reserved2 [933]uint32
	Reserved3 [64]uint32
	Doorbells [1]uint32
}
type
  NVME_CONTROLLER_CAPABILITIES = record
    Anonymous: _Anonymous_e__Struct;
    AsUlonglong: UInt64;
  end;

  NVME_VERSION = record
    Anonymous: _Anonymous_e__Struct;
    AsUlong: DWORD;
  end;

  NVME_CONTROLLER_CONFIGURATION = record
    Anonymous: _Anonymous_e__Struct;
    AsUlong: DWORD;
  end;

  NVME_CONTROLLER_STATUS = record
    Anonymous: _Anonymous_e__Struct;
    AsUlong: DWORD;
  end;

  NVME_NVM_SUBSYSTEM_RESET = record
    NSSRC: DWORD;
  end;

  NVME_ADMIN_QUEUE_ATTRIBUTES = record
    Anonymous: _Anonymous_e__Struct;
    AsUlong: DWORD;
  end;

  NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS = record
    Anonymous: _Anonymous_e__Struct;
    AsUlonglong: UInt64;
  end;

  NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS = record
    Anonymous: _Anonymous_e__Struct;
    AsUlonglong: UInt64;
  end;

  NVME_CONTROLLER_MEMORY_BUFFER_LOCATION = record
    Anonymous: _Anonymous_e__Struct;
    AsUlong: DWORD;
  end;

  NVME_CONTROLLER_MEMORY_BUFFER_SIZE = record
    Anonymous: _Anonymous_e__Struct;
    AsUlong: DWORD;
  end;

  NVME_NVM_SUBSYSTEM_SHUTDOWN = record
    NSSC: DWORD;
  end;

  NVME_CONTROLLER_READY_TIMEOUTS = record
    Anonymous: _Anonymous_e__Struct;
    AsUlong: DWORD;
  end;

  NVME_CONTROLLER_REGISTERS = record
    CAP: NVME_CONTROLLER_CAPABILITIES;
    VS: NVME_VERSION;
    INTMS: DWORD;
    INTMC: DWORD;
    CC: NVME_CONTROLLER_CONFIGURATION;
    Reserved0: DWORD;
    CSTS: NVME_CONTROLLER_STATUS;
    NSSR: NVME_NVM_SUBSYSTEM_RESET;
    AQA: NVME_ADMIN_QUEUE_ATTRIBUTES;
    ASQ: NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS;
    ACQ: NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS;
    CMBLOC: NVME_CONTROLLER_MEMORY_BUFFER_LOCATION;
    CMBSZ: NVME_CONTROLLER_MEMORY_BUFFER_SIZE;
    Reserved1: array[0..8] of DWORD;
    NSSD: NVME_NVM_SUBSYSTEM_SHUTDOWN;
    CRTO: NVME_CONTROLLER_READY_TIMEOUTS;
    Reserved2: array[0..932] of DWORD;
    Reserved3: array[0..63] of DWORD;
    Doorbells: array[0..0] of DWORD;
  end;
const NVME_CONTROLLER_CAPABILITIES = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlonglong: u64,
};

const NVME_VERSION = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlong: u32,
};

const NVME_CONTROLLER_CONFIGURATION = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlong: u32,
};

const NVME_CONTROLLER_STATUS = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlong: u32,
};

const NVME_NVM_SUBSYSTEM_RESET = extern struct {
    NSSRC: u32,
};

const NVME_ADMIN_QUEUE_ATTRIBUTES = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlong: u32,
};

const NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlonglong: u64,
};

const NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlonglong: u64,
};

const NVME_CONTROLLER_MEMORY_BUFFER_LOCATION = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlong: u32,
};

const NVME_CONTROLLER_MEMORY_BUFFER_SIZE = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlong: u32,
};

const NVME_NVM_SUBSYSTEM_SHUTDOWN = extern struct {
    NSSC: u32,
};

const NVME_CONTROLLER_READY_TIMEOUTS = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUlong: u32,
};

const NVME_CONTROLLER_REGISTERS = extern struct {
    CAP: NVME_CONTROLLER_CAPABILITIES,
    VS: NVME_VERSION,
    INTMS: u32,
    INTMC: u32,
    CC: NVME_CONTROLLER_CONFIGURATION,
    Reserved0: u32,
    CSTS: NVME_CONTROLLER_STATUS,
    NSSR: NVME_NVM_SUBSYSTEM_RESET,
    AQA: NVME_ADMIN_QUEUE_ATTRIBUTES,
    ASQ: NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS,
    ACQ: NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS,
    CMBLOC: NVME_CONTROLLER_MEMORY_BUFFER_LOCATION,
    CMBSZ: NVME_CONTROLLER_MEMORY_BUFFER_SIZE,
    Reserved1: [9]u32,
    NSSD: NVME_NVM_SUBSYSTEM_SHUTDOWN,
    CRTO: NVME_CONTROLLER_READY_TIMEOUTS,
    Reserved2: [933]u32,
    Reserved3: [64]u32,
    Doorbells: [1]u32,
};
type
  NVME_CONTROLLER_CAPABILITIES {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlonglong: uint64

  NVME_VERSION {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlong: uint32

  NVME_CONTROLLER_CONFIGURATION {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlong: uint32

  NVME_CONTROLLER_STATUS {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlong: uint32

  NVME_NVM_SUBSYSTEM_RESET {.bycopy.} = object
    NSSRC: uint32

  NVME_ADMIN_QUEUE_ATTRIBUTES {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlong: uint32

  NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlonglong: uint64

  NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlonglong: uint64

  NVME_CONTROLLER_MEMORY_BUFFER_LOCATION {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlong: uint32

  NVME_CONTROLLER_MEMORY_BUFFER_SIZE {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlong: uint32

  NVME_NVM_SUBSYSTEM_SHUTDOWN {.bycopy.} = object
    NSSC: uint32

  NVME_CONTROLLER_READY_TIMEOUTS {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUlong: uint32

  NVME_CONTROLLER_REGISTERS {.bycopy.} = object
    CAP: NVME_CONTROLLER_CAPABILITIES
    VS: NVME_VERSION
    INTMS: uint32
    INTMC: uint32
    CC: NVME_CONTROLLER_CONFIGURATION
    Reserved0: uint32
    CSTS: NVME_CONTROLLER_STATUS
    NSSR: NVME_NVM_SUBSYSTEM_RESET
    AQA: NVME_ADMIN_QUEUE_ATTRIBUTES
    ASQ: NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS
    ACQ: NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS
    CMBLOC: NVME_CONTROLLER_MEMORY_BUFFER_LOCATION
    CMBSZ: NVME_CONTROLLER_MEMORY_BUFFER_SIZE
    Reserved1: array[9, uint32]
    NSSD: NVME_NVM_SUBSYSTEM_SHUTDOWN
    CRTO: NVME_CONTROLLER_READY_TIMEOUTS
    Reserved2: array[933, uint32]
    Reserved3: array[64, uint32]
    Doorbells: array[1, uint32]
struct NVME_CONTROLLER_CAPABILITIES
{
    _Anonymous_e__Struct Anonymous;
    ulong AsUlonglong;
}

struct NVME_VERSION
{
    _Anonymous_e__Struct Anonymous;
    uint AsUlong;
}

struct NVME_CONTROLLER_CONFIGURATION
{
    _Anonymous_e__Struct Anonymous;
    uint AsUlong;
}

struct NVME_CONTROLLER_STATUS
{
    _Anonymous_e__Struct Anonymous;
    uint AsUlong;
}

struct NVME_NVM_SUBSYSTEM_RESET
{
    uint NSSRC;
}

struct NVME_ADMIN_QUEUE_ATTRIBUTES
{
    _Anonymous_e__Struct Anonymous;
    uint AsUlong;
}

struct NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS
{
    _Anonymous_e__Struct Anonymous;
    ulong AsUlonglong;
}

struct NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS
{
    _Anonymous_e__Struct Anonymous;
    ulong AsUlonglong;
}

struct NVME_CONTROLLER_MEMORY_BUFFER_LOCATION
{
    _Anonymous_e__Struct Anonymous;
    uint AsUlong;
}

struct NVME_CONTROLLER_MEMORY_BUFFER_SIZE
{
    _Anonymous_e__Struct Anonymous;
    uint AsUlong;
}

struct NVME_NVM_SUBSYSTEM_SHUTDOWN
{
    uint NSSC;
}

struct NVME_CONTROLLER_READY_TIMEOUTS
{
    _Anonymous_e__Struct Anonymous;
    uint AsUlong;
}

struct NVME_CONTROLLER_REGISTERS
{
    NVME_CONTROLLER_CAPABILITIES CAP;
    NVME_VERSION VS;
    uint INTMS;
    uint INTMC;
    NVME_CONTROLLER_CONFIGURATION CC;
    uint Reserved0;
    NVME_CONTROLLER_STATUS CSTS;
    NVME_NVM_SUBSYSTEM_RESET NSSR;
    NVME_ADMIN_QUEUE_ATTRIBUTES AQA;
    NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS ASQ;
    NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS ACQ;
    NVME_CONTROLLER_MEMORY_BUFFER_LOCATION CMBLOC;
    NVME_CONTROLLER_MEMORY_BUFFER_SIZE CMBSZ;
    uint[9] Reserved1;
    NVME_NVM_SUBSYSTEM_SHUTDOWN NSSD;
    NVME_CONTROLLER_READY_TIMEOUTS CRTO;
    uint[933] Reserved2;
    uint[64] Reserved3;
    uint[1] Doorbells;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_CONTROLLER_REGISTERS サイズ: 4104 バイト(x64)
dim st, 1026    ; 4byte整数×1026(構造体サイズ 4104 / 4 切り上げ)
; CAP : NVME_CONTROLLER_CAPABILITIES (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; VS : NVME_VERSION (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; INTMS : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; INTMC : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; CC : NVME_CONTROLLER_CONFIGURATION (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; Reserved0 : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; CSTS : NVME_CONTROLLER_STATUS (+28, 4byte)  varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; NSSR : NVME_NVM_SUBSYSTEM_RESET (+32, 4byte)  varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; AQA : NVME_ADMIN_QUEUE_ATTRIBUTES (+36, 4byte)  varptr(st)+36 を基点に操作(4byte:入れ子/配列)
; ASQ : NVME_ADMIN_SUBMISSION_QUEUE_BASE_ADDRESS (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; ACQ : NVME_ADMIN_COMPLETION_QUEUE_BASE_ADDRESS (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; CMBLOC : NVME_CONTROLLER_MEMORY_BUFFER_LOCATION (+56, 4byte)  varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; CMBSZ : NVME_CONTROLLER_MEMORY_BUFFER_SIZE (+60, 4byte)  varptr(st)+60 を基点に操作(4byte:入れ子/配列)
; Reserved1 : DWORD (+64, 36byte)  varptr(st)+64 を基点に操作(36byte:入れ子/配列)
; NSSD : NVME_NVM_SUBSYSTEM_SHUTDOWN (+100, 4byte)  varptr(st)+100 を基点に操作(4byte:入れ子/配列)
; CRTO : NVME_CONTROLLER_READY_TIMEOUTS (+104, 4byte)  varptr(st)+104 を基点に操作(4byte:入れ子/配列)
; Reserved2 : DWORD (+108, 3732byte)  varptr(st)+108 を基点に操作(3732byte:入れ子/配列)
; Reserved3 : DWORD (+3840, 256byte)  varptr(st)+3840 を基点に操作(256byte:入れ子/配列)
; Doorbells : DWORD (+4096, 4byte)  varptr(st)+4096 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NVME_NVM_SUBSYSTEM_RESET
    #field int NSSRC
#endstruct

#defstruct global NVME_NVM_SUBSYSTEM_SHUTDOWN
    #field int NSSC
#endstruct

#defstruct global NVME_CONTROLLER_REGISTERS
    #field byte CAP 8
    #field byte VS 4
    #field int INTMS
    #field int INTMC
    #field byte CC 4
    #field int Reserved0
    #field byte CSTS 4
    #field NVME_NVM_SUBSYSTEM_RESET NSSR
    #field byte AQA 4
    #field byte ASQ 8
    #field byte ACQ 8
    #field byte CMBLOC 4
    #field byte CMBSZ 4
    #field int Reserved1 9
    #field NVME_NVM_SUBSYSTEM_SHUTDOWN NSSD
    #field byte CRTO 4
    #field int Reserved2 933
    #field int Reserved3 64
    #field int Doorbells 1
#endstruct

stdim st, NVME_CONTROLLER_REGISTERS        ; NSTRUCT 変数を確保
st->INTMS = 100
mes "INTMS=" + st->INTMS
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。