chiark / gitweb /
cmd_pic wip
authorian <ian>
Tue, 31 May 2005 23:35:09 +0000 (23:35 +0000)
committerian <ian>
Tue, 31 May 2005 23:35:09 +0000 (23:35 +0000)
hostside/commands.c
hostside/common.h
hostside/pic-proto.h [new file with mode: 0644]

index 51d4f49958a0de8fc57daef98fa8fdf6adcdd33b..3441f9be03b7d4542db500a7c5d0d3f1892bc8ab 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <assert.h>
+#include <string.h>
 
 #include "hostside.h"
 
@@ -149,10 +150,19 @@ static void cmd_noop(ParseState *ps, const CmdInfo *ci) {
   oprintf(&ps->cl->ch,"noop successful\n");
 }
 
+typedef struct PicCmdInfo PicCmdInfo;
+struct PicCmdInfo {
+  const char *name;
+  Byte opcode;
+  int argbits;
+};
+
+static void cmd_pic(ParseState *ps, const CmdInfo *ci) {
+  if (!ps_needword(ps)) return;
+}
+
 const CmdInfo toplevel_cmds[]= {
-#if 0
-  { "pic",        cmd_pic         }, /* eg pic point 3 */
-#endif
+  { "pic",        cmd_pic         },
   { "nmra",       cmd_nmra,       },
   { "noop",       cmd_noop        },
   { 0 }
index 5d3a476a294b2f38a5b699579b29f0b1a7d4100f..3b2305700b0edcc3f98ccb15d775082c36ade564 100644 (file)
@@ -19,6 +19,11 @@ typedef struct Nmra {
   int l;
 } Nmra;
 
+typedef struct PicInsn {
+  Byte d[COMMAND_ENCODED_MAX];
+  int l;
+} PicInsn;
+
 /*---------- from serialio.c ----------*/
 
 void vdie(const char *fmt, int ev, va_list al)
diff --git a/hostside/pic-proto.h b/hostside/pic-proto.h
new file mode 100644 (file)
index 0000000..ed9252a
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * arranges for the declarations of
+ *  enco_pic_WHATEVER
+ *  onrecv_pic_WHATEVER
+ * and the tables
+ */
+
+#ifndef PROTOCOL_H
+#define PROTOCOL_H
+
+#define HOST2PIC_0(n,o,a) extern void enco_pic_##n(PicInsn *out);
+#define HOST2PIC_1(n,o,a) extern void enco_pic_##n(PicInsn *out, int objnum);
+#define PIC2HOST_0(n,o,a) extern void on_pic_##n(void);
+#define PIC2HOST_1(n,o,a) extern void on_pic_##n(int objnum);
+#include "proto-spec.h"
+#undef HOST2PIC_0
+#undef HOST2PIC_1
+#undef PIC2HOST_0
+#undef PIC2HOST_1
+
+extern void enco_pic_polarity_begin(PicInsn *out);
+extern void enco_pic_polarity_setbit(PicInsn *out, int objnum);
+extern void on_pic_debug(int ch);
+
+typedef struct PicInsnInfo PicInsnInfo;
+struct PicInsnInfo {
+  const char *name;
+  Byte opcode;
+  int argbits;
+};
+
+#endif /*NMRA_H*/