adding phy_common_sl.{c,h}

master
Andre Puschmann 5 years ago
parent 8b70ff7654
commit 14000f7ae7

@ -27,7 +27,7 @@
#include "srslte/config.h"
#include "srslte/phy/ch_estimation/chest_common.h"
#include "srslte/phy/ch_estimation/refsignal_ul.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/common/phy_common_sl.h"
#include "srslte/phy/resampling/interp.h"
#define SRSLTE_SL_N_RU_SEQ (30)

@ -340,67 +340,6 @@ typedef struct SRSLTE_API {
#define SRSLTE_NBIOT_NPBCH_NOF_BITS_SF \
(SRSLTE_NBIOT_NPBCH_NOF_TOTAL_BITS / 8) ///< The NPBCH is transmitted in 8 blocks (See 36.211 Sec 10.2.4.4)
///< Sidelink
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_TM1 = 0,
SRSLTE_SIDELINK_TM2,
SRSLTE_SIDELINK_TM3,
SRSLTE_SIDELINK_TM4
} srslte_sl_tm_t;
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_PSBCH = 0,
SRSLTE_SIDELINK_PSCCH,
SRSLTE_SIDELINK_PSSCH,
SRSLTE_SIDELINK_PSDCH
} srslte_sl_channels_t;
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_DATA_SYMBOL = 0,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL
} srslte_sl_symbol_t;
typedef enum {
SRSLTE_SCI_FORMAT0 = 0,
SRSLTE_SCI_FORMAT1
} srslte_sci_format_t;
#define SRSLTE_PSBCH_NOF_PRB (6)
#define SRSLTE_PSCCH_TM34_NOF_PRB (2)
#define SRSLTE_MIB_SL_LEN (40) // TM1/2: 40 bits
#define SRSLTE_MIB_SL_V2X_LEN (48) // TM3/4: 48 bits
#define SRSLTE_MIB_SL_MAX_LEN (SRSLTE_MIB_SL_V2X_LEN)
#define SRSLTE_SL_TM12_DEFAULT_NUM_DMRS_SYMBOLS (2)
#define SRSLTE_SL_TM34_DEFAULT_NUM_DMRS_SYMBOLS (4) ///< In TM3/4, all channels have 4 DMRS by default
#define SRSLTE_PSBCH_TM12_NUM_DATA_SYMBOLS (8) ///< SL-BCH is in 8 OFDM symbols (but only 7 are tx'ed)
#define SRSLTE_PSBCH_TM12_NUM_DMRS_SYMBOLS (2) ///< PSBCH has 2 DMRS symbols
#define SRSLTE_PSBCH_TM12_NUM_SYNC_SYMBOLS (4) ///< Two symbols PSSS and two SSSS
#define SRSLTE_PSBCH_TM34_NUM_DATA_SYMBOLS (7) ///< SL-BCH is in 7 OFDM symbols (but only 6 are tx'ed)
#define SRSLTE_PSBCH_TM34_NUM_DMRS_SYMBOLS (3) ///< PSBCH has 3 DMRS symbols in TM3 and TM4
#define SRSLTE_PSBCH_TM34_NUM_SYNC_SYMBOLS (4) ///< Two symbols PSSS and two SSSS
#define SRSLTE_SCI_CRC_LEN (16)
#define SRSLTE_SCI_MAX_LEN (45)
#define SRSLTE_SCI_TM34_LEN (32)
#define SRSLTE_PSCCH_QM 2
#define SRSLTE_PSCCH_TM12_NOF_PRB (1)
#define SRSLTE_PSCCH_TM34_NOF_PRB (2)
#define SRSLTE_PSCCH_SCRAMBLING_SEED (510) ///< Scrambling seed for PSCCH is 510
#define SRSLTE_PSCCH_TM12_NUM_DATA_SYMBOLS (12)
#define SRSLTE_PSCCH_TM12_NUM_DMRS_SYMBOLS (2)
#define SRSLTE_PSCCH_TM12_NUM_DATA_SYMBOLS_EXT (10)
#define SRSLTE_PSCCH_TM34_NUM_DATA_SYMBOLS (10)
#define SRSLTE_PSCCH_TM34_NUM_DMRS_SYMBOLS (4)
///< PHY common function declarations
SRSLTE_API bool srslte_cell_isvalid(srslte_cell_t* cell);
@ -496,11 +435,6 @@ SRSLTE_API float srslte_band_fu_nbiot(uint32_t ul_earfcn, const float m_ul);
SRSLTE_API char* srslte_nbiot_mode_string(srslte_nbiot_mode_t mode);
SRSLTE_API int srslte_sl_get_num_symbols(srslte_sl_tm_t tm, srslte_cp_t cp);
SRSLTE_API bool srslte_psbch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i);
SRSLTE_API bool srslte_pscch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i, srslte_cp_t cp);
SRSLTE_API uint32_t srslte_sci_format0_sizeof(uint32_t nof_prb);
/**
* Returns a constant string pointer with the ACK/NACK feedback mode
*

@ -0,0 +1,102 @@
/*
* Copyright 2013-2019 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/**********************************************************************************************
* File: phy_common_sl.h
*
* Description: Common parameters and lookup functions for Sidelink PHY
*
* Reference: 3GPP TS 36.211 version 15.3.0 Release 15
*********************************************************************************************/
#ifndef SRSLTE_PHY_COMMON_SL_H
#define SRSLTE_PHY_COMMON_SL_H
#include "phy_common.h"
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_TM1 = 0,
SRSLTE_SIDELINK_TM2,
SRSLTE_SIDELINK_TM3,
SRSLTE_SIDELINK_TM4
} srslte_sl_tm_t;
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_PSBCH = 0,
SRSLTE_SIDELINK_PSCCH,
SRSLTE_SIDELINK_PSSCH,
SRSLTE_SIDELINK_PSDCH
} srslte_sl_channels_t;
typedef struct SRSLTE_API {
srslte_sl_tm_t mode;
uint32_t nof_prb;
uint32_t nof_ports;
uint32_t id;
srslte_cp_t cp;
} srslte_cell_sl_t;
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_DATA_SYMBOL = 0,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL
} srslte_sl_symbol_t;
#define SRSLTE_PSBCH_NOF_PRB (6)
#define SRSLTE_PSCCH_TM34_NOF_PRB (2)
#define SRSLTE_MIB_SL_LEN (40) // TM1/2: 40 bits
#define SRSLTE_MIB_SL_V2X_LEN (48) // TM3/4: 48 bits
#define SRSLTE_MIB_SL_MAX_LEN (SRSLTE_MIB_SL_V2X_LEN)
#define SRSLTE_SL_TM12_DEFAULT_NUM_DMRS_SYMBOLS (2)
#define SRSLTE_SL_TM34_DEFAULT_NUM_DMRS_SYMBOLS (4) ///< In TM3/4, all channels have 4 DMRS by default
#define SRSLTE_PSBCH_TM12_NUM_DATA_SYMBOLS (8) ///< SL-BCH is in 8 OFDM symbols (but only 7 are tx'ed)
#define SRSLTE_PSBCH_TM12_NUM_DMRS_SYMBOLS (2) ///< PSBCH has 2 DMRS symbols
#define SRSLTE_PSBCH_TM12_NUM_SYNC_SYMBOLS (4) ///< Two symbols PSSS and two SSSS
#define SRSLTE_PSBCH_TM34_NUM_DATA_SYMBOLS (7) ///< SL-BCH is in 7 OFDM symbols (but only 6 are tx'ed)
#define SRSLTE_PSBCH_TM34_NUM_DMRS_SYMBOLS (3) ///< PSBCH has 3 DMRS symbols in TM3 and TM4
#define SRSLTE_PSBCH_TM34_NUM_SYNC_SYMBOLS (4) ///< Two symbols PSSS and two SSSS
#define SRSLTE_PSCCH_QM 2
#define SRSLTE_PSCCH_TM12_NOF_PRB (1)
#define SRSLTE_PSCCH_TM34_NOF_PRB (2)
#define SRSLTE_PSCCH_SCRAMBLING_SEED (510) ///< Scrambling seed for PSCCH is 510
#define SRSLTE_PSCCH_TM12_NUM_DATA_SYMBOLS (12)
#define SRSLTE_PSCCH_TM12_NUM_DMRS_SYMBOLS (2)
#define SRSLTE_PSCCH_TM12_NUM_DATA_SYMBOLS_EXT (10)
#define SRSLTE_PSCCH_TM34_NUM_DATA_SYMBOLS (10)
#define SRSLTE_PSCCH_TM34_NUM_DMRS_SYMBOLS (4)
SRSLTE_API int srslte_sl_get_num_symbols(srslte_sl_tm_t tm, srslte_cp_t cp);
SRSLTE_API bool srslte_psbch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i);
SRSLTE_API bool srslte_pscch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i, srslte_cp_t cp);
SRSLTE_API uint32_t srslte_sci_format0_sizeof(uint32_t nof_prb);
#endif // SRSLTE_PHY_COMMON_SL_H

@ -26,7 +26,7 @@
#include <stdint.h>
#include "srslte/config.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/common/phy_common_sl.h"
/**
* Master information block - Sidelink (MIB-SL and MIB-SL-V2X).

@ -22,6 +22,7 @@
#ifndef SRSLTE_PSBCH_H
#define SRSLTE_PSBCH_H
#include <srslte/phy/common/phy_common_sl.h>
#include <srslte/phy/dft/dft_precoding.h>
#include <srslte/phy/fec/convcoder.h>
#include <srslte/phy/fec/crc.h>

@ -24,7 +24,7 @@
#include <stdint.h>
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/common/phy_common_sl.h"
#include "srslte/phy/common/sequence.h"
#include "srslte/phy/dft/dft_precoding.h"
#include "srslte/phy/fec/convcoder.h"

@ -26,10 +26,16 @@
#include <stdint.h>
#include "srslte/config.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/common/phy_common_sl.h"
#define SRSLTE_SCI_MSG_MAX_LEN 80
#define SRSLTE_SCI_CRC_LEN (16)
#define SRSLTE_SCI_MAX_LEN (45)
#define SRSLTE_SCI_TM34_LEN (32)
typedef enum { SRSLTE_SCI_FORMAT0 = 0, SRSLTE_SCI_FORMAT1 } srslte_sci_format_t;
/**
* Sidelink Control Information - Sidelink (SCI0 and SCI1).
*

@ -34,7 +34,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/common/phy_common_sl.h"
#include "srslte/phy/dft/dft.h"
#define SRSLTE_SSSS_NOF_SEQ 336

@ -18,5 +18,5 @@
# and at http://www.gnu.org/licenses/.
#
file(GLOB SOURCES "*.c")
set(SOURCES phy_common.c phy_common_sl.c sequence.c timestamp.c)
add_library(srslte_phy_common OBJECT ${SOURCES})

@ -813,68 +813,6 @@ char* srslte_nbiot_mode_string(srslte_nbiot_mode_t mode)
}
}
///< Sidelink helpers
int srslte_sl_get_num_symbols(srslte_sl_tm_t tm, srslte_cp_t cp)
{
if (tm == SRSLTE_SIDELINK_TM1 || tm == SRSLTE_SIDELINK_TM2) {
if (cp == SRSLTE_CP_NORM) {
return SRSLTE_CP_NORM_SF_NSYMB;
} else {
return SRSLTE_CP_EXT_SF_NSYMB;
}
} else if (tm == SRSLTE_SIDELINK_TM3 || tm == SRSLTE_SIDELINK_TM4) {
if (cp == SRSLTE_CP_NORM) {
return SRSLTE_CP_NORM_SF_NSYMB;
} else {
ERROR("Invalid CP");
return SRSLTE_ERROR;
}
} else {
ERROR("Invalid TM");
return SRSLTE_ERROR;
}
}
///< Look-up tables for Sidelink channel symbols
static const srslte_sl_symbol_t srslte_psbch_symbol_map_tm12[SRSLTE_CP_NORM_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
static const srslte_sl_symbol_t srslte_psbch_symbol_map_tm34[SRSLTE_CP_NORM_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
bool srslte_psbch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i)
{
if (tm <= SRSLTE_SIDELINK_TM2) {
return srslte_psbch_symbol_map_tm12[i] == type;
} else {
return srslte_psbch_symbol_map_tm34[i] == type;
}
}
const char* srslte_ack_nack_feedback_mode_string(srslte_ack_nack_feedback_mode_t ack_nack_feedback_mode)
{
switch (ack_nack_feedback_mode) {
@ -916,86 +854,4 @@ srslte_ack_nack_feedback_mode_t srslte_string_ack_nack_feedback_mode(const char*
// Otherwise Normal
return SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_NORMAL;
}
static const srslte_sl_symbol_t srslte_pscch_symbol_map_tm12[SRSLTE_CP_NORM_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
static const srslte_sl_symbol_t srslte_pscch_symbol_map_tm12_ext[SRSLTE_CP_EXT_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
static const srslte_sl_symbol_t srslte_pscch_symbol_map_tm34[SRSLTE_CP_NORM_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
bool srslte_pscch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i, srslte_cp_t cp)
{
if (tm == SRSLTE_SIDELINK_TM1 || tm == SRSLTE_SIDELINK_TM2) {
if (cp == SRSLTE_CP_EXT) {
return srslte_pscch_symbol_map_tm12_ext[i] == type;
}
return srslte_pscch_symbol_map_tm12[i] == type;
} else if (tm == SRSLTE_SIDELINK_TM3 || tm == SRSLTE_SIDELINK_TM4) {
return srslte_pscch_symbol_map_tm34[i] == type;
}
return false;
}
uint32_t srslte_sci_format0_sizeof(uint32_t nof_prb)
{
// 3GPP TS 36.212 5.4.3.1
uint32_t n = 0;
// Frequency hopping flag 1 bit
n += 1;
// Resource block assignment and hopping resource allocation
n += (uint32_t)ceil(log((nof_prb * (nof_prb + 1)) / 2.0) / log(2));
// Time resource pattern 7 bits
n += 7;
// Modulation and coding scheme 5 bit
n += 5;
// Timing advance indication 11 bits
n += 11;
// Group destination ID 8 bits
n += 8;
return n;
}

@ -0,0 +1,141 @@
/*
* Copyright 2013-2019 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "srslte/phy/common/phy_common_sl.h"
#include "srslte/phy/utils/debug.h"
int srslte_sl_get_num_symbols(srslte_sl_tm_t tm, srslte_cp_t cp)
{
if (tm == SRSLTE_SIDELINK_TM1 || tm == SRSLTE_SIDELINK_TM2) {
if (cp == SRSLTE_CP_NORM) {
return SRSLTE_CP_NORM_SF_NSYMB;
} else {
return SRSLTE_CP_EXT_SF_NSYMB;
}
} else if (tm == SRSLTE_SIDELINK_TM3 || tm == SRSLTE_SIDELINK_TM4) {
if (cp == SRSLTE_CP_NORM) {
return SRSLTE_CP_NORM_SF_NSYMB;
} else {
ERROR("Invalid CP");
return SRSLTE_ERROR;
}
} else {
ERROR("Invalid TM");
return SRSLTE_ERROR;
}
}
///< Look-up tables for Sidelink channel symbols
static const srslte_sl_symbol_t srslte_psbch_symbol_map_tm12[SRSLTE_CP_NORM_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
static const srslte_sl_symbol_t srslte_psbch_symbol_map_tm34[SRSLTE_CP_NORM_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
bool srslte_psbch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i)
{
if (tm <= SRSLTE_SIDELINK_TM2) {
return srslte_psbch_symbol_map_tm12[i] == type;
} else {
return srslte_psbch_symbol_map_tm34[i] == type;
}
}
static const srslte_sl_symbol_t srslte_pscch_symbol_map_tm12[SRSLTE_CP_NORM_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
static const srslte_sl_symbol_t srslte_pscch_symbol_map_tm12_ext[SRSLTE_CP_EXT_SF_NSYMB] = {
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
static const srslte_sl_symbol_t srslte_pscch_symbol_map_tm34[SRSLTE_CP_NORM_SF_NSYMB] = {SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_DATA_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL};
bool srslte_pscch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i, srslte_cp_t cp)
{
if (tm == SRSLTE_SIDELINK_TM1 || tm == SRSLTE_SIDELINK_TM2) {
if (cp == SRSLTE_CP_EXT) {
return srslte_pscch_symbol_map_tm12_ext[i] == type;
}
return srslte_pscch_symbol_map_tm12[i] == type;
} else if (tm == SRSLTE_SIDELINK_TM3 || tm == SRSLTE_SIDELINK_TM4) {
return srslte_pscch_symbol_map_tm34[i] == type;
}
return false;
}

@ -21,16 +21,18 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "srslte/phy/phch/pscch.h"
#include "srslte/phy/fec/rm_conv.h"
#include "srslte/phy/utils/bit.h"
#include "srslte/phy/utils/debug.h"
#include "srslte/phy/utils/vector.h"
#include "srslte/phy/modem/demod_soft.h"
#include "srslte/phy/modem/mod.h"
#include "srslte/phy/phch/pscch.h"
#include "srslte/phy/phch/sch.h"
#include "srslte/phy/phch/sci.h"
#include "srslte/phy/scrambling/scrambling.h"
#include "srslte/phy/utils/bit.h"
#include "srslte/phy/utils/debug.h"
#include "srslte/phy/utils/vector.h"
int srslte_pscch_init(srslte_pscch_t* q, uint32_t nof_prb, srslte_sl_tm_t tm, srslte_cp_t cp)
{

@ -167,4 +167,30 @@ void srslte_sci_free(srslte_sci_t* q)
if (q != NULL) {
bzero(q, sizeof(srslte_sci_t));
}
}
uint32_t srslte_sci_format0_sizeof(uint32_t nof_prb)
{
// 3GPP TS 36.212 5.4.3.1
uint32_t n = 0;
// Frequency hopping flag 1 bit
n += 1;
// Resource block assignment and hopping resource allocation
n += (uint32_t)ceil(log((nof_prb * (nof_prb + 1)) / 2.0) / log(2));
// Time resource pattern 7 bits
n += 7;
// Modulation and coding scheme 5 bit
n += 5;
// Timing advance indication 11 bits
n += 11;
// Group destination ID 8 bits
n += 8;
return n;
}
Loading…
Cancel
Save