Commit b198f8bd authored by David Cussans's avatar David Cussans

Deleting more SVN dirs

parent 3712a10a
K 25
svn:wc:ra_dav:version-url
V 39
/svn/!svn/ver/934/trunk/PyChips/scripts
END
example1.py
K 25
svn:wc:ra_dav:version-url
V 51
/svn/!svn/ver/499/trunk/PyChips/scripts/example1.py
END
soakTest.py
K 25
svn:wc:ra_dav:version-url
V 51
/svn/!svn/ver/934/trunk/PyChips/scripts/soakTest.py
END
bandwidthRxTest.py
K 25
svn:wc:ra_dav:version-url
V 58
/svn/!svn/ver/499/trunk/PyChips/scripts/bandwidthRxTest.py
END
configureJumboMac.py
K 25
svn:wc:ra_dav:version-url
V 60
/svn/!svn/ver/863/trunk/PyChips/scripts/configureJumboMac.py
END
10
dir
1570
https://cactus.hepforge.org/svn/trunk/PyChips/scripts
https://cactus.hepforge.org/svn
2011-12-22T16:42:29.517135Z
934
frazier
18a17b70-165d-4f71-a96d-00e1b61b3a60
example1.py
file
2013-07-29T17:57:10.000000Z
90ebe4b8a9f33d5d7e11431d91cdf4f1
2011-06-21T22:29:49.331383Z
499
frazier
has-props
1878
soakTest.py
file
2013-07-29T17:57:10.000000Z
10931df3fa75c627980d8aed235af372
2011-12-22T16:42:29.517135Z
934
frazier
has-props
6865
bandwidthRxTest.py
file
2013-07-29T17:57:10.000000Z
2155affb31538e0fffd2ca21850e2da9
2011-06-21T22:29:49.331383Z
499
frazier
has-props
1542
configureJumboMac.py
file
2013-07-29T17:57:10.000000Z
e4476a2f4ee79e1e131e74da9e4ed9d8
2011-11-01T16:40:33.255597Z
863
frazier
has-props
1223
from PyChipsUser import *
from datetime import datetime
from os import environ
import math
#chipsLog.setLevel(logging.DEBUG)
#######################
### TEST PARAMETERS ###
hostIP = "localhost"
hostPort = 50001
hostRamName = "BigTestRam"
testDepth = 350
testIterations = 10000
#######################
addrTable = AddressTable("../addressTables/davesFirmwareSoakTestAddrTable.txt")
testBoard = ChipsBusUdp(addrTable, hostIP, hostPort)
# Fill up the host's RAM with something, just so we can see its working correctly
# when in debug mode
writeBuf = []
for iVal in range(testDepth):
writeBuf.append(iVal)
testBoard.blockWrite(hostRamName, writeBuf)
print "Read-bandwidth test is running..."
# Start the clock
startTime = datetime.now()
# Run the test
for iRead in range(testIterations):
testBoard.blockRead(hostRamName, testDepth)
# Stop the clock
stopTime = datetime.now()
# Calculate the total IPbus payload actually transferred in kilobytes, excluding all headers, etc
totalPayloadKB = testIterations * testDepth / 256.
# Calculate the total transfer time in seconds
totalTime = stopTime-startTime
totalSeconds = (totalTime.days*86400) + totalTime.seconds + (totalTime.microseconds/1000000.)
dataRateKB_s = totalPayloadKB/totalSeconds
print "\nRead Bandwidth Results:"
print "-----------------------\n"
print "Total IPbus payload transferred = %.2f KB" % totalPayloadKB
print "Total time taken = %.2f s" % totalSeconds
print "Average read bandwidth = %.2f KB/s" % dataRateKB_s
# Configures the Ethernet MAC to use jumbo frames, when using Dave Newbold's default firmware.
#
# Robert Frazier, Oct 2011
from PyChipsUser import *
#chipsLog.setLevel(logging.DEBUG) # Uncomment for debug output!
# ******************************************************
# **** Set IP and port number of board in question ****
boardIpAddr = "192.168.200.32" # TODO: make this a command line parameter...
boardPortNum = 50001
# ******************************************************
if __name__ == '__main__':
addrTable = AddressTable("../addressTables/davesFirmwareSoakTestAddrTable.txt")
board = ChipsBusUdp(addrTable, boardIpAddr, boardPortNum)
board.write("MacHostBusPtr", 0x240)
result = board.read("MacHostBusReg")
print "Receiver register is set to:", hex(result)
print "Writing back previous value with bit 30 set high..."
board.write("MacHostBusReg", (result | 0x40000000))
print "...done."
board.write("MacHostBusPtr", 0x280)
result = board.read("MacHostBusReg")
print "Transmitter register is set to:", hex(result)
print "Writing back previous value with bit 30 set high..."
board.write("MacHostBusReg", (result | 0x40000000))
print "...done."
# Import the PyChips code - PYTHONPATH must be set to the PyChips installation src folder!
from PyChipsUser import *
##################################################################################################
### Uncomment one of the following two lines to turn on verbose or very-verbose debug modes. ###
### These debug modes allow you to see the packets being sent and received. ###
##################################################################################################
#chipsLog.setLevel(logging.DEBUG) # Verbose logging (see packets being sent and received)
# Read in an address table by creating an AddressTable object (Note the forward slashes, not backslashes!)
addrTable = AddressTable("../addressTables/davesFirmwareSoakTestAddrTable.txt")
# Create a ChipsBus bus to talk to your board.
# These require an address table object, an IP address and a port number
myBoard = ChipsBusUdp(addrTable, "localhost", 50001) # Change "localhost" to an IP address like "192.168.10.1", etc
# Perform some basic single-register reads and writes.
# Note that single-register reads and writes can be done on registers with a mask.
# See: help(ChipsBusUdp.read) and help(ChipsBusUdp.write) for more info on the below.
myBoard.write("Test", 0xdeadbeef)
print "'Test' register value is:", hex(myBoard.read("Test"))
myBoard.write("Test", 0xcafebabe)
print "'Test' register value is now:", hex(myBoard.read("Test"))
# Perform some block reads/writes:
# See: help(ChipsBusUdp.blockWrite) and help(ChipsBusUdp.blockRead) for more info
myBoard.blockWrite("BigTestRam", [0xdeadbeef, 0xcafebabe, 0x0ddba115, 0xbeefcafe])
blockReadResult = myBoard.blockRead("BigTestRam", 4) # 4 is the read depth.
print "\nBlock read result is:", uInt32HexListStr(blockReadResult)
# For further details on the basic API, please see: help(ChipsBusUdp)
#! /usr/bin/env python
#--------------------------------------------------------------
# Soak-tester for Dave Newbold's default/example IPbus firmware
#
# Robert Frazier, March 2011
#--------------------------------------------------------------
# Python imports
import sys
from optparse import OptionParser
from random import random
from time import asctime
import os
def getRandU32Value():
"""Returns a random unsigned 32-bit value"""
return int(random()*0xffffffff)
def getRandU32List(listSize):
"""Returns a list of length listSize of random U32 values"""
result = []
for i in range(listSize):
result.append(getRandU32Value())
return result
def screenAndLog(logFile, msg):
"""Prints a message to both the screen and to a logFile handle"""
print msg
logFile.write(msg + "\n")
logFile.flush()
os.fsync(logFile)
def findAddrTable():
"""A hacky function that attempts to find and return the soakTestAddrTable.txt file-path.
Returns False if it can't find it.
"""
for item in sys.path:
if item.find("PyChips") >= 0 or item.find("pychips") >= 0:
if item.find("src") >= 0:
file = item + "/../addressTables/soakTestAddrTable.txt"
if os.path.exists(file) and os.path.isfile(file):
return file
return False
if __name__ == '__main__':
# Option parser stuff
parser = OptionParser(usage = "%prog target_ip_address [options]\n\n"
"IPbus Soak Tester\n"
"-----------------")
parser.add_option("-i", "--iterations", action="store", type="int", dest="maxIterations", default=10000,
help="Number of test iterations (default = %default) to perform; zero or less indicates the test should run ~indefinitely.")
parser.add_option("-p", "--port", action="store", type="int", dest="port", default=50001,
help="Port number of the target device you wish to soak-test (default = %default)")
parser.add_option("-f", "--addrTableFile", action="store", type="string", dest="addrTableFile",
help="Manually specify the complete filepath to soakTestAddrTable.txt if it can't automatically be found")
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
help="turn on verbose mode: prints outgoing/incoming packets to the console")
(options, args) = parser.parse_args()
# Find out if they have or haven't supplied an IP address
if len(args) != 1:
parser.error("\nYou must supply a target IP address when running this script!\n" \
"For example:\n\t./soakTest.py 192.168.200.16\n\t./soakTest.py localhost\n" \
"For more help and options, do:\n\t./soakTest.py -h")
ipAddr = args[0]
# Open up a log file.
logName = '/tmp/soakTestLog_' + ipAddr + '.txt'
log = open(logName, 'w')
screenAndLog(log, "\nSoak-Test Session Started at " + asctime() + \
"\n-----------------------------------------------------\n")
# Either get the address table filename from the command line option,
# or try to automatically find it
if options.addrTableFile != None:
addrTableFile = options.addrTableFile
else:
addrTableFile = findAddrTable()
if addrTableFile:
screenAndLog(log, "Using the following automatically located address-table file:\n" + addrTableFile + "\n")
else:
screenAndLog(log, "Failed to locate 'soakTestAddrTable.txt' within your PyChips installation.\n" \
"Please specify the complete path to this file using the -f option next\n" \
"time you run this soak test script.")
sys.exit()
# Now import PyChips
from PyChipsUser import *
# Set the logger up according to verbosity flag
if options.verbose: chipsLog.setLevel(logging.DEBUG)
else: chipsLog.setLevel(logging.INFO)
# Create the UDP IPbus to the target device being soak-tested
board = ChipsBusUdp(AddressTable(addrTableFile), ipAddr, options.port)
# If the user specified zero or less iterations, this means run ~indefinitely
if options.maxIterations < 1: options.maxIterations = 1000000000000
# Counters
testIterationCount = 0
writeReadErrors = 0
blockWriteReadErrors = 0
exceptionCount = 0
loop = True
print "\nLog output also at:", logName
print "Press ctrl-c to terminate test."
print "Running...\n"
while testIterationCount < options.maxIterations:
try:
testIterationCount += 1
if(testIterationCount % 1000 == 0):
screenAndLog(log, "Iteration " + repr(testIterationCount))
testVal = getRandU32Value()
board.write("Test", testVal)
readResult = board.read("Test")
if readResult != testVal:
screenAndLog(log, "Write/Read error occurred! Expected " + hex(testVal) + " but got " + hex(readResult))
writeReadErrors += 1
blockTestVal = getRandU32List(16)
board.blockWrite("BigTestRam", blockTestVal)
blockReadResult = board.blockRead("BigTestRam", 16)
if blockTestVal != blockReadResult:
screenAndLog(log, "Block Write/Read error occurred!" \
"\n\tExpected Received" \
"\n\t-------- --------" \
+ uInt32HexDualListStr(blockTestVal, blockReadResult))
blockWriteReadErrors += 1
if writeReadErrors >= 30 or blockWriteReadErrors >= 30:
screenAndLog(log, "\nToo many errors have occurred - ending test program!")
break
except KeyboardInterrupt:
screenAndLog(log, "\nKeyboard interrupt (ctrl-c) received - ending test program!")
break
except ChipsException, what:
screenAndLog(log, "An exception occurred at " + asctime() + ":\n\t" + str(what))
exceptionCount += 1
if exceptionCount >= 30:
screenAndLog(log, "\nToo many exceptions have occurred - ending test program!")
break
screenAndLog(log, "\n\n-----------------\nTest Summary:\n")
screenAndLog(log, "\tTotal Test Iterations = " + repr(testIterationCount))
screenAndLog(log, "\tTotal Write/Read Errors = " + repr(writeReadErrors))
screenAndLog(log, "\tTotal Block Write/Read Errors = " + repr(blockWriteReadErrors))
screenAndLog(log, "\tTotal ChipsBus Exceptions during test = " + repr(exceptionCount))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment