예제 #1
0
def setup_module(module):
    # Prepare reference DCD object
    global ref_dcd_obj

    ref_dcd_obj = img.SegDCD(enabled=True)
    ref_dcd_obj.append(
        img.CmdWriteData(ops=img.EnumWriteOps.WRITE_VALUE,
                         data=((0x30340004, 0x4F400005), )))
    ref_dcd_obj.append(
        img.CmdWriteData(ops=img.EnumWriteOps.CLEAR_BITMASK,
                         data=((0x307900C4, 0x00000001), )))
    ref_dcd_obj.append(
        img.CmdWriteData(ops=img.EnumWriteOps.SET_BITMASK,
                         data=((0x307900C4, 0x00000001), )))
    ref_dcd_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ALL_CLEAR,
                         address=0x307900C4,
                         mask=0x00000001))
    ref_dcd_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ALL_CLEAR,
                         address=0x307900C4,
                         mask=0x00000001,
                         count=5))
    ref_dcd_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ANY_CLEAR,
                         address=0x307900C4,
                         mask=0x00000001))
    ref_dcd_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ANY_CLEAR,
                         address=0x307900C4,
                         mask=0x00000001,
                         count=5))
    ref_dcd_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ALL_SET,
                         address=0x307900C4,
                         mask=0x00000001))
    ref_dcd_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ALL_SET,
                         address=0x307900C4,
                         mask=0x00000001,
                         count=5))
    ref_dcd_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ANY_SET,
                         address=0x307900C4,
                         mask=0x00000001))
    ref_dcd_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ANY_SET,
                         address=0x307900C4,
                         mask=0x00000001,
                         count=5))
    ref_dcd_obj.append(img.CmdNop())
예제 #2
0
def test_write_value_cmd():
    cmd = img.CmdWriteData(data=((0, 1), ))
    assert cmd.bytes == 4
    assert cmd.ops == img.EnumWriteOps.WRITE_VALUE
    assert len(cmd) == 1
    assert cmd[0] == [0, 1]

    data = cmd.export()
    assert len(data) == 12
    assert cmd == img.CmdWriteData.parse(data)
예제 #3
0
def test_set_bit_mask_cmd():
    cmd = img.CmdWriteData(ops=img.EnumWriteOps.SET_BITMASK)
    cmd.append(0, 1)
    assert cmd.bytes == 4
    assert cmd.ops == img.EnumWriteOps.SET_BITMASK
    assert len(cmd) == 1
    assert cmd[0] == [0, 1]

    data = cmd.export()
    assert len(data) == 12
    assert cmd == img.CmdWriteData.parse(data)
예제 #4
0
def test_clear_bit_mask_cmd():
    cmd = img.CmdWriteData(ops=img.EnumWriteOps.CLEAR_BITMASK)
    cmd.append(0, 1)
    cmd.append(1, 1)
    assert cmd.bytes == 4
    assert cmd.ops == img.EnumWriteOps.CLEAR_BITMASK
    assert len(cmd) == 2
    assert cmd[1] == [1, 1]

    data = cmd.export()
    assert len(data) == 20
    assert cmd == img.CmdWriteData.parse(data)
예제 #5
0
def setup_module(module):
    # Prepare reference CSF object
    global ref_csf_obj

    ref_csf_obj = img.SegCSF(enabled=True)
    ref_csf_obj.append(
        img.CmdWriteData(ops=img.EnumWriteOps.WRITE_VALUE,
                         data=((0x30340004, 0x4F400005), )))
    ref_csf_obj.append(
        img.CmdCheckData(ops=img.EnumCheckOps.ALL_CLEAR,
                         address=0x307900C4,
                         mask=0x00000001,
                         count=10))