
//Code snippet with prints
char valStr[12];
uint32_t* valPtr;

crcTest(0xA80000, 0x557000);

SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");
valPtr = (uint32_t*) 0x5CA80000;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5CA80004;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5CA80008;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5CA8000C;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

qspiReader(rprcAddress, 0xA80000, 0x557000);
qspiFlashRewriter(rprcAddress, 0x1080000, 0x557000);

//qspiReader(rprcAddress, 0x1D00000, 0x39E94);
//qspiFlashRewriter(rprcAddress, 0x457000, 0x39E94);

SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");
valPtr = (uint32_t*) 0x5CA80000;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5CA80004;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5CA80008;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5CA8000C;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

crcTest(0x1080000, 0x557000);

SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");
valPtr = (uint32_t*) 0x5D080000;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5D080004;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5D080008;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

valPtr = (uint8_t*) 0x5D08000C;
snprintf(valStr, (size_t) 12, "%x", *valPtr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, valStr);
SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO, "\n");

//with qspiFlashRewriter(rprcAddress, 0x1080000, 0x557000); function call

//before qspiFlashRewriter call
0x5CA80000: 0
0x5CA80004: 0
0x5CA80008: 80000
0x5CA8000C: 41525a44

//after qspiFlashRewriter call
0x5CA80000: 4f400000
0x5CA80004: 4f400000
0x5CA80008: 4f400000
0x5CA8000C: 4f400000

0x5D080000: 4f400000
0x5D080004: 4f400000
0x5D080008: 4f400000
0x5D08000C: 4f400000

////////////////////////////////////////////////////////////////////////

//without qspiFlashRewriter(rprcAddress, 0x1080000, 0x557000); function call

//before qspiFlashRewriter call
0x5CA80000: 0
0x5CA80004: 0
0x5CA80008: 80000
0x5CA8000C: 41525a44

//after qspiFlashRewriter call
0x5CA80000: 0
0x5CA80004: 0
0x5CA80008: 80000
0x5CA8000C: 41525a44

0x5D080000: 0
0x5D080004: 0
0x5D080008: 80000
0x5D08000C: 41525a44