1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/core/include/queue.h

51 lines
1.3 KiB
C
Raw Normal View History

/*
* Copyright (C) 2013 Freie Universität Berlin
*
* This file 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.
*/
/**
* @addtogroup core_util
* @{
*
* @file queue.h
* @brief A simple queue implementation
*
* @author Freie Universität Berlin, Computer Systems & Telematics
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/
#ifndef __QUEUE_H
#define __QUEUE_H
2013-06-14 19:41:48 +02:00
#include <stdint.h>
#include <inttypes.h>
// mspgcc bug : PRIxxx macros not defined before mid-2011 versions
#ifndef PRIu32
#define PRIu32 "lu"
#endif
typedef struct queue_node_t {
struct queue_node_t *next;
unsigned int data;
uint32_t priority;
} queue_node_t;
void queue_add_tail(queue_node_t *root, queue_node_t *new_obj);
void queue_add_head(queue_node_t *root, queue_node_t *new_obj);
queue_node_t *queue_remove_head(queue_node_t *root);
void queue_priority_add(queue_node_t *root, queue_node_t *new_obj);
void queue_priority_add_generic(queue_node_t *root, queue_node_t *new_obj, int(*cmp)(queue_node_t *, queue_node_t *)) ;
void queue_remove(queue_node_t *root, queue_node_t *node);
2013-10-10 17:06:41 +02:00
#if ENABLE_DEBUG
2013-06-30 01:53:53 +02:00
void queue_print(queue_node_t *node);
void queue_print_node(queue_node_t *node);
2013-10-10 17:06:41 +02:00
#endif
2013-06-30 01:53:53 +02:00
/** @} */
#endif /* __QUEUE_H */