git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5030 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
66205faf65
commit
77f68f1c5b
|
@ -151,7 +151,7 @@ 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);
|
static FatFSWrapper fs;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application entry point.
|
* Application entry point.
|
||||||
|
@ -168,6 +168,9 @@ int main(void) {
|
||||||
halInit();
|
halInit();
|
||||||
System::init();
|
System::init();
|
||||||
|
|
||||||
|
fs.mount();
|
||||||
|
fs.unmount();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Activates the serial driver 2 using the driver default configuration.
|
* Activates the serial driver 2 using the driver default configuration.
|
||||||
* PA2(TX) and PA3(RX) are routed to USART2.
|
* PA2(TX) and PA3(RX) are routed to USART2.
|
||||||
|
|
|
@ -47,9 +47,8 @@ namespace chibios_fatfs {
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_fatfs::FatFSWrapper::FatFSServerThread *
|
* chibios_fatfs::FatFSWrapper::FatFSServerThread *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
FatFSWrapper::FatFSServerThread::FatFSServerThread(::BaseBlockDevice *blkdev) :
|
FatFSWrapper::FatFSServerThread::FatFSServerThread(void) :
|
||||||
BaseStaticThread<FATFS_THREAD_STACK_SIZE>(),
|
BaseStaticThread<FATFS_THREAD_STACK_SIZE>() {
|
||||||
blkdev(blkdev) {
|
|
||||||
|
|
||||||
start(FATFS_THREAD_PRIORITY);
|
start(FATFS_THREAD_PRIORITY);
|
||||||
}
|
}
|
||||||
|
@ -79,18 +78,28 @@ namespace chibios_fatfs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FatFSWrapper::FatFSServerThread::stop(void) {
|
||||||
|
|
||||||
|
sendMessage(MSG_TERMINATE);
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_fatfs::FatFSWrapper *
|
* chibios_fatfs::FatFSWrapper *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
FatFSWrapper::FatFSWrapper(::BaseBlockDevice *blkdev) : server(blkdev) {
|
FatFSWrapper::FatFSWrapper(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FatFSWrapper::mount(void) {
|
||||||
|
|
||||||
server.start(FATFS_THREAD_PRIORITY);
|
server.start(FATFS_THREAD_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FatFSWrapper::~FatFSWrapper() {
|
void FatFSWrapper::unmount(void) {
|
||||||
|
|
||||||
server.~FatFSServerThread();
|
server.stop();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
uint32_t FatFSWrapper::getAndClearLastError(void) {
|
uint32_t FatFSWrapper::getAndClearLastError(void) {
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
#include "ch.hpp"
|
#include "ch.hpp"
|
||||||
#include "fs.hpp"
|
#include "fs.hpp"
|
||||||
#include "hal.h"
|
|
||||||
|
|
||||||
#ifndef _FS_FATFS_IMPL_HPP_
|
#ifndef _FS_FATFS_IMPL_HPP_
|
||||||
#define _FS_FATFS_IMPL_HPP_
|
#define _FS_FATFS_IMPL_HPP_
|
||||||
|
@ -67,16 +66,15 @@ namespace chibios_fatfs {
|
||||||
* @brief Class of the internal server thread.
|
* @brief Class of the internal server thread.
|
||||||
*/
|
*/
|
||||||
class FatFSServerThread : public BaseStaticThread<FATFS_THREAD_STACK_SIZE> {
|
class FatFSServerThread : public BaseStaticThread<FATFS_THREAD_STACK_SIZE> {
|
||||||
private:
|
|
||||||
::BaseBlockDevice *blkdev;
|
|
||||||
protected:
|
protected:
|
||||||
virtual msg_t main(void);
|
virtual msg_t main(void);
|
||||||
public:
|
public:
|
||||||
FatFSServerThread(::BaseBlockDevice *blkdev);
|
FatFSServerThread(void);
|
||||||
|
virtual void stop(void);
|
||||||
} server;
|
} server;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FatFSWrapper(::BaseBlockDevice *blkdev);
|
FatFSWrapper(void);
|
||||||
virtual uint32_t getAndClearLastError(void);
|
virtual uint32_t getAndClearLastError(void);
|
||||||
virtual void synchronize(void);
|
virtual void synchronize(void);
|
||||||
virtual void remove(const char *fname);
|
virtual void remove(const char *fname);
|
||||||
|
@ -84,6 +82,16 @@ namespace chibios_fatfs {
|
||||||
virtual BaseFileStreamInterface *openForRead(const char *fname);
|
virtual BaseFileStreamInterface *openForRead(const char *fname);
|
||||||
virtual BaseFileStreamInterface *openForWrite(const char *fname);
|
virtual BaseFileStreamInterface *openForWrite(const char *fname);
|
||||||
virtual BaseFileStreamInterface *create(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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,12 @@ namespace chibios_rt {
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::ThreadReference *
|
* chibios_rt::ThreadReference *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void ThreadReference::stop(void) {
|
||||||
|
|
||||||
|
chDbgPanic("invoked unimplemented method stop()");
|
||||||
|
}
|
||||||
|
|
||||||
msg_t ThreadReference::suspend(void) {
|
msg_t ThreadReference::suspend(void) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
|
|
||||||
|
@ -158,6 +164,10 @@ namespace chibios_rt {
|
||||||
|
|
||||||
void ThreadReference::requestTerminate(void) {
|
void ThreadReference::requestTerminate(void) {
|
||||||
|
|
||||||
|
chDbgAssert(thread_ref != NULL,
|
||||||
|
"ThreadReference, #5",
|
||||||
|
"not referenced");
|
||||||
|
|
||||||
chThdTerminate(thread_ref);
|
chThdTerminate(thread_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +175,7 @@ namespace chibios_rt {
|
||||||
msg_t ThreadReference::wait(void) {
|
msg_t ThreadReference::wait(void) {
|
||||||
|
|
||||||
chDbgAssert(thread_ref != NULL,
|
chDbgAssert(thread_ref != NULL,
|
||||||
"ThreadReference, #5",
|
"ThreadReference, #6",
|
||||||
"not referenced");
|
"not referenced");
|
||||||
|
|
||||||
msg_t msg = chThdWait(thread_ref);
|
msg_t msg = chThdWait(thread_ref);
|
||||||
|
@ -178,7 +188,7 @@ namespace chibios_rt {
|
||||||
msg_t ThreadReference::sendMessage(msg_t msg) {
|
msg_t ThreadReference::sendMessage(msg_t msg) {
|
||||||
|
|
||||||
chDbgAssert(thread_ref != NULL,
|
chDbgAssert(thread_ref != NULL,
|
||||||
"ThreadReference, #6",
|
"ThreadReference, #7",
|
||||||
"not referenced");
|
"not referenced");
|
||||||
|
|
||||||
return chMsgSend(thread_ref, msg);
|
return chMsgSend(thread_ref, msg);
|
||||||
|
@ -186,16 +196,28 @@ namespace chibios_rt {
|
||||||
|
|
||||||
bool ThreadReference::isPendingMessage(void) {
|
bool ThreadReference::isPendingMessage(void) {
|
||||||
|
|
||||||
|
chDbgAssert(thread_ref != NULL,
|
||||||
|
"ThreadReference, #7",
|
||||||
|
"not referenced");
|
||||||
|
|
||||||
return (bool)chMsgIsPendingI(thread_ref);
|
return (bool)chMsgIsPendingI(thread_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t ThreadReference::getMessage(void) {
|
msg_t ThreadReference::getMessage(void) {
|
||||||
|
|
||||||
|
chDbgAssert(thread_ref != NULL,
|
||||||
|
"ThreadReference, #8",
|
||||||
|
"not referenced");
|
||||||
|
|
||||||
return chMsgGet(thread_ref);
|
return chMsgGet(thread_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadReference::releaseMessage(msg_t msg) {
|
void ThreadReference::releaseMessage(msg_t msg) {
|
||||||
|
|
||||||
|
chDbgAssert(thread_ref != NULL,
|
||||||
|
"ThreadReference, #9",
|
||||||
|
"not referenced");
|
||||||
|
|
||||||
chMsgRelease(thread_ref, msg);
|
chMsgRelease(thread_ref, msg);
|
||||||
}
|
}
|
||||||
#endif /* CH_USE_MESSAGES */
|
#endif /* CH_USE_MESSAGES */
|
||||||
|
@ -203,11 +225,19 @@ namespace chibios_rt {
|
||||||
#if CH_USE_EVENTS
|
#if CH_USE_EVENTS
|
||||||
void ThreadReference::signalEvents(eventmask_t mask) {
|
void ThreadReference::signalEvents(eventmask_t mask) {
|
||||||
|
|
||||||
|
chDbgAssert(thread_ref != NULL,
|
||||||
|
"ThreadReference, #10",
|
||||||
|
"not referenced");
|
||||||
|
|
||||||
chEvtSignal(thread_ref, mask);
|
chEvtSignal(thread_ref, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadReference::signalEventsI(eventmask_t mask) {
|
void ThreadReference::signalEventsI(eventmask_t mask) {
|
||||||
|
|
||||||
|
chDbgAssert(thread_ref != NULL,
|
||||||
|
"ThreadReference, #11",
|
||||||
|
"not referenced");
|
||||||
|
|
||||||
chEvtSignalI(thread_ref, mask);
|
chEvtSignalI(thread_ref, mask);
|
||||||
}
|
}
|
||||||
#endif /* CH_USE_EVENTS */
|
#endif /* CH_USE_EVENTS */
|
||||||
|
@ -359,66 +389,66 @@ namespace chibios_rt {
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES
|
#if CH_USE_SEMAPHORES
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::Semaphore *
|
* chibios_rt::CounterSemaphore *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
Semaphore::Semaphore(cnt_t n) {
|
CounterSemaphore::CounterSemaphore(cnt_t n) {
|
||||||
|
|
||||||
chSemInit(&sem, n);
|
chSemInit(&sem, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore::reset(cnt_t n) {
|
void CounterSemaphore::reset(cnt_t n) {
|
||||||
|
|
||||||
chSemReset(&sem, n);
|
chSemReset(&sem, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore::resetI(cnt_t n) {
|
void CounterSemaphore::resetI(cnt_t n) {
|
||||||
|
|
||||||
chSemResetI(&sem, n);
|
chSemResetI(&sem, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t Semaphore::wait(void) {
|
msg_t CounterSemaphore::wait(void) {
|
||||||
|
|
||||||
return chSemWait(&sem);
|
return chSemWait(&sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t Semaphore::waitS(void) {
|
msg_t CounterSemaphore::waitS(void) {
|
||||||
|
|
||||||
return chSemWaitS(&sem);
|
return chSemWaitS(&sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t Semaphore::waitTimeout(systime_t time) {
|
msg_t CounterSemaphore::waitTimeout(systime_t time) {
|
||||||
|
|
||||||
return chSemWaitTimeout(&sem, time);
|
return chSemWaitTimeout(&sem, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t Semaphore::waitTimeoutS(systime_t time) {
|
msg_t CounterSemaphore::waitTimeoutS(systime_t time) {
|
||||||
|
|
||||||
return chSemWaitTimeoutS(&sem, time);
|
return chSemWaitTimeoutS(&sem, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore::signal(void) {
|
void CounterSemaphore::signal(void) {
|
||||||
|
|
||||||
chSemSignal(&sem);
|
chSemSignal(&sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore::signalI(void) {
|
void CounterSemaphore::signalI(void) {
|
||||||
|
|
||||||
chSemSignalI(&sem);
|
chSemSignalI(&sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore::addCounterI(cnt_t n) {
|
void CounterSemaphore::addCounterI(cnt_t n) {
|
||||||
|
|
||||||
chSemAddCounterI(&sem, n);
|
chSemAddCounterI(&sem, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt_t Semaphore::getCounterI(void) {
|
cnt_t CounterSemaphore::getCounterI(void) {
|
||||||
|
|
||||||
return chSemGetCounterI(&sem);
|
return chSemGetCounterI(&sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CH_USE_SEMSW
|
#if CH_USE_SEMSW
|
||||||
msg_t Semaphore::signalWait(chibios_rt::Semaphore *ssem,
|
msg_t CounterSemaphore::signalWait(CounterSemaphore *ssem,
|
||||||
chibios_rt::Semaphore *wsem) {
|
CounterSemaphore *wsem) {
|
||||||
|
|
||||||
return chSemSignalWait(&ssem->sem, &wsem->sem);
|
return chSemSignalWait(&ssem->sem, &wsem->sem);
|
||||||
}
|
}
|
||||||
|
@ -607,110 +637,108 @@ namespace chibios_rt {
|
||||||
|
|
||||||
#if CH_USE_QUEUES
|
#if CH_USE_QUEUES
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::InputQueue *
|
* chibios_rt::InQueue *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
InputQueue::InputQueue(uint8_t *bp, size_t size,
|
InQueue::InQueue(uint8_t *bp, size_t size, qnotify_t infy, void *link) {
|
||||||
qnotify_t infy, void *link) {
|
|
||||||
|
|
||||||
chIQInit(&iq, bp, size, infy, link);
|
chIQInit(&iq, bp, size, infy, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t InputQueue::getFullI(void) {
|
size_t InQueue::getFullI(void) {
|
||||||
|
|
||||||
return chIQGetFullI(&iq);
|
return chIQGetFullI(&iq);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t InputQueue::getEmptyI(void) {
|
size_t InQueue::getEmptyI(void) {
|
||||||
|
|
||||||
return chIQGetEmptyI(&iq);
|
return chIQGetEmptyI(&iq);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputQueue::isEmptyI(void) {
|
bool InQueue::isEmptyI(void) {
|
||||||
|
|
||||||
return (bool)chIQIsEmptyI(&iq);
|
return (bool)chIQIsEmptyI(&iq);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputQueue::isFullI(void) {
|
bool InQueue::isFullI(void) {
|
||||||
|
|
||||||
return (bool)chIQIsFullI(&iq);
|
return (bool)chIQIsFullI(&iq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputQueue::resetI(void) {
|
void InQueue::resetI(void) {
|
||||||
|
|
||||||
chIQResetI(&iq);
|
chIQResetI(&iq);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t InputQueue::putI(uint8_t b) {
|
msg_t InQueue::putI(uint8_t b) {
|
||||||
|
|
||||||
return chIQPutI(&iq, b);
|
return chIQPutI(&iq, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t InputQueue::get() {
|
msg_t InQueue::get() {
|
||||||
|
|
||||||
return chIQGet(&iq);
|
return chIQGet(&iq);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t InputQueue::getTimeout(systime_t time) {
|
msg_t InQueue::getTimeout(systime_t time) {
|
||||||
|
|
||||||
return chIQGetTimeout(&iq, time);
|
return chIQGetTimeout(&iq, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t InputQueue::readTimeout(uint8_t *bp, size_t n, systime_t time) {
|
size_t InQueue::readTimeout(uint8_t *bp, size_t n, systime_t time) {
|
||||||
|
|
||||||
return chIQReadTimeout(&iq, bp, n, time);
|
return chIQReadTimeout(&iq, bp, n, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::OutputQueue *
|
* chibios_rt::OutQueue *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
OutputQueue::OutputQueue(uint8_t *bp, size_t size,
|
OutQueue::OutQueue(uint8_t *bp, size_t size, qnotify_t onfy, void *link) {
|
||||||
qnotify_t onfy, void *link) {
|
|
||||||
|
|
||||||
chOQInit(&oq, bp, size, onfy, link);
|
chOQInit(&oq, bp, size, onfy, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t OutputQueue::getFullI(void) {
|
size_t OutQueue::getFullI(void) {
|
||||||
|
|
||||||
return chOQGetFullI(&oq);
|
return chOQGetFullI(&oq);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t OutputQueue::getEmptyI(void) {
|
size_t OutQueue::getEmptyI(void) {
|
||||||
|
|
||||||
return chOQGetEmptyI(&oq);
|
return chOQGetEmptyI(&oq);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutputQueue::isEmptyI(void) {
|
bool OutQueue::isEmptyI(void) {
|
||||||
|
|
||||||
return (bool)chOQIsEmptyI(&oq);
|
return (bool)chOQIsEmptyI(&oq);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutputQueue::isFullI(void) {
|
bool OutQueue::isFullI(void) {
|
||||||
|
|
||||||
return (bool)chOQIsFullI(&oq);
|
return (bool)chOQIsFullI(&oq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputQueue::resetI(void) {
|
void OutQueue::resetI(void) {
|
||||||
|
|
||||||
chOQResetI(&oq);
|
chOQResetI(&oq);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t OutputQueue::put(uint8_t b) {
|
msg_t OutQueue::put(uint8_t b) {
|
||||||
|
|
||||||
return chOQPut(&oq, b);
|
return chOQPut(&oq, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t OutputQueue::putTimeout(uint8_t b, systime_t time) {
|
msg_t OutQueue::putTimeout(uint8_t b, systime_t time) {
|
||||||
|
|
||||||
return chOQPutTimeout(&oq, b, time);
|
return chOQPutTimeout(&oq, b, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t OutputQueue::getI(void) {
|
msg_t OutQueue::getI(void) {
|
||||||
|
|
||||||
return chOQGetI(&oq);
|
return chOQGetI(&oq);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t OutputQueue::writeTimeout(const uint8_t *bp, size_t n,
|
size_t OutQueue::writeTimeout(const uint8_t *bp, size_t n,
|
||||||
systime_t time) {
|
systime_t time) {
|
||||||
|
|
||||||
return chOQWriteTimeout(&oq, bp, n, time);
|
return chOQWriteTimeout(&oq, bp, n, time);
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,13 @@ namespace chibios_rt {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stops the thread.
|
||||||
|
* @note The implementation is left to descendant classes and is
|
||||||
|
* optional.
|
||||||
|
*/
|
||||||
|
virtual void stop(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Suspends the current thread on the reference.
|
* @brief Suspends the current thread on the reference.
|
||||||
* @details The suspended thread becomes the referenced thread. It is
|
* @details The suspended thread becomes the referenced thread. It is
|
||||||
|
@ -752,12 +759,12 @@ namespace chibios_rt {
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES || defined(__DOXYGEN__)
|
#if CH_USE_SEMAPHORES || defined(__DOXYGEN__)
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::Semaphore *
|
* chibios_rt::CounterSemaphore *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* @brief Class encapsulating a semaphore.
|
* @brief Class encapsulating a semaphore.
|
||||||
*/
|
*/
|
||||||
class Semaphore {
|
class CounterSemaphore {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Embedded @p ::Semaphore structure.
|
* @brief Embedded @p ::Semaphore structure.
|
||||||
|
@ -765,7 +772,7 @@ namespace chibios_rt {
|
||||||
::Semaphore sem;
|
::Semaphore sem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Semaphore constructor.
|
* @brief CounterSemaphore constructor.
|
||||||
* @details The embedded @p ::Semaphore structure is initialized.
|
* @details The embedded @p ::Semaphore structure is initialized.
|
||||||
*
|
*
|
||||||
* @param[in] n the semaphore counter value, must be greater
|
* @param[in] n the semaphore counter value, must be greater
|
||||||
|
@ -773,7 +780,7 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @init
|
* @init
|
||||||
*/
|
*/
|
||||||
Semaphore(cnt_t n);
|
CounterSemaphore(cnt_t n);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs a reset operation on the semaphore.
|
* @brief Performs a reset operation on the semaphore.
|
||||||
|
@ -930,8 +937,8 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
static msg_t signalWait(chibios_rt::Semaphore *ssem,
|
static msg_t signalWait(CounterSemaphore *ssem,
|
||||||
chibios_rt::Semaphore *wsem);
|
CounterSemaphore *wsem);
|
||||||
#endif /* CH_USE_SEMSW */
|
#endif /* CH_USE_SEMSW */
|
||||||
};
|
};
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
|
@ -1398,12 +1405,12 @@ namespace chibios_rt {
|
||||||
|
|
||||||
#if CH_USE_QUEUES || defined(__DOXYGEN__)
|
#if CH_USE_QUEUES || defined(__DOXYGEN__)
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::InputQueue *
|
* chibios_rt::InQueue *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* @brief Class encapsulating an input queue.
|
* @brief Class encapsulating an input queue.
|
||||||
*/
|
*/
|
||||||
class InputQueue {
|
class InQueue {
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Embedded @p ::InputQueue structure.
|
* @brief Embedded @p ::InputQueue structure.
|
||||||
|
@ -1412,7 +1419,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief InputQueue constructor.
|
* @brief InQueue constructor.
|
||||||
*
|
*
|
||||||
* @param[in] bp pointer to a memory area allocated as queue buffer
|
* @param[in] bp pointer to a memory area allocated as queue buffer
|
||||||
* @param[in] size size of the queue buffer
|
* @param[in] size size of the queue buffer
|
||||||
|
@ -1422,7 +1429,7 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @init
|
* @init
|
||||||
*/
|
*/
|
||||||
InputQueue(uint8_t *bp, size_t size, qnotify_t infy, void *link);
|
InQueue(uint8_t *bp, size_t size, qnotify_t infy, void *link);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the filled space into an input queue.
|
* @brief Returns the filled space into an input queue.
|
||||||
|
@ -1551,7 +1558,7 @@ namespace chibios_rt {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::InputQueueBuffer *
|
* chibios_rt::InQueueBuffer *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* @brief Template class encapsulating an input queue and its buffer.
|
* @brief Template class encapsulating an input queue and its buffer.
|
||||||
|
@ -1559,28 +1566,28 @@ namespace chibios_rt {
|
||||||
* @param N size of the input queue
|
* @param N size of the input queue
|
||||||
*/
|
*/
|
||||||
template <int N>
|
template <int N>
|
||||||
class InputQueueBuffer : public InputQueue {
|
class InQueueBuffer : public InQueue {
|
||||||
private:
|
private:
|
||||||
uint8_t iq_buf[N];
|
uint8_t iq_buf[N];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief InputQueueBuffer constructor.
|
* @brief InQueueBuffer constructor.
|
||||||
*
|
*
|
||||||
* @init
|
* @init
|
||||||
*/
|
*/
|
||||||
InputQueueBuffer(qnotify_t infy, void *link) : InputQueue(iq_buf, N,
|
InQueueBuffer(qnotify_t infy, void *link) : InQueue(iq_buf, N,
|
||||||
infy, link) {
|
infy, link) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::OutputQueue *
|
* chibios_rt::OutQueue *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* @brief Class encapsulating an output queue.
|
* @brief Class encapsulating an output queue.
|
||||||
*/
|
*/
|
||||||
class OutputQueue {
|
class OutQueue {
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Embedded @p ::OutputQueue structure.
|
* @brief Embedded @p ::OutputQueue structure.
|
||||||
|
@ -1589,7 +1596,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief OutputQueue constructor.
|
* @brief OutQueue constructor.
|
||||||
*
|
*
|
||||||
* @param[in] bp pointer to a memory area allocated as queue buffer
|
* @param[in] bp pointer to a memory area allocated as queue buffer
|
||||||
* @param[in] size size of the queue buffer
|
* @param[in] size size of the queue buffer
|
||||||
|
@ -1599,7 +1606,7 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @init
|
* @init
|
||||||
*/
|
*/
|
||||||
OutputQueue(uint8_t *bp, size_t size, qnotify_t onfy, void *link);
|
OutQueue(uint8_t *bp, size_t size, qnotify_t onfy, void *link);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the filled space into an output queue.
|
* @brief Returns the filled space into an output queue.
|
||||||
|
@ -1730,7 +1737,7 @@ namespace chibios_rt {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* chibios_rt::OutputQueueBuffer *
|
* chibios_rt::OutQueueBuffer *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* @brief Template class encapsulating an output queue and its buffer.
|
* @brief Template class encapsulating an output queue and its buffer.
|
||||||
|
@ -1738,18 +1745,18 @@ namespace chibios_rt {
|
||||||
* @param N size of the output queue
|
* @param N size of the output queue
|
||||||
*/
|
*/
|
||||||
template <int N>
|
template <int N>
|
||||||
class OutputQueueBuffer : public OutputQueue {
|
class OutQueueBuffer : public OutQueue {
|
||||||
private:
|
private:
|
||||||
uint8_t oq_buf[N];
|
uint8_t oq_buf[N];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief OutputQueueBuffer constructor.
|
* @brief OutQueueBuffer constructor.
|
||||||
*
|
*
|
||||||
* @init
|
* @init
|
||||||
*/
|
*/
|
||||||
OutputQueueBuffer(qnotify_t onfy, void *link) : InputQueue(oq_buf, N,
|
OutQueueBuffer(qnotify_t onfy, void *link) : OutQueue(oq_buf, N,
|
||||||
onfy, link) {
|
onfy, link) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif /* CH_USE_QUEUES */
|
#endif /* CH_USE_QUEUES */
|
||||||
|
|
Loading…
Reference in New Issue