CPP wrappers ported to Chibios v3.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7118 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
barthess 2014-08-03 20:23:16 +00:00
parent fb723a1e3d
commit a5ba022311
4 changed files with 215 additions and 136 deletions

View File

@ -45,22 +45,22 @@ namespace chibios_rt {
void System::lockFromIsr(void) {
chSysLockFromIsr();
chSysLockFromISR();
}
void System::unlockFromIsr(void) {
chSysUnlockFromIsr();
chSysUnlockFromISR();
}
systime_t System::getTime(void) {
return chTimeNow();
return chVTGetSystemTimeX();
}
bool System::isTimeWithin(systime_t start, systime_t end) {
return (bool)chTimeIsWithin(start, end);
return chVTIsSystemTimeWithinX(start, end);
}
/*------------------------------------------------------------------------*
@ -97,7 +97,7 @@ namespace chibios_rt {
bool Timer::isArmedI(void) {
return (bool)chVTIsArmedI(&timer_ref);
return chVTIsArmedI(&timer_ref);
}
/*------------------------------------------------------------------------*
@ -106,7 +106,7 @@ namespace chibios_rt {
void ThreadReference::stop(void) {
chDbgPanic("invoked unimplemented method stop()");
chSysHalt("invoked unimplemented method stop()");
}
msg_t ThreadReference::suspend(void) {
@ -115,11 +115,10 @@ namespace chibios_rt {
chSysLock();
chDbgAssert(thread_ref != NULL,
"ThreadReference, #1",
"already referenced");
thread_ref = chThdSelf();
chSchGoSleepS(THD_STATE_SUSPENDED);
thread_ref = chThdGetSelfX();
chSchGoSleepS(CH_STATE_SUSPENDED);
msg = thread_ref->p_u.rdymsg;
chSysUnlock();
@ -129,24 +128,22 @@ namespace chibios_rt {
msg_t ThreadReference::suspendS(void) {
chDbgAssert(thread_ref == NULL,
"ThreadReference, #2",
"already referenced");
thread_ref = chThdSelf();
chSchGoSleepS(THD_STATE_SUSPENDED);
thread_ref = chThdGetSelfX();
chSchGoSleepS(CH_STATE_SUSPENDED);
return thread_ref->p_u.rdymsg;
}
void ThreadReference::resume(msg_t msg) {
chSysLock()
chSysLock();
chDbgAssert(thread_ref != NULL,
"ThreadReference, #3",
"not referenced");
if (thread_ref) {
Thread *tp = thread_ref;
thread_t *tp = thread_ref;
thread_ref = NULL;
chSchWakeupS(tp, msg);
}
@ -157,11 +154,10 @@ namespace chibios_rt {
void ThreadReference::resumeI(msg_t msg) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #4",
"not referenced");
if (thread_ref) {
Thread *tp = thread_ref;
thread_t *tp = thread_ref;
thread_ref = NULL;
tp->p_msg = msg;
chSchReadyI(tp);
@ -171,30 +167,27 @@ namespace chibios_rt {
void ThreadReference::requestTerminate(void) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #5",
"not referenced");
chThdTerminate(thread_ref);
}
#if CH_USE_WAITEXIT
#if CH_CFG_USE_WAITEXIT
msg_t ThreadReference::wait(void) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #6",
"not referenced");
msg_t msg = chThdWait(thread_ref);
thread_ref = NULL;
return msg;
}
#endif /* CH_USE_WAITEXIT */
#endif /* CH_CFG_USE_WAITEXIT */
#if CH_USE_MESSAGES
#if CH_CFG_USE_MESSAGES
msg_t ThreadReference::sendMessage(msg_t msg) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #7",
"not referenced");
return chMsgSend(thread_ref, msg);
@ -203,16 +196,14 @@ namespace chibios_rt {
bool ThreadReference::isPendingMessage(void) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #7",
"not referenced");
return (bool)chMsgIsPendingI(thread_ref);
return chMsgIsPendingI(thread_ref);
}
msg_t ThreadReference::getMessage(void) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #8",
"not referenced");
return chMsgGet(thread_ref);
@ -221,18 +212,16 @@ namespace chibios_rt {
void ThreadReference::releaseMessage(msg_t msg) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #9",
"not referenced");
chMsgRelease(thread_ref, msg);
}
#endif /* CH_USE_MESSAGES */
#endif /* CH_CFG_USE_MESSAGES */
#if CH_USE_EVENTS
#if CH_CFG_USE_EVENTS
void ThreadReference::signalEvents(eventmask_t mask) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #10",
"not referenced");
chEvtSignal(thread_ref, mask);
@ -241,15 +230,14 @@ namespace chibios_rt {
void ThreadReference::signalEventsI(eventmask_t mask) {
chDbgAssert(thread_ref != NULL,
"ThreadReference, #11",
"not referenced");
chEvtSignalI(thread_ref, mask);
}
#endif /* CH_USE_EVENTS */
#endif /* CH_CFG_USE_EVENTS */
#if CH_USE_DYNAMIC
#endif /* CH_USE_DYNAMIC */
#if CH_CFG_USE_DYNAMIC
#endif /* CH_CFG_USE_DYNAMIC */
/*------------------------------------------------------------------------*
* chibios_rt::BaseThread *
@ -297,7 +285,7 @@ namespace chibios_rt {
bool BaseThread::shouldTerminate(void) {
return (bool)chThdShouldTerminate();
return chThdShouldTerminateX();
}
void BaseThread::sleep(systime_t interval){
@ -315,15 +303,15 @@ namespace chibios_rt {
chThdYield();
}
#if CH_USE_MESSAGES
#if CH_CFG_USE_MESSAGES
ThreadReference BaseThread::waitMessage(void) {
ThreadReference tr(chMsgWait());
return tr;
}
#endif /* CH_USE_MESSAGES */
#endif /* CH_CFG_USE_MESSAGES */
#if CH_USE_EVENTS
#if CH_CFG_USE_EVENTS
eventmask_t BaseThread::getAndClearEvents(eventmask_t mask) {
return chEvtGetAndClearEvents(mask);
@ -349,7 +337,7 @@ namespace chibios_rt {
return chEvtWaitAll(ewmask);
}
#if CH_USE_EVENTS_TIMEOUT
#if CH_CFG_USE_EVENTS_TIMEOUT
eventmask_t BaseThread::waitOneEventTimeout(eventmask_t ewmask,
systime_t time) {
@ -367,39 +355,39 @@ namespace chibios_rt {
return chEvtWaitAllTimeout(ewmask, time);
}
#endif /* CH_USE_EVENTS_TIMEOUT */
#endif /* CH_CFG_USE_EVENTS_TIMEOUT */
void BaseThread::dispatchEvents(const evhandler_t handlers[],
eventmask_t mask) {
chEvtDispatch(handlers, mask);
}
#endif /* CH_USE_EVENTS */
#endif /* CH_CFG_USE_EVENTS */
#if CH_USE_MUTEXES
void BaseThread::unlockMutex(void) {
#if CH_CFG_USE_MUTEXES
void BaseThread::unlockMutex(Mutex *mp) {
chMtxUnlock();
chMtxUnlock(&mp->mutex);
}
void BaseThread::unlockMutexS(void) {
void BaseThread::unlockMutexS(Mutex *mp) {
chMtxUnlockS();
chMtxUnlockS(&mp->mutex);
}
void BaseThread::unlockAllMutexes(void) {
chMtxUnlockAll();
}
#endif /* CH_USE_MUTEXES */
#endif /* CH_CFG_USE_MUTEXES */
#if CH_USE_SEMAPHORES
#if CH_CFG_USE_SEMAPHORES
/*------------------------------------------------------------------------*
* chibios_rt::CounterSemaphore *
*------------------------------------------------------------------------*/
CounterSemaphore::CounterSemaphore(cnt_t n) {
chSemInit(&sem, n);
chSemObjectInit(&sem, n);
}
void CounterSemaphore::reset(cnt_t n) {
@ -452,20 +440,18 @@ namespace chibios_rt {
return chSemGetCounterI(&sem);
}
#if CH_USE_SEMSW
msg_t CounterSemaphore::signalWait(CounterSemaphore *ssem,
CounterSemaphore *wsem) {
return chSemSignalWait(&ssem->sem, &wsem->sem);
}
#endif /* CH_USE_SEMSW */
/*------------------------------------------------------------------------*
* chibios_rt::BinarySemaphore *
*------------------------------------------------------------------------*/
BinarySemaphore::BinarySemaphore(bool taken) {
chBSemInit(&bsem, (bool_t)taken);
chBSemObjectInit(&bsem, taken);
}
msg_t BinarySemaphore::wait(void) {
@ -490,12 +476,12 @@ namespace chibios_rt {
void BinarySemaphore::reset(bool taken) {
chBSemReset(&bsem, (bool_t)taken);
chBSemReset(&bsem, taken);
}
void BinarySemaphore::resetI(bool taken) {
chBSemResetI(&bsem, (bool_t)taken);
chBSemResetI(&bsem, taken);
}
void BinarySemaphore::signal(void) {
@ -512,15 +498,15 @@ namespace chibios_rt {
return (bool)chBSemGetStateI(&bsem);
}
#endif /* CH_USE_SEMAPHORES */
#endif /* CH_CFG_USE_SEMAPHORES */
#if CH_USE_MUTEXES
#if CH_CFG_USE_MUTEXES
/*------------------------------------------------------------------------*
* chibios_rt::Mutex *
*------------------------------------------------------------------------*/
Mutex::Mutex(void) {
chMtxInit(&mutex);
chMtxObjectInit(&mutex);
}
bool Mutex::tryLock(void) {
@ -543,13 +529,13 @@ namespace chibios_rt {
chMtxLockS(&mutex);
}
#if CH_USE_CONDVARS
#if CH_CFG_USE_CONDVARS
/*------------------------------------------------------------------------*
* chibios_rt::CondVar *
*------------------------------------------------------------------------*/
CondVar::CondVar(void) {
chCondInit(&condvar);
chCondObjectInit(&condvar);
}
void CondVar::signal(void) {
@ -582,25 +568,25 @@ namespace chibios_rt {
return chCondWaitS(&condvar);
}
#if CH_USE_CONDVARS_TIMEOUT
#if CH_CFG_USE_CONDVARS_TIMEOUT
msg_t CondVar::waitTimeout(systime_t time) {
return chCondWaitTimeout(&condvar, time);
}
#endif /* CH_USE_CONDVARS_TIMEOUT */
#endif /* CH_USE_CONDVARS */
#endif /* CH_USE_MUTEXES */
#endif /* CH_CFG_USE_CONDVARS_TIMEOUT */
#endif /* CH_CFG_USE_CONDVARS */
#endif /* CH_CFG_USE_MUTEXES */
#if CH_USE_EVENTS
#if CH_CFG_USE_EVENTS
/*------------------------------------------------------------------------*
* chibios_rt::EvtListener *
*------------------------------------------------------------------------*/
flagsmask_t EvtListener::getAndClearFlags(void) {
eventflags_t EvtListener::getAndClearFlags(void) {
return chEvtGetAndClearFlags(&ev_listener);
}
flagsmask_t EvtListener::getAndClearFlagsI(void) {
eventflags_t EvtListener::getAndClearFlagsI(void) {
return chEvtGetAndClearFlagsI(&ev_listener);
}
@ -610,7 +596,7 @@ namespace chibios_rt {
*------------------------------------------------------------------------*/
EvtSource::EvtSource(void) {
chEvtInit(&ev_source);
chEvtObjectInit(&ev_source);
}
void EvtSource::registerOne(chibios_rt::EvtListener *elp,
@ -630,24 +616,24 @@ namespace chibios_rt {
chEvtUnregister(&ev_source, &elp->ev_listener);
}
void EvtSource::broadcastFlags(flagsmask_t flags) {
void EvtSource::broadcastFlags(eventflags_t flags) {
chEvtBroadcastFlags(&ev_source, flags);
}
void EvtSource::broadcastFlagsI(flagsmask_t flags) {
void EvtSource::broadcastFlagsI(eventflags_t flags) {
chEvtBroadcastFlagsI(&ev_source, flags);
}
#endif /* CH_USE_EVENTS */
#endif /* CH_CFG_USE_EVENTS */
#if CH_USE_QUEUES
#if CH_CFG_USE_QUEUES
/*------------------------------------------------------------------------*
* chibios_rt::InQueue *
*------------------------------------------------------------------------*/
InQueue::InQueue(uint8_t *bp, size_t size, qnotify_t infy, void *link) {
chIQInit(&iq, bp, size, infy, link);
chIQObjectInit(&iq, bp, size, infy, link);
}
size_t InQueue::getFullI(void) {
@ -700,7 +686,7 @@ namespace chibios_rt {
*------------------------------------------------------------------------*/
OutQueue::OutQueue(uint8_t *bp, size_t size, qnotify_t onfy, void *link) {
chOQInit(&oq, bp, size, onfy, link);
chOQObjectInit(&oq, bp, size, onfy, link);
}
size_t OutQueue::getFullI(void) {
@ -748,15 +734,15 @@ namespace chibios_rt {
return chOQWriteTimeout(&oq, bp, n, time);
}
#endif /* CH_USE_QUEUES */
#endif /* CH_CFG_USE_QUEUES */
#if CH_USE_MAILBOXES
#if CH_CFG_USE_MAILBOXES
/*------------------------------------------------------------------------*
* chibios_rt::Mailbox *
*------------------------------------------------------------------------*/
Mailbox::Mailbox(msg_t *buf, cnt_t n) {
chMBInit(&mb, buf, n);
chMBObjectInit(&mb, buf, n);
}
void Mailbox::reset(void) {
@ -818,20 +804,20 @@ namespace chibios_rt {
return chMBGetUsedCountI(&mb);
}
#endif /* CH_USE_MAILBOXES */
#endif /* CH_CFG_USE_MAILBOXES */
#if CH_USE_MEMPOOLS
#if CH_CFG_USE_MEMPOOLS
/*------------------------------------------------------------------------*
* chibios_rt::MemoryPool *
*------------------------------------------------------------------------*/
MemoryPool::MemoryPool(size_t size, memgetfunc_t provider) {
chPoolInit(&pool, size, provider);
chPoolObjectInit(&pool, size, provider);
}
MemoryPool::MemoryPool(size_t size, memgetfunc_t provider, void* p, size_t n) {
chPoolInit(&pool, size, provider);
chPoolObjectInit(&pool, size, provider);
chPoolLoadArray(&pool, p, n);
}
@ -860,7 +846,7 @@ namespace chibios_rt {
chPoolFreeI(&pool, objp);
}
#endif /* CH_USE_MEMPOOLS */
#endif /* CH_CFG_USE_MEMPOOLS */
}
/** @} */

View File

@ -28,10 +28,13 @@
#define _CH_HPP_
/**
* @brief ChibiOS kernel-related classes and interfaces.
* @brief ChibiOS-RT kernel-related classes and interfaces.
*/
namespace chibios_rt {
/* Forward declarations */
class Mutex;
/*------------------------------------------------------------------------*
* chibios_rt::System *
*------------------------------------------------------------------------*/
@ -182,7 +185,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p VirtualTimer structure.
*/
::VirtualTimer timer_ref;
::virtual_timer_t timer_ref;
/**
* @brief Enables a virtual timer.
@ -236,7 +239,7 @@ namespace chibios_rt {
/**
* @brief Pointer to the system thread.
*/
::Thread *thread_ref;
::thread_t *thread_ref;
/**
* @brief Thread reference constructor.
@ -247,7 +250,7 @@ namespace chibios_rt {
*
* @init
*/
ThreadReference(Thread *tp) : thread_ref(tp) {
ThreadReference(thread_t *tp) : thread_ref(tp) {
};
@ -312,7 +315,7 @@ namespace chibios_rt {
*/
void requestTerminate(void);
#if CH_USE_WAITEXIT || defined(__DOXYGEN__)
#if CH_CFG_USE_WAITEXIT || defined(__DOXYGEN__)
/**
* @brief Blocks the execution of the invoking thread until the specified
* thread terminates then the exit code is returned.
@ -346,9 +349,9 @@ namespace chibios_rt {
* @api
*/
msg_t wait(void);
#endif /* CH_USE_WAITEXIT */
#endif /* CH_CFG_USE_WAITEXIT */
#if CH_USE_MESSAGES || defined(__DOXYGEN__)
#if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__)
/**
* @brief Sends a message to the thread and returns the answer.
*
@ -386,9 +389,9 @@ namespace chibios_rt {
* @api
*/
void releaseMessage(msg_t msg);
#endif /* CH_USE_MESSAGES */
#endif /* CH_CFG_USE_MESSAGES */
#if CH_USE_EVENTS || defined(__DOXYGEN__)
#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/**
* @brief Adds a set of event flags directly to specified @p Thread.
*
@ -406,10 +409,10 @@ namespace chibios_rt {
* @iclass
*/
void signalEventsI(eventmask_t mask);
#endif /* CH_USE_EVENTS */
#endif /* CH_CFG_USE_EVENTS */
#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
#endif /* CH_USE_DYNAMIC */
#if CH_CFG_USE_DYNAMIC || defined(__DOXYGEN__)
#endif /* CH_CFG_USE_DYNAMIC */
};
/*------------------------------------------------------------------------*
@ -550,7 +553,7 @@ namespace chibios_rt {
*/
static void yield(void);
#if CH_USE_MESSAGES || defined(__DOXYGEN__)
#if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__)
/**
* @brief Waits for a message.
*
@ -559,9 +562,9 @@ namespace chibios_rt {
* @api
*/
static ThreadReference waitMessage(void);
#endif /* CH_USE_MESSAGES */
#endif /* CH_CFG_USE_MESSAGES */
#if CH_USE_EVENTS || defined(__DOXYGEN__)
#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/**
* @brief Clears the pending events specified in the mask.
*
@ -630,7 +633,7 @@ namespace chibios_rt {
*/
static eventmask_t waitAllEvents(eventmask_t ewmask);
#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
#if CH_CFG_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
/**
* @brief Waits for a single event.
* @details A pending event among those specified in @p ewmask is selected,
@ -689,7 +692,7 @@ namespace chibios_rt {
*/
static eventmask_t waitAllEventsTimeout(eventmask_t ewmask,
systime_t time);
#endif /* CH_USE_EVENTS_TIMEOUT */
#endif /* CH_CFG_USE_EVENTS_TIMEOUT */
/**
* @brief Invokes the event handlers associated to an event flags mask.
@ -702,9 +705,9 @@ namespace chibios_rt {
*/
static void dispatchEvents(const evhandler_t handlers[],
eventmask_t mask);
#endif /* CH_USE_EVENTS */
#endif /* CH_CFG_USE_EVENTS */
#if CH_USE_MUTEXES || defined(__DOXYGEN__)
#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/**
* @brief Unlocks the next owned mutex in reverse lock order.
* @pre The invoking thread <b>must</b> have at least one owned mutex.
@ -715,7 +718,7 @@ namespace chibios_rt {
*
* @api
*/
static void unlockMutex(void);
static void unlockMutex(Mutex *mp);
/**
* @brief Unlocks the next owned mutex in reverse lock order.
@ -729,7 +732,7 @@ namespace chibios_rt {
*
* @sclass
*/
static void unlockMutexS(void);
static void unlockMutexS(Mutex *mp);
/**
* @brief Unlocks all the mutexes owned by the invoking thread.
@ -743,7 +746,7 @@ namespace chibios_rt {
* @api
*/
static void unlockAllMutexes(void);
#endif /* CH_USE_MUTEXES */
#endif /* CH_CFG_USE_MUTEXES */
};
/*------------------------------------------------------------------------*
@ -758,7 +761,7 @@ namespace chibios_rt {
template <int N>
class BaseStaticThread : public BaseThread {
protected:
WORKING_AREA(wa, N);
THD_WORKING_AREA(wa, N);
public:
/**
@ -789,7 +792,7 @@ namespace chibios_rt {
}
};
#if CH_USE_SEMAPHORES || defined(__DOXYGEN__)
#if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::CounterSemaphore *
*------------------------------------------------------------------------*/
@ -801,7 +804,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::Semaphore structure.
*/
::Semaphore sem;
::semaphore_t sem;
/**
* @brief CounterSemaphore constructor.
@ -963,7 +966,6 @@ namespace chibios_rt {
*/
cnt_t getCounterI(void);
#if CH_USE_SEMSW || defined(__DOXYGEN__)
/**
* @brief Atomic signal and wait operations.
*
@ -980,7 +982,6 @@ namespace chibios_rt {
*/
static msg_t signalWait(CounterSemaphore *ssem,
CounterSemaphore *wsem);
#endif /* CH_USE_SEMSW */
};
/*------------------------------------------------------------------------*
* chibios_rt::BinarySemaphore *
@ -993,7 +994,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::Semaphore structure.
*/
::BinarySemaphore bsem;
::binary_semaphore_t bsem;
/**
* @brief BinarySemaphore constructor.
@ -1135,9 +1136,9 @@ namespace chibios_rt {
*/
bool getStateI(void);
};
#endif /* CH_USE_SEMAPHORES */
#endif /* CH_CFG_USE_SEMAPHORES */
#if CH_USE_MUTEXES || defined(__DOXYGEN__)
#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::Mutex *
*------------------------------------------------------------------------*/
@ -1149,7 +1150,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::Mutex structure.
*/
::Mutex mutex;
::mutex_t mutex;
/**
* @brief Mutex object constructor.
@ -1216,7 +1217,7 @@ namespace chibios_rt {
void lockS(void);
};
#if CH_USE_CONDVARS || defined(__DOXYGEN__)
#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::CondVar *
*------------------------------------------------------------------------*/
@ -1228,7 +1229,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::CondVar structure.
*/
::CondVar condvar;
::condition_variable_t condvar;
/**
* @brief CondVar object constructor.
@ -1310,7 +1311,7 @@ namespace chibios_rt {
*/
msg_t waitS(void);
#if CH_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
#if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
/**
* @brief Waits on the CondVar while releasing the controlling mutex.
*
@ -1326,12 +1327,12 @@ namespace chibios_rt {
* @api
*/
msg_t waitTimeout(systime_t time);
#endif /* CH_USE_CONDVARS_TIMEOUT */
#endif /* CH_CFG_USE_CONDVARS_TIMEOUT */
};
#endif /* CH_USE_CONDVARS */
#endif /* CH_USE_MUTEXES */
#endif /* CH_CFG_USE_CONDVARS */
#endif /* CH_CFG_USE_MUTEXES */
#if CH_USE_EVENTS || defined(__DOXYGEN__)
#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::EvtListener *
*------------------------------------------------------------------------*/
@ -1343,7 +1344,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::EventListener structure.
*/
struct ::EventListener ev_listener;
::event_listener_t ev_listener;
/**
* @brief Returns the pending flags from the listener and clears them.
@ -1353,7 +1354,7 @@ namespace chibios_rt {
*
* @api
*/
flagsmask_t getAndClearFlags(void);
eventflags_t getAndClearFlags(void);
/**
* @brief Returns the flags associated to an @p EventListener.
@ -1365,7 +1366,7 @@ namespace chibios_rt {
*
* @iclass
*/
flagsmask_t getAndClearFlagsI(void);
eventflags_t getAndClearFlagsI(void);
};
/*------------------------------------------------------------------------*
@ -1379,7 +1380,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::EventSource structure.
*/
struct ::EventSource ev_source;
::event_source_t ev_source;
/**
* @brief EvtSource object constructor.
@ -1433,7 +1434,7 @@ namespace chibios_rt {
*
* @api
*/
void broadcastFlags(flagsmask_t flags);
void broadcastFlags(eventflags_t flags);
/**
* @brief Broadcasts on an event source.
@ -1445,11 +1446,11 @@ namespace chibios_rt {
*
* @iclass
*/
void broadcastFlagsI(flagsmask_t flags);
void broadcastFlagsI(eventflags_t flags);
};
#endif /* CH_USE_EVENTS */
#endif /* CH_CFG_USE_EVENTS */
#if CH_USE_QUEUES || defined(__DOXYGEN__)
#if CH_CFG_USE_QUEUES || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::InQueue *
*------------------------------------------------------------------------*/
@ -1461,7 +1462,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::InputQueue structure.
*/
::InputQueue iq;
::input_queue_t iq;
public:
/**
@ -1642,7 +1643,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::OutputQueue structure.
*/
::OutputQueue oq;
::output_queue_t oq;
public:
/**
@ -1813,9 +1814,9 @@ namespace chibios_rt {
onfy, link) {
}
};
#endif /* CH_USE_QUEUES */
#endif /* CH_CFG_USE_QUEUES */
#if CH_USE_MAILBOXES || defined(__DOXYGEN__)
#if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::Mailbox *
*------------------------------------------------------------------------*/
@ -1827,7 +1828,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::Mailbox structure.
*/
::Mailbox mb;
::mailbox_t mb;
/**
* @brief Mailbox constructor.
@ -2066,9 +2067,9 @@ namespace chibios_rt {
(cnt_t)(sizeof mb_buf / sizeof (msg_t))) {
}
};
#endif /* CH_USE_MAILBOXES */
#endif /* CH_CFG_USE_MAILBOXES */
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
#if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::MemoryPool *
*------------------------------------------------------------------------*/
@ -2080,7 +2081,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::MemoryPool structure.
*/
::MemoryPool pool;
::memory_pool_t pool;
/**
* @brief MemoryPool constructor.
@ -2207,7 +2208,7 @@ namespace chibios_rt {
loadArray(pool_buf, N);
}
};
#endif /* CH_USE_MEMPOOLS */
#endif /* CH_CFG_USE_MEMPOOLS */
/*------------------------------------------------------------------------*
* chibios_rt::BaseSequentialStreamInterface *

View File

@ -0,0 +1,78 @@
#include <stdio.h>
#include <errno.h>
#include "osal.h"
#include "syscalls_cpp.hpp"
/**
*
*/
#ifdef __cplusplus
extern "C" {
#endif
void _exit(int status){
(void) status;
osalSysHalt("Unrealized");
while(TRUE){}
}
#ifdef __cplusplus
}
#endif
/**
*
*/
#ifdef __cplusplus
extern "C" {
#endif
pid_t _getpid(void){
return 1;
}
#ifdef __cplusplus
}
#endif
/**
*
*/
#undef errno
extern int errno;
#ifdef __cplusplus
extern "C" {
#endif
int _kill(int pid, int sig) {
(void)pid;
(void)sig;
errno = EINVAL;
return -1;
}
#ifdef __cplusplus
}
#endif
/**
*
*/
#ifdef __cplusplus
extern "C" {
#endif
void _open_r(void){
return;
}
#ifdef __cplusplus
}
#endif
/**
*
*/
#ifdef __cplusplus
extern "C" {
#endif
void __cxa_pure_virtual() {
osalSysHalt("Pure virtual function call.");
}
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,14 @@
#ifndef SYSCALLS_CPP_HPP_
#define SYSCALLS_CPP_HPP_
/* The ABI requires a 64-bit type. */
__extension__ typedef int __guard __attribute__((mode (__DI__)));
int __cxa_guard_acquire(__guard *);
void __cxa_guard_release (__guard *);
void __cxa_guard_abort (__guard *);
void *__dso_handle = NULL;
#endif /* SYSCALLS_CPP_HPP_ */