2015-09-30 11:57:20 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Nick van IJzendoorn <nijzendoorn@engineering-spirit.nl>
|
2017-03-13 09:42:25 +01:00
|
|
|
* 2017 HAW Hamburg
|
2015-09-30 11:57:20 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup tests
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Thread test application
|
|
|
|
*
|
|
|
|
* @author Nick van IJzendoorn <nijzendoorn@engineering-spirit.nl>
|
2017-03-13 09:42:25 +01:00
|
|
|
* @author Sebastian Meiling <s@mlng.net>
|
2015-09-30 11:57:20 +02:00
|
|
|
*
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
2017-03-13 09:42:25 +01:00
|
|
|
#include "log.h"
|
2015-09-30 11:57:20 +02:00
|
|
|
#include "msg.h"
|
|
|
|
|
|
|
|
#define MSG_QUEUE_LENGTH (8)
|
|
|
|
|
|
|
|
msg_t msg_queue[MSG_QUEUE_LENGTH];
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
msg_t msges[MSG_QUEUE_LENGTH];
|
|
|
|
|
|
|
|
msg_init_queue(msg_queue, MSG_QUEUE_LENGTH);
|
|
|
|
|
2017-03-13 09:42:25 +01:00
|
|
|
puts("[START]");
|
2019-10-10 01:10:41 +02:00
|
|
|
|
2017-03-13 09:42:25 +01:00
|
|
|
/* add message to own queue */
|
2021-11-24 13:35:20 +01:00
|
|
|
for (unsigned idx = 0; idx < MSG_QUEUE_LENGTH; ++idx) {
|
2015-09-30 11:57:20 +02:00
|
|
|
msges[idx].type = idx;
|
|
|
|
msg_send_to_self(msges + idx);
|
2017-03-13 09:42:25 +01:00
|
|
|
LOG_INFO("+ add msg: %d\n", idx);
|
|
|
|
if (msg_avail() != (idx) + 1) {
|
|
|
|
puts("[FAILED]");
|
|
|
|
return 1;
|
|
|
|
}
|
2015-09-30 11:57:20 +02:00
|
|
|
}
|
2017-03-13 09:42:25 +01:00
|
|
|
/* receive available messages in queue */
|
2021-11-24 13:35:20 +01:00
|
|
|
for (unsigned idx = msg_avail(); idx > 0; --idx) {
|
2015-09-30 11:57:20 +02:00
|
|
|
msg_t msg;
|
|
|
|
msg_receive(&msg);
|
2017-03-13 09:42:25 +01:00
|
|
|
LOG_INFO("- got msg: %d\n", (MSG_QUEUE_LENGTH - idx));
|
2021-11-24 13:35:20 +01:00
|
|
|
if (msg.type != (MSG_QUEUE_LENGTH - idx)
|
make: fix sign-compare errors
cpu, nrf5x_common: fix sign-compare in periph/flashpage
drivers, periph_common: fix sign-compare in flashpage
cpu, sam0_common: fix sign-compare error in periph/gpio
cpu, cc2538: fix sign-compare in periph/timer
cpu, sam3: fix sign-compare in periph/gpio
cpu, stm32_common: fix sign-compare in periph/pwm
cpu, stm32_common: fix sign-compare in periph/timer
cpu, stm32_common: fix sign-compare in periph/flashpage
cpu, nrf5x_common: fix sign-compare in radio/nrfmin
cpu, samd21: fix sign-compare in periph/pwm
cpu, ezr32wg: fix sign-compare in periph/gpio
cpu, ezr32wg: fix sign-compare in periph/timer
drivers, ethos: fix sign-compare
sys, net: fix sign-compare
cpu, atmega_common: fix sign-compare error
cpu, msp430fxyz: fix sign-compare in periph/gpio
boards, msb-430-common: fix sign-compare in board_init
driver, cc2420: fix sign-compared
sys/net: fix sign-compare in gnrc_tftp
driver, pcd8544: fix sign-compare
driver, pn532: fix sign-compare
driver, sdcard_spi: fix sign-compare
tests: fix sign_compare
sys/net, lwmac: fix sign_compare
pkg, lwip: fix sign-compare
boards, waspmote: make CORECLOCK unsigned long to fix sign_compare error
tests, sock_ip: fix sign compare
tests, msg_avail: fix sign compare
tests, sock_udp: fix sign compare
boards: fix sign-compare for calliope and microbit matrix
2017-10-31 11:57:40 +01:00
|
|
|
|| msg_avail() != idx - 1) {
|
2017-03-13 09:42:25 +01:00
|
|
|
puts("[FAILED]");
|
|
|
|
return 1;
|
|
|
|
}
|
2015-09-30 11:57:20 +02:00
|
|
|
}
|
2017-03-13 09:42:25 +01:00
|
|
|
puts("[SUCCESS]");
|
2015-09-30 11:57:20 +02:00
|
|
|
return 0;
|
|
|
|
}
|