Commit e7e0c7be authored by Andrey Filippov's avatar Andrey Filippov

re-organized trigger behavior

parent a8a661b1
This diff is collapsed.
......@@ -6,11 +6,11 @@
//extern struct framepars_t (*framepars)[PARS_FRAMES];
extern struct framepars_t *aframepars[SENSOR_PORTS];
extern struct framepars_past_t *apastpars[SENSOR_PORTS];
extern struct common_pars_t *common_pars;
extern unsigned long *aglobalPars[SENSOR_PORTS];
extern unsigned long *amultiSensIndex[SENSOR_PORTS];
extern unsigned long *amultiSensRvrsIndex[SENSOR_PORTS];
extern wait_queue_head_t aframepars_wait_queue[SENSOR_PORTS];
///TODO: init framepars (zero parameters) before initscripts (not when detecting the sensors) - then initscript will be able to overwrite some
void init_framepars_ptr(int sensor_port);
int initSequencers (int sensor_port); ///Move to sensorcommon? currently it is used through frameparsall file (lseek)
......@@ -35,6 +35,7 @@ void set_imageParamsR_all(int sensor_port, int n, unsigned long d);
//Next 2 called from ISR
void updateInterFrame(int sensor_port, u32 compressed_frame, struct interframe_params_t * interframe_pars);
void updateFramePars (int sensor_port, int frame16);
int setFrameParStatic (int sensor_port, unsigned long index, unsigned long val);
int setFrameParsStatic (int sensor_port, int numPars, struct frameparspair_t * pars);
unsigned long getThisFrameNumber (int sensor_port); /// just return current thisFrameNumber
......
......@@ -150,17 +150,21 @@ const unsigned long ahead_tab[]=
/// For Micron sensors limitfps should have the same latency as changing window height, otherwise when WOI_HEIGHT 0x3c0->0x790 and next frame VBLANK 0x13e->0x284
/// sensor waits till the counter overflows (>10 seconds) without any frame sync pulses
onchange_limitfps, 0, 2, 1, 1, 1, 0, /// check compressor will keep up, limit sensor FPS if needed
onchange_compmode, 0, 0, 1, 1, 1, 0, /// program compressor modes
/// onchange_compmode, 0, 0, 1, 1, 1, 0, /// program compressor modes
onchange_compmode, 0, 0, 0, 0, 0, 0, /// program compressor modes
onchange_focusmode, 1, 0, 0, 0, 0, 0, /// program focus modes (through writing the tables, so no sequencer)
// onchange_trigseq, 0, 0, 0, 0, 0, 0, /// program sequencer (int/ext)
// onchange_trigseq, 1, 0, 0, 0, 0, 0, /// program sequencer (int/ext) NOTE:needs >24 bit data, too much for sequencer
onchange_trigseq, 1, 2, 1, 1, 1, 0, /// program sequencer (int/ext) NOTE:needs >24 bit data, too much for sequencer. Should be not later than onchange_triggermode and limitfps
// onchange_trigseq, 1, 2, 1, 1, 1, 0, /// program sequencer (int/ext) NOTE:needs >24 bit data, too much for sequencer. Should be not later than onchange_triggermode and limitfps
onchange_trigseq, 0, 2, 1, 1, 1, 0, /// NC393: OK to program through the sequencer (full 32 bits)
onchange_irq, 0, 0, 0, 0, 0, 0, /// program smart IRQ mode
onchange_comprestart, 0, 0, 0, 0, 0, 0, /// restart after changing geometry (recognizes ASAP and programs memory channel 2 then)
/// onchange_compstop should have the same latency as onchange_window
// NC393 - triggered mode wants onchange_compstop==2, while onchange_window == 1?
// onchange_compstop, 0, 2, 1, 2, 1, 0, /// stop compressor when changing geometry
onchange_compstop, 0, 2, 1, 1, 1, 0, /// stop compressor when changing geometry
/// onchange_compstop, 0, 2, 1, 1, 1, 0, /// stop compressor when changing geometry
onchange_compstop, 0, 2, 2, 2, 2, 0, /// stop compressor when changing geometry
onchange_compctl, 0, 0, 1, 1, 1, 0, /// only start/stop/single (after explicitly changed, not when geometry was changed)
// onchange_gammaload, 1, 0, 0, 0, 0, 0, /// write gamma tables (should be prepared). Maybe - just last byte, to activate?
onchange_gammaload, 1, 1, 1, 1, 1, 0, /// write gamma tables (should be prepared). Maybe - just last byte, to activate?
......
This diff is collapsed.
......@@ -1030,6 +1030,7 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p
if ((((bitstream_version ^ I2C359_MINVERSION) & 0xffff0000)!=0) || ((bitstream_version & 0xffff) < (I2C359_MINVERSION & 0xffff))) {
dev_err(g_dev_ptr,"invalid 10359 bitstream version, found 0x%08lx, required >= 0x%08x\n",bitstream_version, I2C359_MINVERSION );
setFramePar(sensor_port, thispars, P_SENSOR, sensor->sensorType);
common_pars->sensors[sensor_port] = sensor->sensorType;
return -1;
}
dev_dbg(g_dev_ptr,"10359 bitstream version =0x%08lx\n",bitstream_version);
......@@ -1129,6 +1130,7 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p
if (GLOBALPARS(sensor_port,G_SENS_AVAIL)==0) {
dev_warn(g_dev_ptr,"No supported sensors connected to 10359A board\n");
setFramePar(sensor_port, thispars, P_SENSOR, sensor->sensorType);
common_pars->sensors[sensor_port] = sensor->sensorType;
if (nupdate) setFramePars(sensor_port,thispars, nupdate, pars_to_update); // save changes to sensor register shadows
return 0;
}
......
......@@ -239,14 +239,15 @@ const unsigned long param_depend_tab[]=
P_RFOCUS_TOP, ONCHANGE_FOCUSMODE ,
P_RFOCUS_HEIGHT, ONCHANGE_FOCUSMODE ,
P_FOCUS_FILTER, ONCHANGE_FOCUSMODE ,
P_TRIG_MASTER, ONCHANGE_TRIGSEQ ,
P_TRIG_CONDITION, ONCHANGE_TRIGSEQ ,
P_TRIG_DELAY, ONCHANGE_TRIGSEQ ,
P_TRIG_OUT, ONCHANGE_TRIGSEQ ,
P_TRIG_PERIOD, ONCHANGE_TRIGSEQ ,
P_TRIG_PERIOD, ONCHANGE_TRIGSEQ | ONCHANGE_LIMITFPS,
P_SKIP_FRAMES, ONCHANGE_RECALCSEQ ,
P_I2C_QPERIOD, ONCHANGE_I2C ,
P_I2C_BYTES, ONCHANGE_I2C ,
P_IRQ_SMART, ONCHANGE_IRQ ,
P_I2C_EOF, ONCHANGE_IRQ ,
P_EXTERN_TIMESTAMP, ONCHANGE_TRIGSEQ ,
P_TRIG_BITLENGTH, ONCHANGE_TRIGSEQ ,
P_XMIT_TIMESTAMP, ONCHANGE_TRIGSEQ ,
......
This diff is collapsed.
......@@ -36,6 +36,7 @@
#define USELONGLONG 1
#define ETRAXFS_MMAP_CACHE_BUG y
//#define INIT_IN_TRIGGERED // Init sensors in triggered mode, stopped
#if ELPHEL_DEBUG
#define EDBG(x) x
......@@ -279,6 +280,7 @@
#define SENSORWIDTH_IBIS51300 1280 ///< FillFactory IBIS51300 width
#define SENSORHEIGHT_IBIS51300 1024 ///< FillFactory IBIS51300 height
#define P_TRIG_MASTER 3 ///< Master channel for setting trigger para,eters
#define P_SENSOR_RUN 4 ///< Sensor acquisition mode 0 - stop, 1 - single, 2 - run
#define SENSOR_RUN_STOP 0 ///< Sensor acquisition mode: STOP
#define SENSOR_RUN_SINGLE 1 ///< Sensor acquisition mode: SINGLE FRAME
......@@ -449,8 +451,9 @@
#define P_SKIP_FRAMES 107 ///< number of frames to skip after restarting sensor+compressor - now zero/nonzero?
#define P_I2C_QPERIOD 108 ///< number of system clock periods in 1/4 of i2c SCL period to the sensor/sensor board // 393: Moved to DT
#define P_I2C_BYTES 109 ///< number of bytes in hardware i2c write (after slave addr) -0/1/2
#define P_IRQ_SMART 110 ///< TODO: Obsolete for 393, update"smart" IRQ modes: +1 - wait for VACT in early compressor_done,
//#define P_IRQ_SMART 110 ///< TODO: Obsolete for 393, update"smart" IRQ modes: +1 - wait for VACT in early compressor_done,
///< +2 - wait for dma fifo ready // 393: Combine IRQ? 353: bit 0 will be always 1 (needs fix in FPGA)
#define P_I2C_EOF 110 ///< 0:increment i2c sequencer at the SOF (same as ystem frame), 1 - increment early (at previous EOF)
#define P_EXTERN_TIMESTAMP 111 ///< Use external timestamp (received with sync) when availabele, 0 - always use local timestamp
#define P_OVERSIZE 112 ///< ignore sensor dimensions, use absolute WOI_LEFT, WOI_TOP
#define P_XMIT_TIMESTAMP 113 ///< 0 - transmit just sync pulse, 1 - pulse+timestamp over the sync line
......@@ -988,7 +991,8 @@ struct framepars_past_t {
};
/// All parameter data for a sensor port, including future ones and past. Size should be PAGE_SIZE aligned
struct framepars_all_t {
struct framepars_all_t
{
struct framepars_t framePars[PARS_FRAMES]; ///< Future frame parameters
struct framepars_t func2call; ///< func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used
unsigned long globalPars[NUM_GPAR]; ///< parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W
......@@ -997,6 +1001,27 @@ struct framepars_all_t {
unsigned long multiSensRvrsIndex[P_MAX_PAR_ROUNDUP]; ///< reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number
};
/// Parameters, common for all channels (trigger mode)
struct common_pars_t{
unsigned long master_chn; ///< Master channel (controlparameters through this channel) ([0] - value, [1] - frame)
unsigned long sensors[SENSOR_PORTS]; ///< detected sensors
long updated[SENSOR_PORTS]; ///< 0 no update, -1 - ASAP, SENSOR_PORTS - frame 0, 2*SENSOR_PORTS-1 - SENSOR_PORTS-1
unsigned long trig_period; ///< Trigger period (in 100 MHz clocks
unsigned long trig_bitlength; ///< duration of one bit minus 1 in 25MHz clocks, maximal value 255 (256*40ns)
unsigned long extern_timestamp; ///< Use external (received) timestamp if available
unsigned long xmit_timestamp; ///< Transmit timestamp with sync pulse
unsigned long trig_condition; ///< Trigger condition (Each dibit: 0 - inactive, 1 - keep (nop), 2 - active low, 3 - active high)
unsigned long trig_out; ///< trigger output (Each dibit: 0 - inactive, 1 - keep (nop), 2 - active low, 3 - active high)
};
/*
* TRIG_PERIOD 500 0x1f4
* TRIG_BITLENGTH 31 0x1f
* EXTERN_TIMESTAMP 1 0x1
* XMIT_TIMESTAMP 0 0x0
* TRIG_CONDITION 0 0x0
* TRIG_OUT 0 0x0
*/
/// Key/value pair of parameters
struct frameparspair_t {
unsigned long num; ///< parameter index ( as defined by P_* constants) ORed with "force new" (0x10000) - parameter value will be considered a new one
......@@ -1073,6 +1098,7 @@ struct p_names_t {
#define DEFINE_P_NAMES(x) struct p_names_t x[]= { \
P_NAME_ENTRY(NUMBER), \
P_NAME_ENTRY(SENSOR), \
P_NAME_ENTRY(TRIG_MASTER), \
P_NAME_ENTRY(SENSOR_RUN), \
P_NAME_ENTRY(SENSOR_SINGLE), \
P_NAME_ENTRY(ACTUAL_WIDTH), \
......@@ -1189,7 +1215,7 @@ struct p_names_t {
P_NAME_ENTRY(SKIP_FRAMES), \
P_NAME_ENTRY(I2C_QPERIOD), \
P_NAME_ENTRY(I2C_BYTES), \
P_NAME_ENTRY(IRQ_SMART), \
P_NAME_ENTRY(I2C_EOF), \
P_NAME_ENTRY(EXTERN_TIMESTAMP), \
P_NAME_ENTRY(OVERSIZE), \
P_NAME_ENTRY(XMIT_TIMESTAMP), \
......@@ -1485,7 +1511,7 @@ struct p_names_t {
#define LSEEK_AUTOEXP_GET 0x1a ///< copy window and exposure parameters to autoexp_state
#define LSEEK_TRIGGER_PGM 0x1b ///< program trigger parameters
#define LSEEK_I2C_PGM 0x1c ///< program hardware i2c speed/bytes
#define LSEEK_IRQ_SMART_PGM 0x1d ///< program "smart" irq modes (+1 - wait VACT, +2 - wait dma fifo)
#define LSEEK_I2C_EOF_PGM 0x1d ///< program "smart" irq modes (+1 - wait VACT, +2 - wait dma fifo)
#define LSEEK_EXTERN_TIMESTAMP_PGM 0x1e ///< 1 - use external timestamps if available
#define LSEEK_DMA_INIT 0x1f ///< (re-) initialize ETRAX DMA for compressor
#define LSEEK_DMA_STOP 0x20 ///< STOP ETRAX DMA
......@@ -1572,7 +1598,7 @@ struct p_names_t {
LSEEK_NAME_ENTRY(AUTOEXP_GET), \
LSEEK_NAME_ENTRY(TRIGGER_PGM), \
LSEEK_NAME_ENTRY(I2C_PGM), \
LSEEK_NAME_ENTRY(IRQ_SMART_PGM), \
LSEEK_NAME_ENTRY(I2C_EOF_PGM), \
LSEEK_NAME_ENTRY(EXTERN_TIMESTAMP_PGM), \
LSEEK_NAME_ENTRY(DMA_INIT), \
LSEEK_NAME_ENTRY(DMA_STOP), \
......
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