Skip to content
Snippets Groups Projects
Commit b056d77d authored by Kenneth Hiemstra's avatar Kenneth Hiemstra
Browse files

corrected for node 0,2

parent 510d2975
No related branches found
No related tags found
No related merge requests found
...@@ -239,7 +239,7 @@ bool Fpga::point(const uint clientId, TermOutput& termout, const char cmd, const ...@@ -239,7 +239,7 @@ bool Fpga::point(const uint clientId, TermOutput& termout, const char cmd, const
case REG_FORMAT_BOOLEAN: case REG_FORMAT_BOOLEAN:
case REG_FORMAT_INTEGER: case REG_FORMAT_INTEGER:
for(unsigned int i=0;i<termresults.nof_vals;i++) { for(unsigned int i=0;i<termresults.nof_vals;i++) {
termout.valint[idx*nodes.size()+i] = termresults.valint[i]; termout.valint[idx*termresults.nof_vals+i] = termresults.valint[i];
} }
break; break;
case REG_FORMAT_FLOAT: case REG_FORMAT_FLOAT:
......
...@@ -91,14 +91,14 @@ void Node::worker(const int clientId) ...@@ -91,14 +91,14 @@ void Node::worker(const int clientId)
strerror(errno),clientId,UniboardNr, myIPaddr.c_str(), Type.c_str(), LocalNr, GlobalNr); strerror(errno),clientId,UniboardNr, myIPaddr.c_str(), Type.c_str(), LocalNr, GlobalNr);
continue; continue;
} else { } else {
//printf("Node::worker job (size=%d) for client[%d] Uniboard=%d node IP=%s type=%s localnr=%d globalnr=%d\n", printf("Node::worker job (size=%d) for client[%d] Uniboard=%d node IP=%s type=%s localnr=%d globalnr=%d\n",
// (int)ret,clientId,UniboardNr, myIPaddr.c_str(), Type.c_str(), LocalNr, GlobalNr); (int)ret,clientId,UniboardNr, myIPaddr.c_str(), Type.c_str(), LocalNr, GlobalNr);
} }
//m.lock(); //m.lock();
pread_cmd_struct *p = (pread_cmd_struct *)buf; pread_cmd_struct *p = (pread_cmd_struct *)buf;
/*
cout << "clientId=" << p->clientId; cout << "clientId=" << p->clientId;
cout << " p.relative_addr=" << p->relative_addr; cout << " p.relative_addr=" << p->relative_addr;
cout << " p.type=" << p->type << endl; cout << " p.type=" << p->type << endl;
...@@ -107,7 +107,7 @@ void Node::worker(const int clientId) ...@@ -107,7 +107,7 @@ void Node::worker(const int clientId)
cout << " p.nvalues=" << p->nvalues; cout << " p.nvalues=" << p->nvalues;
cout << " p.format=" << p->format; cout << " p.format=" << p->format;
cout << " p.cmd=" << p->cmdId << endl; cout << " p.cmd=" << p->cmdId << endl;
*/
termout.clear(); termout.clear();
memset((void *)&r,0,sizeof(r)); memset((void *)&r,0,sizeof(r));
...@@ -150,16 +150,14 @@ void Node::worker(const int clientId) ...@@ -150,16 +150,14 @@ void Node::worker(const int clientId)
for(unsigned int i=0;i<termout.nof_vals; i++) { for(unsigned int i=0;i<termout.nof_vals; i++) {
r.valfloat[i] = termout.valfloat[i]; r.valfloat[i] = termout.valfloat[i];
} }
//printf("Node::worker job for client[%d] Uniboard=%d node IP=%s send back %d\n",
// clientId,UniboardNr, myIPaddr.c_str(),sizeof(r));
for(unsigned int i=0;i<termout.nof_vals; i++) { for(unsigned int i=0;i<termout.nof_vals; i++) {
r.valint[i] = termout.valint[i]; r.valint[i] = termout.valint[i];
} }
memcpy((void *)r.valstr, (void *)termout.valstr, sizeof(r.valstr)); memcpy((void *)r.valstr, (void *)termout.valstr, sizeof(r.valstr));
r.datatype = termout.datatype; r.datatype = termout.datatype;
//printf("Node::worker job for client[%d] Uniboard=%d New node IP=%s send back %d\n",
// clientId,UniboardNr, myIPaddr.c_str(),sizeof(r));
ret = write(reply_pipe[clientId][1], (void *)&r, sizeof(r)); ret = write(reply_pipe[clientId][1], (void *)&r, sizeof(r));
//printf("Node::worker job for client[%d] Uniboard=%d New node IP=%s sent done\n",
// clientId,UniboardNr, myIPaddr.c_str());
//m.unlock(); //m.unlock();
} }
printf("Node::worker job for client[%d] Uniboard=%d New node IP=%s leaving!!\n", printf("Node::worker job for client[%d] Uniboard=%d New node IP=%s leaving!!\n",
...@@ -173,6 +171,7 @@ Node::Node(const string ipaddr, const uint unb, const uint localnr, const std::s ...@@ -173,6 +171,7 @@ Node::Node(const string ipaddr, const uint unb, const uint localnr, const std::s
myIPaddr = ipaddr; myIPaddr = ipaddr;
Nof_pipes = nof_pipes; Nof_pipes = nof_pipes;
ucp_connection = new UCP*[nof_pipes]; ucp_connection = new UCP*[nof_pipes];
for(int i=0;i<Nof_pipes;i++) { for(int i=0;i<Nof_pipes;i++) {
ucp_connection[i] = new UCP(ipaddr); ucp_connection[i] = new UCP(ipaddr);
...@@ -185,10 +184,11 @@ Node::Node(const string ipaddr, const uint unb, const uint localnr, const std::s ...@@ -185,10 +184,11 @@ Node::Node(const string ipaddr, const uint unb, const uint localnr, const std::s
if(type!="pn") throw runtime_error("invalid node type: \"" + type + "\""); if(type!="pn") throw runtime_error("invalid node type: \"" + type + "\"");
Type=type; Type=type;
//syslog(LOG_INFO,"Uniboard=%d New node IP=%s type=%s localnr=%d globalnr=%d\n", //syslog(LOG_INFO,"Uniboard=%d New node IP=%s type=%s localnr=%d globalnr=%d\n",
// UniboardNr, myIPaddr.c_str(), Type.c_str(), LocalNr, GlobalNr); // UniboardNr, myIPaddr.c_str(), Type.c_str(), LocalNr, GlobalNr);
printf("Uniboard=%d New node IP=%s type=%s localnr=%d globalnr=%d\n", printf("Uniboard=%d New node IP=%s type=%s localnr=%d globalnr=%d enabled=%d\n",
UniboardNr, myIPaddr.c_str(), Type.c_str(), LocalNr, GlobalNr); UniboardNr, myIPaddr.c_str(), Type.c_str(), LocalNr, GlobalNr, enabled);
reply_pipe = new int*[nof_pipes]; reply_pipe = new int*[nof_pipes];
cmd_pipe = new int*[nof_pipes]; cmd_pipe = new int*[nof_pipes];
......
...@@ -137,6 +137,7 @@ bool Periph_fpga::Read(UCP *ucp, const std::string addr_str, const uint32_t offs ...@@ -137,6 +137,7 @@ bool Periph_fpga::Read(UCP *ucp, const std::string addr_str, const uint32_t offs
bool isfifo = registerMap->type_isfifo((addr_str)); bool isfifo = registerMap->type_isfifo((addr_str));
ret = ucp->readRegister(addr,nvalues,data_ptr,isfifo); ret = ucp->readRegister(addr,nvalues,data_ptr,isfifo);
//usleep(300000);
if(ret && (shift != 0 || mask != 0xffffffff)) { if(ret && (shift != 0 || mask != 0xffffffff)) {
for(uint32_t i=0; i < nvalues; i++) { for(uint32_t i=0; i < nvalues; i++) {
data_ptr[i] &= mask; data_ptr[i] &= mask;
...@@ -165,6 +166,7 @@ bool Periph_fpga::Write(UCP *ucp, const std::string addr_str, const uint32_t off ...@@ -165,6 +166,7 @@ bool Periph_fpga::Write(UCP *ucp, const std::string addr_str, const uint32_t off
data_ptr[i] &= mask; data_ptr[i] &= mask;
} }
} }
//usleep(300000);
return ucp->writeRegister(addr,nvalues,data_ptr,isfifo); return ucp->writeRegister(addr,nvalues,data_ptr,isfifo);
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# UNB 0 # UNB 0
node 0 10.99.2.1 unb2b_minimal 2 1 node 0 10.99.2.1 unb2b_minimal 2 1
node 1 10.99.2.2 unb2b_minimal 2 0 node 1 10.99.2.2 unb2b_minimal 2 0
node 2 10.99.2.3 unb2b_minimal 2 0 node 2 10.99.2.3 unb2b_minimal 2 1
node 3 10.99.2.4 unb2b_minimal 2 0 node 3 10.99.2.4 unb2b_minimal 2 0
# UNB 1 # UNB 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment