コード例 #1
0
    def _add_submodule(self, name, Module, offset):
        module = None

        path = self.path / name
        if path.exists():
            uio = Uio(path, parent=self)
            assert uio.region().address == self.region().address + offset

            module = uio.map(Module)
            module._uio = uio

            module.irq.uio = uio

        setattr(self, name, module)

        if module is None:
            # fallback, mainly for debugging:
            module = self.map(Module, offset)

        setattr(self, '_' + name, module)
コード例 #2
0
ファイル: l3-sn-test.py プロジェクト: silver2row/py-uio
        ("pending", src_t),  #r-
    ]


class FaultCombiner(ctypes.Structure):
    _anonymous_ = ["app"]
    _fields_ = [
        ("component", ComponentID),  # vendor 1 type 0x37
        ("app", FlagOutput),
        ("debug", FlagOutput),
    ]


# L3 target agents are capable of logging faults and optionally asserting an
# irq.  Faults resulting from debug (JTAG) requests are separated from those
# resulting from non-debug (aka "application") requests.  Each target agent
# therefore has two fault irq outputs, and the faultcombiners retain this
# separation.  The device tree snippet arranges for the "app fault" output of
# the top-level faultcombiner to be deliverable as irq to userspace.
#
fc_top = l3_sn.region("l3f").map(FaultCombiner, 0x1100)
fc_l3f = l3_sn.region("l3f").map(FaultCombiner, 0x1000)
fc_l3s = l3_sn.region("l3s").map(FaultCombiner, 0x600)

for i in fc_top, fc_l3s, fc_l3f:
    assert i.component.vendor == 1
    assert i.component.type == 0x37
    i.enabled = 0xffffffff  # enable all inputs
    n = i.enabled.bit_length()  # check how many we actually got
    print('inputs: ' + format(i.pending, '0{0}b'.format(n)))
コード例 #3
0
ファイル: l3-sn-test.py プロジェクト: mvduin/py-uio
            ("enabled", src_t),  #rw
            ("pending", src_t),  #r-
        ]

class FaultCombiner( ctypes.Structure ):
    _anonymous_ = ["app"]
    _fields_ = [
            ("component", ComponentID), # vendor 1 type 0x37
            ("app",     FlagOutput),
            ("debug",   FlagOutput),
        ]


# L3 target agents are capable of logging faults and optionally asserting an
# irq.  Faults resulting from debug (JTAG) requests are separated from those
# resulting from non-debug (aka "application") requests.  Each target agent
# therefore has two fault irq outputs, and the faultcombiners retain this
# separation.  The device tree snippet arranges for the "app fault" output of
# the top-level faultcombiner to be deliverable as irq to userspace.
#
fc_top = l3_sn.region( "l3f" ).map( FaultCombiner, 0x1100 )
fc_l3f = l3_sn.region( "l3f" ).map( FaultCombiner, 0x1000 )
fc_l3s = l3_sn.region( "l3s" ).map( FaultCombiner,  0x600 )

for i in fc_top, fc_l3s, fc_l3f:
    assert i.component.vendor == 1
    assert i.component.type == 0x37
    i.enabled = 0xffffffff      # enable all inputs
    n = i.enabled.bit_length()  # check how many we actually got
    print( 'inputs: ' + format( i.pending, '0{0}b'.format(n) ) )