1 from __future__
import print_function
3 # Copyright (C) 2016, Elphel.inc. 4 # Simulation code for cocotb simulation for x393 project 6 # This program is free software: you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation, either version 3 of the License, or 9 # (at your option) any later version. 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 16 # You should have received a copy of the GNU General Public License 17 # along with this program. If not, see <http:#www.gnu.org/licenses/>. 18 @author: Andrey Filippov 19 @copyright: 2016 Elphel, Inc. 21 @contact: andrey@elphel.coml 26 class SocketCommand():
29 def __init__(self, command=None, arguments=None):
67 return json.dumps(val)
80 def __init__(self, host='localhost', port=7777):
83 self.
cmd= SocketCommand()
85 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
88 reply = sock.recv(16384)
93 print(
"start->",self.
communicate(self.cmd.toJSON()))
98 self.cmd.setWrite([address,data])
102 self.cmd.setWait([irqMask,wait_ns])
110 self.cmd.setRead(address)
114 return json.loads(rslt)
def write( self, address, data)
def setRead( self, arguments)
def toJSON( self, val=None)
def waitIrq( self, irqMask, wait_ns)
def setWrite( self, arguments)
def fromJSON( self, jstr)
def communicate( self, snd_str)
def setWait( self, arguments)
def __init__( self, host='localhost', port=7777)
def __init__( self, command=None, arguments=None)