Commit 340dc14b authored by Andrey Filippov's avatar Andrey Filippov

more debugging

parent 59fb3238
......@@ -27,6 +27,9 @@ install:
$(INSTALL) $(OWN) -m $(INSTDOCS) $(PHP_SCRIPTS) $(DESTDIR)/$(DOCUMENTROOT)
$(INSTALL) $(OWN) -d $(DESTDIR)/$(SYSCONFDIR)
$(INSTALL) $(OWN) -d $(DESTDIR)/$(CONFDIR)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(CONFS) $(DESTDIR)/$(CONFDIR)
$(INSTALL) $(OWN) -m $(INSTDOCS) -T autocampars.xml $(DESTDIR)/$(CONFDIR)/autocampars0.xml
$(INSTALL) $(OWN) -m $(INSTDOCS) -T autocampars.xml $(DESTDIR)/$(CONFDIR)/autocampars1.xml
$(INSTALL) $(OWN) -m $(INSTDOCS) -T autocampars.xml $(DESTDIR)/$(CONFDIR)/autocampars2.xml
$(INSTALL) $(OWN) -m $(INSTDOCS) -T autocampars.xml $(DESTDIR)/$(CONFDIR)/autocampars3.xml
clean:
@echo "make clean in src"
This diff is collapsed.
......@@ -415,7 +415,7 @@ CAPTION;
// NC393 - added IRQs ON
// $xml->addChild ( 'irqon_result' . strval ( $sensor_port ), fseek ( $framepars_file, ELPHEL_LSEEK_INTERRUPT_ON, SEEK_END ) ); // #define LSEEK_INTERRUPT_ON 0x24 /// enable camera interrupts
// $xml->addChild ( 'compressor_irqon_result', fseek ( $framepars_file, ELPHEL_LSEEK_INTERRUPT_ON, SEEK_END ) ); // #define LSEEK_INTERRUPT_ON 0x24 /// enable camera interrupts
// Init turn on cmdseq interrupts, but not compressor ones
$xml->addChild ('DEBUG_01_'. strval ( $sensor_port ), $GLOBALS ['framepars_paths'] [$sensor_port]);
$xml->addChild ( 'LSEEK_FRAMEPARS_INIT' . strval ( $sensor_port ), fseek ( $framepars_file, ELPHEL_LSEEK_FRAMEPARS_INIT, SEEK_END ) );
$xml->addChild ( 'elphel_set_P_value' . strval ( $sensor_port ), elphel_set_P_value ( $sensor_port, ELPHEL_SENSOR, 0x00, 0, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ) ); // / will start detection
......
......@@ -162,7 +162,7 @@
exit (0);
}
if (array_key_exists ( 'sensor_port', $_GET )) {
$sensor_port = (myval($_GET ['sensor_port'])) & 3;
$GLOBALS [sensor_port] = (myval($_GET ['sensor_port'])) & 3;
}
$elp_const=get_defined_constants(true);
$elp_const=$elp_const["elphel"];
......@@ -192,7 +192,7 @@
} else { // return XML page with specified parameters values
addGammas($todo);
$names=array_merge(extractNames($global_params),extractNames($frame_params));
$currentParameters=elphel_get_P_arr($sensor_port, $names);
$currentParameters=elphel_get_P_arr($GLOBALS [sensor_port], $names);
applyPost($todo,true); // no final wait
$msg="<?xml version=\"1.0\"?>\n<parameters>\n";
foreach ($currentParameters as $key=>$value) {
......@@ -574,7 +574,7 @@ echo "</pre>";
function showLastImages($numImg,$imagesPerRow,$imgScale) {
$done= decodeTodo ($_GET['done']);
// $this_exif=elphel_get_exif_elphel(0);
$circbuf_pointers=elphel_get_circbuf_pointers($sensor_port,1);
$circbuf_pointers=elphel_get_circbuf_pointers($GLOBALS [sensor_port],1);
$framesAgo=0;
//echo "<pre>\n";
end($circbuf_pointers);
......@@ -602,12 +602,12 @@ function showLastImages($numImg,$imagesPerRow,$imgScale) {
$lastFrameIndex=key($circbuf_pointers);
for ($i=0; $i<=min(($numImg-1),$lastFrameIndex);$i++) {
$meta[$i]=array('circbuf_pointer'=>$circbuf_pointers[$lastFrameIndex-($numImg-1)+$i]['circbuf_pointer'],
'meta'=>elphel_get_interframe_meta($sensor_port,$circbuf_pointers[$lastFrameIndex-($numImg-1)+$i]['circbuf_pointer']),
'Exif'=>elphel_get_exif_elphel ($sensor_port,$circbuf_pointers[$lastFrameIndex-($numImg-1)+$i]['exif_pointer']));
'meta'=>elphel_get_interframe_meta($GLOBALS [sensor_port],$circbuf_pointers[$lastFrameIndex-($numImg-1)+$i]['circbuf_pointer']),
'Exif'=>elphel_get_exif_elphel ($GLOBALS [sensor_port],$circbuf_pointers[$lastFrameIndex-($numImg-1)+$i]['exif_pointer']));
$lastFrameNumber=$circbuf_pointers[$lastFrameIndex-($numImg-1)+$i]['frame'];
}
$running=(elphel_get_P_value($sensor_port, ELPHEL_COMPRESSOR_RUN)==ELPHEL_CONST_COMPRESSOR_RUN_CONT) &&
(elphel_get_P_value($sensor_port, ELPHEL_SENSOR_RUN)==ELPHEL_CONST_SENSOR_RUN_CONT);
$running=(elphel_get_P_value($GLOBALS [sensor_port], ELPHEL_COMPRESSOR_RUN)==ELPHEL_CONST_COMPRESSOR_RUN_CONT) &&
(elphel_get_P_value($GLOBALS [sensor_port], ELPHEL_SENSOR_RUN)==ELPHEL_CONST_SENSOR_RUN_CONT);
$page_title=sprintf("%s %d images acquired to the circular buffer (circbuf). Acquisition is %s. Last frame is %d"
,$framesAgo?"$framesAgo frames (stored) ago":"Latest"
,$numImg
......@@ -751,10 +751,10 @@ function applyPost($todo,$noFinalWait=false) {
$waitingEnabled=false;
break;
}
if (elphel_get_frame($sensor_port)< 8) $waitingEnabled=false; /// or is "==0" enough?
if ($waitingEnabled && !$noFinalWait) elphel_skip_frames($sensor_port,1); // in GET mode, do not skip any frames
if (elphel_get_frame($GLOBALS [sensor_port])< 8) $waitingEnabled=false; /// or is "==0" enough?
if ($waitingEnabled && !$noFinalWait) elphel_skip_frames($GLOBALS [sensor_port],1); // in GET mode, do not skip any frames
/// store the current frame number as reference for all actions delays
$frame_zero=elphel_get_frame($sensor_port);
$frame_zero=elphel_get_frame($GLOBALS [sensor_port]);
$frame_since=0;
$frame_now=$frame_zero;
///Iterate through $todo array, programming the parameter changes
......@@ -764,23 +764,23 @@ function applyPost($todo,$noFinalWait=false) {
$frame_now=$frame_since+$frame_zero;
if ($waitingEnabled) {
if ($showSeqMode>0) {printf ("waiting frame %d (0x%x) ... ",$frame_now,$frame_now); ob_flush(); flush();}
elphel_wait_frame_abs($sensor_port, $frame_now);
elphel_wait_frame_abs($GLOBALS [sensor_port], $frame_now);
if ($showSeqMode>0) {printf ("done\n"); ob_flush(); flush();}
}
}
elphel_set_P_arr ($sensor_port, $pgmpars, $frame_zero+$since,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC); /// Are these flags needed?
elphel_set_P_arr ($GLOBALS [sensor_port], $pgmpars, $frame_zero+$since,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC); /// Are these flags needed?
}
if (!$noFinalWait) {
$frame_now=$since+$frame_zero+1; /// wait just 1 frame longer that the target of the last command in $todo
// echo "since=$since\n"; ob_flush(); flush();
if ($showSeqMode>0) {printf ("waiting frame %d (0x%x) ... ",$frame_now,$frame_now); ob_flush(); flush();}
if ($waitingEnabled) {
elphel_wait_frame_abs($sensor_port, $frame_now);
elphel_wait_frame_abs($GLOBALS [sensor_port], $frame_now);
} else {
$timeout_step= 100000; /// 0.1 sec
$timeout= 3000000; /// 3.0sec
for ($i=0 ; $i < $timeout; $i+=$timeout_step) {
if (elphel_get_frame($sensor_port)>=$frame_now) break;
if (elphel_get_frame($GLOBALS [sensor_port])>=$frame_now) break;
usleep($timeout_step);
}
}
......@@ -883,7 +883,7 @@ function addGammas($todo) {
$black=($gamma_black>>8) & 0xff;
$gamma=($gamma_black & 0xff)*0.01;
if ($showSeqMode>0) printf("<pre>Adding gamma table (gamma=%f, black level=%d)\n</pre>\n",$gamma,$black);
elphel_gamma_add ($gamma, $black); // does not need $sensor_port
elphel_gamma_add ($gamma, $black); // does not need $GLOBALS [sensor_port]
}
}
......@@ -930,11 +930,13 @@ function parseGetNames() {
$embedImageScale= $value;
if (!$embedImageScale) $embedImageScale=$defaultEmbedImageScale;
} else if ($key=='_time') {
} else if ($key=='sensor_port') {
} else {
/// locate $key among constants, accept numeric values also
$address=myval ($key);
if (($address==0) && (strlen($key)>3)) { /// suspect constant
$address=elphel_parse_P_name($key); // does not need $sensor_port,
$address=elphel_parse_P_name($key); // does not need $GLOBALS [sensor_port],
}
if ($address==0) {
$xml = new SimpleXMLElement("<?xml version='1.0'?><framepars/>");
......@@ -966,7 +968,7 @@ function parseGetNames() {
if ($isPost) {
$ahead=$posted_params[$index]['delay'];
}
if (elphel_is_global_par($address)) { // does not need $sensor_port,
if (elphel_is_global_par($address)) { // does not need $GLOBALS [sensor_port],
$global_params[$index++]=array("number"=>$address,
"name"=>$key,
......@@ -1000,7 +1002,7 @@ function readCurrentParameterValues() {
}
// echo "<pre>";
//print_r($pars);
$pars=elphel_get_P_arr($sensor_port, $pars); /// next2 frame/globals
$pars=elphel_get_P_arr($GLOBALS [sensor_port], $pars); /// next2 frame/globals
//print_r($pars);
foreach ($frame_params as $key=>$par) {
$frame_params[$key]['cur_value']=$pars[$par['name']];
......@@ -1208,7 +1210,7 @@ function printPage($encoded_todo) {
fclose($fd_circ);
// echo "circbuf_pointer=$circbuf_pointer";
if ($circbuf_pointer>=0) {
$meta=elphel_get_interframe_meta($sensor_port, $circbuf_pointer);
$meta=elphel_get_interframe_meta($GLOBALS [sensor_port], $circbuf_pointer);
$width= floor($meta['width']*$embedImageScale);
$height=floor($meta['height']*$embedImageScale);
//echo "width=$width, height=$height, embedImageScale=$embedImageScale<br />\n";
......@@ -1310,7 +1312,7 @@ function printPage($encoded_todo) {
function getDescription ($compositeName,$descriptions){
if (array_key_exists($compositeName,$descriptions)) return $descriptions[$compositeName];
/// try to find a parent name
$number=elphel_parse_P_name($compositeName); // does not need $sensor_port,
$number=elphel_parse_P_name($compositeName); // does not need $GLOBALS [sensor_port],
if (!$number) return "Unknown name";
$prefix="";
// is it a bit field?
......@@ -1321,7 +1323,7 @@ function getDescription ($compositeName,$descriptions){
$name=substr($compositeName,0,strlen($compositeName)-strlen('__XXYY'));
if ($width==1) $prefix.= sprintf("This is the bit %d of %s - ",$bit,$name);
else $prefix.= sprintf("This is a bit selection - bits %d through %d of %s - ",$bit,($bit+$width-1),$name);
$number=elphel_parse_P_name($name); // does not need $sensor_port,
$number=elphel_parse_P_name($name); // does not need $GLOBALS [sensor_port],
if (!$number) {
echo "Internal error in parsedit.php:Unknown name $name of $compositeName";
exit (1);
......@@ -1359,6 +1361,7 @@ function getParDescriptions($autocampars) {
break;
}
}
$path = str_replace("0.",strval($GLOBALS [sensor_port]).".",$path); // NC393: here it does not really matter
$xml = simplexml_load_file($path);
$descriptions=array();
foreach ($xml->descriptions->children() as $entry) {
......
......@@ -86,4 +86,5 @@ return mmap.mmap(f.fileno(), self.PAGE_SIZE, offset = page_addr)
"""
if __name__ == "__main__":
test_mmap(0)
for p in range(4):
test_mmap(p)
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