///TODO: init framepars (zero parameters) before initscripts (not when detecting the sensors) - then initscript will be able to overwrite some
voidinit_framepars_ptr(void);
voidinitSequencers(void);///Move to sensorcommon? currently it is used through frameparsall file (lseek)
voidinitGlobalPars(void);/// resets all global parameters but debug mask (if ELPHEL_DEBUG)
intinitMultiPars(void);/// initialize structures for individual per-sensor parameters. Now only works for sensor registers using G_MULTI_REGSM. Should be called aftre/during sensor detection
voidinitFramePars(void);///initialize all parameters, set thisFrameNumber to frame8 (read from hardware, usually 0 after resetting i2c and cmd_seq)
voidresetFrameNumber(void);/// reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow)
voidinit_framepars_ptr(intsensor_port);
voidinitSequencers(intsensor_port);///Move to sensorcommon? currently it is used through frameparsall file (lseek)
voidinitGlobalPars(intsensor_port);/// resets all global parameters but debug mask (if ELPHEL_DEBUG)
intinitMultiPars(intsensor_port);/// initialize structures for individual per-sensor parameters. Now only works for sensor registers using G_MULTI_REGSM. Should be called aftre/during sensor detection
voidinitFramePars(intsensor_port);///initialize all parameters, set thisFrameNumber to frame8 (read from hardware, usually 0 after resetting i2c and cmd_seq)
voidresetFrameNumber(intsensor_port);/// reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow)
voidupdateFramePars(intframe8,structinterframe_params_t*frame_pars);/// called from ISR - advance thisFrameNumber to match hardware frame8, copy parameters as needed.
voidupdateFramePars(intsensor_port,intframe8,structinterframe_params_t*frame_pars);/// called from ISR - advance thisFrameNumber to match hardware frame8, copy parameters as needed.
/// frame8 usually is just next after thisFrameNumber
/// frame_pars - pointer to structure (between frames in the frame buffer) to save a pointer to past parameters
unsignedlonggetThisFrameNumber(void);/// just return current thisFrameNumber
unsignedlonggetThisFrameNumber(intsensor_port);/// just return current thisFrameNumber
/// set parameters for the frame number frameno, knowing that they should be set not less than maxLatency ahead (may be sensor - dependent)
/// Parameters (numPars of them) will be updated all at once, with interrupts disabled
/// Return - 0 if OK, -ERR_FRAMEPARS_TOOEARLY or -ERR_FRAMEPARS_TOOLATE if it is too early or too late to set parameters (numPars may be 0 to just test)
...
...
@@ -42,27 +43,28 @@ unsigned long getThisFrameNumber(void); /// just return current thisFrameNumber
/// TODO: Make (an "unlimited") future commands que based on lists and a tree frame index
/// Parameters related to multi-sensor (10359A) setup
#define MAX_SENSORS 3 // maximal number of sensor attached (modify some hard-wired constants below if this to be changed)
//! Parameters below are accessed through mmap, because of cache coherency problem it make sense to keep them compact (maybe group by 8 - cache line of 32 bytes)
//#define MAX_SENSORS 3 // maximal number of sensor attached (modify some hard-wired constants below if this to be changed)
/* Modified for 393 - using up to 4 sub-sensors (even as 10359 only supports 3 */
#define MAX_SENSORS 4 // maximal number of sensor attached (modify some hard-wired constants below if this to be changed)
#define SENSOR_PORTS 4 // Number of sensor ports (each has individual framepars_all_t
//! Parameters below are accessed through mmap, because of cache coherence problem it make sense to keep them compact (maybe group by 8 - cache line of 32 bytes)
#define P_SENSOR_RUN 4 // 0 - stop, 1 - single, 2 - run
//#define P_MAX_PAR 511 /// maximal # of used parameter
//#define P_MAX_GPAR 1023 // maximal # of global parameter
#define P_MAX_GPAR 2047 /// maximal # of global parameter - TODO: change name to NUM_GPAR and make it 2048
//#define P_MAX_GPAR 2047 /// maximal # of global parameter - TODO: change name to NUM_GPAR and make it 2048
#define NUM_GPAR 2048 /// maximal # of global parameter - TODO: change name to NUM_GPAR and make it 2048
#define P_MAX_GPAR (NUM_GPAR - 1) /// maximal # of global parameter - TODO: change name to NUM_GPAR and make it 2048
#define PARS_SAVE_FROM 128 /// PARS_SAVE_NUM parameters starting from PARS_SAVE_FROM from "this" frame will be saved in circular buffer, PASTPARS_SAVE_ENTRIES entries
#define PARS_SAVE_COPY 16 /// number of parameters copied from future (framepars) to the past (pastpars)
...
...
@@ -617,7 +628,7 @@
#define GLOBALS_PRESERVE 0x20 /// number of parameters that are not erased during initGlobalPars
/// First 32 parameter values are not erased with initGlobalPars
#define GLOBALPARS(x) globalPars[(x)-FRAMEPAR_GLOBALS] // should work in drivers and applications
#define GLOBALPARS(p, x) (aglobalPars[p][(x)-FRAMEPAR_GLOBALS]) // should work in drivers and applications
#define G_DEBUG (FRAMEPAR_GLOBALS + 2) /// Each bit turns on/off some debug outputs
#define G_TEST_CTL_BITS (FRAMEPAR_GLOBALS + 3) /// turn some features on/off in the drivers for debugging purposes
...
...
@@ -817,10 +828,14 @@
/// when the 3-bit counter is combined with the software variable to get the full 32-bit frame number
/// Each parameter page includes 927 parameter registers, as well as 97 bitmasks to speed up updates between frames
/// So if no parameters are changed - nothing to be copied from page to page
#define PARS_FRAMES 8 // number of frames handled in buffer
#define PARS_FRAMES_MASK (PARS_FRAMES-1) // currently 7
unsignedlongpars[927];// parameter values (indexed by P_* constants)
unsignedlongfunctions;// each bit specifies function to be executed (triggered by some parameters change)
...
...
@@ -893,13 +908,14 @@ struct framepars_past_t {
unsignedlongpast_pars[PARS_SAVE_NUM];
};
// size should be PAGE_SIZE aligned
structframepars_all_t{
structframepars_tframePars[PARS_FRAMES];
structframepars_tfunc2call;/// func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used
unsignedlongglobalPars[P_MAX_GPAR];/// parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W
structframepars_tfunc2call;/// func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used
unsignedlongglobalPars[NUM_GPAR];/// parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W
unsignedlongmultiSensIndex[P_MAX_PAR];/// indexes of individual sensor register shadows (first of 3) - now for all parameters, not just sensor ones
unsignedlongmultiSensRvrsIndex[P_MAX_PAR];/// reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number
unsignedlongmultiSensIndex[P_MAX_PAR_ROUNDUP];/// indexes of individual sensor register shadows (first of 3) - now for all parameters, not just sensor ones
unsignedlongmultiSensRvrsIndex[P_MAX_PAR_ROUNDUP];/// reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number
};
structframeparspair_t{
...
...
@@ -1771,7 +1787,7 @@ struct gamma_stuct_t {
#define HISTOGRAM_TABLE_OFFSET 52 /// Histogram tables data starts 44 bytes from the histogram page structure (for PHP raw histogram)
///TODO: Update when histogram_stuct_t is changed
structhistogram_stuct_t{
unsignedlongframe;/// frame number correspoding to the current histogram
unsignedlongframe;/// frame number corresponding to the current histogram