Commit b8d9da2e authored by Raymond Knopp's avatar Raymond Knopp

sci/slsch mac step1

parent 8199a1e0
......@@ -1066,6 +1066,10 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_pbch.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_psbch_rx.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_psbch_tx.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/psfch_nr.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dci.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
......@@ -1380,6 +1384,7 @@ set (MAC_NR_SRC_UE
${NR_UE_MAC_DIR}/nr_ra_procedures.c
${NR_UE_MAC_DIR}/nr_ue_power_procedures.c
${NR_UE_MAC_DIR}/nr_ue_sci_slsch.c
${NR_UE_MAC_DIR}/nr_slsch_scheduler.c
)
set (ENB_APP_SRC
......
......@@ -277,6 +277,8 @@ typedef struct sl_nr_tx_config_pscch_pssch_pdu {
// from this value according to 38.213 section 16
int16_t pssch_tx_power;
uint16_t slsch_payload_length;
uint8_t *slsch_payload;
} sl_nr_tx_config_pscch_pssch_pdu_t;
// MAC indicates PHY to send PSBCH.
......@@ -288,6 +290,16 @@ typedef struct sl_nr_tx_config_psbch_pdu {
} sl_nr_tx_config_psbch_pdu_t;
typedef struct sl_nr_tx_config_psfch_pdu {
// These fields map directly to the same fields in nfapi_nr_ul_config_pucch_pdu
uint8_t start_symbol_index;
uint8_t hopping_id;
uint8_t prb;
uint16_t initial_cyclic_shift;
uint8_t mcs;
} sl_nr_tx_config_psfch_pdu_t;
// MAC commands PHY to perform an action on TX RESOURCE POOL or TX PSBCH using this TX CONFIG
typedef struct {
sl_nr_tx_config_type_enum_t pdu_type; // indicates the type of TX config request
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/NR_UE_TRANSPORT/nr_pscch_tx.c
* \brief Top-level routines for generating and decoding the PSCCH physical channel
* \author R. Knopp
* \date 2023
* \version 0.1
* \company Eurecom
* \email:
* \note
* \warning
*/
//#include "PHY/defs.h"
#include "PHY/impl_defs_nr.h"
#include "PHY/defs_nr_common.h"
#include "PHY/defs_nr_UE.h"
//#include "PHY/extern.h"
#include "PHY/NR_UE_TRANSPORT/pucch_nr.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
#include <openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h>
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "T.h"
void nr_generate_psfch0(const PHY_VARS_NR_UE *ue,
c16_t **txdataF,
const NR_DL_FRAME_PARMS *frame_parms,
const int16_t amp,
const int nr_slot_tx,
const sl_nr_tx_config_psfch_pdu_t *psfch_pdu)
{
fapi_nr_ul_config_pucch_pdu pucch_pdu;
pucch_pdu.start_symbol_index = psfch_pdu->start_symbol_index;
pucch_pdu.hopping_id = psfch_pdu->hopping_id;
pucch_pdu.prb_start = psfch_pdu->prb;
pucch_pdu.initial_cyclic_shift = psfch_pdu->initial_cyclic_shift;
pucch_pdu.mcs = psfch_pdu->mcs;
nr_generate_pucch0(ue,txdataF,frame_parms,amp,nr_slot_tx,&pucch_pdu);
}
......@@ -681,7 +681,8 @@ typedef struct nr_phy_data_tx_s {
//Sidelink Rx action decided by MAC
sl_nr_tx_config_type_enum_t sl_tx_action;
sl_nr_tx_config_psbch_pdu_t psbch_vars;
sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_pdu;
sl_nr_tx_config_psfch_pdu_t *nr_sl_psfch_pdu;
} nr_phy_data_tx_t;
typedef struct nr_phy_data_s {
......
......@@ -733,6 +733,9 @@ int8_t sl_handle_scheduled_response(nr_scheduled_response_t *scheduled_response)
phy_data_tx->psbch_vars.tx_slss_id =
sl_tx_config->tx_config_list[0].tx_psbch_config_pdu.tx_slss_id;
break;
case SL_NR_CONFIG_TYPE_TX_PSCCH_PSSCH:
phy_data_tx->sl_tx_action = SL_NR_CONFIG_TYPE_TX_PSCCH_PSSCH;
LOG_I(NR_PHY,"Received CONFIG_TYPE_TX_PSCCH_PSSCH\n");
default:
AssertFatal(0,"Incorrect sl_tx config req pdutype \n");
break;
......
......@@ -285,7 +285,7 @@ int phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue,
for(int i=0; i< fp->nb_antennas_tx; ++i)
txdataF[i] = &txdataF_buf[i * samplesF_per_slot];
LOG_D(PHY,"****** start Sidelink TX-Chain for AbsSubframe %d.%d ******\n",
LOG_I(PHY,"****** start Sidelink TX-Chain for AbsSubframe %d.%d ******\n",
frame_tx, slot_tx);
start_meas(&sl_phy_params->phy_proc_sl_tx);
......@@ -308,7 +308,12 @@ int phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue,
}
tx_action = 1;
}
else if (phy_data->sl_tx_action == SL_NR_CONFIG_TYPE_TX_PSCCH_PSSCH) {
LOG_I(NR_PHY,"Generating PSCCH ( )\n");
}
else if (phy_data->sl_tx_action == SL_NR_CONFIG_TYPE_TX_PSFCH) {
LOG_I(NR_PHY,"Generating PSFCH ( )\n");
}
if (tx_action) {
LOG_D(PHY, "Sending Uplink data \n");
nr_ue_pusch_common_procedures(ue,
......
......@@ -38,6 +38,8 @@
#include <string.h>
#include <stdbool.h>
#include "common/utils/nr/nr_common.h"
#include "common/utils/collection/linear_alloc.h"
#include "NR_CellGroupConfig.h"
#define NR_SHORT_BSR_TABLE_SIZE 32
......@@ -404,6 +406,22 @@ typedef struct {
#define NR_MAX_NUM_LCID 32
#define NR_MAX_NUM_LCGID 8
#define SL_SCH_LCID_SCCH_PC5_NOT_PROT 0 // SCCH carrying PC5-S messages that are not protected
#define SL_SCH_LCID_SCCH_PC5_DSMC 1 // SCCH carrying PC5-S messages "Direct Security Mode Command" and "Direct Security Mode Complete"
#define SL_SCH_LCID_SCCH_PC5_PROT 2 // SCCH carrying other PC5-S messages that are protected
#define SL_SCH_LCID_SCCH_PC5_RRC 3 // SCCH carrying PC5-RRC messages
#define SL_SCH_LCID_4_19 4 // 4–19 Identity of the logical channel
#define SL_SCH_LCID_20_55 20 // 20–55 Reserved
#define SL_SCH_LCID_SCCH_RRC_SL_RLC0 56 // SCCH carrying RRC messages delivered via SL-RLC0 as specified in TS 38.331 [5]
#define SL_SCH_LCID_SCCH_RRC_SL_RLC1 57 // SCCH carrying RRC message delivered via SL-RLC1 as specified in TS 38.331 [5]
#define SL_SCH_LCID_SCCH_SL_DISCOVERY 58 // SCCH for Sidelink Discovery Messages
#define SL_SCH_LCID_SL_INTER_UE_COORD_REQ 59 // Sidelink Inter-UE Coordination Request
#define SL_SCH_LCID_SL_INTER_UE_COORD_INFO 60 // Sidelink Inter-UE Coordination Information
#define SL_SCH_LCID_SL_DRX_CMD 61 // Sidelink DRX Command
#define SL_SCH_LCID_SL_CSI_REPORT 62 // Sidelink CSI Reporting
#define SL_SCH_LCID_SL_PADDING 63 // Padding
#define MAX_RLC_SDU_SUBHEADER_SIZE 3
//===========
......@@ -534,6 +552,11 @@ typedef struct nr_csi_report {
int N2;
} nr_csi_report_t;
typedef struct {
int CQI;
int RI;
} nr_sl_csi_report_t;
typedef enum {
NR_SRS_SRI_0 = 0,
NR_SRS_SRI_1,
......@@ -619,5 +642,21 @@ typedef struct NR_tda_info {
long k2;
} NR_tda_info_t;
typedef struct NR_bler_stats {
frame_t last_frame;
float bler;
uint8_t mcs;
uint64_t rounds[8];
} NR_bler_stats_t;
/*! \brief NR_list_t is a "list" (of users, HARQ processes, slices, ...).
* * Especially useful in the scheduler and to keep "classes" of users. */
typedef struct {
int head;
int *next;
int tail;
int len;
} NR_list_t;
#endif /*__LAYER2_MAC_H__ */
......@@ -20,6 +20,7 @@
*/
#include "openair2/LAYER2/NR_MAC_UE/mac_defs.h"
#include "openair2/LAYER2/NR_MAC_UE/nr_ue_sci.h"
#include "NR_SidelinkPreconfigNR-r16.h"
#include "mac_proto.h"
......@@ -370,6 +371,7 @@ int nr_rrc_mac_config_req_sl_preconfig(module_id_t module_id,
if (freqcfg->sl_BWP_List_r16 &&
freqcfg->sl_BWP_List_r16->list.array[0])
bwp = freqcfg->sl_BWP_List_r16->list.array[0];
mac->sl_bwp = bwp;
AssertFatal(bwp!=NULL, "BWP config common cannot be NULL\n");
if (bwp->sl_BWP_PoolConfigCommon_r16) {
......@@ -380,6 +382,7 @@ int nr_rrc_mac_config_req_sl_preconfig(module_id_t module_id,
if (rxpool) {
if (sl_mac->sl_RxPool[i] == NULL)
sl_mac->sl_RxPool[i] = malloc16_clear(sizeof(SL_ResourcePool_params_t));
mac->sl_rx_res_pool = rxpool;
sl_mac->sl_RxPool[i]->respool = rxpool;
uint16_t sci_1a_len = 0, num_subch = 0;
sci_1a_len = sl_determine_sci_1a_len(&num_subch,
......@@ -404,6 +407,7 @@ int nr_rrc_mac_config_req_sl_preconfig(module_id_t module_id,
bwp->sl_BWP_PoolConfigCommon_r16->sl_TxPoolSelectedNormal_r16->list.array[0]->sl_ResourcePool_r16;
if (txpool) {
mac->sl_tx_res_pool = txpool;
if (sl_mac->sl_TxPool[i] == NULL)
sl_mac->sl_TxPool[i] = malloc16_clear(sizeof(SL_ResourcePool_params_t));
sl_mac->sl_TxPool[i]->respool = txpool;
......
......@@ -48,7 +48,7 @@
#include "LAYER2/MAC/mac.h"
#include "NR_MAC_COMMON/nr_mac_extern.h"
#include "mac_defs_sl.h"
#include "LAYER2/RLC/rlc.h"
/* RRC */
#include "NR_DRX-Config.h"
#include "NR_SchedulingRequestConfig.h"
......@@ -421,6 +421,82 @@ typedef struct ssb_list_info {
uint8_t nb_tx_ssb;
} ssb_list_info_t;
typedef struct NR_sched_pssch {
int frame;
int slot;
int mu;
/// RB allocation within active uBWP
uint16_t rbSize;
uint16_t rbStart;
/// MCS
uint8_t mcs;
/// TBS-related info
uint16_t R;
uint8_t Qm;
uint32_t tb_size;
/// UL HARQ PID to use for this UE, or -1 for "any new"
int8_t sl_harq_pid;
uint8_t nrOfLayers;
//NR_pusch_dmrs_t dmrs_info;
} NR_sched_pssch_t;
typedef struct {
bool is_waiting;
uint8_t ndi;
uint8_t round;
uint16_t feedback_slot;
/// sched_pusch keeps information on MCS etc used for the initial transmission
NR_sched_pssch_t sched_pssch;
} NR_UE_sl_harq_t;
//
typedef struct {
/// Sched PSSCH: scheduling decisions, copied into HARQ and cleared every TTI
NR_sched_pssch_t sched_pssch;
//
NR_bler_stats_t sl_bler_stats;
/// per-LC status data
mac_rlc_status_resp_t rlc_status[NR_MAX_NUM_LCID];
//
/// information about every UL HARQ process
NR_UE_sl_harq_t sl_harq_processes[NR_MAX_HARQ_PROCESSES];
/// UL HARQ processes that are free
NR_list_t available_sl_harq;
/// UL HARQ processes that await feedback
NR_list_t feedback_sl_harq;
/// UL HARQ processes that await retransmission
NR_list_t retrans_sl_harq;
//
// NR_SLSCH
} NR_SL_UE_sched_ctrl_t;
#define MAX_SL_UE_CONNECTIONS 8
#define MAX_SL_CSI_REPORTCONFIG MAX_SL_UE_CONNECTIONS
typedef struct {
uint16_t dest_id;
uid_t uid; // unique ID of this UE
/// scheduling control info
nr_sl_csi_report_t csi_report_template[MAX_SL_CSI_REPORTCONFIG];
NR_SL_UE_sched_ctrl_t UE_sched_ctrl;
} NR_SL_UE_info_t;
typedef struct {
NR_SL_UE_info_t *list[MAX_SL_UE_CONNECTIONS+1];
uid_allocator_t ue_allocator;
} NR_SL_UEs_t;
/*!\brief Top level UE MAC structure */
typedef struct {
NR_UE_L2_STATE_t state;
......@@ -459,7 +535,8 @@ typedef struct {
// sidelink
NR_SL_BWP_ConfigCommon_r16_t *sl_bwp;
NR_SL_ResourcePool_r16_t *sl_res_pool;
NR_SL_ResourcePool_r16_t *sl_rx_res_pool;
NR_SL_ResourcePool_r16_t *sl_tx_res_pool;
bool phy_config_request_sent;
frame_type_t frame_type;
......@@ -535,6 +612,9 @@ typedef struct {
//SIDELINK MAC PARAMETERS
sl_nr_ue_mac_params_t *SL_MAC_PARAMS;
// SIDELINK Scheduling fields
NR_SL_UEs_t UE_info;
} NR_UE_MAC_INST_t;
/*@}*/
......
......@@ -27,7 +27,7 @@
#include "NR_TDD-UL-DL-ConfigCommon.h"
#include "NR_MAC_COMMON/nr_mac.h"
#include "NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include "nr_ue_sci.h"
#define SL_NR_MAC_NUM_RX_RESOURCE_POOLS 1
#define SL_NR_MAC_NUM_TX_RESOURCE_POOLS 1
......
......@@ -480,5 +480,23 @@ void nr_mac_rrc_sl_mib_ind(const module_id_t module_id,
uint8_t* pduP,
const sdu_size_t pdu_len,
const uint16_t rx_slss_id);
void config_pssch_sci_pdu_rx(sl_nr_rx_config_pssch_sci_pdu_t *nr_sl_pssch_sci_pdu,
nr_sci_format_t sci2_format,
nr_sci_pdu_t *sci_pdu,
uint32_t pscch_Nid,
int pscch_subchannel_index,
const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp,
const NR_SL_ResourcePool_r16_t *sl_res_pool);
void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_pdu,
const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp,
const NR_SL_ResourcePool_r16_t *sl_res_pool,
nr_sci_pdu_t *sci_pdu,
nr_sci_pdu_t *sci2_pdu,
uint8_t *slsch_pdu,
uint16_t slsch_pdu_length,
const nr_sci_format_t format1,
const nr_sci_format_t format2);
#endif
/** @}*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/* \file nr_slsch_scheduler.c
* \brief Routines for UE SLSCH scheduling
* \author R. Knopp
* \date Aug. 2023
* \version 0.1
* \company EURECOM
* \email raymond.knopp@eurecom.fr
*/
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
#include <common/utils/nr/nr_common.h>
#include "NR_MAC_COMMON/nr_mac.h"
#include "NR_MAC_COMMON/nr_mac_common.h"
#include "NR_MAC_UE/mac_proto.h"
#include "NR_MAC_UE/mac_extern.h"
#include "NR_MAC_UE/nr_ue_sci.h"
bool nr_schedule_slsch(nr_sci_pdu_t *sci_pdu,nr_sci_pdu_t *sci2_pdu,uint8_t *slsch_pdu,nr_sci_format_t format2, uint16_t *slsch_pdu_length) {
// Fill SCI1A
sci_pdu->priority = 0;
sci_pdu->frequency_resource_assignment.val=0;
sci_pdu->time_resource_assignment.val=0;
sci_pdu->resource_reservation_period.val=0;
sci_pdu->dmrs_pattern.val = 0;
sci_pdu->second_stage_sci_format = 0;
sci_pdu->number_of_dmrs_port = 0;
sci_pdu->mcs = 9;
sci_pdu->additional_mcs.val = 0;
sci_pdu->psfch_overhead.val = 0;
sci_pdu->reserved.val = 0;
sci_pdu->conflict_information_receiver.val = 0;
// Fill SCI2A
sci2_pdu->harq_pid = 0;
sci2_pdu->ndi = 0;
sci2_pdu->rv_index=0;
sci2_pdu->source_id=0;
sci2_pdu->dest_id=1;
sci2_pdu->harq_feedback=0;
sci2_pdu->cast_type=0;
if (format2==NR_SL_SCI_FORMAT_2C || format2==NR_SL_SCI_FORMAT_2A)
sci2_pdu->csi_req=0;
if (format2==NR_SL_SCI_FORMAT_2B)
sci2_pdu->zone_id=0;
// Fill in for R17: communication_range
sci2_pdu->communication_range.val = 0;
if (format2==NR_SL_SCI_FORMAT_2C) {
sci2_pdu->providing_req_ind = 0;
// Fill in for R17 : resource combinations
sci2_pdu->resource_combinations.val = 0;
sci2_pdu->first_resource_location = 0;
// Fill in for R17 : reference_slot_location
sci2_pdu->reference_slot_location.val = 0;
sci2_pdu->resource_set_type=0;
// Fill in for R17 : lowest_subchannel_indices
sci2_pdu->lowest_subchannel_indices.val=0;
}
// Set SLSCH
return true;
}
......@@ -43,7 +43,7 @@
#include "NR_MAC_COMMON/nr_mac_common.h"
#include "NR_MAC_UE/mac_proto.h"
#include "NR_MAC_UE/mac_extern.h"
#include "NR_MAC_UE/nr_ue_sci.h"
/* utils */
#include "assertions.h"
#include "oai_asn1.h"
......@@ -3240,6 +3240,52 @@ uint8_t sl_determine_if_SSB_slot(uint16_t frame, uint16_t slot, uint16_t slots_p
frame, slot, sl_bch->ssb_slot,sl_bch->num_ssb);
return 0;
}
bool nr_ue_sl_pssch_scheduler(nr_sidelink_indication_t *sl_ind,
const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp,
const NR_SL_ResourcePool_r16_t *sl_res_pool,
sl_nr_tx_config_request_t *tx_config,
uint8_t *config_type) {
uint8_t ret_status = 0;
uint16_t slot = sl_ind->slot_tx;
uint16_t frame = sl_ind->frame_tx;
if (sl_ind->slot_type != SIDELINK_SLOT_TYPE_TX) return false;
LOG_I(NR_MAC,"[UE%d] SL-PSSCH SCHEDULER: Frame:SLOT %d:%d, slot_type:%d\n",
sl_ind->module_id, frame, slot,sl_ind->slot_type);
nr_sci_pdu_t sci_pdu;
nr_sci_pdu_t sci2_pdu;
uint8_t *slsch_pdu;
uint16_t slsch_pdu_length;
bool schedule_slsch = nr_schedule_slsch(&sci_pdu,&sci2_pdu,&slsch_pdu,&slsch_pdu_length);
if (!schedule_slsch) return false;
*config_type = SL_NR_CONFIG_TYPE_TX_PSCCH_PSSCH;
tx_config->number_pdus = 1;
tx_config->sfn = frame;
tx_config->slot = slot;
tx_config->tx_config_list[0].pdu_type = *config_type;
fill_pssch_pscch_pdu(&tx_config->tx_config_list[0].tx_pscch_pssch_config_pdu,
sl_bwp,
sl_res_pool,
&sci_pdu,
&sci2_pdu,
slsch_pdu,
slsch_pdu_length,
NR_SL_SCI_FORMAT_1A,
NR_SL_SCI_FORMAT_2A);
LOG_I(NR_MAC, "[UE%d] TTI-%d:%d TX PSCCH_PSSCH REQ \n", sl_ind->module_id,frame, slot);
ret_status = schedule_slsch;
return ret_status;
}
/*
* determine if sidelink slot is a PSBCH slot
......@@ -3392,14 +3438,29 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) {
// Check if PSBCH slot and PSBCH should be transmitted or Received
is_psbch_slot = nr_ue_sl_psbch_scheduler(sl_ind, sl_mac, &rx_config, &tx_config, &tti_action);
if (!is_psbch_slot) {
bool tx_allowed=true,rx_allowed=true;
if (mac->sl_tx_res_pool && mac->sl_tx_res_pool->ext1 && mac->sl_tx_res_pool->ext1->sl_TimeResource_r16) {
int sl_tx_period = 8*mac->sl_tx_res_pool->ext1->sl_TimeResource_r16->size - mac->sl_tx_res_pool->ext1->sl_TimeResource_r16->bits_unused;
int slot_mod_period = sl_ind->slot_tx%sl_tx_period;
uint8_t mask = mac->sl_tx_res_pool->ext1->sl_TimeResource_r16->buf[slot_mod_period>>3];
if (((1<<slot_mod_period) % mask) == 0) tx_allowed=0;
}
if (mac->sl_rx_res_pool && mac->sl_rx_res_pool->ext1 && mac->sl_tx_res_pool->ext1->sl_TimeResource_r16) {
int sl_rx_period = 8*mac->sl_rx_res_pool->ext1->sl_TimeResource_r16->size - mac->sl_rx_res_pool->ext1->sl_TimeResource_r16->bits_unused;
int slot_mod_period = sl_ind->slot_rx%sl_rx_period;
uint8_t mask = mac->sl_rx_res_pool->ext1->sl_TimeResource_r16->buf[slot_mod_period>>3];
if (((1<<slot_mod_period) % mask) == 0) rx_allowed=0;
}
if (!is_psbch_slot && tx_allowed) {
//Check if reserved slot or a sidelink resource configured in Rx/Tx resource pool timeresource bitmap
nr_ue_sl_pssch_scheduler(sl_ind, mac->sl_bwp, mac->sl_tx_res_pool,&tx_config, &tti_action);
}
if (tti_action == SL_NR_CONFIG_TYPE_RX_PSBCH) {
if (tti_action == SL_NR_CONFIG_TYPE_RX_PSBCH || tti_action == SL_NR_CONFIG_TYPE_RX_PSCCH || tti_action == SL_NR_CONFIG_TYPE_RX_PSSCH_SCI || tti_action == SL_NR_CONFIG_TYPE_RX_PSSCH_SLSCH) {
fill_scheduled_response(&scheduled_response, NULL, NULL, NULL, &rx_config, NULL, mod_id, 0,frame, slot, sl_ind->phy_data);
}
if (tti_action == SL_NR_CONFIG_TYPE_TX_PSBCH) {
if (tti_action == SL_NR_CONFIG_TYPE_TX_PSBCH || tti_action == SL_NR_CONFIG_TYPE_TX_PSCCH_PSSCH) {
fill_scheduled_response(&scheduled_response, NULL, NULL, NULL, NULL, &tx_config, mod_id, 0,frame, slot, sl_ind->phy_data);
}
......
......@@ -30,6 +30,8 @@
* \warning
*/
#ifndef __LAYER2_NR_UE_SCI_H__
#define __LAYER2_NR_UE_SCI_H__
#include "NR_MAC_COMMON/nr_mac.h"
typedef enum {
......@@ -72,4 +74,4 @@ typedef struct {
uint8_t resource_set_type; // 1 bit, format 2C
dci_field_t lowest_subchannel_indices; // depending on n_subChannel^SL, format 2C
} nr_sci_pdu_t;
#endif
......@@ -73,7 +73,9 @@ uint32_t nr_sci_size(const NR_SL_ResourcePool_r16_t *sl_res_pool,
size+=3;
// frequency resource assignment
long Nsc = *sl_res_pool->sl_NumSubchannel_r16;
if (*sl_res_pool->sl_UE_SelectedConfigRP_r16->sl_MaxNumPerReserve_r16 == NR_SL_UE_SelectedConfigRP_r16__sl_MaxNumPerReserve_r16_n2)
if (sl_res_pool->sl_UE_SelectedConfigRP_r16 &&
sl_res_pool->sl_UE_SelectedConfigRP_r16->sl_MaxNumPerReserve_r16 &&
*sl_res_pool->sl_UE_SelectedConfigRP_r16->sl_MaxNumPerReserve_r16 == NR_SL_UE_SelectedConfigRP_r16__sl_MaxNumPerReserve_r16_n2)
sci_pdu->frequency_resource_assignment.nbits = (uint8_t)ceil(log2((Nsc * (Nsc + 1)) >>1));
else
sci_pdu->frequency_resource_assignment.nbits = (uint8_t)ceil(log2((Nsc * (Nsc + 1) * (2*Nsc + 1)) /6));
......@@ -214,6 +216,8 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p
const NR_SL_ResourcePool_r16_t *sl_res_pool,
nr_sci_pdu_t *sci_pdu,
nr_sci_pdu_t *sci2_pdu,
uint8_t *slsch_pdu,
uint16_t slsch_pdu_length,
const nr_sci_format_t format1,
const nr_sci_format_t format2) {
int pos=0,fsize;
......@@ -423,7 +427,10 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p
AssertFatal(1==0,"Unknown format %d for sci2\n",format2);
break;
}
}
nr_sl_pssch_pscch_pdu->slsch_payload = slsch_pdu;
nr_sl_pssch_pscch_pdu->slsch_payload_length = slsch_pdu_length;
};
void config_pscch_pdu_rx(sl_nr_rx_config_pscch_pdu_t *nr_sl_pscch_pdu,
......@@ -547,12 +554,12 @@ int nr_ue_process_sci1_indication_pdu(NR_UE_MAC_INST_t *mac,frame_t frame, int s
nr_sci_pdu_t sci_pdu; //&mac->def_sci_pdu[slot][sci->sci_format_type];
sl_nr_rx_config_pssch_sci_pdu_t nr_sl_pssch_sci_pdu;
const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp = mac->sl_bwp;
const NR_SL_ResourcePool_r16_t *sl_res_pool = mac->sl_res_pool;
const NR_SL_ResourcePool_r16_t *sl_res_pool = mac->sl_rx_res_pool;
LOG_D(MAC,"Received sci indication (sci format %d, Nid %x, subChannelIndex %d, payloadSize %d,payload %llx)\n",
sci->sci_format_type,sci->Nid,sci->subch_index,sci->sci_payloadlen,*(unsigned long long*)sci->sci_payloadBits);
AssertFatal(sci->sci_format_type == NR_SL_SCI_FORMAT_1A, "need to have format 1A here only\n");
nr_extract_pscch_pdu((uint64_t *)sci->sci_payloadBits, sl_bwp, sl_res_pool, &sci_pdu);
AssertFatal(sci->sci_format_type == SL_SCI_FORMAT_1A_ON_PSCCH, "need to have format 1A here only\n");
extract_pscch_pdu((uint64_t *)sci->sci_payloadBits, sl_bwp, sl_res_pool, &sci_pdu);
config_pssch_sci_pdu_rx(&nr_sl_pssch_sci_pdu,
NR_SL_SCI_FORMAT_2A,
&sci_pdu,
......@@ -569,6 +576,7 @@ const int sl_dmrs_mask2[2][8] = { {34,34,34,264,264,1032,1032,1032},
{34,34,34,272,272,1040,1040,1040}};
const int sl_dmrs_mask3[5] = {146,146,546,546,2114};
const int sl_dmrs_mask4[3] = {1170,1170,1170};
void config_pssch_sci_pdu_rx(sl_nr_rx_config_pssch_sci_pdu_t *nr_sl_pssch_sci_pdu,
nr_sci_format_t sci2_format,
nr_sci_pdu_t *sci_pdu,
......@@ -646,5 +654,6 @@ void config_pssch_sci_pdu_rx(sl_nr_rx_config_pssch_sci_pdu_t *nr_sl_pssch_sci_pd
// is triggred as part of TX pool sensing procedure.
nr_sl_pssch_sci_pdu->sense_pssch = 0;
}
......@@ -101,15 +101,6 @@
extern const uint8_t nr_rv_round_map[4];
/*! \brief NR_list_t is a "list" (of users, HARQ processes, slices, ...).
* Especially useful in the scheduler and to keep "classes" of users. */
typedef struct {
int head;
int *next;
int tail;
int len;
} NR_list_t;
typedef enum {
RA_IDLE = 0,
Msg2 = 1,
......@@ -449,13 +440,6 @@ typedef struct NR_UE_harq {
//! fixme : need to enhace for the multiple TB CQI report
typedef struct NR_bler_stats {
frame_t last_frame;
float bler;
uint8_t mcs;
uint64_t rounds[8];
} NR_bler_stats_t;
//
/*! As per spec 38.214 section 5.2.1.4.2
* - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE shall report in
......
......@@ -168,7 +168,10 @@ static void prepare_NR_SL_ResourcePool(NR_SL_ResourcePool_r16_t *sl_res_pool,
sl_res_pool->sl_TimeWindowSizeCBR_r16 = NULL;
sl_res_pool->sl_TimeWindowSizeCR_r16 = NULL;
sl_res_pool->sl_PTRS_Config_r16 = NULL;
sl_res_pool->sl_UE_SelectedConfigRP_r16 = NULL;
sl_res_pool->sl_UE_SelectedConfigRP_r16 = calloc(1,sizeof(*sl_res_pool->sl_UE_SelectedConfigRP_r16));
sl_res_pool->sl_UE_SelectedConfigRP_r16->sl_MaxNumPerReserve_r16 = calloc(1,sizeof(*sl_res_pool->sl_UE_SelectedConfigRP_r16->sl_MaxNumPerReserve_r16));
*sl_res_pool->sl_UE_SelectedConfigRP_r16->sl_MaxNumPerReserve_r16 = NR_SL_UE_SelectedConfigRP_r16__sl_MaxNumPerReserve_r16_n2;
sl_res_pool->sl_RxParametersNcell_r16 = NULL;
sl_res_pool->sl_ZoneConfigMCR_List_r16 = NULL;
sl_res_pool->sl_FilterCoefficient_r16 = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment