git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@619 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
36c9110259
commit
382151cf63
30
src/chcond.c
30
src/chcond.c
|
@ -31,8 +31,8 @@
|
||||||
#if defined(CH_USE_CONDVARS) && defined(CH_USE_MUTEXES)
|
#if defined(CH_USE_CONDVARS) && defined(CH_USE_MUTEXES)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes s \p CondVar structure.
|
* Initializes s @p CondVar structure.
|
||||||
* @param cp pointer to a \p CondVar structure
|
* @param cp pointer to a @p CondVar structure
|
||||||
*/
|
*/
|
||||||
void chCondInit(CondVar *cp) {
|
void chCondInit(CondVar *cp) {
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void chCondInit(CondVar *cp) {
|
||||||
/**
|
/**
|
||||||
* Signals one thread that is waiting on the condition variable.
|
* Signals one thread that is waiting on the condition variable.
|
||||||
*
|
*
|
||||||
* @param cp pointer to the \p CondVar structure
|
* @param cp pointer to the @p CondVar structure
|
||||||
*/
|
*/
|
||||||
void chCondSignal(CondVar *cp) {
|
void chCondSignal(CondVar *cp) {
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ void chCondSignal(CondVar *cp) {
|
||||||
/**
|
/**
|
||||||
* Signals one thread that is waiting on the condition variable.
|
* Signals one thread that is waiting on the condition variable.
|
||||||
*
|
*
|
||||||
* @param cp pointer to the \p CondVar structure
|
* @param cp pointer to the @p CondVar structure
|
||||||
* @note This function must be called within a \p chSysLock() / \p chSysUnlock()
|
* @note This function must be called within a @p chSysLock() / @p chSysUnlock()
|
||||||
* block.
|
* block.
|
||||||
*/
|
*/
|
||||||
void chCondSignalI(CondVar *cp) {
|
void chCondSignalI(CondVar *cp) {
|
||||||
|
@ -70,7 +70,7 @@ void chCondSignalI(CondVar *cp) {
|
||||||
/**
|
/**
|
||||||
* Signals all threads that are waiting on the condition variable.
|
* Signals all threads that are waiting on the condition variable.
|
||||||
*
|
*
|
||||||
* @param cp pointer to the \p CondVar structure
|
* @param cp pointer to the @p CondVar structure
|
||||||
*/
|
*/
|
||||||
void chCondBroadcast(CondVar *cp) {
|
void chCondBroadcast(CondVar *cp) {
|
||||||
|
|
||||||
|
@ -85,13 +85,13 @@ void chCondBroadcast(CondVar *cp) {
|
||||||
/**
|
/**
|
||||||
* Signals all threads that are waiting on the condition variable.
|
* Signals all threads that are waiting on the condition variable.
|
||||||
*
|
*
|
||||||
* @param cp pointer to the \p CondVar structure
|
* @param cp pointer to the @p CondVar structure
|
||||||
* @note This function must be called within a \p chSysLock() / \p chSysUnlock()
|
* @note This function must be called within a @p chSysLock() / @p chSysUnlock()
|
||||||
*/
|
*/
|
||||||
void chCondBroadcastI(CondVar *cp) {
|
void chCondBroadcastI(CondVar *cp) {
|
||||||
|
|
||||||
/* empties the condition variable queue and inserts all the Threads into the
|
/* empties the condition variable queue and inserts all the Threads into the
|
||||||
* ready list in FIFO order. The wakeup message is set to \p RDY_RESET in
|
* ready list in FIFO order. The wakeup message is set to @p RDY_RESET in
|
||||||
* order to make a chCondBroadcast() detectable from a chCondSignal(). */
|
* order to make a chCondBroadcast() detectable from a chCondSignal(). */
|
||||||
while (cp->c_queue.p_next != (void *)&cp->c_queue)
|
while (cp->c_queue.p_next != (void *)&cp->c_queue)
|
||||||
chSchReadyI(fifo_remove(&cp->c_queue))->p_rdymsg = RDY_RESET;
|
chSchReadyI(fifo_remove(&cp->c_queue))->p_rdymsg = RDY_RESET;
|
||||||
|
@ -105,7 +105,7 @@ void chCondBroadcastI(CondVar *cp) {
|
||||||
*
|
*
|
||||||
* The thread MUST already have locked the mutex when calling chCondWait().
|
* The thread MUST already have locked the mutex when calling chCondWait().
|
||||||
*
|
*
|
||||||
* @param cp pointer to the \p CondVar structure
|
* @param cp pointer to the @p CondVar structure
|
||||||
* @return The wakep mode.
|
* @return The wakep mode.
|
||||||
* @retval RDY_OK if the condvar was signaled using chCondSignal().
|
* @retval RDY_OK if the condvar was signaled using chCondSignal().
|
||||||
* @retval RDY_RESET if the condvar was signaled using chCondBroadcast().
|
* @retval RDY_RESET if the condvar was signaled using chCondBroadcast().
|
||||||
|
@ -129,11 +129,11 @@ msg_t chCondWait(CondVar *cp) {
|
||||||
*
|
*
|
||||||
* The thread MUST already have locked the mutex when calling chCondWait().
|
* The thread MUST already have locked the mutex when calling chCondWait().
|
||||||
*
|
*
|
||||||
* @param cp pointer to the \p CondVar structure
|
* @param cp pointer to the @p CondVar structure
|
||||||
* @return The wakep mode.
|
* @return The wakep mode.
|
||||||
* @retval RDY_OK if the condvar was signaled using chCondSignal().
|
* @retval RDY_OK if the condvar was signaled using chCondSignal().
|
||||||
* @retval RDY_RESET if the condvar was signaled using chCondBroadcast().
|
* @retval RDY_RESET if the condvar was signaled using chCondBroadcast().
|
||||||
* @note This function must be called within a \p chSysLock() / \p chSysUnlock()
|
* @note This function must be called within a @p chSysLock() / @p chSysUnlock()
|
||||||
*/
|
*/
|
||||||
msg_t chCondWaitS(CondVar *cp) {
|
msg_t chCondWaitS(CondVar *cp) {
|
||||||
Mutex *mp;
|
Mutex *mp;
|
||||||
|
@ -159,7 +159,7 @@ msg_t chCondWaitS(CondVar *cp) {
|
||||||
*
|
*
|
||||||
* The thread MUST already have locked the mutex when calling chCondWait().
|
* The thread MUST already have locked the mutex when calling chCondWait().
|
||||||
*
|
*
|
||||||
* @param cp pointer to the \p CondVar structure
|
* @param cp pointer to the @p CondVar structure
|
||||||
* @param time the number of ticks before the operation fails
|
* @param time the number of ticks before the operation fails
|
||||||
* @return The wakep mode.
|
* @return The wakep mode.
|
||||||
* @retval RDY_OK if the condvar was signaled using chCondSignal().
|
* @retval RDY_OK if the condvar was signaled using chCondSignal().
|
||||||
|
@ -186,14 +186,14 @@ msg_t chCondWaitTimeout(CondVar *cp, systime_t time) {
|
||||||
*
|
*
|
||||||
* The thread MUST already have locked the mutex when calling chCondWait().
|
* The thread MUST already have locked the mutex when calling chCondWait().
|
||||||
*
|
*
|
||||||
* @param cp pointer to the \p CondVar structure
|
* @param cp pointer to the @p CondVar structure
|
||||||
* @param time the number of ticks before the operation fails
|
* @param time the number of ticks before the operation fails
|
||||||
* @return The wakep mode.
|
* @return The wakep mode.
|
||||||
* @retval RDY_OK if the condvar was signaled using chCondSignal().
|
* @retval RDY_OK if the condvar was signaled using chCondSignal().
|
||||||
* @retval RDY_RESET if the condvar was signaled using chCondBroadcast().
|
* @retval RDY_RESET if the condvar was signaled using chCondBroadcast().
|
||||||
* @retval RDY_TIMEOUT if the condvar was not signaled within the specified
|
* @retval RDY_TIMEOUT if the condvar was not signaled within the specified
|
||||||
* timeout.
|
* timeout.
|
||||||
* @note This function must be called within a \p chSysLock() / \p chSysUnlock()
|
* @note This function must be called within a @p chSysLock() / @p chSysUnlock()
|
||||||
*/
|
*/
|
||||||
msg_t chCondWaitTimeoutS(CondVar *cp, systime_t time) {
|
msg_t chCondWaitTimeoutS(CondVar *cp, systime_t time) {
|
||||||
Mutex *mp;
|
Mutex *mp;
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#ifdef CH_USE_EVENTS
|
#ifdef CH_USE_EVENTS
|
||||||
/**
|
/**
|
||||||
* Registers an Event Listener on an Event Source.
|
* Registers an Event Listener on an Event Source.
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the @p EventSource structure
|
||||||
* @param elp pointer to the \p EventListener structure
|
* @param elp pointer to the @p EventListener structure
|
||||||
* @param emask the mask of event flags to be pended to the thread when the
|
* @param emask the mask of event flags to be pended to the thread when the
|
||||||
* event source is broadcasted
|
* event source is broadcasted
|
||||||
* @note Multiple Event Listeners can specify the same bits to be pended.
|
* @note Multiple Event Listeners can specify the same bits to be pended.
|
||||||
|
@ -46,8 +46,8 @@ void chEvtRegisterMask(EventSource *esp, EventListener *elp, eventmask_t emask)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregisters an Event Listener from its Event Source.
|
* Unregisters an Event Listener from its Event Source.
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the @p EventSource structure
|
||||||
* @param elp pointer to the \p EventListener structure
|
* @param elp pointer to the @p EventListener structure
|
||||||
* @note If the event listener is not registered on the specified event source
|
* @note If the event listener is not registered on the specified event source
|
||||||
* then the function does nothing.
|
* then the function does nothing.
|
||||||
* @note For optimal performance it is better to perform the unregister
|
* @note For optimal performance it is better to perform the unregister
|
||||||
|
@ -89,7 +89,7 @@ eventmask_t chEvtClear(eventmask_t mask) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes an events mask pending in the current thread, this is \b much faster than
|
* Makes an events mask pending in the current thread, this is \b much faster than
|
||||||
* using \p chEvtBroadcast().
|
* using @p chEvtBroadcast().
|
||||||
* @param mask the events to be pended
|
* @param mask the events to be pended
|
||||||
* @return The current pending events mask.
|
* @return The current pending events mask.
|
||||||
*/
|
*/
|
||||||
|
@ -105,7 +105,7 @@ eventmask_t chEvtPend(eventmask_t mask) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signals all the Event Listeners registered on the specified Event Source.
|
* Signals all the Event Listeners registered on the specified Event Source.
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the @p EventSource structure
|
||||||
*/
|
*/
|
||||||
void chEvtBroadcast(EventSource *esp) {
|
void chEvtBroadcast(EventSource *esp) {
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void chEvtBroadcast(EventSource *esp) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signals all the Event Listeners registered on the specified Event Source.
|
* Signals all the Event Listeners registered on the specified Event Source.
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the @p EventSource structure
|
||||||
* @note This function does not reschedule.
|
* @note This function does not reschedule.
|
||||||
*/
|
*/
|
||||||
void chEvtBroadcastI(EventSource *esp) {
|
void chEvtBroadcastI(EventSource *esp) {
|
||||||
|
@ -143,7 +143,7 @@ void chEvtBroadcastI(EventSource *esp) {
|
||||||
/**
|
/**
|
||||||
* Invokes the event handlers associated with a mask.
|
* Invokes the event handlers associated with a mask.
|
||||||
* @param mask mask of the events to be dispatched
|
* @param mask mask of the events to be dispatched
|
||||||
* @param handlers an array of \p evhandler_t. The array must be
|
* @param handlers an array of @p evhandler_t. The array must be
|
||||||
* have indexes from zero up the higher registered event
|
* have indexes from zero up the higher registered event
|
||||||
* identifier.
|
* identifier.
|
||||||
*/
|
*/
|
||||||
|
@ -163,10 +163,10 @@ void chEvtDispatch(const evhandler_t handlers[], eventmask_t mask) {
|
||||||
#if defined(CH_OPTIMIZE_SPEED) || !defined(CH_USE_EVENTS_TIMEOUT) || \
|
#if defined(CH_OPTIMIZE_SPEED) || !defined(CH_USE_EVENTS_TIMEOUT) || \
|
||||||
defined(__DOXIGEN__)
|
defined(__DOXIGEN__)
|
||||||
/**
|
/**
|
||||||
* A pending event among those specified in \p ewmask is selected, cleared and
|
* A pending event among those specified in @p ewmask is selected, cleared and
|
||||||
* its mask returned.
|
* its mask returned.
|
||||||
* @param ewmask mask of the events that the function should wait for,
|
* @param ewmask mask of the events that the function should wait for,
|
||||||
* \p ALL_EVENTS enables all the events
|
* @p ALL_EVENTS enables all the events
|
||||||
* @return The mask of the lowest id served and cleared event.
|
* @return The mask of the lowest id served and cleared event.
|
||||||
* @note One and only one event is served in the function, the one with the
|
* @note One and only one event is served in the function, the one with the
|
||||||
* lowest event id. The function is meant to be invoked into a loop in
|
* lowest event id. The function is meant to be invoked into a loop in
|
||||||
|
@ -193,10 +193,10 @@ eventmask_t chEvtWaitOne(eventmask_t ewmask) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for any of the specified events.
|
* Waits for any of the specified events.
|
||||||
* The function waits for any event among those specified in \p ewmask to
|
* The function waits for any event among those specified in @p ewmask to
|
||||||
* become pending then the events are cleared and returned.
|
* become pending then the events are cleared and returned.
|
||||||
* @param ewmask mask of the events that the function should wait for,
|
* @param ewmask mask of the events that the function should wait for,
|
||||||
* \p ALL_EVENTS enables all the events
|
* @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.
|
||||||
*/
|
*/
|
||||||
eventmask_t chEvtWaitAny(eventmask_t ewmask) {
|
eventmask_t chEvtWaitAny(eventmask_t ewmask) {
|
||||||
|
@ -217,7 +217,7 @@ eventmask_t chEvtWaitAny(eventmask_t ewmask) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for all the specified event flags then clears them.
|
* Waits for all the specified event flags then clears them.
|
||||||
* The function waits for all the events specified in \p ewmask to become
|
* The function waits for all the events specified in @p ewmask to become
|
||||||
* pending then the events are cleared and returned.
|
* pending then the events are cleared and returned.
|
||||||
* @param ewmask mask of the event ids that the function should wait for
|
* @param ewmask mask of the event ids that the function should wait for
|
||||||
* @return The mask of the served and cleared events.
|
* @return The mask of the served and cleared events.
|
||||||
|
@ -240,10 +240,10 @@ eventmask_t chEvtWaitAll(eventmask_t ewmask) {
|
||||||
#ifdef CH_USE_EVENTS_TIMEOUT
|
#ifdef CH_USE_EVENTS_TIMEOUT
|
||||||
/**
|
/**
|
||||||
* Waits for a single event.
|
* Waits for a single event.
|
||||||
* A pending event among those specified in \p ewmask is selected, cleared and
|
* A pending event among those specified in @p ewmask is selected, cleared and
|
||||||
* its mask returned.
|
* its mask returned.
|
||||||
* @param ewmask mask of the events that the function should wait for,
|
* @param ewmask mask of the events that the function should wait for,
|
||||||
* \p ALL_EVENTS enables all the events
|
* @p ALL_EVENTS enables all the events
|
||||||
* @param time the number of ticks before the operation timouts
|
* @param time the number of ticks before the operation timouts
|
||||||
* @return The mask of the lowest id served and cleared event.
|
* @return The mask of the lowest id served and cleared event.
|
||||||
* @retval 0 if the specified timeout expired.
|
* @retval 0 if the specified timeout expired.
|
||||||
|
@ -273,10 +273,10 @@ eventmask_t chEvtWaitOneTimeout(eventmask_t ewmask, systime_t time) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for any of the specified events.
|
* Waits for any of the specified events.
|
||||||
* The function waits for any event among those specified in \p ewmask to
|
* The function waits for any event among those specified in @p ewmask to
|
||||||
* become pending then the events are cleared and returned.
|
* become pending then the events are cleared and returned.
|
||||||
* @param ewmask mask of the events that the function should wait for,
|
* @param ewmask mask of the events that the function should wait for,
|
||||||
* \p ALL_EVENTS enables all the events
|
* @p ALL_EVENTS enables all the events
|
||||||
* @param time the number of ticks before the operation timouts
|
* @param time the number of ticks before the operation 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.
|
||||||
|
@ -300,7 +300,7 @@ eventmask_t chEvtWaitAnyTimeout(eventmask_t ewmask, systime_t time) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for all the specified event flags then clears them.
|
* Waits for all the specified event flags then clears them.
|
||||||
* The function waits for all the events specified in \p ewmask to become
|
* The function waits for all the events specified in @p ewmask to become
|
||||||
* pending then the events are cleared and returned.
|
* pending then the events are cleared and returned.
|
||||||
* @param ewmask mask of the event ids that the function should wait for
|
* @param ewmask mask of the event ids that the function should wait for
|
||||||
* @param time the number of ticks before the operation timouts
|
* @param time the number of ticks before the operation timouts
|
||||||
|
|
|
@ -190,7 +190,7 @@ void chHeapFree(void *p) {
|
||||||
* @return The number of fragments in the heap.
|
* @return The number of fragments in the heap.
|
||||||
* @note This function is meant to be used in the test suite, it should not be
|
* @note This function is meant to be used in the test suite, it should not be
|
||||||
* really useful for the application code.
|
* really useful for the application code.
|
||||||
* @note This function is not implemented when the \p CH_USE_MALLOC_HEAP
|
* @note This function is not implemented when the @p CH_USE_MALLOC_HEAP
|
||||||
* configuration option is used (it always returns zero).
|
* configuration option is used (it always returns zero).
|
||||||
*/
|
*/
|
||||||
size_t chHeapStatus(size_t *sizep) {
|
size_t chHeapStatus(size_t *sizep) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an empty memory pool.
|
* Initializes an empty memory pool.
|
||||||
* @param mp pointer to a \p MemoryPool structure
|
* @param mp pointer to a @p MemoryPool structure
|
||||||
* @param size the size of the objects contained in this memory pool
|
* @param size the size of the objects contained in this memory pool
|
||||||
*/
|
*/
|
||||||
void chPoolInit(MemoryPool *mp, size_t size) {
|
void chPoolInit(MemoryPool *mp, size_t size) {
|
||||||
|
@ -42,7 +42,7 @@ void chPoolInit(MemoryPool *mp, size_t size) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates an object from a memory pool.
|
* Allocates an object from a memory pool.
|
||||||
* @param mp pointer to a \p MemoryPool structure
|
* @param mp pointer to a @p MemoryPool structure
|
||||||
* @return The pointer to the allocated object.
|
* @return The pointer to the allocated object.
|
||||||
* @retval NULL if pool is empty.
|
* @retval NULL if pool is empty.
|
||||||
*/
|
*/
|
||||||
|
@ -59,7 +59,7 @@ void *chPoolAllocI(MemoryPool *mp) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates an object from a memory pool.
|
* Allocates an object from a memory pool.
|
||||||
* @param mp pointer to a \p MemoryPool structure
|
* @param mp pointer to a @p MemoryPool structure
|
||||||
* @return The pointer to the allocated object.
|
* @return The pointer to the allocated object.
|
||||||
* @retval NULL if pool is empty.
|
* @retval NULL if pool is empty.
|
||||||
*/
|
*/
|
||||||
|
@ -74,7 +74,7 @@ void *chPoolAlloc(MemoryPool *mp) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases (or adds) an object into (to) a memory pool.
|
* Releases (or adds) an object into (to) a memory pool.
|
||||||
* @param mp pointer to a \p MemoryPool structure
|
* @param mp pointer to a @p MemoryPool structure
|
||||||
* @param objp the pointer to the object to be released or added
|
* @param objp the pointer to the object to be released or added
|
||||||
* @note the object is assumed to be of the right size for the specified
|
* @note the object is assumed to be of the right size for the specified
|
||||||
* memory pool.
|
* memory pool.
|
||||||
|
@ -91,7 +91,7 @@ void chPoolFreeI(MemoryPool *mp, void *objp) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases (or adds) an object into (to) a memory pool.
|
* Releases (or adds) an object into (to) a memory pool.
|
||||||
* @param mp pointer to a \p MemoryPool structure
|
* @param mp pointer to a @p MemoryPool structure
|
||||||
* @param objp the pointer to the object to be released or added
|
* @param objp the pointer to the object to be released or added
|
||||||
* @note the object is assumed to be of the right size for the specified
|
* @note the object is assumed to be of the right size for the specified
|
||||||
* memory pool.
|
* memory pool.
|
||||||
|
|
20
src/chmsg.c
20
src/chmsg.c
|
@ -26,11 +26,11 @@
|
||||||
#ifdef CH_USE_MESSAGES
|
#ifdef CH_USE_MESSAGES
|
||||||
/**
|
/**
|
||||||
* Sends a message to the specified thread. The client is stopped until the
|
* Sends a message to the specified thread. The client is stopped until the
|
||||||
* server executes a \p chMsgRelease() after receiving the message.
|
* server executes a @p chMsgRelease() after receiving the message.
|
||||||
*
|
*
|
||||||
* @param tp the pointer to the thread
|
* @param tp the pointer to the thread
|
||||||
* @param msg the message, it can be a pointer to a complex structure
|
* @param msg the message, it can be a pointer to a complex structure
|
||||||
* @return The return message from \p chMsgRelease().
|
* @return The return message from @p chMsgRelease().
|
||||||
*/
|
*/
|
||||||
msg_t chMsgSend(Thread *tp, msg_t msg) {
|
msg_t chMsgSend(Thread *tp, msg_t msg) {
|
||||||
|
|
||||||
|
@ -55,16 +55,16 @@ msg_t chMsgSend(Thread *tp, msg_t msg) {
|
||||||
#ifdef CH_USE_MESSAGES_EVENT
|
#ifdef CH_USE_MESSAGES_EVENT
|
||||||
/**
|
/**
|
||||||
* Sends a message to the specified thread and atomically triggers an event.
|
* Sends a message to the specified thread and atomically triggers an event.
|
||||||
* The client is stopped until the server executes a \p chMsgRelease()
|
* The client is stopped until the server executes a @p chMsgRelease()
|
||||||
* after receiving the message.
|
* after receiving the message.
|
||||||
*
|
*
|
||||||
* @param tp the pointer to the thread
|
* @param tp the pointer to the thread
|
||||||
* @param msg the message, it can be a pointer to a complex structure
|
* @param msg the message, it can be a pointer to a complex structure
|
||||||
* @param esp the event source to pulse while sending the message
|
* @param esp the event source to pulse while sending the message
|
||||||
* @return The return message from \p chMsgRelease().
|
* @return The return message from @p chMsgRelease().
|
||||||
* @note This function assumes that the receiving thread is not sleeping into
|
* @note This function assumes that the receiving thread is not sleeping into
|
||||||
* a \p chMsgWait(). The use case is that the server thread is waiting
|
* a @p chMsgWait(). The use case is that the server thread is waiting
|
||||||
* for both messages AND events while waiting into \p chEvtWaitXXX().
|
* for both messages AND events while waiting into @p chEvtWaitXXX().
|
||||||
*/
|
*/
|
||||||
msg_t chMsgSendWithEvent(Thread *tp, msg_t msg, EventSource *esp) {
|
msg_t chMsgSendWithEvent(Thread *tp, msg_t msg, EventSource *esp) {
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ msg_t chMsgSendWithEvent(Thread *tp, msg_t msg, EventSource *esp) {
|
||||||
* @return The pointer to the message structure. Note, it is always the
|
* @return The pointer to the message structure. Note, it is always the
|
||||||
* message associated to the thread on the top of the messages queue.
|
* message associated to the thread on the top of the messages queue.
|
||||||
* @note You can assume that the data contained in the message is stable until
|
* @note You can assume that the data contained in the message is stable until
|
||||||
* you invoke \p chMsgRelease() because the sending thread is
|
* you invoke @p chMsgRelease() because the sending thread is
|
||||||
* suspended until then.
|
* suspended until then.
|
||||||
*/
|
*/
|
||||||
msg_t chMsgWait(void) {
|
msg_t chMsgWait(void) {
|
||||||
|
@ -114,9 +114,9 @@ msg_t chMsgWait(void) {
|
||||||
*
|
*
|
||||||
* @return The pointer to the message structure. Note, it is always the
|
* @return The pointer to the message structure. Note, it is always the
|
||||||
* message associated to the thread on the top of the messages queue.
|
* message associated to the thread on the top of the messages queue.
|
||||||
* If the queue is empty then \p NULL is returned.
|
* If the queue is empty then @p NULL is returned.
|
||||||
* @note You can assume that the data pointed by the message is stable until
|
* @note You can assume that the data pointed by the message is stable until
|
||||||
* you invoke \p chMsgRelease() because the sending thread is
|
* you invoke @p chMsgRelease() because the sending thread is
|
||||||
* suspended until then. Always remember that the message data is not
|
* suspended until then. Always remember that the message data is not
|
||||||
* copied between the sender and the receiver, just a pointer is passed.
|
* copied between the sender and the receiver, just a pointer is passed.
|
||||||
*/
|
*/
|
||||||
|
@ -137,7 +137,7 @@ msg_t chMsgGet(void) {
|
||||||
* @param msg the message returned to the message sender
|
* @param msg the message returned to the message sender
|
||||||
* @note You can call this function only if there is a message already in the
|
* @note You can call this function only if there is a message already in the
|
||||||
* queue else the result will be unpredictable (a crash most likely).
|
* queue else the result will be unpredictable (a crash most likely).
|
||||||
* Exiting from the \p chMsgWait() ensures you have at least one
|
* Exiting from the @p chMsgWait() ensures you have at least one
|
||||||
* message in the queue so it is not a big deal.<br>
|
* message in the queue so it is not a big deal.<br>
|
||||||
* The condition is only tested in debug mode in order to make this code
|
* The condition is only tested in debug mode in order to make this code
|
||||||
* as fast as possible.
|
* as fast as possible.
|
||||||
|
|
18
src/chmtx.c
18
src/chmtx.c
|
@ -27,8 +27,8 @@
|
||||||
#ifdef CH_USE_MUTEXES
|
#ifdef CH_USE_MUTEXES
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes s \p Mutex structure.
|
* Initializes s @p Mutex structure.
|
||||||
* @param mp pointer to a \p Mutex structure
|
* @param mp pointer to a @p Mutex structure
|
||||||
*/
|
*/
|
||||||
void chMtxInit(Mutex *mp) {
|
void chMtxInit(Mutex *mp) {
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ void chMtxInit(Mutex *mp) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locks the specified mutex.
|
* Locks the specified mutex.
|
||||||
* @param mp pointer to the \p Mutex structure
|
* @param mp pointer to the @p Mutex structure
|
||||||
*/
|
*/
|
||||||
void chMtxLock(Mutex *mp) {
|
void chMtxLock(Mutex *mp) {
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ void chMtxLock(Mutex *mp) {
|
||||||
/**
|
/**
|
||||||
* Locks the specified mutex.
|
* Locks the specified mutex.
|
||||||
*
|
*
|
||||||
* @param mp pointer to the \p Mutex structure
|
* @param mp pointer to the @p Mutex structure
|
||||||
* @note This function must be called within a \p chSysLock() / \p chSysUnlock()
|
* @note This function must be called within a @p chSysLock() / @p chSysUnlock()
|
||||||
* block.
|
* block.
|
||||||
*/
|
*/
|
||||||
void chMtxLockS(Mutex *mp) {
|
void chMtxLockS(Mutex *mp) {
|
||||||
|
@ -113,7 +113,7 @@ void chMtxLockS(Mutex *mp) {
|
||||||
* Tries to lock a mutex. This function does not have any overhead related to
|
* Tries to lock a mutex. This function does not have any overhead related to
|
||||||
* the priority inheritance mechanism because it does not try to enter a sleep
|
* the priority inheritance mechanism because it does not try to enter a sleep
|
||||||
* state on the mutex.
|
* state on the mutex.
|
||||||
* @param mp pointer to the \p Mutex structure
|
* @param mp pointer to the @p Mutex structure
|
||||||
* @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.
|
||||||
*/
|
*/
|
||||||
|
@ -132,10 +132,10 @@ bool_t chMtxTryLock(Mutex *mp) {
|
||||||
* Tries to lock a mutex. This function does not have any overhead related to
|
* Tries to lock a mutex. This function does not have any overhead related to
|
||||||
* the priority inheritance mechanism because it does not try to enter a sleep
|
* the priority inheritance mechanism because it does not try to enter a sleep
|
||||||
* state on the mutex.
|
* state on the mutex.
|
||||||
* @param mp pointer to the \p Mutex structure
|
* @param mp pointer to the @p Mutex structure
|
||||||
* @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.
|
||||||
* @note This function must be called within a \p chSysLock() / \p chSysUnlock()
|
* @note This function must be called within a @p chSysLock() / @p chSysUnlock()
|
||||||
* block.
|
* block.
|
||||||
*/
|
*/
|
||||||
bool_t chMtxTryLockS(Mutex *mp) {
|
bool_t chMtxTryLockS(Mutex *mp) {
|
||||||
|
@ -196,7 +196,7 @@ Mutex *chMtxUnlock(void) {
|
||||||
/**
|
/**
|
||||||
* Unlocks the next owned mutex in reverse lock order.
|
* Unlocks the next owned mutex in reverse lock order.
|
||||||
* @return The pointer to the unlocked mutex.
|
* @return The pointer to the unlocked mutex.
|
||||||
* @note This function must be called within a \p chSysLock() / \p chSysUnlock()
|
* @note This function must be called within a @p chSysLock() / @p chSysUnlock()
|
||||||
* block.
|
* block.
|
||||||
* @note This function does not reschedule internally.
|
* @note This function does not reschedule internally.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
/**
|
/**
|
||||||
* Initializes an input queue. A Semaphore is internally initialized
|
* Initializes an input queue. A Semaphore is internally initialized
|
||||||
* and works as a counter of the bytes contained in the queue.
|
* and works as a counter of the bytes contained in the queue.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @param buffer pointer to a memory area allocated as queue buffer
|
* @param buffer pointer to a memory area allocated as queue buffer
|
||||||
* @param size size of the queue buffer
|
* @param size size of the queue buffer
|
||||||
* @param inotify pointer to a callback function that is invoked when
|
* @param inotify pointer to a callback function that is invoked when
|
||||||
* some data is read from the Queue. The value can be \p NULL.
|
* some data is read from the Queue. The value can be @p NULL.
|
||||||
*/
|
*/
|
||||||
void chIQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t inotify) {
|
void chIQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t inotify) {
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ void chIQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t inotify) {
|
||||||
/**
|
/**
|
||||||
* Resets an input queue. All the data is lost and the waiting threads
|
* Resets an input queue. All the data is lost and the waiting threads
|
||||||
* resumed.
|
* resumed.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
*/
|
*/
|
||||||
void chIQReset(Queue *qp) {
|
void chIQReset(Queue *qp) {
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ void chIQReset(Queue *qp) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserts a byte into an input queue.
|
* Inserts a byte into an input queue.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @param b the byte value to be written
|
* @param b the byte value to be written
|
||||||
* @retval Q_OK if the operation is successful.
|
* @retval Q_OK if the operation is successful.
|
||||||
* @retval Q_FULL if the queue is full.
|
* @retval Q_FULL if the queue is full.
|
||||||
|
@ -83,7 +83,7 @@ msg_t chIQPutI(Queue *qp, uint8_t b) {
|
||||||
/**
|
/**
|
||||||
* Gets a byte from the input queue, if the queue is empty then the
|
* Gets a byte from the input queue, if the queue is empty then the
|
||||||
* calling thread is suspended until a byte arrives in the queue.
|
* calling thread is suspended until a byte arrives in the queue.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @return A byte value from the queue.
|
* @return A byte value from the queue.
|
||||||
* @retval Q_RESET if the queue was reset.
|
* @retval Q_RESET if the queue was reset.
|
||||||
*/
|
*/
|
||||||
|
@ -113,13 +113,13 @@ msg_t chIQGet(Queue *qp) {
|
||||||
* Gets a byte from the input queue, if the queue is empty then the
|
* Gets a byte from the input queue, if the queue is empty then the
|
||||||
* calling thread is suspended until a byte arrives in the queue or the
|
* calling thread is suspended until a byte arrives in the queue or the
|
||||||
* specified time expires.
|
* specified time expires.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @param time the number of ticks before the operation timouts
|
* @param time the number of ticks before the operation timouts
|
||||||
* @return A byte value from the queue.
|
* @return A byte value from the queue.
|
||||||
* @retval Q_TIMEOUT if the specified time expired.
|
* @retval Q_TIMEOUT if the specified time expired.
|
||||||
* @retval Q_RESET if the queue was reset.
|
* @retval Q_RESET if the queue was reset.
|
||||||
* @note The function is available only if the \p CH_USE_QUEUES_TIMEOUT and
|
* @note The function is available only if the @p CH_USE_QUEUES_TIMEOUT and
|
||||||
* \p CH_USE_SEMAPHORES_TIMEOUT options are enabled in \p chconf.h.
|
* @p CH_USE_SEMAPHORES_TIMEOUT options are enabled in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
msg_t chIQGetTimeout(Queue *qp, systime_t time) {
|
msg_t chIQGetTimeout(Queue *qp, systime_t time) {
|
||||||
uint8_t b;
|
uint8_t b;
|
||||||
|
@ -147,7 +147,7 @@ msg_t chIQGetTimeout(Queue *qp, systime_t time) {
|
||||||
/**
|
/**
|
||||||
* Reads some data from the input queue into the specified buffer. The function
|
* Reads some data from the input queue into the specified buffer. The function
|
||||||
* is non-blocking and can return zero if the queue is empty.
|
* is non-blocking and can return zero if the queue is empty.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @param buffer the data buffer
|
* @param buffer the data buffer
|
||||||
* @param n the maximum amount of data to be read
|
* @param n the maximum amount of data to be read
|
||||||
* @return The number of bytes read.
|
* @return The number of bytes read.
|
||||||
|
@ -189,11 +189,11 @@ size_t chIQRead(Queue *qp, uint8_t *buffer, size_t n) {
|
||||||
/**
|
/**
|
||||||
* Initializes an output queue. A Semaphore is internally initialized
|
* Initializes an output queue. A Semaphore is internally initialized
|
||||||
* and works as a counter of the free bytes in the queue.
|
* and works as a counter of the free bytes in the queue.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @param buffer pointer to a memory area allocated as queue buffer
|
* @param buffer pointer to a memory area allocated as queue buffer
|
||||||
* @param size size of the queue buffer
|
* @param size size of the queue buffer
|
||||||
* @param onotify pointer to a callback function that is invoked when
|
* @param onotify pointer to a callback function that is invoked when
|
||||||
* some data is written in the Queue. The value can be \p NULL.
|
* some data is written in the Queue. The value can be @p NULL.
|
||||||
*/
|
*/
|
||||||
void chOQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t onotify) {
|
void chOQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t onotify) {
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ void chOQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t onotify) {
|
||||||
/**
|
/**
|
||||||
* Resets an Output Queue. All the data is lost and the waiting threads
|
* Resets an Output Queue. All the data is lost and the waiting threads
|
||||||
* resumed.
|
* resumed.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
*/
|
*/
|
||||||
void chOQReset(Queue *qp) {
|
void chOQReset(Queue *qp) {
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ void chOQReset(Queue *qp) {
|
||||||
/**
|
/**
|
||||||
* Inserts a byte in the output queue, if the queue is full then the thread
|
* Inserts a byte in the output queue, if the queue is full then the thread
|
||||||
* is suspended until the queue has free space available.
|
* is suspended until the queue has free space available.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @param b the byte value to be written
|
* @param b the byte value to be written
|
||||||
*/
|
*/
|
||||||
void chOQPut(Queue *qp, uint8_t b) {
|
void chOQPut(Queue *qp, uint8_t b) {
|
||||||
|
@ -241,7 +241,7 @@ void chOQPut(Queue *qp, uint8_t b) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a byte from an output queue.
|
* Gets a byte from an output queue.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @return The byte value from the queue.
|
* @return The byte value from the queue.
|
||||||
* @retval Q_EMPTY if the queue is empty.
|
* @retval Q_EMPTY if the queue is empty.
|
||||||
* @note This function is the lower side endpoint of the output queue.
|
* @note This function is the lower side endpoint of the output queue.
|
||||||
|
@ -264,7 +264,7 @@ msg_t chOQGetI(Queue *qp) {
|
||||||
/**
|
/**
|
||||||
* Writes some data from the specified buffer into the queue. The function
|
* Writes some data from the specified buffer into the queue. The function
|
||||||
* is non-blocking and can return zero if the queue is full.
|
* is non-blocking and can return zero if the queue is full.
|
||||||
* @param qp pointer to a \p Queue structure
|
* @param qp pointer to a @p Queue structure
|
||||||
* @param buffer the data buffer
|
* @param buffer the data buffer
|
||||||
* @param n the maximum amount of data to be written
|
* @param n the maximum amount of data to be written
|
||||||
* @return The number of written bytes.
|
* @return The number of written bytes.
|
||||||
|
@ -307,13 +307,13 @@ size_t chOQWrite(Queue *qp, uint8_t *buffer, size_t n) {
|
||||||
#ifdef CH_USE_QUEUES_HALFDUPLEX
|
#ifdef CH_USE_QUEUES_HALFDUPLEX
|
||||||
/**
|
/**
|
||||||
* Initializes an half duplex queue.
|
* Initializes an half duplex queue.
|
||||||
* @param qp pointer to the \p HalfDuplexQueue structure
|
* @param qp pointer to the @p HalfDuplexQueue structure
|
||||||
* @param buffer pointer to a memory area allocated as buffer for the queue
|
* @param buffer pointer to a memory area allocated as buffer for the queue
|
||||||
* @param size the size of the queue buffer
|
* @param size the size of the queue buffer
|
||||||
* @param inotify pointer to a callback function that is invoked when
|
* @param inotify pointer to a callback function that is invoked when
|
||||||
* some data is read from the queue. The value can be \p NULL.
|
* some data is read from the queue. The value can be @p NULL.
|
||||||
* @param onotify pointer to a callback function that is invoked when
|
* @param onotify pointer to a callback function that is invoked when
|
||||||
* some data is written to the queue. The value can be \p NULL.
|
* some data is written to the queue. The value can be @p NULL.
|
||||||
*/
|
*/
|
||||||
void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, size_t size,
|
void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, size_t size,
|
||||||
qnotify_t inotify, qnotify_t onotify) {
|
qnotify_t inotify, qnotify_t onotify) {
|
||||||
|
@ -329,7 +329,7 @@ void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, size_t size,
|
||||||
/**
|
/**
|
||||||
* Reads a byte from the receive queue, if the queue is empty or is in
|
* Reads a byte from the receive queue, if the queue is empty or is in
|
||||||
* transmission mode then the invoking thread is suspended.
|
* transmission mode then the invoking thread is suspended.
|
||||||
* @param qp pointer to a \p HalfDuplexQueue structure
|
* @param qp pointer to a @p HalfDuplexQueue structure
|
||||||
* @return The byte value.
|
* @return The byte value.
|
||||||
* @retval Q_RESET if the queue was reset.
|
* @retval Q_RESET if the queue was reset.
|
||||||
*/
|
*/
|
||||||
|
@ -362,12 +362,12 @@ msg_t chHDQGetReceive(HalfDuplexQueue *qp) {
|
||||||
/**
|
/**
|
||||||
* Reads a byte from the receive queue, if the queue is empty or is in
|
* Reads a byte from the receive queue, if the queue is empty or is in
|
||||||
* transmission mode then the invoking thread is suspended.
|
* transmission mode then the invoking thread is suspended.
|
||||||
* @param qp pointer to a \p HalfDuplexQueue structure
|
* @param qp pointer to a @p HalfDuplexQueue structure
|
||||||
* @param time the number of ticks before the operation timouts
|
* @param time the number of ticks before the operation timouts
|
||||||
* @return The byte value.
|
* @return The byte value.
|
||||||
* @retval Q_TIMEOUT if a timeout occurs.
|
* @retval Q_TIMEOUT if a timeout occurs.
|
||||||
* @note The function is available only if the \p CH_USE_QUEUES_TIMEOUT and
|
* @note The function is available only if the @p CH_USE_QUEUES_TIMEOUT and
|
||||||
* \p CH_USE_SEMAPHORES_TIMEOUT options are enabled in \p chconf.h.
|
* @p CH_USE_SEMAPHORES_TIMEOUT options are enabled in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
msg_t chHDQGetReceiveTimeout(HalfDuplexQueue *qp, systime_t time) {
|
msg_t chHDQGetReceiveTimeout(HalfDuplexQueue *qp, systime_t time) {
|
||||||
uint8_t b;
|
uint8_t b;
|
||||||
|
@ -400,7 +400,7 @@ msg_t chHDQGetReceiveTimeout(HalfDuplexQueue *qp, systime_t time) {
|
||||||
* Writes a byte into the transmit queue. If the buffer contains unread
|
* Writes a byte into the transmit queue. If the buffer contains unread
|
||||||
* input data then the the buffer is cleared and the queue goes in
|
* input data then the the buffer is cleared and the queue goes in
|
||||||
* transmission mode.
|
* transmission mode.
|
||||||
* @param qp pointer to a \p HalfDuplexQueue structure
|
* @param qp pointer to a @p HalfDuplexQueue structure
|
||||||
* @param b the byte value to be written
|
* @param b the byte value to be written
|
||||||
*/
|
*/
|
||||||
void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b) {
|
void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b) {
|
||||||
|
@ -431,7 +431,7 @@ void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a byte from the transmit queue.
|
* Gets a byte from the transmit queue.
|
||||||
* @param qp pointer to a \p HalfDuplexQueue structure
|
* @param qp pointer to a @p HalfDuplexQueue structure
|
||||||
* @return The byte value.
|
* @return The byte value.
|
||||||
* @retval Q_EMPTY if the transmit queue is empty (not in transmission mode).
|
* @retval Q_EMPTY if the transmit queue is empty (not in transmission mode).
|
||||||
* @note This function must be called with interrupts disabled or from an
|
* @note This function must be called with interrupts disabled or from an
|
||||||
|
@ -453,7 +453,7 @@ msg_t chHDQGetTransmitI(HalfDuplexQueue *qp) {
|
||||||
/**
|
/**
|
||||||
* Writes a byte into the receive queue. If the queue is in transmission mode
|
* Writes a byte into the receive queue. If the queue is in transmission mode
|
||||||
* then the byte is lost.
|
* then the byte is lost.
|
||||||
* @param qp pointer to a \p HalfDuplexQueue structure
|
* @param qp pointer to a @p HalfDuplexQueue structure
|
||||||
* @param b the byte value to be written
|
* @param b the byte value to be written
|
||||||
* @retval Q_OK if the operation is successful.
|
* @retval Q_OK if the operation is successful.
|
||||||
* @retval Q_FULL if the driver is in transmit mode or the receive queue is full.
|
* @retval Q_FULL if the driver is in transmit mode or the receive queue is full.
|
||||||
|
|
14
src/chschd.c
14
src/chschd.c
|
@ -30,7 +30,7 @@ ReadyList rlist;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scheduler initialization.
|
* Scheduler initialization.
|
||||||
* @note Internally invoked by the \p chSysInit().
|
* @note Internally invoked by the @p chSysInit().
|
||||||
*/
|
*/
|
||||||
void chSchInit(void) {
|
void chSchInit(void) {
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ void chSchInit(void) {
|
||||||
* @param tp the Thread to be made ready
|
* @param tp the Thread to be made ready
|
||||||
* @return The Thread pointer.
|
* @return The Thread pointer.
|
||||||
* @note The function must be called in the system mutex zone.
|
* @note The function must be called in the system mutex zone.
|
||||||
* @note The function does not reschedule, the \p chSchRescheduleS() should
|
* @note The function does not reschedule, the @p chSchRescheduleS() should
|
||||||
* be called soon after.
|
* be called soon after.
|
||||||
* @note The function is not meant to be used in the user code directly.
|
* @note The function is not meant to be used in the user code directly.
|
||||||
*/
|
*/
|
||||||
|
@ -72,7 +72,7 @@ Thread *chSchReadyI(Thread *tp) {
|
||||||
/**
|
/**
|
||||||
* Puts the current thread to sleep into the specified state, the next highest
|
* Puts the current thread to sleep into the specified state, the next highest
|
||||||
* priority thread becomes running. The threads states are described into
|
* priority thread becomes running. The threads states are described into
|
||||||
* \p threads.h
|
* @p threads.h
|
||||||
* @param newstate the new thread state
|
* @param newstate the new thread state
|
||||||
* @note The function must be called in the system mutex zone.
|
* @note The function must be called in the system mutex zone.
|
||||||
* @note The function is not meant to be used in the user code directly.
|
* @note The function is not meant to be used in the user code directly.
|
||||||
|
@ -112,7 +112,7 @@ static void wakeup(void *p) {
|
||||||
*
|
*
|
||||||
* @param newstate the new thread state
|
* @param newstate the new thread state
|
||||||
* @param time the number of ticks before the operation timeouts. the value
|
* @param time the number of ticks before the operation timeouts. the value
|
||||||
* zero (\p TIME_INFINITE) is allowed.
|
* zero (@p TIME_INFINITE) is allowed.
|
||||||
* @return The wakeup message.
|
* @return The wakeup message.
|
||||||
* @retval RDY_TIMEOUT if a timeout occurs.
|
* @retval RDY_TIMEOUT if a timeout occurs.
|
||||||
* @note The function must be called in the system mutex zone.
|
* @note The function must be called in the system mutex zone.
|
||||||
|
@ -142,8 +142,8 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) {
|
||||||
* @param msg message to the awakened thread
|
* @param msg message to the awakened thread
|
||||||
* @note The function must be called in the system mutex zone.
|
* @note The function must be called in the system mutex zone.
|
||||||
* @note The function is not meant to be used in the user code directly.
|
* @note The function is not meant to be used in the user code directly.
|
||||||
* @note It is equivalent to a \p chSchReadyI() followed by a
|
* @note It is equivalent to a @p chSchReadyI() followed by a
|
||||||
* \p chSchRescheduleS() but much more efficient.
|
* @p chSchRescheduleS() but much more efficient.
|
||||||
*/
|
*/
|
||||||
void chSchWakeupS(Thread *ntp, msg_t msg) {
|
void chSchWakeupS(Thread *ntp, msg_t msg) {
|
||||||
ntp->p_rdymsg = msg;
|
ntp->p_rdymsg = msg;
|
||||||
|
@ -172,7 +172,7 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
|
||||||
/**
|
/**
|
||||||
* Switch to the first thread on the runnable queue.
|
* Switch to the first thread on the runnable queue.
|
||||||
*
|
*
|
||||||
* @note It is intended to be called if \p chSchRescRequiredI() evaluates to \p TRUE.
|
* @note It is intended to be called if @p chSchRescRequiredI() evaluates to @p TRUE.
|
||||||
*/
|
*/
|
||||||
void chSchDoRescheduleI(void) {
|
void chSchDoRescheduleI(void) {
|
||||||
|
|
||||||
|
|
60
src/chsem.c
60
src/chsem.c
|
@ -27,7 +27,7 @@
|
||||||
#ifdef CH_USE_SEMAPHORES
|
#ifdef CH_USE_SEMAPHORES
|
||||||
/**
|
/**
|
||||||
* Initializes a semaphore with the specified counter value.
|
* Initializes a semaphore with the specified counter value.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @param n initial value of the semaphore counter. Must be non-negative.
|
* @param n initial value of the semaphore counter. Must be non-negative.
|
||||||
* @note Can be called with interrupts disabled or enabled.
|
* @note Can be called with interrupts disabled or enabled.
|
||||||
*/
|
*/
|
||||||
|
@ -40,11 +40,11 @@ void chSemInit(Semaphore *sp, cnt_t n) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a reset operation on the semaphore.
|
* Performs a reset operation on the semaphore.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @param n the new value of the semaphore counter. The value must be non-negative.
|
* @param n the new value of the semaphore counter. The value must be non-negative.
|
||||||
* @note The released threads can recognize they were waked up by a reset
|
* @note The released threads can recognize they were waked up by a reset
|
||||||
* instead than a signal because the \p chSemWait() will return
|
* instead than a signal because the @p chSemWait() will return
|
||||||
* \p RDY_RESET instead of \p RDY_OK.
|
* @p RDY_RESET instead of @p RDY_OK.
|
||||||
*/
|
*/
|
||||||
void chSemReset(Semaphore *sp, cnt_t n) {
|
void chSemReset(Semaphore *sp, cnt_t n) {
|
||||||
|
|
||||||
|
@ -58,11 +58,11 @@ void chSemReset(Semaphore *sp, cnt_t n) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a reset operation on the semaphore.
|
* Performs a reset operation on the semaphore.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @param n the new value of the semaphore counter. The value must be non-negative.
|
* @param n the new value of the semaphore counter. The value must be non-negative.
|
||||||
* @note The released threads can recognize they were waked up by a reset
|
* @note The released threads can recognize they were waked up by a reset
|
||||||
* instead than a signal because the \p chSemWait() will return
|
* instead than a signal because the @p chSemWait() will return
|
||||||
* \p RDY_RESET instead of \p RDY_OK.
|
* @p RDY_RESET instead of @p RDY_OK.
|
||||||
* @note This function does not reschedule.
|
* @note This function does not reschedule.
|
||||||
*/
|
*/
|
||||||
void chSemResetI(Semaphore *sp, cnt_t n) {
|
void chSemResetI(Semaphore *sp, cnt_t n) {
|
||||||
|
@ -77,9 +77,9 @@ void chSemResetI(Semaphore *sp, cnt_t n) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a wait operation on a semaphore.
|
* Performs a wait operation on a semaphore.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @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 using \p chSemReset().
|
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
||||||
*/
|
*/
|
||||||
msg_t chSemWait(Semaphore *sp) {
|
msg_t chSemWait(Semaphore *sp) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
|
@ -94,9 +94,9 @@ msg_t chSemWait(Semaphore *sp) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a wait operation on a semaphore.
|
* Performs a wait operation on a semaphore.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @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 using \p chSemReset().
|
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
||||||
* @note This function must be called with interrupts disabled.
|
* @note This function must be called with interrupts disabled.
|
||||||
* @note This function cannot be called by an interrupt handler.
|
* @note This function cannot be called by an interrupt handler.
|
||||||
*/
|
*/
|
||||||
|
@ -114,14 +114,14 @@ msg_t chSemWaitS(Semaphore *sp) {
|
||||||
#ifdef CH_USE_SEMAPHORES_TIMEOUT
|
#ifdef CH_USE_SEMAPHORES_TIMEOUT
|
||||||
/**
|
/**
|
||||||
* Performs a wait operation on a semaphore with timeout specification.
|
* Performs a wait operation on a semaphore with timeout specification.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @param time the number of ticks before the operation fails
|
* @param time the number of ticks before the operation fails
|
||||||
* @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 using \p chSemReset().
|
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
||||||
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset within the
|
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset within the
|
||||||
* specified timeout.
|
* specified timeout.
|
||||||
* @note The function is available only if the \p CH_USE_SEMAPHORES_TIMEOUT
|
* @note The function is available only if the @p CH_USE_SEMAPHORES_TIMEOUT
|
||||||
* option is enabled in \p chconf.h.
|
* option is enabled in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
|
msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
|
@ -136,14 +136,14 @@ msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a wait operation on a semaphore with timeout specification.
|
* Performs a wait operation on a semaphore with timeout specification.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @param time the number of ticks before the operation fails
|
* @param time the number of ticks before the operation fails
|
||||||
* @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 using \p chSemReset().
|
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
||||||
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset within the specified
|
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset within the specified
|
||||||
* timeout.
|
* timeout.
|
||||||
* @note The function is available only if the \p CH_USE_SEMAPHORES_TIMEOUT
|
* @note The function is available only if the @p CH_USE_SEMAPHORES_TIMEOUT
|
||||||
* option is enabled in \p chconf.h.
|
* option is enabled in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
|
msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
|
||||||
|
|
||||||
|
@ -158,9 +158,9 @@ msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a signal operation on a semaphore.
|
* Performs a signal operation on a semaphore.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @note The function is available only if the \p CH_USE_SEMAPHORES
|
* @note The function is available only if the @p CH_USE_SEMAPHORES
|
||||||
* option is enabled in \p chconf.h.
|
* option is enabled in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
void chSemSignal(Semaphore *sp) {
|
void chSemSignal(Semaphore *sp) {
|
||||||
|
|
||||||
|
@ -174,9 +174,9 @@ void chSemSignal(Semaphore *sp) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a signal operation on a semaphore.
|
* Performs a signal operation on a semaphore.
|
||||||
* @param sp pointer to a \p Semaphore structure
|
* @param sp pointer to a @p Semaphore structure
|
||||||
* @note The function is available only if the \p CH_USE_SEMAPHORES
|
* @note The function is available only if the @p CH_USE_SEMAPHORES
|
||||||
* option is enabled in \p chconf.h.
|
* option is enabled in @p chconf.h.
|
||||||
* @note This function does not reschedule.
|
* @note This function does not reschedule.
|
||||||
*/
|
*/
|
||||||
void chSemSignalI(Semaphore *sp) {
|
void chSemSignalI(Semaphore *sp) {
|
||||||
|
@ -193,12 +193,12 @@ void chSemSignalI(Semaphore *sp) {
|
||||||
#ifdef CH_USE_SEMSW
|
#ifdef CH_USE_SEMSW
|
||||||
/**
|
/**
|
||||||
* Performs atomic signal and wait operations on two semaphores.
|
* Performs atomic signal and wait operations on two semaphores.
|
||||||
* @param sps pointer to a \p Semaphore structure to be signaled
|
* @param sps pointer to a @p Semaphore structure to be signaled
|
||||||
* @param spw pointer to a \p Semaphore structure to be wait on
|
* @param spw pointer to a @p Semaphore structure 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 using \p chSemReset().
|
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
||||||
* @note The function is available only if the \p CH_USE_SEMSW
|
* @note The function is available only if the @p CH_USE_SEMSW
|
||||||
* option is enabled in \p chconf.h.
|
* option is enabled in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) {
|
msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
|
|
|
@ -29,15 +29,15 @@
|
||||||
* Initializes a generic full duplex driver. The HW dependent part of the
|
* Initializes a generic full duplex driver. The HW dependent part of the
|
||||||
* initialization has to be performed outside, usually in the hardware
|
* initialization has to be performed outside, usually in the hardware
|
||||||
* initialization code.
|
* initialization code.
|
||||||
* @param sd pointer to a \p FullDuplexDriver structure
|
* @param sd pointer to a @p FullDuplexDriver structure
|
||||||
* @param ib pointer to a memory area allocated for the Input Queue buffer
|
* @param ib pointer to a memory area allocated for the Input Queue buffer
|
||||||
* @param isize size of the Input Queue buffer
|
* @param isize size of the Input Queue buffer
|
||||||
* @param inotify pointer to a callback function that is invoked when
|
* @param inotify pointer to a callback function that is invoked when
|
||||||
* some data is read from the Queue. The value can be \p NULL.
|
* some data is read from the Queue. The value can be @p NULL.
|
||||||
* @param ob pointer to a memory area allocated for the Output Queue buffer
|
* @param ob pointer to a memory area allocated for the Output Queue buffer
|
||||||
* @param osize size of the Output Queue buffer
|
* @param osize size of the Output Queue buffer
|
||||||
* @param onotify pointer to a callback function that is invoked when
|
* @param onotify pointer to a callback function that is invoked when
|
||||||
* some data is written in the Queue. The value can be \p NULL.
|
* some data is written in the Queue. The value can be @p NULL.
|
||||||
*/
|
*/
|
||||||
void chFDDInit(FullDuplexDriver *sd,
|
void chFDDInit(FullDuplexDriver *sd,
|
||||||
uint8_t *ib, size_t isize, qnotify_t inotify,
|
uint8_t *ib, size_t isize, qnotify_t inotify,
|
||||||
|
@ -54,7 +54,7 @@ void chFDDInit(FullDuplexDriver *sd,
|
||||||
/**
|
/**
|
||||||
* This function must be called from the input interrupt service routine in
|
* This function must be called from the input interrupt service routine in
|
||||||
* order to enqueue incoming data and generate the related events.
|
* order to enqueue incoming data and generate the related events.
|
||||||
* @param sd pointer to a \p FullDuplexDriver structure
|
* @param sd pointer to a @p FullDuplexDriver structure
|
||||||
* @param b the byte to be written in the driver's Input Queue
|
* @param b the byte to be written in the driver's Input Queue
|
||||||
*/
|
*/
|
||||||
void chFDDIncomingDataI(FullDuplexDriver *sd, uint8_t b) {
|
void chFDDIncomingDataI(FullDuplexDriver *sd, uint8_t b) {
|
||||||
|
@ -69,7 +69,7 @@ void chFDDIncomingDataI(FullDuplexDriver *sd, uint8_t b) {
|
||||||
* Must be called from the output interrupt service routine in order to get
|
* Must be called from the output interrupt service routine in order to get
|
||||||
* the next byte to be transmitted.
|
* the next byte to be transmitted.
|
||||||
*
|
*
|
||||||
* @param sd pointer to a \p FullDuplexDriver structure
|
* @param sd pointer to a @p FullDuplexDriver structure
|
||||||
* @return The byte value read from the driver's output queue.
|
* @return The byte value read from the driver's output queue.
|
||||||
* @retval Q_EMPTY if the queue is empty (the lower driver usually disables
|
* @retval Q_EMPTY if the queue is empty (the lower driver usually disables
|
||||||
* the interrupt source when this happens).
|
* the interrupt source when this happens).
|
||||||
|
@ -85,7 +85,7 @@ msg_t chFDDRequestDataI(FullDuplexDriver *sd) {
|
||||||
/**
|
/**
|
||||||
* Must be called from the I/O interrupt service routine in order to
|
* Must be called from the I/O interrupt service routine in order to
|
||||||
* notify I/O conditions as errors, signals change etc.
|
* notify I/O conditions as errors, signals change etc.
|
||||||
* @param sd pointer to a \p FullDuplexDriver structure
|
* @param sd pointer to a @p FullDuplexDriver structure
|
||||||
* @param mask condition flags to be added to the mask
|
* @param mask condition flags to be added to the mask
|
||||||
*/
|
*/
|
||||||
void chFDDAddFlagsI(FullDuplexDriver *sd, dflags_t mask) {
|
void chFDDAddFlagsI(FullDuplexDriver *sd, dflags_t mask) {
|
||||||
|
@ -96,7 +96,7 @@ void chFDDAddFlagsI(FullDuplexDriver *sd, dflags_t mask) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns and clears the errors mask associated to the driver.
|
* This function returns and clears the errors mask associated to the driver.
|
||||||
* @param sd pointer to a \p FullDuplexDriver structure
|
* @param sd pointer to a @p FullDuplexDriver structure
|
||||||
* @return The condition flags modified since last time this function was
|
* @return The condition flags modified since last time this function was
|
||||||
* invoked.
|
* invoked.
|
||||||
*/
|
*/
|
||||||
|
@ -114,13 +114,13 @@ dflags_t chFDDGetAndClearFlags(FullDuplexDriver *sd) {
|
||||||
* Initializes a generic half duplex driver. The HW dependent part of the
|
* Initializes a generic half duplex driver. The HW dependent part of the
|
||||||
* initialization has to be performed outside, usually in the hardware
|
* initialization has to be performed outside, usually in the hardware
|
||||||
* initialization code.
|
* initialization code.
|
||||||
* @param sd pointer to a \p HalfDuplexDriver structure
|
* @param sd pointer to a @p HalfDuplexDriver structure
|
||||||
* @param b pointer to a memory area allocated for the queue buffer
|
* @param b pointer to a memory area allocated for the queue buffer
|
||||||
* @param size the buffer size
|
* @param size the buffer size
|
||||||
* @param inotify pointer to a callback function that is invoked when
|
* @param inotify pointer to a callback function that is invoked when
|
||||||
* some data is read from the queue. The value can be \p NULL.
|
* some data is read from the queue. The value can be @p NULL.
|
||||||
* @param onotify pointer to a callback function that is invoked when
|
* @param onotify pointer to a callback function that is invoked when
|
||||||
* some data is written in the queue. The value can be \p NULL.
|
* some data is written in the queue. The value can be @p NULL.
|
||||||
*/
|
*/
|
||||||
void chHDDInit(HalfDuplexDriver *sd, uint8_t *b, size_t size,
|
void chHDDInit(HalfDuplexDriver *sd, uint8_t *b, size_t size,
|
||||||
qnotify_t inotify, qnotify_t onotify) {
|
qnotify_t inotify, qnotify_t onotify) {
|
||||||
|
@ -135,7 +135,7 @@ void chHDDInit(HalfDuplexDriver *sd, uint8_t *b, size_t size,
|
||||||
/**
|
/**
|
||||||
* This function must be called from the input interrupt service routine in
|
* This function must be called from the input interrupt service routine in
|
||||||
* order to enqueue incoming data and generate the related events.
|
* order to enqueue incoming data and generate the related events.
|
||||||
* @param sd pointer to a \p FullDuplexDriver structure
|
* @param sd pointer to a @p FullDuplexDriver structure
|
||||||
* @param b the byte to be written in the driver's input queue
|
* @param b the byte to be written in the driver's input queue
|
||||||
*/
|
*/
|
||||||
void chHDDIncomingDataI(HalfDuplexDriver *sd, uint8_t b) {
|
void chHDDIncomingDataI(HalfDuplexDriver *sd, uint8_t b) {
|
||||||
|
@ -150,7 +150,7 @@ void chHDDIncomingDataI(HalfDuplexDriver *sd, uint8_t b) {
|
||||||
* Must be called from the output interrupt service routine in order to get
|
* Must be called from the output interrupt service routine in order to get
|
||||||
* the next byte to be transmitted.
|
* the next byte to be transmitted.
|
||||||
*
|
*
|
||||||
* @param sd pointer to a \p HalfDuplexDriver structure
|
* @param sd pointer to a @p HalfDuplexDriver structure
|
||||||
* @return The byte value read from the driver's output queue.
|
* @return The byte value read from the driver's output queue.
|
||||||
* @retval Q_EMPTY if the queue is empty (the lower driver usually disables
|
* @retval Q_EMPTY if the queue is empty (the lower driver usually disables
|
||||||
* the interrupt source when this happens).
|
* the interrupt source when this happens).
|
||||||
|
@ -166,7 +166,7 @@ msg_t chHDDRequestDataI(HalfDuplexDriver *sd) {
|
||||||
/**
|
/**
|
||||||
* Must be called from the I/O interrupt service routine in order to
|
* Must be called from the I/O interrupt service routine in order to
|
||||||
* notify I/O conditions as errors, signals change etc.
|
* notify I/O conditions as errors, signals change etc.
|
||||||
* @param sd pointer to a \p HalfDuplexDriver structure
|
* @param sd pointer to a @p HalfDuplexDriver structure
|
||||||
* @param mask condition flags to be added to the mask
|
* @param mask condition flags to be added to the mask
|
||||||
*/
|
*/
|
||||||
void chHDDAddFlagsI(HalfDuplexDriver *sd, dflags_t mask) {
|
void chHDDAddFlagsI(HalfDuplexDriver *sd, dflags_t mask) {
|
||||||
|
@ -177,7 +177,7 @@ void chHDDAddFlagsI(HalfDuplexDriver *sd, dflags_t mask) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns and clears the errors mask associated to the driver.
|
* This function returns and clears the errors mask associated to the driver.
|
||||||
* @param sd pointer to a \p HalfDuplexDriver structure
|
* @param sd pointer to a @p HalfDuplexDriver structure
|
||||||
* @return The condition flags modified since last time this function was
|
* @return The condition flags modified since last time this function was
|
||||||
* invoked.
|
* invoked.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,9 +45,9 @@ static void idle_thread(void *p) {
|
||||||
/**
|
/**
|
||||||
* ChibiOS/RT initialization. After executing this function the current
|
* ChibiOS/RT initialization. After executing this function the current
|
||||||
* instructions stream becomes the main thread.
|
* instructions stream becomes the main thread.
|
||||||
* @note Interrupts should be still disabled when \p chSysInit() is invoked
|
* @note Interrupts should be still disabled when @p chSysInit() is invoked
|
||||||
* and are internally enabled.
|
* and are internally enabled.
|
||||||
* @note The main thread is created with priority \p NORMALPRIO.
|
* @note The main thread is created with priority @p NORMALPRIO.
|
||||||
*/
|
*/
|
||||||
void chSysInit(void) {
|
void chSysInit(void) {
|
||||||
static Thread mainthread;
|
static Thread mainthread;
|
||||||
|
@ -81,7 +81,7 @@ void chSysInit(void) {
|
||||||
* it when the quantum is used up. Increments system time and manages the
|
* it when the quantum is used up. Increments system time and manages the
|
||||||
* timers.
|
* timers.
|
||||||
* @note The frequency of the timer determines the system tick granularity and,
|
* @note The frequency of the timer determines the system tick granularity and,
|
||||||
* together with the \p CH_TIME_QUANTUM macro, the round robin interval.
|
* together with the @p CH_TIME_QUANTUM macro, the round robin interval.
|
||||||
*/
|
*/
|
||||||
void chSysTimerHandlerI(void) {
|
void chSysTimerHandlerI(void) {
|
||||||
|
|
||||||
|
|
|
@ -66,17 +66,17 @@ static void memfill(uint8_t *p, uint32_t n, uint8_t v) {
|
||||||
/**
|
/**
|
||||||
* Initializes a new thread.
|
* Initializes a new thread.
|
||||||
* The new thread is initialized but not inserted in the ready list, the
|
* The new thread is initialized but not inserted in the ready list, the
|
||||||
* initial state is \p PRSUSPENDED.
|
* initial state is @p PRSUSPENDED.
|
||||||
* @param prio the priority level for the new thread. Usually the threads are
|
* @param prio the priority level for the new thread. Usually the threads are
|
||||||
* created with priority \p NORMALPRIO, priorities
|
* created with priority @p NORMALPRIO, priorities
|
||||||
* can range from \p LOWPRIO to \p HIGHPRIO.
|
* can range from @p LOWPRIO to @p HIGHPRIO.
|
||||||
* @param workspace pointer to a working area dedicated to the thread stack
|
* @param workspace pointer to a working area dedicated to the thread stack
|
||||||
* @param wsize size of the working area.
|
* @param wsize size of the working area.
|
||||||
* @param pf the thread function
|
* @param pf the thread function
|
||||||
* @param arg an argument passed to the thread function. It can be \p NULL.
|
* @param arg an argument passed to the thread function. It can be @p NULL.
|
||||||
* @return The pointer to the \p Thread structure allocated for the
|
* @return The pointer to the @p Thread structure allocated for the
|
||||||
* thread into the working space area.
|
* thread into the working space area.
|
||||||
* @note A thread can terminate by calling \p chThdExit() or by simply
|
* @note A thread can terminate by calling @p chThdExit() or by simply
|
||||||
* returning from its main function.
|
* returning from its main function.
|
||||||
* @note This function can be invoked from within an interrupt handler.
|
* @note This function can be invoked from within an interrupt handler.
|
||||||
*/
|
*/
|
||||||
|
@ -100,13 +100,13 @@ Thread *chThdInit(void *workspace, size_t wsize,
|
||||||
* @param workspace pointer to a working area dedicated to the thread stack
|
* @param workspace pointer to a working area dedicated to the thread stack
|
||||||
* @param wsize size of the working area.
|
* @param wsize size of the working area.
|
||||||
* @param prio the priority level for the new thread. Usually the threads are
|
* @param prio the priority level for the new thread. Usually the threads are
|
||||||
* created with priority \p NORMALPRIO, priorities
|
* created with priority @p NORMALPRIO, priorities
|
||||||
* can range from \p LOWPRIO to \p HIGHPRIO.
|
* can range from @p LOWPRIO to @p HIGHPRIO.
|
||||||
* @param pf the thread function
|
* @param pf the thread function
|
||||||
* @param arg an argument passed to the thread function. It can be \p NULL.
|
* @param arg an argument passed to the thread function. It can be @p NULL.
|
||||||
* @return The pointer to the \p Thread structure allocated for the
|
* @return The pointer to the @p Thread structure allocated for the
|
||||||
* thread into the working space area.
|
* thread into the working space area.
|
||||||
* @note A thread can terminate by calling \p chThdExit() or by simply
|
* @note A thread can terminate by calling @p chThdExit() or by simply
|
||||||
* returning from its main function.
|
* returning from its main function.
|
||||||
*/
|
*/
|
||||||
Thread *chThdCreateStatic(void *workspace, size_t wsize,
|
Thread *chThdCreateStatic(void *workspace, size_t wsize,
|
||||||
|
@ -120,20 +120,20 @@ Thread *chThdCreateStatic(void *workspace, size_t wsize,
|
||||||
* Creates a new thread allocating the memory from the heap.
|
* Creates a new thread allocating the memory from the heap.
|
||||||
* @param wsize size of the working area to be allocated
|
* @param wsize size of the working area to be allocated
|
||||||
* @param prio the priority level for the new thread. Usually the threads are
|
* @param prio the priority level for the new thread. Usually the threads are
|
||||||
* created with priority \p NORMALPRIO, priorities
|
* created with priority @p NORMALPRIO, priorities
|
||||||
* can range from \p LOWPRIO to \p HIGHPRIO.
|
* can range from @p LOWPRIO to @p HIGHPRIO.
|
||||||
* @param pf the thread function
|
* @param pf the thread function
|
||||||
* @param arg an argument passed to the thread function. It can be \p NULL.
|
* @param arg an argument passed to the thread function. It can be @p NULL.
|
||||||
* @return The pointer to the \p Thread structure allocated for the
|
* @return The pointer to the @p Thread structure allocated for the
|
||||||
* thread into the working space area.
|
* thread into the working space area.
|
||||||
* @retval NULL if the memory cannot be allocated.
|
* @retval NULL if the memory cannot be allocated.
|
||||||
* @note A thread can terminate by calling \p chThdExit() or by simply
|
* @note A thread can terminate by calling @p chThdExit() or by simply
|
||||||
* returning from its main function.
|
* returning from its main function.
|
||||||
* @note The memory allocated for the thread is not released when the thread
|
* @note The memory allocated for the thread is not released when the thread
|
||||||
* terminates but when a \p chThdWait() is performed.
|
* terminates but when a @p chThdWait() is performed.
|
||||||
* @note The function is available only if the \p CH_USE_DYNAMIC,
|
* @note The function is available only if the @p CH_USE_DYNAMIC,
|
||||||
* \p CH_USE_HEAP and \p CH_USE_WAITEXIT options are enabled
|
* @p CH_USE_HEAP and @p CH_USE_WAITEXIT options are enabled
|
||||||
* in \p chconf.h.
|
* in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
Thread *chThdCreateFromHeap(size_t wsize, tprio_t prio,
|
Thread *chThdCreateFromHeap(size_t wsize, tprio_t prio,
|
||||||
tfunc_t pf, void *arg) {
|
tfunc_t pf, void *arg) {
|
||||||
|
@ -152,21 +152,21 @@ Thread *chThdCreateFromHeap(size_t wsize, tprio_t prio,
|
||||||
* Creates a new thread allocating the memory from the specified Memory Pool.
|
* Creates a new thread allocating the memory from the specified Memory Pool.
|
||||||
* @param mp the memory pool
|
* @param mp the memory pool
|
||||||
* @param prio the priority level for the new thread. Usually the threads are
|
* @param prio the priority level for the new thread. Usually the threads are
|
||||||
* created with priority \p NORMALPRIO, priorities
|
* created with priority @p NORMALPRIO, priorities
|
||||||
* can range from \p LOWPRIO to \p HIGHPRIO.
|
* can range from @p LOWPRIO to @p HIGHPRIO.
|
||||||
* @param pf the thread function
|
* @param pf the thread function
|
||||||
* @param arg an argument passed to the thread function. It can be \p NULL.
|
* @param arg an argument passed to the thread function. It can be @p NULL.
|
||||||
* @return The pointer to the \p Thread structure allocated for the
|
* @return The pointer to the @p Thread structure allocated for the
|
||||||
* thread into the working space area or \p NULL if the memory cannot
|
* thread into the working space area or @p NULL if the memory cannot
|
||||||
* be allocated.
|
* be allocated.
|
||||||
* @retval NULL if the memory pool is empty.
|
* @retval NULL if the memory pool is empty.
|
||||||
* @note A thread can terminate by calling \p chThdExit() or by simply
|
* @note A thread can terminate by calling @p chThdExit() or by simply
|
||||||
* returning from its main function.
|
* returning from its main function.
|
||||||
* @note The memory allocated for the thread is not released when the thread
|
* @note The memory allocated for the thread is not released when the thread
|
||||||
* terminates but when a \p chThdWait() is performed.
|
* terminates but when a @p chThdWait() is performed.
|
||||||
* @note The function is available only if the \p CH_USE_DYNAMIC,
|
* @note The function is available only if the @p CH_USE_DYNAMIC,
|
||||||
* \p CH_USE_MEMPOOLS and \p CH_USE_WAITEXIT options are enabled
|
* @p CH_USE_MEMPOOLS and @p CH_USE_WAITEXIT options are enabled
|
||||||
* in \p chconf.h.
|
* in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
|
Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
|
||||||
tfunc_t pf, void *arg) {
|
tfunc_t pf, void *arg) {
|
||||||
|
@ -210,9 +210,9 @@ void chThdSetPriority(tprio_t newprio) {
|
||||||
/**
|
/**
|
||||||
* Suspends the invoking thread.
|
* Suspends the invoking thread.
|
||||||
*
|
*
|
||||||
* @param tpp pointer to a \p Thread pointer, the \p Thread pointer is set
|
* @param tpp pointer to a @p Thread pointer, the @p Thread pointer is set
|
||||||
* to point to the suspended process before it enters the
|
* to point to the suspended process before it enters the
|
||||||
* \p PRSUSPENDED state, it is set to \p NULL after it is resumed.
|
* @p PRSUSPENDED state, it is set to @p NULL after it is resumed.
|
||||||
* This allows to implement a "test and resume" on the variable
|
* This allows to implement a "test and resume" on the variable
|
||||||
* into interrupt handlers.
|
* into interrupt handlers.
|
||||||
*/
|
*/
|
||||||
|
@ -244,8 +244,8 @@ Thread *chThdResume(Thread *tp) {
|
||||||
* Requests a thread termination.
|
* Requests a thread termination.
|
||||||
* @param tp the pointer to the thread
|
* @param tp the pointer to the thread
|
||||||
* @note The thread is not termitated but a termination request is added to
|
* @note The thread is not termitated but a termination request is added to
|
||||||
* its \p p_flags field. The thread can read this status by
|
* its @p p_flags field. The thread can read this status by
|
||||||
* invoking \p chThdShouldTerminate() and then terminate cleanly.
|
* invoking @p chThdShouldTerminate() and then terminate cleanly.
|
||||||
*/
|
*/
|
||||||
void chThdTerminate(Thread *tp) {
|
void chThdTerminate(Thread *tp) {
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ void chThdSleepUntil(systime_t time) {
|
||||||
* Terminates the current thread by specifying an exit status code.
|
* Terminates the current thread by specifying an exit status code.
|
||||||
*
|
*
|
||||||
* @param msg the thread exit code. The code can be retrieved by using
|
* @param msg the thread exit code. The code can be retrieved by using
|
||||||
* \p chThdWait().
|
* @p chThdWait().
|
||||||
*/
|
*/
|
||||||
void chThdExit(msg_t msg) {
|
void chThdExit(msg_t msg) {
|
||||||
Thread *tp = currp;
|
Thread *tp = currp;
|
||||||
|
@ -304,20 +304,20 @@ void chThdExit(msg_t msg) {
|
||||||
* The memory used by the exited thread is handled in different ways depending
|
* The memory used by the exited thread is handled in different ways depending
|
||||||
* on the API that spawned the thread:
|
* on the API that spawned the thread:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>If the thread was spawned by \p chThdCreateStatic() or by \p chThdInit()
|
* <li>If the thread was spawned by @p chThdCreateStatic() or by @p chThdInit()
|
||||||
* then nothing happens and the thread working area is not released or
|
* then nothing happens and the thread working area is not released or
|
||||||
* modified in any way. This is the default, totally static, behavior.</li>
|
* modified in any way. This is the default, totally static, behavior.</li>
|
||||||
* <li>If the thread was spawned by \p chThdCreateFromHeap() then the working
|
* <li>If the thread was spawned by @p chThdCreateFromHeap() then the working
|
||||||
* area is returned to the system heap.</li>
|
* area is returned to the system heap.</li>
|
||||||
* <li>If the thread was spawned by \p chThdCreateFromMemoryPool() then the
|
* <li>If the thread was spawned by @p chThdCreateFromMemoryPool() then the
|
||||||
* working area is returned to the owning memory pool.</li>
|
* working area is returned to the owning memory pool.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param tp the thread pointer
|
* @param tp the thread pointer
|
||||||
* @return The exit code from the terminated thread
|
* @return The exit code from the terminated thread
|
||||||
* @note After invoking \p chThdWait() the thread pointer becomes invalid and
|
* @note After invoking @p chThdWait() the thread pointer becomes invalid and
|
||||||
* must not be used as parameter for further system calls.
|
* must not be used as parameter for further system calls.
|
||||||
* @note The function is available only if the \p CH_USE_WAITEXIT
|
* @note The function is available only if the @p CH_USE_WAITEXIT
|
||||||
* option is enabled in \p chconf.h.
|
* option is enabled in @p chconf.h.
|
||||||
* @note Only one thread can be waiting for another thread at any time. You
|
* @note Only one thread can be waiting for another thread at any time. You
|
||||||
* should imagine the threads as having a reference counter that is set
|
* should imagine the threads as having a reference counter that is set
|
||||||
* to one when the thread is created, chThdWait() decreases the reference
|
* to one when the thread is created, chThdWait() decreases the reference
|
||||||
|
|
|
@ -39,7 +39,7 @@ void chVTInit(void) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables a virtual timer.
|
* Enables a virtual timer.
|
||||||
* @param vtp the \p VirtualTimer structure pointer
|
* @param vtp the @p VirtualTimer structure pointer
|
||||||
* @param time the number of time ticks, the value zero is not allowed
|
* @param time the number of time ticks, the value zero is not allowed
|
||||||
* @param vtfunc the timer callback function. After invoking the callback
|
* @param vtfunc the timer callback function. After invoking the callback
|
||||||
* the timer is disabled and the structure can be disposed or
|
* the timer is disabled and the structure can be disposed or
|
||||||
|
@ -70,7 +70,7 @@ void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables a Virtual Timer.
|
* Disables a Virtual Timer.
|
||||||
* @param vtp the \p VirtualTimer structure pointer
|
* @param vtp the @p VirtualTimer structure pointer
|
||||||
* @note It must be called with the interrupts disabled.
|
* @note It must be called with the interrupts disabled.
|
||||||
* @note The timer MUST be active when this function is invoked.
|
* @note The timer MUST be active when this function is invoked.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -67,8 +67,8 @@ extern "C" {
|
||||||
* with the specified message.
|
* with the specified message.
|
||||||
* @param c the condition to be verified to be true
|
* @param c the condition to be verified to be true
|
||||||
* @param m the text message
|
* @param m the text message
|
||||||
* @note The condition is tested only if the \p CH_USE_DEBUG switch is
|
* @note The condition is tested only if the @p CH_USE_DEBUG switch is
|
||||||
* specified in \p chconf.h else the macro does nothing.
|
* specified in @p chconf.h else the macro does nothing.
|
||||||
*/
|
*/
|
||||||
#define chDbgAssert(c, m) { \
|
#define chDbgAssert(c, m) { \
|
||||||
if (!(c)) \
|
if (!(c)) \
|
||||||
|
|
|
@ -57,16 +57,16 @@ typedef struct EventSource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an Event Source.
|
* Initializes an Event Source.
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the @p EventSource structure
|
||||||
* @note Can be called with interrupts disabled or enabled.
|
* @note Can be called with interrupts disabled or enabled.
|
||||||
*/
|
*/
|
||||||
#define chEvtInit(esp) \
|
#define chEvtInit(esp) \
|
||||||
((esp)->es_next = (EventListener *)(void *)(esp))
|
((esp)->es_next = (EventListener *)(void *)(esp))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies if there is at least one \p EventListener registered on the
|
* Verifies if there is at least one @p EventListener registered on the
|
||||||
* \p EventSource.
|
* @p EventSource.
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the @p EventSource structure
|
||||||
* @note Can be called with interrupts disabled or enabled.
|
* @note Can be called with interrupts disabled or enabled.
|
||||||
*/
|
*/
|
||||||
#define chEvtIsListening(esp) \
|
#define chEvtIsListening(esp) \
|
||||||
|
@ -101,12 +101,12 @@ extern "C" {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an Event Listener on an Event Source.
|
* Registers an Event Listener on an Event Source.
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the @p EventSource structure
|
||||||
* @param elp pointer to the \p EventListener structure
|
* @param elp pointer to the @p EventListener structure
|
||||||
* @param eid numeric identifier assigned to the Event Listener. The identifier
|
* @param eid numeric identifier assigned to the Event Listener. The identifier
|
||||||
* is used as index for the event callback function.
|
* is used as index for the event callback function.
|
||||||
* The value must range between zero and the size, in bit, of the
|
* The value must range between zero and the size, in bit, of the
|
||||||
* \p eventid_t type minus one.
|
* @p eventid_t type minus one.
|
||||||
* @note Multiple Event Listeners can use the same event identifier, the
|
* @note Multiple Event Listeners can use the same event identifier, the
|
||||||
* listener will share the callback function.
|
* listener will share the callback function.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,9 +36,9 @@ typedef struct Thread Thread;
|
||||||
* @extends ThreadsList
|
* @extends ThreadsList
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** First \p Thread in the queue, or \p ThreadQueue when empty. */
|
/** First @p Thread in the queue, or @p ThreadQueue when empty. */
|
||||||
Thread *p_next;
|
Thread *p_next;
|
||||||
/** Last \p Thread in the queue, or \p ThreadQueue when empty. */
|
/** Last @p Thread in the queue, or @p ThreadQueue when empty. */
|
||||||
Thread *p_prev;
|
Thread *p_prev;
|
||||||
} ThreadsQueue;
|
} ThreadsQueue;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ typedef struct {
|
||||||
* Generic threads single link list, it works like a stack.
|
* Generic threads single link list, it works like a stack.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Last pushed \p Thread on the stack list, or \p ThreadList when empty. */
|
/** Last pushed @p Thread on the stack list, or @p ThreadList when empty. */
|
||||||
Thread *p_next;
|
Thread *p_next;
|
||||||
} ThreadsList;
|
} ThreadsList;
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
typedef struct Mutex {
|
typedef struct Mutex {
|
||||||
/** Queue of the threads sleeping on this Mutex.*/
|
/** Queue of the threads sleeping on this Mutex.*/
|
||||||
ThreadsQueue m_queue;
|
ThreadsQueue m_queue;
|
||||||
/** Owner \p Thread pointer or \p NULL.*/
|
/** Owner @p Thread pointer or @p NULL.*/
|
||||||
Thread *m_owner;
|
Thread *m_owner;
|
||||||
/** Next \p Mutex into an owner-list, \p NULL if none.*/
|
/** Next @p Mutex into an owner-list, @p NULL if none.*/
|
||||||
struct Mutex *m_next;
|
struct Mutex *m_next;
|
||||||
} Mutex;
|
} Mutex;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns \p TRUE if the mutex queue contains at least a waiting thread.
|
* Returns @p TRUE if the mutex queue contains at least a waiting thread.
|
||||||
*/
|
*/
|
||||||
#define chMtxQueueNotEmptyS(mp) notempty(&(mp)->m_queue)
|
#define chMtxQueueNotEmptyS(mp) notempty(&(mp)->m_queue)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#ifndef _SCHEDULER_H_
|
#ifndef _SCHEDULER_H_
|
||||||
#define _SCHEDULER_H_
|
#define _SCHEDULER_H_
|
||||||
|
|
||||||
/** Normal \p chSchReadyI() message. */
|
/** Normal @p chSchReadyI() message. */
|
||||||
#define RDY_OK 0
|
#define RDY_OK 0
|
||||||
/** Returned when the thread was made ready because of a timeout. */
|
/** Returned when the thread was made ready because of a timeout. */
|
||||||
#define RDY_TIMEOUT -1
|
#define RDY_TIMEOUT -1
|
||||||
|
@ -57,9 +57,9 @@
|
||||||
* @extends ThreadsQueue
|
* @extends ThreadsQueue
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Next \p Thread in the ready list.*/
|
/** Next @p Thread in the ready list.*/
|
||||||
Thread *p_next;
|
Thread *p_next;
|
||||||
/** Previous \p Thread in the ready list.*/
|
/** Previous @p Thread in the ready list.*/
|
||||||
Thread *p_prev;
|
Thread *p_prev;
|
||||||
/* End of the fields shared with the ThreadsQueue structure. */
|
/* End of the fields shared with the ThreadsQueue structure. */
|
||||||
/** The thread priority.*/
|
/** The thread priority.*/
|
||||||
|
|
|
@ -53,21 +53,21 @@ typedef struct {
|
||||||
/** Input queue. Incoming data can be read from this queue by using the
|
/** Input queue. Incoming data can be read from this queue by using the
|
||||||
* queues APIs.*/
|
* queues APIs.*/
|
||||||
Queue sd_iqueue;
|
Queue sd_iqueue;
|
||||||
/** Data Available \p EventSource. This event is generated when some incoming
|
/** Data Available @p EventSource. This event is generated when some incoming
|
||||||
* data is inserted in the Input \p Queue.*/
|
* data is inserted in the Input @p Queue.*/
|
||||||
EventSource sd_ievent;
|
EventSource sd_ievent;
|
||||||
|
|
||||||
/** Output queue. Outgoing data can be written to this Output \p Queue by
|
/** Output queue. Outgoing data can be written to this Output @p Queue by
|
||||||
* using the queues APIs.*/
|
* using the queues APIs.*/
|
||||||
Queue sd_oqueue;
|
Queue sd_oqueue;
|
||||||
/** Data Transmitted \p EventSource. This event is generated when the
|
/** Data Transmitted @p EventSource. This event is generated when the
|
||||||
* Output \p Queue is empty.*/
|
* Output @p Queue is empty.*/
|
||||||
EventSource sd_oevent;
|
EventSource sd_oevent;
|
||||||
|
|
||||||
/** I/O driver status flags. This field should not be read directly but
|
/** I/O driver status flags. This field should not be read directly but
|
||||||
* the \p chFDDGetAndClearFlags() funtion should be used instead.*/
|
* the @p chFDDGetAndClearFlags() funtion should be used instead.*/
|
||||||
dflags_t sd_flags;
|
dflags_t sd_flags;
|
||||||
/** Status Change \p EventSource. This event is generated when a
|
/** Status Change @p EventSource. This event is generated when a
|
||||||
* condition flag was changed.*/
|
* condition flag was changed.*/
|
||||||
EventSource sd_sevent;
|
EventSource sd_sevent;
|
||||||
} FullDuplexDriver;
|
} FullDuplexDriver;
|
||||||
|
@ -115,17 +115,17 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/** Data queue. Transmit/receive \p HalfDuplexQueue.*/
|
/** Data queue. Transmit/receive @p HalfDuplexQueue.*/
|
||||||
HalfDuplexQueue sd_queue;
|
HalfDuplexQueue sd_queue;
|
||||||
/** Data Available \p EventSource. This event is generated when some
|
/** Data Available @p EventSource. This event is generated when some
|
||||||
* incoming data is inserted in the receive queue.*/
|
* incoming data is inserted in the receive queue.*/
|
||||||
EventSource sd_ievent;
|
EventSource sd_ievent;
|
||||||
/** Data Transmitted \p EventSource. This event is generated when the
|
/** Data Transmitted @p EventSource. This event is generated when the
|
||||||
* transmission queue is empty and the driver can either transmit more
|
* transmission queue is empty and the driver can either transmit more
|
||||||
* data or enter receive mode.*/
|
* data or enter receive mode.*/
|
||||||
EventSource sd_oevent;
|
EventSource sd_oevent;
|
||||||
/** I/O driver status flags. This field should not be read directly but
|
/** I/O driver status flags. This field should not be read directly but
|
||||||
* the \p chHDDGetAndClearFlags() funtion should be used
|
* the @p chHDDGetAndClearFlags() funtion should be used
|
||||||
* instead.*/
|
* instead.*/
|
||||||
dflags_t sd_flags;
|
dflags_t sd_flags;
|
||||||
/** Status Change Event Source. This event is generated when a condition
|
/** Status Change Event Source. This event is generated when a condition
|
||||||
|
|
|
@ -154,7 +154,7 @@
|
||||||
* IRQ handler exit code.
|
* IRQ handler exit code.
|
||||||
* @note Usually IRQ handlers function are also declared naked.
|
* @note Usually IRQ handlers function are also declared naked.
|
||||||
* @note This macro usually performs the final reschedulation by using
|
* @note This macro usually performs the final reschedulation by using
|
||||||
* \p chSchRescRequiredI() and \p chSchDoRescheduleI().
|
* @p chSchRescRequiredI() and @p chSchDoRescheduleI().
|
||||||
*/
|
*/
|
||||||
#define CH_IRQ_EPILOGUE() SYS_IRQ_EPILOGUE()
|
#define CH_IRQ_EPILOGUE() SYS_IRQ_EPILOGUE()
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,13 @@
|
||||||
* @extends ThreadsQueue
|
* @extends ThreadsQueue
|
||||||
* @note Not all the listed fields are always needed, by switching off some
|
* @note Not all the listed fields are always needed, by switching off some
|
||||||
* not needed ChibiOS/RT subsystems it is possible to save RAM space by
|
* not needed ChibiOS/RT subsystems it is possible to save RAM space by
|
||||||
* shrinking the \p Thread structure.
|
* shrinking the @p Thread structure.
|
||||||
*/
|
*/
|
||||||
struct Thread {
|
struct Thread {
|
||||||
/** Next \p Thread in the threads list.*/
|
/** Next @p Thread in the threads list.*/
|
||||||
Thread *p_next;
|
Thread *p_next;
|
||||||
/* End of the fields shared with the ThreadsList structure. */
|
/* End of the fields shared with the ThreadsList structure. */
|
||||||
/** Previous \p Thread in the threads list.*/
|
/** Previous @p Thread in the threads list.*/
|
||||||
Thread *p_prev;
|
Thread *p_prev;
|
||||||
/* End of the fields shared with the ThreadsQueue structure. */
|
/* End of the fields shared with the ThreadsQueue structure. */
|
||||||
/** The thread priority.*/
|
/** The thread priority.*/
|
||||||
|
@ -59,28 +59,28 @@ struct Thread {
|
||||||
* thread in the system.
|
* thread in the system.
|
||||||
*/
|
*/
|
||||||
union {
|
union {
|
||||||
/** Thread wakeup code (only valid when exiting the \p PRREADY state).*/
|
/** Thread wakeup code (only valid when exiting the @p PRREADY state).*/
|
||||||
msg_t p_rdymsg;
|
msg_t p_rdymsg;
|
||||||
/** The thread exit code (only while in \p PREXIT state).*/
|
/** The thread exit code (only while in @p PREXIT state).*/
|
||||||
msg_t p_exitcode;
|
msg_t p_exitcode;
|
||||||
#ifdef CH_USE_SEMAPHORES
|
#ifdef CH_USE_SEMAPHORES
|
||||||
/** Semaphore where the thread is waiting on (only in \p PRWTSEM state).*/
|
/** Semaphore where the thread is waiting on (only in @p PRWTSEM state).*/
|
||||||
Semaphore *p_wtsemp;
|
Semaphore *p_wtsemp;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CH_USE_MUTEXES
|
#ifdef CH_USE_MUTEXES
|
||||||
/** Mutex where the thread is waiting on (only in \p PRWTMTX state).*/
|
/** Mutex where the thread is waiting on (only in @p PRWTMTX state).*/
|
||||||
Mutex *p_wtmtxp;
|
Mutex *p_wtmtxp;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CH_USE_CONDVARS
|
#ifdef CH_USE_CONDVARS
|
||||||
/** CondVar where the thread is waiting on (only in \p PRWTCOND state).*/
|
/** CondVar where the thread is waiting on (only in @p PRWTCOND state).*/
|
||||||
CondVar *p_wtcondp;
|
CondVar *p_wtcondp;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CH_USE_MESSAGES
|
#ifdef CH_USE_MESSAGES
|
||||||
/** Destination thread for message send (only in \p PRSNDMSG state).*/
|
/** Destination thread for message send (only in @p PRSNDMSG state).*/
|
||||||
Thread *p_wtthdp;
|
Thread *p_wtthdp;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CH_USE_EVENTS
|
#ifdef CH_USE_EVENTS
|
||||||
/** Enabled events mask (only while in \p PRWTOREVT or \p PRWTANDEVT
|
/** Enabled events mask (only while in @p PRWTOREVT or @p PRWTANDEVT
|
||||||
states). */
|
states). */
|
||||||
eventmask_t p_ewmask;
|
eventmask_t p_ewmask;
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,7 +106,7 @@ struct Thread {
|
||||||
eventmask_t p_epending;
|
eventmask_t p_epending;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CH_USE_MUTEXES
|
#ifdef CH_USE_MUTEXES
|
||||||
/** List of mutexes owned by this thread, \p NULL terminated. */
|
/** List of mutexes owned by this thread, @p NULL terminated. */
|
||||||
Mutex *p_mtxlist;
|
Mutex *p_mtxlist;
|
||||||
/** Thread's own, non-inherited, priority. */
|
/** Thread's own, non-inherited, priority. */
|
||||||
tprio_t p_realprio;
|
tprio_t p_realprio;
|
||||||
|
@ -129,20 +129,20 @@ struct Thread {
|
||||||
#define PRWTSEM 3
|
#define PRWTSEM 3
|
||||||
/** Thread state: Waiting on a mutex. */
|
/** Thread state: Waiting on a mutex. */
|
||||||
#define PRWTMTX 4
|
#define PRWTMTX 4
|
||||||
/** Thread state: Waiting in \p chThdSleep() or \p chThdSleepUntil(). */
|
/** Thread state: Waiting in @p chThdSleep() or @p chThdSleepUntil(). */
|
||||||
#define PRWTCOND 5
|
#define PRWTCOND 5
|
||||||
/** Thread state: Waiting in \p chCondWait(). */
|
/** Thread state: Waiting in @p chCondWait(). */
|
||||||
#define PRSLEEP 6
|
#define PRSLEEP 6
|
||||||
/** Thread state: Waiting in \p chThdWait(). */
|
/** Thread state: Waiting in @p chThdWait(). */
|
||||||
#define PRWAIT 7
|
#define PRWAIT 7
|
||||||
/** Thread state: Waiting in \p chEvtWaitOneTimeout() or
|
/** Thread state: Waiting in @p chEvtWaitOneTimeout() or
|
||||||
\p chEvtWaitAnyTimeout(). */
|
@p chEvtWaitAnyTimeout(). */
|
||||||
#define PRWTOREVT 8
|
#define PRWTOREVT 8
|
||||||
/** Thread state: Waiting in \p chEvtWaitAllTimeout(). */
|
/** Thread state: Waiting in @p chEvtWaitAllTimeout(). */
|
||||||
#define PRWTANDEVT 9
|
#define PRWTANDEVT 9
|
||||||
/** Thread state: Waiting in \p chMsgSend(). */
|
/** Thread state: Waiting in @p chMsgSend(). */
|
||||||
#define PRSNDMSG 10
|
#define PRSNDMSG 10
|
||||||
/** Thread state: Waiting in \p chMsgWait(). */
|
/** Thread state: Waiting in @p chMsgWait(). */
|
||||||
#define PRWTMSG 11
|
#define PRWTMSG 11
|
||||||
/** Thread state: After termination.*/
|
/** Thread state: After termination.*/
|
||||||
#define PREXIT 12
|
#define PREXIT 12
|
||||||
|
@ -195,16 +195,16 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Returns the pointer to the \p Thread currently in execution.*/
|
/** Returns the pointer to the @p Thread currently in execution.*/
|
||||||
#define chThdSelf() currp
|
#define chThdSelf() currp
|
||||||
|
|
||||||
/** Returns the thread priority.*/
|
/** Returns the thread priority.*/
|
||||||
#define chThdGetPriority() (currp->p_prio)
|
#define chThdGetPriority() (currp->p_prio)
|
||||||
|
|
||||||
/** Returns the pointer to the \p Thread local storage area, if any.*/
|
/** Returns the pointer to the @p Thread local storage area, if any.*/
|
||||||
#define chThdLS() (void *)(currp + 1)
|
#define chThdLS() (void *)(currp + 1)
|
||||||
|
|
||||||
/** Verifies if the specified thread is in the \p PREXIT state.*/
|
/** Verifies if the specified thread is in the @p PREXIT state.*/
|
||||||
#define chThdTerminated(tp) ((tp)->p_state == PREXIT)
|
#define chThdTerminated(tp) ((tp)->p_state == PREXIT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,8 +213,8 @@ extern "C" {
|
||||||
#define chThdShouldTerminate() (currp->p_flags & P_TERMINATE)
|
#define chThdShouldTerminate() (currp->p_flags & P_TERMINATE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resumes a thread created with the \p P_SUSPENDED option or suspended with
|
* Resumes a thread created with the @p P_SUSPENDED option or suspended with
|
||||||
* \p chThdSuspend().
|
* @p chThdSuspend().
|
||||||
* @param tp the pointer to the thread
|
* @param tp the pointer to the thread
|
||||||
*/
|
*/
|
||||||
#define chThdResumeI(tp) chSchReadyI(tp)
|
#define chThdResumeI(tp) chSchReadyI(tp)
|
||||||
|
|
|
@ -117,10 +117,10 @@ extern "C" {
|
||||||
#define chVTIsArmedI(vtp) ((vtp)->vt_func != NULL)
|
#define chVTIsArmedI(vtp) ((vtp)->vt_func != NULL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of system ticks since the \p chSysInit() invocation.
|
* Returns the number of system ticks since the @p chSysInit() invocation.
|
||||||
* @return the system ticks number
|
* @return the system ticks number
|
||||||
* @note The counter can reach its maximum and then returns to zero.
|
* @note The counter can reach its maximum and then returns to zero.
|
||||||
* @note This function is designed to work with the \p chThdSleepUntil().
|
* @note This function is designed to work with the @p chThdSleepUntil().
|
||||||
*/
|
*/
|
||||||
#define chSysGetTime() (vtlist.vt_systime)
|
#define chSysGetTime() (vtlist.vt_systime)
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for a ChibiOS/RT thread, the thread body is the virtual
|
* Base class for a ChibiOS/RT thread, the thread body is the virtual
|
||||||
* function \p Main().
|
* function @p Main().
|
||||||
*/
|
*/
|
||||||
class BaseThread {
|
class BaseThread {
|
||||||
public:
|
public:
|
||||||
|
@ -185,7 +185,7 @@ namespace chibios_rt {
|
||||||
static msg_t WaitMessage(void);
|
static msg_t WaitMessage(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an enqueued message or \p NULL.
|
* Returns an enqueued message or @p NULL.
|
||||||
* @return The incoming message.
|
* @return The incoming message.
|
||||||
* @retval NULL No incoming message.
|
* @retval NULL No incoming message.
|
||||||
*/
|
*/
|
||||||
|
@ -242,7 +242,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simplified constructor, it allows to create a thread by simply
|
* Simplified constructor, it allows to create a thread by simply
|
||||||
* specifying a name. In is assumed \p NORMALPRIO as initial priority
|
* specifying a name. In is assumed @p NORMALPRIO as initial priority
|
||||||
* and no special option flags.
|
* and no special option flags.
|
||||||
* @param tname the name to be assigned to the thread
|
* @param tname the name to be assigned to the thread
|
||||||
*/
|
*/
|
||||||
|
@ -255,7 +255,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
#ifdef CH_USE_SEMAPHORES
|
#ifdef CH_USE_SEMAPHORES
|
||||||
/**
|
/**
|
||||||
* Class encapsulating a \p Semaphore.
|
* Class encapsulating a @p Semaphore.
|
||||||
*/
|
*/
|
||||||
class Semaphore {
|
class Semaphore {
|
||||||
public:
|
public:
|
||||||
|
@ -305,8 +305,8 @@ namespace chibios_rt {
|
||||||
#ifdef CH_USE_SEMSW
|
#ifdef CH_USE_SEMSW
|
||||||
/**
|
/**
|
||||||
* Atomic signal and wait operations.
|
* Atomic signal and wait operations.
|
||||||
* @param ssem pointer to a \p Semaphore to be signaled
|
* @param ssem pointer to a @p Semaphore to be signaled
|
||||||
* @param wsem pointer to a \p Semaphore to be wait on
|
* @param 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.
|
||||||
*/
|
*/
|
||||||
|
@ -317,7 +317,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
#ifdef CH_USE_MUTEXES
|
#ifdef CH_USE_MUTEXES
|
||||||
/**
|
/**
|
||||||
* Class encapsulating a \p Mutex.
|
* Class encapsulating a @p Mutex.
|
||||||
*/
|
*/
|
||||||
class Mutex {
|
class Mutex {
|
||||||
public:
|
public:
|
||||||
|
@ -364,7 +364,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
#ifdef CH_USE_CONDVARS
|
#ifdef CH_USE_CONDVARS
|
||||||
/**
|
/**
|
||||||
* Class encapsulating a \p CondVar.
|
* Class encapsulating a @p CondVar.
|
||||||
*/
|
*/
|
||||||
class CondVar {
|
class CondVar {
|
||||||
public:
|
public:
|
||||||
|
@ -417,7 +417,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
#ifdef CH_USE_EVENTS
|
#ifdef CH_USE_EVENTS
|
||||||
/**
|
/**
|
||||||
* Class encapsulating an \p EventSource.
|
* Class encapsulating an @p EventSource.
|
||||||
*/
|
*/
|
||||||
class Event {
|
class Event {
|
||||||
public:
|
public:
|
||||||
|
@ -434,14 +434,14 @@ namespace chibios_rt {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a listener on the event source.
|
* Registers a listener on the event source.
|
||||||
* @param elp pointer to the \p EventListener structure
|
* @param elp pointer to the @p EventListener structure
|
||||||
* @param eid numeric identifier assigned to the Event Listener
|
* @param eid numeric identifier assigned to the Event Listener
|
||||||
*/
|
*/
|
||||||
void Register(EventListener *elp, eventid_t eid);
|
void Register(EventListener *elp, eventid_t eid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an Event Listener on an Event Source.
|
* Registers an Event Listener on an Event Source.
|
||||||
* @param elp pointer to the \p EventListener structure
|
* @param elp pointer to the @p EventListener structure
|
||||||
* @param emask the mask of event flags to be pended to the thread when the
|
* @param emask the mask of event flags to be pended to the thread when the
|
||||||
* event source is broadcasted
|
* event source is broadcasted
|
||||||
* @note Multiple Event Listeners can specify the same bits to be pended.
|
* @note Multiple Event Listeners can specify the same bits to be pended.
|
||||||
|
@ -470,7 +470,7 @@ namespace chibios_rt {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes an events mask pending in the current thread, this is \b much
|
* Makes an events mask pending in the current thread, this is \b much
|
||||||
* faster than using \p Broadcast().
|
* faster than using @p Broadcast().
|
||||||
* @param mask the events to be pended
|
* @param mask the events to be pended
|
||||||
* @return The current pending events mask.
|
* @return The current pending events mask.
|
||||||
*/
|
*/
|
||||||
|
@ -479,7 +479,7 @@ namespace chibios_rt {
|
||||||
/**
|
/**
|
||||||
* Invokes the event handlers associated with a mask.
|
* Invokes the event handlers associated with a mask.
|
||||||
* @param mask mask of the events to be dispatched
|
* @param mask mask of the events to be dispatched
|
||||||
* @param handlers an array of \p evhandler_t. The array must be
|
* @param handlers an array of @p evhandler_t. The array must be
|
||||||
* have indexes from zero up the higher registered event
|
* have indexes from zero up the higher registered event
|
||||||
* identifier.
|
* identifier.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -39,7 +39,7 @@ static void tmrcb(void *p) {
|
||||||
/**
|
/**
|
||||||
* Starts the timer, if the timer was already running then the function has
|
* Starts the timer, if the timer was already running then the function has
|
||||||
* no effect.
|
* no effect.
|
||||||
* @param etp pointer to an initialized \p EvTimer structure.
|
* @param etp pointer to an initialized @p EvTimer structure.
|
||||||
*/
|
*/
|
||||||
void evtStart(EvTimer *etp) {
|
void evtStart(EvTimer *etp) {
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void evtStart(EvTimer *etp) {
|
||||||
/**
|
/**
|
||||||
* Stops the timer, if the timer was already stopped then the function has
|
* Stops the timer, if the timer was already stopped then the function has
|
||||||
* no effect.
|
* no effect.
|
||||||
* @param etp pointer to an initialized \p EvTimer structure.
|
* @param etp pointer to an initialized @p EvTimer structure.
|
||||||
*/
|
*/
|
||||||
void evtStop(EvTimer *etp) {
|
void evtStop(EvTimer *etp) {
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an \p EvTimer structure.
|
* Initializes an @p EvTimer structure.
|
||||||
* @param etp the EvTimer structure to be initialized
|
* @param etp the EvTimer structure to be initialized
|
||||||
* @param time the interval in system ticks
|
* @param time the interval in system ticks
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
* robin scheduling algorithm on threads of equal priority.*/
|
* robin scheduling algorithm on threads of equal priority.*/
|
||||||
#define CH_USE_ROUNDROBIN
|
#define CH_USE_ROUNDROBIN
|
||||||
|
|
||||||
/** Configuration option: if specified then the \p chThdWait() function
|
/** Configuration option: if specified then the @p chThdWait() function
|
||||||
* is included in the kernel.*/
|
* is included in the kernel.*/
|
||||||
#define CH_USE_WAITEXIT
|
#define CH_USE_WAITEXIT
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the Semaphores with timeout APIs
|
/** Configuration option: if specified then the Semaphores with timeout APIs
|
||||||
* are included in the kernel.
|
* are included in the kernel.
|
||||||
* @note requires \p CH_USE_SEMAPHORES.*/
|
* @note requires @p CH_USE_SEMAPHORES.*/
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT
|
#define CH_USE_SEMAPHORES_TIMEOUT
|
||||||
|
|
||||||
/** Configuration option: if specified then the Mutexes APIs are included in
|
/** Configuration option: if specified then the Mutexes APIs are included in
|
||||||
|
@ -71,21 +71,21 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the Conditional Variables APIs are
|
/** Configuration option: if specified then the Conditional Variables APIs are
|
||||||
* included in the kernel.
|
* included in the kernel.
|
||||||
* @note requires \p CH_USE_MUTEXES.*/
|
* @note requires @p CH_USE_MUTEXES.*/
|
||||||
#define CH_USE_CONDVARS
|
#define CH_USE_CONDVARS
|
||||||
|
|
||||||
/** Configuration option: if specified then the Conditional Variables APIs are
|
/** Configuration option: if specified then the Conditional Variables APIs are
|
||||||
* included in the kernel.
|
* included in the kernel.
|
||||||
* @note requires \p CH_USE_CONDVARS and \p CH_USE_MUTEXES.*/
|
* @note requires @p CH_USE_CONDVARS and @p CH_USE_MUTEXES.*/
|
||||||
#define CH_USE_CONDVARS_TIMEOUT
|
#define CH_USE_CONDVARS_TIMEOUT
|
||||||
|
|
||||||
/** Configuration option: if specified then the Events APIs are included in
|
/** Configuration option: if specified then the Events APIs are included in
|
||||||
* the kernel.*/
|
* the kernel.*/
|
||||||
#define CH_USE_EVENTS
|
#define CH_USE_EVENTS
|
||||||
|
|
||||||
/** Configuration option: if specified then the \p chEvtWaitXXXTimeout()
|
/** Configuration option: if specified then the @p chEvtWaitXXXTimeout()
|
||||||
* functions are included in the kernel.
|
* functions are included in the kernel.
|
||||||
* @note requires \p CH_USE_EVENTS.
|
* @note requires @p CH_USE_EVENTS.
|
||||||
*/
|
*/
|
||||||
#define CH_USE_EVENTS_TIMEOUT
|
#define CH_USE_EVENTS_TIMEOUT
|
||||||
|
|
||||||
|
@ -93,14 +93,14 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_MESSAGES
|
#define CH_USE_MESSAGES
|
||||||
|
|
||||||
/** Configuration option: if specified then the \p chMsgSendWithEvent()
|
/** Configuration option: if specified then the @p chMsgSendWithEvent()
|
||||||
* function is included in the kernel.
|
* function is included in the kernel.
|
||||||
* @note requires \p CH_USE_MESSAGES.*/
|
* @note requires @p CH_USE_MESSAGES.*/
|
||||||
#define CH_USE_MESSAGES_EVENT
|
#define CH_USE_MESSAGES_EVENT
|
||||||
|
|
||||||
/** Configuration option: If enabled then the threads serve messages by
|
/** Configuration option: If enabled then the threads serve messages by
|
||||||
* priority instead of FIFO order.
|
* priority instead of FIFO order.
|
||||||
* @note requires \p CH_USE_MESSAGES.*/
|
* @note requires @p CH_USE_MESSAGES.*/
|
||||||
#define CH_USE_MESSAGES_PRIORITY
|
#define CH_USE_MESSAGES_PRIORITY
|
||||||
|
|
||||||
/** Configuration option: if specified then the I/O queues APIs are included
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the I/O queues with timeout
|
/** Configuration option: if specified then the I/O queues with timeout
|
||||||
* APIs are included in the kernel.
|
* APIs are included in the kernel.
|
||||||
* @note requires \p CH_USE_SEMAPHORES_TIMEOUT.*/
|
* @note requires @p CH_USE_SEMAPHORES_TIMEOUT.*/
|
||||||
#define CH_USE_QUEUES_TIMEOUT
|
#define CH_USE_QUEUES_TIMEOUT
|
||||||
|
|
||||||
/** Configuration option: if specified then the full duplex serial driver APIs
|
/** Configuration option: if specified then the full duplex serial driver APIs
|
||||||
|
@ -131,13 +131,13 @@
|
||||||
/** Configuration option: Number of RAM bytes to use as system heap. If set to
|
/** Configuration option: Number of RAM bytes to use as system heap. If set to
|
||||||
* zero then the whole available RAM is used as system heap.
|
* zero then the whole available RAM is used as system heap.
|
||||||
* @note In order to use the whole RAM as system heap the linker script must
|
* @note In order to use the whole RAM as system heap the linker script must
|
||||||
* provide the \p __heap_base__ and \p __heap_end__ symbols.
|
* provide the @p __heap_base__ and @p __heap_end__ symbols.
|
||||||
* @note requires \p CH_USE_HEAP.
|
* @note requires @p CH_USE_HEAP.
|
||||||
*/
|
*/
|
||||||
#define CH_HEAP_SIZE 0
|
#define CH_HEAP_SIZE 0
|
||||||
|
|
||||||
/** Configuration option: enforces the use of the C-runtime \p malloc() and
|
/** Configuration option: enforces the use of the C-runtime @p malloc() and
|
||||||
* \p free() functions as backend for the system heap allocator.*/
|
* @p free() functions as backend for the system heap allocator.*/
|
||||||
#define CH_USE_MALLOC_HEAP
|
#define CH_USE_MALLOC_HEAP
|
||||||
|
|
||||||
/** Configuration option: if specified then the memory pools allocator APIs
|
/** Configuration option: if specified then the memory pools allocator APIs
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the dynamic objects creation APIs
|
/** Configuration option: if specified then the dynamic objects creation APIs
|
||||||
* are included in the kernel.
|
* are included in the kernel.
|
||||||
* @note requires \p CH_USE_WAITEXIT.
|
* @note requires @p CH_USE_WAITEXIT.
|
||||||
*/
|
*/
|
||||||
#define CH_USE_DYNAMIC
|
#define CH_USE_DYNAMIC
|
||||||
|
|
||||||
|
@ -156,18 +156,18 @@
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** Configuration option: This constant is the number of ticks allowed for the
|
||||||
* threads before preemption occurs. This option is only meaningful if the
|
* threads before preemption occurs. This option is only meaningful if the
|
||||||
* option \p CH_USE_ROUNDROBIN is also active.*/
|
* option @p CH_USE_ROUNDROBIN is also active.*/
|
||||||
#define CH_TIME_QUANTUM 20
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
* global \p currp variable. Caching this variable in a register can greatly
|
* global @p currp variable. Caching this variable in a register can greatly
|
||||||
* improve both space and time efficiency of the generated code. Another side
|
* improve both space and time efficiency of the generated code. Another side
|
||||||
* effect is that one less register has to be saved during the context switch
|
* effect is that one less register has to be saved during the context switch
|
||||||
* resulting in lower RAM usage and faster code.
|
* resulting in lower RAM usage and faster code.
|
||||||
* @note This option is only useable with the GCC compiler and is only useful
|
* @note This option is only useable with the GCC compiler and is only useful
|
||||||
* on processors with many registers like ARM cores.
|
* on processors with many registers like ARM cores.
|
||||||
* @note If this option is enabled then ALL the libraries linked to the
|
* @note If this option is enabled then ALL the libraries linked to the
|
||||||
* ChibiOS/RT code <b>must</b> be recompiled with the GCC option \p
|
* ChibiOS/RT code <b>must</b> be recompiled with the GCC option @p
|
||||||
* -ffixed-\<reg\>.
|
* -ffixed-\<reg\>.
|
||||||
*/
|
*/
|
||||||
//#define CH_CURRP_REGISTER_CACHE "reg"
|
//#define CH_CURRP_REGISTER_CACHE "reg"
|
||||||
|
@ -182,19 +182,19 @@
|
||||||
*/
|
*/
|
||||||
#define CH_USE_TRACE
|
#define CH_USE_TRACE
|
||||||
|
|
||||||
/** User fields added to the end of the \p Thread structure. */
|
/** User fields added to the end of the @p Thread structure. */
|
||||||
#define THREAD_EXT_FIELDS \
|
#define THREAD_EXT_FIELDS \
|
||||||
struct { \
|
struct { \
|
||||||
/* Add thread custom fields here.*/ \
|
/* Add thread custom fields here.*/ \
|
||||||
};
|
};
|
||||||
|
|
||||||
/** User initialization code added to the \p chThdInit() API.
|
/** User initialization code added to the @p chThdInit() API.
|
||||||
* @note It is invoked from within \p chThdInit(). */
|
* @note It is invoked from within @p chThdInit(). */
|
||||||
#define THREAD_EXT_INIT(tp) { \
|
#define THREAD_EXT_INIT(tp) { \
|
||||||
/* Add thread initialization code here.*/ \
|
/* Add thread initialization code here.*/ \
|
||||||
}
|
}
|
||||||
|
|
||||||
/** User finalization code added to the \p chThdExit() API.
|
/** User finalization code added to the @p chThdExit() API.
|
||||||
* @note It is inserted into lock zone. */
|
* @note It is inserted into lock zone. */
|
||||||
#define THREAD_EXT_EXIT(tp) { \
|
#define THREAD_EXT_EXIT(tp) { \
|
||||||
/* Add thread finalization code here.*/ \
|
/* Add thread finalization code here.*/ \
|
||||||
|
|
Loading…
Reference in New Issue