Commit 09efb985 authored by Matthieu Kanj's avatar Matthieu Kanj

seperation for file: openair1/PHY/LTE_TRANSPORT/dlsch_coding_NB_IoT.c

+ creation of new file openair1/PHY/LTE_TRANSPORT/extern_NB_IoT.h
parent 34edb293
......@@ -993,6 +993,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c
......
......@@ -184,4 +184,9 @@ This function takes the w-sequence and generates the d-sequence. The nu-sequenc
// uint8_t r,
// uint32_t *E_out);
void ccode_encode_npdsch_NB_IoT (int32_t numbits,
uint8_t *inPtr,
uint8_t *outPtr,
uint32_t crc);
#endif /* OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_ */
......@@ -31,6 +31,7 @@
*/
//#include "PHY/defs.h"
#include "PHY/extern_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/extern_NB_IoT.h"
#include "SCHED/defs_nb_iot.h"
#ifdef DEBUG_DCI_TOOLS
#include "PHY/vars_NB_IoT.h"
......
......@@ -15,11 +15,11 @@
#define __LTE_TRANSPORT_DEFS_NB_IOT__H__
////#include "PHY/defs.h"
//#include "PHY/defs_nb_iot.h"
#include "dci_nb_iot.h"
#include "PHY/LTE_TRANSPORT/dci_nb_iot.h"
#include "PHY/impl_defs_lte_nb_iot.h"
#include "openair2/COMMON/platform_types_NB_IoT.h"
//#include "dci.h"
#include "uci_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/uci_NB_IoT.h"
//#include "dci.h"
//#include "uci.h"
//#ifndef STANDALONE_COMPILE
......@@ -76,56 +76,7 @@
//
//// to be created LTE_eNB_DLSCH_t --> is duplicated for each number of UE and then indexed in the table
//
// typedef struct { // LTE_eNB_DLSCH_t
// /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
// uint32_t *txdataF[8];
// /// Allocated RNTI (0 means DLSCH_t is not currently used)
// uint16_t rnti;
// /// Active flag for baseband transmitter processing
// uint8_t active;
// /// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
// uint8_t subframe_tx[10];
// /// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
// uint8_t nCCE[10];
// /// Current HARQ process id
// uint8_t current_harq_pid;
// /// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
// uint8_t harq_ids[10];
// /// Window size (in outgoing transport blocks) for fine-grain rate adaptation
// uint8_t ra_window_size;
// /// First-round error threshold for fine-grain rate adaptation
// uint8_t error_threshold;
// /// Pointers to 8 HARQ processes for the DLSCH
// NB_IoT_DL_eNB_HARQ_t harq_processe;
// /// circular list of free harq PIDs (the oldest come first)
// /// (10 is arbitrary value, must be > to max number of DL HARQ processes in LTE)
// int harq_pid_freelist[10];
// /// the head position of the free list (if list is free then head=tail)
// int head_freelist;
// /// the tail position of the free list
// int tail_freelist;
// /// Number of soft channel bits
// uint32_t G;
// /// Codebook index for this dlsch (0,1,2,3)
// uint8_t codebook_index;
// /// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
// uint8_t Mdlharq;
// /// Maximum number of HARQ rounds
// uint8_t Mlimit;
// /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
// uint8_t Kmimo;
// /// Nsoft parameter related to UE Category
// uint32_t Nsoft;
// /// amplitude of PDSCH (compared to RS) in symbols without pilots
// int16_t sqrt_rho_a;
// /// amplitude of PDSCH (compared to RS) in symbols containing pilots
// int16_t sqrt_rho_b;
// } NB_IoT_eNB_DLSCH_t;
//
//
//
//typedef struct { // LTE_DL_eNB_HARQ_t
//typedef struct { // LTE_DL_eNB_HARQ_t
// /// Status Flag indicating for this DLSCH (idle,active,disabled)
// SCH_status_t status;
// /// Transport block size
......@@ -133,7 +84,7 @@
// /// The payload + CRC size in bits, "B" from 36-212
// uint32_t B; // keep this parameter
// /// Pointer to the payload
// uint8_t *b; // keep this parameter
// uint8_t *b; // keep this parameter
// /// Pointers to transport block segments
// //uint8_t *c[MAX_NUM_DLSCH_SEGMENTS];
// /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
......@@ -171,11 +122,11 @@
// /// data after scrambling
// uint8_t s_e[MAX_NUM_CHANNEL_BITS_NB_IOT];
// /// length of the table e
// uint16_t length_e // new parameter
// uint16_t length_e // new parameter
// /// Tail-biting convolutional coding outputs
// uint8_t d[96+(3*(24+MAX_DL_SIZE_BITS_NB_IOT))]; // new parameter
// /// Sub-block interleaver outputs
// uint8_t w[3*3*(MAX_DL_SIZE_BITS_NB_IOT+24)]; // new parameter
// uint8_t w[3*3*(MAX_DL_SIZE_BITS_NB_IOT+24)]; // new parameter
// /// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17, TM3-4)
// uint8_t Nl;
// /// Number of layers for this PDSCH transmission (TM8-10)
......@@ -184,7 +135,6 @@
// uint8_t first_layer;
//} NB_IoT_DL_eNB_HARQ_t;
typedef enum {
SCH_IDLE_NB_IoT,
ACTIVE_NB_IoT,
......@@ -193,6 +143,106 @@ typedef enum {
} SCH_status_NB_IoT_t;
typedef struct {
/// NB-IoT
SCH_status_NB_IoT_t status;
/// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
uint8_t scheduling_delay;
/// The number of the subframe to transmit the NPDSCH Table TS 36.213 Table 16.4.1.3-1 (Nsf) (NB. in this case is not the index Isf)
uint8_t resource_assignment;
/// is the index that determined the repeat number of NPDSCH through table TS 36.213 Table 16.4.1.3-2 / for SIB1-NB Table 16.4.1.3-3
uint8_t repetition_number;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
/// Determined the repetition number value 0-3 (2 biut carried by the FAPI NPDCCH)
uint8_t dci_subframe_repetitions;
/// modulation always QPSK Qm = 2
uint8_t modulation;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t e[MAX_NUM_CHANNEL_BITS_NB_IoT];
/// data after scrambling
uint8_t s_e[MAX_NUM_CHANNEL_BITS_NB_IoT];
//length of the table e
uint16_t length_e; // new parameter
/// Tail-biting convolutional coding outputs
uint8_t d[96+(3*(24+MAX_DL_SIZE_BITS_NB_IoT))]; // new parameter
/// Sub-block interleaver outputs
uint8_t w[3*3*(MAX_DL_SIZE_BITS_NB_IoT+24)]; // new parameter
/// Status Flag indicating for this DLSCH (idle,active,disabled)
//SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits, "B" from 36-212
uint32_t B;
/// Pointer to the payload
uint8_t *b;
///pdu of the ndlsch message
uint8_t*pdu;
/// Frame where current HARQ round was sent
uint32_t frame;
/// Subframe where current HARQ round was sent
uint32_t subframe;
/// Index of current HARQ round for this DLSCH
uint8_t round;
/// MCS format for this NDLSCH , TS 36.213 Table 16.4.1.5
uint8_t mcs;
// we don't have code block segmentation / crc attachment / concatenation in NB-IoT R13 36.212 6.4.2
// we don't have beamforming in NB-IoT
//this index will be used mainly for SI message buffer
uint8_t pdu_buffer_index;
} NB_IoT_DL_eNB_HARQ_t;
typedef struct { // LTE_eNB_DLSCH_t
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
uint32_t *txdataF[8];
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti;
/// Active flag for baseband transmitter processing
uint8_t active;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/// Current HARQ process id
uint8_t current_harq_pid;
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
uint8_t harq_ids[10];
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation
uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// Pointers to 8 HARQ processes for the DLSCH
NB_IoT_DL_eNB_HARQ_t harq_process;
/// circular list of free harq PIDs (the oldest come first)
/// (10 is arbitrary value, must be > to max number of DL HARQ processes in LTE)
int harq_pid_freelist[10];
/// the head position of the free list (if list is free then head=tail)
int head_freelist;
/// the tail position of the free list
int tail_freelist;
/// Number of soft channel bits
uint32_t G;
/// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index;
/// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Mdlharq;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
} NB_IoT_eNB_DLSCH_t;
typedef struct {
/// HARQ process id
uint8_t harq_id;
......@@ -379,9 +429,9 @@ typedef struct {
/// saved subband PMI allocation from last PUSCH/PUCCH report
uint16_t pmi_alloc;
/// HARQ-ACKs
harq_status_NB_IoT_t harq_ack[10];
harq_status_NB_IoT_t harq_ack;
/// Pointers to up to 8 HARQ processes
NB_IoT_DL_UE_HARQ_t *harq_processes[8];
NB_IoT_DL_UE_HARQ_t *harq_process;
/// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17
uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
......@@ -476,46 +526,7 @@ typedef struct {
} DCI_PDU_NB_IoT;
typedef struct {
/// NB-IoT
SCH_status_NB_IoT_t status;
/// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
uint8_t scheduling_delay;
/// The number of the subframe to transmit the NPDSCH Table TS 36.213 Table 16.4.1.3-1 (Nsf) (NB. in this case is not the index Isf)
uint8_t resource_assignment;
/// is the index that determined the repeat number of NPDSCH through table TS 36.213 Table 16.4.1.3-2 / for SIB1-NB Table 16.4.1.3-3
uint8_t repetition_number;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
/// Determined the repetition number value 0-3 (2 biut carried by the FAPI NPDCCH)
uint8_t dci_subframe_repetitions;
/// modulation always QPSK Qm = 2
uint8_t modulation;
/// Status Flag indicating for this DLSCH (idle,active,disabled)
//SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits, "B" from 36-212
uint32_t B;
/// Pointer to the payload
uint8_t *b;
///pdu of the ndlsch message
uint8_t*pdu;
/// Frame where current HARQ round was sent
uint32_t frame;
/// Subframe where current HARQ round was sent
uint32_t subframe;
/// Index of current HARQ round for this DLSCH
uint8_t round;
/// MCS format for this NDLSCH , TS 36.213 Table 16.4.1.5
uint8_t mcs;
// we don't have code block segmentation / crc attachment / concatenation in NB-IoT R13 36.212 6.4.2
// we don't have beamforming in NB-IoT
//this index will be used mainly for SI message buffer
uint8_t pdu_buffer_index;
} NB_IoT_DL_eNB_HARQ_t;
typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
......@@ -781,7 +792,7 @@ typedef struct {
uint8_t npbch_w[3*3*(16+NPBCH_A)];
uint8_t npbch_e[1600];
///pdu of the npbch message
uint8_t*pdu;
uint8_t *pdu;
} NB_IoT_eNB_NPBCH_t;
......
......@@ -14,17 +14,19 @@
//#include "PHY/defs.h"
#include "PHY/defs_nb_iot.h"
#include "PHY/extern.h"
#include "PHY/extern_NB_IoT.h"
#include "PHY/CODING/defs_nb_iot.h"
//#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/LTE_TRANSPORT/defs.h"
#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/LTE_TRANSPORT/defs_nb_iot.h"
#include "PHY/LTE_TRANSPORT/proto_nb_iot.h"
#include "SCHED/defs_nb_iot.h"
#include "defs_nb_iot.h"
//#include "defs_nb_iot.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h" // newly added for NB_IoT
//#include "PHY/LTE_TRANSPORT/defs_nb_iot.h" // newly added for NB_IoT
unsigned char ccodelte_table2_NB_IoT[128];
void ccode_encode_npdsch_NB_IoT (int32_t numbits,
uint8_t *inPtr,
......@@ -54,7 +56,7 @@ void ccode_encode_npdsch_NB_IoT (int32_t numbits,
if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
out = ccodelte_table_NB_IoT[state];
out = ccodelte_table2_NB_IoT[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
......@@ -76,33 +78,33 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
//unsigned char harq_pid = dlsch->current_harq_pid; // to check during implementation if harq_pid is required in the NB_IoT_eNB_DLSCH_t structure in defs_NB_IoT.h
unsigned int A;
uint8_t RCC;
A = dlsch->harq_processe->TBS; // 680
dlsch->harq_processe->length_e = G*Nsf // G*Nsf (number_of_subframes) = total number of bits to transmit
A = dlsch->harq_process.TBS; // 680
dlsch->harq_process.length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit
int32_t numbits = A+24;
if (dlsch->harq_processe->round == 0) { // This is a new packet
if (dlsch->harq_process.round == 0) { // This is a new packet
crc = crc24a(a,A)>>8; // CRC calculation (24 bits CRC)
crc = crc24a_NB_IoT(a,A)>>8; // CRC calculation (24 bits CRC)
// CRC attachment to payload
a[A>>3] = ((uint8_t*)&crc)[2];
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
dlsch->harq_processe->B = numbits; // The length of table b in bits
dlsch->harq_process.B = numbits; // The length of table b in bits
memcpy(dlsch->harq_processe->b,a,numbits/8);
memset(dlsch->harq_processe->d,LTE_NULL,96);
memcpy(dlsch->harq_process.b,a,numbits/8);
memset(dlsch->harq_process.d,LTE_NULL_NB_IoT,96);
start_meas(te_stats);
ccode_encode_npdsch_NB_IoT(numbits, dlsch->harq_processe->b, dlsch->harq_processe->d+96, crc); // step 1 Tail-biting convolutional coding
ccode_encode_npdsch_NB_IoT(numbits, dlsch->harq_process.b, dlsch->harq_process.d+96, crc); // step 1 Tail-biting convolutional coding
stop_meas(te_stats);
start_meas(i_stats);
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->harq_processe->d+96,dlsch->harq_processe->w); // step 2 interleaving
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->harq_process.d+96,dlsch->harq_process.w); // step 2 interleaving
stop_meas(i_stats);
start_meas(rm_stats);
lte_rate_matching_cc_NB_IoT(RCC,dlsch->harq_processe->length_e,dlsch->harq_processe->w,dlsch->harq_processe->e); // step 3 Rate Matching
lte_rate_matching_cc_NB_IoT(RCC,dlsch->harq_process.length_e,dlsch->harq_process.w,dlsch->harq_process.e); // step 3 Rate Matching
stop_meas(rm_stats);
}
return(0);
......
/*
* 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.0 (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
*/
//NB-Iot
extern unsigned int TBStable_NB_IoT[14][8];
......@@ -159,4 +159,38 @@ NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(//unsigned char Kmimo,
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag);
/** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
uint8_t *input_buffer,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe)
\brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are:
- CRC computation and addition
- Code block segmentation and sub-block CRC addition
- Channel coding (Turbo coding)
- Rate matching (sub-block interleaving, bit collection, selection and transmission
- Code block concatenation
@param eNB Pointer to eNB PHY context
@param input_buffer Pointer to input buffer for sub-frame
@param frame_parms Pointer to frame descriptor structure
@param num_pdcch_symbols Number of PDCCH symbols in this subframe
@param dlsch Pointer to dlsch to be encoded
@param frame Frame number
@param subframe Subframe number
@param rm_stats Time statistics for rate-matching
@param te_stats Time statistics for turbo-encoding
@param i_stats Time statistics for interleaving
@returns status
*/
int32_t dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_eNB_DLSCH_t *dlsch,
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G, // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats);
#endif
......@@ -24,8 +24,8 @@
//#include "PHY/defs.h"
#include "PHY/defs_nb_iot.h"
#include "PHY_INTERFACE/defs.h"
#include "PHY_INTERFACE/IF_Module_nb_iot.h"
//#include "PHY_INTERFACE/defs.h"
//#include "PHY_INTERFACE/IF_Module_nb_iot.h"
/*
extern char* namepointer_chMag ;
extern char* namepointer_log2;
......@@ -34,11 +34,11 @@ extern char fmageren_name2[512];
extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
*/
#include "PHY/LTE_TRANSPORT/extern.h"
#include "SIMULATION/ETH_TRANSPORT/extern.h"
//#include "PHY/LTE_TRANSPORT/extern.h"
//#include "SIMULATION/ETH_TRANSPORT/extern.h"
extern unsigned int DAQ_MBOX;
extern int number_of_cards;
extern unsigned int DAQ_MBOX_NB_IoT;
extern int number_of_cards_NB_IoT;
//extern PHY_CONFIG *PHY_config;
//extern PHY_VARS *PHY_vars;
......
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