diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-02-06 10:37:50 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-02-06 10:37:50 +0000 |
commit | cf957f9d4a54d49f66d9af4ee7c7b4bb90660409 (patch) | |
tree | a7b63f1e94ec6a9d280a4ad9aadd1c20846aab5c /os/rt | |
parent | 23f759922d415d9adaab70424b2c67ff0d9b7181 (diff) | |
download | ChibiOS-cf957f9d4a54d49f66d9af4ee7c7b4bb90660409.tar.gz ChibiOS-cf957f9d4a54d49f66d9af4ee7c7b4bb90660409.tar.bz2 ChibiOS-cf957f9d4a54d49f66d9af4ee7c7b4bb90660409.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6668 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt')
-rw-r--r-- | os/rt/include/ch.h | 4 | ||||
-rw-r--r-- | os/rt/include/chschd.h | 50 | ||||
-rw-r--r-- | os/rt/include/chvt.h | 25 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/chcore.h | 8 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/chcore_v6m.h | 6 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/chcore_v7m.h | 4 | ||||
-rw-r--r-- | os/rt/ports/e200/chcore.h | 4 | ||||
-rw-r--r-- | os/rt/src/chvt.c | 5 |
8 files changed, 58 insertions, 48 deletions
diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h index 11c75c407..a8cc7ac81 100644 --- a/os/rt/include/ch.h +++ b/os/rt/include/ch.h @@ -62,10 +62,6 @@ #define CH_KERNEL_PATCH 0
/** @} */
-/* Forward declarations.*/
-typedef struct thread thread_t;
-typedef struct virtual_timer virtual_timer_t;
-
/* Core headers.*/
#include "chtypes.h"
#include "chconf.h"
diff --git a/os/rt/include/chschd.h b/os/rt/include/chschd.h index bcca26d85..fe85f76cb 100644 --- a/os/rt/include/chschd.h +++ b/os/rt/include/chschd.h @@ -69,16 +69,16 @@ /*===========================================================================*/
/**
- * @brief Generic threads single link list, it works like a stack.
+ * @extends threads_queue_t
+ *
+ * @brief Type of a thread structure.
*/
-typedef struct {
- thread_t *p_next; /**< @brief Next in the list/queue. */
-} threads_list_t;
+typedef struct thread thread_t;
/**
* @extends threads_list_t
*
- * @brief Generic threads bidirectional linked list header and element.
+ * @brief Type of a generic threads bidirectional linked list header and element.
*/
typedef struct {
thread_t *p_next; /**< @brief Next in the list/queue. */
@@ -86,6 +86,13 @@ typedef struct { } threads_queue_t;
/**
+ * @brief Type of a generic threads single link list, it works like a stack.
+ */
+typedef struct {
+ thread_t *p_next; /**< @brief Next in the list/queue. */
+} threads_list_t;
+
+/**
* @extends threads_queue_t
*
* @brief Ready list header.
@@ -106,14 +113,12 @@ typedef struct { } ready_list_t;
/**
- * @extends threads_queue_t
- *
* @brief Structure representing a thread.
* @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 shrinking the @p thread_t structure.
+ * by shrinking this structure.
*/
-typedef struct thread {
+struct 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. */
@@ -246,7 +251,32 @@ typedef struct thread { /* Extra fields defined in chconf.h.*/
CH_CFG_THREAD_EXTRA_FIELDS
#endif
-} thread_t;
+};
+
+/**
+ * @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 {
+ 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. */
+ vtfunc_t vt_func; /**< @brief Timer callback function
+ pointer. */
+ void *vt_par; /**< @brief Timer callback function
+ parameter. */
+};
/**
* @brief Virtual timers list header.
diff --git a/os/rt/include/chvt.h b/os/rt/include/chvt.h index 5c2d49d31..471ba22ee 100644 --- a/os/rt/include/chvt.h +++ b/os/rt/include/chvt.h @@ -87,31 +87,6 @@ /* Module data structures and types. */
/*===========================================================================*/
-/**
- * @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 {
- 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. */
- vtfunc_t vt_func; /**< @brief Timer callback function
- pointer. */
- void *vt_par; /**< @brief Timer callback function
- parameter. */
-};
-
/*===========================================================================*/
/* Module macros. */
/*===========================================================================*/
diff --git a/os/rt/ports/ARMCMx/chcore.h b/os/rt/ports/ARMCMx/chcore.h index ca6ae60e7..0e5ed6933 100644 --- a/os/rt/ports/ARMCMx/chcore.h +++ b/os/rt/ports/ARMCMx/chcore.h @@ -42,6 +42,11 @@ */
#define PORT_ARCHITECTURE_ARM
+/* The following code is not processed when the file is included from an
+ asm module because those intrinsic macros are not necessarily defined
+ by the assembler too.*/
+#if !defined(_FROM_ASM_)
+
/**
* @brief Compiler name and version.
*/
@@ -57,6 +62,9 @@ #else
#error "unsupported compiler"
#endif
+
+#endif /* !defined(_FROM_ASM_) */
+
/** @} */
/**
diff --git a/os/rt/ports/ARMCMx/chcore_v6m.h b/os/rt/ports/ARMCMx/chcore_v6m.h index e80efc9b9..fa6476084 100644 --- a/os/rt/ports/ARMCMx/chcore_v6m.h +++ b/os/rt/ports/ARMCMx/chcore_v6m.h @@ -254,7 +254,7 @@ struct port_intctx { struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
if ((stkalign_t *)(r13 - 1) < (otp)->p_stklimit) \
chSysHalt("stack overflow"); \
- _port_switch(ntp, otp); \
+ _port_switch((void *)ntp, (void *)otp); \
}
#endif
@@ -266,10 +266,10 @@ struct port_intctx { extern "C" {
#endif
void _port_irq_epilogue(regarm_t lr);
+ void _port_switch(void *ntp, void *otp);
+ void _port_thread_start(void);
void _port_switch_from_isr(void);
void _port_exit_from_isr(void);
- void _port_switch(thread_t *ntp, thread_t *otp);
- void _port_thread_start(void);
#ifdef __cplusplus
}
#endif
diff --git a/os/rt/ports/ARMCMx/chcore_v7m.h b/os/rt/ports/ARMCMx/chcore_v7m.h index 404e87411..9e0b1e9cd 100644 --- a/os/rt/ports/ARMCMx/chcore_v7m.h +++ b/os/rt/ports/ARMCMx/chcore_v7m.h @@ -344,7 +344,7 @@ struct port_intctx { struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
if ((stkalign_t *)(r13 - 1) < (otp)->p_stklimit) \
chSysHalt("stack overflow"); \
- _port_switch(ntp, otp); \
+ _port_switch((void *)ntp, (void *)otp); \
}
#endif
@@ -356,7 +356,7 @@ struct port_intctx { extern "C" {
#endif
void _port_irq_epilogue(void);
- void _port_switch(thread_t *ntp, thread_t *otp);
+ void _port_switch(void *ntp, void *otp);
void _port_thread_start(void);
void _port_switch_from_isr(void);
void _port_exit_from_isr(void);
diff --git a/os/rt/ports/e200/chcore.h b/os/rt/ports/e200/chcore.h index 0255a0f1d..a043bb0b0 100644 --- a/os/rt/ports/e200/chcore.h +++ b/os/rt/ports/e200/chcore.h @@ -340,7 +340,7 @@ struct context { register struct port_intctx *sp asm ("%r1"); \
if ((stkalign_t *)(sp - 1) < otp->p_stklimit) \
chDbgPanic("stack overflow"); \
- _port_switch(ntp, otp); \
+ _port_switch((void *)ntp, (void *)otp); \
}
#endif
@@ -373,7 +373,7 @@ struct context { #ifdef __cplusplus
extern "C" {
#endif
- void _port_switch(thread_t *ntp, thread_t *otp);
+ void _port_switch(void *ntp, void *otp);
void _port_thread_start(void);
#ifdef __cplusplus
}
diff --git a/os/rt/src/chvt.c b/os/rt/src/chvt.c index e87c2d12c..d20e20d91 100644 --- a/os/rt/src/chvt.c +++ b/os/rt/src/chvt.c @@ -136,8 +136,9 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay, while (p->vt_delta < delay) {
delay -= p->vt_delta;
p = p->vt_next;
- } -
/* The timer is inserted in the delta list.*/ + }
+
+ /* The timer is inserted in the delta list.*/
vtp->vt_prev = (vtp->vt_next = p)->vt_prev;
vtp->vt_prev->vt_next = p->vt_prev = vtp;
vtp->vt_delta = delay
|