Win32 API 日本語リファレンス
ホームDevices.Usb › USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR

USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR

構造体
サイズx64: 8 バイト / x86: 8 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
bLengthBYTE1+0+0このディスクリプタのサイズをバイト単位で示す。
bDescriptorTypeBYTE1+1+1ディスクリプタ種別。SSPアイソクロナスコンパニオンを示す。
wReservedWORD2+2+2予約フィールド。0でなければならない。
dwBytesPerIntervalDWORD4+4+4サービス間隔ごとに転送する総バイト数を示す。

各言語での定義

#include <windows.h>

// USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR  (x64 8 / x86 8 バイト)
#pragma pack(push, 1)
typedef struct USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR {
    BYTE bLength;
    BYTE bDescriptorType;
    WORD wReserved;
    DWORD dwBytesPerInterval;
} USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR
{
    public byte bLength;
    public byte bDescriptorType;
    public ushort wReserved;
    public uint dwBytesPerInterval;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR
    Public bLength As Byte
    Public bDescriptorType As Byte
    Public wReserved As UShort
    Public dwBytesPerInterval As UInteger
End Structure
import ctypes
from ctypes import wintypes

class USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("bLength", ctypes.c_ubyte),
        ("bDescriptorType", ctypes.c_ubyte),
        ("wReserved", ctypes.c_ushort),
        ("dwBytesPerInterval", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR {
    pub bLength: u8,
    pub bDescriptorType: u8,
    pub wReserved: u16,
    pub dwBytesPerInterval: u32,
}
import "golang.org/x/sys/windows"

type USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR struct {
	bLength byte
	bDescriptorType byte
	wReserved uint16
	dwBytesPerInterval uint32
}
type
  USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR = packed record
    bLength: Byte;
    bDescriptorType: Byte;
    wReserved: Word;
    dwBytesPerInterval: DWORD;
  end;
const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR = extern struct {
    bLength: u8,
    bDescriptorType: u8,
    wReserved: u16,
    dwBytesPerInterval: u32,
};
type
  USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR {.packed.} = object
    bLength: uint8
    bDescriptorType: uint8
    wReserved: uint16
    dwBytesPerInterval: uint32
align(1)
struct USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR
{
    ubyte bLength;
    ubyte bDescriptorType;
    ushort wReserved;
    uint dwBytesPerInterval;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR サイズ: 8 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; bLength : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; bDescriptorType : BYTE (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; wReserved : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; dwBytesPerInterval : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR, pack=1
    #field byte bLength
    #field byte bDescriptorType
    #field short wReserved
    #field int dwBytesPerInterval
#endstruct

stdim st, USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR        ; NSTRUCT 変数を確保
st->bLength = 100
mes "bLength=" + st->bLength