mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.9 KiB
C++
98 lines
2.9 KiB
C++
/**
|
|
*
|
|
* \section COPYRIGHT
|
|
*
|
|
* Copyright 2013-2020 Software Radio Systems Limited
|
|
*
|
|
* 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.
|
|
*
|
|
*/
|
|
|
|
#ifndef SRSLTE_COMMON_H
|
|
#define SRSLTE_COMMON_H
|
|
|
|
/*******************************************************************************
|
|
INCLUDES
|
|
*******************************************************************************/
|
|
|
|
#include "srslte/adt/span.h"
|
|
#include <chrono>
|
|
#include <memory>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <sys/time.h>
|
|
|
|
/*******************************************************************************
|
|
DEFINES
|
|
*******************************************************************************/
|
|
|
|
#define SRSLTE_UE_CATEGORY 4
|
|
|
|
#define SRSLTE_N_SRB 3
|
|
#define SRSLTE_N_DRB 8
|
|
#define SRSLTE_N_RADIO_BEARERS 11
|
|
|
|
#define SRSLTE_N_MCH_LCIDS 32
|
|
|
|
#define FDD_HARQ_DELAY_DL_MS 4
|
|
#define FDD_HARQ_DELAY_UL_MS 4
|
|
#define MSG3_DELAY_MS 2 // Delay added to FDD_HARQ_DELAY_DL_MS
|
|
|
|
#define TTI_SUB(a, b) ((((a) + 10240) - (b)) % 10240)
|
|
#define TTI_ADD(a, b) (((a) + (b)) % 10240)
|
|
|
|
#define TTI_TX(tti) TTI_ADD(tti, FDD_HARQ_DELAY_DL_MS)
|
|
|
|
#define TTI_RX(tti) (TTI_SUB(tti, FDD_HARQ_DELAY_UL_MS))
|
|
#define TTI_RX_ACK(tti) (TTI_ADD(tti, FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS))
|
|
|
|
#define TTIMOD_SZ 20
|
|
#define TTIMOD(tti) (tti % TTIMOD_SZ)
|
|
|
|
#define INVALID_TTI 10241
|
|
#define TX_ENB_DELAY FDD_HARQ_DELAY_UL_MS
|
|
|
|
#define PHICH_MAX_SF 6 // Maximum PHICH in a subframe (1 in FDD, > 1 in TDD, see table 9.1.2-1 36.213)
|
|
|
|
#define ASYNC_DL_SCHED (FDD_HARQ_DELAY_UL_MS <= 4)
|
|
|
|
// Cat 4 UE - Max number of DL-SCH transport block bits received within a TTI
|
|
// 3GPP 36.306 v15.4.0 Table 4.1.1 for Category 11 with 2 layers and 256QAM
|
|
#define SRSLTE_MAX_TBSIZE_BITS 97896
|
|
#define SRSLTE_BUFFER_HEADER_OFFSET 1020
|
|
#define SRSLTE_MAX_BUFFER_SIZE_BITS (SRSLTE_MAX_TBSIZE_BITS + SRSLTE_BUFFER_HEADER_OFFSET)
|
|
#define SRSLTE_MAX_BUFFER_SIZE_BYTES (SRSLTE_MAX_TBSIZE_BITS / 8 + SRSLTE_BUFFER_HEADER_OFFSET)
|
|
|
|
/*******************************************************************************
|
|
TYPEDEFS
|
|
*******************************************************************************/
|
|
|
|
namespace srslte {
|
|
|
|
#define ENABLE_TIMESTAMP
|
|
|
|
// helper functions
|
|
inline const char* enum_to_text(const char* const array[], uint32_t nof_types, uint32_t enum_val)
|
|
{
|
|
return enum_val >= nof_types ? "" : array[enum_val];
|
|
}
|
|
|
|
template <class ItemType>
|
|
ItemType enum_to_number(ItemType* array, uint32_t nof_types, uint32_t enum_val)
|
|
{
|
|
return enum_val >= nof_types ? -1 : array[enum_val];
|
|
}
|
|
|
|
enum class srslte_rat_t { lte, nr, nulltype };
|
|
inline std::string to_string(const srslte_rat_t& type)
|
|
{
|
|
constexpr static const char* options[] = {"LTE", "NR"};
|
|
return enum_to_text(options, (uint32_t)srslte_rat_t::nulltype, (uint32_t)type);
|
|
}
|
|
|
|
} // namespace srslte
|
|
|
|
#endif // SRSLTE_COMMON_H
|