is sdmmc driver reentrant?

squonk11
Posts: 69
Joined: Wed Mar 01, 2017 6:53 pm
Location: Germany

is sdmmc driver reentrant?

Postby squonk11 » Mon Jul 16, 2018 2:23 pm

I am trying to implement a webserver which serves the webpages stored on an SD card. It also should be able to serve more than one simultaneous connection. For this the esp-idf driver for the SD card needs to be reentrant. Is this the case?
"Whoever believes to be someone has stopped becoming someone"
Sokrates

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: is sdmmc driver reentrant?

Postby ESP_igrr » Tue Jul 17, 2018 7:20 am

If you are reading files from FAT filesystem via standard C library functions, then you can do so from multiple concurrent tasks. Keep in mind that FATFS library does not support some concurrent operations on same file (reading/writing from one task and deleting it from the other).

If you aren't using FATFS, and accessing SD card as raw storage via sdmmc protocol layer, you need to add locking around SD card commands yourself.

squonk11
Posts: 69
Joined: Wed Mar 01, 2017 6:53 pm
Location: Germany

Re: is sdmmc driver reentrant?

Postby squonk11 » Tue Jul 17, 2018 4:00 pm

thank you for your fast answer.
yes, I will be using FAT filesystem with the in esp-idf provided C library. The webpages of course will only be read; so, a simultaneous read of the same file from two different tasks needs to be possible. I guess your answer gives green light for this approach, right?
"Whoever believes to be someone has stopped becoming someone"
Sokrates

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: is sdmmc driver reentrant?

Postby ESP_igrr » Wed Jul 18, 2018 7:06 am

Yes, simultaneous read from the same file from different tasks is possible.

Who is online

Users browsing this forum: No registered users and 137 guests