From f79380c2ef3624b4cd25c50825c372bec6e9a00c Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 4 May 2006 23:58:43 +0000 Subject: [PATCH] working on making realtime link --- hostside/Makefile | 3 ++- hostside/skelproto-pic.c | 20 ++++++++++++++++---- hostside/skelproto-pic.h | 7 ++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/hostside/Makefile b/hostside/Makefile index add2355..0ac0a63 100644 --- a/hostside/Makefile +++ b/hostside/Makefile @@ -16,7 +16,8 @@ hostside-old: serialio.o nmra.o main.o encode.o utils.o realtime: realtime.o startup.o cdumgr.o \ cmdinput.o \ - utils.o serialio.o auproto-pic.o + utils.o serialio.o auproto-pic.o \ + __oop-read-copy.o -loop $(LINK) proto-expanded: ../cebpic/README.protocol diff --git a/hostside/skelproto-pic.c b/hostside/skelproto-pic.c index ec565e2..72440e3 100644 --- a/hostside/skelproto-pic.c +++ b/hostside/skelproto-pic.c @@ -7,23 +7,35 @@ * and related functions */ +#include + #include "common.h" #include "auproto-pic.h" -extern void enco_pic_anyinsn(PicInsn *out, const PicInsnInfo *pii, - int objnum) { +extern void enco_pic_any(PicInsn *out, int opcode, int argbits, int objnum) { unsigned long as= objnum; int i; - out->l= 1 + pii->argbits/7; + assert(!(as & (~0UL << argbits))); + out->l= 1 + argbits; for (i= out->l - 1; i >= 0; i--, as >>= 7) out->d[i]= (as & 0x07fUL) | 0x080UL; out->d[out->l - 1] &= ~0x080UL; - out->d[0] |= pii->opcode; + out->d[0] |= opcode; } +#define C , +#define ENCO(w, xa, opcode, argbits, objnum) \ + extern void enco_pic_##w(PicInsn *out xa) { \ + return enco_pic_any(out, opcode, argbits, objnum); \ + } + +ENCO(pii, C const PicInsnInfo *pii C int objn,pii->opcode,pii->argbits,objn) +ENCO(@cnameyn@, , @opcodeyn@, 0,0) @h2p@ @arglentf=0@ +ENCO(@cnameyn@, C int objnum, @opcodeyn@, @arglen@,objnum) @h2p@ @arglentf=1@ + const PicInsnInfo *lookup_byopcode(Byte byte0, const PicInsnInfo *table) { const PicInsnInfo *pi; for (pi= table; diff --git a/hostside/skelproto-pic.h b/hostside/skelproto-pic.h index f748382..d30cad1 100644 --- a/hostside/skelproto-pic.h +++ b/hostside/skelproto-pic.h @@ -13,8 +13,8 @@ typedef struct PicInsnInfo PicInsnInfo; typedef void PicInputFn(const PicInsnInfo *pii, const PicInsn *pi, int objnum); -void enco_pic_@cname@(PicInsn *out); @h2p@ @arglentf=0@ -void enco_pic_@cname@(PicInsn *out, int objum); @h2p@ @arglentf=1@ +void enco_pic_@cnameyn@(PicInsn *out); @h2p@ @arglentf=0@ +void enco_pic_@cnameyn@(PicInsn *out, int objum); @h2p@ @arglentf=1@ PicInputFn on_pic_@cnameyn@; @p2h@ #define PICMSG_@cnameynu@ @opcodeyn@ #define PICMSG_@cnameynu@_M @opcodemaskyn@ @@ -23,7 +23,8 @@ PicInputFn on_pic_@cnameyn@; @p2h@ extern void enco_pic_polarity_begin(PicInsn *out); extern void enco_pic_polarity_setbit(PicInsn *out, int objnum); -extern void enco_pic_anyinsn(PicInsn *out, const PicInsnInfo *pii, int objnum); +extern void enco_pic_pii(PicInsn *out, const PicInsnInfo *pii, int objnum); +extern void enco_pic_any(PicInsn *out, int opcode, int argbits, int objnum); const PicInsnInfo *lookup_byopcode(Byte byte0, const PicInsnInfo *table); void picinsn_decode(const PicInsn *pi, const PicInsnInfo *table, -- 2.30.2