2014-01-10 16:21:35 +01:00
|
|
|
/*
|
2015-09-27 18:58:30 +02:00
|
|
|
* Copyright (C) 2013 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
2014-02-03 23:03:13 +01:00
|
|
|
*
|
2014-07-31 19:45:27 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2014-02-03 23:03:13 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup tests
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief IRQ test application
|
|
|
|
*
|
2015-09-27 18:58:30 +02:00
|
|
|
* @author Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
2014-02-03 23:03:13 +01:00
|
|
|
*
|
|
|
|
* @}
|
2014-01-10 16:21:35 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2015-09-03 19:01:09 +02:00
|
|
|
#include "xtimer.h"
|
2014-01-10 16:21:35 +01:00
|
|
|
#include "thread.h"
|
|
|
|
|
2016-02-11 15:18:44 +01:00
|
|
|
static char busy_stack[THREAD_STACKSIZE_MAIN];
|
|
|
|
static volatile int busy, i, k;
|
2014-01-10 16:21:35 +01:00
|
|
|
|
2014-03-04 20:20:01 +01:00
|
|
|
void *busy_thread(void *arg)
|
2014-01-10 16:21:35 +01:00
|
|
|
{
|
2014-03-04 20:20:01 +01:00
|
|
|
(void) arg;
|
|
|
|
|
2014-05-02 13:57:10 +02:00
|
|
|
int j = 0;
|
2014-03-29 19:14:00 +01:00
|
|
|
puts("busy_thread starting");
|
2014-01-10 16:21:35 +01:00
|
|
|
|
|
|
|
i = 0;
|
2014-01-25 11:29:35 +01:00
|
|
|
|
2014-01-10 16:21:35 +01:00
|
|
|
while (busy) {
|
|
|
|
k = j = ++i;
|
|
|
|
}
|
2014-01-25 11:29:35 +01:00
|
|
|
|
2014-01-10 16:21:35 +01:00
|
|
|
printf("i: %i\n", i);
|
|
|
|
printf("j: %i\n", j);
|
|
|
|
printf("k: %i\n", k);
|
|
|
|
|
2017-11-09 18:15:09 +01:00
|
|
|
puts("SUCCESS");
|
2014-03-04 20:20:01 +01:00
|
|
|
|
|
|
|
return NULL;
|
2014-01-10 16:21:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2017-11-09 18:15:09 +01:00
|
|
|
puts("START");
|
|
|
|
|
2014-01-10 16:21:35 +01:00
|
|
|
busy = 1;
|
|
|
|
k = 23;
|
2014-07-09 07:13:56 +02:00
|
|
|
thread_create(busy_stack, sizeof(busy_stack),
|
2015-12-02 12:00:37 +01:00
|
|
|
THREAD_PRIORITY_MAIN + 1, THREAD_CREATE_WOUT_YIELD,
|
2014-03-04 20:20:01 +01:00
|
|
|
busy_thread, NULL, "busy_thread");
|
2014-03-29 19:14:00 +01:00
|
|
|
puts("busy_thread created");
|
2014-01-10 16:21:35 +01:00
|
|
|
|
2015-09-03 19:01:09 +02:00
|
|
|
puts("xtimer_wait()");
|
|
|
|
xtimer_usleep(100000);
|
2014-01-10 16:21:35 +01:00
|
|
|
busy = 0;
|
|
|
|
|
2014-03-29 19:14:00 +01:00
|
|
|
puts("main: return");
|
|
|
|
|
|
|
|
return 0;
|
2014-01-10 16:21:35 +01:00
|
|
|
}
|