예제 #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
        ("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) ) )