apps/autocampars/autocampars.php

Go to the documentation of this file.
00001 #!/usr/local/sbin/php -q
00002 <?php
00027   $Log="";
00028   $cvslog=<<<CVSLOG
00029   $Log: autocampars.php,v $
00030   Revision 1.1.1.1  2008/11/27 20:04:01  elphel
00031 
00032 
00033   Revision 1.15  2008/11/27 09:26:43  elphel
00034   Added support for vignetting correction related parameters
00035 
00036   Revision 1.14  2008/11/24 18:40:21  elphel
00037   Now init only sets the parameters (after clearing everything) tagged with "init", setting sensor phase in wrong time caused problems
00038 
00039   Revision 1.13  2008/11/24 17:30:19  elphel
00040   Removed "?new" when submitting the form
00041 
00042   Revision 1.12  2008/11/24 17:04:12  elphel
00043   Fixed html characters when saving config files
00044 
00045   Revision 1.11  2008/11/22 05:53:57  elphel
00046   added several more parameters related no ccamftp.php
00047 
00048   Revision 1.10  2008/11/20 23:22:14  elphel
00049   Added more parameters descriptions
00050 
00051   Revision 1.9  2008/11/20 07:12:57  elphel
00052   typo
00053 
00054   Revision 1.8  2008/11/20 07:11:56  elphel
00055   minor message edit
00056 
00057   Revision 1.7  2008/11/20 07:03:12  elphel
00058   added support for config/script versions checking, parameter descriptions available in parsedit.php (only some parameters have actual description)
00059 
00060   Revision 1.6  2008/11/20 04:01:53  elphel
00061   more testing
00062 
00063   Revision 1.5  2008/11/20 04:00:33  elphel
00064   trying CVS log as PHP string
00065   
00066   Revision 1.4  2008/11/18 19:31:04  elphel
00067   implemented initialization mode (used at boot time)
00068 
00069   Revision 1.3  2008/11/18 07:37:10  elphel
00070   snapshot
00071 
00072   Revision 1.2  2008/11/17 23:42:59  elphel
00073   snapshot
00074 
00075   Revision 1.1  2008/11/17 06:41:20  elphel
00076   8.0.alpha18 - started autocampars - camera parameters save/restore/init manager
00077 CVSLOG;
00078 //main()
00079   $p=strpos ($cvslog,"Revision");
00080   $version=strtok(substr($cvslog,$p+strlen("Revision"),20)," ");
00081 //  echo "<pre>";
00082 //  echo $version;
00083 //  echo "</pre>";
00084 //  $version="1.0";
00085   $thisScript=$_SERVER['argv'][0];
00086   $numBackups=5;
00087   $parseditPath="/parsedit.php";
00088   $embedImageScale=0.15;
00089   $twoColumns=false;
00090 //  $configPath=      "/var/autocampars.xml";
00091 //  $backupConfigPath="/var/autocampars.xml.backup";
00092   $configPath=      "/etc/autocampars.xml";
00093   $backupConfigPath="/etc/autocampars.xml.backup";
00094   $logFilePath=     "/var/log/autocampars.log"; 
00095   $logFile=         fopen($logFilePath,"a");
00096   $useDefaultPageNumber=15;
00097   $protectedPage=0;  
00098 
00099 //foreach ($_SERVER['argv'] as $param)
00100 //  echo "1- This is autocampars.php, argv="; print_r ($_SERVER['argv']); echo "\n";
00101   $init=false;
00102   $daemon=false;
00103   $initPage=$useDefaultPageNumber;
00104   if ((array_key_exists('new',$_GET)) || (array_key_exists('--new',$_SERVER['argv']))) {
00105      if (file_exists ($configPath)) {
00106        rotateConfig($numBackups);
00107      }
00108   }
00109   if (!file_exists  ($configPath)) {
00110     $confFile=fopen ($configPath,"w+");
00111     fwrite ($confFile,createDefaultConfig($version));
00112     fclose($confFile);
00113     exec ('sync');
00114   }
00115   $config=parseConfig($configPath);
00116   if ($_SERVER['REQUEST_METHOD']=="GET") {
00117     processGet();
00118     exit(0);
00119   } else if ($_SERVER['REQUEST_METHOD']=="POST") {
00120     processPost();
00121     processGet();
00122     exit(0);
00123   } else {
00124     foreach ($_SERVER['argv'] as $param) {
00125       if (substr($param,0,6)=="--init") {
00126         $param=substr($param,7);
00127         if (strlen($param)>0) $initPage=myval($param);
00128         if (($initPage<0) || ($initPage > $useDefaultPageNumber)) $initPage=$useDefaultPageNumber;
00129         $init=true; 
00130         break;
00131       } else if (substr($param,0,8)=="--daemon") {
00132         $daemon=true;
00133         break;
00134       } else if ($param=='--ignore-revision') {
00135         $config['version']=$version;
00136         saveRotateConfig($numBackups);
00137         break;
00138       }
00139     }
00140     if (!$daemon && !$init) {
00141       echo <<<USAGE
00142 
00143 Usage: {$_SERVER['argv'][0]} --init[=page_number]
00144 Initialise parameters using the saved ones in $configPath, page number 0<='page_number'<15)
00145 If page number is not specified the current default one will be used.
00146 
00147 Other functionality (parameters save/restore is provided when this script is called from the daemon,
00148 in that case command is read from the AUTOCAMPARS_* parameter
00149 
00150 USAGE;
00151       exit (0);
00152     }
00153   }
00154   if ($version != $config['version']) {
00155     $warn= <<<WARN
00156 Warning! Version numbers of this script and the config file mismatch:
00157 Script ({$_SERVER['argv'][0]}): $version.
00158 Config file ($configPath): {$config['version']}
00159 This may (or may not) cause errors. You have several option:
00160  1 - re-run this script with '--ignore-revision' - the file will have
00161      new revision number written
00162  2 - re-run the script with '--new' parameter - the old config file
00163      will be deleted and the new fresh one creted
00164 You may also provide the same parameters in the HTTP GET request, i.e.:
00165 http://192.168.0.7/autocampars.php?new
00166 WARN;
00167     echo $warn;
00168     fwrite ($logFile,$warn);
00169     exit (1);
00170   }
00171   if ($init) {
00172       $page=processInit($initPage);
00173       if ($page <0) {
00174         echo "Senosor failed to initialize, see $logFilePath for detailes\n";
00175       } else {
00176         echo "Senosor was successfully initialized at ".date("F j, Y, g:i a")." from $configPath page $page\n";
00177       }
00178       exit (0);
00179   }
00180   if ($daemon) {
00181     processDaemon();
00182     exit (0);
00183   }
00184   exit (0);
00185 /*
00186 #define AUTOCAMPARS_CMD_RESTORE  1  /// restore specified groups of parameters from the specified page
00187 #define AUTOCAMPARS_CMD_SAVE     2  /// save all current parameters to the specified group (page 0 is write-protected)
00188 #define AUTOCAMPARS_CMD_DFLT     3  /// make selected page the default one (used at startup), page 0 OK 
00189 #define AUTOCAMPARS_CMD_SAVEDFLT 4  /// save all current parameters to the specified group (page 0 is write-protected) and make it default (used at startup)
00190 #define AUTOCAMPARS_CMD_INIT     5  /// reset sensor/sequencers, restore all parameters from the specified page
00191 */
00192 
00193 function processInit($initPage) {
00194   global $config, $logFile;
00195   $maxWait=5.0; 
00196   $waitDaemons=5.0; 
00197 
00198 
00199   $sleepOnce=0.1;
00200   if (elphel_get_frame()>0) {
00201 echo "Current frame=".elphel_get_frame().", sleeping to give daemons a chance\n";
00202      elphel_set_P_value(ELPHEL_DAEMON_EN, 0x00, 0, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);
00203      usleep ($waitDaemons*1000000);
00204   }
00206   $framepars_file=fopen("/dev/frameparsall","r");
00207   fseek($framepars_file,ELPHEL_LSEEK_FRAMEPARS_INIT,SEEK_END);                      
00208   elphel_set_P_value(ELPHEL_SENSOR, 0x00, 0, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);
00209   fseek($framepars_file,ELPHEL_LSEEK_SENSORPROC,    SEEK_END);                      
00210 
00211 
00212   for ($t=0; elphel_get_frame()==0; $t+=$sleepOnce) {
00213     usleep ($sleepOnce*1000000);
00214     if ($t>$maxWait) {
00215       fwrite ($logFile,"Sensor failed to initialize at ".date("F j, Y, g:i a")."\n");
00216       fclose ($logFile);
00217       exec ('sync');
00218       return -1; 
00219     }
00220   }
00221   echo "after reset - current frame=".elphel_get_frame()."\n";
00222 //  $page=setParsFromPage($initPage,0xffffffff,true); /// all parameters, init mode - treat all parameters as new, even when they are the same as current (0)
00223   $page=setParsFromPage($initPage,0x1,true); 
00224   return $page;
00225 }
00226 function processDaemon() {
00227   global $config,  $useDefaultPageNumber, $protectedPage,$numBackups;
00228 
00229   $AUTOCAMPARS=elphel_get_P_arr(array("AUTOCAMPARS_CMD"=>null, "AUTOCAMPARS_GROUPS"=>null,"AUTOCAMPARS_PAGE"=>null));
00230 //  echo "processDaemon()\n";
00231 //  print_r($AUTOCAMPARS);
00232   $page=     myval($AUTOCAMPARS['AUTOCAMPARS_PAGE']);
00233   $groupMask=myval($AUTOCAMPARS['AUTOCAMPARS_GROUPS']);
00234   switch ((integer) $AUTOCAMPARS['AUTOCAMPARS_CMD']) {
00235     case ELPHEL_CONST_AUTOCAMPARS_CMD_RESTORE:
00236       $page=setParsFromPage($page,$groupMask);
00237 //      echo "ELPHEL_CONST_AUTOCAMPARS_CMD_RESTORE\n";
00238       break;
00239     case ELPHEL_CONST_AUTOCAMPARS_CMD_SAVE:
00240 //      echo "ELPHEL_CONST_AUTOCAMPARS_CMD_SAVE\n";
00241       $page=readParsToPage($page);
00242       saveRotateConfig($numBackups);
00243       break;
00244     case ELPHEL_CONST_AUTOCAMPARS_CMD_DFLT:
00245 //      echo "ELPHEL_CONST_AUTOCAMPARS_CMD_DFLT\n";
00246       if (($page>=0) && ($page<$useDefaultPageNumber) && ($page !=$useDefaultPageNumber)) {
00247         $config['defaultPage']=$page;
00248         saveRotateConfig($numBackups);
00249       }
00250       break;
00251     case ELPHEL_CONST_AUTOCAMPARS_CMD_SAVEDFLT:
00252 //      echo "ELPHEL_CONST_AUTOCAMPARS_CMD_SAVEDFLT\n";
00253       $page=readParsToPage($page);
00254       $config['defaultPage']=$page;
00255       saveRotateConfig($numBackups);
00256       break;
00257     case ELPHEL_CONST_AUTOCAMPARS_CMD_INIT:
00258 //      echo "ELPHEL_CONST_AUTOCAMPARS_CMD_INIT\n";
00259       $page=processInit($page);
00261       break;
00262     default:
00263       echo $_SERVER['argv'][0].": Unknown command=".$AUTOCAMPARS['AUTOCAMPARS_CMD'];
00264   }
00265 //  print_r($config);
00266 }
00267 function processPost() {
00268  global $config;
00270  $needle="update_comment_";
00271  foreach ($_POST as $key=>$value) if (substr($key,0,strlen($needle))==$needle) {
00272    $page=substr($key,strlen($needle));
00273    $comment=$_POST['comment_'.$page];
00274 //   echo "updating comment for page $page, it will be $comment\n";
00275    $config['paramSets'][$page]['comment']=$comment;
00276    saveRotateConfig($numBackups);
00277    processGet();
00278    exit(0);
00279  } 
00280  if (array_key_exists('update_default',$_POST)) {
00281    $config['defaultPage']=$_POST['default_page'];
00282    saveRotateConfig($numBackups);
00283    processGet();
00284    exit(0);
00285  }
00286  $needle="save_";
00287  foreach ($_POST as $key=>$value) if (substr($key,0,strlen($needle))==$needle) {
00288    $page=substr($key,strlen($needle));
00289    $page=readParsToPage($page);
00290    $config['defaultPage']=$page;
00291    saveRotateConfig($numBackups);
00292    processGet();
00293    exit(0);
00294  } 
00295  $needle="restore_";
00296  foreach ($_POST as $key=>$value) if (substr($key,0,strlen($needle))==$needle) {
00297    $page=substr($key,strlen($needle));
00298    $needle="group_";
00299    $groupMask=0;
00300    foreach ($_POST as $key=>$value) if (substr($key,0,strlen($needle))==$needle) {
00301      $groupMask |= (1 << ((integer)substr($key,strlen($needle))));
00302    }
00303    $page=setParsFromPage($page,$groupMask);
00304    processGet();
00305    exit(0);
00306  } 
00307 
00308 
00309  echo "<pre>\n";
00310  print_r ($_POST);
00311  echo "</pre>\n";
00312  exit (0);
00313 }
00315 
00316 function processGet() {
00317   global $config,$twoColumns,$configPath,$version;
00318   if (array_key_exists('ignore-revision',$_GET) && ($version != $config['version'])) {
00319      $config['version']=$version;
00320      saveRotateConfig($numBackups);
00321   }
00322   if ($version != $config['version']) {
00323     startPage("Warning: version numbers mismatch", "function updateLink(){}");
00324     $warn= <<<WARN
00325 <center><h4>Warning! Version numbers of this script and the config file mismatch:</h4></center>
00326 Script:  <b>$version</b>.<br/>
00327 Config file ($configPath): <b>{$config['version']}</b><br/>
00328 <ol>This may (or may not) cause errors. You have several options:
00329 <li> Follow <a href="?new">this link </a> and create a new config file </li>
00330 <li> Follow <a href="?ignore-revision">this other link </a> to ignore the warning and write a new revision number to the config file</li>
00331 <li> First update the version number with the link above, then manually edit/merge old and new data</li>
00332 </ol>
00333 WARN;
00334     echo $warn;
00335     endPage();
00336     exit (1);
00337   }
00338 
00339   $page_title="Model 353 Camera Parameters save/restore";
00340   startPage($page_title, mainJavascript());
00341   if ($twoColumns) printf ("<table><tr><td style='vertical-align: top'>\n");
00342   writeGroupsTable();
00343   if ($twoColumns)  printf ("</td><td>\n");
00344   else              printf ("<br/>\n");
00345   writePagesTable();
00346   if ($twoColumns) printf ("</td></tr></table>\n");
00347   endPage();
00348 }
00349 
00350 function startPage($page_title, $javascript) {
00351 $url=str_replace('new','same',$_SERVER['REQUEST_URI']); 
00352 
00353 //    [REQUEST_URI] => /autocampars.php?new
00354 
00355 echo <<<HEAD
00356 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
00357                       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
00358 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
00359 <head>
00360  <title>$page_title</title>
00361  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
00362 <script type="text/javascript"><!--
00363 $javascript
00364 //-->
00365 </script>
00366 </head>
00367 <body onload='updateLink()'>
00368 <form action="$url" method="post">
00369 HEAD;
00375 }
00376 function  endPage(){
00377   echo "\n</form></body></html>\n";
00378 }
00379 
00380 function writeGroupsTable() {
00381    global $config;
00382    printf ("<table border='1' style='font-family: Courier, monospace;'>\n");
00383    printf ("<tr>");
00384    printf ("<td><input type='button' value='&nbsp;Select&nbsp;\nAll' onclick='checkAll()' title='Select all parameter groups'/></td>\n");
00385    printf ("<td style='text-align:center'>Bit</td><td style='text-align:center'>Name</td><td style='text-align:center'>Description</td></tr>\n");
00386    foreach ($config['groupBits'] as $name=> $bit) {
00387      printf("<tr>");
00388      printf ("<td style='text-align:center'><input type='checkbox' name='group_%d' value='1' id='id_group_%d' onclick='updateLink();'/></td>",$bit,$bit);
00389      printf ("<td style='text-align:right' >%d</td>",$bit);
00390      printf ("<td style='text-align:left' >%s</td>",$name);
00391      printf ("<td style='text-align:left' >%s</td>",$config['groupDescriptions'][$bit]);
00392      printf("</tr>\n");
00393    }
00394    printf ("<tr>");
00395    printf ("<td><input type='button' value='Deselect\nAll' onclick='unCheckAll()' title='Deselect all parameter groups'/></td>\n");
00396    printf ("<td colspan='3'>&nbsp;<a href='#' target='new' id='id_editLink' title='View/edit current values of the selected parameters groups'>View/Edit Current</a>");
00397    printf ("<label style='border: 0px solid #000;' for='id_embed_image' title='Include image with the parameter edit window'>&nbsp;&nbsp;<input type='checkbox' name='embed' value='1' id='id_embed_image' onclick='updateLink();' checked/>Include image</label></td></tr>\n");
00398    printf ("</table>\n");
00399 }
00400 function writePagesTable() {
00401    global $config,$protectedPage,$useDefaultPageNumber;
00402    printf ("<table border='1' style='font-family: Courier, monospace;'>\n");
00403    printf ("<tr>");
00404    printf ("<td style='text-align:center'>Page</td>");
00405    printf ("<td style='text-align:center'>");
00406        printf ("<input type='submit' name='update_default' value='Update\ndefault' id='id_update_default' title='Update default (used at boot time) configuration page'/>");
00407    printf ("</td>");
00408    printf ("<td style='text-align:center'>Save</td>");
00409    printf ("<td style='text-align:center'>Restore<br/>selected<br/>groups</td>");
00410    printf ("<td style='text-align:center'>Time Saved</td>");
00411    printf ("<td style='text-align:center'>Comments</td>");
00412    printf ("</tr>\n");
00413    for ($i=0;$i<$useDefaultPageNumber;$i++) {
00414      printf ("<tr>");
00415      printf ("<td style='text-align:right'>%d</td>",$i);
00416 
00417      if (array_key_exists($i,$config['paramSets'])) {
00418        printf ("<td style='text-align:center'><input type='radio' name='default_page' value='%d' id='id_default_page_%d' %s".
00419              " title='Select config file page %d as default (boot up) page' /></td>",
00420                $i,$i,($i==$config['defaultPage'])?"checked":"",$i);
00421      } else {
00422        printf ("<td>&nbsp;</td>");
00423      }
00424      if ($i==$protectedPage) {
00425        printf ("<td>&nbsp;</td>");
00426      } else  {
00427        printf ("<td style='text-align:center'><input type='submit' name='save_%d' value='%s' id='id_save_page_%d' title='Save current parameters to the config file as page %d'/></td>",
00428                   $i,array_key_exists($i,$config['paramSets'])?"Overwrite":"Save",$i,$i);
00429      }
00430      if (array_key_exists($i,$config['paramSets'])) {
00431        printf ("<td style='text-align:center'><input type='submit' name='restore_%d' value='Restore' id='id_restore_page_%d' title='Restore parameters from the config file page %d'/></td>",
00432                   $i,$i,$i);
00433        printf ("<td style='text-align:left'>%s</td>",$config['paramSets'][$i]['timestamp']?date("F j, Y, g:i a",$config['paramSets'][$i]['timestamp']):"&nbsp;");
00434        printf ("<td>");
00435        if ($i==$protectedPage)
00436          printf ("%s&nbsp;",$config['paramSets'][$i]['comment']);
00437        else {
00438          printf ("<input type='text'   name='comment_%d' size='40' value='%s' id='id_comment_%d' style='text-align:left'/>",$i,$config['paramSets'][$i]['comment'],$i);
00439          printf ("<input type='submit' name='update_comment_%d' value='Update' id='id_update_comment_%d' title='Update comment in the config file'/>",$i,$i);
00440        }
00441 
00442        printf ("</td>");
00443      } else {
00444        printf ("<td colspan='3'>&nbsp;</td>");
00445      }
00446      printf ("</tr>\n");
00447    }
00448    printf ("</table>\n");
00449 }
00450 
00451 function mainJavascript() {
00452    global $config,$protectedPage,$useDefaultPageNumber,$parseditPath,$embedImageScale;
00453    $checkboxNumbers="";
00454    foreach ($config['groupBits'] as $name=> $bit) {
00455      $checkboxNumbers.=$bit.",";
00456    }
00457    $checkboxNumbers=rtrim ($checkboxNumbers,",");
00458    $groupNames="";
00459    for($i=0;$i<32;$i++) $groupNames.='"'.$config['groupNames'][$i].'",';
00460    $groupNames=rtrim ($groupNames,",");
00461    $groupList="{";
00462    foreach ($config['groups'] as $name=> $value) {
00463      $groupList.=$name.":".$value.",";
00464    }
00465    $groupList=rtrim($groupList,",").'}';
00466 return <<<JAVASCRIPT
00467 function unCheckAll() {
00468   var checkboxes=Array($checkboxNumbers);
00469   var i,cb;
00470   for (i in checkboxes) {
00471     if (((cb=document.getElementById('id_group_'+checkboxes[i])))) {
00472       cb.checked=false;
00473     }
00474   }
00475   updateLink();
00476 }
00477 function checkAll() {
00478   var checkboxes=Array($checkboxNumbers);
00479   var i,cb;
00480   for (i in checkboxes) {
00481     if (((cb=document.getElementById('id_group_'+checkboxes[i])))) {
00482       cb.checked=true;
00483     }
00484   }
00485   updateLink();
00486 }
00487 function updateLink() {
00488   var i,cb;
00489   var groups=$groupList;
00490   var groupNames=Array($groupNames);
00491   var checkboxes=Array($checkboxNumbers);
00492   var mask=0;
00493   var selectedGroups="";
00494   for (i in checkboxes) {
00495     if ((((cb=document.getElementById('id_group_'+checkboxes[i])))) && cb.checked) {
00496       mask |= (1 << checkboxes[i]);
00497       selectedGroups+=groupNames[checkboxes[i]]+"+";
00498     }
00499   }
00500   var selectedPars=Array();
00501   for (i in groups) {
00502     if (groups[i] & mask) selectedPars[selectedPars.length]=i;
00503   }
00504 //  alert (selectedPars.toString());
00505   document.getElementById('id_editLink').href="$parseditPath?"+
00506   ((document.getElementById('id_embed_image').checked)?"embed=$embedImageScale&":"")+
00507   "title=Parameters+for+groups:+"+selectedGroups;
00508   for (i in selectedPars) {
00509     document.getElementById('id_editLink').href+="&"+selectedPars[i];
00510   }
00511 }
00512 JAVASCRIPT;
00513 }
00514 
00520 function  addGammas($pars) {
00521    $gammas=array();
00522    if (array_key_exists('GTAB_R', $pars)) $gammas[$pars['GTAB_R' ]>>16]=1; /// duplicates will be eliminated
00523    if (array_key_exists('GTAB_G', $pars)) $gammas[$pars['GTAB_G' ]>>16]=1;
00524    if (array_key_exists('GTAB_GB',$pars)) $gammas[$pars['GTAB_GB']>>16]=1;
00525    if (array_key_exists('GTAB_B', $pars)) $gammas[$pars['GTAB_B' ]>>16]=1;
00526 //   var_dump($gammas);
00527    foreach ($gammas as $gamma_black=>$whatever) {
00528      $black=($gamma_black>>8) & 0xff;
00529      $gamma=($gamma_black & 0xff)*0.01;
00530      elphel_gamma_add ($gamma, $black);
00531    }
00532 }
00533 
00534 
00535 function setParsFromPage($page,$mask,$initmode=false) {
00536   global $config, $useDefaultPageNumber;
00537   if ($page==$useDefaultPageNumber) $page=$config['defaultPage'];
00538   $parToSet=array();
00539   foreach ($config['groups'] as $par=>$parMask) {
00540     if (($mask & $parMask) &&
00541          array_key_exists($par, $config['paramSets'][$page]) &&
00542          (!$config['parTypes'][$par])) /// not 'text'
00543                 $parToSet[$par]=myval($config['paramSets'][$page][$par]);
00544   }
00546   addGammas($parToSet);
00550 
00551   if ($initmode) {
00552     elphel_set_P_arr($parToSet,-1,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);
00553   } else {
00554     elphel_set_P_arr($parToSet);
00555   }
00556   return $page;
00557 }
00558 
00559 function readParsToPage($page) {
00560   global $config,$protectedPage,$useDefaultPageNumber;
00561   if (($page == $protectedPage) || ($page < 0) || ($page>$useDefaultPageNumber)) return -1;
00562   if ($page==$useDefaultPageNumber) $page=$config['nextPage']; /// 0 is write protected
00563   if ($page == $protectedPage) $page=findNextPage($page);
00564 // echo "\nbefore:";print_r($config);
00565   $config['paramSets'][$page]=elphel_get_P_arr($config['groups']); /// 'text' parameters will be just ignored
00566   $config['paramSets'][$page]['comment']="Saved on ".date("F j, Y, g:i a");
00567   $config['paramSets'][$page]['timestamp']=time();
00568 // echo "\nafter:";print_r($config);
00569   $config['nextPage']=findNextPage($page);
00570   elphel_set_P_arr(array("AUTOCAMPARS_PAGE"=>$page+0)); /// will set some (3?) frames ahead so not yet available until waited enough
00571 //  echo "Saved to page $page, result=$result\n";
00572   return $page;
00573 //date("F j, Y, g:i a")
00574 }
00575 //elphel_parse_P_name
00576 
00577 function saveRotateConfig($numBackups) {
00578   global  $config,$configPath, $backupConfigPath;
00579   rotateConfig($numBackups);
00580 
00581   $confFile=fopen ($configPath,"w+");
00582   fwrite ($confFile,encodeConfig($config));
00583   fclose($confFile);
00584   exec ('sync');
00585 }
00586 function rotateConfig($numBackups) {
00587   global  $config,$configPath, $backupConfigPath;
00588   if (file_exists (backupName($numBackups))) unlink  (backupName($numBackups));
00589   for ($i=$numBackups-1;$i>0;$i--) if (file_exists (backupName($i-1)))  rename  (backupName($i-1),backupName($i));
00590   if (($numBackups>0) && (file_exists ($configPath) )) rename  ($configPath,backupName(0));
00591 }
00592 
00593 function backupName($num) {
00594    global $backupConfigPath;
00595    if ($num>0) return $backupConfigPath.$num;
00596    else return $backupConfigPath;
00597 }
00598 
00599 function findNextPage($page) {
00600   global $config,$protectedPage,$useDefaultPageNumber;
00601   $page++;
00602   while (($page==$protectedPage) || ($page==$useDefaultPageNumber)) {
00603     $page++;
00604     if ($page>$useDefaultPageNumber) $page=0;
00605   }
00606   return $page;
00607 }
00608 
00609 
00610 function parseConfig($filename) {
00611    $config=array('version'=>0,
00612                  'defaultPage'=>0,
00613                  'nextPage'=>0,
00614                  'groupBits'=>array(),
00615                  'groupNames'=>array(),
00616                  'groupDescriptions'=>array(),
00617                  'descriptions'=>array(),
00618                  'groups'=>array(),
00619                  'parTypes'=>array(),
00620                  'paramSets'=>array());
00621    $xml = simplexml_load_file($filename);
00622    $config['version']=(string) $xml->version;
00623    $config['defaultPage']=(string) $xml->defaultPage;
00624    $config['nextPage']=(string) $xml->nextPage;
00625    foreach ($xml->groupNames->children() as $entry) {
00626      $config['groupBits'][$entry->getName()] = (integer) $entry->attributes()->bit;
00627      $config['groupNames'][(integer) $entry->attributes()->bit] = $entry->getName();
00628      $config['groupDescriptions'][(integer) $entry->attributes()->bit]=trim((string)$entry,"\" ");
00629    }
00630    foreach ($xml->descriptions->children() as $entry) {
00631      $config['descriptions'][$entry->getName()]=trim((string)$entry,"\"");
00632    }
00633    foreach ($xml->groups->children() as $entry) {
00634      if ((string)$entry) {
00635         $value=0;
00636         foreach (explode(',',trim((string)$entry,'" ')) as $key) $value |= (1<< ($config['groupBits'][$key]));
00637         $config['groups'][$entry->getName()]=$value;
00638         $config['parTypes'][$entry->getName()]=$entry->attributes()->type;
00639      }
00640    }
00641    foreach ($xml->paramSets->children() as $paramSet) {
00642      $numSet=(integer)$paramSet->attributes()->number;
00643      $config['paramSets'][$numSet] = array();
00644 //     foreach ($paramSet->children() as $param)  $config['paramSets'][$numSet][$param->getName()]=myval((string) $param);
00645      foreach ($paramSet->children() as $param) {
00646 //        echo $param->getName();var_dump((string)$param);
00647           $config['paramSets'][$numSet][$param->getName()]= trim((string) $param, "\" ") ;
00648      }
00649    }
00650  return $config;
00651 }
00652 
00653 function encodeConfig($config) {
00654 //echo "encodeConfig()";print_r($config);
00655      $xml ="<?xml version=\"1.0\" standalone=\"yes\"?>\n<!-- This file is generated by ".$_SERVER['argv'][0]." -->\n";
00656      $xml.="  <autocampars>\n";
00657      $xml.="<!-- File version -->\n";
00658      $xml.=sprintf("    <version>%s</version>\n",$config['version']);
00659      $xml.="<!-- Number of parameter page that will be used as default (i.e. after camera boot) -->\n";
00660      $xml.=sprintf("    <defaultPage>%d</defaultPage>\n",$config['defaultPage']);
00661      $xml.="<!-- Number of parameter page that will be next used to save parameters (if not specified) -->\n";
00662      $xml.=sprintf("    <nextPage>%d</nextPage>\n",$config['nextPage']);
00663      $xml.="<!-- Descriptions of the parameters -->\n";
00664      $xml.="    <descriptions>\n";
00665      foreach ($config['descriptions'] as $name=>$description)
00666         $xml.=sprintf("      <%s>%s</%s>\n",$name,htmlspecialchars($description,ENT_QUOTES),$name);
00667      $xml.="    </descriptions>\n";
00668      $xml.="<!-- Parameter groups that can be restored from the saved values  -->\n";
00669      $xml.="    <groupNames>\n";
00670      foreach ($config['groupBits'] as $key=>$bit)
00671          $xml.=sprintf("      <%s bit=\"%d\">%s</%s>\n",$key,$bit,$config['groupDescriptions'][$bit],$key);
00672      $xml.="    </groupNames>\n";
00673 
00674      $xml.="<!-- Parameter groups -->\n";
00675      $xml.="    <groups>\n";
00676      foreach ($config['groups'] as $key=>$value) {
00677         $groups="";
00678         for ($bit=0;$bit<24;$bit++) if ($value & (1<<$bit)){
00679           if ($groups) $groups.=",";
00680            $groups.=$config['groupNames'][$bit];
00681         } 
00682         if ($config['parTypes'][$key]) $xml.=sprintf("      <%s type=\"%s\">\"%s\"</%s>\n",$key,$config['parTypes'][$key],$groups,$key);
00683         else                           $xml.=sprintf("      <%s>\"%s\"</%s>\n",$key,$groups,$key);
00684      }
00685      $xml.="    </groups>\n";
00686      $xml.="<!-- Saved parameter Sets -->\n";
00687      $xml.="    <paramSets>\n";
00688      foreach ($config['paramSets'] as $index=>$paramSet) {
00689         $xml.=sprintf("      <set number=\"%d\">\n",$index);
00690         foreach ($paramSet as $key=>$value) {
00691           $xml.=sprintf("        <%s>\"%s\"</%s>\n",$key,$value,$key);
00692         }
00693         $xml.="      </set>\n";
00694      }
00695 
00696      $xml.="    </paramSets>\n";
00697 
00698      $xml.="  </autocampars>\n";
00699   return $xml;
00700 }
00701 
00702 function myval ($s) {
00703   $s=trim($s,"\" ");
00704   if (strtoupper(substr($s,0,2))=="0X")   return intval(hexdec($s));
00705   else return intval($s);
00706 }
00707 
00708 
00709 
00712 function createDefaultConfig($version){
00713   $SENSOR_RUN=     ELPHEL_CONST_SENSOR_RUN_CONT;     
00714   $COMPRESSOR_RUN= ELPHEL_CONST_COMPRESSOR_RUN_CONT; 
00715   $HISTMODE_Y=     ELPHEL_CONST_TASKLET_HIST_ONCE;
00716   $HISTMODE_C=     ELPHEL_CONST_TASKLET_HIST_ONCE;
00717   $thisScript=$_SERVER['argv'][0];
00718 return <<<DEFAULT_CONFIG
00719 <?xml version="1.0" standalone="yes"?>
00720 <!-- This file is generated by $thisScript  -->
00721 <autocampars>
00722 <!-- File version -->
00723   <version>$version</version>
00724 <!-- Parameter groups that can be restored from the saved values  -->
00725   <groupNames>
00726    <init          bit="0" >"Initialization"</init>
00727    <woi           bit="1" >"Window of Interest (WOI)"</woi>
00728    <image         bit="2" >"Image color, quality, ..."</image>
00729    <histWnd       bit="3" >"Histogram Window"</histWnd>
00730    <autoexposure  bit="5" >"Autoexposure"</autoexposure>
00731    <whiteBalance  bit="6" >"White Balance"</whiteBalance>
00732    <streamer      bit="7" >"Streamer"</streamer>
00733    <camftp        bit="8" >"FTP Upload"</camftp>
00734    <camogm        bit="9" >"In-camera recording"</camogm>
00735    <vignet        bit="10" >"Vignetting correction"</vignet>
00736    <unsafe        bit="22" >"Not safe yet"</unsafe>
00737    <diagn         bit="23">"Diagnostics, debug"</diagn>
00738   </groupNames>
00739 <!-- Number of parameter page that will be used as default (i.e. after camera boot) -->
00740 <defaultPage>0</defaultPage>
00741 <!-- Number of parameter page that will be next used to save parameters (if not specified) -->
00742 <nextPage>1</nextPage>
00743 <!-- Descriptions of the parameters -->
00744   <descriptions>
00745      <comment>"init"</comment>
00746      <timestamp>"init"</timestamp>
00747      <SENSOR>"Sensor ID number is determined by driver. Writing 0 to this location will re-start sensor identification"</SENSOR>
00748      <SENSOR_RUN>"Senosor can be stopped (0), acquire a single frame (1) or run continuously (2)"</SENSOR_RUN>
00749      <ACTUAL_WIDTH>"Actual image size (appropriately divided when decimation is used) - readonly"</ACTUAL_WIDTH>
00750      <ACTUAL_HEIGHT>"Actual image height (appropriately divided when decimation is used) - readonly"</ACTUAL_HEIGHT>
00751      <BAYER>"Bayer mosaic shift 0..3 (+1 - swap horisontally,+2 - swap vertically)"</BAYER>
00752      <PERIOD>"Frame period in pixel clock cycles - readonly"</PERIOD>
00753      <FP1000SLIM>"FPS limit as integer number of frames per 1000 seconds"</FP1000SLIM>
00754      <FRAME>"Absolute frame number, counted by the sensor frame sync pulses. Includes the frames that are not compressed and never appeared in the circbuf."</FRAME>
00755      <CLK_FPGA>"Sensor clock in HZ (so 96MHz is 96000000)"</CLK_FPGA>
00756      <CLK_SENSOR>"FPGA compressor/memory clock in HZ (so 1600Hz is 160000000)"</CLK_SENSOR>
00757      <FPGA_XTRA>"Extra clock cycles compressor needs to compress a frame in addition to the number of compressed pixels (for non-jp4 images each sensor pixel needs 3 FPGA clock cycles, for some of the jp4 modes - 2 clocks/pixel"</FPGA_XTRA>
00758      <TRIG>"Trigger mode. currently 0 - free running, 4 - triggered by external signal or FPGA timing generator."</TRIG>
00759      <EXPOS>"Exposure time in microseconds. Sensor driver modifies the value of this parameter to be multiple of sensor scan line times (see VEXPOS)"</EXPOS>
00760      <BGFRAME></BGFRAME>
00761      <IMGSZMEM></IMGSZMEM>
00762      <PAGE_ACQ></PAGE_ACQ>
00763      <PAGE_READ></PAGE_READ>
00764      <OVERLAP></OVERLAP>
00765      <VIRT_KEEP>"Preserve \"virtual window\" size when resizing the window of interest (WOI) if non-zero. That will preserve the same FPS when resizing WOI"</VIRT_KEEP>
00766      <VIRT_WIDTH>"Width of the virtual window defines the time of reading out 1 sensor scan line. Normally this parameter is determined by the driver automatically, but may be manually modified."</VIRT_WIDTH>
00767      <VIRT_HEIGHT>"Height of the virtual window defines the frame duration in scan lines. Readout period (in free-running, not externally triggered mode) is equal to the product of VIRT_WIDTH * VIRT_HEIGHT. Normally this parameter is determined by the driver automatically, but may be manually modified."</VIRT_HEIGHT>
00768      <WOI_LEFT>"Window of interest left margin. Should be even number"</WOI_LEFT>
00769      <WOI_TOP>"Window of interest top margin. Should be even number"</WOI_TOP>
00770      <WOI_WIDTH>"Window of interest width. Should be multiple of 16 (divided by decimation if any). This parameter is modified by the driver according to the sensor capabilities, so if you put 10000 this value will be reduced to the full sensor width."</WOI_WIDTH>
00771      <WOI_HEIGHT>"Window of interest height. Should be multiple of 16 (divided by decimation if any). This parameter is modified by the driver according to the sensor capabilities, so if you put 10000 this value will be reduced to the full sensor width."</WOI_HEIGHT>
00772      <FLIPH>"Mirroring (flipping) the image horizontally. Driver is aware of the sensor orientation in Elphel cameras so value 0 is used for normal image orientation when captured by the camera (contrary to the previously released software)"</FLIPH>
00773      <FLIPV>"Mirroring (flipping) the image vertically. Driver is aware of the sensor orientation in Elphel cameras so value 0 is used for normal image orientation when captured by the camera (contrary to the previously released software)"</FLIPV>
00774      <FPSFLAGS>"FPS limit mode - bit 0 - limit fps (not higher than), bit 1 - maintain fps (not lower than)"</FPSFLAGS>
00775      <DCM_HOR>"Horizontal decimation of the image (as supported by the sensor). Actual number of pixels read from the senor will is divided (from the WOI size) by this value (0 considered to be the same as 1)"</DCM_HOR>
00776      <DCM_VERT>"Vertical decimation of the image (as supported by the sensor). Actual number of pixels read from the senor will is divided (from the WOI size) by this value (0 considered to be the same as 1)"</DCM_VERT>
00777      <BIN_HOR>"Horizontal binning (adding/averaging) of several adjacent  pixels  of the same color (so odd and even pixels are processed separately) as supported by the sensor."</BIN_HOR>
00778      <BIN_VERT>"Vertical binning (adding/averaging) of several adjacent  pixels  of the same color (so odd and even pixels are processed separately) as supported by the sensor."</BIN_VERT>
00779      <FPGATEST>"Replace the image from the sensor with the internally generated test pattern. Currently only two values are supported: 0 - npormal image, 1 horizontal gradient.</FPGATEST>
00780      <TESTSENSOR>"Sensor internal test modes: 0x10000 - enable, lower bits - test mode value"</TESTSENSOR>
00781      <COLOR>"Compressor modes (only modes 0..2 can be processed with standard libjpeg):`
00782                0 - mono6, monochrome (color YCbCr 4:2:0 with zeroed out color componets)`
00783                1 - color, YCbCr 4:2:0, 3x3 pixels`
00784                2 - jp46 - original jp4, encoded as 4:2:0 with zeroed color components`
00785                3 - jp46dc, modified jp46 so each color component uses individual DC diffenential encoding`
00786                4 - reserved for color with 5x5 conversion (not yet implemented)`
00787                5 - jp4 with ommitted color components (4:0:0)`
00788                6 - jp4dc, similar to jp46dc encoded as 4:0:0`
00789                7 - jp4diff, differential where (R-G), G, (G2-G) and (B-G) components are encoded as 4:0:0`
00790                8 - jp4hdr, (R-G), G, G2,(B-G) are encoded so G2 can be used with high gain`
00791                9 - jp4fiff2, (R-G)/2, G,(G2-G)/2, (B-G)/2 to avoid possible overflow in compressed values`
00792               10 - jp4hdr2, (R-G)/2, G,G2,(B-G)/2`
00793               14 - mono,  monochrome with ommitted color components (4:0:0)"</COLOR>
00794      <FRAMESYNC_DLY>"not used, should be 0"</FRAMESYNC_DLY>
00795      <PF_HEIGHT>"Height of the strip in photofinish mode (not functional)"</PF_HEIGHT>
00796      <BITS>"data width stored from the sensor - can be either 8 or 16. 16 bit mode bypasses gamma-conversion, but it is not supported by the compressor"</BITS>
00797      <SHIFTL>"not used, should be 0"</SHIFTL>
00798      <FPNS>"FPN correction subtract scale - not yet supported by current software"</FPNS>
00799      <FPNM>"FPN correction multiply scale - not yet supported by current software"</FPNM>
00800      <VEXPOS>"Exposure measured in sensor native units - number of scan lines, it can be any integer number, while the EXPOS measured in microseconds is modified by the driver to make it multiple of scan lines. Both VEXPOS and EXPOS can be used to specify exposure."</VEXPOS>
00801      <VIRTTRIG>"Not used, should be 0"</VIRTTRIG>
00802      <PERIOD_MIN>Minimal frame period (in pixel clock cycles) calculated by the driver from the user and hardware limitations (readonly)</PERIOD_MIN>
00803      <PERIOD_MAX>Maximal frame period (in pixel clock cycles) calculated by the driver from the user and hardware limitations  (readonly)</PERIOD_MAX>
00804      <SENSOR_PIXH>Pixels to be read from the sensor, horizontal,incliding margins, excluding embedded timestamps (readonly)</SENSOR_PIXH>
00805      <SENSOR_PIXV>Pixels to be read from the sensor, vertical, incliding margins (readonly)</SENSOR_PIXV>
00806      <GAINR>"Red channel sensor analog gain multiplied by 0x100 (256), so 0x100 corresponds to  x1.0 gain. Driver updates this value according to the sensor capabilities"</GAINR>
00807      <GAING>"Green channel sensor analog gain multiplied by 0x100 (256), so 0x100 corresponds to  x1.0 gain. Driver updates this value according to the sensor capabilities. Green channel is used in automatic exposure adjustment and as reference to differencial color gains."</GAING>
00808      <GAINGB>"Second green (GB - green in blue line) channel sensor analog gain multiplied by 0x100 (256), so 0x100 corresponds to  x1.0 gain. Normally the second green channel is programmed to have the same gain as the first green, but can be used separately for HDR applications. Driver updates this value according to the sensor capabilities."</GAINGB>
00809      <GAINB>"Blue channel sensor analog gain multiplied by 0x100 (256), so 0x100 corresponds to  x1.0 gain. Driver updates this value according to the sensor capabilities"</GAINB>
00810      <FATZERO>"not used"</FATZERO>
00811      <QUALITY>"JPEG compression quality in percents. Supports individual setting of the Y and C quantization tables and quality values when the second byte is non-zero. In that case the bit7 determines which of the 2 quantization table prototypes will be used for Y (normally - 0), inverted bit 15 - prototype for C. Normally it is 0, so tabele 1 (color) is used, this when bit is set to 1 ( |=0x8000) the table 0 will be used instead). Bits 0..6 and 8..14 determine compression quality setting for Y and C, respectively."</QUALITY>
00812      <FP1000S>"Current sensor frame rate measured in frames per 1000 seconds"</FP1000S>
00813      <SENSOR_WIDTH>Sensor width in pixels (readonly)</SENSOR_WIDTH>
00814      <SENSOR_HEIGHT>Sensor height in pixels (readonly)</SENSOR_HEIGHT>
00815      <COLOR_SATURATION_BLUE>"Saturation of blue color (B-G) in percents. This scale value is used in the Bayer-to-YCbCr converter that feeds the JPEG compressor. Normally the saturation should be more than 100 to compensate the color washout when the gamma correction value is less than 1.0, because the gamma correction (which is applied to the raw Bayer pixel data) decrease relative (divided by the full value) difference between color components"</COLOR_SATURATION_BLUE>
00816      <COLOR_SATURATION_RED>"Saturation of red color (R-G) in percents. This scale value is used in the Bayer-to-YCbCr converter that feeds the JPEG compressor. Normally the saturation should be more than 100 to compensate the color washout when the gamma correction value is less than 1.0, because the gamma correction (which is applied to the raw Bayer pixel data) decrease relative (divided by the full value) difference between color components"</COLOR_SATURATION_RED>
00817       <VIGNET_AX>"AX in AX*X^2+BX*X+AY*Y^2+BY*Y+C"</VIGNET_AX>
00818       <VIGNET_AY>"AY in AX*X^2+BX*X+AY*Y^2+BY*Y+C"</VIGNET_AY>
00819       <VIGNET_BX>"BX in AX*X^2+BX*X+AY*Y^2+BY*Y+C"</VIGNET_BX>
00820       <VIGNET_BY>"BY in AX*X^2+BX*X+AY*Y^2+BY*Y+C"</VIGNET_BY>
00821       <VIGNET_C>"C in AX*X^2+BX*X+AY*Y^2+BY*Y+C"</VIGNET_C>
00822       <VIGNET_SHL>"Additional shift left of the vignetting correction multiplied by digital gain. Default 1"</VIGNET_SHL>
00823       <VIGNET_ZERIN>"Will be subtracted from the 16-bit unsigned scaled sensor data before multiplying by vignetting correction and color balancing scale. It is a 17-bit signed data"</VIGNET_ZERIN>
00824       <VIGNET_ZEROUT>"Will be added to the result of multiplication of the 16-bit sennsor data (with optionally subtracted VIGNET_ZERIN) by color correction coefficient/vignetting correction coefficient"</VIGNET_ZEROUT>
00825       <DGAINR>"&quot;Digital gain&quot; for the red color channel - 17 bit unsigned value. Default value is 0x8000 fro 1.0, so up to 4X gain boost is available before saturation"</DGAINR>
00826       <DGAING>"&quot;Digital gain&quot; for the green color channel - 17 bit unsigned value. Default value is 0x8000 fro 1.0, so up to 4X gain boost is available before saturation"</DGAING>
00827       <DGAINGB>"&quot;Digital gain&quot; for second green color channel - 17 bit unsigned value. Default value is 0x8000 fro 1.0, so up to 4X gain boost is available before saturation"</DGAINGB>
00828       <DGAINB>"&quot;Digital gain&quot; for the blue color channel - 17 bit unsigned value. Default value is 0x8000 fro 1.0, so up to 4X gain boost is available before saturation"</DGAINB>
00829      <ZBINROUND>"Fine tuning of the compressor quantizer, combines 2 bytes: zero bin + ((rounding add) &lt;&lt; 8) 8-bit JPEG quantizer zero bin size, fractional addition to absolute value before truncating."</ZBINROUND>
00830      <TILES>Number of 16x16 (20x20) tiles in a compressed frame (readonly)</TILES>
00831      <SENSOR_PHASE>"Sensor phase adjusment, packed, low 16 bit - signed fine phase, bits [18:17] - 90-degrees shift"</SENSOR_PHASE>
00832      <AUTOEXP_ON>"1 - autoexposure enabled when, 0 - autoexpousre disabled. Autoexposure can still be off if the bit responsible for autoexposure daemon in DAEMON_EN is turned off - in the latter case the whole autoexposure daemon will be disabled, including white balancing and hdr mode also."</AUTOEXP_ON>
00833      <HISTWND_RWIDTH>"Histogram (used for autoexposure, white balancing and just histograms display) window width, relative to the window (WOI) width. It is defined as a fraction of 65536(0x10000), so 0x8000 is 50%"</HISTWND_RWIDTH>
00834      <HISTWND_RHEIGHT>"Histogram (used for autoexposure, white balancing and just histograms display) window height, relative to the window (WOI) height. It is defined as a fraction of 65536(0x10000), so 0x8000 is 50%"</HISTWND_RHEIGHT>
00835      <HISTWND_RLEFT>"Histogram (used for autoexposure, white balancing and just histograms display) window left position, relative to the window (WOI) remaining (after HISTWND_RWIDTH). It is defined as a fraction of 65536(0x10000), so when HISTWND_RLEFT=0x8000 and HISTWND_RWIDTH=0x8000 that will put histogram window in the center 50% leaving 25% from each of the left and right WOI limits"</HISTWND_RLEFT>
00836      <HISTWND_RTOP>"Histogram (used for autoexposure, white balancing and just histograms display) window top position, relative to the window (WOI) remaining (after HISTWND_RHEIGHT). It is defined as a fraction of 65536(0x10000), so when HISTWND_RTOP=0x8000 and HISTWND_RHEIGHT=0x8000 that will put histogram window vertically in the center 50% leaving 25% from each of the top and bottom WOI limits"</HISTWND_RTOP>
00837      <AUTOEXP_EXP_MAX>"Maximal exposure time allowed to autoexposure daemon. Currently it is set in maximal number of scanlines, not in absolute time units"</AUTOEXP_EXP_MAX>
00838      <AUTOEXP_OVEREXP_MAX>"not used"</AUTOEXP_OVEREXP_MAX>
00839      <AUTOEXP_S_PERCENT>"not used"</AUTOEXP_S_PERCENT>
00840      <AUTOEXP_S_INDEX>"not used"</AUTOEXP_S_INDEX>
00841      <AUTOEXP_EXP>"not used"</AUTOEXP_EXP>
00842      <AUTOEXP_SKIP_PMIN>"not used"</AUTOEXP_SKIP_PMIN>
00843      <AUTOEXP_SKIP_PMAX>"not used"</AUTOEXP_SKIP_PMAX>
00844      <AUTOEXP_SKIP_T>"not used"</AUTOEXP_SKIP_T>
00845      <HISTWND_WIDTH>"Histogram (used for autoexposure, white balancing and just histograms display) window width in pixels (readonly)"</HISTWND_WIDTH>
00846      <HISTWND_HEIGHT>"Histogram (used for autoexposure, white balancing and just histograms display) window height in pixels (readonly)"</HISTWND_HEIGHT>
00847      <HISTWND_TOP>"Histogram (used for autoexposure, white balancing and just histograms display) window top position in pixels (readonly)"</HISTWND_TOP>
00848      <HISTWND_LEFT>"Histogram (used for autoexposure, white balancing and just histograms display) window left position in pixels (readonly)"</HISTWND_LEFT>
00849      <FOCUS_SHOW>"Show focus information instead of/combined with the image: 0 - regular image, 1 - block focus instead of Y DC (AC=0), 2 - image Y DC combined all frame, 3 combined in WOI"</FOCUS_SHOW>
00850      <FOCUS_SHOW1>"Additional parameter that modifies visualization mode. Currently just a single bit (how much to add)"</FOCUS_SHOW1>
00851      <RFOCUS_LEFT>"init"</RFOCUS_LEFT>
00852      <RFOCUS_WIDTH>"init"</RFOCUS_WIDTH>
00853      <RFOCUS_TOP>"init"</RFOCUS_TOP>
00854      <RFOCUS_HEIGHT>"init"</RFOCUS_HEIGHT>
00855      <FOCUS_LEFT>"Focus WOI left margin, in pixels, inclusive (3 LSB will be zeroed as it should be multiple of 8x8 block width)"</FOCUS_LEFT>
00856      <FOCUS_WIDTH>"Focus WOI width (3 LSB will be zeroed as it should be multiple of 8x8 block width)"</FOCUS_WIDTH>
00857      <FOCUS_TOP>"focus WOI top margin, inclusive (3 LSB will be zeroed as it should be multiple of 8x8 block height)"</FOCUS_TOP>
00858      <FOCUS_HEIGHT>"Focus WOI height (3 LSB will be zeroed as it should be multiple of 8x8 block height)"</FOCUS_HEIGHT>
00859      <FOCUS_TOTWIDTH>"Total width of the image frame in pixels (readonly)"</FOCUS_TOTWIDTH>
00860      <FOCUS_FILTER>"Select 8x8 filter used for the focus calculation (same order as quantization coefficients), 0..14"</FOCUS_FILTER>
00861      <TRIG_CONDITION>"FPGA trigger sequencer trigger condition, 0 - internal, else dibits ((use&lt;&lt;1) | level) for each GPIO[11:0] pin"</TRIG_CONDITION>
00862      <TRIG_DELAY>"FPGA trigger sequencer trigger delay, 32 bits in pixel clocks"</TRIG_DELAY>
00863      <TRIG_OUT>"FPGA trigger sequencer trigger output to GPIO, dibits ((use &lt;&lt; 1) | level_when_active). Bit 24 - test mode, when GPIO[11:10] are controlled by other internal signals"</TRIG_OUT>
00864      <TRIG_PERIOD>"FPGA trigger sequencer output sync period (32 bits, in pixel clocks). 0- stop. 1..256 - single, >=256 repetitive with specified period"</TRIG_PERIOD>
00865      <SKIP_FRAMES>"Changes parameter latencies tables pages for each of the trigger modes separately (0/1), currently should be 0"</SKIP_FRAMES>
00866      <I2C_QPERIOD>"Number of system clock periods in 1/4 of i2c SCL period to the sensor/sensor board, set by the driver"</I2C_QPERIOD>
00867      <I2C_BYTES>"Number of bytes in hardware i2c write (after slave addr) -0/1/2, set by the driver"</I2C_BYTES>
00868      <IRQ_SMART>"IRQ mode (2 bits) to combine interrupts from the sensor frame sync and compressor when it is running: +1 - wait for VACT in early compressor_done, +2 - wait for dma fifo ready. Current software assumes both bits are set (value=3), set up by the driver"</IRQ_SMART>
00869      <EARLY_TIMESTAMP>"When 0 - frame sync (start of the frame readout) will be used for timestamping of the images, when 1 and the trigger mode is external (physically external to the camera or just when sensor runs from the FPGA timing generator) the start of exposure will be used for time stamping (exposure time earlier). THis is the default mode to prevent recorded frame period jitter caused by automatic exposure adjustments"</EARLY_TIMESTAMP>
00870      <OVERSIZE>"0 - normal mode, 1 - ignore sensor dimensions, use absolute WOI_LEFT, WOI_TOP - needed to be able to read optically black pixels"</OVERSIZE>
00871      <GTAB_R>"Identifies Gamma-table for the red color. Camera can use either automatically generated tables using the provided black level and gamma (in percent) or arbitrary custom tables, in that case the top 16 bits are used as a 16-bit hash (user provided) to distinguish between different loaded tables. The lower 16 bits determine scale applied to the table (saturated to the full scale), so the value is (black_level&lt;&lt;24) | (gamma_in_percent &lt;&lt;16) | (scale_times_0x1000 &amp; 0xffff). In PHP (or PHP scripts) the individual fields of GTAB_R can be referenced with composite names like GTAB_R__0824 for black level, GTAB_R__0816 for gamma in percents and GTAB_R__1600 for scale.</GTAB_R>
00872      <GTAB_G>"Identifies Gamma-table for the green color. Camera can use either automatically generated tables using the provided black level and gamma (in percent) or arbitrary custom tables, in that case the top 16 bits are used as a 16-bit hash (user provided) to distinguish between different loaded tables. The lower 16 bits determine scale applied to the table (saturated to the full scale), so the value is (black_level&lt;&lt;24) | (gamma_in_percent &lt;&lt;16) | (scale_times_0x1000 &amp; 0xffff). In PHP (or PHP scripts) the individual fields of GTAB_G can be referenced with composite names like GTAB_G__0824 for black level, GTAB_G__0816 for gamma in percents and GTAB_G__1600 for scale.</GTAB_G>
00873      <GTAB_GB>"Identifies Gamma-table for the second green (in blue line) color. Camera can use either automatically generated tables using the provided black level and gamma (in percent) or arbitrary custom tables, in that case the top 16 bits are used as a 16-bit hash (user provided) to distinguish between different loaded tables. The lower 16 bits determine scale applied to the table (saturated to the full scale), so the value is (black_level&lt;&lt;24) | (gamma_in_percent &lt;&lt;16) | (scale_times_0x1000 &amp; 0xffff). In PHP (or PHP scripts) the individual fields of GTAB_GB can be referenced with composite names like GTAB_GB__0824 for black level, GTAB_GB__0816 for gamma in percents and GTAB_GB__1600 for scale.</GTAB_GB>
00874      <GTAB_B>"Identifies Gamma-table for the blue color. Camera can use either automatically generated tables using the provided black level and gamma (in percent) or arbitrary custom tables, in that case the top 16 bits are used as a 16-bit hash (user provided) to distinguish between different loaded tables. The lower 16 bits determine scale applied to the table (saturated to the full scale), so the value is (black_level&lt;&lt;24) | (gamma_in_percent &lt;&lt;16) | (scale_times_0x1000 &amp; 0xffff). In PHP (or PHP scripts) the individual fields of GTAB_B can be referenced with composite names like GTAB_B__0824 for black level, GTAB_B__0816 for gamma in percents and GTAB_B__1600 for scale.</GTAB_B>
00875      <SDRAM_CHN20>"Internal value used by the driver (memory controller register 0 channel 2)"</SDRAM_CHN20>
00876      <SDRAM_CHN21>"Internal value used by the driver (memory controller register 1 channel 2)"</SDRAM_CHN21>
00877      <SDRAM_CHN22>"Internal value used by the driver (memory controller register 2 channel 2)"</SDRAM_CHN22>
00878      <COMPRESSOR_RUN>"Compressor state: 0 - stopped, 1 - compress single frame, 2 - run continuously. Some applications (streamer, videorecorder) rely on this register to be set to 2"</COMPRESSOR_RUN>
00879      <COMPMOD_BYRSH>"Additional bayer shift in compressor only (to swap meanings of the colors), 0..3"</COMPMOD_BYRSH>
00880      <COMPMOD_TILSH>"Diagonal shift of the 16x16 pixel block in the 20x20 tile that compressor receives (0 - top left corner is (0,0), ..., 4 - top left corner is (4,4))"</COMPMOD_TILSH>
00881      <COMPMOD_DCSUB>"Subtract average block pixel value before DCT and add it back after"</COMPMOD_DCSUB>
00882      <COMPMOD_QTAB>"Quantization table bank number (set by the driver)"</COMPMOD_QTAB>
00883      <SENSOR_REGS>Sensor internal registers (sensor-specific). IN PHP/PHP scripts it is possible to reference individual register/bit fields with composite names, i.e. SENSOR_REGS160__0403 in Micron MT9P031 sensor allows to edit test patter number - bits 3..6 of the sensor register 160 (0xa0)</SENSOR_REGS>
00884      <DAEMON_EN>"Controls running daemons (individually turns them on/off by setting/resetting the related bit). It is more convinient to control them as individual bits using defined composite parameters, like DAEMON_EN_AUTOEXPOSURE, DAEMON_EN_STREAMER, etc."</DAEMON_EN>
00885      <DAEMON_EN_AUTOEXPOSURE>"0 - turns autoexposure daemon off, 1 - on. When off - not just autoexposure, but also white balance and HDR are disabled"</DAEMON_EN_AUTOEXPOSURE>
00886      <DAEMON_EN_STREAMER>"0 - turns the videostreamer off, 1 - on."</DAEMON_EN_STREAMER>
00887      <DAEMON_EN_CCAMFTP>"0 - turns the FTP uploader off, 1 - on. (not yet implemented)"</DAEMON_EN_CCAMFTP>
00888      <DAEMON_EN_CAMOGM>"0 - turns videorecording  off, 1 - on. (not yet implemented)"</DAEMON_EN_CAMOGM>
00889      <DAEMON_EN_AUTOCAMPARS>"when set to 1 autocampars daemon will wake up, launch autocampars.php script (that will actually process the provided command of saving/restoring parameters from the file) and goes back to sleep by clearing this bit by itself."</DAEMON_EN_AUTOCAMPARS>
00890      <AEXP_FRACPIX>"Fraction of all pixels that should be below P_AEXP_LEVEL (16.16 - 0x10000 - all pixels)"</AEXP_FRACPIX>
00891      <AEXP_LEVEL>"Target output level:  [P_AEXP_FRACPIX]/0x10000 of all pixels should have value below it (also 16.16 - 0x10000 - full output scale)"</AEXP_LEVEL>
00892      <HDR_DUR>"0 - HDR 0ff, >1 - duration of same exposure (currently 1 or 2 - for free running)"</HDR_DUR>
00893      <HDR_VEXPOS>"Second exposure setting in alternating frames HDR mode. if it is less than 0x10000 - number of lines of exposure, >=10000 - relative to "normal" exposure"</HDR_VEXPOS>
00894      <EXP_AHEAD>"How many frames ahead of the current frame write exposure to the sensor"</EXP_AHEAD>
00895      <AE_THRESH>"Autoexposure error (logariphmic difference between calculated and current exposures) is integrated between frame and corrections are scaled when error is below thershold."</AE_THRESH>
00896      <WB_THRESH>"White balance error (logariphmic difference between calculated and current values) is integrated between frame and corrections are scaled when error is below thershold (not yet implemented)"</WB_THRESH>
00897      <AE_PERIOD>"Autoexposure period (will be increased if below the latency)"</AE_PERIOD>
00898      <WB_PERIOD>"White balance period (will be increased if below the latency)"</WB_PERIOD>
00899      <WB_MASK>"Bitmask - which colors to correct (1 - correct, 0 - ignore). Is used to turn white balancing off (0), default on is 0xd"</WB_MASK>
00900      <WB_WHITELEV>"White balance level of white (16.16 - 0x10000 is full scale, 0xfae1 - 98%, default)"</WB_WHITELEV>
00901      <WB_WHITEFRAC>"White balance fraction (16.16) of all pixels that have level above [P_WB_WHITELEV] for the brightest color [P_WB_WHITELEV] will be decreased if needed to satisfy [P_WB_WHITELEV]. default is 1% (0x028f)"</WB_WHITEFRAC>
00902      <WB_SCALE_R>"Additional correction for red/green from calulated by white balance.  0x10000 - 1.0 (default)"</WB_SCALE_R>
00903      <WB_SCALE_GB>"Additional correction for green2/green from calulated by white balance.  0x10000 - 1.0 (default). May be used for the color HDR mode"</WB_SCALE_GB>
00904      <WB_SCALE_B>"Additional correction for blue/green from calulated by white balance.  0x10000 - 1.0 (default)"</WB_SCALE_B>
00905      <HISTRQ>"Single histogram calculation request address (used automatically)"</HISTRQ>
00906      <HISTRQ_Y>"Single histogram calculation request for Y (green1) histogram (used automatically)"</HISTRQ_Y>
00907      <HISTRQ_C>"Single histogram calculation request for C (red, green2, blue) histograms (used automatically)"</HISTRQ_C>
00908      <HISTRQ_YC>"Single histogram calculation request for Y and C (red, green, green2, blue) histograms (used automatically)"</HISTRQ_YC>
00909      <PROFILE>"index to access profiles as pastpars (i.e. from PHP ELPHEL_PROFILE1,PHP ELPHEL_PROFILE2)"</PROFILE>
00910      <GAIN_MIN>"Minimal sensor analog gain (0x100 - 1.0) - used for  white balancing. May be user limited from the hardware capabilities."</GAIN_MIN>
00911      <GAIN_MAX>"Maximal sensor analog gain (0x100 - 1.0) - used for  white balancing. May be user limited from the hardware capabilities."</GAIN_MAX>
00912      <GAIN_CTRL>"Analog gain control for white balance. Combines GAIN_STEP and GAIN_ENABLE"</GAIN_CTRL>
00913      <GAIN_STEP>"minimal correction to be applied to the analog gain (should be set larger that sensor actual gain step to prevent oscillations (0x100 - 1.0, 0x20 - 1/8)"</GAIN_STEP>
00914      <GAIN_ENABLE>"Enabling analog gain control in white balancing (it uses scaling in gamma tables for fine adjustments and may additionally adjust analog gains if this value is 1"</GAIN_ENABLE>
00915      <AUTOCAMPARS_CTRL>"Input patrameter for the autocampars daemon to execute when enabled: bits 0..24 - parameter groups to restore, bits 28..30: 1 - restore, 2 - save, 3 - set default 4 save as default 5 - init. Combines AUTOCAMPARS_GROUPS, AUTOCAMPARS_PAGE and AUTOCAMPARS_CMD"</AUTOCAMPARS_CTRL>
00916      <AUTOCAMPARS_GROUPS>"Input patrameter for the autocampars daemon to execute when enabled: each of the 24 bits enables restoration of the related parameter group"</AUTOCAMPARS_GROUPS>
00917      <AUTOCAMPARS_PAGE>Input patrameter for the autocampars daemon to execute when enabled - page number to use to save/restore parameters. 0..14 - absolute page number, 15 - default when reading, next after last saved - when writing (15 will be replaced by the particular number by autocampars, so that value can be read back</AUTOCAMPARS_PAGE>
00918      <AUTOCAMPARS_CMD>Commands for the autocampars daemon to execute (to use from PHP - add ELPHEL_CONST_ to the name):`
00919               1 - AUTOCAMPARS_CMD_RESTORE - restore specified groups of parameters from the specified page`
00920               2 - AUTOCAMPARS_CMD_SAVE - save all current parameters to the specified group (page 0 is write-protected)`
00921               3 - AUTOCAMPARS_CMD_DFLT - make selected page the default one (used at startup)`
00922               4 - AUTOCAMPARS_CMD_SAVEDFLT - save all current parameters to the specified group (page 0 is write-protected) and make it default (used at startup)`
00923               5 - AUTOCAMPARS_CMD_INIT - reset sensor/sequencers, restore all parameters from the specified page</AUTOCAMPARS_CMD>
00924      <FTP_PERIOD>"Desired period of image upload to the remote FTP server (seconds)"</FTP_PERIOD>
00925      <FTP_TIMEOUT>"Maximal waiting time for the image to be uploaded to the remote server"</FTP_TIMEOUT>
00926      <FTP_UPDATE>"Maximal time between updates (camera wil re-read remote configuration file)"</FTP_UPDATE>
00927      <FTP_NEXT_TIME>"Sheduled time of the next FTP upload in seconds from epoch (G_ parameter)"</FTP_NEXT_TIME>
00928      <DEBUG>"Selectively enables debug outputs from differnt parts of the drivers. Can easily lock the system as some output goes from inside the interrupt service code or from the parts of the code where interrups are disabled. To us it safely you need to kill the klog daemon an redirect debug output to file with &quot;printk_mod &amp;&quot; command. After that the output will be available as http://camera_ip/var/klog.txt". The printk_mod also kills restart restart daemon so any normally restarted applications (like lighttpd, php, imgsrv) will not be restarted automatically (G_ parameter, not frame-related)</DEBUG>
00929      <MAXAHEAD>"Maximal number of frames ahead of current to be programmed to hardware"</MAXAHEAD>
00930      <THIS_FRAME>"Current absolute frame number (G_ parameter, readonly)"</THIS_FRAME>
00931      <CIRCBUFSIZE>"Circular video buffer size in bytes (G_ parameter, readonly)"</CIRCBUFSIZE>
00932      <FREECIRCBUF>"Free space in the circular video buffer in bytes - only make sense when used with the global read pointer CIRCBUFRP (G_ parameter, readonly)"</FREECIRCBUF>
00933      <CIRCBUFWP>"Circular video buffer write pointer - where the next acquired frame will start(G_ parameter, readonly)"</CIRCBUFWP>
00934      <CIRCBUFRP>"Circular video buffer (global) read pointer. Used for synchronization between applications (i.e. reduce the streamer CPU load/fps if video recorder is not keeping up with the incoming data (G_ parameter)"</CIRCBUFRP>
00935      <SECONDS>"Buffer used to read/write FPGA real time timer, seconds from epoch (G_ parameter)"</SECONDS>
00936      <MICROSECONDS>"Buffer used to read/write FPGA real time timer, microseconds (G_ parameter)"</MICROSECONDS>
00937      <CALLNASAP>"Bit mask of the internal tasks that can use FPGA sequencer - can be modified with parseq.php (G_ parameter)"</CALLNASAP>
00938      <CALLNEXT>"Four registers (CALLNEXT1..CALLNEXT4) that specify latencies of the internal tasks - can be modified with parseq.php (G_ parameters)"</CALLNEXT>
00939      <NEXT_AE_FRAME>"Next frame when autoexposure is scheduled (G_ parameter)"</NEXT_AE_FRAME>
00940      <NEXT_WB_FRAME>"Next frame when white balancing is scheduled (G_ parameter)"</NEXT_WB_FRAME>
00941      <HIST_DIM_01>"Zero levels (on 0xffff scale) for red and green1 color components for white balancing and autoexposure (G_ parameter)"</HIST_DIM_01>
00942      <HIST_DIM_23>"Zero levels (on 0xffff scale) for green2 and blue color components for white balancing and autoexposure (G_ parameter)"</HIST_DIM_23>
00943      <AE_INTEGERR></AE_INTEGERR>
00944      <WB_INTEGERR></WB_INTEGERR>
00945      <TASKLET_CTL>"Tasklet control, parent to HISTMODE_Y, HISTMODE_C and additionally:`
00946               bit 0 (TASKLET_CTL_PGM) - disable programming parameters (should not be)`
00947               Bit 1 (TASKLET_CTL_IGNPAST) - ignore overdue parameters`
00948               Bit 2 (TASKLET_CTL_NOSAME) - do not try to process parameters immediately after being written. If 0, only non-ASAP will be processed`
00949               Bit 3 (TASKLET_CTL_ENPROF) - enable profiling (saving timing of the interrupts/tasklets in pastpars) - can be controlled through PROFILING_EN (G_parameter)"</TASKLET_CTL>
00950      <GFOCUS_VALUE>"Sum of all blocks focus values inside focus WOI (G_ parameter,readonly)"</GFOCUS_VALUE>
00951      <HISTMODE_Y>"Controls when the Y (green1) histograms are calcuted:`
00952               0 - TASKLET_HIST_ALL - calculate each frame`
00953               1 - TASKLET_HIST_HALF calculate each even (0,2,4,6 frame of 8)`
00954               2 - TASKLET_HIST_QUATER  - calculate twice per 8 (0, 4)`
00955               3 - TASKLET_HIST_ONCE - calculate once  per 8 (0)`
00956               4 - TASKLET_HIST_RQONLY -  calculate only when specifically requested`
00957               7 - TASKLET_HIST_NEVER - never calculate.`
00958               NOTE: It is safer to allow all histograms at least once in 8 frames so applications will not be locked up waiting for the missed histogram (G_ parameter)"</HISTMODE_Y>
00959      <HISTMODE_C>"Controls when the C (red, green2, blue) histograms are calcuted:`
00960               0 - TASKLET_HIST_ALL - calculate each frame`
00961               1 - TASKLET_HIST_HALF calculate each even (0,2,4,6 frame of 8)`
00962               2 - TASKLET_HIST_QUATER  - calculate twice per 8 (0, 4)`
00963               3 - TASKLET_HIST_ONCE - calculate once  per 8 (0)`
00964               4 - TASKLET_HIST_RQONLY -  calculate only when specifically requested`
00965               7 - TASKLET_HIST_NEVER - never calculate.`
00966               NOTE: It is safer to allow all histograms at least once in 8 frames so applications will not be locked up waiting for the missed histogram (G_ parameter)"</HISTMODE_C>
00967      <SKIP_DIFF_FRAME>"Maximal number of frames of the different size streamer should skip before giving up - needed to allow acquisition of the full-frame images during streaming lower resolution ones(G_ parameter)"</SKIP_DIFF_FRAME>
00968      <HIST_LAST_INDEX>"Index of the last acquired histograms in the histogram cache (G_ parameter,readonly)"</HIST_LAST_INDEX>
00969      <HIST_Y_FRAME>"Frame number for which last Y (green1) histogram was calculated(G_ parameter,readonly)"</HIST_Y_FRAME>
00970      <HIST_C_FRAME>"Frame number for which last C (red, green2, blue) histogram was calculated(G_ parameter,readonly)"</HIST_C_FRAME>
00971      <DAEMON_ERR>"Bits from up to 32 daemons to report problems or requests (G_ parameter)"</DAEMON_ERR>
00972      <DAEMON_RETCODE>"32 locations - DAEMON_RETCODE0...DAEMON_RETCODE31 to get calues from the running daemons(G_ parameter)"</DAEMON_RETCODE>
00973      <PROFILING_EN>"Enable profiling (saving timing of the interrupts/tasklets in pastpars) - this is a single bit of the TASKLET_CTL parameter.(G_ parameter)"</PROFILING_EN>
00974   </descriptions>
00975 <!-- "init,woi,image,histWnd,autoexposure,whiteBalance,streamer,camftp,camogm,diagn" -->
00976 <!-- Parameter groups -->
00977   <groups>
00978      <comment type="text">"init"</comment>
00979      <timestamp type="text">"init"</timestamp>
00980      <SENSOR></SENSOR>
00981      <SENSOR_RUN>"init"</SENSOR_RUN>
00982      <ACTUAL_WIDTH></ACTUAL_WIDTH>
00983      <ACTUAL_HEIGHT></ACTUAL_HEIGHT>
00984      <BAYER>"init"</BAYER>
00985      <PERIOD></PERIOD>
00986      <FP1000SLIM>"init,streamer"</FP1000SLIM>
00987      <FRAME></FRAME>
00988      <CLK_FPGA>"unsafe"</CLK_FPGA>
00989      <CLK_SENSOR>"unsafe"</CLK_SENSOR>
00990      <FPGA_XTRA>"init"</FPGA_XTRA>
00991      <TRIG>"init"</TRIG>
00992      <EXPOS>"init,autoexposure"</EXPOS>
00993      <BGFRAME></BGFRAME>
00994      <IMGSZMEM></IMGSZMEM>
00995      <PAGE_ACQ></PAGE_ACQ>
00996      <PAGE_READ></PAGE_READ>
00997      <OVERLAP></OVERLAP>
00998      <VIRT_KEEP>"init,woi"</VIRT_KEEP>
00999      <VIRT_WIDTH>"woi"</VIRT_WIDTH>
01000      <VIRT_HEIGHT>"woi"</VIRT_HEIGHT>
01001      <WOI_LEFT>"init,woi"</WOI_LEFT>
01002      <WOI_TOP>"init,woi"</WOI_TOP>
01003      <WOI_WIDTH>"init,woi"</WOI_WIDTH>
01004      <WOI_HEIGHT>"init,woi"</WOI_HEIGHT>
01005      <FLIPH>"init,woi"</FLIPH>
01006      <FLIPV>"init,woi"</FLIPV>
01007      <FPSFLAGS>"init,streamer"</FPSFLAGS>
01008      <DCM_HOR>"init,woi"</DCM_HOR>
01009      <DCM_VERT>"init,woi"</DCM_VERT>
01010      <BIN_HOR>"init,woi"</BIN_HOR>
01011      <BIN_VERT>"init,woi"</BIN_VERT>
01012      <FPGATEST>"init,image,diagn"</FPGATEST>
01013      <TESTSENSOR>"init,image,diagn"</TESTSENSOR>
01014      <COLOR>"init,image"</COLOR>
01015      <FRAMESYNC_DLY>"init"</FRAMESYNC_DLY>
01016      <PF_HEIGHT>"init"</PF_HEIGHT>
01017      <BITS>"init"</BITS>
01018      <SHIFTL>"init,image"</SHIFTL>
01019      <FPNS>"init,image"</FPNS>
01020      <FPNM>"init,image"</FPNM>
01021      <VEXPOS></VEXPOS>
01022      <VIRTTRIG>"init"</VIRTTRIG>
01023      <PERIOD_MIN></PERIOD_MIN>
01024      <PERIOD_MAX></PERIOD_MAX>
01025      <SENSOR_PIXH></SENSOR_PIXH>
01026      <SENSOR_PIXV></SENSOR_PIXV>
01027      <GAINR>"init,image"</GAINR>
01028      <GAING>"init,image"</GAING>
01029      <GAINB>"init,image"</GAINB>
01030      <GAINGB>"init,image"</GAINGB>
01031      <FATZERO></FATZERO>
01032      <QUALITY>"init,image"</QUALITY>
01033      <FP1000S></FP1000S>
01034      <SENSOR_WIDTH></SENSOR_WIDTH>
01035      <SENSOR_HEIGHT></SENSOR_HEIGHT>
01036      <COLOR_SATURATION_BLUE>"init,image"</COLOR_SATURATION_BLUE>
01037      <COLOR_SATURATION_RED>"init,image"</COLOR_SATURATION_RED>
01038      <VIGNET_AX>"init,vignet"</VIGNET_AX>
01039      <VIGNET_AY>"init,vignet"</VIGNET_AY>
01040      <VIGNET_BX>"init,vignet"</VIGNET_BX>
01041      <VIGNET_BY>"init,vignet"</VIGNET_BY>
01042      <VIGNET_C>"init,vignet"</VIGNET_C>
01043      <VIGNET_SHL>"init,vignet"</VIGNET_SHL>
01044      <VIGNET_ZERIN>"init,vignet"</VIGNET_ZERIN>
01045      <VIGNET_ZEROUT>"init,vignet"</VIGNET_ZEROUT>
01046      <DGAINR>"init,vignet"</DGAINR>
01047      <DGAING>"init,vignet"</DGAING>
01048      <DGAINGB>"init,vignet"</DGAINGB>
01049      <DGAINB>"init,vignet"</DGAINB>
01050      <ZBINROUND>"init,image"</ZBINROUND>
01051      <TILES></TILES>
01052      <SENSOR_PHASE>"unsafe"</SENSOR_PHASE>
01053      <AUTOEXP_ON>"init,autoexposure"</AUTOEXP_ON>
01054      <HISTWND_RWIDTH>"init,histWnd"</HISTWND_RWIDTH>
01055      <HISTWND_RHEIGHT>"init,histWnd"</HISTWND_RHEIGHT>
01056      <HISTWND_RLEFT>"init,histWnd"</HISTWND_RLEFT>
01057      <HISTWND_RTOP>"init,histWnd"</HISTWND_RTOP>
01058      <AUTOEXP_EXP_MAX></AUTOEXP_EXP_MAX>
01059      <AUTOEXP_OVEREXP_MAX></AUTOEXP_OVEREXP_MAX>
01060      <AUTOEXP_S_PERCENT></AUTOEXP_S_PERCENT>
01061      <AUTOEXP_S_INDEX></AUTOEXP_S_INDEX>
01062      <AUTOEXP_EXP></AUTOEXP_EXP>
01063      <AUTOEXP_SKIP_PMIN></AUTOEXP_SKIP_PMIN>
01064      <AUTOEXP_SKIP_PMAX></AUTOEXP_SKIP_PMAX>
01065      <AUTOEXP_SKIP_T></AUTOEXP_SKIP_T>
01066      <HISTWND_WIDTH></HISTWND_WIDTH>
01067      <HISTWND_HEIGHT></HISTWND_HEIGHT>
01068      <HISTWND_TOP></HISTWND_TOP>
01069      <HISTWND_LEFT></HISTWND_LEFT>
01070      <FOCUS_SHOW>"init"</FOCUS_SHOW>
01071      <FOCUS_SHOW1>"init"</FOCUS_SHOW1>
01072      <RFOCUS_LEFT>"init"</RFOCUS_LEFT>
01073      <RFOCUS_WIDTH>"init"</RFOCUS_WIDTH>
01074      <RFOCUS_TOP>"init"</RFOCUS_TOP>
01075      <RFOCUS_HEIGHT>"init"</RFOCUS_HEIGHT>
01076      <FOCUS_LEFT></FOCUS_LEFT>
01077      <FOCUS_WIDTH></FOCUS_WIDTH>
01078      <FOCUS_TOP></FOCUS_TOP>
01079      <FOCUS_HEIGHT></FOCUS_HEIGHT>
01080      <FOCUS_TOTWIDTH></FOCUS_TOTWIDTH>
01081      <FOCUS_FILTER>"init"</FOCUS_FILTER>
01082      <TRIG_CONDITION>"init"</TRIG_CONDITION>
01083      <TRIG_DELAY>"init"</TRIG_DELAY>
01084      <TRIG_OUT>"init"</TRIG_OUT>
01085      <TRIG_PERIOD>"init"</TRIG_PERIOD>
01086      <SKIP_FRAMES>"init"</SKIP_FRAMES>
01087      <I2C_QPERIOD>"unsafe"</I2C_QPERIOD>
01088      <I2C_BYTES>"unsafe"</I2C_BYTES>
01089      <IRQ_SMART>"init"</IRQ_SMART>
01090      <EARLY_TIMESTAMP>"init"</EARLY_TIMESTAMP>
01091      <OVERSIZE>"init"</OVERSIZE>
01092      <GTAB_R>"init,image,whiteBalance"</GTAB_R>
01093      <GTAB_G>"init,image,whiteBalance"</GTAB_G>
01094      <GTAB_GB>"init,image,whiteBalance"</GTAB_GB>
01095      <GTAB_B>"init,image,whiteBalance"</GTAB_B>
01096      <SDRAM_CHN20></SDRAM_CHN20>
01097      <SDRAM_CHN21></SDRAM_CHN21>
01098      <SDRAM_CHN22></SDRAM_CHN22>
01099      <COMPRESSOR_RUN>"init"</COMPRESSOR_RUN>
01100      <COMPMOD_BYRSH>"init,image"</COMPMOD_BYRSH>
01101      <COMPMOD_TILSH>"init,image"</COMPMOD_TILSH>
01102      <COMPMOD_DCSUB>"init,image"</COMPMOD_DCSUB>
01103      <COMPMOD_QTAB></COMPMOD_QTAB>
01104      <SENSOR_REGS></SENSOR_REGS>
01105      <DAEMON_EN>"init,diagn"</DAEMON_EN>
01106      <DAEMON_EN_AUTOEXPOSURE>"init,diagn"</DAEMON_EN_AUTOEXPOSURE>
01107      <DAEMON_EN_STREAMER>"init,streamer,diagn"</DAEMON_EN_STREAMER>
01108      <DAEMON_EN_CCAMFTP>"init,camftp,diagn"</DAEMON_EN_CCAMFTP>
01109      <DAEMON_EN_CAMOGM>"init,camogm,diagn"</DAEMON_EN_CAMOGM>
01110      <DAEMON_EN_AUTOCAMPARS>diagn</DAEMON_EN_AUTOCAMPARS>
01111      <AEXP_FRACPIX>"init,autoexposure"</AEXP_FRACPIX>
01112      <AEXP_LEVEL>"init,autoexposure"</AEXP_LEVEL>
01113      <HDR_DUR>"init,autoexposure"</HDR_DUR>
01114      <HDR_VEXPOS>"init,autoexposure"</HDR_VEXPOS>
01115      <EXP_AHEAD>"init"</EXP_AHEAD>
01116      <AE_THRESH>"init,autoexposure"</AE_THRESH>
01117      <WB_THRESH>"init,whiteBalance"</WB_THRESH>
01118      <AE_PERIOD>"init,autoexposure"</AE_PERIOD>
01119      <WB_PERIOD>"init,whiteBalance"</WB_PERIOD>
01120      <WB_MASK>"init,whiteBalance"</WB_MASK>
01121      <WB_WHITELEV>"init,whiteBalance"</WB_WHITELEV>
01122      <WB_WHITEFRAC>"init,whiteBalance"</WB_WHITEFRAC>
01123      <WB_SCALE_R>"init,whiteBalance"</WB_SCALE_R>
01124      <WB_SCALE_GB>"init,whiteBalance"</WB_SCALE_GB>
01125      <WB_SCALE_B>"init,whiteBalance"</WB_SCALE_B>
01126      <HISTRQ></HISTRQ>
01127      <HISTRQ_Y></HISTRQ_Y>
01128      <HISTRQ_C></HISTRQ_C>
01129      <HISTRQ_YC></HISTRQ_YC>
01130      <PROFILE></PROFILE>
01131      <GAIN_MIN>"init,whiteBalance"</GAIN_MIN>
01132      <GAIN_MAX>"init,whiteBalance"</GAIN_MAX>
01133      <GAIN_CTRL>"init,whiteBalance"</GAIN_CTRL>
01134      <GAIN_STEP>"init,whiteBalance"</GAIN_STEP>
01135      <GAIN_ENABLE>"init,whiteBalance"</GAIN_ENABLE>
01136      <AUTOCAMPARS_CTRL></AUTOCAMPARS_CTRL>
01137      <AUTOCAMPARS_GROUPS></AUTOCAMPARS_GROUPS>
01138      <AUTOCAMPARS_PAGE></AUTOCAMPARS_PAGE>
01139      <AUTOCAMPARS_CMD></AUTOCAMPARS_CMD>
01140      <FTP_PERIOD>"init,camftp"</FTP_PERIOD>
01141      <FTP_TIMEOUT>"init,camftp"</FTP_TIMEOUT>
01142      <FTP_UPDATE>"init,camftp"</FTP_UPDATE>
01143      <FTP_NEXT_TIME></FTP_NEXT_TIME>
01144      <DEBUG>"init"</DEBUG>
01145      <MAXAHEAD>"init"</MAXAHEAD>
01146      <THIS_FRAME></THIS_FRAME>
01147      <CIRCBUFSIZE></CIRCBUFSIZE>
01148      <FREECIRCBUF></FREECIRCBUF>
01149      <CIRCBUFWP></CIRCBUFWP>
01150      <CIRCBUFRP></CIRCBUFRP>
01151      <SECONDS></SECONDS>
01152      <MICROSECONDS></MICROSECONDS>
01153      <CALLNASAP></CALLNASAP>
01154      <CALLNEXT></CALLNEXT>
01155      <NEXT_AE_FRAME></NEXT_AE_FRAME>
01156      <NEXT_WB_FRAME></NEXT_WB_FRAME>
01157      <HIST_DIM_01>"init,autoexposure"</HIST_DIM_01>
01158      <HIST_DIM_23>"init,autoexposure"</HIST_DIM_23>
01159      <AE_INTEGERR></AE_INTEGERR>
01160      <WB_INTEGERR></WB_INTEGERR>
01161      <TASKLET_CTL>"init,diagn"</TASKLET_CTL>
01162      <GFOCUS_VALUE></GFOCUS_VALUE>
01163      <HISTMODE_Y>"init,diagn"</HISTMODE_Y>
01164      <HISTMODE_C>"init,diagn"</HISTMODE_C>
01165      <SKIP_DIFF_FRAME>"init,streamer"</SKIP_DIFF_FRAME>
01166      <HIST_LAST_INDEX></HIST_LAST_INDEX>
01167      <HIST_Y_FRAME></HIST_Y_FRAME>
01168      <HIST_C_FRAME></HIST_C_FRAME>
01169      <DAEMON_ERR></DAEMON_ERR>
01170      <DAEMON_RETCODE></DAEMON_RETCODE>
01171      <PROFILING_EN>"init,diagn"</PROFILING_EN>
01172   </groups>
01173   <paramSets>
01174     <set number="0">
01175      <comment>Default values of parameters (page 0)</comment>
01176      <SENSOR_RUN>$SENSOR_RUN</SENSOR_RUN>
01177      <BAYER>0</BAYER>
01178      <FP1000SLIM>0</FP1000SLIM>
01179      <FPGA_XTRA>1000</FPGA_XTRA>
01180      <TRIG>0</TRIG>
01181      <EXPOS>10000</EXPOS>
01182      <VIRT_KEEP>0</VIRT_KEEP>
01183      <WOI_LEFT>0</WOI_LEFT>
01184      <WOI_TOP>0</WOI_TOP>
01185      <WOI_WIDTH>10000</WOI_WIDTH>
01186      <WOI_HEIGHT>10000</WOI_HEIGHT>
01187      <FLIPH>0</FLIPH>
01188      <FLIPV>0</FLIPV>
01189      <FPSFLAGS>0</FPSFLAGS>
01190      <DCM_HOR>1</DCM_HOR>
01191      <DCM_VERT>1</DCM_VERT>
01192      <BIN_HOR>1</BIN_HOR>
01193      <BIN_VERT>1</BIN_VERT>
01194      <FPGATEST>0</FPGATEST>
01195      <TESTSENSOR>0</TESTSENSOR>
01196      <COLOR>1</COLOR>
01197      <FRAMESYNC_DLY>0</FRAMESYNC_DLY>
01198      <PF_HEIGHT>0</PF_HEIGHT>
01199      <BITS>8</BITS>
01200      <SHIFTL>0</SHIFTL>
01201      <FPNS>0</FPNS>
01202      <FPNM>0</FPNM>
01203      <VIRTTRIG>0</VIRTTRIG>
01204      <GAINR>0x200</GAINR>
01205      <GAING>0x200</GAING>
01206      <GAINB>0x200</GAINB>
01207      <GAINGB>0x200</GAINGB>
01208      <QUALITY>80</QUALITY>
01209      <COLOR_SATURATION_BLUE>200</COLOR_SATURATION_BLUE>
01210      <COLOR_SATURATION_RED>200</COLOR_SATURATION_RED>
01211      <VIGNET_AX>0</VIGNET_AX>
01212      <VIGNET_AY>0</VIGNET_AY>
01213      <VIGNET_BX>0</VIGNET_BX>
01214      <VIGNET_BY>0</VIGNET_BY>
01215      <VIGNET_C>32768</VIGNET_C>
01216      <VIGNET_SHL>1</VIGNET_SHL>
01217      <VIGNET_ZERIN>2560</VIGNET_ZERIN>
01218      <VIGNET_ZEROUT>2560</VIGNET_ZEROUT>
01219      <DGAINR>32768</DGAINR>
01220      <DGAING>32768</DGAING>
01221      <DGAINGB>32768</DGAINGB>
01222      <DGAINB>32768</DGAINB>
01223      <ZBINROUND>"init,image"</ZBINROUND>
01224      <ZBINROUND>0</ZBINROUND>
01225      <AUTOEXP_ON>1</AUTOEXP_ON>
01226      <HISTWND_RWIDTH>0x8000</HISTWND_RWIDTH>
01227      <HISTWND_RHEIGHT>0x8000</HISTWND_RHEIGHT>
01228      <HISTWND_RLEFT>0x8000</HISTWND_RLEFT>
01229      <HISTWND_RTOP>0x8000</HISTWND_RTOP>
01230      <FOCUS_SHOW>0</FOCUS_SHOW>
01231      <FOCUS_SHOW1>0</FOCUS_SHOW1>
01232      <RFOCUS_LEFT>0x8000</RFOCUS_LEFT>
01233      <RFOCUS_WIDTH>0x8000</RFOCUS_WIDTH>
01234      <RFOCUS_TOP>0x8000</RFOCUS_TOP>
01235      <RFOCUS_HEIGHT>0x8000</RFOCUS_HEIGHT>
01236      <FOCUS_FILTER>0</FOCUS_FILTER>
01237      <TRIG_CONDITION>0</TRIG_CONDITION>
01238      <TRIG_DELAY>0</TRIG_DELAY>
01239      <TRIG_OUT>0</TRIG_OUT>
01240      <TRIG_PERIOD>0</TRIG_PERIOD>
01241      <SKIP_FRAMES>0</SKIP_FRAMES>
01242      <IRQ_SMART>3</IRQ_SMART>
01243      <EARLY_TIMESTAMP>1</EARLY_TIMESTAMP>
01244      <OVERSIZE>0</OVERSIZE>
01245      <GTAB_R>0x0a390400</GTAB_R>
01246      <GTAB_G>0x0a390400</GTAB_G>
01247      <GTAB_GB>0x0a390400</GTAB_GB>
01248      <GTAB_B>0x0a390400</GTAB_B>
01249      <COMPRESSOR_RUN>$COMPRESSOR_RUN</COMPRESSOR_RUN>
01250      <COMPMOD_BYRSH>0</COMPMOD_BYRSH>
01251      <COMPMOD_TILSH>0</COMPMOD_TILSH>
01252      <COMPMOD_DCSUB>0</COMPMOD_DCSUB>
01253      <SENSOR_REGS></SENSOR_REGS>
01254      <DAEMON_EN>0</DAEMON_EN>
01255      <DAEMON_EN_AUTOEXPOSURE>1</DAEMON_EN_AUTOEXPOSURE>
01256      <DAEMON_EN_STREAMER>1</DAEMON_EN_STREAMER>
01257      <DAEMON_EN_CCAMFTP>0</DAEMON_EN_CCAMFTP>
01258      <DAEMON_EN_CAMOGM>0</DAEMON_EN_CAMOGM>
01259      <DAEMON_EN_AUTOCAMPARS>1</DAEMON_EN_AUTOCAMPARS>
01260      <AEXP_FRACPIX>0xff80</AEXP_FRACPIX>
01261      <AEXP_LEVEL>0xf800</AEXP_LEVEL>
01262      <HDR_DUR>0</HDR_DUR>
01263      <EXP_AHEAD>3</EXP_AHEAD>
01264      <AE_THRESH>500</AE_THRESH>
01265      <WB_THRESH>500</WB_THRESH>
01266      <AE_PERIOD>4</AE_PERIOD>
01267      <WB_PERIOD>16</WB_PERIOD>
01268      <WB_MASK>0xd</WB_MASK>
01269      <WB_WHITELEV>0xfae1</WB_WHITELEV>
01270      <WB_WHITEFRAC>0x028f</WB_WHITEFRAC>
01271      <WB_SCALE_R>0x10000</WB_SCALE_R>
01272      <WB_SCALE_GB>0x10000</WB_SCALE_GB>
01273      <WB_SCALE_B>0x10000</WB_SCALE_B>
01274      <GAIN_MIN>0x100</GAIN_MIN>
01275      <GAIN_MAX>0xfc00</GAIN_MAX>
01276      <GAIN_STEP>0x20</GAIN_STEP>
01277      <GAIN_ENABLE>1</GAIN_ENABLE>
01278      <FTP_PERIOD>180</FTP_PERIOD>
01279      <FTP_TIMEOUT>360</FTP_TIMEOUT>
01280      <FTP_UPDATE>600</FTP_UPDATE>
01281      <DEBUG>0</DEBUG>
01282      <MAXAHEAD>2</MAXAHEAD>
01283      <HIST_DIM_01>0x0a000a00</HIST_DIM_01>
01284      <HIST_DIM_23>0x0a000a00</HIST_DIM_23>
01285      <AE_INTEGERR></AE_INTEGERR>
01286      <WB_INTEGERR></WB_INTEGERR>
01287      <TASKLET_CTL>0</TASKLET_CTL>
01288      <GFOCUS_VALUE></GFOCUS_VALUE>
01289      <HISTMODE_Y>$HISTMODE_Y</HISTMODE_Y>
01290      <HISTMODE_C>$HISTMODE_C</HISTMODE_C>
01291      <SKIP_DIFF_FRAME>4</SKIP_DIFF_FRAME>
01292      <PROFILING_EN>0</PROFILING_EN>
01293     </set>
01294   </paramSets>
01295 </autocampars> 
01296 
01297 
01298 DEFAULT_CONFIG;
01299 }
01300 ?>

Generated on Fri Nov 28 00:06:21 2008 for elphel by  doxygen 1.5.1