MCPcopy Create free account
hub / github.com/apache/nuttx / main

Function main

arch/sim/src/sim/sim_deviceimage.c:393–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391
392#ifdef VFAT_STANDALONE
393int main(int argc, char **argv, char **envp)
394{
395 char *deviceimage;
396 int cmf;
397 int fdict;
398 int flg;
399 int check;
400
401 cmf = g_vfatdata[0];
402 syslog(LOG_INFO, "CMF=%02x: CM=%d CINFO=%d\n", cmf, cmf & 0x0f, cmf >> 4);
403
404 flg = g_vfatdata[1];
405 fdict = (flg >> 5) & 1;
406
407 syslog(LOG_INFO, "FLG=%02x: FCHECK=%d FDICT=%d FLEVEL=%d\n",
408 flg, flg & 0x1f, fdict, flg >> 6);
409
410 /* The FCHECK value must be such that CMF and FLG, when viewed as
411 * a 16-bit unsigned integer stored in MSB order (CMF*256 + FLG),
412 * is a multiple of 31.
413 */
414
415 check = cmf * 256 + flg;
416 if (check % 31 != 0)
417 {
418 syslog(LOG_INFO, "Fails check: %04x is not a multiple of 31\n", check);
419 }
420
421 deviceimage = sim_deviceimage();
422 if (deviceimage)
423 {
424 syslog(LOG_INFO, "Inflate SUCCEEDED\n");
425 kmm_free(deviceimage);
426 return 0;
427 }
428 else
429 {
430 syslog(LOG_INFO, "Inflate FAILED\n");
431 return 1;
432 }
433}
434#endif

Callers

nothing calls this directly

Calls 3

sim_deviceimageFunction · 0.85
kmm_freeFunction · 0.85
syslogFunction · 0.50

Tested by

no test coverage detected