aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/include
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-10-26 09:57:09 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-10-26 09:57:09 +0000
commitda0a231bbcac124415c001ae59a576d5cefeb07b (patch)
treec3bc5f2dd8cc37747943478b69c4132e741b1ee5 /os/rt/include
parent904182fd332e97b474c5733866bc653befc57587 (diff)
downloadChibiOS-da0a231bbcac124415c001ae59a576d5cefeb07b.tar.gz
ChibiOS-da0a231bbcac124415c001ae59a576d5cefeb07b.tar.bz2
ChibiOS-da0a231bbcac124415c001ae59a576d5cefeb07b.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7421 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/include')
-rw-r--r--os/rt/include/ch.h5
-rw-r--r--os/rt/include/chschd.h83
-rw-r--r--os/rt/include/chsystypes.h116
3 files changed, 148 insertions, 56 deletions
diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h
index f26832e4d..5e67aa202 100644
--- a/os/rt/include/ch.h
+++ b/os/rt/include/ch.h
@@ -62,11 +62,8 @@
#define CH_KERNEL_PATCH 0
/** @} */
-/* Required forward declaration, knowledge of this type is required by all
- modules.*/
-typedef struct thread thread_t;
-
/* Core headers.*/
+#include "chsystypes.h"
#include "chtypes.h"
#include "chconf.h"
#include "chcore.h"
diff --git a/os/rt/include/chschd.h b/os/rt/include/chschd.h
index 2be90cd27..8a7a59aae 100644
--- a/os/rt/include/chschd.h
+++ b/os/rt/include/chschd.h
@@ -69,48 +69,19 @@
/*===========================================================================*/
/**
- * @extends threads_queue_t
- *
- * @brief Type of a thread structure.
+ * @brief Generic threads single link list, it works like a stack.
*/
-typedef struct thread thread_t;
-
-/**
- * @extends threads_list_t
- *
- * @brief Type of a generic threads bidirectional linked list header and element.
- */
-typedef struct {
+struct ch_threads_list {
thread_t *p_next; /**< @brief Next in the list/queue. */
- thread_t *p_prev; /**< @brief Previous in the queue. */
-} threads_queue_t;
+};
/**
- * @brief Type of a generic threads single link list, it works like a stack.
+ * @brief Generic threads bidirectional linked list header and element.
*/
-typedef struct {
+struct ch_threads_queue{
thread_t *p_next; /**< @brief Next in the list/queue. */
-} threads_list_t;
-
-/**
- * @extends threads_queue_t
- *
- * @brief Ready list header.
- */
-typedef struct {
- threads_queue_t r_queue; /**< @brief Threads queue. */
- tprio_t r_prio; /**< @brief This field must be
- initialized to zero. */
- struct context r_ctx; /**< @brief Not used, present because
- offsets. */
-#if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__)
- thread_t *r_newer; /**< @brief Newer registry element. */
- thread_t *r_older; /**< @brief Older registry element. */
-#endif
- /* End of the fields shared with the thread_t structure.*/
- thread_t *r_current; /**< @brief The currently running
- thread. */
-} ready_list_t;
+ thread_t *p_prev; /**< @brief Previous in the queue. */
+};
/**
* @brief Structure representing a thread.
@@ -118,7 +89,7 @@ typedef struct {
* not needed ChibiOS/RT subsystems it is possible to save RAM space
* by shrinking this structure.
*/
-struct thread {
+struct ch_thread {
thread_t *p_next; /**< @brief Next in the list/queue. */
/* End of the fields shared with the threads_list_t structure.*/
thread_t *p_prev; /**< @brief Previous in the queue. */
@@ -257,21 +228,11 @@ struct thread {
};
/**
- * @brief Type of a Virtual Timer callback function.
- */
-typedef void (*vtfunc_t)(void *);
-
-/**
- * @brief Type of a Virtual Timer structure.
- */
-typedef struct virtual_timer virtual_timer_t;
-
-/**
* @extends virtual_timers_list_t
*
* @brief Virtual Timer descriptor structure.
*/
-struct virtual_timer {
+struct ch_virtual_timer {
virtual_timer_t *vt_next; /**< @brief Next timer in the list. */
virtual_timer_t *vt_prev; /**< @brief Previous timer in the list. */
systime_t vt_delta; /**< @brief Time delta before timeout. */
@@ -287,7 +248,7 @@ struct virtual_timer {
* in order to make the unlink time constant, the reset of a virtual
* timer is often used in the code.
*/
-typedef struct {
+struct ch_virtual_timers_list {
virtual_timer_t *vt_next; /**< @brief Next timer in the delta
list. */
virtual_timer_t *vt_prev; /**< @brief Last timer in the delta
@@ -303,14 +264,32 @@ typedef struct {
systime_t vt_lasttime;/**< @brief System time of the last
tick event. */
#endif
-} virtual_timers_list_t;
+};
+
+/**
+ * @extends threads_queue_t
+ */
+struct ch_ready_list {
+ threads_queue_t r_queue; /**< @brief Threads queue. */
+ tprio_t r_prio; /**< @brief This field must be
+ initialized to zero. */
+ struct context r_ctx; /**< @brief Not used, present because
+ offsets. */
+#if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__)
+ thread_t *r_newer; /**< @brief Newer registry element. */
+ thread_t *r_older; /**< @brief Older registry element. */
+#endif
+ /* End of the fields shared with the thread_t structure.*/
+ thread_t *r_current; /**< @brief The currently running
+ thread. */
+};
/**
* @brief System data structure.
* @note This structure contain all the data areas used by the OS except
* stacks.
*/
-typedef struct ch_system {
+struct ch_system {
/**
* @brief Ready list header.
*/
@@ -357,7 +336,7 @@ typedef struct ch_system {
*/
ch_trace_buffer_t dbg_trace_buffer;
#endif
-} ch_system_t;
+};
/*===========================================================================*/
/* Module macros. */
diff --git a/os/rt/include/chsystypes.h b/os/rt/include/chsystypes.h
new file mode 100644
index 000000000..6cf0c147b
--- /dev/null
+++ b/os/rt/include/chsystypes.h
@@ -0,0 +1,116 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011,2012,2013,2014 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/>.
+*/
+
+/**
+ * @file chsystypes.h
+ * @brief System types header.
+ *
+ * @addtogroup scheduler
+ * @{
+ */
+
+#ifndef _CHSYSTYPES_H_
+#define _CHSYSTYPES_H_
+
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
+/**
+ * @extends threads_queue_t
+ *
+ * @brief Type of a thread structure.
+ */
+typedef struct ch_thread thread_t;
+
+/**
+ * @brief Type of a generic threads single link list, it works like a stack.
+ */
+typedef struct ch_threads_list threads_list_t;
+
+/**
+ * @extends threads_list_t
+ *
+ * @brief Type of a generic threads bidirectional linked list header and element.
+ */
+typedef struct ch_threads_queue threads_queue_t;
+
+/**
+ * @extends threads_queue_t
+ *
+ * @brief Type of a ready list header.
+ */
+typedef struct ch_ready_list ready_list_t;
+
+/**
+ * @brief Type of a Virtual Timer callback function.
+ */
+typedef void (*vtfunc_t)(void *);
+
+/**
+ * @brief Type of a Virtual Timer structure.
+ */
+typedef struct ch_virtual_timer virtual_timer_t;
+
+/**
+ * @brief Type of virtual timers list header.
+ */
+typedef struct ch_virtual_timers_list virtual_timers_list_t;
+
+/**
+ * @brief Type of system data structure.
+ */
+typedef struct ch_system ch_system_t;
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
+#endif /* _CHSYSTYPES_H_ */
+
+/** @} */