示例#1
0
def parse_rom_element(rom, addr = 0, debug = False):
    entity = sdbc()
    possible_magic = rom[addr + 0] << 24 | \
                     rom[addr + 1] << 16 | \
                     rom[addr + 2] <<  8 | \
                     rom[addr + 3] <<  0

    if (possible_magic == SDB_INTERCONNECT_MAGIC):
        #if debug: print "Found Interconnect!"
        _parse_rom_interconnect_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_INTERCONNECT
    elif rom[addr + 63] == SDB_RECORD_TYPE_DEVICE:
        _parse_rom_device_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_DEVICE
    elif rom[addr + 63] == SDB_RECORD_TYPE_BRIDGE:
        _parse_rom_bridge_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_BRIDGE
    elif rom[addr + 63] == SDB_RECORD_TYPE_INTEGRATION:
        _parse_integration_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_INTEGRATION
    elif rom[addr + 63] == SDB_RECORD_TYPE_REPO_URL:
        _parse_repo_url_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_REPO_URL
    elif rom[addr + 63] == SDB_RECORD_TYPE_SYNTHESIS:
        _parse_synthesis_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_SYNTHESIS
    elif rom[addr + 63] == SDB_RECORD_TYPE_EMPTY:
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_EMPTY
    else:
        data = " ".join(["0x%02X" % i for i in rom])
        raise SDBError("Info: Unrecognized Record @ addr 0x%04X (record: 0x%02X)\nFull element: %s" % (addr, rom[addr + 63], data))
    return entity
示例#2
0
def parse_rom_element(rom, addr=0, debug=False):
    entity = sdbc()
    possible_magic = rom[addr + 0] << 24 | \
                     rom[addr + 1] << 16 | \
                     rom[addr + 2] <<  8 | \
                     rom[addr + 3] <<  0

    if (possible_magic == SDB_INTERCONNECT_MAGIC):
        #if debug: print "Found Interconnect!"
        _parse_rom_interconnect_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_INTERCONNECT
    elif rom[addr + 63] == SDB_RECORD_TYPE_DEVICE:
        _parse_rom_device_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_DEVICE
    elif rom[addr + 63] == SDB_RECORD_TYPE_BRIDGE:
        _parse_rom_bridge_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_BRIDGE
    elif rom[addr + 63] == SDB_RECORD_TYPE_INTEGRATION:
        _parse_integration_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_INTEGRATION
    elif rom[addr + 63] == SDB_RECORD_TYPE_REPO_URL:
        _parse_repo_url_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_REPO_URL
    elif rom[addr + 63] == SDB_RECORD_TYPE_SYNTHESIS:
        _parse_synthesis_element(entity, rom, addr, debug)
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_SYNTHESIS
    elif rom[addr + 63] == SDB_RECORD_TYPE_EMPTY:
        entity.d["SDB_RECORD_TYPE"] = SDB_RECORD_TYPE_EMPTY
    else:
        data = " ".join(["0x%02X" % i for i in rom])
        raise SDBError(
            "Info: Unrecognized Record @ addr 0x%04X (record: 0x%02X)\nFull element: %s"
            % (addr, rom[addr + 63], data))
    return entity
示例#3
0
 def __init__(self, parent):
     self.spacing = 0
     self.children = []
     super(SOMBus, self).__init__(parent, sdbc())
     self.c = sdb_component.create_interconnect_record( name = "bus",
                                               vendor_id = 0x800000000000C594,
                                               device_id = 0x00000001,
                                               start_address = 0x00,
                                               size = 0x00)
     self.curr_pos = 0
示例#4
0
 def __init__(self, parent):
     self.spacing = 0
     self.children = []
     super(SOMBus, self).__init__(parent, sdbc())
     self.c = sdb_component.create_interconnect_record(
         name="bus",
         vendor_id=0x800000000000C594,
         device_id=0x00000001,
         start_address=0x00,
         size=0x00)
     self.curr_pos = 0