From 0439161de62eb4b768da9b494af62304a63069ae Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 3 Nov 2020 09:18:48 +0100 Subject: [PATCH] Removed modulation enum from LDPC RM --- lib/include/srslte/phy/common/phy_common.h | 18 +++++++------ lib/include/srslte/phy/fec/ldpc/ldpc_rm.h | 20 ++++---------- lib/src/phy/fec/ldpc/ldpc_rm.c | 26 +++++++++---------- .../phy/fec/ldpc/test/ldpc_rm_chain_test.c | 19 +++++++------- lib/src/phy/fec/ldpc/test/ldpc_rm_test.c | 18 ++++++------- 5 files changed, 47 insertions(+), 54 deletions(-) diff --git a/lib/include/srslte/phy/common/phy_common.h b/lib/include/srslte/phy/common/phy_common.h index 14eb0aa5f..90587673a 100644 --- a/lib/include/srslte/phy/common/phy_common.h +++ b/lib/include/srslte/phy/common/phy_common.h @@ -185,8 +185,7 @@ typedef enum SRSLTE_API { } srslte_phich_r_t; /// LTE duplex modes. -typedef enum SRSLTE_API -{ +typedef enum SRSLTE_API { /// FDD uses frame structure type 1. SRSLTE_FDD = 0, /// TDD uses frame structure type 2. @@ -208,7 +207,7 @@ typedef struct SRSLTE_API { /// TS 36.211 v13.13.0 Table 4.2-1. uint32_t ss_config; /// Set to true when the fields have been configured, otherwise false. - bool configured; + bool configured; } srslte_tdd_config_t; /// TDD uplink-downlink subframe types. @@ -276,12 +275,15 @@ typedef enum SRSLTE_API { typedef enum SRSLTE_API { SRSLTE_MIMO_DECODER_ZF, SRSLTE_MIMO_DECODER_MMSE } srslte_mimo_decoder_t; +/*! + * \brief Types of modulations and associated modulation order. + */ typedef enum SRSLTE_API { - SRSLTE_MOD_BPSK = 0, - SRSLTE_MOD_QPSK, - SRSLTE_MOD_16QAM, - SRSLTE_MOD_64QAM, - SRSLTE_MOD_256QAM, + SRSLTE_MOD_BPSK = 0, /*!< \brief pi/2-BPSK. */ + SRSLTE_MOD_QPSK, /*!< \brief QPSK. */ + SRSLTE_MOD_16QAM, /*!< \brief QAM16. */ + SRSLTE_MOD_64QAM, /*!< \brief QAM64. */ + SRSLTE_MOD_256QAM, /*!< \brief QAM256. */ SRSLTE_MOD_NITEMS } srslte_mod_t; diff --git a/lib/include/srslte/phy/fec/ldpc/ldpc_rm.h b/lib/include/srslte/phy/fec/ldpc/ldpc_rm.h index 0aaa8ca66..2c087f3b6 100644 --- a/lib/include/srslte/phy/fec/ldpc/ldpc_rm.h +++ b/lib/include/srslte/phy/fec/ldpc/ldpc_rm.h @@ -32,19 +32,9 @@ #ifndef SRSLTE_LDPCRM_H #define SRSLTE_LDPCRM_H +#include "srslte/phy/common/phy_common.h" #include "srslte/phy/fec/ldpc/base_graph.h" -/*! - * \brief Types of modulations and associated modulation order. - */ -typedef enum SRSLTE_API { - BPSK, /*!< \brief pi/2-BPSK. */ - QPSK, /*!< \brief QPSK. */ - QAM16, /*!< \brief QAM16. */ - QAM64, /*!< \brief QAM64. */ - QAM256 /*!< \brief QAM256. */ -} mod_type_t; - /*! * \brief Describes a rate matcher or rate dematcher (K, F are ignored at rate matcher) */ @@ -90,7 +80,7 @@ SRSLTE_API int srslte_ldpc_rm_tx(srslte_ldpc_rm_t* q, const srslte_basegraph_t bg, const uint32_t ls, const uint8_t rv, - const mod_type_t mod_type, + const srslte_mod_t mod_type, const uint32_t Nref); /*! @@ -125,7 +115,7 @@ SRSLTE_API int srslte_ldpc_rm_rx_f(srslte_ldpc_rm_t* q, const srslte_basegraph_t bg, const uint32_t ls, const uint8_t rv, - const mod_type_t mod_type, + const srslte_mod_t mod_type, const uint32_t Nref); /*! @@ -159,7 +149,7 @@ SRSLTE_API int srslte_ldpc_rm_rx_s(srslte_ldpc_rm_t* q, const srslte_basegraph_t bg, const uint32_t ls, const uint8_t rv, - const mod_type_t mod_type, + const srslte_mod_t mod_type, const uint32_t Nref); /*! @@ -194,7 +184,7 @@ SRSLTE_API int srslte_ldpc_rm_rx_c(srslte_ldpc_rm_t* q, const srslte_basegraph_t bg, const uint32_t ls, const uint8_t rv, - const mod_type_t mod_type, + const srslte_mod_t mod_type, const uint32_t Nref); /*! diff --git a/lib/src/phy/fec/ldpc/ldpc_rm.c b/lib/src/phy/fec/ldpc/ldpc_rm.c index ffa9502d4..0312e56a6 100644 --- a/lib/src/phy/fec/ldpc/ldpc_rm.c +++ b/lib/src/phy/fec/ldpc/ldpc_rm.c @@ -62,7 +62,7 @@ static const uint32_t BASEN[2] = {66, 50}; static const uint32_t BASEK[2] = {22, 10}; /*! - * \brief Look-up table: Retuns the mod order associated to a mod_type_t + * \brief Look-up table: Retuns the mod order associated to a srslte_mod_t * */ static const uint32_t MODORD[5] = {1, 2, 4, 6, 8}; @@ -116,14 +116,14 @@ struct pRM_rx_c { /*! * Initialize rate-matching parameters */ -static int init_rm(srslte_ldpc_rm_t* p, - const uint32_t E, - const uint32_t F, - const uint32_t bg, - const uint32_t ls, - const uint8_t rv, - const mod_type_t mod_type, - const uint32_t Nref) +static int init_rm(srslte_ldpc_rm_t* p, + const uint32_t E, + const uint32_t F, + const uint32_t bg, + const uint32_t ls, + const uint8_t rv, + const srslte_mod_t mod_type, + const uint32_t Nref) { if (p == NULL) { return -1; @@ -574,7 +574,7 @@ int srslte_ldpc_rm_tx(srslte_ldpc_rm_t* q, const srslte_basegraph_t bg, const uint32_t ls, const uint8_t rv, - const mod_type_t mod_type, + const srslte_mod_t mod_type, const uint32_t Nref) { @@ -605,7 +605,7 @@ int srslte_ldpc_rm_rx_f(srslte_ldpc_rm_t* q, const srslte_basegraph_t bg, const uint32_t ls, const uint8_t rv, - const mod_type_t mod_type, + const srslte_mod_t mod_type, const uint32_t Nref) { @@ -637,7 +637,7 @@ int srslte_ldpc_rm_rx_s(srslte_ldpc_rm_t* q, const srslte_basegraph_t bg, const uint32_t ls, const uint8_t rv, - const mod_type_t mod_type, + const srslte_mod_t mod_type, const uint32_t Nref) { @@ -670,7 +670,7 @@ int srslte_ldpc_rm_rx_c(srslte_ldpc_rm_t* q, const srslte_basegraph_t bg, const uint32_t ls, const uint8_t rv, - const mod_type_t mod_type, + const srslte_mod_t mod_type, const uint32_t Nref) { diff --git a/lib/src/phy/fec/ldpc/test/ldpc_rm_chain_test.c b/lib/src/phy/fec/ldpc/test/ldpc_rm_chain_test.c index b2fea5bd4..bf21f9e87 100644 --- a/lib/src/phy/fec/ldpc/test/ldpc_rm_chain_test.c +++ b/lib/src/phy/fec/ldpc/test/ldpc_rm_chain_test.c @@ -60,14 +60,15 @@ #include "srslte/phy/utils/random.h" #include "srslte/phy/utils/vector.h" -static srslte_basegraph_t base_graph = BG1; /*!< \brief Base Graph (BG1 or BG2). */ -static uint32_t lift_size = 2; /*!< \brief Lifting Size. */ -static uint32_t rm_length = 0; /*!< \brief Codeword length after rate matching. */ -static uint32_t F = 22 - 5; /*!< \brief Number of filler bits in each CBS. */ -static uint8_t rv = 0; /*!< \brief Redundancy version {0-3}. */ -static mod_type_t mod_type = BPSK; /*!< \brief Modulation type: BPSK, QPSK, QAM16, QAM64, QAM256 = 4 */ -static uint32_t Nref = 0; /*!< \brief Limited buffer size. */ -static float snr = 0; /*!< \brief Signal-to-Noise Ratio [dB]. */ +static srslte_basegraph_t base_graph = BG1; /*!< \brief Base Graph (BG1 or BG2). */ +static uint32_t lift_size = 2; /*!< \brief Lifting Size. */ +static uint32_t rm_length = 0; /*!< \brief Codeword length after rate matching. */ +static uint32_t F = 22 - 5; /*!< \brief Number of filler bits in each CBS. */ +static uint32_t E = 14000; /*!< \brief Rate-matched Codeword size. */ +static uint8_t rv = 0; /*!< \brief Redundancy version {0-3}. */ +static srslte_mod_t mod_type = SRSLTE_MOD_BPSK; /*!< \brief Modulation type: BPSK, QPSK, QAM16, QAM64, QAM256 = 4 */ +static uint32_t Nref = 0; /*!< \brief Limited buffer size. */ +static float snr = 0; /*!< \brief Signal-to-Noise Ratio [dB]. */ static int finalK = 0; /*!< \brief Number of uncoded bits (message length, including punctured and filler bits). */ static int finalN = 0; /*!< \brief Number of coded bits (codeword length). */ @@ -121,7 +122,7 @@ void parse_args(int argc, char** argv) rv = (uint8_t)strtol(optarg, NULL, 10); break; case 'm': - mod_type = (mod_type_t)strtol(optarg, NULL, 10); + mod_type = (srslte_mod_t)strtol(optarg, NULL, 10); break; case 'M': Nref = (uint32_t)strtol(optarg, NULL, 10); diff --git a/lib/src/phy/fec/ldpc/test/ldpc_rm_test.c b/lib/src/phy/fec/ldpc/test/ldpc_rm_test.c index 4cf734d47..6b0d053c2 100644 --- a/lib/src/phy/fec/ldpc/test/ldpc_rm_test.c +++ b/lib/src/phy/fec/ldpc/test/ldpc_rm_test.c @@ -53,14 +53,14 @@ #include "srslte/phy/utils/random.h" #include "srslte/phy/utils/vector.h" -static srslte_basegraph_t base_graph = BG2; /*!< \brief Base Graph (BG1 or BG2). */ -static uint32_t lift_size = 208; /*!< \brief Lifting Size. */ -static uint32_t C = 2; /*!< \brief Number of code block segments (CBS). */ -static uint32_t F = 10; /*!< \brief Number of filler bits in each CBS. */ -static uint32_t E = 0; /*!< \brief Rate-matched codeword size (E = 0, no rate matching). */ -static uint8_t rv = 0; /*!< \brief Redundancy version {0-3}. */ -static mod_type_t mod_type = QPSK; /*!< \brief Modulation type: BPSK, QPSK, QAM16, QAM64, QAM256. */ -static uint32_t Nref = 0; /*!< \brief Limited buffer size.*/ +static srslte_basegraph_t base_graph = BG2; /*!< \brief Base Graph (BG1 or BG2). */ +static uint32_t lift_size = 208; /*!< \brief Lifting Size. */ +static uint32_t C = 2; /*!< \brief Number of code block segments (CBS). */ +static uint32_t F = 10; /*!< \brief Number of filler bits in each CBS. */ +static uint32_t E = 0; /*!< \brief Rate-matched codeword size (E = 0, no rate matching). */ +static uint8_t rv = 0; /*!< \brief Redundancy version {0-3}. */ +static srslte_mod_t mod_type = SRSLTE_MOD_QPSK; /*!< \brief Modulation type: BPSK, QPSK, QAM16, QAM64, QAM256. */ +static uint32_t Nref = 0; /*!< \brief Limited buffer size.*/ static uint32_t N = 0; /*!< \brief Codeblock size (including punctured and filler bits). */ static uint32_t K = 0; /*!< \brief Codeword size. */ @@ -104,7 +104,7 @@ void parse_args(int argc, char** argv) rv = (uint8_t)strtol(optarg, NULL, 10); break; case 'm': - mod_type = (mod_type_t)strtol(optarg, NULL, 10); + mod_type = (srslte_mod_t)strtol(optarg, NULL, 10); break; case 'M': Nref = (uint32_t)strtol(optarg, NULL, 10);