2014-01-10 16:21:35 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
|
2014-02-03 23:03:13 +01:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup tests
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief IRQ test application
|
|
|
|
*
|
|
|
|
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
|
|
|
|
*
|
|
|
|
* @}
|
2014-01-10 16:21:35 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "hwtimer.h"
|
|
|
|
#include "thread.h"
|
|
|
|
|
2014-07-04 15:39:43 +02:00
|
|
|
char busy_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
2014-03-29 19:14:00 +01:00
|
|
|
volatile int busy, i, k;
|
2014-01-10 16:21:35 +01:00
|
|
|
|
|
|
|
void busy_thread(void)
|
|
|
|
{
|
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);
|
|
|
|
|
2014-03-29 19:14:00 +01:00
|
|
|
puts("success");
|
2014-01-10 16:21:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
busy = 1;
|
|
|
|
k = 23;
|
2014-07-09 07:13:56 +02:00
|
|
|
thread_create(busy_stack, sizeof(busy_stack),
|
2014-01-25 11:29:35 +01:00
|
|
|
PRIORITY_MAIN + 1, CREATE_WOUT_YIELD, busy_thread,
|
|
|
|
"busy_thread");
|
2014-03-29 19:14:00 +01:00
|
|
|
puts("busy_thread created");
|
2014-01-10 16:21:35 +01:00
|
|
|
|
2014-03-29 19:14:00 +01:00
|
|
|
puts("hwtimer_wait()");
|
2014-01-14 17:46:20 +01:00
|
|
|
hwtimer_wait(HWTIMER_TICKS(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
|
|
|
}
|