git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5009 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
1be8fe145c
commit
12286fd5e4
|
@ -397,15 +397,14 @@ namespace chibios_rt {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates and starts a system thread.
|
* @brief Creates and starts a system thread.
|
||||||
*
|
*
|
||||||
* @param[in] tname the name to be assigned to the thread
|
* @param[in] tname the name to be assigned to the thread
|
||||||
* @param[in] prio thread priority
|
* @param[in] prio thread priority
|
||||||
* @return Error flag.
|
* @return Error flag.
|
||||||
* @retval false if the operation failed.
|
* @retval false if the operation succeeded.
|
||||||
* @retval true if the operation succeeded.
|
* @retval true if the operation failed.
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
@ -413,7 +412,7 @@ namespace chibios_rt {
|
||||||
msg_t _thd_start(void *arg);
|
msg_t _thd_start(void *arg);
|
||||||
|
|
||||||
thread_ref = chThdCreateStatic(wa, sizeof(wa), prio, _thd_start, this);
|
thread_ref = chThdCreateStatic(wa, sizeof(wa), prio, _thd_start, this);
|
||||||
return thread_ref != NULL;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -434,6 +433,8 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @param[in] n the semaphore counter value, must be greater
|
* @param[in] n the semaphore counter value, must be greater
|
||||||
* or equal to zero
|
* or equal to zero
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
Semaphore(cnt_t n);
|
Semaphore(cnt_t n);
|
||||||
|
|
||||||
|
@ -442,6 +443,8 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @param[in] n the new semaphore counter value, must be
|
* @param[in] n the new semaphore counter value, must be
|
||||||
* greater or equal to zero
|
* greater or equal to zero
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void reset(cnt_t n);
|
void reset(cnt_t n);
|
||||||
|
|
||||||
|
@ -450,6 +453,8 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @retval RDY_OK if the semaphore was signaled or not taken.
|
* @retval RDY_OK if the semaphore was signaled or not taken.
|
||||||
* @retval RDY_RESET if the semaphore was reset.
|
* @retval RDY_RESET if the semaphore was reset.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
msg_t wait(void);
|
msg_t wait(void);
|
||||||
|
|
||||||
|
@ -461,6 +466,8 @@ namespace chibios_rt {
|
||||||
* @retval RDY_RESET if the semaphore was reset.
|
* @retval RDY_RESET if the semaphore was reset.
|
||||||
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset
|
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset
|
||||||
* within the specified timeout.
|
* within the specified timeout.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
msg_t waitTimeout(systime_t time);
|
msg_t waitTimeout(systime_t time);
|
||||||
|
|
||||||
|
@ -468,6 +475,8 @@ namespace chibios_rt {
|
||||||
* @brief Signal operation on the semaphore.
|
* @brief Signal operation on the semaphore.
|
||||||
* @details The semaphore is signaled, the next thread in queue, if any,
|
* @details The semaphore is signaled, the next thread in queue, if any,
|
||||||
* is awakened.
|
* is awakened.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void signal(void);
|
void signal(void);
|
||||||
|
|
||||||
|
@ -479,6 +488,8 @@ namespace chibios_rt {
|
||||||
* @param[in] wsem pointer to a @p Semaphore to be wait on
|
* @param[in] wsem pointer to a @p Semaphore to be wait on
|
||||||
* @retval RDY_OK if the semaphore was signaled or not taken.
|
* @retval RDY_OK if the semaphore was signaled or not taken.
|
||||||
* @retval RDY_RESET if the semaphore was reset.
|
* @retval RDY_RESET if the semaphore was reset.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static msg_t signalWait(Semaphore *ssem, Semaphore *wsem);
|
static msg_t signalWait(Semaphore *ssem, Semaphore *wsem);
|
||||||
#endif /* CH_USE_SEMSW */
|
#endif /* CH_USE_SEMSW */
|
||||||
|
@ -499,6 +510,8 @@ namespace chibios_rt {
|
||||||
/**
|
/**
|
||||||
* @brief Mutex constructor.
|
* @brief Mutex constructor.
|
||||||
* @details The embedded @p ::Mutex structure is initialized.
|
* @details The embedded @p ::Mutex structure is initialized.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
Mutex(void);
|
Mutex(void);
|
||||||
|
|
||||||
|
@ -507,6 +520,8 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @retval TRUE if the mutex was successfully acquired
|
* @retval TRUE if the mutex was successfully acquired
|
||||||
* @retval FALSE if the lock attempt failed.
|
* @retval FALSE if the lock attempt failed.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
bool tryLock(void);
|
bool tryLock(void);
|
||||||
|
|
||||||
|
@ -515,6 +530,8 @@ namespace chibios_rt {
|
||||||
* @details Performs a lock operation on the mutex, if the mutex is
|
* @details Performs a lock operation on the mutex, if the mutex is
|
||||||
* already locked then the thread enters the mutex priority
|
* already locked then the thread enters the mutex priority
|
||||||
* queue and waits.
|
* queue and waits.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void lock(void);
|
void lock(void);
|
||||||
|
|
||||||
|
@ -522,6 +539,8 @@ namespace chibios_rt {
|
||||||
* @brief Unlocks the mutex.
|
* @brief Unlocks the mutex.
|
||||||
* @details Performs an unlock operation on the mutex, the next waiting
|
* @details Performs an unlock operation on the mutex, the next waiting
|
||||||
* thread, if any, is resumed and locks the mutex.
|
* thread, if any, is resumed and locks the mutex.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static void unlock(void);
|
static void unlock(void);
|
||||||
|
|
||||||
|
@ -531,6 +550,8 @@ namespace chibios_rt {
|
||||||
* the mutexes one by one and not just because the call overhead,
|
* the mutexes one by one and not just because the call overhead,
|
||||||
* this function does not have any overhead related to the
|
* this function does not have any overhead related to the
|
||||||
* priority inheritance mechanism.
|
* priority inheritance mechanism.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static void unlockAll(void);
|
static void unlockAll(void);
|
||||||
};
|
};
|
||||||
|
@ -549,18 +570,24 @@ namespace chibios_rt {
|
||||||
/**
|
/**
|
||||||
* @brief CondVar constructor.
|
* @brief CondVar constructor.
|
||||||
* @details The embedded @p ::CondVar structure is initialized.
|
* @details The embedded @p ::CondVar structure is initialized.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
CondVar(void);
|
CondVar(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Signals the CondVar.
|
* @brief Signals the CondVar.
|
||||||
* @details The next thread waiting on the @p CondVar, if any, is awakened.
|
* @details The next thread waiting on the @p CondVar, if any, is awakened.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void signal(void);
|
void signal(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Broadcasts the CondVar.
|
* @brief Broadcasts the CondVar.
|
||||||
* @details All the threads waiting on the @p CondVar, if any, are awakened.
|
* @details All the threads waiting on the @p CondVar, if any, are awakened.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void broadcast(void);
|
void broadcast(void);
|
||||||
|
|
||||||
|
@ -572,6 +599,8 @@ namespace chibios_rt {
|
||||||
* @p chCondSignal().
|
* @p chCondSignal().
|
||||||
* @retval RDY_RESET if the condvar was signaled using
|
* @retval RDY_RESET if the condvar was signaled using
|
||||||
* @p chCondBroadcast().
|
* @p chCondBroadcast().
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
msg_t wait(void);
|
msg_t wait(void);
|
||||||
|
|
||||||
|
@ -587,6 +616,8 @@ namespace chibios_rt {
|
||||||
* @p chCondBroadcast().
|
* @p chCondBroadcast().
|
||||||
* @retval RDY_TIMEOUT if the condvar was not signaled within the
|
* @retval RDY_TIMEOUT if the condvar was not signaled within the
|
||||||
* specified timeout.
|
* specified timeout.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
msg_t waitTimeout(systime_t time);
|
msg_t waitTimeout(systime_t time);
|
||||||
#endif /* CH_USE_CONDVARS_TIMEOUT */
|
#endif /* CH_USE_CONDVARS_TIMEOUT */
|
||||||
|
@ -608,6 +639,8 @@ namespace chibios_rt {
|
||||||
/**
|
/**
|
||||||
* @brief Event constructor.
|
* @brief Event constructor.
|
||||||
* @details The embedded @p ::EventSource structure is initialized.
|
* @details The embedded @p ::EventSource structure is initialized.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
Event(void);
|
Event(void);
|
||||||
|
|
||||||
|
@ -617,6 +650,8 @@ namespace chibios_rt {
|
||||||
* @param[in] elp pointer to the @p EventListener structure
|
* @param[in] elp pointer to the @p EventListener structure
|
||||||
* @param[in] eid numeric identifier assigned to the Event
|
* @param[in] eid numeric identifier assigned to the Event
|
||||||
* Listener
|
* Listener
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void registerOne(EventListener *elp, eventid_t eid);
|
void registerOne(EventListener *elp, eventid_t eid);
|
||||||
|
|
||||||
|
@ -627,6 +662,8 @@ namespace chibios_rt {
|
||||||
* @param[in] elp pointer to the @p EventListener structure
|
* @param[in] elp pointer to the @p EventListener structure
|
||||||
* @param[in] emask the mask of event flags to be pended to the
|
* @param[in] emask the mask of event flags to be pended to the
|
||||||
* thread when the event source is broadcasted
|
* thread when the event source is broadcasted
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void registerMask(EventListener *elp, eventmask_t emask);
|
void registerMask(EventListener *elp, eventmask_t emask);
|
||||||
|
|
||||||
|
@ -636,6 +673,8 @@ namespace chibios_rt {
|
||||||
* source.
|
* source.
|
||||||
*
|
*
|
||||||
* @param[in] elp the listener to be unregistered
|
* @param[in] elp the listener to be unregistered
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void unregister(EventListener *elp);
|
void unregister(EventListener *elp);
|
||||||
|
|
||||||
|
@ -645,6 +684,8 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @param[in] flags the flags set to be added to the listener
|
* @param[in] flags the flags set to be added to the listener
|
||||||
* flags mask
|
* flags mask
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
void broadcastFlags(flagsmask_t flags);
|
void broadcastFlags(flagsmask_t flags);
|
||||||
|
|
||||||
|
@ -655,6 +696,8 @@ namespace chibios_rt {
|
||||||
* @param[in] flags the events to be cleared
|
* @param[in] flags the events to be cleared
|
||||||
* @return The flags added to the listener by the
|
* @return The flags added to the listener by the
|
||||||
* associated event source.
|
* associated event source.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static flagsmask_t getAndClearFlags(EventListener *elp);
|
static flagsmask_t getAndClearFlags(EventListener *elp);
|
||||||
|
|
||||||
|
@ -663,6 +706,8 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @param[in] mask the events to be cleared
|
* @param[in] mask the events to be cleared
|
||||||
* @return The pending events that were cleared.
|
* @return The pending events that were cleared.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static eventmask_t getAndClearEvents(eventmask_t mask);
|
static eventmask_t getAndClearEvents(eventmask_t mask);
|
||||||
|
|
||||||
|
@ -672,6 +717,8 @@ namespace chibios_rt {
|
||||||
*
|
*
|
||||||
* @param[in] mask the events to be pended
|
* @param[in] mask the events to be pended
|
||||||
* @return The current pending events mask.
|
* @return The current pending events mask.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static eventmask_t addEvents(eventmask_t mask);
|
static eventmask_t addEvents(eventmask_t mask);
|
||||||
|
|
||||||
|
@ -682,6 +729,8 @@ namespace chibios_rt {
|
||||||
* @param[in] handlers an array of @p evhandler_t. The array must be
|
* @param[in] handlers an array of @p evhandler_t. The array must be
|
||||||
* have indexes from zero up the higher registered
|
* have indexes from zero up the higher registered
|
||||||
* event identifier.
|
* event identifier.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static void dispatch(const evhandler_t handlers[], eventmask_t mask);
|
static void dispatch(const evhandler_t handlers[], eventmask_t mask);
|
||||||
|
|
||||||
|
@ -699,6 +748,8 @@ namespace chibios_rt {
|
||||||
* wait for, @p ALL_EVENTS enables all the events
|
* wait for, @p ALL_EVENTS enables all the events
|
||||||
* @return The mask of the lowest id served and cleared
|
* @return The mask of the lowest id served and cleared
|
||||||
* event.
|
* event.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static eventmask_t waitOne(eventmask_t ewmask);
|
static eventmask_t waitOne(eventmask_t ewmask);
|
||||||
|
|
||||||
|
@ -711,6 +762,8 @@ namespace chibios_rt {
|
||||||
* @param[in] ewmask mask of the events that the function should
|
* @param[in] ewmask mask of the events that the function should
|
||||||
* wait for, @p ALL_EVENTS enables all the events
|
* wait for, @p ALL_EVENTS enables all the events
|
||||||
* @return The mask of the served and cleared events.
|
* @return The mask of the served and cleared events.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static eventmask_t waitAny(eventmask_t ewmask);
|
static eventmask_t waitAny(eventmask_t ewmask);
|
||||||
|
|
||||||
|
@ -722,6 +775,8 @@ namespace chibios_rt {
|
||||||
* @param[in] ewmask mask of the event ids that the function should
|
* @param[in] ewmask mask of the event ids that the function should
|
||||||
* wait for
|
* wait for
|
||||||
* @return The mask of the served and cleared events.
|
* @return The mask of the served and cleared events.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static eventmask_t waitAll(eventmask_t ewmask);
|
static eventmask_t waitAll(eventmask_t ewmask);
|
||||||
|
|
||||||
|
@ -743,6 +798,8 @@ namespace chibios_rt {
|
||||||
* @return The mask of the lowest id served and cleared
|
* @return The mask of the lowest id served and cleared
|
||||||
* event.
|
* event.
|
||||||
* @retval 0 if the specified timeout expired.
|
* @retval 0 if the specified timeout expired.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static eventmask_t waitOneTimeout(eventmask_t ewmask, systime_t time);
|
static eventmask_t waitOneTimeout(eventmask_t ewmask, systime_t time);
|
||||||
|
|
||||||
|
@ -758,6 +815,8 @@ namespace chibios_rt {
|
||||||
* timouts
|
* timouts
|
||||||
* @return The mask of the served and cleared events.
|
* @return The mask of the served and cleared events.
|
||||||
* @retval 0 if the specified timeout expired.
|
* @retval 0 if the specified timeout expired.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static eventmask_t waitAnyTimeout(eventmask_t ewmask, systime_t time);
|
static eventmask_t waitAnyTimeout(eventmask_t ewmask, systime_t time);
|
||||||
|
|
||||||
|
@ -772,9 +831,10 @@ namespace chibios_rt {
|
||||||
* timouts
|
* timouts
|
||||||
* @return The mask of the served and cleared events.
|
* @return The mask of the served and cleared events.
|
||||||
* @retval 0 if the specified timeout expired.
|
* @retval 0 if the specified timeout expired.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
static eventmask_t waitAllTimeout(eventmask_t ewmask, systime_t time);
|
static eventmask_t waitAllTimeout(eventmask_t ewmask, systime_t time);
|
||||||
|
|
||||||
#endif /* CH_USE_EVENTS_TIMEOUT */
|
#endif /* CH_USE_EVENTS_TIMEOUT */
|
||||||
};
|
};
|
||||||
#endif /* CH_USE_EVENTS */
|
#endif /* CH_USE_EVENTS */
|
||||||
|
|
Loading…
Reference in New Issue