Commit 7a3e1480 authored by Andrey Filippov's avatar Andrey Filippov

Continue porting pgm_functions

parent 196a40df
This diff is collapsed.
...@@ -6,6 +6,13 @@ ...@@ -6,6 +6,13 @@
int init_pgm_proc(void); int init_pgm_proc(void);
int add_sensor_proc(int index, int (*sens_func)(int sensor_port, struct sensor_t * , struct framepars_t * , struct framepars_t *, int )); int add_sensor_proc(int index, int (*sens_func)(int sensor_port, struct sensor_t * , struct framepars_t * , struct framepars_t *, int ));
/// Commands through sequencer: switch between ASAP (frame <0) and absolute
/// @param port - sensor port (0..3)
/// @param frame - <0 for ASAP command, otherwise absolute frame number to program for 4 LSB only are used)
/// @param func - part of the command write through sequencer w/o 'seqr_/seqa_ prefix
/// @param data - appropriate data type (matching function definition) to be written
#define X393_SEQ_SEND1(port,frame,func,data) {if ((frame) < 0) seqr_##func (0, (data), (port)); \
else seqa_##func ((frame), (data), (port)); }
/** Tells if parameter is modifies /** Tells if parameter is modifies
......
This diff is collapsed.
...@@ -16,8 +16,3 @@ ...@@ -16,8 +16,3 @@
*******************************************************************************/ *******************************************************************************/
//typedef enum {DIRECT,ABSOLUTE,RELATIVE} x393cmd_t; //typedef enum {DIRECT,ABSOLUTE,RELATIVE} x393cmd_t;
#include "x393.h" #include "x393.h"
int setup_sensor_memory (int num_sensor, int frame_sa, int frame_sa_inc, int last_frame_num, int frame_full_width,
int window_width, int window_height, int window_left, int window_top, x393cmd_t x393cmd, int frame16);
int setup_compressor_memory (int num_sensor, int frame_sa, int frame_sa_inc, int last_frame_num, int frame_full_width,
int window_width, int window_height, int window_left, int window_top, int byte32, int tile_width, int tile_vstep,
int tile_height, int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16);
...@@ -91,6 +91,9 @@ int setup_sensor_memory (int num_sensor, ///< sensor port number (0..3) ...@@ -91,6 +91,9 @@ int setup_sensor_memory (int num_sensor, ///< sensor port number (0..3)
window_left_top.top = window_top; window_left_top.top = window_top;
switch (x393cmd){ switch (x393cmd){
case ASAP:
frame16 = 0;
// no break
case RELATIVE: case RELATIVE:
seqr_x393_sens_mcntrl_scanline_startaddr (frame16, window_frame_sa, num_sensor); // Set frame start address seqr_x393_sens_mcntrl_scanline_startaddr (frame16, window_frame_sa, num_sensor); // Set frame start address
seqr_x393_sens_mcntrl_scanline_frame_size (frame16, window_frame_sa_inc, num_sensor); // Set frame size (address increment) seqr_x393_sens_mcntrl_scanline_frame_size (frame16, window_frame_sa_inc, num_sensor); // Set frame size (address increment)
...@@ -129,8 +132,10 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3 ...@@ -129,8 +132,10 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3
int window_height, ///< 16-bit window height (in scan lines) int window_height, ///< 16-bit window height (in scan lines)
int window_left, ///< 13-bit window left margin in 8-bursts (16 bytes) int window_left, ///< 13-bit window left margin in 8-bursts (16 bytes)
int window_top, ///< 16-bit window top margin (in scan lines int window_top, ///< 16-bit window top margin (in scan lines
int tile_width, ///< tile width in pixels int tile_width, ///< tile width in bjursts (16-pixels each)
int tile_height, ///< tile height: 18 for color JPEG, 16 for JP4 flavors // = 18 int tile_height, ///< tile height: 18 for color JPEG, 16 for JP4 flavors // = 18
int tile_vstep, ///< tile vertical step in pixel rows (JPEG18/jp4 = 16) // = 16
int extra_pages, ///< extra pages needed (1) - number of previous pages to keep in a 4-page buffer
int disable_need, ///< disable "need" (yield to sensor channels - they can not wait) int disable_need, ///< disable "need" (yield to sensor channels - they can not wait)
x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer
int frame16) ///< Frame number the command should be applied to (if not immediate mode) int frame16) ///< Frame number the command should be applied to (if not immediate mode)
...@@ -141,8 +146,6 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3 ...@@ -141,8 +146,6 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3
int frame_sa_inc = frame_full_width * (buffer_settings.frame_height[num_sensor] >>3); int frame_sa_inc = frame_full_width * (buffer_settings.frame_height[num_sensor] >>3);
int last_frame_num = buffer_settings.frames_in_buffer[num_sensor] - 1; int last_frame_num = buffer_settings.frames_in_buffer[num_sensor] - 1;
int byte32 = 1; ///< 1 - 32-byte columns (currently used), 0 - 16 byte columns int byte32 = 1; ///< 1 - 32-byte columns (currently used), 0 - 16 byte columns
int tile_vstep = 16; ///< tile vertical step in pixel rows (JPEG18/jp4 = 16) // = 16
int extra_pages = 1; ///< extra pages needed (1) - number of previous pages to keep in a 4-page buffer
x393_mcntrl_mode_scan_t mcntrl_mode = {.enable = 1, // [ 0] (1) enable requests from this channel ( 0 will let current to finish, but not raise want/need) x393_mcntrl_mode_scan_t mcntrl_mode = {.enable = 1, // [ 0] (1) enable requests from this channel ( 0 will let current to finish, but not raise want/need)
.chn_nreset = 0, // [ 1] (1) 0: immediately reset all the internal circuitry .chn_nreset = 0, // [ 1] (1) 0: immediately reset all the internal circuitry
...@@ -179,6 +182,9 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3 ...@@ -179,6 +182,9 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3
mcntrl_mode.extra_pages = extra_pages; // non-constant parameter mcntrl_mode.extra_pages = extra_pages; // non-constant parameter
switch (x393cmd){ switch (x393cmd){
case ASAP:
frame16 = 0;
// no break
case RELATIVE: case RELATIVE:
seqr_x393_sens_mcntrl_tiled_startaddr (frame16, window_frame_sa, num_sensor); // Set frame start address seqr_x393_sens_mcntrl_tiled_startaddr (frame16, window_frame_sa, num_sensor); // Set frame start address
seqr_x393_sens_mcntrl_tiled_frame_size (frame16, window_frame_sa_inc, num_sensor); // Set frame size (address increment) seqr_x393_sens_mcntrl_tiled_frame_size (frame16, window_frame_sa_inc, num_sensor); // Set frame size (address increment)
......
...@@ -23,3 +23,9 @@ struct elphel_video_buf_t ...@@ -23,3 +23,9 @@ struct elphel_video_buf_t
int frames_in_buffer[4]; ///< Number of frames in channel 0 buffer int frames_in_buffer[4]; ///< Number of frames in channel 0 buffer
}; };
int setup_sensor_memory (int num_sensor, int window_width, int window_height, int window_left,
int window_top, x393cmd_t x393cmd, int frame16);
int setup_compressor_memory (int num_sensor, int window_width, int window_height, int window_left,
int window_top, int tile_width, int tile_height, int tile_vstep,
int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16);
...@@ -293,10 +293,10 @@ ...@@ -293,10 +293,10 @@
<li> bit 2 - async (snapshot, ext trigger) mode, 0 - continuous NOTE: Only this bit is used now <li> bit 2 - async (snapshot, ext trigger) mode, 0 - continuous NOTE: Only this bit is used now
<li> bit 3 - no overlap, single frames: program - acquire/compress same frame</ul>*/ <li> bit 3 - no overlap, single frames: program - acquire/compress same frame</ul>*/
#define P_BGFRAME 16 ///< Background measurement mode - will use 16-bit mode and no FPN correction #define P_BGFRAME 16 ///< Background measurement mode - will use 16-bit mode and no FPN correction
#define P_IMGSZMEM 17 ///< image size in video memory (calculated when channel 0 is programmed) #define P_IMGSZMEM 17 ///< image size in video memory (calculated when channel 0 is programmed) NC393: Not used ???
// image page numbers depend on image size/pixel depth, so changing any of them will invalidate all pages // image page numbers depend on image size/pixel depth, so changing any of them will invalidate all pages
#define P_PAGE_ACQ 18 ///< Number of image page buffer to acquire to (0.1?) #define P_PAGE_ACQ 18 ///< Number of image page buffer to acquire to (0.1?) NC393: Not used ???
#define P_PAGE_READ 19 ///< Number of image page buffer to read from to (0.1?) #define P_PAGE_READ 19 ///< Number of image page buffer to read from to (0.1?) NC393: Not used ???
#define P_OVERLAP 20 ///< number of EXRA lines to be acquired - probably dead, #define P_OVERLAP 20 ///< number of EXRA lines to be acquired - probably dead,
#define P_VIRT_KEEP 21 ///< 0 - recalculate P_VIRT_WIDTH, P_VIRT_HEIGHT when window is changed, 1 - keep those parameters #define P_VIRT_KEEP 21 ///< 0 - recalculate P_VIRT_WIDTH, P_VIRT_HEIGHT when window is changed, 1 - keep those parameters
#define P_VIRT_WIDTH 22 ///< Virtual window width #define P_VIRT_WIDTH 22 ///< Virtual window width
...@@ -312,7 +312,8 @@ ...@@ -312,7 +312,8 @@
#define P_BIN_HOR 32 ///< binning 1/2 - KAC1310 only - now for mt9t001 #define P_BIN_HOR 32 ///< binning 1/2 - KAC1310 only - now for mt9t001
#define P_BIN_VERT 33 ///< not used yet binning 1/2 - KAC1310 only - now for mt9t001 #define P_BIN_VERT 33 ///< not used yet binning 1/2 - KAC1310 only - now for mt9t001
#define P_FPGATEST 34 ///< FPGA test modes (now - just one) #define P_FPGATEST 34 ///< FPGA test modes (now - just one)
#define P_FRAMESYNC_DLY 35 ///< maybe - temporary - delay of frame sync (vacts) by number of scan lines - for photofinish mode #define P_FRAMESYNC_DLY 35 ///< maybe - temporary - delay of frame sync (vacts) by number of scan lines - for photofinish mode // not used anywhere?
///< Lower bits 16 will be used to delay frame sync, bit 16 - use internal HACT duration (0 - use from sensor) [*]
#define P_PF_HEIGHT 36 ///< height of each strip in photofinish mode - normally 2 lines #define P_PF_HEIGHT 36 ///< height of each strip in photofinish mode - normally 2 lines
///< also now includes timestamping mode +0x10000 - for normal frames, 0x20000 - for photo-finish ///< also now includes timestamping mode +0x10000 - for normal frames, 0x20000 - for photo-finish
#define P_BITS 37 ///< pixel depth - bits 10/8/4 #define P_BITS 37 ///< pixel depth - bits 10/8/4
...@@ -331,7 +332,7 @@ ...@@ -331,7 +332,7 @@
#define P_SENSOR_PIXV 46 ///< (readonly) pixels to be read from the sensor, vertical (including margins) #define P_SENSOR_PIXV 46 ///< (readonly) pixels to be read from the sensor, vertical (including margins)
#define P_FATZERO 47 ///< subtract while adding data from to consecutive frames (async trigger) #define P_FATZERO 47 ///< subtract while adding data from to consecutive frames (async trigger)
#define P_COMPMOD_TILSH 48 ///< Horizontal tiles - obsolete in 393? #define P_COMPMOD_TILSH 48 ///< Horizontal tiles - obsolete in 393? YES
#define P_COMPMOD_DCSUB 49 ///< Subtract DC in compressor before DCT #define P_COMPMOD_DCSUB 49 ///< Subtract DC in compressor before DCT
#define P_COMPMOD_QTAB 50 ///< to be written not directly, but by pgm_quality ? #define P_COMPMOD_QTAB 50 ///< to be written not directly, but by pgm_quality ?
...@@ -459,8 +460,8 @@ ...@@ -459,8 +460,8 @@
// 393: Are they the same? // 393: Are they the same?
#define P_COLOR 135 ///< mono - 0, color mode - 1, +0 - normal, 256 - sensor test, 512 - FPGA test #define P_COLOR 135 ///< mono - 0, color mode - 1, +0 - normal, 256 - sensor test, 512 - FPGA test
#define COLORMODE_MONO6 0 ///< monochrome, (4:2:0), #define COLORMODE_MONO6 1 ///< monochrome, (4:2:0), was:0
#define COLORMODE_COLOR 1 ///< color, 4:2:0, 18x18(old) #define COLORMODE_COLOR 0 ///< color, 4:2:0, 18x18(old) was: 1
#define COLORMODE_JP46 2 ///< jp4, original (4:2:0) #define COLORMODE_JP46 2 ///< jp4, original (4:2:0)
#define COLORMODE_JP46DC 3 ///< jp4, dc -improved (4:2:0) #define COLORMODE_JP46DC 3 ///< jp4, dc -improved (4:2:0)
#define COLORMODE_COLOR20 4 ///< color, 4:2:0, 20x20, middle of the tile (not yet implemented) #define COLORMODE_COLOR20 4 ///< color, 4:2:0, 20x20, middle of the tile (not yet implemented)
...@@ -1662,8 +1663,8 @@ struct sensorproc_t { ...@@ -1662,8 +1663,8 @@ struct sensorproc_t {
*! that goes after the encoded frame, so total is 36 bytes (26+2+8) *! that goes after the encoded frame, so total is 36 bytes (26+2+8)
!****************************************************************************************************/ !****************************************************************************************************/
// move fram x353.h // move fram x353.h
#define DEFAULT_COLOR_SATURATION_BLUE 0x90 ///< 100*realtive saturation blue #define DEFAULT_COLOR_SATURATION_BLUE 0x90 ///< 100*relative saturation blue
#define DEFAULT_COLOR_SATURATION_RED 0xb6 ///< 100*realtive saturation red #define DEFAULT_COLOR_SATURATION_RED 0xb6 ///< 100*relative saturation red
//#define EXPOSURE_UNIT 100 // to move to finer exposure settings - current unit in microseconds. TODO: Propagate it to drivers... //#define EXPOSURE_UNIT 100 // to move to finer exposure settings - current unit in microseconds. TODO: Propagate it to drivers...
#define EXPOSURE_UNIT 1 ///< to move to finer exposure settings - current unit in microseconds. TODO: Propagate it to drivers... #define EXPOSURE_UNIT 1 ///< to move to finer exposure settings - current unit in microseconds. TODO: Propagate it to drivers...
......
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