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

master
gdisirio 2014-10-26 09:57:09 +00:00
parent 904182fd33
commit da0a231bbc
6 changed files with 465 additions and 57 deletions

View File

@ -65,7 +65,7 @@ endif
# Enables the use of FPU on Cortex-M4 (no, softfp, hard). # Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),) ifeq ($(USE_FPU),)
USE_FPU = no USE_FPU = hard
endif endif
# #

View File

@ -0,0 +1,158 @@
***************************************************************************
Options: -O2 -fomit-frame-pointer -falign-functions=16
Settings: SYSCLK=168, ACR=0x705 (5 wait states)
***************************************************************************
*** ChibiOS/RT test suite
***
*** Kernel: 3.0.0dev
*** Compiled: Oct 26 2014 - 10:54:30
*** Compiler: GCC 4.7.4 20140401 (release) [ARM/embedded-4_7-branch revision 209195]
*** Architecture: ARMv7-ME
*** Core Variant: Cortex-M4F
*** Port Info: Advanced kernel mode
*** Platform: STM32F407 High Performance with DSP and FPU
*** Test Board: STMicroelectronics STM32F4-Discovery
----------------------------------------------------------------------------
--- Test Case 1.1 (Threads, enqueuing test #1)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.2 (Threads, enqueuing test #2)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.3 (Threads, priority change)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.4 (Threads, delays)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.1 (Semaphores, enqueuing)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.2 (Semaphores, timeout)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.3 (Semaphores, atomic signal-wait)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.4 (Binary Semaphores, functionality)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.1 (Mutexes, priority enqueuing test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.2 (Mutexes, priority return)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.3 (Mutexes, status)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.4 (CondVar, signal test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.5 (CondVar, broadcast test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.6 (CondVar, boost test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.1 (Messages, loop)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 5.1 (Mailboxes, queuing and timeouts)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.1 (Events, registration and dispatch)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.2 (Events, wait and broadcast)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.3 (Events, timeouts)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 7.1 (Heap, allocation and fragmentation test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 8.1 (Memory Pools, queue/dequeue)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.1 (Dynamic APIs, threads creation from heap)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.2 (Dynamic APIs, threads creation from memory pool)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.3 (Dynamic APIs, registry and references)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.1 (Queues, input queues)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.2 (Queues, output queues)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.1 (Benchmark, messages #1)
--- Score : 604311 msgs/S, 1208622 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.2 (Benchmark, messages #2)
--- Score : 513757 msgs/S, 1027514 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.3 (Benchmark, messages #3)
--- Score : 513757 msgs/S, 1027514 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.4 (Benchmark, context switch)
--- Score : 1686320 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.5 (Benchmark, threads, full cycle)
--- Score : 394363 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.6 (Benchmark, threads, create only)
--- Score : 543685 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.7 (Benchmark, mass reschedule, 5 threads)
--- Score : 164867 reschedules/S, 989202 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.8 (Benchmark, round robin context switching)
--- Score : 1181012 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.9 (Benchmark, I/O Queues throughput)
--- Score : 1873164 bytes/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.10 (Benchmark, virtual timers set/reset)
--- Score : 1343996 timers/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.11 (Benchmark, semaphores wait/signal)
--- Score : 3199988 wait+signal/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.12 (Benchmark, mutexes lock/unlock)
--- Score : 1856348 lock+unlock/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.13 (Benchmark, RAM footprint)
--- System: 732 bytes
--- Thread: 68 bytes
--- Timer : 20 bytes
--- Semaph: 12 bytes
--- EventS: 4 bytes
--- EventL: 20 bytes
--- Mutex : 16 bytes
--- CondV.: 8 bytes
--- Queue : 36 bytes
--- MailB.: 40 bytes
--- Result: SUCCESS
----------------------------------------------------------------------------
Final result: SUCCESS

View File

@ -0,0 +1,158 @@
***************************************************************************
Options: -O2 -fomit-frame-pointer -falign-functions=16
Settings: SYSCLK=168, ACR=0x705 (5 wait states)
***************************************************************************
*** ChibiOS/RT test suite
***
*** Kernel: 3.0.0dev
*** Compiled: Oct 26 2014 - 10:50:20
*** Compiler: GCC 4.7.4 20140401 (release) [ARM/embedded-4_7-branch revision 209195]
*** Architecture: ARMv7-ME
*** Core Variant: Cortex-M4
*** Port Info: Advanced kernel mode
*** Platform: STM32F407 High Performance with DSP and FPU
*** Test Board: STMicroelectronics STM32F4-Discovery
----------------------------------------------------------------------------
--- Test Case 1.1 (Threads, enqueuing test #1)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.2 (Threads, enqueuing test #2)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.3 (Threads, priority change)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.4 (Threads, delays)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.1 (Semaphores, enqueuing)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.2 (Semaphores, timeout)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.3 (Semaphores, atomic signal-wait)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.4 (Binary Semaphores, functionality)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.1 (Mutexes, priority enqueuing test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.2 (Mutexes, priority return)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.3 (Mutexes, status)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.4 (CondVar, signal test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.5 (CondVar, broadcast test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.6 (CondVar, boost test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.1 (Messages, loop)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 5.1 (Mailboxes, queuing and timeouts)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.1 (Events, registration and dispatch)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.2 (Events, wait and broadcast)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.3 (Events, timeouts)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 7.1 (Heap, allocation and fragmentation test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 8.1 (Memory Pools, queue/dequeue)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.1 (Dynamic APIs, threads creation from heap)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.2 (Dynamic APIs, threads creation from memory pool)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.3 (Dynamic APIs, registry and references)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.1 (Queues, input queues)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.2 (Queues, output queues)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.1 (Benchmark, messages #1)
--- Score : 799993 msgs/S, 1599986 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.2 (Benchmark, messages #2)
--- Score : 648644 msgs/S, 1297288 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.3 (Benchmark, messages #3)
--- Score : 648644 msgs/S, 1297288 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.4 (Benchmark, context switch)
--- Score : 2559992 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.5 (Benchmark, threads, full cycle)
--- Score : 467963 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.6 (Benchmark, threads, create only)
--- Score : 691353 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.7 (Benchmark, mass reschedule, 5 threads)
--- Score : 206135 reschedules/S, 1236810 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.8 (Benchmark, round robin context switching)
--- Score : 1551960 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.9 (Benchmark, I/O Queues throughput)
--- Score : 1873164 bytes/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.10 (Benchmark, virtual timers set/reset)
--- Score : 1343998 timers/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.11 (Benchmark, semaphores wait/signal)
--- Score : 3199988 wait+signal/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.12 (Benchmark, mutexes lock/unlock)
--- Score : 1856348 lock+unlock/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.13 (Benchmark, RAM footprint)
--- System: 460 bytes
--- Thread: 68 bytes
--- Timer : 20 bytes
--- Semaph: 12 bytes
--- EventS: 4 bytes
--- EventL: 20 bytes
--- Mutex : 16 bytes
--- CondV.: 8 bytes
--- Queue : 36 bytes
--- MailB.: 40 bytes
--- Result: SUCCESS
----------------------------------------------------------------------------
Final result: SUCCESS

View File

@ -62,11 +62,8 @@
#define CH_KERNEL_PATCH 0 #define CH_KERNEL_PATCH 0
/** @} */ /** @} */
/* Required forward declaration, knowledge of this type is required by all
modules.*/
typedef struct thread thread_t;
/* Core headers.*/ /* Core headers.*/
#include "chsystypes.h"
#include "chtypes.h" #include "chtypes.h"
#include "chconf.h" #include "chconf.h"
#include "chcore.h" #include "chcore.h"

View File

@ -69,48 +69,19 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @extends threads_queue_t * @brief Generic threads single link list, it works like a stack.
*
* @brief Type of a thread structure.
*/ */
typedef struct thread thread_t; struct ch_threads_list {
thread_t *p_next; /**< @brief Next in the list/queue. */
};
/** /**
* @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 { struct ch_threads_queue{
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; };
/**
* @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.
*/
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;
/** /**
* @brief Structure representing a thread. * @brief Structure representing a thread.
@ -118,7 +89,7 @@ typedef struct {
* 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 this structure. * by shrinking this structure.
*/ */
struct thread { struct ch_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. */
@ -256,22 +227,12 @@ struct thread {
#endif #endif
}; };
/**
* @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 * @extends virtual_timers_list_t
* *
* @brief Virtual Timer descriptor structure. * @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_next; /**< @brief Next timer in the list. */
virtual_timer_t *vt_prev; /**< @brief Previous timer in the list. */ virtual_timer_t *vt_prev; /**< @brief Previous timer in the list. */
systime_t vt_delta; /**< @brief Time delta before timeout. */ 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 * in order to make the unlink time constant, the reset of a virtual
* timer is often used in the code. * 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 virtual_timer_t *vt_next; /**< @brief Next timer in the delta
list. */ list. */
virtual_timer_t *vt_prev; /**< @brief Last timer in the delta 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 systime_t vt_lasttime;/**< @brief System time of the last
tick event. */ tick event. */
#endif #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. * @brief System data structure.
* @note This structure contain all the data areas used by the OS except * @note This structure contain all the data areas used by the OS except
* stacks. * stacks.
*/ */
typedef struct ch_system { struct ch_system {
/** /**
* @brief Ready list header. * @brief Ready list header.
*/ */
@ -357,7 +336,7 @@ typedef struct ch_system {
*/ */
ch_trace_buffer_t dbg_trace_buffer; ch_trace_buffer_t dbg_trace_buffer;
#endif #endif
} ch_system_t; };
/*===========================================================================*/ /*===========================================================================*/
/* Module macros. */ /* Module macros. */

116
os/rt/include/chsystypes.h Normal file
View File

@ -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_ */
/** @} */