iCub-main
EthUpdater.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 RobotCub Consortium
3  * Author: Alessandro Scalzo alessandro.scalzo@iit.it, Marco Accame marco.accame@iit.it
4  * CopyPolicy: Released under the terms of the GNU GPL v2.0.
5  *
6  */
7 
8 #include "EthUpdater.h"
9 
10 #include <ace/ACE.h>
11 #include <yarp/os/Time.h>
12 
13 #include <yarp/os/Log.h>
14 
15 using namespace yarp::os;
16 
17 const int EthUpdater::partition_APPLICATION = uprot_partitionAPPLICATION;
18 const int EthUpdater::partition_LOADER = uprot_partitionLOADER;
19 const int EthUpdater::partition_UPDATER = uprot_partitionUPDATER;
20 
21 
22 #define PRINT_DEBUG_INFO_ON_TERMINAL
23 
24 
25 // TODO: check here if it is called and when (it seems that it's never called)
27 {
28  mBoardList.empty();
29 
30  eOuprot_cmd_DISCOVER_t * cmd = (eOuprot_cmd_DISCOVER_t*) mTxBuffer;
31 
32  memset(cmd, EOUPROT_VALUE_OF_UNUSED_BYTE, sizeof(eOuprot_cmd_DISCOVER_t));
33 
34  cmd->opc = uprot_OPC_LEGACY_SCAN;
35  cmd->opc2 = uprot_OPC_DISCOVER;
36  cmd->jump2updater = 1;
37 
38  int numberOfDiscovered = 0;
39 
40  mSocket.SendBroad(cmd, sizeof(eOuprot_cmd_DISCOVER_t), mPort);
41 
42  ACE_UINT16 rxPort;
43  ACE_UINT32 rxAddress = mMyAddress;
44 
45  while (mSocket.ReceiveFrom(mRxBuffer, sizeof(mRxBuffer), rxAddress, rxPort, 1000)>0)
46  {
47  eOuprot_cmd_DISCOVER_REPLY_t * disc = (eOuprot_cmd_DISCOVER_REPLY_t*) mRxBuffer;
48  eOuprot_cmd_LEGACY_SCAN_REPLY_t * scan = (eOuprot_cmd_LEGACY_SCAN_REPLY_t*) mRxBuffer;
49  char ipaddr[20];
50  snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d",(rxAddress>>24)&0xFF, (rxAddress>>16)&0xFF, (rxAddress>>8)&0xFF, rxAddress&0xFF);
51 
52  // if I received the extended reply I'll pass throughout it
53 
54 
55  // otherwise process it as usual
56  if(uprot_OPC_DISCOVER == disc->reply.opc)
57  {
58  // the board has replied with the new protocol.
59  if (rxAddress != mMyAddress)
60  {
61  boardInfo_t binfo = {0};
62 
63  // the protococol version and capabilities are properties of the running process.
64  binfo.protversion = disc->reply.protversion;
65  binfo.capabilities = disc->capabilities;
66 
67  memcpy(&binfo.macaddress, disc->mac48, 6);
68  binfo.boardtype = disc->boardtype;
69 
70  memcpy(&binfo.processes, &disc->processes, sizeof(eOuprot_proctable_t));
71  memcpy(binfo.boardinfo32, disc->boardinfo32, sizeof(binfo.boardinfo32));
72 
73  BoardInfo *pBoard = new BoardInfo(rxAddress, binfo);
74 
75  mBoardList.addBoard(pBoard);
76 
77  numberOfDiscovered++;
78 
79 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
80  uint8_t index = eouprot_process2index((eOuprot_process_t)disc->processes.runningnow);
81  printf("Discovered a board @ %s: %s w/ %s v %d.%d running protocol v %d w/ capabilities = 0x%x.\n",
82  ipaddr,
83  eoboards_type2string2((eObrd_type_t)disc->boardtype, eobool_true),
84  eouprot_process2string((eOuprot_process_t)disc->processes.runningnow),
85  disc->processes.info[index].version.major,
86  disc->processes.info[index].version.minor,
87  disc->reply.protversion,
88  disc->capabilities);
89  fflush(stdout);
90 #endif
91  }
92 
93  }
94  else if (uprot_OPC_LEGACY_SCAN == scan->opc)
95  {
96  // we have an old board ... by definition it has protocol version 0.
97 
98  if (rxAddress!=mMyAddress)
99  {
100 
101  // the protococol version and capabilities are properties of the running process.
102  // from the legacy answer uprot_OPC_LEGACY_SCAN i know that we have protocol version 0.
103  // however ... which process is it replying? the most probable is eUpdater, the second most probable is
104  // eApplication. It is unlikely that it is a legacy eMaintainer because we should not use it.
105  // i decide the following:
106  // i give the permissions of legacy updater which contains those of legacy application.
107  // because even if it was the application which replied then, surely now it is the updater running.
108  ACE_UINT8 protocol_version = 0;
109  // i dont have such a mas, hence i use the default for protocol 0, thinking that ....
110  ACE_UINT32 protocol_capabilities = eouprot_get_capabilities(eUpdater, protocol_version);
111 
112  ACE_UINT8 procmajor = scan->version.major;
113  ACE_UINT8 procminor = scan->version.minor;
114 
115 
116  ACE_UINT32 mask=*(ACE_UINT32*)(scan->ipmask);
117  ACE_UINT64 mac=0;
118 
119  for(int i=7; i>=0; --i)
120  {
121  mac=(mac<<8)|scan->mac48[i];
122  }
123 
124  BoardInfo *pBoard = new BoardInfo(rxAddress, mask, mac, procmajor, procminor, protocol_version, protocol_capabilities);
125 
126  mBoardList.addBoard(pBoard);
127 
128  numberOfDiscovered++;
129 
130 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
131  printf("Discovered a board @ %s: the running process is v %d.%d, uses legacy protocol, i assume protocol capabilities = 0x%x.\n",
132  ipaddr, procmajor, procminor, protocol_capabilities);
133  fflush(stdout);
134 #endif
135  }
136  }
137  }
138 
139  return numberOfDiscovered;
140 }
141 
142 
143 bool EthUpdater::isCmdSupported(eOuprot_proc_capabilities_t capability, ACE_UINT32 address)
144 {
145  // search for the BoardInfo with a given address ... if we have a double address then we return a vector
146  // we also may return a vector if address is 0 because we search for the selected.
147  vector<BoardInfo *> boards = mBoardList.getBoards(address);
148 
149  if(0 == boards.size())
150  {
151  return false;
152  }
153 
154  // i assume it is true. i return true only if all the boards support it.
155  bool ret = true;
156  for(int i=0; i<boards.size(); i++)
157  {
158  uint32_t mask = boards[i]->mProtocolCapabilities;
159  bool r = ((mask & capability) == capability) ? true : false;
160  ret = ret && r;
161  }
162 
163  return ret;
164 }
165 
166 
167 std::string EthUpdater::cmdGetMoreInfo(bool refreshInfo, ACE_UINT32 address)
168 {
169  eOuprot_cmd_MOREINFO_t command;
170 
171  command.opc = uprot_OPC_LEGACY_PROCS;
172  command.opc2 = uprot_OPC_MOREINFO;
173  command.plusdescription = 1;
174  command.jump2updater = 1;
175 
176 
177  if(0 == address)
178  {
179  sendCommandSelected(&command, sizeof(command));
180  }
181  else
182  {
183  mSocket.SendTo(&command, sizeof(command), mPort, address);
184  }
185 
186  ACE_UINT16 rxPort;
187  ACE_UINT32 rxAddress;
188 
189  std::string info;
190 
191  while (mSocket.ReceiveFrom(mRxBuffer, sizeof(mRxBuffer), rxAddress, rxPort, 500)>0)
192  {
193  eOuprot_cmd_MOREINFO_REPLY_t *moreinfo = (eOuprot_cmd_MOREINFO_REPLY_t*) mRxBuffer;
194  eOuprot_cmd_LEGACY_PROCS_REPLY_t *procs = (eOuprot_cmd_LEGACY_PROCS_REPLY_t*) mRxBuffer;
195 
196  char ipaddr[20];
197  snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d",(rxAddress>>24)&0xFF, (rxAddress>>16)&0xFF, (rxAddress>>8)&0xFF, rxAddress&0xFF);
198 
199  if(uprot_OPC_LEGACY_PROCS == procs->opc)
200  {
201  // old boards reply with uprot_OPC_LEGACY_PROCS
202 
203 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
204  printf("\n received a uprot_OPC_LEGACY_PROCS from IP %s \n", ipaddr);
205  fflush(stdout);
206 #endif
207  if (rxAddress != mMyAddress)
208  {
209  info+="------------------------------\r\n";
210  info+=std::string("Board\t")+std::string(ipaddr);
211  info+="\r\n\r\n";
212  info+=std::string((char*)procs->description);
213  }
214  }
215  else if(uprot_OPC_MOREINFO == moreinfo->discover.reply.opc)
216  {
217  // a new board has replied
218 
219 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
220  printf("\n received a uprot_OPC_MOREINFO with prot version %d from IP %s\n", moreinfo->discover.reply.protversion, ipaddr);
221  fflush(stdout);
222 #endif
223 
224  if (rxAddress != mMyAddress)
225  {
226  eOuprot_cmd_DISCOVER_REPLY_t * disc = &moreinfo->discover;
227 
228  boardInfo_t binfo = {0};
229 
230  binfo.protversion = disc->reply.protversion;
231  binfo.capabilities = disc->capabilities;
232  memcpy(&binfo.macaddress, disc->mac48, 6);
233  binfo.boardtype = disc->boardtype;
234  memcpy(&binfo.processes, &disc->processes, sizeof(eOuprot_proctable_t));
235  memcpy(binfo.boardinfo32, disc->boardinfo32, sizeof(binfo.boardinfo32));
236 
237  if(refreshInfo)
238  {
239  BoardInfo *pBoard = new BoardInfo(rxAddress, binfo);
240  mBoardList.replaceBoard(pBoard);
241  }
242 
243 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
244 
245  // print binfo.
246  // it would be much bettwer, however, store it somewhere and made it available
247  // through some method
248 
249 
250  printf("\nBOARD at address %s:", ipaddr);
251  printf("\n prot = %d, boardtype = %s, startup proc = %s, def2run proc = %s. it has %d processes:",
252  binfo.protversion,
253  eoboards_type2string2((eObrd_type_t)binfo.boardtype, eobool_true),
254  eouprot_process2string((eOuprot_process_t)binfo.processes.startup),
255  eouprot_process2string((eOuprot_process_t)binfo.processes.def2run),
256  binfo.processes.numberofthem
257  );
258  for(int n=0; n<binfo.processes.numberofthem; n++)
259  {
260  char strdate[24] = {0};
261  char builton[24] = {0};
262  eo_common_date_to_string(binfo.processes.info[n].date, strdate, sizeof(strdate));
263  eo_common_date_to_string(binfo.processes.info[n].compilationdate, builton, sizeof(builton));
264  printf("\n proc-%d: type %s w/ appl version = (%d, %d), dated %s, built on %s, rom = [%d, %d) kb",
265  n,
266  eouprot_process2string((eOuprot_process_t)binfo.processes.info[n].type),
267  binfo.processes.info[n].version.major, binfo.processes.info[n].version.minor,
268  strdate,
269  builton,
270  binfo.processes.info[n].rom_addr_kb, binfo.processes.info[n].rom_addr_kb + binfo.processes.info[n].rom_size_kb
271  );
272 
273  }
274 
275  printf("\n now process %s is running", eouprot_process2string((eOuprot_process_t)binfo.processes.runningnow));
276 
277  if(0xff == binfo.boardinfo32[0])
278  {
279  printf("\n stored info32 is .. ");
280  for(int m=0; m<32; m++)
281  {
282  printf("0x%x ", binfo.boardinfo32[m]);
283  }
284 
285  }
286  else
287  {
288  printf("\n stored info32 is .. ");
289  printf("l = %d, string = %s \n", binfo.boardinfo32[0], &binfo.boardinfo32[1]);
290  }
291 
292  printf("\n\n");
293 
294 #endif
295  // now we put into info all what is needed
296  {
297  info+="------------------------------\r\n";
298  info+=std::string("Board\t")+std::string(ipaddr);
299  info+="\r\n\r\n";
300  if(1 == moreinfo->hasdescription)
301  {
302  info+=std::string((char*)moreinfo->description);
303  }
304  else
305  {
306  info+=std::string("the message does not have a textual description");
307  }
308  }
309  }
310  }
311  }
312 
313  return info;
314 }
315 
316 
317 bool EthUpdater::cmdInfo32Clear(ACE_UINT32 address)
318 {
319  bool ret = false;
320 
321  eOuprot_cmd_PAGE_CLR_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
322  command.opc = uprot_OPC_PAGE_CLR;
323  command.pagesize = 32;
324 
325  if(0 == address)
326  {
327  sendCommandSelected(&command, sizeof(command));
328  }
329  else
330  {
331  mSocket.SendTo(&command, sizeof(command), mPort, address);
332  }
333 
334  return ret;
335 }
336 
337 bool EthUpdater::cmdInfo32Set(const string &info32, ACE_UINT32 address)
338 {
339  bool ret = false;
340 
341  eOuprot_cmd_PAGE_SET_t *cmd = (eOuprot_cmd_PAGE_SET_t*) mTxBuffer;
342  uint16_t sizeofcmd = sizeof(eOuprot_cmd_PAGE_SET_t) - uprot_pagemaxsize + 32;
343  // think of the best way to specify the length of themessage in a proper way
344  // we could decide to send always a length of sizeof(eOuprot_cmd_PAGE_SET_t) which is 132, or ...
345 
346  memset(cmd, EOUPROT_VALUE_OF_UNUSED_BYTE, sizeofcmd);
347 
348  cmd->opc = uprot_OPC_PAGE_SET;
349  cmd->pagesize = 32;
350  memset(cmd->page, 0, 32);
351 
352 
353  const char * str32 = info32.c_str();
354 
355  int len = strlen(str32);
356  if(len>30)
357  {
358  len = 30;
359  }
360  cmd->page[0] = len;
361  memcpy(&cmd->page[1], str32, len);
362 
363  if(0 == address)
364  {
365  sendCommandSelected(cmd, sizeofcmd);
366  }
367  else
368  {
369  mSocket.SendTo(cmd, sizeofcmd, mPort, address);
370  }
371 
372  return ret;
373 }
374 
375 
376 vector<string> EthUpdater::cmdInfo32Get(ACE_UINT32 address)
377 {
378  vector<string> thestrings(0);
379 
380  eOuprot_cmd_PAGE_GET_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
381  command.opc = uprot_OPC_PAGE_GET;
382  command.pagesize = 32;
383 
384  if(0 == address)
385  {
386  sendCommandSelected(&command, sizeof(command));
387  }
388  else
389  {
390  mSocket.SendTo(&command, sizeof(command), mPort, address);
391  }
392 
393  ACE_UINT16 rxPort;
394  ACE_UINT32 rxAddress;
395 
396 
397  while(mSocket.ReceiveFrom(mRxBuffer, sizeof(mRxBuffer), rxAddress, rxPort, 500)>0)
398  {
399  eOuprot_cmd_PAGE_GET_REPLY_t * pageget = (eOuprot_cmd_PAGE_GET_REPLY_t*) mRxBuffer;
400 
401  if(uprot_OPC_PAGE_GET == pageget->reply.opc)
402  {
403  string readstring;
404 
405  if((rxAddress != mMyAddress) && (uprot_RES_OK == pageget->reply.res) && (32 == pageget->pagesize) && (0xff != pageget->page[0]))
406  {
407  readstring = string((const char*)&pageget->page[1]);
408  thestrings.push_back(readstring);
409  }
410 
411 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
412 
413  char ip32[20];
414  snprintf(ip32, sizeof(ip32), "%d.%d.%d.%d",(rxAddress>>24)&0xFF, (rxAddress>>16)&0xFF, (rxAddress>>8)&0xFF, rxAddress&0xFF);
415 
416  if(uprot_RES_OK != pageget->reply.res)
417  {
418  printf("\n received a eOuprot_cmd_PAGE_GET_REPLY_t from IP %s with a failure result %d for size %d", ip32, pageget->reply.res, pageget->pagesize);
419  }
420  else if(rxAddress != mMyAddress)
421  {
422  printf("\n received a eOuprot_cmd_PAGE_GET_REPLY_t from IP %s with size %d: ", ip32, pageget->pagesize);
423 
424  if(32 == pageget->pagesize)
425  { // the page is formatted so that in position 0 there is 0xff if erased and never programmed or strlen(&page[1])
426 
427  uint8_t info32[32] = {0};
428  memcpy(info32, pageget->page, 32);
429 
430  if(0xff == info32[0])
431  {
432  printf("\n stored info32 is .. ");
433  for(int m=0; m<32; m++)
434  {
435  printf("0x%x ", info32[m]);
436  }
437 
438  }
439  else
440  {
441  printf("l = %d, string = %s \n", info32[0], &info32[1]);
442  }
443 
444  }
445 
446  fflush(stdout);
447 
448  }
449 #endif
450 
451  }
452  }
453 
454  return thestrings;
455 }
456 
457 
458 bool EthUpdater::cmdRestart(ACE_UINT32 address)
459 {
460  bool ret = false;
461 
462  eOuprot_cmd_RESTART_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
463  command.opc = uprot_OPC_RESTART;
464 
465  if(0 != address)
466  {
467  mSocket.SendTo(&command, sizeof(command), mPort, address);
468  }
469  else
470  {
471  sendCommandSelected(&command, sizeof(command));
472  }
473 
474  return ret;
475 }
476 
477 
478 bool EthUpdater::cmdSetDEF2RUN(eOuprot_process_t process, ACE_UINT32 address)
479 {
480  bool ret = false;
481 
482  eOuprot_cmd_DEF2RUN_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
483  command.opc = uprot_OPC_DEF2RUN;
484  command.proc = process;
485 
486  if(0 != address)
487  {
488 
489 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
490  char ipaddr[20];
491  snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d",(address>>24)&0xFF, (address>>16)&0xFF, (address>>8)&0xFF, address&0xFF);
492  printf("send command uprot_OPC_DEF2RUN w/ process = %s to %s\n", eouprot_process2string(process), ipaddr);
493 #endif
494 
495  mSocket.SendTo(&command, sizeof(command), mPort, address);
496  }
497  else
498  {
499  for(int i=0; i<mBoardList.size(); ++i)
500  {
501  if(mBoardList[i].mSelected)
502  {
503  address = mBoardList[i].mAddress;
504 
505 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
506  char ipaddr[20];
507  snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d",(address>>24)&0xFF, (address>>16)&0xFF, (address>>8)&0xFF, address&0xFF);
508  printf("send command uprot_OPC_DEF2RUN w/ process = %s to %s\n", eouprot_process2string(process), ipaddr);
509 #endif
510 
511  mSocket.SendTo(&command, sizeof(command), mPort, address);
512  }
513  }
514  }
515 
516  return ret;
517 }
518 
519 
520 bool EthUpdater::cmdJumpUpd(ACE_UINT32 address)
521 {
522  bool ret = false;
523 
524  eOuprot_cmd_JUMP2UPDATER_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
525  command.opc = uprot_OPC_JUMP2UPDATER;
526 
527  if(0 != address)
528  {
529  mSocket.SendTo(&command, sizeof(command), mPort, address);
530  }
531  else
532  {
533  sendCommandSelected(&command, sizeof(command));
534  }
535 
536  return ret;
537 }
538 
539 
540 bool EthUpdater::cmdJump2ROMaddress(uint32_t romaddress, ACE_UINT32 address)
541 {
542  bool ret = false;
543 
544  eOuprot_cmd_JUMP2ADDRESS_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
545  command.opc = uprot_OPC_JUMP2ADDRESS;
546  command.address = romaddress;
547 
548  if(0 != address)
549  {
550  mSocket.SendTo(&command, sizeof(command), mPort, address);
551  }
552  else
553  {
554  sendCommandSelected(&command, sizeof(command));
555  }
556 
557  return ret;
558 }
559 
560 
561 bool EthUpdater::cmdBlink(ACE_UINT32 address)
562 {
563  bool ret = false;
564 
565  eOuprot_cmd_BLINK_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
566  command.opc = uprot_OPC_BLINK;
567 
568  if(0 != address)
569  {
570  mSocket.SendTo(&command, sizeof(command), mPort, address);
571  }
572  else
573  {
574  sendCommandSelected(&command, sizeof(command));
575  }
576 
577  return ret;
578 }
579 
580 
581 bool EthUpdater::cmdEraseEEPROM(ACE_UINT32 address)
582 {
583  bool ret = false;
584 
585  eOuprot_cmd_EEPROM_ERASE_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
586 
587  command.opc = uprot_OPC_LEGACY_EEPROM_ERASE;
588  command.opc2 = uprot_OPC_EEPROM_ERASE;
589  command.sysrestart = 0;
590  command.address = 0;
591  command.size = 0;
592 
593  if(0 != address)
594  {
595  mSocket.SendTo(&command, sizeof(command), mPort, address);
596  }
597  else
598  {
599  sendCommandSelected(&command, sizeof(command));
600  }
601 
602  return ret;
603 }
604 
605 // TODO: at date 22 jun 16: yet to be tested
606 bool EthUpdater::cmdReadEEPROM(uint16_t from, uint16_t size, ACE_UINT32 address, uint8_t **value)
607 {
608  bool ret = false;
609 
610  if(NULL == value)
611  {
612  return ret;
613  }
614 
615  if(0 == address)
616  {
617  return ret;
618  }
619 
620  if((0 == size) || (size > uprot_EEPROMmaxsize))
621  {
622  return ret;
623  }
624 
625  eOuprot_cmd_EEPROM_READ_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
626 
627  command.opc = uprot_OPC_EEPROM_READ;
628  command.address = from;
629  command.size = size;
630 
631  mSocket.SendTo(&command, sizeof(command), mPort, address);
632 
633  // now we wait for teh reply ...
634 
635  ACE_UINT16 rxPort;
636  ACE_UINT32 rxAddress = mMyAddress;
637 
638  while (mSocket.ReceiveFrom(mRxBuffer, sizeof(mRxBuffer), rxAddress, rxPort, 1000)>0)
639  {
640  eOuprot_cmd_EEPROM_READ_REPLY_t * eepromread = (eOuprot_cmd_EEPROM_READ_REPLY_t*) mRxBuffer;
641 
642  char ipaddr[20];
643  snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d",(rxAddress>>24)&0xFF, (rxAddress>>16)&0xFF, (rxAddress>>8)&0xFF, rxAddress&0xFF);
644 
645  if(uprot_OPC_EEPROM_READ == eepromread->reply.opc)
646  {
647  // the board has replied.
648  if (rxAddress == address)
649  {
650  ret = (uprot_RES_OK == eepromread->reply.res) ? true : false;
651 
652  if(ret)
653  {
654  *value = eepromread->eeprom;
655  }
656  }
657  }
658  }
659 
660  return ret;
661 }
662 
663 bool EthUpdater::cmdChangeAddress(ACE_UINT32 newaddress, ACE_UINT32 address)
664 {
665  bool ret = false;
666 
667  eOuprot_cmd_IP_ADDR_SET_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
668 
669  command.opc = uprot_OPC_LEGACY_IP_ADDR_SET;
670  command.opc2 = uprot_OPC_IP_ADDR_SET;
671  command.sysrestart = 0;
672 
673  command.address[0] = (newaddress>>24) & 0xFF;
674  command.address[1] = (newaddress>>16) & 0xFF;
675  command.address[2] = (newaddress>>8 ) & 0xFF;
676  command.address[3] = (newaddress ) & 0xFF;
677 
678 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
679  char ipaddr[20];
680  snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d",(address>>24)&0xFF, (address>>16)&0xFF, (address>>8)&0xFF, address&0xFF);
681  char newipaddr[20];
682  snprintf(newipaddr, sizeof(ipaddr),"%d.%d.%d.%d",(newaddress>>24)&0xFF, (newaddress>>16)&0xFF, (newaddress>>8)&0xFF, newaddress&0xFF);
683 #endif
684 
685  bool stopit = false;
686 
687  if(0 == address)
688  {
689  stopit = true;
690  }
691 
692  // we must have 10.0.1.x, where x is not 0 or 255
693  if((10 != command.address[0]) || (0 != command.address[1]) || (1 != command.address[2]))
694  {
695  stopit = true;
696  }
697 
698  if((0 == command.address[3]) || (255 == command.address[3]))
699  {
700  stopit = true;
701  }
702 
703  if(true == stopit)
704  {
705 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
706  printf("cannot send command uprot_OPC_IP_ADDR_SET to %s with new address %s because either one or both are not valid\n", ipaddr, newipaddr);
707 #endif
708  return ret;
709  }
710 
711 
712 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
713  printf("sent command uprot_OPC_IP_ADDR_SET to %s, new address is %s. w/%s sysrestart\n", ipaddr, newipaddr, (0 == command.sysrestart) ? "out" : "");
714 #endif
715 
716  mSocket.SendTo(&command, sizeof(command), mPort, address);
717 
718  return ret;
719 }
720 
721 
722 
723 
724 std::string EthUpdater::cmdProgram(FILE *programFile, int partition, void (*updateProgressBar)(float), ACE_UINT32 address)
725 {
726  updateProgressBar(0.0f);
727 
728  eOuprot_cmd_PROG_START_t * cmdStart = (eOuprot_cmd_PROG_START_t*) mTxBuffer;
729  eOuprot_cmd_PROG_DATA_t * cmdData = (eOuprot_cmd_PROG_DATA_t*) mTxBuffer;
730  eOuprot_cmd_PROG_END_t * cmdEnd = (eOuprot_cmd_PROG_END_t*) mTxBuffer;
731 
732  const int sizeStart = sizeof(eOuprot_cmd_PROG_START_t);
733  const int sizeEnd = sizeof(eOuprot_cmd_PROG_END_t);
734 
735 
736  const int HEAD_SIZE = 7;
737 
738  fseek(programFile,0,SEEK_END);
739  float fileSize=(float)(ftell(programFile)/3);
740  fseek(programFile,0,SEEK_SET);
741 
742  memset(cmdStart, EOUPROT_VALUE_OF_UNUSED_BYTE, sizeof(eOuprot_cmd_PROG_START_t));
743  cmdStart->opc = uprot_OPC_PROG_START;
744  cmdStart->partition = partition;
745 
746  string partname("UNK");
747  eOuprot_proc_capabilities_t capability = uprot_canDO_nothing;
748  if(uprot_partitionLOADER == partition)
749  {
750  partname = string("LDR");
751  capability = uprot_canDO_PROG_loader;
752  }
753  else if(uprot_partitionUPDATER == partition)
754  {
755  partname = string("UPD");
756  capability = uprot_canDO_PROG_updater;
757  }
758  else if(uprot_partitionAPPLICATION == partition)
759  {
760  partname = string("APP");
761  capability = uprot_canDO_PROG_application;
762  }
763 
764 
765  // sending the start and preparing the list of boards to program
766 
767  mN2Prog = 0;
768 
769  if(0 == address)
770  {
771  // we use the selected
772 
773  for (int i=0; i<mBoardList.size(); ++i)
774  {
775  if (mBoardList[i].mSelected)
776  {
777  mBoard2Prog[mN2Prog++]=&mBoardList[i];
778  mBoardList[i].mSuccess=0;
779  mSocket.SendTo(cmdStart, sizeStart, mPort, mBoardList[i].mAddress);
780  yarp::os::Time::delay(0.01);
781  }
782  }
783 
784  }
785  else
786  {
787  // we use address
788 
789  vector<BoardInfo *> boards = mBoardList.getBoards(address);
790 
791  std::string errorstring;
792  char addr[20];
793  snprintf(addr, sizeof(addr), "%d.%d.%d.%d: ",(address>>24)&0xFF,(address>>16)&0xFF,(address>>8)&0xFF,address&0xFF);
794 
795  errorstring += addr;
796 
797  if(0 == boards.size())
798  {
799  errorstring += "CANT find it\r\n";
800  return errorstring;
801  }
802  else if(boards.size() > 1)
803  {
804 // printf("error: size = %d\n", boards.size());
805 // fflush(stdout);
806  errorstring += "CANT prog more than one";
807  return errorstring;
808  }
809 
810  boards[0]->mSuccess = 0;
811  mBoard2Prog[mN2Prog++] = boards[0];
812  mSocket.SendTo(cmdStart, sizeStart, mPort, address);
813  yarp::os::Time::delay(0.01);
814  }
815 
816 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
817 
818  printf("EthUpdater::cmdProgram() is about to program the %s partition of %d boards:", partname.c_str(), mN2Prog);
819  for(int j=0; j< mN2Prog; j++)
820  {
821  char ipv4str[20];
822  ACE_UINT32 ipv4 = mBoard2Prog[j]->mAddress;
823  bool ok = isCmdSupported(capability, ipv4);
824  snprintf(ipv4str, sizeof(ipv4str), "%d.%d.%d.%d",(ipv4>>24)&0xFF,(ipv4>>16)&0xFF,(ipv4>>8)&0xFF,ipv4&0xFF);
825 
826  printf(" %s (%s)", ipv4str, ok ? ("candoit") : ("CANTdoit"));
827  }
828  printf("\n");
829  fflush(stdout);
830 
831 #endif
832 
833 
834  // now we start
835 
836  mNProgSteps = 0;
837  mNChunks = 1;
838 
839  ACE_UINT16 rxPort;
840  ACE_UINT32 rxAddress;
841 
842  ++mNProgSteps;
843 
844  int success=0;
845 
846  int numberOfOKreplies = 0;
847 
848  // waiting for reply of start
849  for (int n=0; n<1000; ++n)
850  {
851  while (mSocket.ReceiveFrom(mRxBuffer, sizeof(mRxBuffer), rxAddress, rxPort, 10)>0)
852  {
853  eOuprot_cmdREPLY_t * reply = (eOuprot_cmdREPLY_t*) mRxBuffer;
854 
855  if (uprot_OPC_PROG_START == reply->opc)
856  {
857  if (rxAddress!=mMyAddress)
858  {
859  for (int i=0; i<mN2Prog; ++i)
860  {
861  if (rxAddress == mBoard2Prog[i]->mAddress)
862  {
863  if(uprot_RES_OK == reply->res)
864  {
865  ++(mBoard2Prog[i]->mSuccess);
866  numberOfOKreplies++;
867  }
868  else
869  {
870 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
871  // print that we the board tells that we cannot program that partition
872  char ipv4str[20];
873  ACE_UINT32 ipv4 = mBoard2Prog[i]->mAddress;
874  //bool ok = isCmdSupported(capability, ipv4);
875  snprintf(ipv4str, sizeof(ipv4str), "%d.%d.%d.%d",(ipv4>>24)&0xFF,(ipv4>>16)&0xFF,(ipv4>>8)&0xFF,ipv4&0xFF);
876 
877  printf("board %s tells that we cannot program the %s partition\n", ipv4str, partname.c_str());
878  fflush(stdout);
879 #endif
880 
881  }
882 
883  if (++success>=mN2Prog) n=1000;
884  }
885  }
886  }
887  }
888  }
889  }
890 
891 
892  if(0 == numberOfOKreplies)
893  {
894  std::string earlyexit;
895  char addr[20];
896 
897  for (int i=0; i<mN2Prog; ++i)
898  {
899  ACE_UINT32 ip=mBoard2Prog[i]->mAddress;
900  snprintf(addr, sizeof(addr), "%d.%d.%d.%d: ",(ip>>24)&0xFF,(ip>>16)&0xFF,(ip>>8)&0xFF,ip&0xFF);
901  earlyexit+=addr;
902  earlyexit+=partname;
903  earlyexit+=(mBoard2Prog[i]->mSuccess==mNProgSteps)?" OK\r\n":" CANT\r\n";
904  }
905 
906  return earlyexit;
907  }
908 
909  int addrH=0;
910  int baseAddress=0;
911  int bytesToWrite=0;
912  int bytesWritten=0;
913 
914  char buffer[1024];
915 
916  bool beof=false;
917 
918  // sending data
919  while (!beof && fgets(buffer,1024,programFile))
920  {
921  std::string line(buffer);
922 
923  int cmd=strtol(line.substr(7,2).c_str(),NULL,16);
924 
925  switch (cmd)
926  {
927  case 0: //standard data record
928  {
929  int size =strtol(line.substr(1,2).c_str(),NULL,16);
930  int addrL=strtol(line.substr(3,4).c_str(),NULL,16);
931 
932  int address=addrH<<16|addrL;
933 
934  if (!baseAddress) baseAddress=address;
935 
936  if (bytesToWrite+size>uprot_PROGmaxsize || address!=baseAddress+bytesToWrite)
937  {
938  if (bytesToWrite)
939  {
940  cmdData->size[0]= bytesToWrite &0xFF;
941  cmdData->size[1]=(bytesToWrite>>8)&0xFF;
942  sendPROG(uprot_OPC_PROG_DATA, cmdData, HEAD_SIZE+bytesToWrite, mN2Prog,1000);
943  updateProgressBar(float(bytesWritten+=bytesToWrite)/fileSize);
944  bytesToWrite=0;
945  }
946  }
947 
948  if (!bytesToWrite)
949  {
950  baseAddress=address;
951  cmdData->opc = uprot_OPC_PROG_DATA;
952  cmdData->address[0] = addrL&0xFF;
953  cmdData->address[1] = (addrL>>8)&0xFF;
954  cmdData->address[2] = addrH&0xFF;
955  cmdData->address[3] = (addrH>>8)&0xFF;
956  }
957 
958  for (int i=0; i<size; ++i)
959  {
960  cmdData->data[bytesToWrite+i]=(unsigned char)strtol(line.substr(i*2+9,2).c_str(),NULL,16);
961  }
962 
963  bytesToWrite+=size;
964 
965  break;
966  }
967  case 1: //end of file
968  if (bytesToWrite) // force write
969  {
970  beof=true;
971  cmdData->size[0] = bytesToWrite &0xFF;
972  cmdData->size[1] = (bytesToWrite>>8)&0xFF;
973  sendPROG(uprot_OPC_PROG_DATA, cmdData, HEAD_SIZE+bytesToWrite, mN2Prog, 1000);
974  updateProgressBar(1.0f);
975  bytesToWrite=0;
976  }
977  break;
978  case 2:
979  case 3:
980  //AfxMessageBox("Unsupported hex commad");
981  break;
982  case 4: //extended linear address record
983  {
984  if (bytesToWrite) // force write
985  {
986  cmdData->size[0] = bytesToWrite &0xFF;
987  cmdData->size[1] = (bytesToWrite>>8)&0xFF;
988  sendPROG(uprot_OPC_PROG_DATA, cmdData, HEAD_SIZE+bytesToWrite, mN2Prog, 1000);
989  updateProgressBar(float(bytesWritten+=bytesToWrite)/fileSize);
990  bytesToWrite=0;
991  }
992 
993  addrH=strtol(line.substr(9,4).c_str(),NULL,16);
994 
995  break;
996  }
997  case 5: // jump
998  if (bytesToWrite) // force write
999  {
1000  cmdData->size[0]= bytesToWrite &0xFF;
1001  cmdData->size[1]= (bytesToWrite>>8)&0xFF;
1002  sendPROG(uprot_OPC_PROG_DATA, cmdData, HEAD_SIZE+bytesToWrite, mN2Prog,1000);
1003  updateProgressBar(float(bytesWritten+=bytesToWrite)/fileSize);
1004  bytesToWrite=0;
1005  }
1006 
1007  break;
1008  }
1009  }
1010 
1011 
1012  // now we send the end
1013  memset(cmdEnd, EOUPROT_VALUE_OF_UNUSED_BYTE, sizeof(eOuprot_cmd_PROG_END_t));
1014  cmdEnd->opc = uprot_OPC_PROG_END;
1015  cmdEnd->numberofpkts[0] = mNChunks & 0xFF;
1016  cmdEnd->numberofpkts[1] = (mNChunks>>8) & 0xFF;
1017 
1018 
1019  sendPROG(uprot_OPC_PROG_END, cmdEnd, sizeEnd, mN2Prog, 1000);
1020 
1021  updateProgressBar(1.0f);
1022 
1023  std::string sOutput;
1024  char addr[20];
1025 
1026  for (int i=0; i<mN2Prog; ++i)
1027  {
1028  ACE_UINT32 ip=mBoard2Prog[i]->mAddress;
1029  snprintf(addr, sizeof(addr), "%d.%d.%d.%d: ",(ip>>24)&0xFF,(ip>>16)&0xFF,(ip>>8)&0xFF,ip&0xFF);
1030  sOutput+=addr;
1031  sOutput+=partname;
1032  sOutput+=(mBoard2Prog[i]->mSuccess==mNProgSteps)?" OK\r\n":" NOK\r\n";
1033  }
1034 
1035  return sOutput;
1036 }
1037 
1038 
1039 
1040 void EthUpdater::sendCommandSelected(void * cmd, uint16_t len)
1041 {
1042  for (int i=0; i<mBoardList.size(); ++i)
1043  {
1044  if (mBoardList[i].mSelected)
1045  {
1046  mSocket.SendTo(cmd, len, mPort, mBoardList[i].mAddress);
1047  }
1048  }
1049 }
1050 
1051 
1052 
1053 int EthUpdater::sendPROG(const uint8_t opc, void * data, int size, int answers, int retry)
1054 {
1055  // data can be either a eOuprot_cmd_PROG_DATA_t* or a eOuprot_cmd_PROG_END_t*
1056  // both have the same layout of the opc in first position
1057 
1058  // use unicast to all selected boards
1059  for(int k=0;k<mN2Prog; k++)
1060  {
1061  mSocket.SendTo(data, size, mPort, mBoard2Prog[k]->mAddress);
1062  }
1063 
1064  ACE_UINT16 rxPort;
1065  ACE_UINT32 rxAddress;
1066 
1067  ++mNChunks;
1068 
1069  if (answers)
1070  {
1071  ++mNProgSteps;
1072 
1073  for (int r=0; r<retry; ++r)
1074  {
1075  for (int a=0; a<answers; ++a)
1076  {
1077  if (mSocket.ReceiveFrom(mRxBuffer, sizeof(mRxBuffer), rxAddress, rxPort, 10)>0)
1078  {
1079  eOuprot_cmdREPLY_t * reply = (eOuprot_cmdREPLY_t*) mRxBuffer;
1080 
1081  if (opc == reply->opc)
1082  {
1083  if (rxAddress!=mMyAddress)
1084  {
1085  for (int i=0; i<mN2Prog; ++i)
1086  {
1087  if (rxAddress==mBoard2Prog[i]->mAddress)
1088  {
1089  if (uprot_RES_OK == reply->res)
1090  {
1091  ++(mBoard2Prog[i]->mSuccess);
1092  }
1093  break;
1094  }
1095  }
1096 
1097  if (!--answers) return 0;
1098  }
1099  }
1100  }
1101  }
1102  }
1103  }
1104 
1105  return answers;
1106 }
1107 
1108 
1109 bool EthUpdater::cmdChangeMask(ACE_UINT32 newMask, ACE_UINT32 address)
1110 {
1111  bool ret = false;
1112 
1113  eOuprot_cmd_LEGACY_IP_MASK_SET_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
1114 
1115  command.opc = uprot_OPC_LEGACY_IP_MASK_SET;
1116 
1117  command.mask[0] = (newMask>>24)&0xFF;
1118  command.mask[1] = (newMask>>16)&0xFF;
1119  command.mask[2] = (newMask>>8) &0xFF;
1120  command.mask[3] = newMask &0xFF;
1121 
1122 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
1123  char ipaddr[20];
1124  snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d",(address>>24)&0xFF, (address>>16)&0xFF, (address>>8)&0xFF, address&0xFF);
1125  char newm[20];
1126  snprintf(newm, sizeof(newm), "%d.%d.%d.%d",(newMask>>24)&0xFF, (newMask>>16)&0xFF, (newMask>>8)&0xFF, newMask&0xFF);
1127 #endif
1128 
1129  bool stopit = false;
1130 
1131  if(0 == address)
1132  {
1133  stopit = true;
1134  }
1135 
1136  if(true == stopit)
1137  {
1138 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
1139  printf("cannot send command uprot_OPC_LEGACY_IP_MASK_SET to %s with new mask %s because either one or both are not valid\n", ipaddr, newm);
1140 #endif
1141  return ret;
1142  }
1143 
1144 
1145 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
1146  printf("send command eOuprot_cmd_LEGACY_IP_MASK_SET_t to %s, new mask is %s\n", ipaddr, newm);
1147 #endif
1148 
1149  mSocket.SendTo(&command, sizeof(command), mPort, address);
1150 
1151  return ret;
1152 }
1153 
1154 // TODO: at date 22 jun 16: yet to be tested
1155 bool EthUpdater::cmdChangeMAC(uint64_t newMAC48, ACE_UINT32 address)
1156 {
1157  bool ret = false;
1158 
1159  eOuprot_cmd_LEGACY_MAC_SET_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
1160 
1161  command.opc = uprot_OPC_LEGACY_MAC_SET;
1162 
1163  command.mac48[0] = (newMAC48>>40) & 0xFF;
1164  command.mac48[1] = (newMAC48>>32) & 0xFF;
1165  command.mac48[2] = (newMAC48>>24) & 0xFF;
1166  command.mac48[3] = (newMAC48>>16) & 0xFF;
1167  command.mac48[4] = (newMAC48>>8 ) & 0xFF;
1168  command.mac48[5] = (newMAC48 ) & 0xFF;
1169 
1170 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
1171  char ipaddr[20];
1172  snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d",(address>>24)&0xFF, (address>>16)&0xFF, (address>>8)&0xFF, address&0xFF);
1173  char newmac[32];
1174  snprintf(newmac, sizeof(newmac), "%x:%x:%x:%x:%x:%x", command.mac48[0], command.mac48[1], command.mac48[2], command.mac48[3], command.mac48[4], command.mac48[5]);
1175 #endif
1176 
1177  bool stopit = false;
1178 
1179  if(0 == address)
1180  {
1181  stopit = true;
1182  }
1183 
1184  if(0 == newMAC48)
1185  {
1186  stopit = true;
1187  }
1188 
1189  if(true == stopit)
1190  {
1191 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
1192  printf("cannot send command uprot_OPC_LEGACY_MAC_SET to %s with new mac %s because either one or both are not valid\n", ipaddr, newmac);
1193 #endif
1194  return ret;
1195  }
1196 
1197 
1198 #if defined(PRINT_DEBUG_INFO_ON_TERMINAL)
1199  printf("send command uprot_OPC_LEGACY_MAC_SET to %s, new mac is %s\n", ipaddr, newmac);
1200 #endif
1201 
1202  mSocket.SendTo(&command, sizeof(command), mPort, address);
1203 
1204  return ret;
1205 }
1206 
1207 // TODO: at date 22 jun 16: yet to be tested
1208 bool EthUpdater::cmdPageClr(eOuprot_pagesize_t pagesize, ACE_UINT32 address)
1209 {
1210  eOuprot_cmd_PAGE_CLR_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
1211  command.opc = uprot_OPC_PAGE_CLR;
1212  command.pagesize = pagesize;
1213 
1214  if(0 == address)
1215  {
1216  sendCommandSelected(&command, sizeof(command));
1217  }
1218  else
1219  {
1220  mSocket.SendTo(&command, sizeof(command), mPort, address);
1221  }
1222 
1223  return true;
1224 }
1225 
1226 // TODO: at date 22 jun 16: yet to be tested
1227 bool EthUpdater::cmdPageSet(eOuprot_pagesize_t pagesize, uint8_t *data, ACE_UINT32 address)
1228 {
1229  if(NULL == data)
1230  {
1231  return false;
1232  }
1233 
1234  eOuprot_cmd_PAGE_SET_t *cmd = (eOuprot_cmd_PAGE_SET_t*) mTxBuffer;
1235  uint16_t sizeofcmd = sizeof(eOuprot_cmd_PAGE_SET_t) - uprot_pagemaxsize + pagesize;
1236  // think of the best way to specify the length of themessage in a proper way
1237  // we could decide to send always a length of sizeof(eOuprot_cmd_PAGE_SET_t) which is 132, or ...
1238 
1239  memset(cmd, EOUPROT_VALUE_OF_UNUSED_BYTE, sizeofcmd);
1240 
1241  cmd->opc = uprot_OPC_PAGE_SET;
1242  cmd->pagesize = pagesize;
1243  memcpy(&cmd->page[0], data, pagesize);
1244 
1245  if(0 == address)
1246  {
1247  sendCommandSelected(cmd, sizeofcmd);
1248  }
1249  else
1250  {
1251  mSocket.SendTo(cmd, sizeofcmd, mPort, address);
1252  }
1253 
1254  return true;
1255 }
1256 
1257 
1258 // TODO: at date 22 jun 16: yet to be tested
1259 bool EthUpdater::cmdPageGet(eOuprot_pagesize_t pagesize, uint8_t **data, ACE_UINT32 address)
1260 {
1261  if(NULL == data)
1262  {
1263  return false;
1264  }
1265 
1266  if(0 == address)
1267  {
1268  return false;
1269  }
1270 
1271  eOuprot_cmd_PAGE_GET_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
1272  command.opc = uprot_OPC_PAGE_GET;
1273  command.pagesize = pagesize;
1274 
1275  mSocket.SendTo(&command, sizeof(command), mPort, address);
1276 
1277 
1278  ACE_UINT16 rxPort;
1279  ACE_UINT32 rxAddress;
1280 
1281  bool ret = false;
1282 
1283  while(mSocket.ReceiveFrom(mRxBuffer, sizeof(mRxBuffer), rxAddress, rxPort, 500)>0)
1284  {
1285  eOuprot_cmd_PAGE_GET_REPLY_t * pageget = (eOuprot_cmd_PAGE_GET_REPLY_t*) mRxBuffer;
1286 
1287  if(uprot_OPC_PAGE_GET == pageget->reply.opc)
1288  {
1289  if(address == rxAddress)
1290  {
1291  if((uprot_RES_OK == pageget->reply.res) && (pagesize == pageget->pagesize))
1292  {
1293  *data = pageget->page;
1294  ret = true;
1295  }
1296  }
1297  }
1298  }
1299 
1300  return ret;
1301 }
1302 
1303 
1304 // eof
1305 
1306 
@ data
void sendCommandSelected(void *cmd, uint16_t len)
bool cmdRestart(ACE_UINT32 address=0)
Definition: EthUpdater.cpp:458
int cmdDiscover()
Definition: EthUpdater.cpp:26
bool cmdReadEEPROM(uint16_t from, uint16_t size, ACE_UINT32 address, uint8_t **value)
Definition: EthUpdater.cpp:606
static const int partition_LOADER
Definition: EthUpdater.h:43
std::string cmdProgram(FILE *programFile, int partition, void(*updateProgressBar)(float), ACE_UINT32 address=0)
Definition: EthUpdater.cpp:724
int sendPROG(const uint8_t opc, void *data, int size, int answers, int retry)
bool cmdSetDEF2RUN(eOuprot_process_t process, ACE_UINT32 address=0)
Definition: EthUpdater.cpp:478
bool cmdBlink(ACE_UINT32 address=0)
Definition: EthUpdater.cpp:561
bool isCmdSupported(eOuprot_proc_capabilities_t capability, ACE_UINT32 address=0)
Definition: EthUpdater.cpp:143
vector< string > cmdInfo32Get(ACE_UINT32 address=0)
Definition: EthUpdater.cpp:376
bool cmdJumpUpd(ACE_UINT32 address=0)
Definition: EthUpdater.cpp:520
bool cmdJump2ROMaddress(uint32_t romaddress, ACE_UINT32 address=0)
Definition: EthUpdater.cpp:540
static const int partition_APPLICATION
Definition: EthUpdater.h:42
bool cmdChangeAddress(ACE_UINT32 newaddress, ACE_UINT32 address=0)
Definition: EthUpdater.cpp:663
static const int partition_UPDATER
Definition: EthUpdater.h:44
bool cmdInfo32Set(const string &info32, ACE_UINT32 address=0)
Definition: EthUpdater.cpp:337
std::string cmdGetMoreInfo(bool refreshInfo=false, ACE_UINT32 address=0)
Definition: EthUpdater.cpp:167
bool cmdEraseEEPROM(ACE_UINT32 address=0)
Definition: EthUpdater.cpp:581
bool cmdInfo32Clear(ACE_UINT32 address=0)
Definition: EthUpdater.cpp:317
cmd
Definition: dataTypes.h:30
int n
uint8_t boardtype
Definition: BoardInfo.h:26
uint64_t macaddress
Definition: BoardInfo.h:25
uint8_t protversion
Definition: BoardInfo.h:24
uint32_t capabilities
Definition: BoardInfo.h:27
eOuprot_proctable_t processes
Definition: BoardInfo.h:28
uint8_t boardinfo32[32]
Definition: BoardInfo.h:29