From 92988a21ad4c4c9504295ccb580c9f806134471b Mon Sep 17 00:00:00 2001 From: "H. Nikolaus Schaller" Date: Mon, 26 Mar 2012 20:55:28 +0200 Subject: added boot script files to repository --- tools/bddb/donew.php | 230 --------------------------------------------------- 1 file changed, 230 deletions(-) delete mode 100644 tools/bddb/donew.php (limited to 'tools/bddb/donew.php') diff --git a/tools/bddb/donew.php b/tools/bddb/donew.php deleted file mode 100644 index 39b2c78..0000000 --- a/tools/bddb/donew.php +++ /dev/null @@ -1,230 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // doedit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Board Registration Results"); - - if (isset($_REQUEST['serno'])) { - $serno=$_REQUEST['serno']; - die("serial number must not be set ($serno) when Creating!"); - } - - $query="update boards set"; - - list($y, $m, $d) = split("-", $date); - if (!checkdate($m, $d, $y) || $y < 1999) - die("date is invalid (input '$date', yyyy-mm-dd '$y-$m-$d')"); - $query.=" date='$date'"; - - if ($batch != '') { - if (strlen($batch) > 32) - die("batch field too long (>32)"); - $query.=", batch='$batch'"; - } - - if (!in_array($type, $type_vals)) - die("Invalid type ($type) specified"); - $query.=", type='$type'"; - - if (($rev = intval($rev)) <= 0 || $rev > 255) - die("Revision number is invalid ($rev)"); - $query.=sprintf(", rev=%d", $rev); - - $query.=gather_enum_multi_query("sdram", 4); - - $query.=gather_enum_multi_query("flash", 4); - - $query.=gather_enum_multi_query("zbt", 16); - - $query.=gather_enum_multi_query("xlxtyp", 4); - $nxlx = count_enum_multi("xlxtyp", 4); - - $query.=gather_enum_multi_query("xlxspd", 4); - if (count_enum_multi("xlxspd", 4) != $nxlx) - die("number of xilinx speeds not same as number of types"); - - $query.=gather_enum_multi_query("xlxtmp", 4); - if (count_enum_multi("xlxtmp", 4) != $nxlx) - die("number of xilinx temps. not same as number of types"); - - $query.=gather_enum_multi_query("xlxgrd", 4); - if (count_enum_multi("xlxgrd", 4) != $nxlx) - die("number of xilinx grades not same as number of types"); - - if ($cputyp == '') { - if ($cpuspd != '') - die("can't specify cpu speed if there is no cpu"); - if ($cpmspd != '') - die("can't specify cpm speed if there is no cpu"); - if ($busspd != '') - die("can't specify bus speed if there is no cpu"); - } - else { - $query.=", cputyp='$cputyp'"; - if ($cpuspd == '') - die("must specify cpu speed if cpu type is defined"); - $query.=", cpuspd='$cpuspd'"; - if ($cpmspd == '') - die("must specify cpm speed if cpu type is defined"); - $query.=", cpmspd='$cpmspd'"; - if ($busspd == '') - die("must specify bus speed if cpu type is defined"); - $query.=", busspd='$busspd'"; - } - - if (($hschin = intval($hschin)) < 0 || $hschin > 4) - die("Invalid number of hs input chans ($hschin)"); - if (($hschout = intval($hschout)) < 0 || $hschout > 4) - die("Invalid number of hs output chans ($hschout)"); - if ($hstype == '') { - if ($hschin != 0) - die("number of high-speed input channels must be zero" - . " if high-speed chip is not present"); - if ($hschout != 0) - die("number of high-speed output channels must be zero" - . " if high-speed chip is not present"); - } - else - $query.=", hstype='$hstype'"; - $query.=", hschin='$hschin'"; - $query.=", hschout='$hschout'"; - - // echo "final query = '$query'
\n"; - - $quant = intval($quant); - if ($quant <= 0) $quant = 1; - - $sernos = array(); - if ($geneths) - $ethaddrs = array(); - - $sqlerr = ''; - - while ($quant-- > 0) { - - mysql_query("insert into boards (serno) values (null)"); - if (mysql_errno()) { - $sqlerr = mysql_error(); - break; - } - - $serno = mysql_insert_id(); - if (!$serno) { - $sqlerr = "couldn't allocate new serial number"; - break; - } - - mysql_query($query . " where serno=$serno"); - if (mysql_errno()) { - $sqlerr = mysql_error(); - break; - } - - array_push($sernos, $serno); - - if ($geneths) { - - $ethaddr = gen_eth_addr($serno); - - mysql_query("update boards set ethaddr='$ethaddr'" . - " where serno=$serno"); - if (mysql_errno()) { - $sqlerr = mysql_error(); - - array_push($ethaddrs, - "" . - "db save fail" . - ""); - break; - } - - array_push($ethaddrs, $ethaddr); - } - } - - $nsernos = count($sernos); - - if ($nsernos > 0) { - - write_eeprom_cfg_file(); - - echo "\n"; - echo "\t

\n"; - echo "\t\tThe following board serial numbers were" - . " successfully allocated"; - if ($numerrs > 0) - echo " (but with $numerrs cfg file error" . - ($numerrs > 1 ? "s" : "") . ")"; - echo ":\n"; - echo "\t

\n"; - - echo "
\n"; - - echo "\n"; - echo "\n"; - echo "\t\n"; - if ($numerrs > 0) - echo "\t\n"; - if ($geneths) - echo "\t\n"; - echo "\n"; - - for ($i = 0; $i < $nsernos; $i++) { - - $serno = sprintf("%010d", $sernos[$i]); - - echo "\n"; - - echo "\t\n"; - - if ($numerrs > 0) { - if (($errstr = $cfgerrs[$i]) == '') - $errstr = ' '; - echo "\t\n"; - } - - if ($geneths) { - echo "\t\n"; - } - - echo "\n"; - } - - echo "
Serial NumberCfg File ErrsEthernet Address
" . - "$serno" . - "" . - $errstr . - "" . - "" . - $ethaddrs[$i] . - "
\n"; - } - - if ($sqlerr != '') { - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe following SQL error was encountered:\n"; - echo "\t\t

\n"; - echo "\t\t
\n"; - printf("\t\t\t%s\n", $sqlerr); - echo "\t\t
\n"; - echo "\t
\n"; - } - -?> -

- - - - - -
Go to BrowseBack to Start
- -- cgit v1.1