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
4 years ago
|
/**
|
||
8 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
8 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
8 years ago
|
*
|
||
4 years ago
|
* 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.
|
||
8 years ago
|
*
|
||
|
*/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_COMMON_H
|
||
|
#define SRSRAN_COMMON_H
|
||
8 years ago
|
|
||
|
/*******************************************************************************
|
||
|
INCLUDES
|
||
|
*******************************************************************************/
|
||
|
|
||
4 years ago
|
#include "srsran/adt/span.h"
|
||
4 years ago
|
#include <chrono>
|
||
6 years ago
|
#include <memory>
|
||
8 years ago
|
#include <stdint.h>
|
||
|
#include <string.h>
|
||
4 years ago
|
#include <sys/time.h>
|
||
8 years ago
|
|
||
|
/*******************************************************************************
|
||
|
DEFINES
|
||
|
*******************************************************************************/
|
||
|
|
||
4 years ago
|
#define SRSRAN_UE_CATEGORY 4
|
||
8 years ago
|
|
||
4 years ago
|
#define SRSRAN_N_SRB 3
|
||
|
#define SRSRAN_N_DRB 8
|
||
|
#define SRSRAN_N_RADIO_BEARERS 11
|
||
8 years ago
|
|
||
4 years ago
|
#define SRSRAN_N_MCH_LCIDS 32
|
||
7 years ago
|
|
||
5 years ago
|
#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
|
||
7 years ago
|
|
||
6 years ago
|
#define TTI_SUB(a, b) ((((a) + 10240) - (b)) % 10240)
|
||
5 years ago
|
#define TTI_ADD(a, b) (((a) + (b)) % 10240)
|
||
7 years ago
|
|
||
5 years ago
|
#define TTI_TX(tti) TTI_ADD(tti, FDD_HARQ_DELAY_DL_MS)
|
||
6 years ago
|
|
||
5 years ago
|
#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))
|
||
6 years ago
|
|
||
|
#define TTIMOD_SZ 20
|
||
5 years ago
|
#define TTIMOD(tti) (tti % TTIMOD_SZ)
|
||
7 years ago
|
|
||
4 years ago
|
#define INVALID_TTI 10241
|
||
4 years ago
|
#define TX_ENB_DELAY FDD_HARQ_DELAY_UL_MS
|
||
4 years ago
|
|
||
6 years ago
|
#define PHICH_MAX_SF 6 // Maximum PHICH in a subframe (1 in FDD, > 1 in TDD, see table 9.1.2-1 36.213)
|
||
|
|
||
5 years ago
|
#define ASYNC_DL_SCHED (FDD_HARQ_DELAY_UL_MS <= 4)
|
||
7 years ago
|
|
||
6 years ago
|
// Cat 4 UE - Max number of DL-SCH transport block bits received within a TTI
|
||
5 years ago
|
// 3GPP 36.306 v15.4.0 Table 4.1.1 for Category 11 with 2 layers and 256QAM
|
||
4 years ago
|
#define SRSRAN_MAX_TBSIZE_BITS 97896
|
||
|
#define SRSRAN_BUFFER_HEADER_OFFSET 1020
|
||
|
#define SRSRAN_MAX_BUFFER_SIZE_BITS (SRSRAN_MAX_TBSIZE_BITS + SRSRAN_BUFFER_HEADER_OFFSET)
|
||
|
#define SRSRAN_MAX_BUFFER_SIZE_BYTES (SRSRAN_MAX_TBSIZE_BITS / 8 + SRSRAN_BUFFER_HEADER_OFFSET)
|
||
8 years ago
|
|
||
|
/*******************************************************************************
|
||
|
TYPEDEFS
|
||
|
*******************************************************************************/
|
||
|
|
||
4 years ago
|
namespace srsran {
|
||
8 years ago
|
|
||
4 years ago
|
#define ENABLE_TIMESTAMP
|
||
7 years ago
|
|
||
4 years ago
|
// 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];
|
||
|
}
|
||
|
|
||
4 years ago
|
enum class srsran_rat_t { lte, nr, nulltype };
|
||
|
inline std::string to_string(const srsran_rat_t& type)
|
||
4 years ago
|
{
|
||
|
constexpr static const char* options[] = {"LTE", "NR"};
|
||
4 years ago
|
return enum_to_text(options, (uint32_t)srsran_rat_t::nulltype, (uint32_t)type);
|
||
4 years ago
|
}
|
||
|
|
||
4 years ago
|
} // namespace srsran
|
||
8 years ago
|
|
||
4 years ago
|
#endif // SRSRAN_COMMON_H
|