ERIS CORE

◆ messageHandler_GET_RAM2()

void FLASHMEM SvcSerialCommandInterface::messageHandler_GET_RAM2 ( )
protected

Definition at line 402 of file svcSerialCommandInterface.cpp.

402  {
403  char* mp = 0;
404  char c;
405 #ifdef USE_EXTMEM
406  char tmp[1000];
407  //tmp = (char*)extmem_malloc(1000);
408 #else
409  char* tmp;
410  tmp = (char*)malloc(1000);
411 #endif
412  while(throttle()){delay(100);}
413  if(!requestStartLZ4Message()) return;
414  strcpy(tmp,"");
415  printf(F("RAM {\"RAM2\":{\"addr\":\"%08X\",\"chunk\":\""),0x20000000);
416  //RAM2 always ends at 0x20280000
417  for(uint32_t i = 0x20000000; i < 0x20280000; i+=1){
418  if (i == 0x20010000) i = 0x20200000;
419  mp = (char*)i;
420  c = *mp;
421  c = (c & 0xFF);
422  if(i%32==0 && i != 0x20000000){
423  print(F("\",\"decode\":\""));
424  print(tmp);
425  println(F("\"}}"));
426  sendLZ4Message();
427  strcpy(tmp,"");
428  while(throttle()){delay(50);}
429  if(i%1024==0){
430  float32_t pct;
431  pct = 100.0 * ((float)(i-0x20000000)/(float)(0x20280000-0x20000000));
432  Serial.printf(F("CLS\nM GET_RAM2 %08X %.0f pct "),i,pct);
433  for(uint16_t div = 0; div < (uint16_t)pct; div += 5){
434  Serial.printf("*");
435  }
436  Serial.println("");
437  }
438  startLZ4Message();
439  printf(F("RAM {\"RAM2\":{\"addr\":\"%08X\",\"chunk\":\""),i);
440  }
441 
442  printf("%02X ",(uint8_t)c);
443  const char* escape = "\\";
444  if (c=='"'){
445  strncat(tmp, escape, 1);
446  strncat(tmp, &c, 1);
447  }else if (c=='\''){
448  strncat(tmp, escape, 1);
449  strncat(tmp, &c, 1);
450  }else if (isprint((int)c)){
451  strncat(tmp, &c, 1);
452  }else if (iscntrl((int)c)){
453  c = '.';
454  strncat(tmp, &c, 1);
455  }else{
456  c = '?';
457  strncat(tmp, &c, 1);
458  }
459  }
460  println("\n");
461  println(F("RAM END"));
462  sendLZ4Message();
463 #ifdef USE_EXTMEM
464  //do nothing - local var
465 #else
466  free(tmp);
467 #endif
468 }
bool requestStartLZ4Message()
request to start a lz4 compressed message starts the message and returns true if available returns f...
bool throttle()
returns true if the available serial buffer falls below SERIAL_THROTTLE_BUFFER_REMAINING_THRESHOLD if...
void sendLZ4Message()
Calling this function signals the end of a compressed message. The txBuffer contents are lz4 compres...

References requestStartLZ4Message(), sendLZ4Message(), startLZ4Message(), and throttle().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: