Commit a5c0516e authored by Andrey Filippov's avatar Andrey Filippov

passed big endian in 16-bit mode from Python simulation/implementation script

parent 05f323bf
...@@ -114,7 +114,8 @@ class X393Cmprs(object): ...@@ -114,7 +114,8 @@ class X393Cmprs(object):
multi_frame = None, multi_frame = None,
bayer = None, bayer = None,
focus_mode = None, focus_mode = None,
row_lsb_raw = None): row_lsb_raw = None,
be16 = None):
""" """
Combine compressor control parameters into a single word. None value preserves old setting for the parameter 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 @param run_mode - 0 - reset, 2 - run single from memory, 3 - run repetitive
...@@ -138,6 +139,7 @@ class X393Cmprs(object): ...@@ -138,6 +139,7 @@ class X393Cmprs(object):
@param bayer - Bayer shift (0..3) @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 @param row_lsb_raw - four LSBs of the window height - used in raw mode
@param be16 - big endian 16-bit mode (1 for 16-bit raw)
@return combined data word @return combined data word
""" """
data = 0; data = 0;
...@@ -161,6 +163,10 @@ class X393Cmprs(object): ...@@ -161,6 +163,10 @@ class X393Cmprs(object):
data |= (1 << vrlg.CMPRS_CBIT_FRAMES) data |= (1 << vrlg.CMPRS_CBIT_FRAMES)
data |= (multi_frame & ((1 << vrlg.CMPRS_CBIT_FRAMES_BITS) - 1)) << (vrlg.CMPRS_CBIT_FRAMES - vrlg.CMPRS_CBIT_FRAMES_BITS) data |= (multi_frame & ((1 << vrlg.CMPRS_CBIT_FRAMES_BITS) - 1)) << (vrlg.CMPRS_CBIT_FRAMES - vrlg.CMPRS_CBIT_FRAMES_BITS)
if not be16 is None:
data |= (1 << vrlg.CMPRS_CBIT_BE16)
data |= (bayer & ((1 << vrlg.CMPRS_CBIT_BE16_BITS) - 1)) << (vrlg.CMPRS_CBIT_BE16 - vrlg.CMPRS_CBIT_BE16_BITS)
if not bayer is None: if not bayer is None:
data |= (1 << vrlg.CMPRS_CBIT_BAYER) data |= (1 << vrlg.CMPRS_CBIT_BAYER)
data |= (bayer & ((1 << vrlg.CMPRS_CBIT_BAYER_BITS) - 1)) << (vrlg.CMPRS_CBIT_BAYER - vrlg.CMPRS_CBIT_BAYER_BITS) data |= (bayer & ((1 << vrlg.CMPRS_CBIT_BAYER_BITS) - 1)) << (vrlg.CMPRS_CBIT_BAYER - vrlg.CMPRS_CBIT_BAYER_BITS)
...@@ -223,8 +229,8 @@ class X393Cmprs(object): ...@@ -223,8 +229,8 @@ class X393Cmprs(object):
cmode = None, cmode = None,
multi_frame = None, multi_frame = None,
bayer = None, bayer = None,
focus_mode = None, row_lsb_raw = None,
row_lsb_raw = None): be16 = None):
""" """
Combine compressor control parameters into a single word. None value preserves old setting for the parameter 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 @param chn - compressor channel number, "a" or "all" - same for all 4 channels
...@@ -249,6 +255,7 @@ class X393Cmprs(object): ...@@ -249,6 +255,7 @@ class X393Cmprs(object):
@param bayer - Bayer shift (0..3) @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 @param row_lsb_raw - four LSBs of the window height - used in raw mode
@param be16 - big endian 16-bit mode (1 for 16-bit raw)
""" """
try: try:
if (chn == all) or (chn[0].upper() == "A"): #all is a built-in function if (chn == all) or (chn[0].upper() == "A"): #all is a built-in function
...@@ -261,7 +268,8 @@ class X393Cmprs(object): ...@@ -261,7 +268,8 @@ class X393Cmprs(object):
multi_frame = multi_frame, multi_frame = multi_frame,
bayer = bayer, bayer = bayer,
focus_mode = focus_mode, focus_mode = focus_mode,
row_lsb_raw = row_lsb_raw) row_lsb_raw = row_lsb_raw,
be16 = be16)
return return
except: except:
pass pass
...@@ -273,7 +281,9 @@ class X393Cmprs(object): ...@@ -273,7 +281,9 @@ class X393Cmprs(object):
multi_frame = multi_frame, multi_frame = multi_frame,
bayer = bayer, bayer = bayer,
focus_mode = focus_mode, focus_mode = focus_mode,
row_lsb_raw = row_lsb_raw) row_lsb_raw = row_lsb_raw,
be16 = be16)
self.x393_axi_tasks.write_control_register(vrlg.CMPRS_GROUP_ADDR + chn * vrlg.CMPRS_BASE_INC + vrlg.CMPRS_CONTROL_REG, self.x393_axi_tasks.write_control_register(vrlg.CMPRS_GROUP_ADDR + chn * vrlg.CMPRS_BASE_INC + vrlg.CMPRS_CONTROL_REG,
data) data)
...@@ -597,7 +607,8 @@ class X393Cmprs(object): ...@@ -597,7 +607,8 @@ class X393Cmprs(object):
multi_frame = multi_frame, # [15:14] 0 - single-frame buffer, 1 - multiframe video memory buffer multi_frame = multi_frame, # [15:14] 0 - single-frame buffer, 1 - multiframe video memory buffer
bayer = bayer, # [20:18] # Bayer shift bayer = bayer, # [20:18] # Bayer shift
focus_mode = focus_mode, # [23:21] Set focus mode focus_mode = focus_mode, # [23:21] Set focus mode
row_lsb_raw = row_lsb_raw) # [3:0] LSBs of the window height that do not fit into compressor format row_lsb_raw = row_lsb_raw, # [3:0] LSBs of the window height that do not fit into compressor format
be16 = bits16) # swap bytes in compressor channel
self.compressor_format( self.compressor_format(
chn = chn, # compressor channel number (0..3) chn = chn, # compressor channel number (0..3)
......
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