Remove redundant ISR test.

pull/5355/head
Przemyslaw Stekiel 2017-10-17 13:16:57 +02:00 committed by adbridge
parent c9e589cc70
commit 3e56f41aa2
1 changed files with 0 additions and 77 deletions

View File

@ -1,77 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* 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.
*/
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "rtos.h"
#if defined(MBED_RTOS_SINGLE_THREAD)
#error [NOT_SUPPORTED] test not supported
#endif
#define QUEUE_SIZE 5
#define THREAD_DELAY 250
#define QUEUE_PUT_ISR_VALUE 128
#define QUEUE_PUT_THREAD_VALUE 127
#define TEST_STACK_SIZE 512
Queue<uint32_t, QUEUE_SIZE> queue;
DigitalOut myled(LED1);
void queue_isr() {
queue.put((uint32_t*)QUEUE_PUT_ISR_VALUE);
myled = !myled;
}
void queue_thread() {
while (true) {
queue.put((uint32_t*)QUEUE_PUT_THREAD_VALUE);
Thread::wait(THREAD_DELAY);
}
}
int main (void) {
GREENTEA_SETUP(20, "default_auto");
Thread thread(osPriorityNormal, TEST_STACK_SIZE);
thread.start(queue_thread);
Ticker ticker;
ticker.attach(queue_isr, 1.0);
int isr_puts_counter = 0;
bool result = true;
while (true) {
osEvent evt = queue.get();
if (evt.status != osEventMessage) {
printf("QUEUE_GET: FAIL\r\n");
result = false;
break;
} else {
printf("QUEUE_GET: Value(%u) ... [OK]\r\n", evt.value.v);
if (evt.value.v == QUEUE_PUT_ISR_VALUE) {
isr_puts_counter++;
}
if (isr_puts_counter >= QUEUE_SIZE) {
break;
}
}
}
GREENTEA_TESTSUITE_RESULT(result);
return 0;
}