Commit f35b9514 authored by Andrey Filippov's avatar Andrey Filippov

adding more Python methods to test new hardware functionality

parent a04debc6
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -58,6 +58,8 @@ import x393_mcntrl_eyepatterns ...@@ -58,6 +58,8 @@ import x393_mcntrl_eyepatterns
import x393_mcntrl_adjust import x393_mcntrl_adjust
import x393_mcntrl_membridge import x393_mcntrl_membridge
import x393_sens_cmprs import x393_sens_cmprs
import x393_camsync
import x393_gpio
import vrlg import vrlg
__all__ = [] __all__ = []
__version__ = 0.1 __version__ = 0.1
...@@ -333,7 +335,9 @@ USAGE ...@@ -333,7 +335,9 @@ USAGE
x393Eyepatterns= x393_mcntrl_eyepatterns.X393McntrlEyepattern(verbose,args.simulated) x393Eyepatterns= x393_mcntrl_eyepatterns.X393McntrlEyepattern(verbose,args.simulated)
x393Adjust= x393_mcntrl_adjust.X393McntrlAdjust(verbose,args.simulated,args.localparams) x393Adjust= x393_mcntrl_adjust.X393McntrlAdjust(verbose,args.simulated,args.localparams)
X393Membridge= x393_mcntrl_membridge.X393McntrlMembridge(verbose,args.simulated) X393Membridge= x393_mcntrl_membridge.X393McntrlMembridge(verbose,args.simulated)
x393SensCmprs= x393_sens_cmprs.x393SensCmprs(verbose,args.simulated,args.localparams) x393SensCmprs= x393_sens_cmprs.X393SensCmprs(verbose,args.simulated,args.localparams)
x393Camsync= x393_camsync.X393Camsync(verbose,args.simulated,args.localparams)
x393GPIO= x393_gpio.X393GPIO(verbose,args.simulated,args.localparams)
''' '''
print ("----------------------") print ("----------------------")
print("x393_mem.__dict__="+str(x393_mem.__dict__)) print("x393_mem.__dict__="+str(x393_mem.__dict__))
...@@ -349,16 +353,18 @@ USAGE ...@@ -349,16 +353,18 @@ USAGE
func_args=x393_mem.X393Mem.__dict__[name].func_code.co_varnames[1:x393_mem.X393Mem.__dict__[name].func_code.co_argcount] func_args=x393_mem.X393Mem.__dict__[name].func_code.co_varnames[1:x393_mem.X393Mem.__dict__[name].func_code.co_argcount]
print (name+": "+str(func_args)) print (name+": "+str(func_args))
extractTasks(x393_mem.X393Mem,x393mem) extractTasks(x393_mem.X393Mem,x393mem)
extractTasks(x393_utils.X393Utils,x393utils) extractTasks(x393_utils.X393Utils, x393utils)
extractTasks(x393_axi_control_status.X393AxiControlStatus,x393tasks) extractTasks(x393_axi_control_status.X393AxiControlStatus, x393tasks)
extractTasks(x393_pio_sequences.X393PIOSequences,x393Pio) extractTasks(x393_pio_sequences.X393PIOSequences, x393Pio)
extractTasks(x393_mcntrl_timing.X393McntrlTiming,x393Timing) extractTasks(x393_mcntrl_timing.X393McntrlTiming, x393Timing)
extractTasks(x393_mcntrl_buffers.X393McntrlBuffers,x393Buffers) extractTasks(x393_mcntrl_buffers.X393McntrlBuffers, x393Buffers)
extractTasks(x393_mcntrl_tests.X393McntrlTests,x393Tests) extractTasks(x393_mcntrl_tests.X393McntrlTests, x393Tests)
extractTasks(x393_mcntrl_eyepatterns.X393McntrlEyepattern,x393Eyepatterns) extractTasks(x393_mcntrl_eyepatterns.X393McntrlEyepattern, x393Eyepatterns)
extractTasks(x393_mcntrl_adjust.X393McntrlAdjust,x393Adjust) extractTasks(x393_mcntrl_adjust.X393McntrlAdjust, x393Adjust)
extractTasks(x393_mcntrl_membridge.X393McntrlMembridge,X393Membridge) extractTasks(x393_mcntrl_membridge.X393McntrlMembridge, X393Membridge)
extractTasks(x393_sens_cmprs.X393SensCmprs, x393SensCmprs)
extractTasks(x393_camsync.X393Camsync, x393Camsync)
extractTasks(x393_gpio.X393GPIO, x393GPIO)
for cmdLine in commands: for cmdLine in commands:
print ('Running task: '+str(cmdLine)) print ('Running task: '+str(cmdLine))
......
...@@ -297,12 +297,12 @@ class X393AxiControlStatus(object): ...@@ -297,12 +297,12 @@ class X393AxiControlStatus(object):
seq_num): # input [5:0] seq_num; seq_num): # input [5:0] seq_num;
""" """
Set status generation mode for all defined modules Set status generation mode for all defined modules
<mode> - status generation mode: @param mode - status generation mode:
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 4: auto, inc sequence number
<seq_number> - 6-bit sequence number of the status message to be sent @param seq_number - 6-bit sequence number of the status message to be sent
""" """
self.program_status (vrlg.MCONTR_PHY_16BIT_ADDR, vrlg.MCONTR_PHY_STATUS_CNTRL, mode,seq_num)# //MCONTR_PHY_STATUS_REG_ADDR= 'h0, self.program_status (vrlg.MCONTR_PHY_16BIT_ADDR, vrlg.MCONTR_PHY_STATUS_CNTRL, mode,seq_num)# //MCONTR_PHY_STATUS_REG_ADDR= 'h0,
...@@ -318,6 +318,85 @@ class X393AxiControlStatus(object): ...@@ -318,6 +318,85 @@ class X393AxiControlStatus(object):
self.program_status (vrlg.MCNTRL_TEST01_ADDR, vrlg.MCNTRL_TEST01_CHN4_STATUS_CNTRL,mode,seq_num)#; //MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3e, self.program_status (vrlg.MCNTRL_TEST01_ADDR, vrlg.MCNTRL_TEST01_CHN4_STATUS_CNTRL,mode,seq_num)#; //MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3e,
self.program_status (vrlg.MEMBRIDGE_ADDR, vrlg.MEMBRIDGE_STATUS_CNTRL, mode,seq_num)#; //MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3e, self.program_status (vrlg.MEMBRIDGE_ADDR, vrlg.MEMBRIDGE_STATUS_CNTRL, mode,seq_num)#; //MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3e,
def program_status_sensor_i2c( self,
num_sensor,
mode, # input [1:0] mode;
seq_num): # input [5:0] seq_num;
"""
Set status generation mode for selected sensor port i2c control
@param num_sensor - number of the sensor port (0..3)
@param mode - status generation mode:
0: disable status generation,
1: single status request,
2: auto status, keep specified seq number,
4: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent
"""
self.program_status (vrlg.SENSOR_GROUP_ADDR + num_sensor * vrlg.SENSOR_BASE_INC + vrlg.SENSI2C_CTRL_RADDR,
vrlg.SENSI2C_STATUS,
mode,
seq_num)# //MCONTR_PHY_STATUS_REG_ADDR= 'h0,
def program_status_sensor_io( self,
num_sensor,
mode, # input [1:0] mode;
seq_num): # input [5:0] seq_num;
"""
Set status generation mode for selected sensor port io subsystem
@param num_sensor - number of the sensor port (0..3)
@param mode - status generation mode:
0: disable status generation,
1: single status request,
2: auto status, keep specified seq number,
4: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent
"""
self.program_status (vrlg.SENSOR_GROUP_ADDR + num_sensor * vrlg.SENSOR_BASE_INC + vrlg.SENSIO_RADDR,
vrlg.SENSIO_STATUS,
mode,
seq_num)# //MCONTR_PHY_STATUS_REG_ADDR= 'h0,
def program_status_compressor(self,
cmprs_chn,
mode, # input [1:0] mode;
seq_num): # input [5:0] seq_num;
"""
Set status generation mode for selected compressor channel
@param cmprs_chn - number of the compressor channel (0..3)
@param mode - status generation mode:
0: disable status generation,
1: single status request,
2: auto status, keep specified seq number,
4: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent
"""
self.program_status (vrlg.CMPRS_GROUP_ADDR + cmprs_chn * vrlg.CMPRS_BASE_INC,
vrlg.CMPRS_STATUS_CNTRL,
mode,
seq_num)# //MCONTR_PHY_STATUS_REG_ADDR= 'h0,
'''
def program_status_gpio(self,
mode, # input [1:0] mode;
seq_num): # input [5:0] seq_num;
"""
Set status generation mode for GPIO port
@param mode - status generation mode:
0: disable status generation,
1: single status request,
2: auto status, keep specified seq number,
4: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent
"""
self.program_status (vrlg.GPIO_ADDR,
vrlg.GPIO_SET_STATUS,
mode,
seq_num)# //MCONTR_PHY_STATUS_REG_ADDR= 'h0,
'''
def enable_cmda(self, def enable_cmda(self,
en): # input en; en): # input en;
""" """
......
from __future__ import division
from __future__ import print_function
'''
# Copyright (C) 2015, Elphel.inc.
# Class to control image acquisition and compression functionality
# 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/>.
@author: Andrey Filippov
@copyright: 2015 Elphel, Inc.
@license: GPLv3.0+
@contact: andrey@elphel.coml
@deffield updated: Updated
'''
__author__ = "Andrey Filippov"
__copyright__ = "Copyright 2015, Elphel, Inc."
__license__ = "GPL"
__version__ = "3.0+"
__maintainer__ = "Andrey Filippov"
__email__ = "andrey@elphel.com"
__status__ = "Development"
#import sys
#import pickle
from x393_mem import X393Mem
import x393_axi_control_status
import x393_utils
#import time
import vrlg
SI5338_PATH = "/sys/devices/amba.0/e0004000.ps7-i2c/i2c-0/0-0070"
POWER393_PATH = "/sys/devices/elphel393-pwr.1"
class X393SensCmprs(object):
DRY_MODE= True # True
DEBUG_MODE=1
x393_mem=None
x393_axi_tasks=None #x393X393AxiControlStatus
x393_utils=None
verbose=1
def __init__(self, debug_mode=1,dry_mode=True, saveFileName=None):
self.DEBUG_MODE= debug_mode
self.DRY_MODE= dry_mode
self.x393_mem= X393Mem(debug_mode,dry_mode)
self.x393_axi_tasks= x393_axi_control_status.X393AxiControlStatus(debug_mode,dry_mode)
self.x393_utils= x393_utils.X393Utils(debug_mode,dry_mode, saveFileName) # should not overwrite save file path
try:
self.verbose=vrlg.VERBOSE
except:
pass
def setSensorClock(self, freq_MHz = 24.0):
"""
Set up external clock for sensor-synchronous circuitry (and sensor(s) themselves.
Currently required clock frequency is 1/4 of the sensor clock, so it is 24MHz for 96MHz sensor
@param freq_MHz - input clock frequency (MHz). Currently for 96MHZ sensor clock it should be 24.0
"""
with open ( SI5338_PATH + "/output_drivers/2V5_LVDS", "w") as f:
print("1", file = f)
with open ( SI5338_PATH + "/output_clocks/out1_freq_fract","w") as f:
print("%d"%(round(1000000*freq_MHz)), file = f )
def setSensorPower(self, sub_pair=0, power_on=0):
"""
@param sub_pair - pair of the sensors: 0 - sensors 1 and 2, 1 - sensors 3 and 4
@param power_on - 1 - power on, 0 - power off (both sensor power and interface/FPGA bank voltage)
"""
with open (POWER393_PATH + "/channels_"+ ("dis","en")[power_on],"w") as f:
print(("vcc_sens01 vp33sens01", "vcc_sens23 vp33sens23")[sub_pair], file = f)
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