MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / flash32k_test

Function flash32k_test

bsp/Infineon/libraries/HAL_Drivers/drv_flash.c:380–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378MSH_CMD_EXPORT(flash64k_test, "drv flash64k test.");
379
380int flash32k_test(void)
381{
382#define TEST32_OFF (ifx_onchip_flash_32k.len - 0x8000)
383 const struct fal_partition *param;
384 uint8_t write_buffer[512U] = {0};
385 uint8_t read_buffer[512U] = {0};
386
387 /* Set write buffer, clear read buffer */
388 for (uint16_t index = 0; index < 512U; index++)
389 {
390 write_buffer[index] = index;
391 read_buffer[index] = 0;
392 }
393
394 param = fal_partition_find("param");
395
396 if (param == RT_NULL)
397 {
398 LOG_E("not find partition param!");
399 return -1;
400 }
401
402 LOG_I("Erase Start...");
403 fal_partition_erase(param, TEST32_OFF, 0x8000);
404 LOG_I("Erase succeeded!");
405 LOG_I("Write Start...");
406 fal_partition_write(param, TEST32_OFF, write_buffer, sizeof(write_buffer));
407 LOG_I("Write succeeded!");
408 LOG_I("Read Start...");
409 fal_partition_read(param, TEST32_OFF, read_buffer, 128U);
410 LOG_I("Read succeeded!");
411
412 for (int i = 0; i < 128U; i++)
413 {
414 if (read_buffer[i] != write_buffer[i])
415 {
416 LOG_E("Data verification failed!");
417 return -1;
418 }
419 }
420
421 LOG_I("Data verification succeeded!");
422 return 0;
423}
424MSH_CMD_EXPORT(flash32k_test, "drv flash32k test.");
425#endif
426#endif

Callers

nothing calls this directly

Calls 4

fal_partition_findFunction · 0.85
fal_partition_eraseFunction · 0.85
fal_partition_writeFunction · 0.85
fal_partition_readFunction · 0.85

Tested by

no test coverage detected