2020-11-26 01:25:22 -08:00
|
|
|
/**
|
2015-04-27 09:14:28 -07:00
|
|
|
*
|
2020-11-26 01:25:22 -08:00
|
|
|
* \section COPYRIGHT
|
2015-04-27 09:14:28 -07:00
|
|
|
*
|
2021-03-19 03:45:56 -07:00
|
|
|
* Copyright 2013-2021 Software Radio Systems Limited
|
2015-04-27 09:14:28 -07:00
|
|
|
*
|
2020-11-26 01:25:22 -08:00
|
|
|
* By using this file, you agree to the terms and conditions set
|
|
|
|
* forth in the LICENSE file which can be found at the top level of
|
|
|
|
* the distribution.
|
2015-04-27 09:14:28 -07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* File: softbuffer.h
|
|
|
|
*
|
2019-12-16 07:04:22 -08:00
|
|
|
* Description: Buffer for RX and TX soft bits. This should be provided by MAC.
|
|
|
|
* Provided here basically for the examples.
|
2015-04-27 09:14:28 -07:00
|
|
|
*
|
|
|
|
* Reference:
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#ifndef SRSRAN_SOFTBUFFER_H
|
|
|
|
#define SRSRAN_SOFTBUFFER_H
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#include "srsran/config.h"
|
2020-12-11 08:59:54 -08:00
|
|
|
#include <stdint.h>
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2020-11-18 05:48:43 -08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
typedef struct SRSRAN_API {
|
2019-12-16 07:04:22 -08:00
|
|
|
uint32_t max_cb;
|
2020-11-05 09:48:41 -08:00
|
|
|
uint32_t max_cb_size;
|
2019-12-16 07:04:22 -08:00
|
|
|
int16_t** buffer_f;
|
|
|
|
uint8_t** data;
|
|
|
|
bool* cb_crc;
|
|
|
|
bool tb_crc;
|
2021-03-19 03:45:56 -07:00
|
|
|
} srsran_softbuffer_rx_t;
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
typedef struct SRSRAN_API {
|
2019-12-16 07:04:22 -08:00
|
|
|
uint32_t max_cb;
|
2020-11-05 09:48:41 -08:00
|
|
|
uint32_t max_cb_size;
|
2019-12-16 07:04:22 -08:00
|
|
|
uint8_t** buffer_b;
|
2021-03-19 03:45:56 -07:00
|
|
|
} srsran_softbuffer_tx_t;
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
#define SOFTBUFFER_SIZE 18600
|
2015-09-22 13:20:36 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API int srsran_softbuffer_rx_init(srsran_softbuffer_rx_t* q, uint32_t nof_prb);
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2020-11-05 09:48:41 -08:00
|
|
|
/**
|
|
|
|
* @brief Initialises Rx soft-buffer for a number of code blocks and their size
|
|
|
|
* @param q The Rx soft-buffer pointer
|
|
|
|
* @param max_cb The maximum number of code blocks to allocate
|
|
|
|
* @param max_cb_size The code block size to allocate
|
2021-03-19 03:45:56 -07:00
|
|
|
* @return It returns SRSRAN_SUCCESS if it allocates the soft-buffer succesfully, otherwise it returns SRSRAN_ERROR code
|
2020-11-05 09:48:41 -08:00
|
|
|
*/
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API int srsran_softbuffer_rx_init_guru(srsran_softbuffer_rx_t* q, uint32_t max_cb, uint32_t max_cb_size);
|
2020-11-05 09:48:41 -08:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API void srsran_softbuffer_rx_reset(srsran_softbuffer_rx_t* p);
|
2015-08-28 02:08:19 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API void srsran_softbuffer_rx_reset_tbs(srsran_softbuffer_rx_t* q, uint32_t tbs);
|
2015-08-28 02:08:19 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API void srsran_softbuffer_rx_reset_cb(srsran_softbuffer_rx_t* q, uint32_t nof_cb);
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API void srsran_softbuffer_rx_free(srsran_softbuffer_rx_t* p);
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API int srsran_softbuffer_tx_init(srsran_softbuffer_tx_t* q, uint32_t nof_prb);
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2020-11-05 09:48:41 -08:00
|
|
|
/**
|
|
|
|
* @brief Initialises Tx soft-buffer for a number of code blocks and their size
|
|
|
|
* @param q The Tx soft-buffer pointer
|
|
|
|
* @param max_cb The maximum number of code blocks to allocate
|
|
|
|
* @param max_cb_size The code block size to allocate
|
2021-03-19 03:45:56 -07:00
|
|
|
* @return It returns SRSRAN_SUCCESS if it allocates the soft-buffer succesfully, otherwise it returns SRSRAN_ERROR code
|
2020-11-05 09:48:41 -08:00
|
|
|
*/
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API int srsran_softbuffer_tx_init_guru(srsran_softbuffer_tx_t* q, uint32_t max_cb, uint32_t max_cb_size);
|
2020-11-05 09:48:41 -08:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API void srsran_softbuffer_tx_reset(srsran_softbuffer_tx_t* p);
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API void srsran_softbuffer_tx_reset_tbs(srsran_softbuffer_tx_t* q, uint32_t tbs);
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API void srsran_softbuffer_tx_reset_cb(srsran_softbuffer_tx_t* q, uint32_t nof_cb);
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
SRSRAN_API void srsran_softbuffer_tx_free(srsran_softbuffer_tx_t* p);
|
2015-04-27 09:14:28 -07:00
|
|
|
|
2020-11-18 05:48:43 -08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#endif // SRSRAN_SOFTBUFFER_H
|