From: ian Date: Tue, 31 May 2005 23:35:09 +0000 (+0000) Subject: cmd_pic wip X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=c15153474f21f672150996b0aa96bdc66dc37e63;p=trains.git cmd_pic wip --- diff --git a/hostside/commands.c b/hostside/commands.c index 51d4f49..3441f9b 100644 --- a/hostside/commands.c +++ b/hostside/commands.c @@ -4,6 +4,7 @@ #include #include #include +#include #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 } diff --git a/hostside/common.h b/hostside/common.h index 5d3a476..3b23057 100644 --- a/hostside/common.h +++ b/hostside/common.h @@ -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 index 0000000..ed9252a --- /dev/null +++ b/hostside/pic-proto.h @@ -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*/