aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-06-07 14:34:59 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-06-07 14:34:59 +0000
commit5cad241306f64d0a3c0f7829421e4bf8f4b18fbe (patch)
treeebbcad6d0cdb19fa5ef0bf5f6dc5cf80dfbdc4d1 /test
parent152f34a80c6ffe5fd17809732272823091b854e8 (diff)
parentaec912f13f9aa85cd677353fa556f679c3832970 (diff)
downloadChibiOS-5cad241306f64d0a3c0f7829421e4bf8f4b18fbe.tar.gz
ChibiOS-5cad241306f64d0a3c0f7829421e4bf8f4b18fbe.tar.bz2
ChibiOS-5cad241306f64d0a3c0f7829421e4bf8f4b18fbe.zip
I2C. Merged code from trunk.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3036 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r--test/coverage/chconf.h47
-rw-r--r--test/coverage/halconf.h68
-rw-r--r--test/coverage/main.c3
-rw-r--r--test/test.c13
-rw-r--r--test/test.dox3
-rw-r--r--test/test.h3
-rw-r--r--test/testbmk.c32
-rw-r--r--test/testbmk.h3
-rw-r--r--test/testdyn.c27
-rw-r--r--test/testdyn.h3
-rw-r--r--test/testevt.c13
-rw-r--r--test/testevt.h3
-rw-r--r--test/testheap.c7
-rw-r--r--test/testheap.h3
-rw-r--r--test/testmbox.c92
-rw-r--r--test/testmbox.h3
-rw-r--r--test/testmsg.c37
-rw-r--r--test/testmsg.h3
-rw-r--r--test/testmtx.c19
-rw-r--r--test/testmtx.h3
-rw-r--r--test/testpools.c7
-rw-r--r--test/testpools.h3
-rw-r--r--test/testqueues.c7
-rw-r--r--test/testqueues.h3
-rw-r--r--test/testsem.c15
-rw-r--r--test/testsem.h3
-rw-r--r--test/testthd.c5
-rw-r--r--test/testthd.h3
28 files changed, 285 insertions, 146 deletions
diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h
index 617528316..d063fa93f 100644
--- a/test/coverage/chconf.h
+++ b/test/coverage/chconf.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -83,12 +84,29 @@
*
* @note In order to let the OS manage the whole RAM the linker script must
* provide the @p __heap_base__ and @p __heap_end__ symbols.
- * @note Requires @p CH_USE_COREMEM.
+ * @note Requires @p CH_USE_MEMCORE.
*/
#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__)
#define CH_MEMCORE_SIZE 0x20000
#endif
+/**
+ * @brief Idle thread automatic spawn suppression.
+ * @details When this option is activated the function @p chSysInit()
+ * does not spawn the idle thread automatically. The application has
+ * then the responsibility to do one of the following:
+ * - Spawn a custom idle thread at priority @p IDLEPRIO.
+ * - Change the main() thread priority to @p IDLEPRIO then enter
+ * an endless loop. In this scenario the @p main() thread acts as
+ * the idle thread.
+ * .
+ * @note Unless an idle thread is spawned the @p main() thread must not
+ * enter a sleep state.
+ */
+#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
+#define CH_NO_IDLE_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* Performance options. */
/*===========================================================================*/
@@ -105,26 +123,6 @@
#define CH_OPTIMIZE_SPEED FALSE
#endif
-/**
- * @brief Exotic optimization.
- * @details If defined then a CPU register is used as storage for the global
- * @p currp variable. Caching this variable in a register greatly
- * improves both space and time OS efficiency. A side effect is that
- * one less register has to be saved during the context switch
- * resulting in lower RAM usage and faster context switch.
- *
- * @note This option is only usable with the GCC compiler and is only useful
- * on processors with many registers like ARM cores.
- * @note If this option is enabled then ALL the libraries linked to the
- * ChibiOS/RT code <b>must</b> be recompiled with the GCC option @p
- * -ffixed-@<reg@>.
- * @note This option must be enabled in the Makefile, it is listed here for
- * documentation only.
- */
-#if defined(__DOXYGEN__)
-#define CH_CURRP_REGISTER_CACHE "reg"
-#endif
-
/*===========================================================================*/
/* Subsystem options. */
/*===========================================================================*/
@@ -280,7 +278,6 @@
* @details If enabled then the I/O queues APIs are included in the kernel.
*
* @note The default is @p TRUE.
- * @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__)
#define CH_USE_QUEUES TRUE
@@ -303,7 +300,7 @@
* in the kernel.
*
* @note The default is @p TRUE.
- * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or
+ * @note Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or
* @p CH_USE_SEMAPHORES.
* @note Mutexes are recommended.
*/
@@ -318,7 +315,7 @@
*
* @note The default is @p FALSE.
* @note Requires @p CH_USE_HEAP.
- * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the
+ * @note The C-runtime may or may not require @p CH_USE_MEMCORE, see the
* appropriate documentation.
*/
#if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h
index f9ce1975c..2829fb066 100644
--- a/test/coverage/halconf.h
+++ b/test/coverage/halconf.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -55,6 +56,13 @@
#endif
/**
+ * @brief Enables the GPT subsystem.
+ */
+#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
+#define HAL_USE_GPT FALSE
+#endif
+
+/**
* @brief Enables the I2C subsystem.
*/
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
@@ -62,6 +70,13 @@
#endif
/**
+ * @brief Enables the ICU subsystem.
+ */
+#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
+#define HAL_USE_ICU FALSE
+#endif
+
+/**
* @brief Enables the MAC subsystem.
*/
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
@@ -83,6 +98,13 @@
#endif
/**
+ * @brief Enables the SDC subsystem.
+ */
+#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
+#define HAL_USE_SDC FALSE
+#endif
+
+/**
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
@@ -90,6 +112,13 @@
#endif
/**
+ * @brief Enables the SERIAL over USB subsystem.
+ */
+#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
+#define HAL_USE_SERIAL_USB FALSE
+#endif
+
+/**
* @brief Enables the SPI subsystem.
*/
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
@@ -103,6 +132,13 @@
#define HAL_USE_UART FALSE
#endif
+/**
+ * @brief Enables the USB subsystem.
+ */
+#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
+#define HAL_USE_USB FALSE
+#endif
+
/*===========================================================================*/
/* ADC driver related settings. */
/*===========================================================================*/
@@ -207,6 +243,36 @@
/*===========================================================================*/
/*===========================================================================*/
+/* SDC driver related settings. */
+/*===========================================================================*/
+/**
+ * @brief Number of initialization attempts before rejecting the card.
+ * @note Attempts are performed at 10mS intevals.
+ */
+#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
+#define SDC_INIT_RETRY 100
+#endif
+
+/**
+ * @brief Include support for MMC cards.
+ * @note MMC support is not yet implemented so this option must be kept
+ * at @p FALSE.
+ */
+#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
+#define SDC_MMC_SUPPORT FALSE
+#endif
+
+/**
+ * @brief Delays insertions.
+ * @details If enabled this options inserts delays into the MMC waiting
+ * routines releasing some extra CPU time for the threads with
+ * lower priority, this may slow down the driver a bit however.
+ */
+#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
+#define SDC_NICE_WAITING TRUE
+#endif
+
+/*===========================================================================*/
/* SERIAL driver related settings. */
/*===========================================================================*/
diff --git a/test/coverage/main.c b/test/coverage/main.c
index b6f1ee696..a2df0a409 100644
--- a/test/coverage/main.c
+++ b/test/coverage/main.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/test.c b/test/test.c
index 00b5858bc..41662308c 100644
--- a/test/test.c
+++ b/test/test.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -327,9 +328,9 @@ msg_t TestThread(void *p) {
test_println("***");
test_print("*** Kernel: ");
test_println(CH_KERNEL_VERSION);
-#ifdef __GNUC__
- test_print("*** GCC Version: ");
- test_println(__VERSION__);
+#ifdef CH_COMPILER_NAME
+ test_print("*** Compiler: ");
+ test_println(CH_COMPILER_NAME);
#endif
test_print("*** Architecture: ");
test_println(CH_ARCHITECTURE_NAME);
@@ -337,6 +338,10 @@ msg_t TestThread(void *p) {
test_print("*** Core Variant: ");
test_println(CH_CORE_VARIANT_NAME);
#endif
+#ifdef CH_PORT_INFO
+ test_print("*** Port Info: ");
+ test_println(CH_PORT_INFO);
+#endif
#ifdef PLATFORM_NAME
test_print("*** Platform: ");
test_println(PLATFORM_NAME);
diff --git a/test/test.dox b/test/test.dox
index beda6d0ea..296e2145e 100644
--- a/test/test.dox
+++ b/test/test.dox
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/test.h b/test/test.h
index 987e361bf..31806fddb 100644
--- a/test/test.h
+++ b/test/test.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testbmk.c b/test/testbmk.c
index 0f38eb78b..54da81fd8 100644
--- a/test/testbmk.c
+++ b/test/testbmk.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -60,16 +61,19 @@
*/
static Semaphore sem1;
-#if CH_USE_MUTEXES
+#if CH_USE_MUTEXES || defined(__DOXYGEN__)
static Mutex mtx1;
#endif
static msg_t thread1(void *p) {
+ Thread *tp;
msg_t msg;
(void)p;
do {
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
} while (msg);
return 0;
}
@@ -573,7 +577,7 @@ ROMCONST struct testcase testbmk11 = {
bmk11_execute
};
-#if CH_USE_MUTEXES
+#if CH_USE_MUTEXES || defined(__DOXYGEN__)
/**
* @page test_benchmarks_012 Mutexes lock/unlock performance
*
@@ -631,9 +635,11 @@ ROMCONST struct testcase testbmk12 = {
static void bmk13_execute(void) {
test_print("--- System: ");
- test_printn(sizeof(ReadyList) + sizeof(VTList) + IDLE_THREAD_STACK_SIZE +
- (sizeof(Thread) + sizeof(struct intctx) + sizeof(struct extctx) +
- INT_REQUIRED_STACK) * 2);
+ test_printn(sizeof(ReadyList) + sizeof(VTList) +
+ PORT_IDLE_THREAD_STACK_SIZE +
+ (sizeof(Thread) + sizeof(struct intctx) +
+ sizeof(struct extctx) +
+ PORT_INT_REQUIRED_STACK) * 2);
test_println(" bytes");
test_print("--- Thread: ");
test_printn(sizeof(Thread));
@@ -644,7 +650,7 @@ static void bmk13_execute(void) {
test_print("--- Semaph: ");
test_printn(sizeof(Semaphore));
test_println(" bytes");
-#if CH_USE_EVENTS
+#if CH_USE_EVENTS || defined(__DOXYGEN__)
test_print("--- EventS: ");
test_printn(sizeof(EventSource));
test_println(" bytes");
@@ -652,22 +658,22 @@ static void bmk13_execute(void) {
test_printn(sizeof(EventListener));
test_println(" bytes");
#endif
-#if CH_USE_MUTEXES
+#if CH_USE_MUTEXES || defined(__DOXYGEN__)
test_print("--- Mutex : ");
test_printn(sizeof(Mutex));
test_println(" bytes");
#endif
-#if CH_USE_CONDVARS
+#if CH_USE_CONDVARS || defined(__DOXYGEN__)
test_print("--- CondV.: ");
test_printn(sizeof(CondVar));
test_println(" bytes");
#endif
-#if CH_USE_QUEUES
+#if CH_USE_QUEUES || defined(__DOXYGEN__)
test_print("--- Queue : ");
test_printn(sizeof(GenericQueue));
test_println(" bytes");
#endif
-#if CH_USE_MAILBOXES
+#if CH_USE_MAILBOXES || defined(__DOXYGEN__)
test_print("--- MailB.: ");
test_printn(sizeof(Mailbox));
test_println(" bytes");
@@ -697,7 +703,7 @@ ROMCONST struct testcase * ROMCONST patternbmk[] = {
&testbmk9,
&testbmk10,
&testbmk11,
-#if CH_USE_MUTEXES
+#if CH_USE_MUTEXES || defined(__DOXYGEN__)
&testbmk12,
#endif
&testbmk13,
diff --git a/test/testbmk.h b/test/testbmk.h
index 5dde9a60c..43d4f2a22 100644
--- a/test/testbmk.h
+++ b/test/testbmk.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testdyn.c b/test/testdyn.c
index 2035224a1..d015e2ac6 100644
--- a/test/testdyn.c
+++ b/test/testdyn.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -52,11 +53,11 @@
* @brief Dynamic thread APIs test header file
*/
-#if CH_USE_DYNAMIC
-#if CH_USE_HEAP
+#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
static MemoryHeap heap1;
#endif
-#if CH_USE_MEMPOOLS
+#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
static MemoryPool mp1;
#endif
@@ -77,7 +78,7 @@ static msg_t thread(void *p) {
return 0;
}
-#if CH_USE_HEAP
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
static void dyn1_setup(void) {
chHeapInit(&heap1, test.buffer, sizeof(union test_buffers));
@@ -123,9 +124,9 @@ ROMCONST struct testcase testdyn1 = {
NULL,
dyn1_execute
};
-#endif /* CH_USE_HEAP */
+#endif /* (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) */
-#if CH_USE_MEMPOOLS
+#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
/**
* @page test_dynamic_002 Threads creation from Memory Pool
*
@@ -181,7 +182,8 @@ ROMCONST struct testcase testdyn2 = {
};
#endif /* CH_USE_MEMPOOLS */
-#if CH_USE_HEAP && CH_USE_REGISTRY
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \
+ defined(__DOXYGEN__)
/**
* @page test_dynamic_003 Registry and References test
*
@@ -250,14 +252,15 @@ ROMCONST struct testcase testdyn3 = {
* @brief Test sequence for dynamic APIs.
*/
ROMCONST struct testcase * ROMCONST patterndyn[] = {
-#if CH_USE_DYNAMIC
-#if CH_USE_HEAP
+#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
&testdyn1,
#endif
-#if CH_USE_MEMPOOLS
+#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
&testdyn2,
#endif
-#if CH_USE_HEAP && CH_USE_REGISTRY
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \
+ defined(__DOXYGEN__)
&testdyn3,
#endif
#endif
diff --git a/test/testdyn.h b/test/testdyn.h
index efcd4dc1e..366202d62 100644
--- a/test/testdyn.h
+++ b/test/testdyn.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testevt.c b/test/testevt.c
index 656a8430d..4bdeb8fc9 100644
--- a/test/testevt.c
+++ b/test/testevt.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -50,7 +51,7 @@
* @brief Events test header file
*/
-#if CH_USE_EVENTS
+#if CH_USE_EVENTS || defined(__DOXYGEN__)
#define ALLOWED_DELAY MS2ST(5)
@@ -136,7 +137,7 @@ static void evt2_setup(void) {
static msg_t thread1(void *p) {
chThdSleepMilliseconds(50);
- chEvtSignal((Thread *)p, 1);
+ chEvtSignalFlags((Thread *)p, 1);
return 0;
}
@@ -231,7 +232,7 @@ ROMCONST struct testcase testevt2 = {
evt2_execute
};
-#if CH_USE_EVENTS_TIMEOUT
+#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
/**
* @page test_events_003 Events timeout
*
@@ -284,10 +285,10 @@ ROMCONST struct testcase testevt3 = {
* @brief Test sequence for events.
*/
ROMCONST struct testcase * ROMCONST patternevt[] = {
-#if CH_USE_EVENTS
+#if CH_USE_EVENTS || defined(__DOXYGEN__)
&testevt1,
&testevt2,
-#if CH_USE_EVENTS_TIMEOUT
+#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
&testevt3,
#endif
#endif
diff --git a/test/testevt.h b/test/testevt.h
index 687b16912..810257608 100644
--- a/test/testevt.h
+++ b/test/testevt.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testheap.c b/test/testheap.c
index 94fb87bb9..6316b56c6 100644
--- a/test/testheap.c
+++ b/test/testheap.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -47,7 +48,7 @@
* @brief Heap header file
*/
-#if CH_USE_HEAP
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
#define SIZE 16
@@ -155,7 +156,7 @@ ROMCONST struct testcase testheap1 = {
* @brief Test sequence for heap.
*/
ROMCONST struct testcase * ROMCONST patternheap[] = {
-#if CH_USE_HEAP
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
&testheap1,
#endif
NULL
diff --git a/test/testheap.h b/test/testheap.h
index d5ce66ce3..4515f8846 100644
--- a/test/testheap.h
+++ b/test/testheap.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testmbox.c b/test/testmbox.c
index b3ac17e01..8797536c6 100644
--- a/test/testmbox.c
+++ b/test/testmbox.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -50,7 +51,7 @@
* @brief Mailboxes header file
*/
-#if CH_USE_MAILBOXES
+#if CH_USE_MAILBOXES || defined(__DOXYGEN__)
#define ALLOWED_DELAY MS2ST(5)
#define MB_SIZE 5
@@ -100,46 +101,95 @@ static void mbox1_execute(void) {
*/
msg1 = chMBPost(&mb1, 'X', 1);
test_assert(4, msg1 == RDY_TIMEOUT, "wrong wake-up message");
+ msg1 = chMBPostI(&mb1, 'X');
+ test_assert(5, msg1 == RDY_TIMEOUT, "wrong wake-up message");
+ msg1 = chMBPostAhead(&mb1, 'X', 1);
+ test_assert(6, msg1 == RDY_TIMEOUT, "wrong wake-up message");
+ msg1 = chMBPostAheadI(&mb1, 'X');
+ test_assert(7, msg1 == RDY_TIMEOUT, "wrong wake-up message");
/*
* Testing final conditions.
*/
- test_assert(5, chMBGetFreeCountI(&mb1) == 0, "still empty");
- test_assert(6, chMBGetUsedCountI(&mb1) == MB_SIZE, "not full");
- test_assert(7, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ test_assert(8, chMBGetFreeCountI(&mb1) == 0, "still empty");
+ test_assert(9, chMBGetUsedCountI(&mb1) == MB_SIZE, "not full");
+ test_assert(10, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
/*
* Testing dequeuing.
*/
for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
- test_assert(8, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ test_assert(11, msg1 == RDY_OK, "wrong wake-up message");
test_emit_token(msg2);
}
- test_assert_sequence(9, "ABCDE");
+ test_assert_sequence(12, "ABCDE");
/*
* Testing buffer circularity.
*/
msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
- test_assert(10, msg1 == RDY_OK, "wrong wake-up message");
+ test_assert(13, msg1 == RDY_OK, "wrong wake-up message");
msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
- test_assert(11, msg1 == RDY_OK, "wrong wake-up message");
- test_assert(12, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
- test_assert(13, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
+ test_assert(14, msg1 == RDY_OK, "wrong wake-up message");
+ test_assert(15, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
+ test_assert(16, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
/*
* Testing fetch timeout.
*/
msg1 = chMBFetch(&mb1, &msg2, 1);
- test_assert(14, msg1 == RDY_TIMEOUT, "wrong wake-up message");
+ test_assert(17, msg1 == RDY_TIMEOUT, "wrong wake-up message");
+ msg1 = chMBFetchI(&mb1, &msg2);
+ test_assert(18, msg1 == RDY_TIMEOUT, "wrong wake-up message");
/*
* Testing final conditions.
*/
- test_assert(15, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
- test_assert(16, chMBGetUsedCountI(&mb1) == 0, "still full");
- test_assert(17, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ test_assert(19, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
+ test_assert(20, chMBGetUsedCountI(&mb1) == 0, "still full");
+ test_assert(21, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+
+ /*
+ * Testing I-Class.
+ */
+ msg1 = chMBPostI(&mb1, 'A');
+ test_assert(22, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBPostI(&mb1, 'B');
+ test_assert(23, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBPostI(&mb1, 'C');
+ test_assert(24, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBPostI(&mb1, 'D');
+ test_assert(25, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBPostI(&mb1, 'E');
+ test_assert(26, msg1 == RDY_OK, "wrong wake-up message");
+ test_assert(27, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ for (i = 0; i < MB_SIZE; i++) {
+ msg1 = chMBFetchI(&mb1, &msg2);
+ test_assert(28, msg1 == RDY_OK, "wrong wake-up message");
+ test_emit_token(msg2);
+ }
+ test_assert_sequence(29, "ABCDE");
+ test_assert(30, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+
+ msg1 = chMBPostAheadI(&mb1, 'E');
+ test_assert(31, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBPostAheadI(&mb1, 'D');
+ test_assert(32, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBPostAheadI(&mb1, 'C');
+ test_assert(33, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBPostAheadI(&mb1, 'B');
+ test_assert(34, msg1 == RDY_OK, "wrong wake-up message");
+ msg1 = chMBPostAheadI(&mb1, 'A');
+ test_assert(35, msg1 == RDY_OK, "wrong wake-up message");
+ test_assert(36, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ for (i = 0; i < MB_SIZE; i++) {
+ msg1 = chMBFetchI(&mb1, &msg2);
+ test_assert(37, msg1 == RDY_OK, "wrong wake-up message");
+ test_emit_token(msg2);
+ }
+ test_assert_sequence(38, "ABCDE");
+ test_assert(39, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
/*
* Testing reset.
@@ -149,10 +199,10 @@ static void mbox1_execute(void) {
/*
* Re-testing final conditions.
*/
- test_assert(18, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
- test_assert(19, chMBGetUsedCountI(&mb1) == 0, "still full");
- test_assert(20, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
- test_assert(21, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
+ test_assert(40, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
+ test_assert(41, chMBGetUsedCountI(&mb1) == 0, "still full");
+ test_assert(42, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
+ test_assert(43, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
}
ROMCONST struct testcase testmbox1 = {
@@ -168,7 +218,7 @@ ROMCONST struct testcase testmbox1 = {
* @brief Test sequence for mailboxes.
*/
ROMCONST struct testcase * ROMCONST patternmbox[] = {
-#if CH_USE_MAILBOXES
+#if CH_USE_MAILBOXES || defined(__DOXYGEN__)
&testmbox1,
#endif
NULL
diff --git a/test/testmbox.h b/test/testmbox.h
index fc75552a3..c57a52495 100644
--- a/test/testmbox.h
+++ b/test/testmbox.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testmsg.c b/test/testmsg.c
index 881db167f..54c049d44 100644
--- a/test/testmsg.c
+++ b/test/testmsg.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -48,7 +49,7 @@
* @brief Messages header file
*/
-#if CH_USE_MESSAGES
+#if CH_USE_MESSAGES || defined(__DOXYGEN__)
/**
* @page test_msg_001 Messages Server loop
@@ -64,11 +65,11 @@ static msg_t thread(void *p) {
chMsgSend(p, 'A');
chMsgSend(p, 'B');
chMsgSend(p, 'C');
- chMsgSend(p, 'D');
return 0;
}
static void msg1_execute(void) {
+ Thread *tp;
msg_t msg;
/*
@@ -76,29 +77,19 @@ static void msg1_execute(void) {
*/
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1,
thread, chThdSelf());
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
test_assert_sequence(1, "ABC");
-
- /*
- * Testing message fetch using chMsgGet().
- * Note, the following is valid because the sender has higher priority than
- * the receiver.
- */
- msg = chMsgGet();
- test_assert(1, msg != 0, "no message");
- chMsgRelease(0);
- test_assert(2, msg == 'D', "wrong message");
-
- /*
- * Must not have pending messages.
- */
- msg = chMsgGet();
- test_assert(3, msg == 0, "unknown message");
}
ROMCONST struct testcase testmsg1 = {
@@ -114,7 +105,7 @@ ROMCONST struct testcase testmsg1 = {
* @brief Test sequence for messages.
*/
ROMCONST struct testcase * ROMCONST patternmsg[] = {
-#if CH_USE_MESSAGES
+#if CH_USE_MESSAGES || defined(__DOXYGEN__)
&testmsg1,
#endif
NULL
diff --git a/test/testmsg.h b/test/testmsg.h
index d7817d427..7193156bd 100644
--- a/test/testmsg.h
+++ b/test/testmsg.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testmtx.c b/test/testmtx.c
index 9ca9edc85..08329a33b 100644
--- a/test/testmtx.c
+++ b/test/testmtx.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -59,7 +60,7 @@
* @brief Mutexes and CondVars test header file
*/
-#if CH_USE_MUTEXES
+#if CH_USE_MUTEXES || defined(__DOXYGEN__)
#define ALLOWED_DELAY 5
@@ -70,7 +71,7 @@
*/
static MUTEX_DECL(m1);
static MUTEX_DECL(m2);
-#if CH_USE_CONDVARS
+#if CH_USE_CONDVARS || defined(__DOXYGEN__)
static CONDVAR_DECL(c1);
#endif
@@ -119,7 +120,7 @@ ROMCONST struct testcase testmtx1 = {
mtx1_execute
};
-#if CH_DBG_THREADS_PROFILING
+#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__)
/**
* @page test_mtx_002 Priority inheritance, simple case
*
@@ -466,7 +467,7 @@ ROMCONST struct testcase testmtx5 = {
mtx5_execute
};
-#if CH_USE_CONDVARS
+#if CH_USE_CONDVARS || defined(__DOXYGEN__)
/**
* @page test_mtx_006 Condition Variable signal test
*
@@ -577,7 +578,7 @@ static msg_t thread11(void *p) {
chMtxLock(&m2);
chMtxLock(&m1);
-#if CH_USE_CONDVARS_TIMEOUT
+#if CH_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
chCondWaitTimeout(&c1, TIME_INFINITE);
#else
chCondWait(&c1);
@@ -621,15 +622,15 @@ ROMCONST struct testcase testmtx8 = {
* @brief Test sequence for mutexes.
*/
ROMCONST struct testcase * ROMCONST patternmtx[] = {
-#if CH_USE_MUTEXES
+#if CH_USE_MUTEXES || defined(__DOXYGEN__)
&testmtx1,
-#if CH_DBG_THREADS_PROFILING
+#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__)
&testmtx2,
&testmtx3,
#endif
&testmtx4,
&testmtx5,
-#if CH_USE_CONDVARS
+#if CH_USE_CONDVARS || defined(__DOXYGEN__)
&testmtx6,
&testmtx7,
&testmtx8,
diff --git a/test/testmtx.h b/test/testmtx.h
index cd7ddf497..3bfaba78f 100644
--- a/test/testmtx.h
+++ b/test/testmtx.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testpools.c b/test/testpools.c
index c503ecbda..afdd37018 100644
--- a/test/testpools.c
+++ b/test/testpools.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -47,7 +48,7 @@
* @brief Memory Pools test header file
*/
-#if CH_USE_MEMPOOLS
+#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
static MEMORYPOOL_DECL(mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL);
@@ -103,7 +104,7 @@ ROMCONST struct testcase testpools1 = {
* @brief Test sequence for pools.
*/
ROMCONST struct testcase * ROMCONST patternpools[] = {
-#if CH_USE_MEMPOOLS
+#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
&testpools1,
#endif
NULL
diff --git a/test/testpools.h b/test/testpools.h
index 5f526f1d6..a11ef4de7 100644
--- a/test/testpools.h
+++ b/test/testpools.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testqueues.c b/test/testqueues.c
index dd4d00fba..55945761d 100644
--- a/test/testqueues.c
+++ b/test/testqueues.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -53,7 +54,7 @@
* @brief I/O Queues test header file
*/
-#if CH_USE_QUEUES
+#if CH_USE_QUEUES || defined(__DOXYGEN__)
#define TEST_QUEUES_SIZE 4
@@ -223,7 +224,7 @@ ROMCONST struct testcase testqueues2 = {
* @brief Test sequence for queues.
*/
ROMCONST struct testcase * ROMCONST patternqueues[] = {
-#if CH_USE_QUEUES
+#if CH_USE_QUEUES || defined(__DOXYGEN__)
&testqueues1,
&testqueues2,
#endif
diff --git a/test/testqueues.h b/test/testqueues.h
index 1f86fc763..ff9b6a618 100644
--- a/test/testqueues.h
+++ b/test/testqueues.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testsem.c b/test/testsem.c
index 25d87f3f1..6a6a622ef 100644
--- a/test/testsem.c
+++ b/test/testsem.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -50,7 +51,7 @@
* @brief Semaphores test header file
*/
-#if CH_USE_SEMAPHORES
+#if CH_USE_SEMAPHORES || defined(__DOXYGEN__)
#define ALLOWED_DELAY MS2ST(5)
@@ -103,9 +104,9 @@ static void sem1_execute(void) {
test_assert_sequence(1, "ABCDE");
#endif
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread1, "A");
- chSemSetCounterI(&sem1, 2);
+ chSemAddCounterI(&sem1, 2);
test_wait_threads();
- test_assert(2, chSemGetCounterI(&sem1) == 2, "invalid counter");
+ test_assert(2, chSemGetCounterI(&sem1) == 1, "invalid counter");
}
ROMCONST struct testcase testsem1 = {
@@ -189,7 +190,7 @@ ROMCONST struct testcase testsem2 = {
sem2_execute
};
-#if CH_USE_SEMSW
+#if CH_USE_SEMSW || defined(__DOXYGEN__)
/**
* @page test_sem_003 Atomic signal-wait test
*
@@ -291,10 +292,10 @@ ROMCONST struct testcase testsem4 = {
* @brief Test sequence for semaphores.
*/
ROMCONST struct testcase * ROMCONST patternsem[] = {
-#if CH_USE_SEMAPHORES
+#if CH_USE_SEMAPHORES || defined(__DOXYGEN__)
&testsem1,
&testsem2,
-#if CH_USE_SEMSW
+#if CH_USE_SEMSW || defined(__DOXYGEN__)
&testsem3,
#endif
&testsem4,
diff --git a/test/testsem.h b/test/testsem.h
index cfa3b6330..032c75436 100644
--- a/test/testsem.h
+++ b/test/testsem.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
diff --git a/test/testthd.c b/test/testthd.c
index 8b0440248..3433d2eb4 100644
--- a/test/testthd.c
+++ b/test/testthd.c
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -141,7 +142,7 @@ static void thd3_execute(void) {
test_assert(4, chThdGetPriority() == prio,
"unexpected priority level");
-#if CH_USE_MUTEXES
+#if CH_USE_MUTEXES || defined(__DOXYGEN__)
/* Simulates a priority boost situation (p_prio > p_realprio).*/
chSysLock();
chThdSelf()->p_prio += 2;
diff --git a/test/testthd.h b/test/testthd.h
index e355f63fb..5435cc02d 100644
--- a/test/testthd.h
+++ b/test/testthd.h
@@ -1,5 +1,6 @@
/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.