diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-12-20 18:13:36 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-12-20 18:13:36 +0300 |
commit | 9601e42dec2b9292c8b43f41b4ad89d99a238655 (patch) | |
tree | f986d6a1ac568529195448da0741f23cdfa09a18 /src/Storage | |
parent | b161d60fd7ef765b7ea91cdad3b5e24eea5b3ad7 (diff) |
Initialise fsMutex in Duet 2 SBC buildv3-wilriker
Diffstat (limited to 'src/Storage')
-rw-r--r-- | src/Storage/MassStorage.cpp | 11 | ||||
-rw-r--r-- | src/Storage/MassStorage.h | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/Storage/MassStorage.cpp b/src/Storage/MassStorage.cpp index dbb8c7db..e56f5c74 100644 --- a/src/Storage/MassStorage.cpp +++ b/src/Storage/MassStorage.cpp @@ -261,13 +261,19 @@ static const char* TranslateCardError(sd_mmc_err_t err) noexcept } } +#endif + +#if HAS_MASS_STORAGE || HAS_LINUX_INTERFACE + void MassStorage::Init() noexcept { + fsMutex.Create("FileSystem"); + +# if HAS_MASS_STORAGE static const char * const VolMutexNames[] = { "SD0", "SD1" }; static_assert(ARRAY_SIZE(VolMutexNames) >= NumSdCards, "Incorrect VolMutexNames array"); // Create the mutexes - fsMutex.Create("FileSystem"); dirMutex.Create("DirSearch"); freeWriteBuffers = nullptr; @@ -293,10 +299,9 @@ void MassStorage::Init() noexcept sd_mmc_init(SdWriteProtectPins, SdSpiCSPins); // initialize SD MMC stack // We no longer mount the SD card here because it may take a long time if it fails +# endif } -#endif -#if HAS_MASS_STORAGE || HAS_LINUX_INTERFACE FileStore* MassStorage::OpenFile(const char* filePath, OpenMode mode, uint32_t preAllocSize) noexcept { { diff --git a/src/Storage/MassStorage.h b/src/Storage/MassStorage.h index 27db549e..46fc85bf 100644 --- a/src/Storage/MassStorage.h +++ b/src/Storage/MassStorage.h @@ -28,10 +28,8 @@ namespace MassStorage bool CombineName(const StringRef& out, const char* directory, const char* fileName) noexcept; // returns false if error i.e. filename too long const char* GetMonthName(const uint8_t month) noexcept; -#if HAS_MASS_STORAGE - void Init() noexcept; -#endif #if HAS_MASS_STORAGE || HAS_LINUX_INTERFACE + void Init() noexcept; FileStore* OpenFile(const char* filePath, OpenMode mode, uint32_t preAllocSize) noexcept; bool FileExists(const char *filePath) noexcept; #endif |