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

Function flash64k_test

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

Source from the content-addressed store, hash-verified

332INIT_ENV_EXPORT(rt_hw_on_chip_flash_init);
333
334int flash64k_test(void)
335{
336#define TEST_OFF (ifx_onchip_flash_256k.len - 0x40000)
337 const struct fal_partition *param;
338 uint8_t write_buffer[512U] = {0};
339 uint8_t read_buffer[512U] = {0};
340
341 /* Set write buffer, clear read buffer */
342 for (uint16_t index = 0; index < 512U; index++)
343 {
344 write_buffer[index] = index;
345 read_buffer[index] = 0;
346 }
347
348 param = fal_partition_find("app");
349
350 if (param == RT_NULL)
351 {
352 LOG_E("not find partition app!");
353 return -1;
354 }
355
356 LOG_I("Erase Start...");
357 fal_partition_erase(param, TEST_OFF, 0x40000);
358 LOG_I("Erase succeeded!");
359 LOG_I("Write Start...");
360 fal_partition_write(param, TEST_OFF, write_buffer, sizeof(write_buffer));
361 LOG_I("Write succeeded!");
362 LOG_I("Read Start...");
363 fal_partition_read(param, TEST_OFF, read_buffer, 128U);
364 LOG_I("Read succeeded!");
365
366 for (int i = 0; i < 128U; i++)
367 {
368 if (read_buffer[i] != write_buffer[i])
369 {
370 LOG_E("Data verification failed!");
371 return -1;
372 }
373 }
374
375 LOG_I("Data verification succeeded!");
376 return 0;
377}
378MSH_CMD_EXPORT(flash64k_test, "drv flash64k test.");
379
380int flash32k_test(void)

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