From 6a14c665818d8a35311833ca98e76210cef4f2ca Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 17 Apr 2016 06:38:00 +0000 Subject: Fixed invalid EOL in generated files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9301 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/nasa_osal/source/test/test_root.c | 6 +- test/nasa_osal/source/test/test_root.h | 16 +- test/nasa_osal/source/test/test_sequence_001.c | 70 ++--- test/nasa_osal/source/test/test_sequence_001.h | 2 +- test/nasa_osal/source/test/test_sequence_002.c | 38 +-- test/nasa_osal/source/test/test_sequence_002.h | 2 +- test/nasa_osal/source/test/test_sequence_003.c | 24 +- test/nasa_osal/source/test/test_sequence_003.h | 2 +- test/nasa_osal/source/test/test_sequence_004.c | 4 +- test/nasa_osal/source/test/test_sequence_004.h | 2 +- test/nasa_osal/source/test/test_sequence_005.c | 4 +- test/nasa_osal/source/test/test_sequence_005.h | 2 +- test/nasa_osal/source/test/test_sequence_006.c | 4 +- test/nasa_osal/source/test/test_sequence_006.h | 2 +- test/nil/source/test/test_root.c | 92 +++--- test/nil/source/test/test_root.h | 40 +-- test/nil/source/test/test_sequence_001.c | 28 +- test/nil/source/test/test_sequence_001.h | 30 +- test/nil/source/test/test_sequence_002.c | 32 +-- test/nil/source/test/test_sequence_002.h | 30 +- test/nil/source/test/test_sequence_003.c | 28 +- test/nil/source/test/test_sequence_003.h | 30 +- test/nil/source/test/test_sequence_004.c | 36 +-- test/nil/source/test/test_sequence_004.h | 30 +- test/nil/source/test/test_sequence_005.c | 58 ++-- test/nil/source/test/test_sequence_005.h | 30 +- test/nil/source/test/test_sequence_006.c | 36 +-- test/nil/source/test/test_sequence_006.h | 30 +- test/rt/source/test/test_root.c | 124 ++++----- test/rt/source/test/test_root.h | 128 ++++----- test/rt/source/test/test_sequence_001.c | 58 ++-- test/rt/source/test/test_sequence_001.h | 30 +- test/rt/source/test/test_sequence_002.c | 34 +-- test/rt/source/test/test_sequence_002.h | 30 +- test/rt/source/test/test_sequence_003.c | 46 +-- test/rt/source/test/test_sequence_003.h | 30 +- test/rt/source/test/test_sequence_004.c | 88 +++--- test/rt/source/test/test_sequence_004.h | 30 +- test/rt/source/test/test_sequence_005.c | 372 ++++++++++++------------- test/rt/source/test/test_sequence_005.h | 30 +- test/rt/source/test/test_sequence_006.c | 40 +-- test/rt/source/test/test_sequence_006.h | 30 +- test/rt/source/test/test_sequence_007.c | 68 ++--- test/rt/source/test/test_sequence_007.h | 30 +- test/rt/source/test/test_sequence_008.c | 34 +-- test/rt/source/test/test_sequence_008.h | 30 +- test/rt/source/test/test_sequence_009.c | 58 ++-- test/rt/source/test/test_sequence_009.h | 30 +- test/rt/source/test/test_sequence_010.c | 36 +-- test/rt/source/test/test_sequence_010.h | 30 +- test/rt/source/test/test_sequence_011.c | 48 ++-- test/rt/source/test/test_sequence_011.h | 30 +- test/rt/source/test/test_sequence_012.c | 186 ++++++------- test/rt/source/test/test_sequence_012.h | 30 +- 54 files changed, 1194 insertions(+), 1194 deletions(-) (limited to 'test') diff --git a/test/nasa_osal/source/test/test_root.c b/test/nasa_osal/source/test/test_root.c index 2081b7714..be977e983 100644 --- a/test/nasa_osal/source/test/test_root.c +++ b/test/nasa_osal/source/test/test_root.c @@ -48,9 +48,9 @@ const testcase_t * const *test_suite[] = { /* Shared code. */ /*===========================================================================*/ -THD_WORKING_AREA(wa_test1, TASKS_STACK_SIZE); -THD_WORKING_AREA(wa_test2, TASKS_STACK_SIZE); -THD_WORKING_AREA(wa_test3, TASKS_STACK_SIZE); +THD_WORKING_AREA(wa_test1, TASKS_STACK_SIZE); +THD_WORKING_AREA(wa_test2, TASKS_STACK_SIZE); +THD_WORKING_AREA(wa_test3, TASKS_STACK_SIZE); THD_WORKING_AREA(wa_test4, TASKS_STACK_SIZE); #endif /* !defined(__DOXYGEN__) */ diff --git a/test/nasa_osal/source/test/test_root.h b/test/nasa_osal/source/test/test_root.h index 8da782715..eb6fbb801 100644 --- a/test/nasa_osal/source/test/test_root.h +++ b/test/nasa_osal/source/test/test_root.h @@ -34,14 +34,14 @@ extern "C" { /* Shared definitions. */ /*===========================================================================*/ -#define TEST_SUITE_NAME "NASA OSAL over ChibiOS/RT Test Suite" - -#define TASKS_BASE_PRIORITY 200 -#define TASKS_STACK_SIZE 256 - -extern THD_WORKING_AREA(wa_test1, TASKS_STACK_SIZE); -extern THD_WORKING_AREA(wa_test2, TASKS_STACK_SIZE); -extern THD_WORKING_AREA(wa_test3, TASKS_STACK_SIZE); +#define TEST_SUITE_NAME "NASA OSAL over ChibiOS/RT Test Suite" + +#define TASKS_BASE_PRIORITY 200 +#define TASKS_STACK_SIZE 256 + +extern THD_WORKING_AREA(wa_test1, TASKS_STACK_SIZE); +extern THD_WORKING_AREA(wa_test2, TASKS_STACK_SIZE); +extern THD_WORKING_AREA(wa_test3, TASKS_STACK_SIZE); extern THD_WORKING_AREA(wa_test4, TASKS_STACK_SIZE); #endif /* !defined(__DOXYGEN__) */ diff --git a/test/nasa_osal/source/test/test_sequence_001.c b/test/nasa_osal/source/test/test_sequence_001.c index 38a1bf351..95bbeee8a 100644 --- a/test/nasa_osal/source/test/test_sequence_001.c +++ b/test/nasa_osal/source/test/test_sequence_001.c @@ -28,41 +28,41 @@ * Shared code. ****************************************************************************/ -#include "osapi.h" - -static void test_task1(void) { - - test_emit_token('A'); -} - -static void test_task2(void) { - - test_emit_token('B'); -} - -static void test_task3(void) { - - test_emit_token('C'); -} - -static void test_task4(void) { - - test_emit_token('D'); -} - -static void delete_handler(void) { - - test_emit_token('C'); -} - -static void test_task_delete(void) { - - test_emit_token('A'); - (void) OS_TaskInstallDeleteHandler(delete_handler); - while (!OS_TaskDeleteCheck()) { - (void) OS_TaskDelay(1); - } - test_emit_token('B'); +#include "osapi.h" + +static void test_task1(void) { + + test_emit_token('A'); +} + +static void test_task2(void) { + + test_emit_token('B'); +} + +static void test_task3(void) { + + test_emit_token('C'); +} + +static void test_task4(void) { + + test_emit_token('D'); +} + +static void delete_handler(void) { + + test_emit_token('C'); +} + +static void test_task_delete(void) { + + test_emit_token('A'); + (void) OS_TaskInstallDeleteHandler(delete_handler); + while (!OS_TaskDeleteCheck()) { + (void) OS_TaskDelay(1); + } + test_emit_token('B'); } /**************************************************************************** diff --git a/test/nasa_osal/source/test/test_sequence_001.h b/test/nasa_osal/source/test/test_sequence_001.h index 944739ef8..080660f74 100644 --- a/test/nasa_osal/source/test/test_sequence_001.h +++ b/test/nasa_osal/source/test/test_sequence_001.h @@ -1,7 +1,7 @@ /* Copyright statement.*/ /** - * @file test_sequence_001.h + * @file test_sequence_001.h * @brief Test Sequence 001 header. */ diff --git a/test/nasa_osal/source/test/test_sequence_002.c b/test/nasa_osal/source/test/test_sequence_002.c index 0a67f296c..a993de35c 100644 --- a/test/nasa_osal/source/test/test_sequence_002.c +++ b/test/nasa_osal/source/test/test_sequence_002.c @@ -28,25 +28,25 @@ * Shared code. ****************************************************************************/ -#include - -#include "osapi.h" - -uint32 qid, tid; - -#define WRITER_NUM_MESSAGES 16 -#define MESSAGE_SIZE 20 - -static void test_task_writer(void) { - unsigned i; - int32 err; - - for (i = 0; i < WRITER_NUM_MESSAGES; i++) { - err = OS_QueuePut(qid, "Hello World", 12, 0); - if (err != OS_SUCCESS) { - test_emit_token('*'); - } - } +#include + +#include "osapi.h" + +uint32 qid, tid; + +#define WRITER_NUM_MESSAGES 16 +#define MESSAGE_SIZE 20 + +static void test_task_writer(void) { + unsigned i; + int32 err; + + for (i = 0; i < WRITER_NUM_MESSAGES; i++) { + err = OS_QueuePut(qid, "Hello World", 12, 0); + if (err != OS_SUCCESS) { + test_emit_token('*'); + } + } } /**************************************************************************** diff --git a/test/nasa_osal/source/test/test_sequence_002.h b/test/nasa_osal/source/test/test_sequence_002.h index 4cc10eeb8..56a3d36d7 100644 --- a/test/nasa_osal/source/test/test_sequence_002.h +++ b/test/nasa_osal/source/test/test_sequence_002.h @@ -1,7 +1,7 @@ /* Copyright statement.*/ /** - * @file test_sequence_002.h + * @file test_sequence_002.h * @brief Test Sequence 002 header. */ diff --git a/test/nasa_osal/source/test/test_sequence_003.c b/test/nasa_osal/source/test/test_sequence_003.c index 56663666e..c49e7395e 100644 --- a/test/nasa_osal/source/test/test_sequence_003.c +++ b/test/nasa_osal/source/test/test_sequence_003.c @@ -29,18 +29,18 @@ * Shared code. ****************************************************************************/ -#include - -#include "osapi.h" - -uint32 tmid; -uint32 cnt; - -static void tmr_callback(uint32 timer_id) { - - (void)timer_id; - - cnt++; +#include + +#include "osapi.h" + +uint32 tmid; +uint32 cnt; + +static void tmr_callback(uint32 timer_id) { + + (void)timer_id; + + cnt++; } /**************************************************************************** diff --git a/test/nasa_osal/source/test/test_sequence_003.h b/test/nasa_osal/source/test/test_sequence_003.h index 75e4209ca..82f40587f 100644 --- a/test/nasa_osal/source/test/test_sequence_003.h +++ b/test/nasa_osal/source/test/test_sequence_003.h @@ -1,7 +1,7 @@ /* Copyright statement.*/ /** - * @file test_sequence_003.h + * @file test_sequence_003.h * @brief Test Sequence 003 header. */ diff --git a/test/nasa_osal/source/test/test_sequence_004.c b/test/nasa_osal/source/test/test_sequence_004.c index 1ca5586e9..b342d845a 100644 --- a/test/nasa_osal/source/test/test_sequence_004.c +++ b/test/nasa_osal/source/test/test_sequence_004.c @@ -31,8 +31,8 @@ * Shared code. ****************************************************************************/ -#include "osapi.h" - +#include "osapi.h" + uint32 bsid; /**************************************************************************** diff --git a/test/nasa_osal/source/test/test_sequence_004.h b/test/nasa_osal/source/test/test_sequence_004.h index 205176fb5..b34358d46 100644 --- a/test/nasa_osal/source/test/test_sequence_004.h +++ b/test/nasa_osal/source/test/test_sequence_004.h @@ -1,7 +1,7 @@ /* Copyright statement.*/ /** - * @file test_sequence_004.h + * @file test_sequence_004.h * @brief Test Sequence 004 header. */ diff --git a/test/nasa_osal/source/test/test_sequence_005.c b/test/nasa_osal/source/test/test_sequence_005.c index 29537ca82..8d9773ec7 100644 --- a/test/nasa_osal/source/test/test_sequence_005.c +++ b/test/nasa_osal/source/test/test_sequence_005.c @@ -30,8 +30,8 @@ * Shared code. ****************************************************************************/ -#include "osapi.h" - +#include "osapi.h" + uint32 csid; /**************************************************************************** diff --git a/test/nasa_osal/source/test/test_sequence_005.h b/test/nasa_osal/source/test/test_sequence_005.h index 99ee7db5b..11aed54c1 100644 --- a/test/nasa_osal/source/test/test_sequence_005.h +++ b/test/nasa_osal/source/test/test_sequence_005.h @@ -1,7 +1,7 @@ /* Copyright statement.*/ /** - * @file test_sequence_005.h + * @file test_sequence_005.h * @brief Test Sequence 005 header. */ diff --git a/test/nasa_osal/source/test/test_sequence_006.c b/test/nasa_osal/source/test/test_sequence_006.c index 73e95cda9..0e6ccec06 100644 --- a/test/nasa_osal/source/test/test_sequence_006.c +++ b/test/nasa_osal/source/test/test_sequence_006.c @@ -28,8 +28,8 @@ * Shared code. ****************************************************************************/ -#include "osapi.h" - +#include "osapi.h" + uint32 msid; /**************************************************************************** diff --git a/test/nasa_osal/source/test/test_sequence_006.h b/test/nasa_osal/source/test/test_sequence_006.h index ba52bf479..a4f3bc211 100644 --- a/test/nasa_osal/source/test/test_sequence_006.h +++ b/test/nasa_osal/source/test/test_sequence_006.h @@ -1,7 +1,7 @@ /* Copyright statement.*/ /** - * @file test_sequence_006.h + * @file test_sequence_006.h * @brief Test Sequence 006 header. */ diff --git a/test/nil/source/test/test_root.c b/test/nil/source/test/test_root.c index a143b6e44..177a46853 100644 --- a/test/nil/source/test/test_root.c +++ b/test/nil/source/test/test_root.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** @@ -70,38 +70,38 @@ const testcase_t * const *test_suite[] = { /* Shared code. */ /*===========================================================================*/ -semaphore_t gsem1, gsem2; -thread_reference_t gtr1; - -/* - * Support thread. - */ -THD_WORKING_AREA(wa_test_support, 128); -THD_FUNCTION(test_support, arg) { -#if CH_CFG_USE_EVENTS == TRUE - thread_t *tp = (thread_t *)arg; -#else - (void)arg; -#endif - - /* Initializing global resources.*/ - chSemObjectInit(&gsem1, 0); - chSemObjectInit(&gsem2, 0); - - while (true) { - chSysLock(); - if (chSemGetCounterI(&gsem1) < 0) - chSemSignalI(&gsem1); - chSemResetI(&gsem2, 0); - chThdResumeI(>r1, MSG_OK); -#if CH_CFG_USE_EVENTS == TRUE - chEvtSignalI(tp, 0x55); -#endif - chSchRescheduleS(); - chSysUnlock(); - - chThdSleepMilliseconds(250); - } +semaphore_t gsem1, gsem2; +thread_reference_t gtr1; + +/* + * Support thread. + */ +THD_WORKING_AREA(wa_test_support, 128); +THD_FUNCTION(test_support, arg) { +#if CH_CFG_USE_EVENTS == TRUE + thread_t *tp = (thread_t *)arg; +#else + (void)arg; +#endif + + /* Initializing global resources.*/ + chSemObjectInit(&gsem1, 0); + chSemObjectInit(&gsem2, 0); + + while (true) { + chSysLock(); + if (chSemGetCounterI(&gsem1) < 0) + chSemSignalI(&gsem1); + chSemResetI(&gsem2, 0); + chThdResumeI(>r1, MSG_OK); +#if CH_CFG_USE_EVENTS == TRUE + chEvtSignalI(tp, 0x55); +#endif + chSchRescheduleS(); + chSysUnlock(); + + chThdSleepMilliseconds(250); + } } #endif /* !defined(__DOXYGEN__) */ diff --git a/test/nil/source/test/test_root.h b/test/nil/source/test/test_root.h index 0b3d65ecf..694abf9c5 100644 --- a/test/nil/source/test/test_root.h +++ b/test/nil/source/test/test_root.h @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** @@ -48,12 +48,12 @@ extern "C" { /* Shared definitions. */ /*===========================================================================*/ -#define TEST_SUITE_NAME "ChibiOS/NIL Test Suite" - -extern semaphore_t gsem1, gsem2; -extern thread_reference_t gtr1; -extern THD_WORKING_AREA(wa_test_support, 128); - +#define TEST_SUITE_NAME "ChibiOS/NIL Test Suite" + +extern semaphore_t gsem1, gsem2; +extern thread_reference_t gtr1; +extern THD_WORKING_AREA(wa_test_support, 128); + THD_FUNCTION(test_support, arg); #endif /* !defined(__DOXYGEN__) */ diff --git a/test/nil/source/test/test_sequence_001.c b/test/nil/source/test/test_sequence_001.c index 6c1babec7..df99ee49b 100644 --- a/test/nil/source/test/test_sequence_001.c +++ b/test/nil/source/test/test_sequence_001.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" diff --git a/test/nil/source/test/test_sequence_001.h b/test/nil/source/test/test_sequence_001.h index a1e55c6fd..a19faca0f 100644 --- a/test/nil/source/test/test_sequence_001.h +++ b/test/nil/source/test/test_sequence_001.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_001.h + * @file test_sequence_001.h * @brief Test Sequence 001 header. */ diff --git a/test/nil/source/test/test_sequence_002.c b/test/nil/source/test/test_sequence_002.c index 445028963..1e0f41d43 100644 --- a/test/nil/source/test/test_sequence_002.c +++ b/test/nil/source/test/test_sequence_002.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -49,8 +49,8 @@ * Shared code. ****************************************************************************/ -#include "ch.h" - +#include "ch.h" + static semaphore_t sem1; /**************************************************************************** diff --git a/test/nil/source/test/test_sequence_002.h b/test/nil/source/test/test_sequence_002.h index bcaee5aae..9925c61e7 100644 --- a/test/nil/source/test/test_sequence_002.h +++ b/test/nil/source/test/test_sequence_002.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_002.h + * @file test_sequence_002.h * @brief Test Sequence 002 header. */ diff --git a/test/nil/source/test/test_sequence_003.c b/test/nil/source/test/test_sequence_003.c index 977ddbca8..bf5c7941f 100644 --- a/test/nil/source/test/test_sequence_003.c +++ b/test/nil/source/test/test_sequence_003.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" diff --git a/test/nil/source/test/test_sequence_003.h b/test/nil/source/test/test_sequence_003.h index c2365aa1d..86169757a 100644 --- a/test/nil/source/test/test_sequence_003.h +++ b/test/nil/source/test/test_sequence_003.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_003.h + * @file test_sequence_003.h * @brief Test Sequence 003 header. */ diff --git a/test/nil/source/test/test_sequence_004.c b/test/nil/source/test/test_sequence_004.c index 7899c0c31..442aa49ba 100644 --- a/test/nil/source/test/test_sequence_004.c +++ b/test/nil/source/test/test_sequence_004.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -49,10 +49,10 @@ * Shared code. ****************************************************************************/ -#define ALLOWED_DELAY MS2ST(5) -#define MB_SIZE 4 - -static msg_t mb_buffer[MB_SIZE]; +#define ALLOWED_DELAY MS2ST(5) +#define MB_SIZE 4 + +static msg_t mb_buffer[MB_SIZE]; static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE); /**************************************************************************** diff --git a/test/nil/source/test/test_sequence_004.h b/test/nil/source/test/test_sequence_004.h index 09677d6fb..8502f9865 100644 --- a/test/nil/source/test/test_sequence_004.h +++ b/test/nil/source/test/test_sequence_004.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_004.h + * @file test_sequence_004.h * @brief Test Sequence 004 header. */ diff --git a/test/nil/source/test/test_sequence_005.c b/test/nil/source/test/test_sequence_005.c index e95011d18..3c0ef8668 100644 --- a/test/nil/source/test/test_sequence_005.c +++ b/test/nil/source/test/test_sequence_005.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -49,21 +49,21 @@ * Shared code. ****************************************************************************/ -#define MEMORY_POOL_SIZE 4 - -static uint32_t objects[MEMORY_POOL_SIZE]; -static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL); - -#if CH_CFG_USE_SEMAPHORES -static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t)); -#endif - -static void *null_provider(size_t size, unsigned align) { - - (void)size; - (void)align; - - return NULL; +#define MEMORY_POOL_SIZE 4 + +static uint32_t objects[MEMORY_POOL_SIZE]; +static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL); + +#if CH_CFG_USE_SEMAPHORES +static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t)); +#endif + +static void *null_provider(size_t size, unsigned align) { + + (void)size; + (void)align; + + return NULL; } /**************************************************************************** diff --git a/test/nil/source/test/test_sequence_005.h b/test/nil/source/test/test_sequence_005.h index 8389efc62..8312381c3 100644 --- a/test/nil/source/test/test_sequence_005.h +++ b/test/nil/source/test/test_sequence_005.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_005.h + * @file test_sequence_005.h * @brief Test Sequence 005 header. */ diff --git a/test/nil/source/test/test_sequence_006.c b/test/nil/source/test/test_sequence_006.c index 907f3f0d6..ba3e8cbf9 100644 --- a/test/nil/source/test/test_sequence_006.c +++ b/test/nil/source/test/test_sequence_006.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -48,10 +48,10 @@ * Shared code. ****************************************************************************/ -#define ALLOC_SIZE 16 -#define HEAP_SIZE (ALLOC_SIZE * 8) - -static memory_heap_t test_heap; +#define ALLOC_SIZE 16 +#define HEAP_SIZE (ALLOC_SIZE * 8) + +static memory_heap_t test_heap; static CH_HEAP_AREA(myheap, HEAP_SIZE); /**************************************************************************** diff --git a/test/nil/source/test/test_sequence_006.h b/test/nil/source/test/test_sequence_006.h index c7cf10a72..eadcf9c8d 100644 --- a/test/nil/source/test/test_sequence_006.h +++ b/test/nil/source/test/test_sequence_006.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_006.h + * @file test_sequence_006.h * @brief Test Sequence 006 header. */ diff --git a/test/rt/source/test/test_root.c b/test/rt/source/test/test_root.c index 71e7787a8..76aeb05ec 100644 --- a/test/rt/source/test/test_root.c +++ b/test/rt/source/test/test_root.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** @@ -90,54 +90,54 @@ const testcase_t * const *test_suite[] = { /* Shared code. */ /*===========================================================================*/ -/* - * Static working areas, the following areas can be used for threads or - * used as temporary buffers. - */ -union test_buffers test; - -/* - * Pointers to the spawned threads. - */ -thread_t *threads[MAX_THREADS]; - -/* - * Pointers to the working areas. - */ -void * ROMCONST wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, - test.wa.T3, test.wa.T4}; - -/* - * Sets a termination request in all the test-spawned threads. - */ -void test_terminate_threads(void) { - unsigned i; - - for (i = 0; i < MAX_THREADS; i++) - if (threads[i]) - chThdTerminate(threads[i]); -} - -/* - * Waits for the completion of all the test-spawned threads. - */ -void test_wait_threads(void) { - unsigned i; - - for (i = 0; i < MAX_THREADS; i++) - if (threads[i] != NULL) { - chThdWait(threads[i]); - threads[i] = NULL; - } -} - -/* - * Delays execution until next system time tick. - */ -systime_t test_wait_tick(void) { - - chThdSleep(1); - return chVTGetSystemTime(); +/* + * Static working areas, the following areas can be used for threads or + * used as temporary buffers. + */ +union test_buffers test; + +/* + * Pointers to the spawned threads. + */ +thread_t *threads[MAX_THREADS]; + +/* + * Pointers to the working areas. + */ +void * ROMCONST wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, + test.wa.T3, test.wa.T4}; + +/* + * Sets a termination request in all the test-spawned threads. + */ +void test_terminate_threads(void) { + unsigned i; + + for (i = 0; i < MAX_THREADS; i++) + if (threads[i]) + chThdTerminate(threads[i]); +} + +/* + * Waits for the completion of all the test-spawned threads. + */ +void test_wait_threads(void) { + unsigned i; + + for (i = 0; i < MAX_THREADS; i++) + if (threads[i] != NULL) { + chThdWait(threads[i]); + threads[i] = NULL; + } +} + +/* + * Delays execution until next system time tick. + */ +systime_t test_wait_tick(void) { + + chThdSleep(1); + return chVTGetSystemTime(); } #endif /* !defined(__DOXYGEN__) */ diff --git a/test/rt/source/test/test_root.h b/test/rt/source/test/test_root.h index 132c50fe4..e2fdb37f3 100644 --- a/test/rt/source/test/test_root.h +++ b/test/rt/source/test/test_root.h @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** @@ -54,56 +54,56 @@ extern "C" { /* Shared definitions. */ /*===========================================================================*/ -#define TEST_SUITE_NAME "ChibiOS/RT Test Suite" - -/* - * Allowed delay in timeout checks. - */ -#define ALLOWED_DELAY MS2ST(2) - -/* - * Maximum number of test threads. - */ -#define MAX_THREADS 5 - -/* - * Stack size of test threads. - */ -#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) -#define THREADS_STACK_SIZE 48 -#elif defined(CH_ARCHITECTURE_STM8) -#define THREADS_STACK_SIZE 64 -#elif defined(CH_ARCHITECTURE_SIMIA32) -#define THREADS_STACK_SIZE 512 -#else -#define THREADS_STACK_SIZE 128 -#endif - -/* - * Working Area size of test threads. - */ -#define WA_SIZE THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE) - -/* - * Union of all Working Areas, usable as a single large buffer if required. - */ -union test_buffers { - struct { - THD_WORKING_AREA(T0, THREADS_STACK_SIZE); - THD_WORKING_AREA(T1, THREADS_STACK_SIZE); - THD_WORKING_AREA(T2, THREADS_STACK_SIZE); - THD_WORKING_AREA(T3, THREADS_STACK_SIZE); - THD_WORKING_AREA(T4, THREADS_STACK_SIZE); - } wa; - uint8_t buffer[WA_SIZE * 5]; -}; - -extern union test_buffers test; -extern thread_t *threads[MAX_THREADS]; -extern void * ROMCONST wa[5]; - -void test_terminate_threads(void); -void test_wait_threads(void); +#define TEST_SUITE_NAME "ChibiOS/RT Test Suite" + +/* + * Allowed delay in timeout checks. + */ +#define ALLOWED_DELAY MS2ST(2) + +/* + * Maximum number of test threads. + */ +#define MAX_THREADS 5 + +/* + * Stack size of test threads. + */ +#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) +#define THREADS_STACK_SIZE 48 +#elif defined(CH_ARCHITECTURE_STM8) +#define THREADS_STACK_SIZE 64 +#elif defined(CH_ARCHITECTURE_SIMIA32) +#define THREADS_STACK_SIZE 512 +#else +#define THREADS_STACK_SIZE 128 +#endif + +/* + * Working Area size of test threads. + */ +#define WA_SIZE THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE) + +/* + * Union of all Working Areas, usable as a single large buffer if required. + */ +union test_buffers { + struct { + THD_WORKING_AREA(T0, THREADS_STACK_SIZE); + THD_WORKING_AREA(T1, THREADS_STACK_SIZE); + THD_WORKING_AREA(T2, THREADS_STACK_SIZE); + THD_WORKING_AREA(T3, THREADS_STACK_SIZE); + THD_WORKING_AREA(T4, THREADS_STACK_SIZE); + } wa; + uint8_t buffer[WA_SIZE * 5]; +}; + +extern union test_buffers test; +extern thread_t *threads[MAX_THREADS]; +extern void * ROMCONST wa[5]; + +void test_terminate_threads(void); +void test_wait_threads(void); systime_t test_wait_tick(void); #endif /* !defined(__DOXYGEN__) */ diff --git a/test/rt/source/test/test_sequence_001.c b/test/rt/source/test/test_sequence_001.c index fa50d05f3..9003fa153 100644 --- a/test/rt/source/test/test_sequence_001.c +++ b/test/rt/source/test/test_sequence_001.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -45,21 +45,21 @@ * Shared code. ****************************************************************************/ -/* Timer callback for testing system functions in ISR context.*/ -static void vtcb(void *p) { - syssts_t sts; - - (void)p; - - /* Testing normal case.*/ - chSysLockFromISR(); - chSysUnlockFromISR(); - - /* Reentrant case.*/ - chSysLockFromISR(); - sts = chSysGetStatusAndLockX(); - chSysRestoreStatusX(sts); - chSysUnlockFromISR(); +/* Timer callback for testing system functions in ISR context.*/ +static void vtcb(void *p) { + syssts_t sts; + + (void)p; + + /* Testing normal case.*/ + chSysLockFromISR(); + chSysUnlockFromISR(); + + /* Reentrant case.*/ + chSysLockFromISR(); + sts = chSysGetStatusAndLockX(); + chSysRestoreStatusX(sts); + chSysUnlockFromISR(); } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_001.h b/test/rt/source/test/test_sequence_001.h index a1e55c6fd..a19faca0f 100644 --- a/test/rt/source/test/test_sequence_001.h +++ b/test/rt/source/test/test_sequence_001.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_001.h + * @file test_sequence_001.h * @brief Test Sequence 001 header. */ diff --git a/test/rt/source/test/test_sequence_002.c b/test/rt/source/test/test_sequence_002.c index 51fb3cd2c..a712021c6 100644 --- a/test/rt/source/test/test_sequence_002.c +++ b/test/rt/source/test/test_sequence_002.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -42,9 +42,9 @@ * Shared code. ****************************************************************************/ -static THD_FUNCTION(thread, p) { - - test_emit_token(*(char *)p); +static THD_FUNCTION(thread, p) { + + test_emit_token(*(char *)p); } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_002.h b/test/rt/source/test/test_sequence_002.h index bcaee5aae..9925c61e7 100644 --- a/test/rt/source/test/test_sequence_002.h +++ b/test/rt/source/test/test_sequence_002.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_002.h + * @file test_sequence_002.h * @brief Test Sequence 002 header. */ diff --git a/test/rt/source/test/test_sequence_003.c b/test/rt/source/test/test_sequence_003.c index d424e1ff3..31b586481 100644 --- a/test/rt/source/test/test_sequence_003.c +++ b/test/rt/source/test/test_sequence_003.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -39,15 +39,15 @@ * Shared code. ****************************************************************************/ -static thread_reference_t tr1; - -static THD_FUNCTION(thread1, p) { - - chSysLock(); - chThdResumeI(&tr1, MSG_OK); - chSchRescheduleS(); - chSysUnlock(); - test_emit_token(*(char *)p); +static thread_reference_t tr1; + +static THD_FUNCTION(thread1, p) { + + chSysLock(); + chThdResumeI(&tr1, MSG_OK); + chSchRescheduleS(); + chSysUnlock(); + test_emit_token(*(char *)p); } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_003.h b/test/rt/source/test/test_sequence_003.h index c2365aa1d..86169757a 100644 --- a/test/rt/source/test/test_sequence_003.h +++ b/test/rt/source/test/test_sequence_003.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_003.h + * @file test_sequence_003.h * @brief Test Sequence 003 header. */ diff --git a/test/rt/source/test/test_sequence_004.c b/test/rt/source/test/test_sequence_004.c index b6d89baf4..eb62cfb76 100644 --- a/test/rt/source/test/test_sequence_004.c +++ b/test/rt/source/test/test_sequence_004.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -52,36 +52,36 @@ * Shared code. ****************************************************************************/ -#include "ch.h" - -static semaphore_t sem1; - -static THD_FUNCTION(thread1, p) { - - chSemWait(&sem1); - test_emit_token(*(char *)p); -} - -static THD_FUNCTION(thread2, p) { - - (void)p; - chThdSleepMilliseconds(50); - chSysLock(); - chSemSignalI(&sem1); /* For coverage reasons */ - chSchRescheduleS(); - chSysUnlock(); -} - -static THD_FUNCTION(thread3, p) { - - (void)p; - chSemWait(&sem1); - chSemSignal(&sem1); -} - -static THD_FUNCTION(thread4, p) { - - chBSemSignal((binary_semaphore_t *)p); +#include "ch.h" + +static semaphore_t sem1; + +static THD_FUNCTION(thread1, p) { + + chSemWait(&sem1); + test_emit_token(*(char *)p); +} + +static THD_FUNCTION(thread2, p) { + + (void)p; + chThdSleepMilliseconds(50); + chSysLock(); + chSemSignalI(&sem1); /* For coverage reasons */ + chSchRescheduleS(); + chSysUnlock(); +} + +static THD_FUNCTION(thread3, p) { + + (void)p; + chSemWait(&sem1); + chSemSignal(&sem1); +} + +static THD_FUNCTION(thread4, p) { + + chBSemSignal((binary_semaphore_t *)p); } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_004.h b/test/rt/source/test/test_sequence_004.h index 09677d6fb..8502f9865 100644 --- a/test/rt/source/test/test_sequence_004.h +++ b/test/rt/source/test/test_sequence_004.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_004.h + * @file test_sequence_004.h * @brief Test Sequence 004 header. */ diff --git a/test/rt/source/test/test_sequence_005.c b/test/rt/source/test/test_sequence_005.c index 418e232cd..8b584d4de 100644 --- a/test/rt/source/test/test_sequence_005.c +++ b/test/rt/source/test/test_sequence_005.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -55,178 +55,178 @@ * Shared code. ****************************************************************************/ -static MUTEX_DECL(m1); -static MUTEX_DECL(m2); -#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__) -static CONDVAR_DECL(c1); -#endif - -#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) -/** - * @brief CPU pulse. - * @note The current implementation is not totally reliable. - * - * @param[in] duration CPU pulse duration in milliseconds - */ -void test_cpu_pulse(unsigned duration) { - systime_t start, end, now; - - start = chThdGetTicksX(chThdGetSelfX()); - end = start + MS2ST(duration); - do { - now = chThdGetTicksX(chThdGetSelfX()); -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif - } - while (chVTIsTimeWithinX(now, start, end)); -} -#endif /* CH_DBG_THREADS_PROFILING */ - -static THD_FUNCTION(thread1, p) { - - chMtxLock(&m1); - test_emit_token(*(char *)p); - chMtxUnlock(&m1); -} - -#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) -/* Low priority thread */ -static THD_FUNCTION(thread2L, p) { - - (void)p; - chMtxLock(&m1); - test_cpu_pulse(40); - chMtxUnlock(&m1); - test_cpu_pulse(10); - test_emit_token('C'); -} - -/* Medium priority thread */ -static THD_FUNCTION(thread2M, p) { - - (void)p; - chThdSleepMilliseconds(20); - test_cpu_pulse(40); - test_emit_token('B'); -} - -/* High priority thread */ -static THD_FUNCTION(thread2H, p) { - - (void)p; - chThdSleepMilliseconds(40); - chMtxLock(&m1); - test_cpu_pulse(10); - chMtxUnlock(&m1); - test_emit_token('A'); -} - -/* Lowest priority thread */ -static THD_FUNCTION(thread3LL, p) { - - (void)p; - chMtxLock(&m1); - test_cpu_pulse(30); - chMtxUnlock(&m1); - test_emit_token('E'); -} - -/* Low priority thread */ -static THD_FUNCTION(thread3L, p) { - - (void)p; - chThdSleepMilliseconds(10); - chMtxLock(&m2); - test_cpu_pulse(20); - chMtxLock(&m1); - test_cpu_pulse(10); - chMtxUnlock(&m1); - test_cpu_pulse(10); - chMtxUnlock(&m2); - test_emit_token('D'); -} - -/* Medium priority thread */ -static THD_FUNCTION(thread3M, p) { - - (void)p; - chThdSleepMilliseconds(20); - chMtxLock(&m2); - test_cpu_pulse(10); - chMtxUnlock(&m2); - test_emit_token('C'); -} - -/* High priority thread */ -static THD_FUNCTION(thread3H, p) { - - (void)p; - chThdSleepMilliseconds(40); - test_cpu_pulse(20); - test_emit_token('B'); -} - -/* Highest priority thread */ -static THD_FUNCTION(thread3HH, p) { - - (void)p; - chThdSleepMilliseconds(50); - chMtxLock(&m2); - test_cpu_pulse(10); - chMtxUnlock(&m2); - test_emit_token('A'); -} -#endif /* CH_DBG_THREADS_PROFILING */ - -static THD_FUNCTION(thread4A, p) { - - (void)p; - chThdSleepMilliseconds(50); - chMtxLock(&m1); - chMtxUnlock(&m1); -} - -static THD_FUNCTION(thread4B, p) { - - (void)p; - chThdSleepMilliseconds(150); - chSysLock(); - chMtxLockS(&m2); /* For coverage of the chMtxLockS() function variant.*/ - chMtxUnlockS(&m2); /* For coverage of the chMtxUnlockS() function variant.*/ - chSchRescheduleS(); - chSysUnlock(); -} - -#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__) -static THD_FUNCTION(thread6, p) { - - chMtxLock(&m1); - chCondWait(&c1); - test_emit_token(*(char *)p); - chMtxUnlock(&m1); -} - -static THD_FUNCTION(thread8, p) { - - chMtxLock(&m2); - chMtxLock(&m1); -#if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__) - chCondWaitTimeout(&c1, TIME_INFINITE); -#else - chCondWait(&c1); -#endif - test_emit_token(*(char *)p); - chMtxUnlock(&m1); - chMtxUnlock(&m2); -} - -static THD_FUNCTION(thread9, p) { - - chMtxLock(&m2); - test_emit_token(*(char *)p); - chMtxUnlock(&m2); -} +static MUTEX_DECL(m1); +static MUTEX_DECL(m2); +#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__) +static CONDVAR_DECL(c1); +#endif + +#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) +/** + * @brief CPU pulse. + * @note The current implementation is not totally reliable. + * + * @param[in] duration CPU pulse duration in milliseconds + */ +void test_cpu_pulse(unsigned duration) { + systime_t start, end, now; + + start = chThdGetTicksX(chThdGetSelfX()); + end = start + MS2ST(duration); + do { + now = chThdGetTicksX(chThdGetSelfX()); +#if defined(SIMULATOR) + _sim_check_for_interrupts(); +#endif + } + while (chVTIsTimeWithinX(now, start, end)); +} +#endif /* CH_DBG_THREADS_PROFILING */ + +static THD_FUNCTION(thread1, p) { + + chMtxLock(&m1); + test_emit_token(*(char *)p); + chMtxUnlock(&m1); +} + +#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) +/* Low priority thread */ +static THD_FUNCTION(thread2L, p) { + + (void)p; + chMtxLock(&m1); + test_cpu_pulse(40); + chMtxUnlock(&m1); + test_cpu_pulse(10); + test_emit_token('C'); +} + +/* Medium priority thread */ +static THD_FUNCTION(thread2M, p) { + + (void)p; + chThdSleepMilliseconds(20); + test_cpu_pulse(40); + test_emit_token('B'); +} + +/* High priority thread */ +static THD_FUNCTION(thread2H, p) { + + (void)p; + chThdSleepMilliseconds(40); + chMtxLock(&m1); + test_cpu_pulse(10); + chMtxUnlock(&m1); + test_emit_token('A'); +} + +/* Lowest priority thread */ +static THD_FUNCTION(thread3LL, p) { + + (void)p; + chMtxLock(&m1); + test_cpu_pulse(30); + chMtxUnlock(&m1); + test_emit_token('E'); +} + +/* Low priority thread */ +static THD_FUNCTION(thread3L, p) { + + (void)p; + chThdSleepMilliseconds(10); + chMtxLock(&m2); + test_cpu_pulse(20); + chMtxLock(&m1); + test_cpu_pulse(10); + chMtxUnlock(&m1); + test_cpu_pulse(10); + chMtxUnlock(&m2); + test_emit_token('D'); +} + +/* Medium priority thread */ +static THD_FUNCTION(thread3M, p) { + + (void)p; + chThdSleepMilliseconds(20); + chMtxLock(&m2); + test_cpu_pulse(10); + chMtxUnlock(&m2); + test_emit_token('C'); +} + +/* High priority thread */ +static THD_FUNCTION(thread3H, p) { + + (void)p; + chThdSleepMilliseconds(40); + test_cpu_pulse(20); + test_emit_token('B'); +} + +/* Highest priority thread */ +static THD_FUNCTION(thread3HH, p) { + + (void)p; + chThdSleepMilliseconds(50); + chMtxLock(&m2); + test_cpu_pulse(10); + chMtxUnlock(&m2); + test_emit_token('A'); +} +#endif /* CH_DBG_THREADS_PROFILING */ + +static THD_FUNCTION(thread4A, p) { + + (void)p; + chThdSleepMilliseconds(50); + chMtxLock(&m1); + chMtxUnlock(&m1); +} + +static THD_FUNCTION(thread4B, p) { + + (void)p; + chThdSleepMilliseconds(150); + chSysLock(); + chMtxLockS(&m2); /* For coverage of the chMtxLockS() function variant.*/ + chMtxUnlockS(&m2); /* For coverage of the chMtxUnlockS() function variant.*/ + chSchRescheduleS(); + chSysUnlock(); +} + +#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__) +static THD_FUNCTION(thread6, p) { + + chMtxLock(&m1); + chCondWait(&c1); + test_emit_token(*(char *)p); + chMtxUnlock(&m1); +} + +static THD_FUNCTION(thread8, p) { + + chMtxLock(&m2); + chMtxLock(&m1); +#if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__) + chCondWaitTimeout(&c1, TIME_INFINITE); +#else + chCondWait(&c1); +#endif + test_emit_token(*(char *)p); + chMtxUnlock(&m1); + chMtxUnlock(&m2); +} + +static THD_FUNCTION(thread9, p) { + + chMtxLock(&m2); + test_emit_token(*(char *)p); + chMtxUnlock(&m2); +} #endif /* CH_CFG_USE_CONDVARS */ /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_005.h b/test/rt/source/test/test_sequence_005.h index 8389efc62..8312381c3 100644 --- a/test/rt/source/test/test_sequence_005.h +++ b/test/rt/source/test/test_sequence_005.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_005.h + * @file test_sequence_005.h * @brief Test Sequence 005 header. */ diff --git a/test/rt/source/test/test_sequence_006.c b/test/rt/source/test/test_sequence_006.c index 64ff5acbe..509a3a465 100644 --- a/test/rt/source/test/test_sequence_006.c +++ b/test/rt/source/test/test_sequence_006.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -47,12 +47,12 @@ * Shared code. ****************************************************************************/ -static THD_FUNCTION(msg_thread1, p) { - - chMsgSend(p, 'A'); - chMsgSend(p, 'B'); - chMsgSend(p, 'C'); - chMsgSend(p, 'D'); +static THD_FUNCTION(msg_thread1, p) { + + chMsgSend(p, 'A'); + chMsgSend(p, 'B'); + chMsgSend(p, 'C'); + chMsgSend(p, 'D'); } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_006.h b/test/rt/source/test/test_sequence_006.h index c7cf10a72..eadcf9c8d 100644 --- a/test/rt/source/test/test_sequence_006.h +++ b/test/rt/source/test/test_sequence_006.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_006.h + * @file test_sequence_006.h * @brief Test Sequence 006 header. */ diff --git a/test/rt/source/test/test_sequence_007.c b/test/rt/source/test/test_sequence_007.c index c1a40e643..fc4c3f0ec 100644 --- a/test/rt/source/test/test_sequence_007.c +++ b/test/rt/source/test/test_sequence_007.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -52,26 +52,26 @@ * Shared code. ****************************************************************************/ -static EVENTSOURCE_DECL(es1); -static EVENTSOURCE_DECL(es2); - -static void h1(eventid_t id) {(void)id;test_emit_token('A');} -static void h2(eventid_t id) {(void)id;test_emit_token('B');} -static void h3(eventid_t id) {(void)id;test_emit_token('C');} -static ROMCONST evhandler_t evhndl[] = {h1, h2, h3}; - -static THD_FUNCTION(evt_thread3, p) { - - chThdSleepMilliseconds(50); - chEvtSignal((thread_t *)p, 1); -} - -static THD_FUNCTION(evt_thread7, p) { - - (void)p; - chEvtBroadcast(&es1); - chThdSleepMilliseconds(50); - chEvtBroadcast(&es2); +static EVENTSOURCE_DECL(es1); +static EVENTSOURCE_DECL(es2); + +static void h1(eventid_t id) {(void)id;test_emit_token('A');} +static void h2(eventid_t id) {(void)id;test_emit_token('B');} +static void h3(eventid_t id) {(void)id;test_emit_token('C');} +static ROMCONST evhandler_t evhndl[] = {h1, h2, h3}; + +static THD_FUNCTION(evt_thread3, p) { + + chThdSleepMilliseconds(50); + chEvtSignal((thread_t *)p, 1); +} + +static THD_FUNCTION(evt_thread7, p) { + + (void)p; + chEvtBroadcast(&es1); + chThdSleepMilliseconds(50); + chEvtBroadcast(&es2); } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_007.h b/test/rt/source/test/test_sequence_007.h index 27bc760c0..18b68a556 100644 --- a/test/rt/source/test/test_sequence_007.h +++ b/test/rt/source/test/test_sequence_007.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_007.h + * @file test_sequence_007.h * @brief Test Sequence 007 header. */ diff --git a/test/rt/source/test/test_sequence_008.c b/test/rt/source/test/test_sequence_008.c index bbacdfbbd..fe8a1b93b 100644 --- a/test/rt/source/test/test_sequence_008.c +++ b/test/rt/source/test/test_sequence_008.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -49,9 +49,9 @@ * Shared code. ****************************************************************************/ -#define MB_SIZE 4 - -static msg_t mb_buffer[MB_SIZE]; +#define MB_SIZE 4 + +static msg_t mb_buffer[MB_SIZE]; static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE); /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_008.h b/test/rt/source/test/test_sequence_008.h index 68d3ae65d..56c3de601 100644 --- a/test/rt/source/test/test_sequence_008.h +++ b/test/rt/source/test/test_sequence_008.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_008.h + * @file test_sequence_008.h * @brief Test Sequence 008 header. */ diff --git a/test/rt/source/test/test_sequence_009.c b/test/rt/source/test/test_sequence_009.c index 4d32f8a8f..6f4650b8a 100644 --- a/test/rt/source/test/test_sequence_009.c +++ b/test/rt/source/test/test_sequence_009.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -49,21 +49,21 @@ * Shared code. ****************************************************************************/ -#define MEMORY_POOL_SIZE 4 - -static uint32_t objects[MEMORY_POOL_SIZE]; -static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL); - -#if CH_CFG_USE_SEMAPHORES -static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t)); -#endif - -static void *null_provider(size_t size, unsigned align) { - - (void)size; - (void)align; - - return NULL; +#define MEMORY_POOL_SIZE 4 + +static uint32_t objects[MEMORY_POOL_SIZE]; +static MEMORYPOOL_DECL(mp1, sizeof (uint32_t), NULL); + +#if CH_CFG_USE_SEMAPHORES +static GUARDEDMEMORYPOOL_DECL(gmp1, sizeof (uint32_t)); +#endif + +static void *null_provider(size_t size, unsigned align) { + + (void)size; + (void)align; + + return NULL; } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_009.h b/test/rt/source/test/test_sequence_009.h index 43e910db5..fa5f10920 100644 --- a/test/rt/source/test/test_sequence_009.h +++ b/test/rt/source/test/test_sequence_009.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_009.h + * @file test_sequence_009.h * @brief Test Sequence 009 header. */ diff --git a/test/rt/source/test/test_sequence_010.c b/test/rt/source/test/test_sequence_010.c index 5d8879885..c4328f7f1 100644 --- a/test/rt/source/test/test_sequence_010.c +++ b/test/rt/source/test/test_sequence_010.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -48,10 +48,10 @@ * Shared code. ****************************************************************************/ -#define ALLOC_SIZE 16 -#define HEAP_SIZE (ALLOC_SIZE * 8) - -static memory_heap_t test_heap; +#define ALLOC_SIZE 16 +#define HEAP_SIZE (ALLOC_SIZE * 8) + +static memory_heap_t test_heap; static CH_HEAP_AREA(myheap, HEAP_SIZE); /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_010.h b/test/rt/source/test/test_sequence_010.h index bd46ae86a..2c4ea59b6 100644 --- a/test/rt/source/test/test_sequence_010.h +++ b/test/rt/source/test/test_sequence_010.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_010.h + * @file test_sequence_010.h * @brief Test Sequence 010 header. */ diff --git a/test/rt/source/test/test_sequence_011.c b/test/rt/source/test/test_sequence_011.c index 6361b8202..71d27433b 100644 --- a/test/rt/source/test/test_sequence_011.c +++ b/test/rt/source/test/test_sequence_011.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -48,16 +48,16 @@ * Shared code. ****************************************************************************/ -#if CH_CFG_USE_HEAP -static memory_heap_t heap1; -#endif -#if CH_CFG_USE_MEMPOOLS -static memory_pool_t mp1; -#endif - -static THD_FUNCTION(dyn_thread1, p) { - - test_emit_token(*(char *)p); +#if CH_CFG_USE_HEAP +static memory_heap_t heap1; +#endif +#if CH_CFG_USE_MEMPOOLS +static memory_pool_t mp1; +#endif + +static THD_FUNCTION(dyn_thread1, p) { + + test_emit_token(*(char *)p); } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_011.h b/test/rt/source/test/test_sequence_011.h index 87c39666e..89719a7ea 100644 --- a/test/rt/source/test/test_sequence_011.h +++ b/test/rt/source/test/test_sequence_011.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_011.h + * @file test_sequence_011.h * @brief Test Sequence 011 header. */ diff --git a/test/rt/source/test/test_sequence_012.c b/test/rt/source/test/test_sequence_012.c index f224d45bd..1ce965916 100644 --- a/test/rt/source/test/test_sequence_012.c +++ b/test/rt/source/test/test_sequence_012.c @@ -1,17 +1,17 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "hal.h" @@ -54,85 +54,85 @@ * Shared code. ****************************************************************************/ -#if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__) -static semaphore_t sem1; -#endif -#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__) -static mutex_t mtx1; -#endif - -static void tmo(void *param) {(void)param;} - -#if CH_CFG_USE_MESSAGES -static THD_FUNCTION(bmk_thread1, p) { - thread_t *tp; - msg_t msg; - - (void)p; - do { - tp = chMsgWait(); - msg = chMsgGet(tp); - chMsgRelease(tp, msg); - } while (msg); -} - -NOINLINE static unsigned int msg_loop_test(thread_t *tp) { - systime_t start, end; - - uint32_t n = 0; - start = test_wait_tick(); - end = start + MS2ST(1000); - do { - (void)chMsgSend(tp, 1); - n++; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif - } while (chVTIsSystemTimeWithinX(start, end)); - (void)chMsgSend(tp, 0); - return n; -} -#endif - -static THD_FUNCTION(bmk_thread3, p) { - - chThdExit((msg_t)p); -} - -static THD_FUNCTION(bmk_thread4, p) { - msg_t msg; - thread_t *self = chThdGetSelfX(); - - (void)p; - chSysLock(); - do { - chSchGoSleepS(CH_STATE_SUSPENDED); - msg = self->u.rdymsg; - } while (msg == MSG_OK); - chSysUnlock(); -} - -#if CH_CFG_USE_SEMAPHORES -static THD_FUNCTION(bmk_thread7, p) { - - (void)p; - while (!chThdShouldTerminateX()) - chSemWait(&sem1); -} -#endif - -static THD_FUNCTION(bmk_thread8, p) { - - do { - chThdYield(); - chThdYield(); - chThdYield(); - chThdYield(); - (*(uint32_t *)p) += 4; -#if defined(SIMULATOR) - _sim_check_for_interrupts(); -#endif - } while(!chThdShouldTerminateX()); +#if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__) +static semaphore_t sem1; +#endif +#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__) +static mutex_t mtx1; +#endif + +static void tmo(void *param) {(void)param;} + +#if CH_CFG_USE_MESSAGES +static THD_FUNCTION(bmk_thread1, p) { + thread_t *tp; + msg_t msg; + + (void)p; + do { + tp = chMsgWait(); + msg = chMsgGet(tp); + chMsgRelease(tp, msg); + } while (msg); +} + +NOINLINE static unsigned int msg_loop_test(thread_t *tp) { + systime_t start, end; + + uint32_t n = 0; + start = test_wait_tick(); + end = start + MS2ST(1000); + do { + (void)chMsgSend(tp, 1); + n++; +#if defined(SIMULATOR) + _sim_check_for_interrupts(); +#endif + } while (chVTIsSystemTimeWithinX(start, end)); + (void)chMsgSend(tp, 0); + return n; +} +#endif + +static THD_FUNCTION(bmk_thread3, p) { + + chThdExit((msg_t)p); +} + +static THD_FUNCTION(bmk_thread4, p) { + msg_t msg; + thread_t *self = chThdGetSelfX(); + + (void)p; + chSysLock(); + do { + chSchGoSleepS(CH_STATE_SUSPENDED); + msg = self->u.rdymsg; + } while (msg == MSG_OK); + chSysUnlock(); +} + +#if CH_CFG_USE_SEMAPHORES +static THD_FUNCTION(bmk_thread7, p) { + + (void)p; + while (!chThdShouldTerminateX()) + chSemWait(&sem1); +} +#endif + +static THD_FUNCTION(bmk_thread8, p) { + + do { + chThdYield(); + chThdYield(); + chThdYield(); + chThdYield(); + (*(uint32_t *)p) += 4; +#if defined(SIMULATOR) + _sim_check_for_interrupts(); +#endif + } while(!chThdShouldTerminateX()); } /**************************************************************************** diff --git a/test/rt/source/test/test_sequence_012.h b/test/rt/source/test/test_sequence_012.h index f5a4a2c15..dfa728375 100644 --- a/test/rt/source/test/test_sequence_012.h +++ b/test/rt/source/test/test_sequence_012.h @@ -1,21 +1,21 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** - * @file test_sequence_012.h + * @file test_sequence_012.h * @brief Test Sequence 012 header. */ -- cgit v1.2.3