intdir_find_tag(unsignedlongtag);//!find location of the tag field in meta page using long tag (Exif tag and tag group)
inlinevoidwrite_meta_raw_irq(intsensor_port,char*data,intoffset,intlen);//write data to meta, called from IRQ
inlineintwrite_meta_irq(intsensor_port,char*data,int*indx,unsignedlongltag,intlen);//write data to meta, called from IRQ(len==0 => use field length)
inlinevoidputlong_meta_raw_irq(intsensor_port,unsignedlongdata,intoffset);//write data to meta (4 bytes, big endian), called from IRQ
inlineintputlong_meta_irq(intsensor_port,unsignedlongdata,int*indx,unsignedlongltag);//write data to meta (4 bytes, big endian), from IRQ
//void write_meta_raw_irq(char * data, int offset, int len); //write data to meta, called from IRQ
//int write_meta_irq(char * data, int * indx, unsigned long ltag, int len); //write data to meta, called from IRQ(len==0 => use field length). Returns index of the written data, -1 if not written
voidwrite_meta_raw(intsensor_port,char*data,intoffset,intlen);//write data to meta, called from outside IRQ (atomic)
intwrite_meta(intsensor_port,char*data,int*indx,unsignedlongltag,intlen);//write data to meta, from outside IRQ (atomic) (len==0 => use field length). Returns index of the written data, -1 if not written
voidputlong_meta_raw(intsensor_port,unsignedlongdata,intoffset);//write data to meta (4 bytes, big endian), called from outside IRQ (atomic)
intputlong_meta(intsensor_port,unsignedlongdata,int*indx,unsignedlongltag);//write data to meta (4 bytes, big endian), from outside IRQ (atomic). Returns index of the written data, -1 if not written
/// Parameters related to multi-sensor (10359A) setup
/// 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)
//#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)
/* 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_SENSOR_RUN 4 // 0 - stop, 1 - single, 2 - run
//#define P_MAX_PAR 511 /// maximal # of used parameter
//#define P_MAX_PAR 511 /// maximal # of used parameter
//#define P_MAX_GPAR 1023 // maximal # of global 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_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)
#define PARS_SAVE_COPY 16 /// number of parameters copied from future (framepars) to the past (pastpars)
...
@@ -617,7 +628,7 @@
...
@@ -617,7 +628,7 @@
#define GLOBALS_PRESERVE 0x20 /// number of parameters that are not erased during initGlobalPars
#define GLOBALS_PRESERVE 0x20 /// number of parameters that are not erased during initGlobalPars
/// First 32 parameter values are not erased with 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_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
#define G_TEST_CTL_BITS (FRAMEPAR_GLOBALS + 3) /// turn some features on/off in the drivers for debugging purposes
...
@@ -817,10 +828,14 @@
...
@@ -817,10 +828,14 @@
/// when the 3-bit counter is combined with the software variable to get the full 32-bit frame number
/// 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
/// 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
/// So if no parameters are changed - nothing to be copied from page to page
#define PARS_FRAMES 8 // number of frames handled in buffer
/* Modified for 393 : 16 hardware frames, aligning framepars_all_t to PAGE_SIZE*/
#define PARS_FRAMES_MASK (PARS_FRAMES-1) // currently 7
#define PARS_FRAMES 16 // 8 // number of frames handled in buffer
unsignedlongpars[927];// parameter values (indexed by P_* constants)
unsignedlongpars[927];// parameter values (indexed by P_* constants)
unsignedlongfunctions;// each bit specifies function to be executed (triggered by some parameters change)
unsignedlongfunctions;// each bit specifies function to be executed (triggered by some parameters change)
...
@@ -893,13 +908,14 @@ struct framepars_past_t {
...
@@ -893,13 +908,14 @@ struct framepars_past_t {
unsignedlongpast_pars[PARS_SAVE_NUM];
unsignedlongpast_pars[PARS_SAVE_NUM];
};
};
// size should be PAGE_SIZE aligned
structframepars_all_t{
structframepars_all_t{
structframepars_tframePars[PARS_FRAMES];
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
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
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
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];/// reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number
unsignedlongmultiSensRvrsIndex[P_MAX_PAR_ROUNDUP];/// reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number
};
};
structframeparspair_t{
structframeparspair_t{
...
@@ -1773,7 +1789,7 @@ struct gamma_stuct_t {
...
@@ -1773,7 +1789,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)
#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
///TODO: Update when histogram_stuct_t is changed
structhistogram_stuct_t{
structhistogram_stuct_t{
unsignedlongframe;/// frame number correspoding to the current histogram
unsignedlongframe;/// frame number corresponding to the current histogram