2014-02-10 10:52:25 +00:00
|
|
|
/*
|
|
|
|
ChibiOS/RT - Copyright (C) 2006-2013 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_root.c
|
|
|
|
* @brief Test Suite root structures code.
|
|
|
|
*
|
|
|
|
* @addtogroup CH_TEST_ROOT
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "hal.h"
|
|
|
|
#include "ch_test.h"
|
|
|
|
#include "test_root.h"
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Module exported variables. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Array of all the test sequences.
|
|
|
|
*/
|
|
|
|
const testcase_t * const *test_suite[] = {
|
2014-02-10 15:36:30 +00:00
|
|
|
test_sequence_001,
|
2014-02-10 15:47:18 +00:00
|
|
|
test_sequence_002,
|
2014-02-10 10:52:25 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Shared code. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
2014-02-11 09:21:53 +00:00
|
|
|
semaphore_t gsem1, gsem2;
|
2014-02-11 09:59:20 +00:00
|
|
|
thread_reference_t gtr1;
|
2014-02-11 09:21:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Support thread.
|
|
|
|
*/
|
|
|
|
THD_WORKING_AREA(wa_test_support, 128);
|
|
|
|
THD_FUNCTION(test_support, arg) {
|
2014-02-11 13:00:24 +00:00
|
|
|
thread_t *tp = (thread_t *)arg;
|
2014-02-11 09:21:53 +00:00
|
|
|
|
|
|
|
/* Initializing global resources.*/
|
|
|
|
chSemObjectInit(&gsem1, 0);
|
|
|
|
chSemObjectInit(&gsem2, 0);
|
|
|
|
|
|
|
|
/* Waiting for button push and activation of the test suite.*/
|
|
|
|
while (true) {
|
|
|
|
chSysLock();
|
|
|
|
if (chSemGetCounterI(&gsem1) < 0)
|
|
|
|
chSemSignalI(&gsem1);
|
|
|
|
chSemResetI(&gsem2, 0);
|
2014-02-11 09:59:20 +00:00
|
|
|
chThdResumeI(>r1, MSG_OK);
|
2014-02-11 13:00:24 +00:00
|
|
|
chEvtSignalI(tp, 0x55);
|
2014-02-11 09:21:53 +00:00
|
|
|
chSchRescheduleS();
|
|
|
|
chSysUnlock();
|
|
|
|
|
2014-02-11 13:00:24 +00:00
|
|
|
chThdSleepMilliseconds(250);
|
2014-02-11 09:21:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-10 10:52:25 +00:00
|
|
|
/** @} */
|