Hello,
I am just wondering if the position of "EVENT_Delete(kEVENT_TransferComplete);" is wrong in SDK 2.0. The file is located in line 257 @ middleware\fatfs_0.11a\src\fsl_sd_disk\fsl_sd_disk.c.
I am thinking it should be placed between line 253 and 254 so that the event get removed upon failed initialisation. Could anyone from NXP please confirm if I have misunderstood the code? Thanks
Here is the code
if (kStatus_Success != SD_Init(&g_sd))
{
SD_Deinit(&g_sd);
SDHC_Deinit(BOARD_SDHC_BASEADDR);
memset(&g_sd, 0U, sizeof(g_sd));
memset(&g_sdhcAdmaTable, 0U, sizeof(g_sdhcAdmaTable));
memset(&g_sdhcHandle, 0U, sizeof(g_sdhcHandle));
+ EVENT_Delete(kEVENT_TransferComplete);
return STA_NOINIT;
}
- EVENT_Delete(kEVENT_TransferComplete);
Solved! Go to Solution.
Hello,
This bug has already been reported and this is the report number: KPSDK-13253. I would expect to be fixed in next releases.
Regards,
Isaac
Hello,
This bug has already been reported and this is the report number: KPSDK-13253. I would expect to be fixed in next releases.
Regards,
Isaac
Thank you Issac. That is really helpful.
Hello,
Indeed, it makes sense the change that you did to delete the event when disk initialization was wrong. In this case, this EVENT_Delete was used to "initialize" the event value (to 0) although it was created with zero value at EVENT_Create function.
As EVENT_Delete function does not "free" the memory from EVENT object, there is no impact of moving the function when disk initialization fails, however, I'll report this bug to development team for further implementation where this event is created dynamically and it EVENT object needs to be freed when disk initialization fails.
Thanks for pointing this out!
Regards,
Isaac