from ctypes import Structure, c_uint8, c_uint16, c_uint32, c_uint64


class BulkHeader(Structure):
    class Attributes(Structure):
        _fields_ = [
            ('LINK_BW', c_uint8),
            ('LANE_COUNT', c_uint8, 4),
            ('Packing1', c_uint8, 1),
            ('Packing', c_uint8, 2),
            ('MST', c_uint8, 1),
            ('n_val', c_uint16),
            ]

    _fields_ = [
        ('Sync', c_uint32),
        ('Tns', c_uint32),
        ('SourcId', c_uint32),
        ('Length', c_uint32),
        ('TimeStamp', c_uint64),
        ('Sync', c_uint32),
        ('Attribute', Attributes)
    ]


class CaptureCaps(Structure):
    _fields_ = [
        ('triggers', c_uint32, 1),
        ('multipleTriggersSelection', c_uint32, 1),
        ('multipleTriggersAndingSelection', c_uint32, 1),
        ('alpmTriggers', c_uint32, 1),
        ('', c_uint32, 4),
        ('grab128_132', c_uint32, 1),
        ('', c_uint32, 3),
        ("bitGrabWidth", c_uint32, 4),
        ("", c_uint32, 16)
    ]


class SBlock(Structure):
    _fields_ = [
        ('BLOCK', c_uint32),
        ('OFFSET', c_uint64),
        ('SIZE', c_uint64),
    ]
