ホーム › Devices.Usb › USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR
USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| bLength | BYTE | 1 | +0 | +0 | このディスクリプタのサイズをバイト単位で示す。 |
| bDescriptorType | BYTE | 1 | +1 | +1 | ディスクリプタ種別。SSエンドポイントコンパニオンは0x30。 |
| bMaxBurst | BYTE | 1 | +2 | +2 | バーストあたりの最大パケット数から1を引いた値を示す。 |
| bmAttributes | _bmAttributes_e__Union | 8/4 | +3 | +3 | 転送タイプ依存の属性(ストリーム数/最大バースト数)を保持する無名共用体。 |
| wBytesPerInterval | WORD | 2 | +11 | +7 | サービス間隔ごとに転送する総バイト数を示す。 |
共用体: _bmAttributes_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| AsUchar | BYTE | 1 | +0 | +0 |
| Bulk | _Bulk_e__Struct | 8/4 | +0 | +0 |
| Isochronous | _Isochronous_e__Struct | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR (x64 13 / x86 9 バイト)
#pragma pack(push, 1)
typedef struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR {
BYTE bLength;
BYTE bDescriptorType;
BYTE bMaxBurst;
_bmAttributes_e__Union bmAttributes;
WORD wBytesPerInterval;
} USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR
{
public byte bLength;
public byte bDescriptorType;
public byte bMaxBurst;
public _bmAttributes_e__Union bmAttributes;
public ushort wBytesPerInterval;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR
Public bLength As Byte
Public bDescriptorType As Byte
Public bMaxBurst As Byte
Public bmAttributes As _bmAttributes_e__Union
Public wBytesPerInterval As UShort
End Structureimport ctypes
from ctypes import wintypes
class USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR(ctypes.Structure):
_pack_ = 1
_fields_ = [
("bLength", ctypes.c_ubyte),
("bDescriptorType", ctypes.c_ubyte),
("bMaxBurst", ctypes.c_ubyte),
("bmAttributes", _bmAttributes_e__Union),
("wBytesPerInterval", ctypes.c_ushort),
]#[repr(C, packed(1))]
pub struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR {
pub bLength: u8,
pub bDescriptorType: u8,
pub bMaxBurst: u8,
pub bmAttributes: _bmAttributes_e__Union,
pub wBytesPerInterval: u16,
}import "golang.org/x/sys/windows"
type USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR struct {
bLength byte
bDescriptorType byte
bMaxBurst byte
bmAttributes _bmAttributes_e__Union
wBytesPerInterval uint16
}type
USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR = packed record
bLength: Byte;
bDescriptorType: Byte;
bMaxBurst: Byte;
bmAttributes: _bmAttributes_e__Union;
wBytesPerInterval: Word;
end;const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR = extern struct {
bLength: u8,
bDescriptorType: u8,
bMaxBurst: u8,
bmAttributes: _bmAttributes_e__Union,
wBytesPerInterval: u16,
};type
USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR {.packed.} = object
bLength: uint8
bDescriptorType: uint8
bMaxBurst: uint8
bmAttributes: _bmAttributes_e__Union
wBytesPerInterval: uint16align(1)
struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR
{
ubyte bLength;
ubyte bDescriptorType;
ubyte bMaxBurst;
_bmAttributes_e__Union bmAttributes;
ushort wBytesPerInterval;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR サイズ: 9 バイト(x86)
dim st, 3 ; 4byte整数×3(構造体サイズ 9 / 4 切り上げ)
; bLength : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; bDescriptorType : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; bMaxBurst : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; bmAttributes : _bmAttributes_e__Union (+3, 4byte) varptr(st)+3 を基点に操作(4byte:入れ子/配列)
; wBytesPerInterval : WORD (+7, 2byte) wpoke st,7,値 / 値 = wpeek(st,7)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR サイズ: 13 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 13 / 4 切り上げ)
; bLength : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; bDescriptorType : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; bMaxBurst : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; bmAttributes : _bmAttributes_e__Union (+3, 8byte) varptr(st)+3 を基点に操作(8byte:入れ子/配列)
; wBytesPerInterval : WORD (+11, 2byte) wpoke st,11,値 / 値 = wpeek(st,11)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR, pack=1
#field byte bLength
#field byte bDescriptorType
#field byte bMaxBurst
#field byte bmAttributes 8
#field short wBytesPerInterval
#endstruct
stdim st, USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR ; NSTRUCT 変数を確保
st->bLength = 100
mes "bLength=" + st->bLength
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。