예제 #1
0
uint32 NetBusAssign32X(NetBus *ob,int32 Address,int32 BitMSB,int32 BitLSB,int32 Value) {
  Stream *out = ob->out;
  int ret_len;
  uint32 ret;
  WriteInt16LE(ob->out,0x0001);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x1E);
  WriteInt32LE(ob->out,Address);
  WriteInt32LE(ob->out,BitMSB);
  WriteInt32LE(ob->out,BitLSB);
  WriteInt32LE(ob->out,Value);
  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) != 0x1E) 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;
} 
예제 #2
0
int32 NetAIOReadys32(NetAIO *ob,const int32* buf) {
  Stream *out = ob->out;
  int ret_len;
  int32 ret;
  WriteInt16LE(ob->out,0x0009);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x1D);
  int i;
  WriteInt32LE(ob->out,ArrayLength(buf));
  for (i=0;i<ArrayLength(buf);i++) {
    WriteInt32LE(ob->out,buf[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) != 0x0009) longjmp(ob->conn->exception,1);
  if (ReadUInt8LE(ob->in) != 0x1D) 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;
} 
예제 #3
0
void NetBusPeekStream(NetBus *ob,int32 address,int32 direction,int8* dest) {
  Stream *out = ob->out;
  int ret_len;
  WriteInt16LE(ob->out,0x0001);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x15);
  WriteInt32LE(ob->out,address);
  WriteInt32LE(ob->out,direction);
  WriteInt32LE(ob->out,ArrayLength(dest));
  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) != 0x15) longjmp(ob->conn->exception,2);
  if (ReadUInt8LE(ob->in) != 0x50) longjmp(ob->conn->exception,3);
  if (ReadInt32LE(ob->in)!=ArrayLength(dest)) longjmp(ob->conn->exception,5);
  {
    int i;
    for(i=0;i<ArrayLength(dest);i++) {
      dest[i] = ReadInt8LE(out);
    }
  }
  if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
} 
예제 #4
0
int32 NetDIOGetMulti(NetDIO *ob,int8* state,int32 offset) {
  Stream *out = ob->out;
  int ret_len;
  int32 ret;
  WriteInt16LE(ob->out,0x0005);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x0C);
  WriteInt32LE(ob->out,ArrayLength(state));
  WriteInt32LE(ob->out,offset);
  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) != 0x0C) longjmp(ob->conn->exception,2);
  if (ReadUInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3);
  ret = ReadInt32LE(out);
  if (ReadUInt8LE(ob->in) != 0x50) longjmp(ob->conn->exception,3);
  if (ReadInt32LE(ob->in)!=ArrayLength(state)) longjmp(ob->conn->exception,5);
  {
    int i;
    for(i=0;i<ArrayLength(state);i++) {
      state[i] = ReadInt8LE(out);
    }
  }
  if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
  return ret;
} 
예제 #5
0
void NetBusBitClear32(NetBus *ob,int32 Address,int32 BitNumber) {
  Stream *out = ob->out;
  int ret_len;
  WriteInt16LE(ob->out,0x0001);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x14);
  WriteInt32LE(ob->out,Address);
  WriteInt32LE(ob->out,BitNumber);
  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) != 0x14) longjmp(ob->conn->exception,2);
  if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
} 
예제 #6
0
void NetDIOSetAsync(NetDIO *ob,int32 DIONum,DIOState State) {
  Stream *out = ob->out;
  int ret_len;
  WriteInt16LE(ob->out,0x0005);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x07);
  WriteInt32LE(ob->out,DIONum);
  WriteInt32LE(ob->out,State);
  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) != 0x0005) longjmp(ob->conn->exception,1);
  if (ReadUInt8LE(ob->in) != 0x07) longjmp(ob->conn->exception,2);
  if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
} 
예제 #7
0
CANResult NetCANRxMulti(NetCAN *ob,CANMessage* msg,int32 min) {
  Stream *out = ob->out;
  int ret_len;
  CANResult ret;
  WriteInt16LE(ob->out,0x0007);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x05);
  WriteInt32LE(ob->out,ArrayLength(msg));
  WriteInt32LE(ob->out,min);
  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) != 0x05) longjmp(ob->conn->exception,2);
  if (ReadInt8LE(ob->in) != 0xCB) longjmp(ob->conn->exception,3);
  ret = ReadInt32LE(out);
  if (ReadInt8LE(ob->in) != 0x74) longjmp(ob->conn->exception,3);
  if (ReadInt32LE(ob->in)!=ArrayLength(msg)) longjmp(ob->conn->exception,5);
  {
    int i;
    for(i=0;i<ArrayLength(msg);i++) {
      if (ReadInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3);
      msg[i].flags = ReadUInt32LE(out);
      if (ReadInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3);
      msg[i].id = ReadUInt32LE(out);
      if (ReadInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3);
      msg[i].t_sec = ReadUInt32LE(out);
      if (ReadInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3);
      msg[i].t_usec = ReadUInt32LE(out);
      if (ReadInt8LE(ob->in) != 0x03) longjmp(ob->conn->exception,3);
      msg[i].length = ReadUInt32LE(out);
      if (ReadInt8LE(ob->in) != 0x40) longjmp(ob->conn->exception,3);
      ReadInt32LE(out);
      {
        int k;
        for(k=0;k<8;k++) {
          msg[i].data[i] = ReadUInt8LE(out);
        }
      }
    }
  }
  if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
  return ret;
} 
예제 #8
0
CANResult NetCANTx(NetCAN *ob,uint32 flags,uint32 id,const int8* data) {
  Stream *out = ob->out;
  int ret_len;
  CANResult ret;
  WriteInt16LE(ob->out,0x0007);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x01);
  WriteUInt32LE(ob->out,flags);
  WriteUInt32LE(ob->out,id);
  int i;
  WriteInt32LE(ob->out,ArrayLength(data));
  for (i=0;i<ArrayLength(data);i++) {
    WriteInt8LE(ob->out,data[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) != 0x0007) longjmp(ob->conn->exception,1);
  if (ReadInt8LE(ob->in) != 0x01) longjmp(ob->conn->exception,2);
  if (ReadInt8LE(ob->in) != 0xCB) longjmp(ob->conn->exception,3);
  ret = ReadInt32LE(out);
  if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
  return ret;
} 
예제 #9
0
int32 NetAIOGets16(NetAIO *ob,int16* buf) {
  Stream *out = ob->out;
  int ret_len;
  int32 ret;
  WriteInt16LE(ob->out,0x0009);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x16);
  WriteInt32LE(ob->out,ArrayLength(buf));
  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) != 0x16) longjmp(ob->conn->exception,2);
  if (ReadUInt8LE(ob->in) != 0x13) longjmp(ob->conn->exception,3);
  ret = ReadInt32LE(out);
  if (ReadUInt8LE(ob->in) != 0x51) longjmp(ob->conn->exception,3);
  if (ReadInt32LE(ob->in)!=ArrayLength(buf)) longjmp(ob->conn->exception,5);
  {
    int i;
    for(i=0;i<ArrayLength(buf);i++) {
      buf[i] = ReadInt16LE(out);
    }
  }
  if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
  return ret;
} 
예제 #10
0
int32* NetEDIOQueryFunction(NetEDIO *ob,EDIOType type) {
  Stream *out = ob->out;
  int ret_len;
  int32* ret;
  WriteInt16LE(ob->out,0x000A);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x03);
  WriteInt32LE(ob->out,type);
  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) != 0x03) longjmp(ob->conn->exception,2);
  if (ReadInt8LE(ob->in) != 0x53) longjmp(ob->conn->exception,3);
  ret_len = ReadInt32LE(ob->in);
  ret = ArrayAlloc(ret_len,4);
  {
    int i;
    for(i=0;i<ret_len;i++) {
      ret[i] = ReadInt32LE(out);
    }
  }
  if (ReadInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
  return ret;
} 
예제 #11
0
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);
} 
예제 #12
0
int32 NetAIOConfigure(NetAIO *ob,const real32* low,const real32* high,const int32* prec,const int32* rate,const int32* trigger,int32 itrig) {
  Stream *out = ob->out;
  int ret_len;
  int32 ret;
  WriteInt16LE(ob->out,0x0009);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x10);
  int i;
  WriteInt32LE(ob->out,ArrayLength(low));
  for (i=0;i<ArrayLength(low);i++) {
    WriteReal32LE(ob->out,low[i]);
  }
  WriteInt32LE(ob->out,ArrayLength(high));
  for (i=0;i<ArrayLength(high);i++) {
    WriteReal32LE(ob->out,high[i]);
  }
  WriteInt32LE(ob->out,ArrayLength(prec));
  for (i=0;i<ArrayLength(prec);i++) {
    WriteInt32LE(ob->out,prec[i]);
  }
  WriteInt32LE(ob->out,ArrayLength(rate));
  for (i=0;i<ArrayLength(rate);i++) {
    WriteInt32LE(ob->out,rate[i]);
  }
  WriteInt32LE(ob->out,ArrayLength(trigger));
  for (i=0;i<ArrayLength(trigger);i++) {
    WriteInt32LE(ob->out,trigger[i]);
  }
  WriteInt32LE(ob->out,itrig);
  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) != 0x10) 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;
} 
예제 #13
0
void NetBusCommit(NetBus *ob,int32 ForceAll) {
  Stream *out = ob->out;
  int ret_len;
  WriteInt16LE(ob->out,0x0001);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x18);
  WriteInt32LE(ob->out,ForceAll);
  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) != 0x18) longjmp(ob->conn->exception,2);
  if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
} 
예제 #14
0
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;
} 
예제 #15
0
int32 NetAIOPut(NetAIO *ob,int32 channel,int32 value) {
  Stream *out = ob->out;
  int ret_len;
  int32 ret;
  WriteInt16LE(ob->out,0x0009);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x13);
  WriteInt32LE(ob->out,channel);
  WriteInt32LE(ob->out,value);
  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) != 0x13) 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;
} 
예제 #16
0
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;
} 
예제 #17
0
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;
} 
예제 #18
0
void NetBusPoke32(NetBus *ob,int32 Address,uint32 Value) {
  Stream *out = ob->out;
  int ret_len;
  WriteInt16LE(ob->out,0x0001);
  WriteInt8LE(ob->out,ob->instance);
  WriteInt8LE(ob->out,0x08);
  WriteInt32LE(ob->out,Address);
  WriteUInt32LE(ob->out,Value);
  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) != 0x08) longjmp(ob->conn->exception,2);
  if (ReadUInt8LE(ob->in) != 0x80) longjmp(ob->conn->exception,2);
} 
예제 #19
0
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;
} 
예제 #20
0
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;
} 
예제 #21
0
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;
} 
예제 #22
0
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;
} 
예제 #23
0
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;
} 
예제 #24
0
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;
} 
예제 #25
0
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;
} 
예제 #26
0
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);
} 
예제 #27
0
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;
}