Jump to content

SD card Mutex


Duggle

Recommended Posts

The module documentation at uCApps clearly states that a mutex must be used to ensure mutual exclusion between tasks that may be attempting to access the sd card.

But can calls to FILE_SDCardAvailable() be made without taking/giving the mutex?

Link to comment
Share on other sites

Yes, correct.

The flag is set by FILE_CheckSDCard which should be frequently called and should be protected via Mutex

Note that the Mutex is only required if the SPI port is shared with another device (e.g. MBHP_ETH interface)

Best Regards, Thorsten.

Link to comment
Share on other sites

Presumably, mutexs are required when ever two or more tasks are accessing the same data structures (with the possibility of incomplete changes being seen by the other task(s)).

I think I've been using the SD Card mutex to prevent mutliple processes from simultaneous access to file structures. I have a settings save/restore mechanism that is called from different tasks as well as a data logging facility.

I suppose that I should have separate mutexs to remove the potential for bottlenecks. (Although I dont see performance being an issue).

Link to comment
Share on other sites

Of course, you are right, in this case the usage of a Mutex is required as well.

I mixed this with the mutex which is mentioned in the MIOS32 documentation (MIOS32_SPI).

The only reason for not using mutexes would be to keep the code as simple as possible - but once you learned how to setup them, there is no reason for not using this "protection" mechanism.

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...