Skip to content
Snippets Groups Projects
Commit 9468edf2 authored by Pieter Donker's avatar Pieter Donker
Browse files

#2995: add new file to set IP and MAC for unb2b sc3

parent ac9818df
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 SC3)
# Usage:
# . Read all fields:
# . python pi_arts_unb1_sc1_bg_1GbE.py --unb2 4 --pn2 3
# . Read specific field:
# . python pi_arts_unb1_sc1_bg_1GbE.py --unb2 4 --pn2 3 --reg id_beamlet_index
import os
from test_case import Testcase
from node_io import NodeIO
from pi_common_mm import PiCommonMm
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 = 40
tc = Testcase('UTIL - ', '')
tc.set_result('PASSED')
tc.append_log(0, '>>> Title : Set IP, MAC address on %s' % tc.unb_nodes_string(''))
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