git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5029 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
c95f632a67
commit
66205faf65
|
@ -19,11 +19,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ch.hpp"
|
#include "ch.hpp"
|
||||||
#include "fs.hpp"
|
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
#include "fs.hpp"
|
||||||
|
#include "fatfs_fsimpl.hpp"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace chibios_rt;
|
using namespace chibios_rt;
|
||||||
|
using namespace chibios_fatfs;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LED blink sequences.
|
* LED blink sequences.
|
||||||
|
@ -149,6 +151,8 @@ static SequencerThread blinker2(LED4_sequence);
|
||||||
static SequencerThread blinker3(LED5_sequence);
|
static SequencerThread blinker3(LED5_sequence);
|
||||||
static SequencerThread blinker4(LED6_sequence);
|
static SequencerThread blinker4(LED6_sequence);
|
||||||
|
|
||||||
|
static FatFSWrapper fs(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application entry point.
|
* Application entry point.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
#define ERR_TERMINATING (msg_t)1
|
#define ERR_TERMINATING (msg_t)1
|
||||||
#define ERR_UNKNOWN_MSG (msg_t)2
|
#define ERR_UNKNOWN_MSG (msg_t)2
|
||||||
|
|
||||||
|
using namespace chibios_rt;
|
||||||
|
using namespace chibios_fs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FatFS wrapper-related classes and interfaces.
|
* @brief FatFS wrapper-related classes and interfaces.
|
||||||
*/
|
*/
|
||||||
|
@ -51,11 +54,11 @@ namespace chibios_fatfs {
|
||||||
start(FATFS_THREAD_PRIORITY);
|
start(FATFS_THREAD_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
FatFSWrapper::FatFSServerThread::~FatFSServerThread() {
|
/* FatFSWrapper::FatFSServerThread::~FatFSServerThread() {
|
||||||
|
|
||||||
sendMessage(MSG_TERMINATE);
|
sendMessage(MSG_TERMINATE);
|
||||||
wait();
|
wait();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
msg_t FatFSWrapper::FatFSServerThread::main() {
|
msg_t FatFSWrapper::FatFSServerThread::main() {
|
||||||
msg_t sts;
|
msg_t sts;
|
||||||
|
@ -84,9 +87,47 @@ namespace chibios_fatfs {
|
||||||
server.start(FATFS_THREAD_PRIORITY);
|
server.start(FATFS_THREAD_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
FatFSWrapper::~FatFSWrapper() {
|
/* FatFSWrapper::~FatFSWrapper() {
|
||||||
|
|
||||||
server.~FatFSServerThread();
|
server.~FatFSServerThread();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
uint32_t FatFSWrapper::getAndClearLastError(void) {
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FatFSWrapper::synchronize(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FatFSWrapper::remove(const char *fname) {
|
||||||
|
|
||||||
|
(void)fname;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseFileStreamInterface *FatFSWrapper::open(const char *fname) {
|
||||||
|
|
||||||
|
(void)fname;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseFileStreamInterface *FatFSWrapper::openForRead(const char *fname) {
|
||||||
|
|
||||||
|
(void)fname;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseFileStreamInterface *FatFSWrapper::openForWrite(const char *fname) {
|
||||||
|
|
||||||
|
(void)fname;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseFileStreamInterface *FatFSWrapper::create(const char *fname) {
|
||||||
|
|
||||||
|
(void)fname;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ch.hpp"
|
#include "ch.hpp"
|
||||||
|
#include "fs.hpp"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
|
||||||
#ifndef _FS_FATFS_IMPL_HPP_
|
#ifndef _FS_FATFS_IMPL_HPP_
|
||||||
|
@ -47,6 +48,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace chibios_rt;
|
using namespace chibios_rt;
|
||||||
|
using namespace chibios_fs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FatFS wrapper-related classes and interfaces.
|
* @brief FatFS wrapper-related classes and interfaces.
|
||||||
|
@ -71,13 +73,17 @@ namespace chibios_fatfs {
|
||||||
virtual msg_t main(void);
|
virtual msg_t main(void);
|
||||||
public:
|
public:
|
||||||
FatFSServerThread(::BaseBlockDevice *blkdev);
|
FatFSServerThread(::BaseBlockDevice *blkdev);
|
||||||
~FatFSServerThread();
|
|
||||||
} server;
|
} server;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FatFSWrapper(::BaseBlockDevice *blkdev);
|
FatFSWrapper(::BaseBlockDevice *blkdev);
|
||||||
|
virtual uint32_t getAndClearLastError(void);
|
||||||
~FatFSWrapper();
|
virtual void synchronize(void);
|
||||||
|
virtual void remove(const char *fname);
|
||||||
|
virtual BaseFileStreamInterface *open(const char *fname);
|
||||||
|
virtual BaseFileStreamInterface *openForRead(const char *fname);
|
||||||
|
virtual BaseFileStreamInterface *openForWrite(const char *fname);
|
||||||
|
virtual BaseFileStreamInterface *create(const char *fname);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,11 +123,6 @@ namespace chibios_fs {
|
||||||
*/
|
*/
|
||||||
class BaseFileSystemInterface {
|
class BaseFileSystemInterface {
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @brief File system unmount and object destruction.
|
|
||||||
*/
|
|
||||||
virtual ~BaseFileSystemInterface() = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns an implementation dependent error code.
|
* @brief Returns an implementation dependent error code.
|
||||||
*
|
*
|
||||||
|
|
|
@ -279,6 +279,14 @@ namespace chibios_rt {
|
||||||
chThdYield();
|
chThdYield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CH_USE_MESSAGES
|
||||||
|
ThreadReference BaseThread::waitMessage(void) {
|
||||||
|
|
||||||
|
ThreadReference tr(chMsgWait());
|
||||||
|
return tr;
|
||||||
|
}
|
||||||
|
#endif /* CH_USE_MESSAGES */
|
||||||
|
|
||||||
#if CH_USE_EVENTS
|
#if CH_USE_EVENTS
|
||||||
eventmask_t BaseThread::getAndClearEvents(eventmask_t mask) {
|
eventmask_t BaseThread::getAndClearEvents(eventmask_t mask) {
|
||||||
|
|
||||||
|
|
|
@ -385,7 +385,6 @@ namespace chibios_rt {
|
||||||
*/
|
*/
|
||||||
class BaseThread : public ThreadReference {
|
class BaseThread : public ThreadReference {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BaseThread constructor.
|
* @brief BaseThread constructor.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue