mirror of
https://github.com/OpenRTX/OpenRTX
synced 2026-08-08 12:29:06 -04:00
This change removes the old copyright header from project sources and replaces it with a new simplified SPDX-compliant header. Note that files that were missing the header but reasonably understood to be licensed according to the root license were not corrected. Signed-off-by: Ryan Turner <ryan@turnrye.com>
50 lines
723 B
C
50 lines
723 B
C
/*
|
|
* SPDX-FileCopyrightText: Copyright 2020-2026 OpenRTX Contributors
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
#ifndef QUEUE_H
|
|
#define QUEUE_H
|
|
|
|
#include <pthread.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
// Ring buffer size (MAX = 255)
|
|
#define MSG_QTY 10
|
|
|
|
typedef struct queue_t
|
|
{
|
|
pthread_mutex_t mutex;
|
|
pthread_cond_t not_empty;
|
|
uint8_t read_pos;
|
|
uint8_t write_pos;
|
|
uint8_t msg_num;
|
|
uint32_t buffer[MSG_QTY];
|
|
}
|
|
queue_t;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
void queue_init(queue_t *q);
|
|
|
|
/**
|
|
*
|
|
*/
|
|
void queue_terminate(queue_t *q);
|
|
|
|
/**
|
|
*
|
|
*/
|
|
bool queue_pend(queue_t *q, uint32_t *msg, bool blocking);
|
|
|
|
/**
|
|
*
|
|
*/
|
|
bool queue_post(queue_t *q, uint32_t msg);
|
|
|
|
#endif
|