Skip to content
Snippets Groups Projects
Commit f4cc11df authored by Jonathan Hargreaves's avatar Jonathan Hargreaves
Browse files

driver for the destination IP and MAC addresses

parent 4b4fdf97
No related branches found
No related tags found
No related merge requests found
#! /usr/bin/env python
###############################################################################
#
# Copyright (C) 2015
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# Purpose:
# . Read/write common registers for the 10GbE destination MAC and IP addresses (ARTS SC4 TAB versions)
# Usage:
# . Read all fields:
# . python pi_arts_unb1_sc1_bg_1GbE.py --unb 4 --fn 3
# . Read specific field:
# . python pi_arts_unb1_sc1_bg_1GbE.py --unb 4 --fn 3 --reg id_beamlet_index
from pi_common_mm import *
import os
PINAME_IP = 'REG_TAB_DEST_IP'
PINAME_MAC = 'REG_TAB_DEST_MAC'
PID_IP = 'TAB_DEST_IP'
PID_MAC = 'TAB_DEST_MAC'
ADDR_W = 3
NOF_INST = 5
tc = test_case.Testcase('UTIL - ', '')
tc.set_result('PASSED')
tc.append_log(0, '>>> Title : Set IP, MAC address on %s' % tc.unb_nodes_string(''))
io = node_io.NodeIO(tc.nodeImages, tc.base_ip)
cmd = tc.number
print cmd, tc.streamNumbers, tc.gpNumbers
tabdestip = PiCommonMm(tc, io, "REG", PID_IP, slaveName='', piInstanceName='', nofInst=NOF_INST, sizePerInst=1)
tabdestmac = PiCommonMm(tc, io, "REG", PID_MAC, slaveName='', piInstanceName='', nofInst=NOF_INST, sizePerInst=2)
if cmd==0:
for i in tc.streamNumbers:
tabdestip.read_mm(n=None, instNr=i, offset=0, nodeNrs=None, width=32, radix='uns', nofColumns=16, vLevel=3)
tabdestmac.read_mm(n=None, instNr=i, offset=0, nodeNrs=None, width=32, radix='uns', nofColumns=16, vLevel=3)
elif cmd==1:
for i in tc.streamNumbers:
tabdestip.write_mm(data=tc.gpNumbers[i], instNr=i, offset=0, nodeNrs=None, width=32, radix='uns', nofColumns=16, vLevel=3)
elif cmd==2:
for i in tc.streamNumbers:
datatowrite = [tc.gpNumbers[i],tc.gpNumbers[i]/2**32]
print tc.gpNumbers, datatowrite
tabdestmac.write_mm(data=datatowrite, instNr=i, offset=0, nodeNrs=None, width=32, radix='uns', nofColumns=16, vLevel=3)
else:
tc.append_log(0, '>>> Usage [-n <command number>]:')
tc.append_log(0, ' . 0 : read back the IP and MAC registers [--stream <stream numbers>] ')
tc.append_log(0, ' . 1 : write -r values to IP register [--stream <stream numbers>] -r value,value')
tc.append_log(0, ' . 2 : write -r values to MAC register [--stream <stream numbers>] -r [valuelo,valuehi]')
tc.append_log(0, ' else print this messgage.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment