aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-02-06 10:37:50 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-02-06 10:37:50 +0000
commitcf957f9d4a54d49f66d9af4ee7c7b4bb90660409 (patch)
treea7b63f1e94ec6a9d280a4ad9aadd1c20846aab5c /os
parent23f759922d415d9adaab70424b2c67ff0d9b7181 (diff)
downloadChibiOS-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')
-rw-r--r--os/common/ports/ARMCMx/compilers/GCC/rules.mk3
-rw-r--r--os/nil/ports/ARMCMx/nilcore.h8
-rw-r--r--os/rt/include/ch.h4
-rw-r--r--os/rt/include/chschd.h50
-rw-r--r--os/rt/include/chvt.h25
-rw-r--r--os/rt/ports/ARMCMx/chcore.h8
-rw-r--r--os/rt/ports/ARMCMx/chcore_v6m.h6
-rw-r--r--os/rt/ports/ARMCMx/chcore_v7m.h4
-rw-r--r--os/rt/ports/e200/chcore.h4
-rw-r--r--os/rt/src/chvt.c5
10 files changed, 69 insertions, 48 deletions
diff --git a/os/common/ports/ARMCMx/compilers/GCC/rules.mk b/os/common/ports/ARMCMx/compilers/GCC/rules.mk
index a9228e393..1d6def961 100644
--- a/os/common/ports/ARMCMx/compilers/GCC/rules.mk
+++ b/os/common/ports/ARMCMx/compilers/GCC/rules.mk
@@ -23,6 +23,9 @@ ifeq ($(USE_LTO),yes)
endif
# FPU-related options
+ifeq ($(USE_FPU),)
+ USE_FPU = no
+endif
ifneq ($(USE_FPU),no)
OPT += -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant
DDEFS += -DCORTEX_USE_FPU=TRUE
diff --git a/os/nil/ports/ARMCMx/nilcore.h b/os/nil/ports/ARMCMx/nilcore.h
index 9d9c643b4..60202222a 100644
--- a/os/nil/ports/ARMCMx/nilcore.h
+++ b/os/nil/ports/ARMCMx/nilcore.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/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