void NetBusPokeStream(NetBus *ob,int32 address,int32 direction,const int8* data) { Stream *out = ob->out; int ret_len; WriteInt16LE(ob->out,0x0001); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x16); WriteInt32LE(ob->out,address); WriteInt32LE(ob->out,direction); int i; WriteInt32LE(ob->out,ArrayLength(data)); for (i=0;i<ArrayLength(data);i++) { WriteInt8LE(ob->out,data[i]); } if (ob->conn->mode > 0) ob->conn->count++; if (ob->conn->mode < 2) ob->out->Flush(ob->out); if (ob->conn->mode > 0) return; if (ReadInt16LE(ob->in) != 0x0001) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x16) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); }
VoltageRange* NetAIOVoltageRangeList(NetAIO *ob) { Stream *out = ob->out; int ret_len; VoltageRange* ret; WriteInt16LE(ob->out,0x0009); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x04); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0009) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x04) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x70) longjmp(ob->conn->exception,3); ret_len = ReadInt32LE(ob->in); ret = ArrayAlloc(ret_len,24); { int i; for(i=0;i<ret_len;i++) { if (ReadUInt8LE(ob->in) != 0x31) longjmp(ob->conn->exception,3); if (ReadUInt8LE(ob->in) != 0x23) longjmp(ob->conn->exception,3); ret[i].low.start = ReadReal32LE(out); if (ReadUInt8LE(ob->in) != 0x23) longjmp(ob->conn->exception,3); ret[i].low.step = ReadReal32LE(out); if (ReadUInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3); ret[i].low.count = ReadUInt32LE(out); if (ReadUInt8LE(ob->in) != 0x31) longjmp(ob->conn->exception,3); if (ReadUInt8LE(ob->in) != 0x23) longjmp(ob->conn->exception,3); ret[i].high.start = ReadReal32LE(out); if (ReadUInt8LE(ob->in) != 0x23) longjmp(ob->conn->exception,3); ret[i].high.step = ReadReal32LE(out); if (ReadUInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3); ret[i].high.count = ReadUInt32LE(out); } } if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
int32 NetEDIOPreempt(NetEDIO *ob) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x000A); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x02); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x000A) longjmp(ob->conn->exception,1); if (ReadInt8LE(ob->in) != 0x02) longjmp(ob->conn->exception,2); if (ReadInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
AIOType NetAIOType(NetAIO *ob) { Stream *out = ob->out; int ret_len; AIOType ret; WriteInt16LE(ob->out,0x0009); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x03); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0009) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0xCD) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
uint32 NetCANBaudGet(NetCAN *ob) { Stream *out = ob->out; int ret_len; uint32 ret; WriteInt16LE(ob->out,0x0007); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x03); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0007) longjmp(ob->conn->exception,1); if (ReadInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,2); if (ReadInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3); ret = ReadUInt32LE(out); if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
uint16 NetBusPeek16(NetBus *ob,int32 Address) { Stream *out = ob->out; int ret_len; uint16 ret; WriteInt16LE(ob->out,0x0001); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x05); WriteInt32LE(ob->out,Address); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0001) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x05) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x01) longjmp(ob->conn->exception,3); ret = ReadUInt16LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
DIOCaps NetDIOCapabilities(NetDIO *ob,uint32 num) { Stream *out = ob->out; int ret_len; DIOCaps ret; WriteInt16LE(ob->out,0x0005); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x0B); WriteUInt32LE(ob->out,num); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0005) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x0B) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0xC5) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
DIOState NetDIOGetAsync(NetDIO *ob,int32 DIONum) { Stream *out = ob->out; int ret_len; DIOState ret; WriteInt16LE(ob->out,0x0005); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x08); WriteInt32LE(ob->out,DIONum); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0005) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x08) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0xC4) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
int32 NetAIOReady(NetAIO *ob,int32 channel) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x0009); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x14); WriteInt32LE(ob->out,channel); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0009) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x14) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
int32 NetEDIOQueryPWMfd(NetEDIO *ob,int32 num,uint32 freq[1],uint32 DC[1]) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x000A); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x07); WriteInt32LE(ob->out,num); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x000A) longjmp(ob->conn->exception,1); if (ReadInt8LE(ob->in) != 0x07) longjmp(ob->conn->exception,2); if (ReadInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadInt8LE(ob->in) != 0x43) longjmp(ob->conn->exception,3); ReadInt32LE(out); { int i; for(i=0;i<1;i++) { freq[i] = ReadUInt32LE(out); } } if (ReadInt8LE(ob->in) != 0x43) longjmp(ob->conn->exception,3); ReadInt32LE(out); { int i; for(i=0;i<1;i++) { DC[i] = ReadUInt32LE(out); } } if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
int32 NetEDIOUnlock(NetEDIO *ob,uint32 num,int32 flags) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x000A); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x01); WriteUInt32LE(ob->out,num); WriteInt32LE(ob->out,flags); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x000A) longjmp(ob->conn->exception,1); if (ReadInt8LE(ob->in) != 0x01) longjmp(ob->conn->exception,2); if (ReadInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
int32 NetEDIOHBridge(NetEDIO *ob,int32 num,HBState state) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x000A); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x0B); WriteInt32LE(ob->out,num); WriteInt32LE(ob->out,state); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x000A) longjmp(ob->conn->exception,1); if (ReadInt8LE(ob->in) != 0x0B) longjmp(ob->conn->exception,2); if (ReadInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
uint32 NetEDIOEdgeCount(NetEDIO *ob,int32 num,int32 edge) { Stream *out = ob->out; int ret_len; uint32 ret; WriteInt16LE(ob->out,0x000A); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x09); WriteInt32LE(ob->out,num); WriteInt32LE(ob->out,edge); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x000A) longjmp(ob->conn->exception,1); if (ReadInt8LE(ob->in) != 0x09) longjmp(ob->conn->exception,2); if (ReadInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3); ret = ReadUInt32LE(out); if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
int32 NetBusBitToggle32(NetBus *ob,int32 Address,int32 BitNumber) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x0001); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x1B); WriteInt32LE(ob->out,Address); WriteInt32LE(ob->out,BitNumber); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0001) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x1B) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
uint32 NetAIOChannelSamplePeriod(NetAIO *ob,int32 ch,uint32 ns) { Stream *out = ob->out; int ret_len; uint32 ret; WriteInt16LE(ob->out,0x0009); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x0B); WriteInt32LE(ob->out,ch); WriteUInt32LE(ob->out,ns); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0009) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x0B) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3); ret = ReadUInt32LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
void NetDIOWait(NetDIO *ob,int32* match,int32 min,int32 max,const int32* nh,const int32* nl) { Stream *out = ob->out; int ret_len; WriteInt16LE(ob->out,0x0005); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x09); WriteInt32LE(ob->out,ArrayLength(match)); WriteInt32LE(ob->out,min); WriteInt32LE(ob->out,max); int i; WriteInt32LE(ob->out,ArrayLength(nh)); for (i=0;i<ArrayLength(nh);i++) { WriteInt32LE(ob->out,nh[i]); } WriteInt32LE(ob->out,ArrayLength(nl)); for (i=0;i<ArrayLength(nl);i++) { WriteInt32LE(ob->out,nl[i]); } ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0005) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x09) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x53) longjmp(ob->conn->exception,3); if (ReadInt32LE(ob->in)!=ArrayLength(match)) longjmp(ob->conn->exception,5); { int i; for(i=0;i<ArrayLength(match);i++) { match[i] = ReadInt32LE(out); } } if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); }
int32 NetEDIOPWM(NetEDIO *ob,int32 num,uint32 periodHigh,uint32 periodLow) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x000A); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x04); WriteInt32LE(ob->out,num); WriteUInt32LE(ob->out,periodHigh); WriteUInt32LE(ob->out,periodLow); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x000A) longjmp(ob->conn->exception,1); if (ReadInt8LE(ob->in) != 0x04) longjmp(ob->conn->exception,2); if (ReadInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
uint8 NetBusBitsGet8(NetBus *ob,int32 Address,int32 BitMSB,int32 BitLSB) { Stream *out = ob->out; int ret_len; uint8 ret; WriteInt16LE(ob->out,0x0001); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x1F); WriteInt32LE(ob->out,Address); WriteInt32LE(ob->out,BitMSB); WriteInt32LE(ob->out,BitLSB); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0001) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x1F) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x00) longjmp(ob->conn->exception,3); ret = ReadUInt8LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
int32 NetAIOChannelVoltageRange(NetAIO *ob,int32 ch,real32 low,real32 high) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x0009); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x0D); WriteInt32LE(ob->out,ch); WriteReal32LE(ob->out,low); WriteReal32LE(ob->out,high); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0009) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x0D) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }
int32 NetAIOConfiguration(NetAIO *ob,real32* low,real32* high,int32* prec,int32* t,int32* trigger,int32 itrig[1]) { Stream *out = ob->out; int ret_len; int32 ret; WriteInt16LE(ob->out,0x0009); WriteInt8LE(ob->out,ob->instance); WriteInt8LE(ob->out,0x0E); WriteInt32LE(ob->out,ArrayLength(low)); WriteInt32LE(ob->out,ArrayLength(high)); WriteInt32LE(ob->out,ArrayLength(prec)); WriteInt32LE(ob->out,ArrayLength(t)); WriteInt32LE(ob->out,ArrayLength(trigger)); ob->out->Flush(ob->out); if (ob->conn->mode > 0) { while (ob->conn->count) { ob->conn->count--; ReadInt32LE(ob->in); } } if (ReadInt16LE(ob->in) != 0x0009) longjmp(ob->conn->exception,1); if (ReadUInt8LE(ob->in) != 0x0E) longjmp(ob->conn->exception,2); if (ReadUInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3); ret = ReadInt32LE(out); if (ReadUInt8LE(ob->in) != 0x63) longjmp(ob->conn->exception,3); if (ReadInt32LE(ob->in)!=ArrayLength(low)) longjmp(ob->conn->exception,5); { int i; for(i=0;i<ArrayLength(low);i++) { low[i] = ReadReal32LE(out); } } if (ReadUInt8LE(ob->in) != 0x63) longjmp(ob->conn->exception,3); if (ReadInt32LE(ob->in)!=ArrayLength(high)) longjmp(ob->conn->exception,5); { int i; for(i=0;i<ArrayLength(high);i++) { high[i] = ReadReal32LE(out); } } if (ReadUInt8LE(ob->in) != 0x53) longjmp(ob->conn->exception,3); if (ReadInt32LE(ob->in)!=ArrayLength(prec)) longjmp(ob->conn->exception,5); { int i; for(i=0;i<ArrayLength(prec);i++) { prec[i] = ReadInt32LE(out); } } if (ReadUInt8LE(ob->in) != 0x53) longjmp(ob->conn->exception,3); if (ReadInt32LE(ob->in)!=ArrayLength(t)) longjmp(ob->conn->exception,5); { int i; for(i=0;i<ArrayLength(t);i++) { t[i] = ReadInt32LE(out); } } if (ReadUInt8LE(ob->in) != 0x53) longjmp(ob->conn->exception,3); if (ReadInt32LE(ob->in)!=ArrayLength(trigger)) longjmp(ob->conn->exception,5); { int i; for(i=0;i<ArrayLength(trigger);i++) { trigger[i] = ReadInt32LE(out); } } if (ReadUInt8LE(ob->in) != 0x53) longjmp(ob->conn->exception,3); ReadInt32LE(out); { int i; for(i=0;i<1;i++) { itrig[i] = ReadInt32LE(out); } } if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2); return ret; }