Commit 603454fa authored by Gaia Grosso's avatar Gaia Grosso
Browse files

substitute property with register

parent b58c9574
......@@ -9,14 +9,14 @@ reg = ctypes.CDLL(so_file)
config_dict = {
"board0" : {
"driver" : "/dev/wz-xdma0_user",
"property" : {
"property0" : {
"register" : {
"register0" : {
"location": "0x00000000",
"offset" : 0,
"width" : 10,
},
"property1" : {
"register1" : {
"location": "0x00000000",
"offset" : 10,
"width" : 20
......@@ -25,14 +25,14 @@ config_dict = {
},
"board1" : {
"driver" : "/dev/wz-xdma1_user",
"property" : {
"property0" : {
"register" : {
"register0" : {
"location": "0x00000001",
"offset" : 0,
"width" : 32
},
"property1" : {
"register1" : {
"location": "0x00000002",
"offset" : 30,
"width" : 2
......@@ -96,18 +96,18 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser() #Python tool that makes it easy to create an user-friendly command-line interface
parser.add_argument('-b','--board', type=str, help="scouting board", required=True)
parser.add_argument('-a','--action', type=str, help="control action", required=True, choices=actions)
parser.add_argument('-p','--property', type=str, help="control property", required=True)
parser.add_argument('-r','--register', type=str, help="control register", required=True)
parser.add_argument('-v','--value', type=str, help="new value", required=False)
parser.add_argument('-f','--filelog', type=str, help="logfile", required=False)
parser.add_argument('-d','--dump', type=int ,help="dump messages", required=False, default=0)
args = parser.parse_args()
board = args.board
prop = args.property
reg = args.register
device = config_dict[board]["driver"]
location = config_dict[board]["property"][prop]["location"]
offset = config_dict[board]["property"][prop]["offset"]
width = config_dict[board]["property"][prop]["width"]
location = config_dict[board]["register"][reg]["location"]
offset = config_dict[board]["registter"][reg]["offset"]
width = config_dict[board]["register"][reg]["width"]
action = args.action
value = int(args.value)
verbose = args.dump
......@@ -130,7 +130,7 @@ if __name__ == '__main__':
print("Save log at %s"%(filelog))
f = open(filelog, "w")
f.write("board: %s\n"%(device))
f.write("property: %s\n"%(prop))
f.write("register: %s\n"%(reg))
f.write("location: %s\n"%(location))
f.write("offset: %i\n"%(offset))
f.write("width: %i\n"%(width))
......@@ -147,7 +147,7 @@ if __name__ == '__main__':
print("Save log at %s"%(filelog))
f = open(filelog, "w")
f.write("board: %s\n"%(device))
f.write("property: %s\n"%(prop))
f.write("register: %s\n"%(reg))
f.write("location: %s\n"%(location))
f.write("offset: %i\n"%(offset))
f.write("width: %i\n"%(width))
......@@ -162,20 +162,20 @@ if __name__ == '__main__':
if output == -1:
print('The value could not be updated.')
else:
print('Set property %s from location %s on %s: %i'%(prop, location, board, writevalue.value))
print('Set register %s from location %s on %s: %i'%(reg, location, board, writevalue.value))
elif action == "get":
output = ReadProperty(device, location, offset, width, verbose=verbose)
if output == -1:
print('The register could not be read.')
else:
print('Get property %s from location %s on %s: %i'%(prop, location, board, output))
print('Get register %s from location %s on %s: %i'%(reg, location, board, output))
if filelog:
print("Save log at %s"%(filelog))
f = open(filelog, "w")
f.write("board: %s\n"%(device))
f.write("property: %s\n"%(prop))
f.write("register: %s\n"%(reg))
f.write("location: %s\n"%(location))
f.write("offset: %i\n"%(offset))
f.write("width: %i\n"%(width))
......
Supports Markdown
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