ERIS CORE

◆ messageHandler_GET_RAM1()

void FLASHMEM SvcSerialCommandInterface::messageHandler_GET_RAM1 ( )
protected

Definition at line 334 of file svcSerialCommandInterface.cpp.

334  {
335  char* mp = 0;
336  char c;
337 #ifdef USE_EXTMEM
338  char tmp[1000];
339  //tmp = (char*)extmem_malloc(1000);
340 #else
341  char* tmp;
342  tmp = (char*)malloc(1000);
343 #endif
344  while(throttle()){delay(100);}
345  if(!requestStartLZ4Message()) return;
346  strcpy(tmp,"");
347  printf(F("RAM {\"RAM1\":{\"addr\":\"%08X\",\"chunk\":\""),0x000000);
348 
349  for(uint32_t i = 0x00070000; i < 0x0007F000; i+=1){
350  //if (i == 0x20010000) i = 0x20200000;
351  mp = (char*)i;
352  c = *mp;
353  c = (c & 0xFF);
354  if(i%32==0 && i != 0x00070000){
355  print(F("\",\"decode\":\""));
356  print(tmp);
357  println(F("\"}}"));
358  sendLZ4Message();
359  strcpy(tmp,"");
360  while(throttle()){delay(150);}
361  if(i%1024==0){
362  float32_t pct;
363  pct = 100.0 * ((float)(i-0x00070000)/(float)(0x0007F000));
364  Serial.printf(F("CLS\nM GET_RAM1 %08X %.0f pct "),i,pct);
365  for(uint16_t div = 0; div < (uint16_t)pct; div += 5){
366  Serial.printf("*");
367  }
368  Serial.println("");
369  }
370  startLZ4Message();
371  printf(F("RAM {\"RAM1\":{\"addr\":\"%08X\",\"chunk\":\""),i);
372  }
373 
374  printf("%02X ",(uint8_t)c);
375  const char* escape = "\\";
376  if (c=='"'){
377  strncat(tmp, escape, 1);
378  strncat(tmp, &c, 1);
379  }else if (c=='\''){
380  strncat(tmp, escape, 1);
381  strncat(tmp, &c, 1);
382  }else if (isprint((int)c)){
383  strncat(tmp, &c, 1);
384  }else if (iscntrl((int)c)){
385  c = '.';
386  strncat(tmp, &c, 1);
387  }else{
388  c = '?';
389  strncat(tmp, &c, 1);
390  }
391  }
392  println("\n");
393  println(F("RAM END"));
394  sendLZ4Message();
395 #ifdef USE_EXTMEM
396  //do nothing - local var
397 #else
398  free(tmp);
399 #endif
400 }
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: