chiark / gitweb /
wip
authorian <ian>
Thu, 15 Jun 2006 14:32:30 +0000 (14:32 +0000)
committerian <ian>
Thu, 15 Jun 2006 14:32:30 +0000 (14:32 +0000)
cebpic/README.protocol
hostside/actual.c [new file with mode: 0644]
hostside/realtime.c
hostside/safety.c
layout/data2safety

index 4de741e607eba9a820347d16d49fc1974c1c6c67..da40540910cd9f76e9d64dfde153aa7464d282c9 100644 (file)
@@ -184,7 +184,8 @@ Bits which do not correspond to defined reversal segments will be
 ignored by the PICs.  The host must send exactly as many bytes as are
 necessary to include all of the reversal segments for each reversers
 board (for every potential reversal segment, regardless of whether
-that segment is a defined segment corresponding to some actual track).
+that segment is a defined segment corresponding to some actual track;
+however a board with _no_ reversers segments used does not count).
 
 For example, if there are 14 reversible segments (numbered 1 to 14)
 then the following message
diff --git a/hostside/actual.c b/hostside/actual.c
new file mode 100644 (file)
index 0000000..d97195b
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * realtime
+ * implementation of safety algorithm's decisions
+ */
+
+static int maxbytechange;
+static PicInsn polarityinsn= { { 0x90 }, 0 };
+
+void actual_inversions_start(void) {
+  polarityinsn.l= 0;
+}
+
+void actual_inversions_done(void) {
+  if (polarityinsn.l)
+    serial_transmit(&polarityinsn);
+}
+
+void actual_inversions_segment(SegmentNum);
index e636ed12efa68d88e4c1b629f8801dc70f842ce8..d94598e75ccadc88a214f061467462ead92deea8 100644 (file)
@@ -113,7 +113,8 @@ static void *serial_readable(oop_source *evts, int fd,
 void serial_transmit(const PicInsn *pi) {
   const PicInsnInfo *pii;
   int objnum;
-  
+
+  fixme decode polarity
   picinsn_decode(pi, pic_command_infos, &pii, &objnum);
 
   if (!pii)
index 8edec108d6bb697ef6dd554bfae37faf9fb6a5c2..487aefc39a859ae1185d6f548826582c927b5f36 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * realtime
+ * safety core algorithm
  */
 
 #include <stdio.h>
index ce477e9202868114fb2ca2fbb04402572598a5ad..13cd0f0ddb9ffbf56d083783e8586043fc23f1f6 100755 (executable)
@@ -151,6 +151,7 @@ sub line_boards_reversers {
     my ($i,$objnum);
     for ($i=0; $i<6; $i++) {
        $objnum= boob2objnum($num,$i,'reverse',0);
+       fixme nreverses seems unused
        $nreverses= $objnum+1 if $objnum >= $nreverses;
     }
 }
@@ -248,10 +249,11 @@ sub boob2objnum_pt {
 
 sub boob2objnum_reverse {
     my ($boardnum,$obj,$boardtype)=@_;
+fixme need to map board num for reversers to 
 
     # Converts board and object number (in canonical pic number plus
-    # and reverse0...reverse5 as seen on pinout diagrams), to
-    # object number for POLARITY command numbered as shown in
+    # and reverse0...reverse5 as seen on pinout diagrams), to the
+    # segment number for POLARITY command numbered as shown in
     # README.protocol.
     #
     # There are three basic stages:
@@ -263,7 +265,7 @@ sub boob2objnum_reverse {
     #  * We figure out which bit of which message byte the
     #    object corresponds to.  (see reverse.asm, polarity_decode_message)
     #
-    #  * We compute the README.protocol bit and byte number.
+    #  * We compute the README.protocol segment number.
     
     my ($cycle,$boardincycle,$cyclebasebyte,$byte,$bit);
     die unless $boardtype eq 'reversers';
@@ -362,6 +364,11 @@ sub mainread () {
     }
 }
 
+sub redaction () {
+    for ($num=0, $mappednum=0; $num<@boardtype; $num++) {
+       next if $boardtype[$num] eq 'detectors';
+       
+
 sub nummap ($) {
     my ($p) = @_;
     $p =~ s/\d{1,6}/ sprintf "%06d%d",$&,$& /ge;
@@ -616,5 +623,6 @@ sub writeasm () {
     o("\n  end\n");
 }
 mainread();
+redaction();
 writeout();
 writeasm();