diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-10-01 17:42:47 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-10-01 17:42:47 +0000 |
commit | 3a90ab685aaae59f242ae31260e67e9125ae78cd (patch) | |
tree | 1413d1fa5a06ee7e720a1de121c537bb1ecb1c45 /src/include/lists.h | |
parent | 9a0ef300bce50901d5de3d6d722e29b79a2f9a36 (diff) | |
download | ChibiOS-3a90ab685aaae59f242ae31260e67e9125ae78cd.tar.gz ChibiOS-3a90ab685aaae59f242ae31260e67e9125ae78cd.tar.bz2 ChibiOS-3a90ab685aaae59f242ae31260e67e9125ae78cd.zip |
Preparation for AVR core support.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@27 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/include/lists.h')
-rw-r--r-- | src/include/lists.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/include/lists.h b/src/include/lists.h new file mode 100644 index 000000000..477ab1061 --- /dev/null +++ b/src/include/lists.h @@ -0,0 +1,67 @@ +/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @addtogroup Threads
+ * @{
+ */
+
+#ifndef _LISTS_H_
+#define _LISTS_H_
+
+typedef struct Thread Thread;
+
+/* Macros good with both ThreadsQueue and ThreadsList.*/
+#define isempty(p) ((p)->p_next == (Thread *)(p))
+#define notempty(p) ((p)->p_next != (Thread *)(p))
+
+/**
+ * Generic threads FIFO queue header and element.
+ */
+typedef struct {
+ /** Next \p Thread in the queue, in FIFO order.*/
+ Thread *p_next;
+ /** Last \p Thread in the queue, in FIFO order.*/
+ Thread *p_prev;
+} ThreadsQueue;
+
+/**
+ * Generic threads single link list, it works like a stack.
+ */
+typedef struct {
+ Thread *p_next;
+} ThreadsList;
+
+/*
+ * Threads Lists functions and macros.
+ */
+#define fifo_init(tqp) ((tqp)->p_next = (tqp)->p_prev = (Thread *)(tqp));
+#define list_init(tlp) ((tlp)->p_next = (Thread *)(tlp))
+
+#ifndef CH_OPTIMIZE_SPEED
+void fifo_insert(Thread *tp, ThreadsQueue *tqp);
+Thread *fifo_remove(ThreadsQueue *tqp);
+Thread *dequeue(Thread *tp);
+void list_insert(Thread *tp, ThreadsList *tlp);
+Thread *list_remove(ThreadsList *tlp);
+#endif
+
+#endif /* _LISTS_H_ */
+
+/** @} */
|