mirror of
https://github.com/kelvinlawson/atomthreads.git
synced 2026-01-11 18:33:16 +01:00
Reverted kern3 and kern4 test.
Fixed main_thread_func() to call test_start() only once. Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -218,13 +218,14 @@ int main ( void )
|
||||
*/
|
||||
static void main_thread_func (uint32_t data)
|
||||
{
|
||||
while (1) {
|
||||
/* Put a message out on the UART */
|
||||
printk("Running Tests... ");
|
||||
if (test_start() != 0) {
|
||||
printk("FAILED!\n");
|
||||
} else {
|
||||
printk("SUCCESS!\n");
|
||||
}
|
||||
/* Put a message out on the UART */
|
||||
printk("Test Started ... ");
|
||||
if (test_start() != 0) {
|
||||
printk("FAILED!\n");
|
||||
} else {
|
||||
printk("SUCCESS!\n");
|
||||
}
|
||||
printk("Reset your board !!!!!");
|
||||
/* Test finished so just hang !!! */
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ static uint8_t test_thread_stack[NUM_TEST_THREADS][TEST_THREAD_STACK_SIZE];
|
||||
static volatile int running_flag[2];
|
||||
static volatile int sleep_request[2];
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
static void test_thread_func (uint32_t param);
|
||||
static int test_iter = 0;
|
||||
|
||||
|
||||
/**
|
||||
@@ -93,29 +93,23 @@ uint32_t test_start (void)
|
||||
running_flag[0] = running_flag[1] = FALSE;
|
||||
sleep_request[0] = sleep_request[1] = FALSE;
|
||||
|
||||
/* Create threads in first iteration only */
|
||||
if (test_iter == 0) {
|
||||
/* Create low priority thread */
|
||||
if (atomThreadCreate (&tcb[0], 253, test_thread_func, 0,
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
|
||||
/* Create high priority thread */
|
||||
else if (atomThreadCreate (&tcb[1], 252, test_thread_func, 1,
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
/* Create low priority thread */
|
||||
if (atomThreadCreate (&tcb[0], 253, test_thread_func, 0,
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
|
||||
/* Increment test iteration count */
|
||||
test_iter++;
|
||||
/* Create high priority thread */
|
||||
else if (atomThreadCreate (&tcb[1], 252, test_thread_func, 1,
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
|
||||
/* Repeat test a few times */
|
||||
for (i = 0; i < 8; i++)
|
||||
|
||||
@@ -51,7 +51,7 @@ static int volatile test_started;
|
||||
|
||||
/* Forward declarations */
|
||||
static void test_thread_func (uint32_t param);
|
||||
static int test_iter = 0;
|
||||
|
||||
|
||||
/**
|
||||
* \b test_start
|
||||
@@ -89,47 +89,41 @@ uint32_t test_start (void)
|
||||
/* Set test as not started until all threads are ready to go */
|
||||
test_started = FALSE;
|
||||
|
||||
/* Create threads in first iteration only */
|
||||
if (test_iter == 0) {
|
||||
/*
|
||||
* Create all four threads at the same priority as each other.
|
||||
* They are given a lower priority than this thread, however,
|
||||
* to ensure that once this thread wakes up to stop the test it
|
||||
* can do so without confusing the scheduling tests by having
|
||||
* a spell in which this thread was run.
|
||||
*/
|
||||
if (atomThreadCreate (&tcb[0], TEST_THREAD_PRIO + 1, test_thread_func, 0,
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[1], TEST_THREAD_PRIO + 1, test_thread_func, 1,
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[2], TEST_THREAD_PRIO + 1, test_thread_func, 2,
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[3], TEST_THREAD_PRIO + 1, test_thread_func, 3,
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
/*
|
||||
* Create all four threads at the same priority as each other.
|
||||
* They are given a lower priority than this thread, however,
|
||||
* to ensure that once this thread wakes up to stop the test it
|
||||
* can do so without confusing the scheduling tests by having
|
||||
* a spell in which this thread was run.
|
||||
*/
|
||||
if (atomThreadCreate (&tcb[0], TEST_THREAD_PRIO + 1, test_thread_func, 0,
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[1], TEST_THREAD_PRIO + 1, test_thread_func, 1,
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[2], TEST_THREAD_PRIO + 1, test_thread_func, 2,
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[3], TEST_THREAD_PRIO + 1, test_thread_func, 3,
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
|
||||
/* Increment test iteration count */
|
||||
test_iter++;
|
||||
|
||||
/* Start the test */
|
||||
test_started = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user