Commit 654584f3 authored by Andrey Filippov's avatar Andrey Filippov

More development of the Verilog and Python code for LWIR sensors

parent 1ccb2eee
......@@ -129,6 +129,8 @@ module cmprs_cmd_decode#(
parameter CMPRS_CBIT_BAYER_BITS = 2, // number of bits to control compressor Bayer shift mode
parameter CMPRS_CBIT_FOCUS = 23, // bit # to control compressor focus display mode
parameter CMPRS_CBIT_FOCUS_BITS = 2, // number of bits to control compressor focus display mode
parameter CMPRS_CBIT_ROWS_LSB = 28, // bit # Four height LSBs in raw mode
parameter CMPRS_CBIT_ROWS_LSB_BITS = 4, // number of bits to control four height LSBs in raw mode
// compressor bit-fields decode
parameter CMPRS_CBIT_RUN_RST = 2'h0, // reset compressor, stop immediately
// parameter CMPRS_CBIT_RUN_DISABLE = 2'h1, // disable compression of the new frames, finish any already started
......@@ -205,6 +207,7 @@ module cmprs_cmd_decode#(
output reg [ 2:0] cmprs_qpage, // [2:0] - quantizator page number (0..7)
output reg cmprs_dcsub, // subtract dc level before DCT, restore later
output reg [ 1:0] cmprs_fmode, //[1:0] - focus mode
output reg [ 3:0] raw_rows_lsb, // Four LSBs of the window height - used in raw mode
output reg [ 1:0] bayer_shift, // additional shift to bayer mosaic
output reg ignore_color,
......@@ -246,6 +249,7 @@ module cmprs_cmd_decode#(
reg cmprs_dcsub_mclk; // subtract dc level before DCT, restore later
reg [ 3:0] cmprs_mode_mclk; // [3:0] - compressor mode
reg [ 1:0] cmprs_fmode_mclk; //[1:0] - focus mode
reg [ 3:0] rows_lsb_mclk; // [3:0] - Four LSBs of the window height - used in raw mode
reg [ 1:0] bayer_shift_mclk; // additional shift to bayer mosaic
reg [30:0] format_mclk; // left margin and macroblock rows/columns
......@@ -256,6 +260,8 @@ module cmprs_cmd_decode#(
reg cmprs_dcsub_xclk; // subtract dc level before DCT, restore later
reg [ 3:0] cmprs_mode_xclk; // [3:0] - compressor mode
reg [ 1:0] cmprs_fmode_xclk; //[1:0] - focus mode
reg [ 3:0] rows_lsb_xclk; // Four LSBs of the window height - used in raw mode
reg [ 1:0] bayer_shift_xclk; // additional shift to bayer mosaic
reg [30:0] format_xclk; // left margin and macroblock rows/columns
......@@ -311,6 +317,9 @@ module cmprs_cmd_decode#(
if (mrst) cmprs_fmode_mclk <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_FOCUS]) cmprs_fmode_mclk <= di_r[CMPRS_CBIT_FOCUS-1 -:CMPRS_CBIT_FOCUS_BITS];
if (mrst) rows_lsb_mclk <= 4'h0f;
else if (ctrl_we_r && di_r[CMPRS_CBIT_ROWS_LSB]) rows_lsb_mclk <= di_r[CMPRS_CBIT_ROWS_LSB-1 -:CMPRS_CBIT_ROWS_LSB_BITS];
if (mrst) bayer_shift_mclk <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_BAYER]) bayer_shift_mclk <= di_r[CMPRS_CBIT_BAYER-1 -:CMPRS_CBIT_BAYER_BITS];
......@@ -343,6 +352,7 @@ module cmprs_cmd_decode#(
cmprs_dcsub_xclk <= cmprs_dcsub_mclk;
cmprs_mode_xclk <= cmprs_mode_mclk;
cmprs_fmode_xclk <= cmprs_fmode_mclk;
rows_lsb_xclk <= rows_lsb_mclk;
bayer_shift_xclk <= bayer_shift_mclk;
end
......@@ -356,6 +366,7 @@ module cmprs_cmd_decode#(
cmprs_qpage <= cmprs_qpage_xclk;
cmprs_dcsub <= cmprs_dcsub_xclk;
cmprs_fmode <= cmprs_fmode_xclk;
raw_rows_lsb <= rows_lsb_xclk;
bayer_shift <= bayer_shift_xclk;
left_marg <= format_xclk[CMPRS_FRMT_LMARG +: CMPRS_FRMT_LMARG_BITS];
......
......@@ -62,7 +62,8 @@ module cmprs_raw_buf_iface #(
input cmprs_run_mclk, // 0 - off or stopping, reset frame_pre_run
// input [ 4:0] left_marg, // left margin (for not-yet-implemented) mono JPEG (8 lines tile row) can need 7 bits (mod 32 - tile)
input [12:0] n_blocks_in_row_m1, // number of macroblocks in a macroblock row minus 1
input [12:0] n_block_rows_m1, // number of macroblock rows in a frame minus 1
// input [12:0] n_block_rows_m1, // number of macroblock rows in a frame minus 1
input [16:0] n_block_rows_m1, // number of macroblock rows in a frame minus 1
input stuffer_running, // @xclk, active while bit stuffer or trailer are running
input raw_be16, // 0: bytes 0-1-2-3-4-5..., 1: bytes 1-0-3-2-5-4...
output [11:0] buf_ra, // buffer read address (2 MSB - page number)
......@@ -206,7 +207,8 @@ module cmprs_raw_buf_iface #(
quad_last <= mode_valid && !(|quads_left); // valid from 2 after frame_pre_start_r or after quad_r[3]
if (frame_pre_start_r) rows_left <= {n_block_rows_m1, 4'b1111};
// if (frame_pre_start_r) rows_left <= {n_block_rows_m1, 4'b1111};
if (frame_pre_start_r) rows_left <= n_block_rows_m1; //n_block_rows_m1 now combines n_block_rows_m1 and tile vstep ?
else if ((quad_r[2] && quad_last)) rows_left <= rows_left - 1;
rows_last <= {rows_last[0], mode_valid & ~(|rows_left)};
......
......@@ -84,6 +84,9 @@ module compressor393 # (
parameter CMPRS_CBIT_BAYER_BITS = 2, // number of bits to control compressor Bayer shift mode
parameter CMPRS_CBIT_FOCUS = 23, // bit # to control compressor focus display mode
parameter CMPRS_CBIT_FOCUS_BITS = 2, // number of bits to control compressor focus display mode
parameter CMPRS_CBIT_ROWS_LSB = 28, // bit # Four height LSBs in raw mode
parameter CMPRS_CBIT_ROWS_LSB_BITS = 4, // number of bits to control four height LSBs in raw mode
// compressor bit-fields decode
parameter CMPRS_CBIT_RUN_RST = 2'h0, // reset compressor, stop immediately
// parameter CMPRS_CBIT_RUN_DISABLE = 2'h1, // disable compression of the new frames, finish any already started
......@@ -382,6 +385,8 @@ module compressor393 # (
.CMPRS_CBIT_BAYER_BITS (CMPRS_CBIT_BAYER_BITS),
.CMPRS_CBIT_FOCUS (CMPRS_CBIT_FOCUS),
.CMPRS_CBIT_FOCUS_BITS (CMPRS_CBIT_FOCUS_BITS),
.CMPRS_CBIT_ROWS_LSB (CMPRS_CBIT_ROWS_LSB),
.CMPRS_CBIT_ROWS_LSB_BITS (CMPRS_CBIT_ROWS_LSB_BITS),
.CMPRS_CBIT_RUN_RST (CMPRS_CBIT_RUN_RST),
.CMPRS_CBIT_RUN_STANDALONE (CMPRS_CBIT_RUN_STANDALONE),
.CMPRS_CBIT_RUN_ENABLE (CMPRS_CBIT_RUN_ENABLE),
......
......@@ -78,6 +78,8 @@ module jp_channel#(
parameter CMPRS_CBIT_BAYER_BITS = 2, // number of bits to control compressor Bayer shift mode
parameter CMPRS_CBIT_FOCUS = 23, // bit # to control compressor focus display mode
parameter CMPRS_CBIT_FOCUS_BITS = 2, // number of bits to control compressor focus display mode
parameter CMPRS_CBIT_ROWS_LSB = 28, // bit # Four height LSBs in raw mode
parameter CMPRS_CBIT_ROWS_LSB_BITS = 4, // number of bits to control four height LSBs in raw mode
// compressor bit-fields decode
parameter CMPRS_CBIT_RUN_RST = 2'h0, // reset compressor, stop immediately
// parameter CMPRS_CBIT_RUN_DISABLE = 2'h1, // disable compression of the new frames, finish any already started
......@@ -253,7 +255,7 @@ module jp_channel#(
wire [CMPRS_CSAT_CR_BITS-1:0] m_cr; // [9:0] scale for CR - default 0.713 (10'hb6)
wire [ 1:0] cmprs_fmode; // focusing/overlay mode
wire [ 3:0] raw_rows_lsb; // four LSBs of window height in raw mode, 0 means 'h10, 'hf means f
//TODO: assign next 5 values from converter_type[2:0]
wire [ 5:0] mb_w_m1; // macroblock width minus 1
wire [ 5:0] mb_h_m1; // macroblock height -1
......@@ -701,6 +703,8 @@ module jp_channel#(
.CMPRS_CBIT_BAYER_BITS (CMPRS_CBIT_BAYER_BITS),
.CMPRS_CBIT_FOCUS (CMPRS_CBIT_FOCUS),
.CMPRS_CBIT_FOCUS_BITS (CMPRS_CBIT_FOCUS_BITS),
.CMPRS_CBIT_ROWS_LSB (CMPRS_CBIT_ROWS_LSB),
.CMPRS_CBIT_ROWS_LSB_BITS (CMPRS_CBIT_ROWS_LSB_BITS),
.CMPRS_CBIT_RUN_RST (CMPRS_CBIT_RUN_RST),
.CMPRS_CBIT_RUN_STANDALONE (CMPRS_CBIT_RUN_STANDALONE),
.CMPRS_CBIT_RUN_ENABLE (CMPRS_CBIT_RUN_ENABLE),
......@@ -760,7 +764,8 @@ module jp_channel#(
.cmprs_en_late_xclk (stuffer_en), // output reg - extended enable to allow stuffer to gracefully finish
.cmprs_qpage (cmprs_qpage), // output[2:0] reg
.cmprs_dcsub (subtract_dc), // output reg
.cmprs_fmode (cmprs_fmode), // output[1:0] reg
.cmprs_fmode (cmprs_fmode), // output[1:0] reg
.raw_rows_lsb (raw_rows_lsb), // output[3:0] reg
.bayer_shift (bayer_phase), // output[1:0] reg
.ignore_color (ignore_color), // output reg
.four_blocks (), // output reg Not used?
......@@ -888,7 +893,7 @@ module jp_channel#(
.frame_go (frame_go_raw), // input
.cmprs_run_mclk (cmprs_run_mclk), // input
.n_blocks_in_row_m1 (n_blocks_in_row_m1), // input[12:0]
.n_block_rows_m1 (n_block_rows_m1), // input[12:0]
.n_block_rows_m1 ({n_block_rows_m1,raw_rows_lsb}), // input[12:0]
.stuffer_running (stuffer_running), // input
.raw_be16 (raw_be16), // input
.buf_ra (raw_buf_ra), // output[11:0]
......
......@@ -35,7 +35,10 @@
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
*/
parameter FPGA_VERSION = 32'h03930107; // parallel - 17.4 - restored delay after linear, fixed bug, all met
parameter FPGA_VERSION = 32'h03930120; //
// parameter FPGA_VERSION = 32'h03930107; // parallel - 17.4 - restored delay after linear, fixed bug, all met
// parameter FPGA_VERSION = 32'h03930110; //A serial - 17.4 - restored delay after linear, fixed bug, timing met
// parameter FPGA_VERSION = 32'h03930110; // serial - 17.4 - restored delay after linear, fixed bug, timing failed
// parameter FPGA_VERSION = 32'h03930107; // parallel - 17.4 - restored delay after linear, fixed bug, all met
......
......@@ -570,7 +570,7 @@
parameter VOSPI_HACT_TO_HACT_EOF = 2, // minimal clock cycles from HACT to HACT or to EOF
parameter VOSPI_MCLK_HALFDIV = 4, // divide mclk (200Hhz) to get 50 MHz, then divide by 2 and use for sensor 25MHz clock
//`else
//sensor_fifo parameters
//sensor_fifo parameters (for parallel12)
parameter SENSOR_DATA_WIDTH = 12,
parameter SENSOR_FIFO_2DEPTH = 4,
parameter [3:0] SENSOR_FIFO_DELAY = 5, // 7,
......@@ -755,6 +755,8 @@
parameter CMPRS_CBIT_BAYER_BITS = 2, // number of bits to control compressor Bayer shift mode
parameter CMPRS_CBIT_FOCUS = 23, // bit # to control compressor focus display mode
parameter CMPRS_CBIT_FOCUS_BITS = 2, // number of bits to control compressor focus display mode
parameter CMPRS_CBIT_ROWS_LSB = 28, // bit # Four height LSBs in raw mode
parameter CMPRS_CBIT_ROWS_LSB_BITS = 4, // number of bits to control four height LSBs in raw mode
// compressor bit-fields decode
parameter CMPRS_CBIT_RUN_RST = 2'h0, // reset compressor, stop immediately
// parameter CMPRS_CBIT_RUN_DISABLE = 2'h1, // disable compression of the new frames, finish any already started
......
......@@ -309,6 +309,7 @@ SENS_LENS_RADDR = int
SENSI2C_CMD_TABLE__TYPE = str
PXD_IOSTANDARD = str
SENSOR12BITS_TMD__RAW = str
CMPRS_CBIT_ROWS_LSB_BITS = int
MAX_TILE_HEIGHT = int
BUF_CLK1X_PCLK = str
LOGGER_CONF_DBG_BITS = int
......@@ -989,6 +990,7 @@ CMPRS_CBIT_RUN_ENABLE__RAW = str
AXI_RDADDR_LATENCY__TYPE = str
BUF_IPCLK_SENS3__RAW = str
CLK_STATUS__RAW = str
CMPRS_CBIT_ROWS_LSB__RAW = str
MULTICLK_BUF_AXIHP = str
FRAME_WIDTH_BITS = int
READ_PATTERN_OFFSET__TYPE = str
......@@ -1725,6 +1727,7 @@ MCONTR_TOP_0BIT_ADDR = int
NUM_CYCLES_05__RAW = str
MCNTRL_TILED_FRAME_LAST__TYPE = str
QUADRANTS_PXD_HACT_VACT__RAW = str
CMPRS_CBIT_ROWS_LSB_BITS__TYPE = str
MCONTR_CMPRS_STATUS_INC__RAW = str
CMPRS_CBIT_CMODE_JP4DIFFHDR = int
TABLE_CORING_INDEX__RAW = str
......@@ -1735,6 +1738,7 @@ MCONTR_ARBIT_ADDR__TYPE = str
CAMSYNC_TRIG_DELAY1__RAW = str
LWIR_TELEMETRY_TEMP_LAST_KELVIN = int
AXI_TASK_HOLD = float
CMPRS_CBIT_ROWS_LSB__TYPE = str
ADDRESS_NUMBER = int
CAMSYNC_GPIO_EXT_OUT = int
SENSOR_TIMING_FROM__RAW = str
......@@ -2314,6 +2318,7 @@ CMPRS_RAW = int
CLK_PHASE__RAW = str
MCONTR_PHY_0BIT_DLY_RST = int
GPIO_MASK__TYPE = str
CMPRS_CBIT_ROWS_LSB_BITS__RAW = str
MULT_SAXI_BSLOG2__TYPE = str
TILED_STARTX = int
MEMBRIDGE_MASK__TYPE = str
......@@ -2431,6 +2436,7 @@ MCONTR_TOP_0BIT_MCONTR_EN__RAW = str
MULTICLK_PHASE_FB__RAW = str
TABLE_HUFFMAN_INDEX__TYPE = str
SENS_GAMMA_MODE_EN_SET__TYPE = str
CMPRS_CBIT_ROWS_LSB = int
RTC_SET_STATUS__RAW = str
SENS_CTRL_QUADRANTS = int
LD_DLY_PHASE__TYPE = str
......
......@@ -113,7 +113,8 @@ class X393Cmprs(object):
cmode = None,
multi_frame = None,
bayer = None,
focus_mode = None):
focus_mode = None,
row_lsb_raw = None):
"""
Combine compressor control parameters into a single word. None value preserves old setting for the parameter
@param run_mode - 0 - reset, 2 - run single from memory, 3 - run repetitive
......@@ -135,7 +136,8 @@ class X393Cmprs(object):
CMPRS_CBIT_CMODE_MONO4 = 14 - mono 4 blocks
@param multi_frame - False - single-frame buffer, True - multi-frame video memory buffer,
@param bayer - Bayer shift (0..3)
@param focus_mode - focus mode - how to combine image with "focus quality" in the result image
@param focus_mode - focus mode - how to combine image with "focus quality" in the result image
@param row_lsb_raw - four LSBs of the window height - used in raw mode
@return combined data word
"""
data = 0;
......@@ -166,6 +168,9 @@ class X393Cmprs(object):
if not focus_mode is None:
data |= (1 << vrlg.CMPRS_CBIT_FOCUS)
data |= (focus_mode & ((1 << vrlg.CMPRS_CBIT_FOCUS_BITS) - 1)) << (vrlg.CMPRS_CBIT_FOCUS - vrlg.CMPRS_CBIT_FOCUS_BITS)
if not row_lsb_raw is None:
data |= (1 << vrlg.CMPRS_CBIT_ROWS_LSB)
data |= (row_lsb_raw & ((1 << vrlg.CMPRS_CBIT_ROWS_LSB_BITS) - 1)) << (vrlg.CMPRS_CBIT_ROWS_LSB - vrlg.CMPRS_CBIT_ROWS_LSB_BITS)
return data
def compressor_format (self,
......@@ -218,7 +223,8 @@ class X393Cmprs(object):
cmode = None,
multi_frame = None,
bayer = None,
focus_mode = None):
focus_mode = None,
row_lsb_raw = None):
"""
Combine compressor control parameters into a single word. None value preserves old setting for the parameter
@param chn - compressor channel number, "a" or "all" - same for all 4 channels
......@@ -242,6 +248,7 @@ class X393Cmprs(object):
@param multi_frame - False - single-frame buffer, True - multi-frame video memory buffer,
@param bayer - Bayer shift (0..3)
@param focus_mode - focus mode - how to combine image with "focus quality" in the result image
@param row_lsb_raw - four LSBs of the window height - used in raw mode
"""
try:
if (chn == all) or (chn[0].upper() == "A"): #all is a built-in function
......@@ -253,7 +260,8 @@ class X393Cmprs(object):
cmode = cmode,
multi_frame = multi_frame,
bayer = bayer,
focus_mode = focus_mode)
focus_mode = focus_mode,
row_lsb_raw = row_lsb_raw)
return
except:
pass
......@@ -264,7 +272,8 @@ class X393Cmprs(object):
cmode = cmode,
multi_frame = multi_frame,
bayer = bayer,
focus_mode = focus_mode)
focus_mode = focus_mode,
row_lsb_raw = row_lsb_raw)
self.x393_axi_tasks.write_control_register(vrlg.CMPRS_GROUP_ADDR + chn * vrlg.CMPRS_BASE_INC + vrlg.CMPRS_CONTROL_REG,
data)
......@@ -519,11 +528,13 @@ class X393Cmprs(object):
qbank,
dc_sub,
cmode,
bit16,
multi_frame,
bayer,
focus_mode,
num_macro_cols_m1,
num_macro_rows_m1,
row_lsb_raw,
left_margin,
colorsat_blue,
colorsat_red,
......@@ -547,11 +558,14 @@ class X393Cmprs(object):
CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = 10 - jp4, 4 blocks, differential, hdr,divide by 2
CMPRS_CBIT_CMODE_MONO1 = 11 - mono JPEG (not yet implemented)
CMPRS_CBIT_CMODE_MONO4 = 14 - mono 4 blocks
CMPRS_CBIT_CMODE_RAW = 15 - raw (uncompressed) mode
@param bit16 - 16-bit (2 bytes per pixel) mode
@param multi_frame - False - single-frame buffer, True - multi-frame video memory buffer,
@param bayer - Bayer shift (0..3)
@param focus_mode - focus mode - how to combine image with "focus quality" in the result image
@param num_macro_cols_m1 - number of macroblock colums minus 1
@param num_macro_rows_m1 - number of macroblock rows minus 1
@param row_lsb_raw - four LSBs of the window height - used in raw mode
@param left_margin - left margin of the first pixel (0..31) for 32-pixel wide colums in memory access
@param colorsat_blue - color saturation for blue (10 bits), 0x90 for 100%
@param colorsat_red - color saturation for red (10 bits), 0xb6 for 100%
......@@ -567,6 +581,7 @@ class X393Cmprs(object):
print ( "multi_frame = ",multi_frame)
print ( "bayer = ",bayer)
print ( "focus_mode = ",focus_mode)
print ( "row_lsb_raw = ", row_lsb_raw)
self.compressor_control(
chn = chn, # compressor channel number (0..3)
qbank = qbank, # [6:3] quantization table page
......
......@@ -2133,7 +2133,7 @@ class X393ExportC(object):
dw.append(("pwdn_set", vrlg.VOSPI_PWDN + 1, 1, 0, "When set to 1, POWER DOWN is set to the 'pwdn' field value"))
dw.append(("mclk", vrlg.VOSPI_MCLK, 1, 0, "Enable master clock (25MHz) to sensor"))
dw.append(("mclk_set", vrlg.VOSPI_MCLK + 1, 1, 0, "When set to 1, MCLK enable is set to the 'mclk' field value"))
dw.append(("spi_en", vrlg.VOSPI_EN, 2, 0, "SPI Reset/enable: 0 - NOP, 1 - reset+disable, 2 - noreset, disable, 3 - noreset, enable"))
dw.append(("spi_en", vrlg.VOSPI_EN, 2, 0, "SPI reset/enable: 0 - NOP, 1 - reset+disable, 2 - noreset, disable, 3 - noreset, enable"))
dw.append(("segm_zero", vrlg.VOSPI_SEGM0_OK, 1, 0, "OK to input segment 0 (invalid, valid are 1,2,3,4)"))
dw.append(("segm_zero_set",vrlg.VOSPI_SEGM0_OK + 1, 1, 0, "Enable setting of segm_zero"))
dw.append(("out_en", vrlg.VOSPI_OUT_EN, 1, 0, "Enable output sensor data to memory"))
......@@ -2362,6 +2362,8 @@ class X393ExportC(object):
dw.append(("bayer_set", vrlg.CMPRS_CBIT_BAYER, 1, 0, "Set 'bayer'"))
dw.append(("focus", vrlg.CMPRS_CBIT_FOCUS - vrlg.CMPRS_CBIT_FOCUS_BITS, vrlg.CMPRS_CBIT_FOCUS_BITS, 0, "Focus mode"))
dw.append(("focus_set", vrlg.CMPRS_CBIT_FOCUS, 1, 0, "Set 'focus'"))
dw.append(("rows_lsb", vrlg.CMPRS_CBIT_ROWS_LSB - vrlg.CMPRS_CBIT_ROWS_LSB_BITS, vrlg.CMPRS_CBIT_ROWS_LSB_BITS, 0, "4 LSBs of the (height-1), used in raw mode"))
dw.append(("rows_lsb_set", vrlg.CMPRS_CBIT_ROWS_LSB, 1, 0, "Set 4 LSBs of the (height-1)"))
return dw
def _enc_cmprs_coring_sel(self):
dw=[]
......@@ -2374,7 +2376,7 @@ class X393ExportC(object):
return dw
def _enc_cmprs_format(self):
dw=[]
dw.append(("num_macro_cols_m1", vrlg.CMPRS_FRMT_MBCM1, vrlg.CMPRS_FRMT_MBCM1_BITS, 0, "Number of macroblock colums minus 1"))
dw.append(("num_macro_cols_m1", vrlg.CMPRS_FRMT_MBCM1, vrlg.CMPRS_FRMT_MBCM1_BITS, 0, "Number of macroblock columns minus 1"))
dw.append(("num_macro_rows_m1", vrlg.CMPRS_FRMT_MBRM1, vrlg.CMPRS_FRMT_MBRM1_BITS, 0, "Number of macroblock rows minus 1"))
dw.append(("left_margin", vrlg.CMPRS_FRMT_LMARG, vrlg.CMPRS_FRMT_LMARG_BITS, 0, "Left margin of the first pixel (0..31) for 32-pixel wide colums in memory access"))
return dw
......
......@@ -133,10 +133,11 @@ SENSOR_INTERFACES={x393_sensor.SENSOR_INTERFACE_PARALLEL: {"mv":2800, "freq":24.
x393_sensor.SENSOR_INTERFACE_HISPI: {"mv":1820, "freq":24.444, "iface":"1V8_LVDS"},
x393_sensor.SENSOR_INTERFACE_LWIR: {"mv":2800, "freq":24.0, "iface":"2V5_LVDS"}}
# x393_sensor.SENSOR_INTERFACE_HISPI: {"mv":2500, "freq":24.444, "iface":"1V8_LVDS"}}
#slave is 7 bit
SENSOR_DEFAULTS= { x393_sensor.SENSOR_INTERFACE_PARALLEL: {"width":2592, "height":1944, "top":0, "left":0, "slave":0x48, "i2c_delay":100, "bayer":3},
x393_sensor.SENSOR_INTERFACE_HISPI: {"width":4384, "height":3288, "top":0, "left":0, "slave":0x10, "i2c_delay":100, "bayer":2},
x393_sensor.SENSOR_INTERFACE_LWIR: {"width":160, "height":120, "top":0, "left":0, "slave":0x2a, "i2c_delay":100, "bayer":2}}
# x393_sensor.SENSOR_INTERFACE_LWIR: {"width":160, "height":120, "top":0, "left":0, "slave":0x2a, "i2c_delay":100, "bayer":2}}
x393_sensor.SENSOR_INTERFACE_LWIR: {"width":160, "height":122, "top":0, "left":0, "slave":0x2a, "i2c_delay":100, "bayer":2}}
#SENSOR_DEFAULTS_SIMULATION= {x393_sensor.SENSOR_INTERFACE_PARALLEL: {"width":2592, "height":1944, "top":0, "left":0, "slave":0x48, "i2c_delay":100, "bayer":3},
# x393_sensor.SENSOR_INTERFACE_HISPI: {"width":4384, "height":3288, "top":0, "left":0, "slave":0x10, "i2c_delay":100, "bayer":2}}
......@@ -175,6 +176,10 @@ class X393SensCmprs(object):
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["height"]= vrlg.WOI_HEIGHT + 4
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["top"]= 0
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["left"]= 0
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_LWIR]["width"]= vrlg.WOI_WIDTH #4
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_LWIR]["height"]= vrlg.WOI_HEIGHT
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_LWIR]["top"]= 0
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_LWIR]["left"]= 0
# do not update LWIR defaults !!!
if nomargins:
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_PARALLEL]["width"]= vrlg.WOI_WIDTH + 0 # 4
......@@ -641,12 +646,15 @@ class X393SensCmprs(object):
print ("===================== MEMORY_SENSOR =========================, mode= %d"%(cmode))
window_height_memory = window_height
if (cmode==vrlg.CMPRS_CBIT_CMODE_JP4) or (cmode==15): # vrlg.CMPRS_CBIT_CMODE_RAW):
# if (cmode==vrlg.CMPRS_CBIT_CMODE_JP4) or (cmode==15): # vrlg.CMPRS_CBIT_CMODE_RAW):
if (cmode==vrlg.CMPRS_CBIT_CMODE_JP4): # vrlg.CMPRS_CBIT_CMODE_RAW): # RAW may be any umber of lines
window_height_memory &= 0xfff0 # do not need extra margins
num_burst_in_line &= 0xfffe # make even (assuming left=0)
print ("===================== Mode is JP4 or raw =========================")
# print ("===================== Mode is JP4 or raw =========================")
print ("===================== Mode is JP4 =========================")
else:
print ("===================== Mode is neither JP4 nor raw =========================")
# print ("===================== Mode is neither JP4 nor raw =========================")
print ("===================== Mode is not JP4 =========================")
self.x393Sensor.setup_sensor_memory (
num_sensor = num_sensor, # input [1:0] num_sensor;
......@@ -654,7 +662,6 @@ class X393SensCmprs(object):
frame_sa_inc = frame_start_address_inc, # input [31:0] frame_sa_inc; # 22-bit frame start address increment ((3 CA LSBs==0. BA==0)
last_frame_num = last_buf_frame, # input [31:0] last_frame_num; # 16-bit number of the last frame in a buffer
frame_full_width = frame_full_width, # input [31:0] frame_full_width; # 13-bit Padded line length (8-row increment), in 8-bursts (16 bytes)
# window_width = window_width >> 4, # input [31:0] window_width; # 13 bit - in 8*16=128 bit bursts
window_width = num_burst_in_line, # input [31:0] window_width; # 13 bit - in 8*16=128 bit bursts
# window_height = window_height, # input [31:0] window_height; # 16 bit
window_height = window_height_memory, # input [31:0] window_height; # 16 bit
......@@ -669,72 +676,10 @@ class X393SensCmprs(object):
self.x393Cmprs.compressor_control(chn = num_sensor,
run_mode = 0) # reset compressor
#TODO: Calculate from the image size?
"""
#How it was
self.x393Cmprs.setup_compressor_channel (
chn = num_sensor,
qbank = 0,
dc_sub = True,
cmode = vrlg.CMPRS_CBIT_CMODE_JPEG18,
# cmode = vrlg.CMPRS_CBIT_CMODE_JP4,
multi_frame = True,
bayer = 0,
focus_mode = 0,
num_macro_cols_m1 = num_macro_cols_m1,
num_macro_rows_m1 = num_macro_rows_m1,
left_margin = compressor_left_margin,
colorsat_blue = colorsat_blue,
colorsat_red = colorsat_red,
coring = 0,
verbose = verbose)
# TODO: calculate widths correctly!
if exit_step == 14: return False
tile_margin = 2 # 18x18 instead of 16x16
left_tiles32 = window_left // 32
# last_tile32 = (window_left + (window_width & ~0xf) + tile_margin - 1) // 32
last_tile32 = (window_left + ((num_macro_cols_m1 + 1) * 16) + tile_margin - 1) // 32
width32 = last_tile32 - left_tiles32 + 1 # number of 32-wide tiles needed in each row
if (verbose > 0) :
print ("setup_compressor_memory:")
print ("num_sensor = ", num_sensor)
print ("frame_sa = 0x%x"%(frame_start_address))
print ("frame_sa_inc = 0x%x"%(frame_start_address_inc))
print ("last_frame_num = 0x%x"%(last_buf_frame))
print ("frame_full_width = 0x%x"%(frame_full_width))
print ("window_width = 0x%x"%(width32 * 2 )) # window_width >> 4)) # width in 16 - bursts, made evem
print ("window_height = 0x%x"%(window_height & 0xfffffff0))
print ("window_left = 0x%x"%(left_tiles32 * 2)) # window_left >> 4)) # left in 16-byte bursts, made even
print ("window_top = 0x%x"%(window_top))
print ("byte32 = 1")
print ("tile_width = 2")
print ("tile_vstep = 16")
print ("tile_height = 18")
print ("extra_pages = 1")
print ("disable_need = 1")
print ("abort_late = 0")
self.x393Cmprs.setup_compressor_memory (
num_sensor = num_sensor,
frame_sa = frame_start_address, # input [31:0] frame_sa; # 22-bit frame start address ((3 CA LSBs==0. BA==0)
frame_sa_inc = frame_start_address_inc, # input [31:0] frame_sa_inc; # 22-bit frame start address increment ((3 CA LSBs==0. BA==0)
last_frame_num = last_buf_frame, # input [31:0] last_frame_num; # 16-bit number of the last frame in a buffer
frame_full_width = frame_full_width, # input [31:0] frame_full_width; # 13-bit Padded line length (8-row increment), in 8-bursts (16 bytes)
window_width = (width32 * 2 ), # input [31:0] window_width; # 13 bit - in 8*16=128 bit bursts
window_height = window_height & 0xfffffff0, # input [31:0] window_height; # 16 bit
window_left = left_tiles32 * 2, # input [31:0] window_left;
window_top = window_top, # input [31:0] window_top;
byte32 = 1,
tile_width = 2,
tile_vstep = 16,
tile_height = 18,
extra_pages = 1,
disable_need = 1,
abort_late = False)
"""
# replacing with setup compressor:
self.setup_compressor(chn = num_sensor,
cmode = cmode,
bit16 = bit16,
qbank = 0,
dc_sub = True,
multi_frame = True,
......@@ -1165,6 +1110,7 @@ class X393SensCmprs(object):
def setup_compressor(self,
chn,
cmode = 0, # vrlg.CMPRS_CBIT_CMODE_JPEG18,
bit16 = bit16,
bayer = 0,
qbank = 0,
dc_sub = 1,
......@@ -1195,6 +1141,8 @@ class X393SensCmprs(object):
CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = 10 - jp4, 4 blocks, differential, hdr,divide by 2
CMPRS_CBIT_CMODE_MONO1 = 11 - mono JPEG (not yet implemented)
CMPRS_CBIT_CMODE_MONO4 = 14 - mono 4 blocks
CMPRS_CBIT_CMODE_RAW = 15 - raw (uncompressed) mode
@param bit16 - 16-bit (2 bytes per pixel) mode
@param qbank - quantization table page (0..15)
@param dc_sub - True - subtract DC before running DCT, False - no subtraction, convert as is,
@param multi_frame - False - single-frame buffer, True - multi-frame video memory buffer,
......@@ -1219,6 +1167,7 @@ class X393SensCmprs(object):
self. setup_compressor( #self,
chn = chn,
cmode = cmode,
bit16 = bit16,
qbank = qbank,
dc_sub = dc_sub,
multi_frame = multi_frame,
......@@ -1251,35 +1200,6 @@ class X393SensCmprs(object):
num_sensor = chn # 1:1 sensor - compressor
align_to_bursts = 64 # align full width to multiple of align_to_bursts. 64 is the size of memory access
"""
overlap = 0 # tile overlap (total - 2 for JPEG18, 4 - for JPEG20, 0 otherwise
cmprs_top = 0 # 1 for JPEG18 only, 0 for others (also is used for compressor left)
if cmode == vrlg.CMPRS_CBIT_CMODE_JPEG18:
overlap = 2
cmprs_top = 1
elif cmode == vrlg.CMPRS_CBIT_CMODE_JPEG20:
overlap = 4
if overlap:
window_width += (2 * COLOR_MARGINS)
window_height += (2 * COLOR_MARGINS)
tile_width = 2
else:
tile_width = 4
# cmprs_frame_format.left_margin = cmprs_top; // same as top - only for 18x18 tiles to keep Bayer shift (0/1)
width_bursts = window_width >> 4
if window_width & 0xf:
width_bursts += 1
# Adjusting for tile width. TODO: probably not needed, handled in FPGA - verify (and remove 2 next lines)
if width_bursts & 1:
width_bursts += 1
if (tile_width > 2) and (width_bursts & 2):
width_bursts += 2
tile_height = 16 + overlap;
"""
width_in_bursts = window_width >> 4
if (window_width & 0xf):
......@@ -1306,7 +1226,19 @@ class X393SensCmprs(object):
frame_start_address_inc = FRAME_START_ADDRESS_INC #Fixed size
num_macro_cols_m1 = (window_width >> 4) - 1
num_macro_rows_m1 = (window_height >> 4) - 1
if (cmode == vrlg.CMPRS_CBIT_CMODE_RAW) and (bit16):
num_macro_cols_m1 = ((window_width >> 4) << 1) - 1
else:
num_macro_cols_m1 = (window_width >> 4) - 1
if (cmode == vrlg.CMPRS_CBIT_CMODE_RAW):
num_macro_rows_m1 = (window_height >> 4) - 1
cmprs_mem_height = window_height
else:
num_macro_rows_m1 = (window_height -1) >> 4
cmprs_mem_height = window_height & 0xfff0
frame_start_address = (last_buf_frame + 1) * frame_start_address_inc * num_sensor
self.x393Cmprs.setup_compressor_channel (
......@@ -1314,11 +1246,13 @@ class X393SensCmprs(object):
qbank = qbank,
dc_sub = dc_sub,
cmode = cmode, # vrlg.CMPRS_CBIT_CMODE_JPEG18,
bit16 = bit16,
multi_frame = True,
bayer = bayer,
focus_mode = focus_mode,
num_macro_cols_m1 = num_macro_cols_m1,
num_macro_rows_m1 = num_macro_rows_m1,
row_lsb_raw = (window_height -1) & 0xf,
left_margin = compressor_left_margin,
colorsat_blue = colorsat_blue,
colorsat_red = colorsat_red,
......@@ -1350,7 +1284,7 @@ class X393SensCmprs(object):
print ("last_frame_num = 0x%x"%(last_buf_frame))
print ("frame_full_width = 0x%x"%(frame_full_width))
print ("window_width = 0x%x (in 16 - bursts, made even)"%(width32 * 2 )) # window_width >> 4)) # width in 16 - bursts, made even
print ("window_height = 0x%x"%(window_height & 0xfffffff0))
print ("window_height = 0x%x"%(cmprs_mem_height)) # window_height & 0xfffffff0))
print ("window_left = 0x%x"%(left_tiles32 * 2)) # window_left >> 4)) # left in 16-byte bursts, made even
print ("window_top = 0x%x"%(window_top))
print ("byte32 = 1")
......@@ -1368,7 +1302,9 @@ class X393SensCmprs(object):
last_frame_num = last_buf_frame, # input [31:0] last_frame_num; # 16-bit number of the last frame in a buffer
frame_full_width = frame_full_width, # input [31:0] frame_full_width; # 13-bit Padded line length (8-row increment), in 8-bursts (16 bytes)
window_width = (width32 * 2 ), # input [31:0] window_width; # 13 bit - in 8*16=128 bit bursts
window_height = window_height & 0xfffffff0, # input [31:0] window_height; # 16 bit
window_height = cmprs_mem_height, # window_height & 0xfffffff0, # input [31:0] window_height; # 16 bit
window_left = left_tiles32 * 2, # input [31:0] window_left;
window_top = window_top, # input [31:0] window_top;
byte32 = 1,
......@@ -1736,7 +1672,7 @@ class X393SensCmprs(object):
self.x393Sensor.print_status_sensor_i2c (num_sensor = num_sensor)
if verbose >0 :
print ("===================== I2C_SETUP =========================")
print ("===================== I2C_SETUP Sensortype - %s ========================="%(sensorType))
slave_addr = SENSOR_DEFAULTS[sensorType]["slave"]
i2c_delay= SENSOR_DEFAULTS[sensorType]["i2c_delay"]
......@@ -1815,6 +1751,30 @@ class X393SensCmprs(object):
num_bytes_rd = 2,
bit_delay = i2c_delay,
verbose = verbose)
elif sensorType == x393_sensor.SENSOR_INTERFACE_LWIR:
#slave address 0x2a(of 0x7f)
#address - 16bit, data 16 bits
for page in (0, # Most of the commands
0xf8,0xf9,0xfa,0xfb, # Block DATA Buffer 0 (page 10 of FLIR LEPTON(R) Software IDD)
0xfc,0xfd,0xfe,0xff): # Block DATA Buffer 1 (page 10 of FLIR LEPTON(R) Software IDD)
self.x393Sensor.set_sensor_i2c_table_reg_wr (
num_sensor = num_sensor,
page = page,
slave_addr = slave_addr,
rah = page,
num_bytes = 4,
bit_delay = i2c_delay,
verbose = verbose)
self.x393Sensor.set_sensor_i2c_table_reg_rd ( # last page used for read
num_sensor = num_sensor,
page = 0x01,
two_byte_addr = 1,
num_bytes_rd = 2,
bit_delay = i2c_delay,
verbose = verbose)
else:
raise ("Unknown sensor type: %s"%(sensorType))
......@@ -1830,6 +1790,7 @@ class X393SensCmprs(object):
if exit_step == 21: return False
# not used for LWIR
self.x393Camsync.camsync_setup (
sensor_mask = sensor_mask,
trigger_mode = False, # False - async (free running) sensor mode, True - triggered (global reset) sensor mode
......@@ -2541,6 +2502,7 @@ jpeg_write "img.jpeg" 0 100 None False 0 "/www/pages/" 3
y_quality = None,
c_quality = None, # use "same" to save None
cmode = 0, # vrlg.CMPRS_CBIT_CMODE_JPEG18,
bit16 = 0,
bayer = 3, #0, as in simulator
window_width = 66,
window_height = 36,
......@@ -2571,6 +2533,8 @@ jpeg_write "img.jpeg" 0 100 None False 0 "/www/pages/" 3
CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = 10 - jp4, 4 blocks, differential, hdr,divide by 2
CMPRS_CBIT_CMODE_MONO1 = 11 - mono JPEG (not yet implemented)
CMPRS_CBIT_CMODE_MONO4 = 14 - mono 4 blocks
CMPRS_CBIT_CMODE_RAW = 15 - raw (unclmpressed) mode
@param bit16 - 16 bit (2-byte per pixel) mode
@param bayer - Bayer shift (0..3)
@param window_width - window width in pixels (bytes) (TODO: add 16-bit mode)
@param window_height - window height in lines
......@@ -2669,6 +2633,7 @@ jpeg_write "img.jpeg" 0 100 None False 0 "/www/pages/" 3
# setup compressor memory and mode
self. setup_compressor(chn = chn,
cmode = cmode,
bit16 = bit16,
qbank = qbank,
dc_sub = True,
multi_frame = False,
......
......@@ -176,8 +176,15 @@ class X393Sensor(object):
print ("print_status_sensor_io(%d):"%(num_sensor))
if (sensorType == SENSOR_INTERFACE_LWIR):
pass
print (" segment_id = %d"%((status>> 0) & 0x0f))
print (" gpio_in = %d"%((status>> 4) & 0x0f))
print (" in_busy = %d"%((status>> 8) & 1))
print (" out_busy = %d"%((status>> 9) & 1))
print (" crc_err = %d"%((status>>10) & 1))
print (" fake_in = %d"%((status>>11) & 1))
print (" senspgmin = %d"%((status>>24) & 1))
print (" busy = %d"%((status>>25) & 1))
print (" seq = %d"%((status>>26) & 0x3f))
else:
#last_in_line_1cyc_mclk, dout_valid_1cyc_mclk
"""
......@@ -446,6 +453,76 @@ class X393Sensor(object):
rslt |= (quadrants & ((1 << vrlg.SENS_CTRL_QUADRANTS_WIDTH) - 1)) << vrlg.SENS_CTRL_QUADRANTS
return rslt
def func_sensor_io_ctl_lwir (self,
mrst = None,
pwdn = None,
mclk = None,
spi_en = None, # 1 - reset+disable, 2 - noreset, disable, 3 - noreset, enable
segm_zero = None,
out_en = None,
out_single = False,
reset_crc = False,
spi_clk = None,
gpio0 = None,
gpio1 = None,
gpio2 = None,
gpio3 = None,
fake = None,
mosi = None):
"""
Combine sensor I/O control parameters into a control word
@param mrst - True - activate MRST signal (low), False - deactivate MRST (high), None - no change
@param pwdn - True - activate POWER_DOWN signal (low), False - deactivate POWER_DOWN (high), None - no change
@param mclk - True - enable master clock (25MHz) to sensor, False - disable, None - no change
@param spi_en - True - SPI reset/enable: 0 - NOP, 1 - reset+disable, 2 - noreset, disable, 3 - noreset, enable, None - no change
@param segm_zero = True - allow receiving segment ID==0 (ITAR invalid), False - disallow, None - no change,
@param out_en = True - enable continuously receiving data to memory, False - disable, None - no change
@param out_single = True - acquire single frame,
@param reset_crc = True - reset CRC error status bit,
@param spi_clk = True - generate SPI clock during inactive SPI CS, False - do not generate SPI CLK when CS is inactive, None - no change
@param gpio0 = Output control for GPIO0: 0 - nop, 1 - set low, 2 - set high, 3 - input
@param gpio1 = Output control for GPIO0: 1 - nop, 1 - set low, 2 - set high, 3 - input
@param gpio2 = Output control for GPIO0: 2 - nop, 1 - set low, 2 - set high, 3 - input
@param gpio3 = Output control for GPIO0: 3 - nop, 1 - set low, 2 - set high, 3 - input
@param fake = Do not use, just for keeping hardware portsNone,
@param mosi = Do not use, just for keeping hardware portsNone,
@return LWIR sensor i/o control word
"""
rslt = 0
if not mrst is None:
rslt |= (3,2)[mrst] << vrlg.VOSPI_MRST
if not pwdn is None:
rslt |= (3,2)[pwdn] << vrlg.VOSPI_PWDN
if not mclk is None:
rslt |= (2,3)[mclk] << vrlg.VOSPI_MCLK
if not spi_en is None:
rslt |= (spi_en & 3) << vrlg.VOSPI_EN
if not segm_zero is None:
rslt |= (2,3)[segm_zero] << vrlg.VOSPI_SEGM0_OK
if not out_en is None:
rslt |= (2,3)[out_en] << vrlg.VOSPI_OUT_EN
if out_single:
rslt |= 1 << vrlg.VOSPI_OUT_EN_SINGL
if reset_crc:
rslt |= 1 << vrlg.VOSPI_RESET_CRC
if not out_en is None:
rslt |= (2,3)[spi_clk] << vrlg.VOSPI_SPI_CLK
if not gpio0 is None:
rslt |= (gpio0 & 3) << (vrlg.VOSPI_GPIO + 0)
if not gpio1 is None:
rslt |= (gpio1 & 3) << (vrlg.VOSPI_GPIO + 2)
if not gpio2 is None:
rslt |= (gpio2 & 3) << (vrlg.VOSPI_GPIO + 4)
if not gpio3 is None:
rslt |= (gpio3 & 3) << (vrlg.VOSPI_GPIO + 6)
if fake:
rslt |= 1 << vrlg.VOSPI_FAKE_OUT
if fake:
mosi |= 1 << vrlg.VOSPI_MOSI
return rslt
def func_sensor_jtag_ctl(self,
pgmen = None, # <2: keep PGMEN, 2 - PGMEN low (inactive), 3 - high (active) enable JTAG control
prog = None, # <2: keep prog, 2 - prog low (active), 3 - high (inactive) ("program" pin control)
......@@ -963,6 +1040,84 @@ class X393Sensor(object):
reg_addr = (vrlg.SENSOR_GROUP_ADDR + num_sensor * vrlg.SENSOR_BASE_INC) + vrlg.SENSIO_RADDR + vrlg.SENSIO_CTRL;
self.x393_axi_tasks.write_control_register(reg_addr, data)
# TODO: Make one for HiSPi (it is different)
def set_sensor_io_ctl_lwir (self,
mrst = None,
pwdn = None,
mclk = None,
spi_en = None, # 1 - reset+disable, 2 - noreset, disable, 3 - noreset, enable
segm_zero = None,
out_en = None,
out_single = False,
reset_crc = False,
spi_clk = None,
gpio0 = None,
gpio1 = None,
gpio2 = None,
gpio3 = None,
fake = None,
mosi = None):
"""
Combine sensor I/O control parameters into a control word
@param mrst - True - activate MRST signal (low), False - deactivate MRST (high), None - no change
@param pwdn - True - activate POWER_DOWN signal (low), False - deactivate POWER_DOWN (high), None - no change
@param mclk - True - enable master clock (25MHz) to sensor, False - disable, None - no change
@param spi_en - True - SPI reset/enable: 0 - NOP, 1 - reset+disable, 2 - noreset, disable, 3 - noreset, enable, None - no change
@param segm_zero = True - allow receiving segment ID==0 (ITAR invalid), False - disallow, None - no change,
@param out_en = True - enable continuously receiving data to memory, False - disable, None - no change
@param out_single = True - acquire single frame,
@param reset_crc = True - reset CRC error status bit,
@param spi_clk = True - generate SPI clock during inactive SPI CS, False - do not generate SPI CLK when CS is inactive, None - no change
@param gpio0 = Output control for GPIO0: 0 - nop, 1 - set low, 2 - set high, 3 - input
@param gpio1 = Output control for GPIO0: 1 - nop, 1 - set low, 2 - set high, 3 - input
@param gpio2 = Output control for GPIO0: 2 - nop, 1 - set low, 2 - set high, 3 - input
@param gpio3 = Output control for GPIO0: 3 - nop, 1 - set low, 2 - set high, 3 - input
@param fake = Do not use, just for keeping hardware portsNone,
@param mosi = Do not use, just for keeping hardware portsNone,
@return LWIR sensor i/o control word
"""
try:
if (num_sensor == all) or (num_sensor[0].upper() == "A"): #all is a built-in function
for num_sensor in range(4):
self.set_sensor_io_ctl_lwir (num_sensor,
mrst = mrst,
pwdn = pwdn,
mclk = mclk,
spi_en = spi_en,
segm_zero = segm_zero,
out_en = out_en,
out_single = out_single,
reset_crc = reset_crc,
spi_clk = spi_clk,
gpio0 = gpio0,
gpio1 = gpio1,
gpio2 = gpio2,
gpio3 = gpio3,
fake = fake,
mosi = mosi)
return
except:
pass
data = self.func_sensor_io_ctl_lwir (
mrst = mrst,
pwdn = pwdn,
mclk = mclk,
spi_en = spi_en,
segm_zero = segm_zero,
out_en = out_en,
out_single = out_single,
reset_crc = reset_crc,
spi_clk = spi_clk,
gpio0 = gpio0,
gpio1 = gpio1,
gpio2 = gpio2,
gpio3 = gpio3,
fake = fake,
mosi = mosi)
reg_addr = (vrlg.SENSOR_GROUP_ADDR + num_sensor * vrlg.SENSOR_BASE_INC) + vrlg.SENSIO_RADDR + vrlg.SENSIO_CTRL;
self.x393_axi_tasks.write_control_register(reg_addr, data)
def set_sensor_io_dly_parallel (self,
num_sensor,
mmcm_phase,
......
......@@ -2142,6 +2142,8 @@ assign axi_grst = axi_rst_pre;
.CMPRS_CBIT_BAYER_BITS (CMPRS_CBIT_BAYER_BITS),
.CMPRS_CBIT_FOCUS (CMPRS_CBIT_FOCUS),
.CMPRS_CBIT_FOCUS_BITS (CMPRS_CBIT_FOCUS_BITS),
.CMPRS_CBIT_ROWS_LSB (CMPRS_CBIT_ROWS_LSB),
.CMPRS_CBIT_ROWS_LSB_BITS (CMPRS_CBIT_ROWS_LSB_BITS),
.CMPRS_CBIT_RUN_RST (CMPRS_CBIT_RUN_RST),
.CMPRS_CBIT_RUN_STANDALONE (CMPRS_CBIT_RUN_STANDALONE),
.CMPRS_CBIT_RUN_ENABLE (CMPRS_CBIT_RUN_ENABLE),
......
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