Added small php script (with accompanying html form) to generate a binary config file (typically named 'contiki.cfg') readable by cpu/6502/lib/config.c.

This commit is contained in:
oliverschmidt 2008-05-15 22:39:30 +00:00
parent 8ea461b039
commit 449fda5f8b
2 changed files with 144 additions and 0 deletions

113
tools/6502/contiki.htm Normal file
View file

@ -0,0 +1,113 @@
<html>
<head>
<title>Contiki Download</title>
<style type="text/css">
tr.p { padding: 15px 0px }
tr.pt { padding-top: 15px }
tr.pb { padding-bottom: 15px }
tr.bg { background-color: black; height: 1px }
</style>
</head>
<body>
<form action="download.php">
<h4 align="center">Download your custom generated Contiki configuration</h4>
<table align="center" cellpadding="0" cellspacing="0">
<tr class="p">
<td>
<input type="radio" name="machine" id="apple2" value="apple2" checked="checked" />
<label for="apple2">Apple //e</label>
</td><td>
<label for="apple2-drv">Ethernet Card:</label>
<select name="apple2-drv" id="apple2-drv" size="1">
<option value="cs8900a.eth" >Uther </option>
<option value="lan91c96.eth">LANceGS</option>
</select>
</td><td>
<label for="apple2-addr">Slot:</label>
<select name="apple2-addr" id="apple2-addr" size="1">
<option value="C090" >1</option>
<option value="C0A0" >2</option>
<option value="C0B0" selected="selected">3</option>
<option value="C0C0" >4</option>
<option value="C0D0" >5</option>
<option value="C0E0" >6</option>
<option value="C0F0" >7</option>
</select>
</td>
</tr><tr class="bg">
<td colspan="3" />
</tr><tr class="p">
<td>
<input type="radio" name="machine" id="c64" value="c64" />
<label for="c64">C64</label>
</td><td>
<label for="c64-drv">Ethernet Card:</label>
<select name="c64-addr-drv" id="c64-drv" size="1">
<option value="DE08-CS8900A.ETH" >RR+RR-Net</option>
<option value="DE00-CS8900A.ETH" >TFE </option>
<option value="DE10-LAN91C96.ETH">ETH64 </option>
</select>
</td>
</tr><tr class="bg">
<td colspan="3" />
</tr><tr class="p">
<td>
<input type="radio" name="machine" id="c128" value="c128" />
<label for="c128">C128</label>
</td><td>
<label for="c128-drv">Ethernet Card:</label>
<select name="c128-addr-drv" id="c128-drv" size="1">
<option value="DE08-CS8900A.ETH" >RR+RR-Net</option>
<option value="DE00-CS8900A.ETH" >TFE </option>
<option value="DE10-LAN91C96.ETH">ETH64 </option>
</select>
</td>
</tr><tr class="bg">
<td colspan="3" />
</tr><tr class="pt">
<td>
<label for="addr-a">IP Address:</label>
</td><td>
<input type="text" name="addr-a" id="addr-a" size="3" maxlength="3" value="192" />.
<input type="text" name="addr-b" id="addr-b" size="3" maxlength="3" value="168" />.
<input type="text" name="addr-c" id="addr-c" size="3" maxlength="3" value="0" />.
<input type="text" name="addr-d" id="addr-d" size="3" maxlength="3" value="111" />
</td>
</tr><tr>
<td>
<label for="mask-a">Subnet Mask:</label>
</td><td>
<input type="text" name="mask-a" id="mask-a" size="3" maxlength="3" value="255" />.
<input type="text" name="mask-b" id="mask-b" size="3" maxlength="3" value="255" />.
<input type="text" name="mask-c" id="mask-c" size="3" maxlength="3" value="255" />.
<input type="text" name="mask-d" id="mask-d" size="3" maxlength="3" value="0" />
</td>
</tr><tr>
<td>
<label for="dgw-a">Default Gateway:</label>
</td><td>
<input type="text" name="dgw-a" id="dgw-a" size="3" maxlength="3" value="192" />.
<input type="text" name="dgw-b" id="dgw-b" size="3" maxlength="3" value="168" />.
<input type="text" name="dgw-c" id="dgw-c" size="3" maxlength="3" value="0" />.
<input type="text" name="dgw-d" id="dgw-d" size="3" maxlength="3" value="1" />
</td>
</tr><tr class="pb">
<td>
<label for="dns-a">DNS Server:</label>
</td><td>
<input type="text" name="dns-a" id="dns-a" size="3" maxlength="3" value="192" />.
<input type="text" name="dns-b" id="dns-b" size="3" maxlength="3" value="168" />.
<input type="text" name="dns-c" id="dns-c" size="3" maxlength="3" value="0" />.
<input type="text" name="dns-d" id="dns-d" size="3" maxlength="3" value="1" />
</td>
</tr><tr class="bg">
<td colspan="3" />
</tr><tr class="p">
<td colspan="3" align="center">
<input type="submit" value="Download" />
</td>
</tr>
</table>
</form>
</body>
</html>

31
tools/6502/download.php Normal file
View file

@ -0,0 +1,31 @@
<?php
$cfg = chr($_GET['addr-a']).chr($_GET['addr-b']).chr($_GET['addr-c']).chr($_GET['addr-d']);
$cfg .= chr($_GET['mask-a']).chr($_GET['mask-b']).chr($_GET['mask-c']).chr($_GET['mask-d']);
$cfg .= chr($_GET['dgw-a']). chr($_GET['dgw-b']). chr($_GET['dgw-c']). chr($_GET['dgw-d']);
$cfg .= chr($_GET['dns-a']). chr($_GET['dns-b']). chr($_GET['dns-c']). chr($_GET['dns-d']);
switch ($_GET['machine']) {
case "apple2":
$hex = $_GET['apple2-addr'];
$drv = $_GET['apple2-drv'];
break;
case "c64":
$hex = strtok($_GET['c64-addr-drv'], '-');
$drv = strtok('-');
break;
case "c128":
$hex = strtok($_GET['c128-addr-drv'], '-');
$drv = strtok('-');
break;
}
$addr = hexdec($hex);
$cfg .= chr($addr % 0x100).chr($addr / 0x100);
$cfg .= $drv;
header('Content-Type: application/octetstream');
header('Content-Disposition: attachment; filename=contiki.cfg');
print($cfg);
?>