Fixed invalid EOL in generated files.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9301 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
89308874ce
commit
6a14c66581
|
@ -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__) */
|
||||
|
|
|
@ -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__) */
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright statement.*/
|
||||
|
||||
/**
|
||||
* @file test_sequence_001.h
|
||||
* @file test_sequence_001.h
|
||||
* @brief Test Sequence 001 header.
|
||||
*/
|
||||
|
||||
|
|
|
@ -28,25 +28,25 @@
|
|||
* Shared code.
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#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 <string.h>
|
||||
|
||||
#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('*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright statement.*/
|
||||
|
||||
/**
|
||||
* @file test_sequence_002.h
|
||||
* @file test_sequence_002.h
|
||||
* @brief Test Sequence 002 header.
|
||||
*/
|
||||
|
||||
|
|
|
@ -29,18 +29,18 @@
|
|||
* Shared code.
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "osapi.h"
|
||||
|
||||
uint32 tmid;
|
||||
uint32 cnt;
|
||||
|
||||
static void tmr_callback(uint32 timer_id) {
|
||||
|
||||
(void)timer_id;
|
||||
|
||||
cnt++;
|
||||
#include <string.h>
|
||||
|
||||
#include "osapi.h"
|
||||
|
||||
uint32 tmid;
|
||||
uint32 cnt;
|
||||
|
||||
static void tmr_callback(uint32 timer_id) {
|
||||
|
||||
(void)timer_id;
|
||||
|
||||
cnt++;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright statement.*/
|
||||
|
||||
/**
|
||||
* @file test_sequence_003.h
|
||||
* @file test_sequence_003.h
|
||||
* @brief Test Sequence 003 header.
|
||||
*/
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
* Shared code.
|
||||
****************************************************************************/
|
||||
|
||||
#include "osapi.h"
|
||||
|
||||
#include "osapi.h"
|
||||
|
||||
uint32 bsid;
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright statement.*/
|
||||
|
||||
/**
|
||||
* @file test_sequence_004.h
|
||||
* @file test_sequence_004.h
|
||||
* @brief Test Sequence 004 header.
|
||||
*/
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
* Shared code.
|
||||
****************************************************************************/
|
||||
|
||||
#include "osapi.h"
|
||||
|
||||
#include "osapi.h"
|
||||
|
||||
uint32 csid;
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright statement.*/
|
||||
|
||||
/**
|
||||
* @file test_sequence_005.h
|
||||
* @file test_sequence_005.h
|
||||
* @brief Test Sequence 005 header.
|
||||
*/
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
* Shared code.
|
||||
****************************************************************************/
|
||||
|
||||
#include "osapi.h"
|
||||
|
||||
#include "osapi.h"
|
||||
|
||||
uint32 msid;
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright statement.*/
|
||||
|
||||
/**
|
||||
* @file test_sequence_006.h
|
||||
* @file test_sequence_006.h
|
||||
* @brief Test Sequence 006 header.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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__) */
|
||||
|
|
|
@ -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__) */
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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__) */
|
||||
|
|
|
@ -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__) */
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue