コード例 #1
0
def set_mac(obj, mac):
    sc = get_component(obj).o.sc
    mac = mac_as_list(mac)
    idprom = sc.idprom
    for i in range(6):
        idprom[i] = mac[i]
    sc.idprom = idprom
コード例 #2
0
def set_mac(obj, mac):
    sc = get_component(obj).o.sc
    mac = mac_as_list(mac)
    idprom = sc.idprom
    for i in range(6):
        idprom[i] = mac[i]
    sc.idprom = idprom
コード例 #3
0
def write_idprom_to_nvram(obj, hostid, mac):
    phys_mem = get_component(obj).master_cpu.physical_memory
    addr = 0x1fff8909fd8
    # offset 0 = format (1)
    write_memory(phys_mem, addr + 0, 1, 1)
    if hostid:
        # offset 1, 12-14 = hostid
        write_memory(phys_mem, addr + 1, hostid >> 24, 1)
        write_memory(phys_mem, addr + 12, hostid >> 16, 1)
        write_memory(phys_mem, addr + 13, hostid >> 8, 1)
        write_memory(phys_mem, addr + 14, hostid >> 0, 1)
    if mac:
        # offset 2 - 7 = ethernet
        mac = mac_as_list(mac)
        for i in range(len(mac)):
            write_memory(phys_mem, addr + 2 + i, mac[i], 1)
    # offset 8 - 11 = date (not used)
    # offset 15 = checksum
    chk = 0
    for i in range(15):
        chk ^= read_memory(phys_mem, addr + i)
    write_memory(phys_mem, addr + 15, chk, 1)
コード例 #4
0
def write_idprom_to_nvram(obj, hostid, mac):
    phys_mem = get_component(obj).master_cpu.physical_memory
    addr = 0x1FFF8909FD8
    # offset 0 = format (1)
    write_memory(phys_mem, addr + 0, 1, 1)
    if hostid:
        # offset 1, 12-14 = hostid
        write_memory(phys_mem, addr + 1, hostid >> 24, 1)
        write_memory(phys_mem, addr + 12, hostid >> 16, 1)
        write_memory(phys_mem, addr + 13, hostid >> 8, 1)
        write_memory(phys_mem, addr + 14, hostid >> 0, 1)
    if mac:
        # offset 2 - 7 = ethernet
        mac = mac_as_list(mac)
        for i in range(len(mac)):
            write_memory(phys_mem, addr + 2 + i, mac[i], 1)
    # offset 8 - 11 = date (not used)
    # offset 15 = checksum
    chk = 0
    for i in range(15):
        chk ^= read_memory(phys_mem, addr + i)
    write_memory(phys_mem, addr + 15, chk, 1)
コード例 #5
0
def write_idprom_to_nvram(obj, hostid, mac):
    nvram = get_component(obj).o.nvram_image
    base = 0x1fe0
    # offset 0 = format (1)
    nvram.byte_access[base + 0] = 1
    if hostid:
        # offset 1, 12-14 = hostid 
        nvram.byte_access[base +  1] = (hostid >> 24) & 0xff
        nvram.byte_access[base + 12] = (hostid >> 16) & 0xff
        nvram.byte_access[base + 13] = (hostid >>  8) & 0xff
        nvram.byte_access[base + 14] = (hostid >>  0) & 0xff
    if mac:
        # offset 2 - 7 = ethernet
        mac = mac_as_list(mac)
        for i in range(len(mac)):
            nvram.byte_access[base + 2 + i] = mac[i]
    # offset 8 - 11 = date (not used?)
    # offset 15 = checksum
    chk = 0
    for i in range(15):
        chk ^= nvram.byte_access[base + i]
    nvram.byte_access[base + 15] = chk & 0xff
コード例 #6
0
def write_idprom_to_nvram(obj, hostid, mac):
    nvram = get_component(obj).o.nvram_image
    base = 0x1fe0
    # offset 0 = format (1)
    nvram.byte_access[base + 0] = 1
    if hostid:
        # offset 1, 12-14 = hostid
        nvram.byte_access[base + 1] = (hostid >> 24) & 0xff
        nvram.byte_access[base + 12] = (hostid >> 16) & 0xff
        nvram.byte_access[base + 13] = (hostid >> 8) & 0xff
        nvram.byte_access[base + 14] = (hostid >> 0) & 0xff
    if mac:
        # offset 2 - 7 = ethernet
        mac = mac_as_list(mac)
        for i in range(len(mac)):
            nvram.byte_access[base + 2 + i] = mac[i]
    # offset 8 - 11 = date (not used?)
    # offset 15 = checksum
    chk = 0
    for i in range(15):
        chk ^= nvram.byte_access[base + i]
    nvram.byte_access[base + 15] = chk & 0xff