Beispiel #1
0
if (written_address != reg_address):
    print 'ERROR in Register Write. Returned wrong address.'

print("Testing reg_read")
print 'Reading back register 0x%X...' % reg_address
reg_value_read = client.reg_read(reg_address, dummy)
print 'Value at register 0x%X: 0x%X' % (reg_address, reg_value_read)
if (reg_value_read != reg_value):
    print 'ERROR in Register Read. Returned wrong value.'

print("** Tested Reg read and write. **\n")

print("Testing reg write block")
print 'Writing block of %d values to register location 0x%X...' % (
    num_reg_writes, reg_address)
last_location = client.reg_write_block(reg_address, num_reg_writes, reg_values,
                                       dummy)
print 'Last location written into: 0x%X' % last_location
if (last_location != (reg_address + (num_reg_writes - 1) * 4)):
    print 'ERROR in Reg Write Block. Returned wrong last location'

print '** Tested reg_write_block. **\n'

print("Testing reg read block")
values = client.reg_read_block(reg_address, num_reg_writes, dummy)
print 'Reading out block of %d values from register location 0x%X... ' % (
    num_reg_writes, reg_address)
print 'Values read out:'
print values
print '** Tested reg_read_block. **\n'

print("Testing mem write")
    print 'Reading back memory location 0x%X...' % mem_address
mem_value_read = client.mem_read(mem_address, dummy)
if (verbose == True):
    print 'Value at memory location 0x%X : 0x%X' % (mem_address,
                                                    mem_value_read)
if (mem_value_read != mem_value):
    print 'ERROR in Memroy Read. Returned wrong value.'
    error = error + 1

print '** Tested Mem read and write. **\n'

# Testing reg write block
if (verbose == True):
    print 'Writing block of %d values to register location 0x%X...' % (
        number_of_writes, starting_address)
last_location = client.reg_write_block(starting_address, number_of_writes,
                                       reg_values, dummy)
if (verbose == True): print 'Last location written into: 0x%X' % last_location
if (last_location != (starting_address + (number_of_writes - 1) * 4)):
    print 'ERROR in Reg Write Block. Returned wrong last location'
    error = error + 1
print '** Tested reg_write_block. **\n'

# Testing reg read block
values = client.reg_read_block(starting_address, number_of_reads, dummy)
if (verbose):
    print 'Reading out block of %d values from register location 0x%X... ' % (
        number_of_reads, starting_address)
    print 'Values read out:'
    print values
print '** Tested reg_read_block. **\n'