srsLTE/lib/include/srslte/phy/utils/ringbuffer.h

38 lines
876 B
C

#ifndef RINGBUFFER_H
#define RINGBUFFER_H
#include "srslte/config.h"
#include <pthread.h>
#include <stdint.h>
typedef struct {
uint8_t *buffer;
int capacity;
int count;
int wpm;
int rpm;
pthread_mutex_t mutex;
pthread_cond_t cvar;
} srslte_ringbuffer_t;
SRSLTE_API int srslte_ringbuffer_init(srslte_ringbuffer_t *q,
int capacity);
SRSLTE_API void srslte_ringbuffer_free(srslte_ringbuffer_t *q,
int capacity);
SRSLTE_API int srslte_ringbuffer_write(srslte_ringbuffer_t *q,
uint8_t *ptr,
int nof_bytes);
SRSLTE_API int srslte_ringbuffer_read(srslte_ringbuffer_t *q,
uint8_t *ptr,
int nof_bytes);
#endif