ChibiOS/RT Logo ChibiOS/RT

Architecture - Reference Manual - Guides

Data Structures | Defines | Functions

Internals
[Kernel]

Collaboration diagram for Internals:


Description

All the functions present in this module, while public, are not an OS API and should not be directly used in the user applications code.

Data Structures

struct  ThreadsQueue
 Generic threads bidirectional linked list header and element. More...
struct  ThreadsList
 Generic threads single link list, it works like a stack. More...

Defines

#define queue_init(tqp)   ((tqp)->p_next = (tqp)->p_prev = (Thread *)(tqp));
 Threads queue initialization.
#define list_init(tlp)   ((tlp)->p_next = (Thread *)(tlp))
 Threads list initialization.
#define isempty(p)   ((p)->p_next == (Thread *)(p))
 Evaluates to TRUE if the specified threads queue or list is empty.
#define notempty(p)   ((p)->p_next != (Thread *)(p))
 Evaluates to TRUE if the specified threads queue or list is not empty.
#define _THREADSQUEUE_DATA(name)   {(Thread *)&name, (Thread *)&name}
 Data part of a static threads queue initializer.
#define THREADSQUEUE_DECL(name)   ThreadsQueue name = _THREADSQUEUE_DATA(name)
 Static threads queue initializer.

Functions

void prio_insert (Thread *tp, ThreadsQueue *tqp)
 Inserts a thread into a priority ordered queue.
void queue_insert (Thread *tp, ThreadsQueue *tqp)
 Inserts a Thread into a queue.
Threadfifo_remove (ThreadsQueue *tqp)
 Removes the first-out Thread from a queue and returns it.
Threadlifo_remove (ThreadsQueue *tqp)
 Removes the last-out Thread from a queue and returns it.
Threaddequeue (Thread *tp)
 Removes a Thread from a queue and returns it.
void list_insert (Thread *tp, ThreadsList *tlp)
 Pushes a Thread on top of a stack list.
Threadlist_remove (ThreadsList *tlp)
 Pops a Thread from the top of a stack list and returns it.

Define Documentation

#define queue_init (   tqp  )     ((tqp)->p_next = (tqp)->p_prev = (Thread *)(tqp));

Threads queue initialization.

Definition at line 46 of file chlists.h.

Referenced by chCondInit(), chMtxInit(), chSemInit(), init_thread(), and scheduler_init().

#define list_init (   tlp  )     ((tlp)->p_next = (Thread *)(tlp))

Threads list initialization.

Definition at line 51 of file chlists.h.

Referenced by init_thread().

#define isempty (   p  )     ((p)->p_next == (Thread *)(p))

Evaluates to TRUE if the specified threads queue or list is empty.

Definition at line 57 of file chlists.h.

#define notempty (   p  )     ((p)->p_next != (Thread *)(p))

Evaluates to TRUE if the specified threads queue or list is not empty.

Definition at line 63 of file chlists.h.

Referenced by chCondSignal(), chCondSignalI(), and chThdExit().

#define _THREADSQUEUE_DATA (   name  )     {(Thread *)&name, (Thread *)&name}

Data part of a static threads queue initializer.

This macro should be used when statically initializing a threads queue that is part of a bigger structure.

Parameters:
[in] name the name of the threads queue variable

Definition at line 72 of file chlists.h.

#define THREADSQUEUE_DECL (   name  )     ThreadsQueue name = _THREADSQUEUE_DATA(name)

Static threads queue initializer.

Statically initialized threads queues require no explicit initialization using queue_init().

Parameters:
[in] name the name of the threads queue variable

Definition at line 81 of file chlists.h.


Function Documentation

void prio_insert ( Thread tp,
ThreadsQueue tqp 
)

Inserts a thread into a priority ordered queue.

Note:
The insertion is done by scanning the list from the highest priority toward the lowest.
This function is not an API.
Parameters:
[in] tp the pointer to the thread to be inserted in the list
[in] tqp the pointer to the threads list header

Definition at line 49 of file chlists.c.

References Thread::p_next, Thread::p_prev, and Thread::p_prio.

Referenced by chCondWaitS(), chCondWaitTimeoutS(), and chMtxLockS().

void queue_insert ( Thread tp,
ThreadsQueue tqp 
)

Inserts a Thread into a queue.

Note:
This function is not an API.
Parameters:
[in] tp the pointer to the thread to be inserted in the list
[in] tqp the pointer to the threads list header

Definition at line 71 of file chlists.c.

References Thread::p_next, ThreadsQueue::p_prev, and Thread::p_prev.

Thread * fifo_remove ( ThreadsQueue tqp  ) 

Removes the first-out Thread from a queue and returns it.

Note:
If the queue is priority ordered then this function returns the thread with the highest priority.
This function is not an API.
Parameters:
[in] tqp the pointer to the threads list header
Returns:
The removed thread pointer.

Definition at line 87 of file chlists.c.

References Thread::p_next, and ThreadsQueue::p_next.

Referenced by chCondBroadcastI(), chCondSignal(), chCondSignalI(), chMsgRelease(), chMtxUnlock(), chMtxUnlockAll(), chMtxUnlockS(), chSchDoRescheduleI(), chSchGoSleepS(), chSemSignal(), chSemSignalI(), and chSemSignalWait().

Thread * lifo_remove ( ThreadsQueue tqp  ) 

Removes the last-out Thread from a queue and returns it.

Note:
If the queue is priority ordered then this function returns the thread with the lowest priority.
This function is not an API.
Parameters:
[in] tqp the pointer to the threads list header
Returns:
The removed thread pointer.

Definition at line 103 of file chlists.c.

References Thread::p_prev, and ThreadsQueue::p_prev.

Referenced by chSemResetI().

Thread * dequeue ( Thread tp  ) 

Removes a Thread from a queue and returns it.

The thread is removed from the queue regardless of its relative position and regardless the used insertion method.

Note:
This function is not an API.
Parameters:
[in] tp the pointer to the thread to be removed from the queue
Returns:
The removed thread pointer.

Definition at line 119 of file chlists.c.

References Thread::p_next, and Thread::p_prev.

Referenced by chMtxLockS().

void list_insert ( Thread tp,
ThreadsList tlp 
)

Pushes a Thread on top of a stack list.

Note:
This function is not an API.
Parameters:
[in] tp the pointer to the thread to be inserted in the list
[in] tlp the pointer to the threads list header

Definition at line 133 of file chlists.c.

References ThreadsList::p_next, and Thread::p_next.

Referenced by chThdWait().

Thread * list_remove ( ThreadsList tlp  ) 

Pops a Thread from the top of a stack list and returns it.

Note:
The list must be non-empty before calling this function.
This function is not an API.
Parameters:
[in] tlp the pointer to the threads list header
Returns:
The removed thread pointer.

Definition at line 147 of file chlists.c.

References Thread::p_next, and ThreadsList::p_next.

Referenced by chThdExit().


Generated on Sun Nov 28 2010 14:09:56 for ChibiOS/RT by doxygen 1.7.1