diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-01-04 10:26:22 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-01-04 10:26:22 +0000 |
commit | 77f68f1c5b8f39a9146f5bd644867dde10b24c14 (patch) | |
tree | c47f7999708d41650b3ba17a880f1984f7620c79 /os/fs | |
parent | 66205faf65927f86cd1faa8d738e48551fff75e0 (diff) | |
download | ChibiOS-77f68f1c5b8f39a9146f5bd644867dde10b24c14.tar.gz ChibiOS-77f68f1c5b8f39a9146f5bd644867dde10b24c14.tar.bz2 ChibiOS-77f68f1c5b8f39a9146f5bd644867dde10b24c14.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5030 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/fs')
-rw-r--r-- | os/fs/fatfs/fatfs_fsimpl.cpp | 23 | ||||
-rw-r--r-- | os/fs/fatfs/fatfs_fsimpl.hpp | 18 |
2 files changed, 29 insertions, 12 deletions
diff --git a/os/fs/fatfs/fatfs_fsimpl.cpp b/os/fs/fatfs/fatfs_fsimpl.cpp index e42c11e50..4fd071f00 100644 --- a/os/fs/fatfs/fatfs_fsimpl.cpp +++ b/os/fs/fatfs/fatfs_fsimpl.cpp @@ -47,9 +47,8 @@ namespace chibios_fatfs { /*------------------------------------------------------------------------*
* chibios_fatfs::FatFSWrapper::FatFSServerThread *
*------------------------------------------------------------------------*/
- FatFSWrapper::FatFSServerThread::FatFSServerThread(::BaseBlockDevice *blkdev) :
- BaseStaticThread<FATFS_THREAD_STACK_SIZE>(),
- blkdev(blkdev) {
+ FatFSWrapper::FatFSServerThread::FatFSServerThread(void) :
+ BaseStaticThread<FATFS_THREAD_STACK_SIZE>() {
start(FATFS_THREAD_PRIORITY);
}
@@ -79,18 +78,28 @@ namespace chibios_fatfs { }
}
+ void FatFSWrapper::FatFSServerThread::stop(void) {
+
+ sendMessage(MSG_TERMINATE);
+ wait();
+ }
+
/*------------------------------------------------------------------------*
* chibios_fatfs::FatFSWrapper *
*------------------------------------------------------------------------*/
- FatFSWrapper::FatFSWrapper(::BaseBlockDevice *blkdev) : server(blkdev) {
+ FatFSWrapper::FatFSWrapper(void) {
+
+ }
+
+ void FatFSWrapper::mount(void) {
server.start(FATFS_THREAD_PRIORITY);
}
-/* FatFSWrapper::~FatFSWrapper() {
+ void FatFSWrapper::unmount(void) {
- server.~FatFSServerThread();
- }*/
+ server.stop();
+ }
uint32_t FatFSWrapper::getAndClearLastError(void) {
diff --git a/os/fs/fatfs/fatfs_fsimpl.hpp b/os/fs/fatfs/fatfs_fsimpl.hpp index 8c61c5748..cdb46bc66 100644 --- a/os/fs/fatfs/fatfs_fsimpl.hpp +++ b/os/fs/fatfs/fatfs_fsimpl.hpp @@ -28,7 +28,6 @@ #include "ch.hpp"
#include "fs.hpp"
-#include "hal.h"
#ifndef _FS_FATFS_IMPL_HPP_
#define _FS_FATFS_IMPL_HPP_
@@ -67,16 +66,15 @@ namespace chibios_fatfs { * @brief Class of the internal server thread.
*/
class FatFSServerThread : public BaseStaticThread<FATFS_THREAD_STACK_SIZE> {
- private:
- ::BaseBlockDevice *blkdev;
protected:
virtual msg_t main(void);
public:
- FatFSServerThread(::BaseBlockDevice *blkdev);
+ FatFSServerThread(void);
+ virtual void stop(void);
} server;
public:
- FatFSWrapper(::BaseBlockDevice *blkdev);
+ FatFSWrapper(void);
virtual uint32_t getAndClearLastError(void);
virtual void synchronize(void);
virtual void remove(const char *fname);
@@ -84,6 +82,16 @@ namespace chibios_fatfs { virtual BaseFileStreamInterface *openForRead(const char *fname);
virtual BaseFileStreamInterface *openForWrite(const char *fname);
virtual BaseFileStreamInterface *create(const char *fname);
+
+ /**
+ * @brief Mounts the file system.
+ */
+ void mount(void);
+
+ /**
+ * @brief Unmounts the file system.
+ */
+ void unmount(void);
};
}
|