]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/tests/rtos/mbed/isr/main.cpp
6 #define THREAD_DELAY 250
7 #define QUEUE_PUT_ISR_VALUE 128
8 #define QUEUE_PUT_THREAD_VALUE 127
11 * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
12 * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
13 * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
15 #if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)
16 #define STACK_SIZE DEFAULT_STACK_SIZE/4
18 #define STACK_SIZE DEFAULT_STACK_SIZE
21 Queue
<uint32_t, QUEUE_SIZE
> queue
;
23 DigitalOut
myled(LED1
);
27 queue
.put((uint32_t*)QUEUE_PUT_ISR_VALUE
);
31 void queue_thread(void const *argument
) {
33 queue
.put((uint32_t*)QUEUE_PUT_THREAD_VALUE
);
34 Thread::wait(THREAD_DELAY
);
39 MBED_HOSTTEST_TIMEOUT(20);
40 MBED_HOSTTEST_SELECT(default_auto
);
41 MBED_HOSTTEST_DESCRIPTION(ISR (Queue
));
42 MBED_HOSTTEST_START("RTOS_8");
44 Thread
thread(queue_thread
, NULL
, osPriorityNormal
, STACK_SIZE
);
46 ticker
.attach(queue_isr
, 1.0);
47 int isr_puts_counter
= 0;
51 osEvent evt
= queue
.get();
52 if (evt
.status
!= osEventMessage
) {
53 printf("QUEUE_GET: Status(0x%02X) ... [FAIL]\r\n", evt
.status
);
57 printf("QUEUE_GET: Value(%u) ... [OK]\r\n", evt
.value
.v
);
58 if (evt
.value
.v
== QUEUE_PUT_ISR_VALUE
) {
61 if (isr_puts_counter
>= QUEUE_SIZE
) {
67 MBED_HOSTTEST_RESULT(result
);