git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6668 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2014-02-06 10:37:50 +00:00
parent 23f759922d
commit cf957f9d4a
10 changed files with 69 additions and 48 deletions

View File

@ -23,6 +23,9 @@ ifeq ($(USE_LTO),yes)
endif endif
# FPU-related options # FPU-related options
ifeq ($(USE_FPU),)
USE_FPU = no
endif
ifneq ($(USE_FPU),no) ifneq ($(USE_FPU),no)
OPT += -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant OPT += -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant
DDEFS += -DCORTEX_USE_FPU=TRUE DDEFS += -DCORTEX_USE_FPU=TRUE

View File

@ -42,6 +42,11 @@
*/ */
#define PORT_ARCHITECTURE_ARM #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. * @brief Compiler name and version.
*/ */
@ -57,6 +62,9 @@
#else #else
#error "unsupported compiler" #error "unsupported compiler"
#endif #endif
#endif /* !defined(_FROM_ASM_) */
/** @} */ /** @} */
/** /**

View File

@ -62,10 +62,6 @@
#define CH_KERNEL_PATCH 0 #define CH_KERNEL_PATCH 0
/** @} */ /** @} */
/* Forward declarations.*/
typedef struct thread thread_t;
typedef struct virtual_timer virtual_timer_t;
/* Core headers.*/ /* Core headers.*/
#include "chtypes.h" #include "chtypes.h"
#include "chconf.h" #include "chconf.h"

View File

@ -69,22 +69,29 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Generic threads single link list, it works like a stack. * @extends threads_queue_t
*
* @brief Type of a thread structure.
*/ */
typedef struct { typedef struct thread thread_t;
thread_t *p_next; /**< @brief Next in the list/queue. */
} threads_list_t;
/** /**
* @extends threads_list_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 { typedef struct {
thread_t *p_next; /**< @brief Next in the list/queue. */ thread_t *p_next; /**< @brief Next in the list/queue. */
thread_t *p_prev; /**< @brief Previous in the queue. */ thread_t *p_prev; /**< @brief Previous in the queue. */
} threads_queue_t; } 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 * @extends threads_queue_t
* *
@ -106,14 +113,12 @@ typedef struct {
} ready_list_t; } ready_list_t;
/** /**
* @extends threads_queue_t
*
* @brief Structure representing a thread. * @brief Structure representing a thread.
* @note Not all the listed fields are always needed, by switching off some * @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 * 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. */ thread_t *p_next; /**< @brief Next in the list/queue. */
/* End of the fields shared with the threads_list_t structure.*/ /* End of the fields shared with the threads_list_t structure.*/
thread_t *p_prev; /**< @brief Previous in the queue. */ thread_t *p_prev; /**< @brief Previous in the queue. */
@ -246,7 +251,32 @@ typedef struct thread {
/* Extra fields defined in chconf.h.*/ /* Extra fields defined in chconf.h.*/
CH_CFG_THREAD_EXTRA_FIELDS CH_CFG_THREAD_EXTRA_FIELDS
#endif #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. * @brief Virtual timers list header.

View File

@ -87,31 +87,6 @@
/* Module data structures and types. */ /* 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. */ /* Module macros. */
/*===========================================================================*/ /*===========================================================================*/

View File

@ -42,6 +42,11 @@
*/ */
#define PORT_ARCHITECTURE_ARM #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. * @brief Compiler name and version.
*/ */
@ -57,6 +62,9 @@
#else #else
#error "unsupported compiler" #error "unsupported compiler"
#endif #endif
#endif /* !defined(_FROM_ASM_) */
/** @} */ /** @} */
/** /**

View File

@ -254,7 +254,7 @@ struct port_intctx {
struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \ struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
if ((stkalign_t *)(r13 - 1) < (otp)->p_stklimit) \ if ((stkalign_t *)(r13 - 1) < (otp)->p_stklimit) \
chSysHalt("stack overflow"); \ chSysHalt("stack overflow"); \
_port_switch(ntp, otp); \ _port_switch((void *)ntp, (void *)otp); \
} }
#endif #endif
@ -266,10 +266,10 @@ struct port_intctx {
extern "C" { extern "C" {
#endif #endif
void _port_irq_epilogue(regarm_t lr); 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_switch_from_isr(void);
void _port_exit_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 #ifdef __cplusplus
} }
#endif #endif

View File

@ -344,7 +344,7 @@ struct port_intctx {
struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \ struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
if ((stkalign_t *)(r13 - 1) < (otp)->p_stklimit) \ if ((stkalign_t *)(r13 - 1) < (otp)->p_stklimit) \
chSysHalt("stack overflow"); \ chSysHalt("stack overflow"); \
_port_switch(ntp, otp); \ _port_switch((void *)ntp, (void *)otp); \
} }
#endif #endif
@ -356,7 +356,7 @@ struct port_intctx {
extern "C" { extern "C" {
#endif #endif
void _port_irq_epilogue(void); 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_thread_start(void);
void _port_switch_from_isr(void); void _port_switch_from_isr(void);
void _port_exit_from_isr(void); void _port_exit_from_isr(void);

View File

@ -340,7 +340,7 @@ struct context {
register struct port_intctx *sp asm ("%r1"); \ register struct port_intctx *sp asm ("%r1"); \
if ((stkalign_t *)(sp - 1) < otp->p_stklimit) \ if ((stkalign_t *)(sp - 1) < otp->p_stklimit) \
chDbgPanic("stack overflow"); \ chDbgPanic("stack overflow"); \
_port_switch(ntp, otp); \ _port_switch((void *)ntp, (void *)otp); \
} }
#endif #endif
@ -373,7 +373,7 @@ struct context {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void _port_switch(thread_t *ntp, thread_t *otp); void _port_switch(void *ntp, void *otp);
void _port_thread_start(void); void _port_thread_start(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -136,8 +136,9 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
while (p->vt_delta < delay) { while (p->vt_delta < delay) {
delay -= p->vt_delta; delay -= p->vt_delta;
p = p->vt_next; 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 = (vtp->vt_next = p)->vt_prev;
vtp->vt_prev->vt_next = p->vt_prev = vtp; vtp->vt_prev->vt_next = p->vt_prev = vtp;
vtp->vt_delta = delay vtp->vt_delta = delay