Commit 5da7305f authored by oai's avatar oai

header include & re-construct for NB-IoT

parent edb74831
......@@ -325,8 +325,8 @@ add_custom_target (
set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
add_library(RRC_LIB ${rrc_source}
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c)
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c)
#${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
add_dependencies(RRC_LIB rrc_flag)
include_directories ("${RRC_FULL_DIR}")
......@@ -770,6 +770,7 @@ include_directories("${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0")
include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES")
include_directories("${OPENAIR2_DIR}/RRC/LTE")
include_directories("${OPENAIR2_DIR}/RRC/NBIOT")
include_directories("${OPENAIR_DIR}/common/utils")
include_directories("${OPENAIR_DIR}/common/utils/ocp_itti")
include_directories("${OPENAIR3_DIR}/NAS/COMMON")
......
......@@ -52,7 +52,7 @@
#include "PHY/defs_L1_NB_IoT.h"
#include "RRC/LTE/defs_NB_IoT.h"
#include "RRC/NBIOT/defs_NB_IoT.h"
......
/*
* 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/LTE_TRANSPORT/dci.h
* \brief typedefs for LTE DCI structures from 36-212, V8.6 2009-03. Limited to 5 MHz formats for the moment.Current LTE compliance V8.6 2009-03.
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __DCI_NB_IOT_H__
#define __DCI_NB_IOT_H__
//#ifndef USER_MODE
//#include "PHY/types.h"
//#else
#include <stdint.h>
//#endif
typedef enum
{
DCIFormatN0 = 0,
DCIFormatN1,
DCIFormatN1_RA,//is for initial RA procedure (semi-static information) so maybe is not needed
DCIFormatN1_RAR,
DCIFormatN2,
DCIFormatN2_Ind,
DCIFormatN2_Pag,
}DCI_format_NB_IoT_t;
/// DCI Format Type 0 (180 kHz, 23 bits)
struct DCIFormatN0{
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type;
/// Subcarrier indication, 6 bits
uint8_t scind;
/// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign;
/// Modulation and Coding Scheme, 4 bits
uint8_t mcs;
/// New Data Indicator, 1 bits
uint8_t ndi;
/// Scheduling Delay, 2 bits
uint8_t Scheddly;
/// Repetition Number, 3 bits
uint8_t RepNum;
/// Redundancy version for HARQ (only use 0 and 2), 1 bits
uint8_t rv;
/// DCI subframe repetition Number, 2 bits
uint8_t DCIRep;
};
typedef struct DCIFormatN0 DCIFormatN0_t;
/// DCI Format Type N1 for User data
struct DCIFormatN1{
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1,1bits
uint8_t type;
//NPDCCH order indicator (set to 0), 1 bits
uint8_t orderIndicator;
// Scheduling Delay,3 bits
uint8_t Scheddly;
// Resourse Assignment (RU Assignment),3 bits
uint8_t ResAssign;
// Modulation and Coding Scheme,4 bits
uint8_t mcs;
// Repetition Number,4 bits
uint8_t RepNum;
// New Data Indicator,1 bits
uint8_t ndi;
// HARQ-ACK resource,4 bits
uint8_t HARQackRes;
// DCI subframe repetition Number,2 bits
uint8_t DCIRep;
};
typedef struct DCIFormatN1 DCIFormatN1_t;
/// DCI Format Type N1 for initial RA
struct DCIFormatN1_RA{
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type;
//NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator;
// Start number of NPRACH repetiiton, 2 bits
uint8_t Scheddly;
// Subcarrier indication of NPRACH, 6 bits
uint8_t scind;
// All the remainging bits, 13 bits
uint8_t remaingingBits;
};
typedef struct DCIFormatN1_RA DCIFormatN1_RA_t;
/// DCI Format Type N1 for User data
struct DCIFormatN1_RAR{
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1,1bits
uint8_t type;
//NPDCCH order indicator (set to 0), 1 bits
uint8_t orderIndicator;
// Scheduling Delay,3 bits
uint8_t Scheddly;
// Resourse Assignment (RU Assignment),3 bits
uint8_t ResAssign;
// Modulation and Coding Scheme,4 bits
uint8_t mcs;
// Repetition Number,4 bits
uint8_t RepNum;
// New Data Indicator,1 bits,reserved in the RAR
uint8_t ndi;
// HARQ-ACK resource,4 bits,reserved in the RAR
uint8_t HARQackRes;
// DCI subframe repetition Number,2 bits
uint8_t DCIRep;
};
typedef struct DCIFormatN1_RAR DCIFormatN1_RAR_t;
// DCI Format Type N2 for direct indication, 15 bits
struct DCIFormatN2_Ind{
//Flag for paging(1)/direct indication(0), set to 0,1 bits
uint8_t type;
//Direct indication information, 8 bits
uint8_t directIndInf;
// Reserved information bits, 6 bits
uint8_t resInfoBits;
};
typedef struct DCIFormatN2_Ind DCIFormatN2_Ind_t;
// DCI Format Type N2 for Paging, 15 bits
struct DCIFormatN2_Pag{
//Flag for paging(1)/direct indication(0), set to 1,1 bits
uint8_t type;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign;
// Modulation and Coding Scheme, 4 bits
uint8_t mcs;
// Repetition Number, 4 bits
uint8_t RepNum;
// Reserved 3 bits
uint8_t DCIRep;
};
typedef struct DCIFormatN2_Pag DCIFormatN2_Pag_t;
typedef union DCI_CONTENT {
//
DCIFormatN0_t DCIN0;
//
DCIFormatN1_t DCIN1;
//
DCIFormatN1_RA_t DCIN1_RA;
//
DCIFormatN1_RAR_t DCIN1_RAR;
//
DCIFormatN2_Ind_t DCIN2_Ind;
//
DCIFormatN2_Pag_t DCIN2_Pag;
}DCI_CONTENT;
/*Structure for packing*/
struct DCIN0{
/// DCI subframe repetition Number, 2 bits
uint8_t DCIRep:2;
/// New Data Indicator, 1 bits
uint8_t ndi:1;
/// Repetition Number, 3 bits
uint8_t RepNum:3;
/// Redundancy version for HARQ (only use 0 and 2), 1 bits
uint8_t rv:1;
/// Modulation and Coding Scheme, 4 bits
uint8_t mcs:4;
/// Scheduling Delay, 2 bits
uint8_t Scheddly:2;
/// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign:3;
/// Subcarrier indication, 6 bits
uint8_t scind:6;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type:1;
} __attribute__ ((__packed__));
typedef struct DCIN0 DCIN0_t;
#define sizeof_DCIN0_t 23
struct DCIN1_RAR{
// DCI subframe repetition Number, 2 bits
uint8_t DCIRep:2;
// HARQ-ACK resource,4 bits
uint8_t HARQackRes:4;
// New Data Indicator,1 bits
uint8_t ndi:1;
// Repetition Number, 4 bits
uint8_t RepNum:4;
// Modulation and Coding Scheme, 4 bits
uint8_t mcs:4;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign:3;
// Scheduling Delay, 3 bits
uint8_t Scheddly:3;
//NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator:1;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type:1;
} __attribute__ ((__packed__));
typedef struct DCIN1_RAR DCIN1_RAR_t;
#define sizeof_DCIN1_RAR_t 23
struct DCIN1{
// DCI subframe repetition Number, 2 bits
uint8_t DCIRep:2;
// HARQ-ACK resource,4 bits
uint8_t HARQackRes:4;
// New Data Indicator,1 bits
uint8_t ndi:1;
// Repetition Number, 4 bits
uint8_t RepNum:4;
// Modulation and Coding Scheme, 4 bits
uint8_t mcs:4;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign:3;
// Scheduling Delay, 3 bits
uint8_t Scheddly:3;
//NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator:1;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type:1;
} __attribute__ ((__packed__));
typedef struct DCIN1 DCIN1_t;
#define sizeof_DCIN1_t 23
// DCI Format Type N2 for direct indication, 15 bits
struct DCIN2_Ind{
// Reserved information bits, 6 bits
uint8_t resInfoBits:6;
//Direct indication information, 8 bits
uint8_t directIndInf:8;
//Flag for paging(1)/direct indication(0), set to 0,1 bits
uint8_t type:1;
} __attribute__ ((__packed__));;
typedef struct DCIN2_Ind DCIN2_Ind_t;
#define sizeof_DCIN2_Ind_t 15
// DCI Format Type N2 for Paging, 15 bits
struct DCIN2_Pag{
// Reserved 3 bits
uint8_t DCIRep:3;
// Repetition Number, 4 bits
uint8_t RepNum:4;
// Modulation and Coding Scheme, 4 bits
uint8_t mcs:4;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign:3;
//Flag for paging(1)/direct indication(0), set to 1,1 bits
uint8_t type:1;
} __attribute__ ((__packed__));;
typedef struct DCIN2_Pag DCIN2_Pag_t;
#define sizeof_DCIN2_Pag_t 15
#define MAX_DCI_SIZE_BITS_NB_IoT 23
#endif
This diff is collapsed.
/*
* 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
*/
#ifndef __DLSCH_TBS_FULL_NB_IOT_H__
#define __DLSCH_TBS_FULL_NB_IOT_H__
/** \brief "Transport block size table"
* (Table 7.1.7.2.1-1 in 3GPP TS 36.213 V8.6.0)
*/
// NB-IoT------------------
// TBS table for the case not containing SIB1-NB, Table 16.4.1.5.1-1 in TS 36.213 v14.2
unsigned int TBStable_NB_IoT[14][8] ={ //[ITBS][ISF]
{16,32,56,88,120.152,208,256},
{24,56,88,144,176,208,256,344},
{32,72,144,176,208,256,328,424},
{40,104,176,208,256,328,440,568},
{56,120,208,256,328,408,552,680},
{72,144,244,328,424,504,680,872},
{88,176,256,392,504,600,808,1032},
{104,224,328,472,584,680,968,1224},
{120,256,392,536,680,808,1096,1352},
{136,296,456,616,776,936,1256,1544},
{144,328,504,680,872,1032,1384,1736},
{176,376,584,776,1000,1192,1608,2024},
{208,440,680,904,1128,1352,1800,2280},
{224,488,744,1128,1256,1544,2024,2536}
};
//TBS table for the case containing S1B1-NB, Table 16.4.1.5.2-1 in TS 36.213 v14.2 (Itbs = 12 ~ 15 is reserved field
//mapping ITBS to SIB1-NB
unsigned int TBStable_NB_IoT_SIB1[16] = {208,208,208,328,328,328,440,440,440,680,680,680,0,0,0,0};
#endif
\ No newline at end of file
/*
* 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
*/
#ifndef __PHY_LTE_TRANSPORT_EXTERN_NB_IOT__H__
#define __PHY_LTE_TRANSPORT_EXTERN_NB_IOT__H__
extern unsigned int TBStable_NB_IoT[14][8];
extern unsigned int TBStable_NB_IoT_SIB1[16];
extern unsigned char cs_ri_normal_NB_IoT[4];
extern unsigned char cs_ri_extended_NB_IoT[4];
extern unsigned char cs_ack_normal_NB_IoT[4];
extern unsigned char cs_ack_extended_NB_IoT[4];
extern int8_t wACK_RX_NB_IoT[5][4];
extern int G_tab[18];
extern short conjugate[8],conjugate2[8];
extern short *ul_ref_sigs_rx_NB_IoT[30][4]; // NB-IoT: format 1 pilots
extern short *ul_ref_sigs_f2_rx_NB_IoT[16]; // NB-IoT: format 2 pilots
//extern unsigned short dftsizes[33];
extern int16_t e_phi_re_m6[120];
extern int16_t e_phi_im_m6[120];
extern int16_t e_phi_re_m5[120];
extern int16_t e_phi_im_m5[120];
extern int16_t e_phi_re_m4[120];
extern int16_t e_phi_im_m4[120];
extern int16_t e_phi_re_m3[120];
extern int16_t e_phi_im_m3[120];
extern int16_t e_phi_re_m2[120];
extern int16_t e_phi_im_m2[120];
extern int16_t e_phi_re_m1[120];
extern int16_t e_phi_im_m1[120];
extern int16_t e_phi_re_0[120];
extern int16_t e_phi_im_0[120];
extern int16_t e_phi_re_p1[120];
extern int16_t e_phi_im_p1[120];
extern int16_t e_phi_re_p2[120];
extern int16_t e_phi_im_p2[120];
extern int16_t e_phi_re_p3[120];
extern int16_t e_phi_im_p3[120];
extern int16_t e_phi_re_p4[120];
extern int16_t e_phi_im_p4[120];
extern int16_t e_phi_re_p5[120];
extern int16_t e_phi_im_p5[120];
#endif
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
clear all
% nsss_gen / matlab
% Copyright 2016 b<>com. All rights reserved.
% description: generation of NSSS subframe
% Reference: 3GPP TS36.211 release 13
% author: Vincent Savaux, b<>com, Rennes, France
% email: vincent.savaux@b-com.com
% Input : \
% Output : matrix NSSS_frame
% Parameters
% frame_number = 100;
% cellID = 200;
% % % Mapping results to estimated u-3
SNR_start = -10;
SNR_end = 2;
vec_SNR = SNR_start : 2 : SNR_end;
N_loop = 40;
Proba_fail = zeros(1,length(vec_SNR));
mat_bn = zeros(4,128); % mat_bn contains the 4 possible Hadamard sequences defined in the standard
mat_bn(1,:) = ones(1,128);
mat_bn(2,:) = [1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 ...
-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 ...
1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 ...
-1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 ...
1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 ...
-1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 ...
1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1];
mat_bn(3,:) = [1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 ...
-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 1 ...
-1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 ...
1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 ...
1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 ...
-1 1 1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 ...
-1 1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1];
mat_bn(4,:) = [1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 ...
-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 1 ...
-1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 ...
1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 ...
-1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 ...
1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 ...
1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1];
mat_bn = [mat_bn,mat_bn(:,1:4)]; % see the definition of m in stadard
mat_theta_f = zeros(4,132); % mat_bn contains the 4 possible phase sequences defined in the standard
mat_theta_f(1,:) = ones(1,132);
mat_theta_f(2,:) = repmat([1,-j,-1,j],1,33);
mat_theta_f(3,:) = repmat([1,-1],1,66);
mat_theta_f(4,:) = repmat([1,j,-1,-j],1,33);
mat_16_theta = round(kron(mat_theta_f,ones(4,1))); % mat_bn contains the 4x4=16 possible pseudo-random sequences
mat_16_bn = repmat(mat_bn,4,1);
mat_16 = mat_16_theta.*mat_16_bn;
corresponding_values = zeros(16,2); % first column for q, second for theta_f
corresponding_values(:,1) = repmat([0;1;2;3],4,1); % mapping column to q
corresponding_values(:,2) = kron([0;1;2;3],ones(4,1)); % mapping column to theta_f
for k = 1 : length(vec_SNR) % loop on the SNR
N_fail = 0;
for loop = 1 : N_loop
SNR = vec_SNR(k);
frame_number = 2*randi([0,3],1);
cellID = randi([0,503],1);
% function NSSS_subframe = nsss_gen(frame_number,cellID)
theta_f = 33/132*mod(frame_number/2,4); % as defined in stadard
u = mod(cellID,126) + 3; % root of ZC sequence, defined in standard
q = floor(cellID/126);
size_RB = 12; % number of sub-carrier per RB
N_ZC = 131;
L_sub_frame = 14; % number of OFDM symbols per subframe
j = 1i;
vec_n = 0:N_ZC;
vec_n1 = mod(vec_n,131);
vec_bq = mat_bn(q+1,:);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Creation of the signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ZC sequence in frequency domain
ZC_sequence = exp(-j*pi*u*vec_n1.*(vec_n1+1)/N_ZC);
had_sequence = exp(-j*2*pi*theta_f*vec_n);
vec_bq_had = vec_bq.*had_sequence;
P_noise = 10^(-SNR/10); % SNR in dB to noise power
noise = sqrt(P_noise/2)*randn(1,132)+sqrt(P_noise/2)*j*randn(1,132);
vec_d = vec_bq.*had_sequence.*ZC_sequence + noise;
mat_NSSS = flipud(reshape(vec_d,size_RB,L_sub_frame-3));
NSSS_subframe = [zeros(size_RB,3),mat_NSSS];
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Exhaustive cell ID research
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sequence_r = repmat(vec_d,16,1).*conj(mat_16); % this remove the phase component
vec_u = 3 : 128;
mat_u = repmat(vec_u.',1,length(vec_n1));
mat_n1 = repmat(vec_n1,126,1);
sequence_ZC = exp(-j*pi*mat_u.*mat_n1.*(mat_n1+1)/N_ZC);
matrix_max_correl = zeros(126,16); % this will be filled by the maximum of correlation value
for s_ = 1 : 16
seq_ref = sequence_r(s_,:);
for u_ = 1 : 126
correl = xcorr(seq_ref,sequence_ZC(u_,:));
[val_max,ind_max] = max(abs(correl));
matrix_max_correl(u_,s_) = val_max;
end
end
max_correl = max(max(matrix_max_correl)); % get the max of all correlation values
index_max = find(matrix_max_correl==max_correl);
estim_u_ = mod(index_max,126)-1;
index_column = (index_max-mod(index_max,126))/126+1;
estim_q_ = corresponding_values(index_column);
estim_cell_ID = q*126 + estim_u_;
if cellID ~= estim_cell_ID
N_fail = N_fail + 1;
end
end
Proba_fail(k) = N_fail/N_loop;
end
plot(vec_SNR,Proba_fail)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* 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
*/
#ifndef __UCI_NB_IOT__H__
#define __UCI_NB_IOT__H__
//#include "PHY/types_NB_IoT.h"
typedef enum {
ue_selected_NB_IoT,
wideband_cqi_rank1_2A_NB_IoT, //wideband_cqi_rank1_2A,
wideband_cqi_rank2_2A_NB_IoT, //wideband_cqi_rank2_2A,
HLC_subband_cqi_nopmi_NB_IoT, //HLC_subband_cqi_nopmi,
HLC_subband_cqi_rank1_2A_NB_IoT, //HLC_subband_cqi_rank1_2A,
HLC_subband_cqi_rank2_2A_NB_IoT, //HLC_subband_cqi_rank2_2A,
HLC_subband_cqi_modes123_NB_IoT, //HLC_subband_cqi_modes123
HLC_subband_cqi_mcs_CBA_NB_IoT, // MCS and RNTI, for contention-based acces
unknown_cqi_NB_IoT//
} UCI_format_NB_IoT_t;
// **********************************************1.5 MHz***************************************************************************
typedef struct __attribute__((packed))
{
uint32_t padding:16;
uint32_t pmi:12;
uint32_t cqi1:4;
}
wideband_cqi_rank1_2A_1_5MHz_NB_IoT ;
#define sizeof_wideband_cqi_rank1_2A_1_5MHz_NB_IoT 16
typedef struct __attribute__((packed))
{
uint16_t padding:2;
uint16_t pmi:6;
uint16_t cqi2:4;
uint16_t cqi1:4;
}
wideband_cqi_rank2_2A_1_5MHz_NB_IoT ;
#define sizeof_wideband_cqi_rank2_2A_1_5MHz_NB_IoT 14
typedef struct __attribute__((packed))
{
uint32_t padding:16;
uint32_t diffcqi1:12;
uint32_t cqi1:4;
}
HLC_subband_cqi_nopmi_1_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_nopmi_1_5MHz_NB_IoT 16
typedef struct __attribute__((packed))
{
uint32_t padding:14;
uint32_t pmi:2;
uint32_t diffcqi1:12;
uint32_t cqi1:4;
}
HLC_subband_cqi_rank1_2A_1_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_rank1_2A_1_5MHz_NB_IoT 18
typedef struct __attribute__((packed))
{
uint64_t padding:31;
uint64_t pmi:1;
uint64_t diffcqi2:12;
uint64_t cqi2:4;
uint64_t diffcqi1:12;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_1_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_rank2_2A_1_5MHz_NB_IoT 33
typedef struct __attribute__((packed))
{
uint32_t padding:16;
uint32_t diffcqi1:12;
uint32_t cqi1:4;
}
HLC_subband_cqi_modes123_1_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_modes123_1_5MHz_NB_IoT 16
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t crnti:16;
uint32_t mcs:5;
}
HLC_subband_cqi_mcs_CBA_1_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz_NB_IoT 21
// **********************************************5 MHz***************************************************************************
typedef struct __attribute__((packed))
{
uint32_t padding:14;
uint32_t pmi:14;
uint32_t cqi1:4;
}
wideband_cqi_rank1_2A_5MHz_NB_IoT ;
#define sizeof_wideband_cqi_rank1_2A_5MHz_NB_IoT 18
typedef struct __attribute__((packed))
{
uint16_t padding:1;
uint16_t pmi:7;
uint16_t cqi2:4;
uint16_t cqi1:4;
}
wideband_cqi_rank2_2A_5MHz_NB_IoT ;
#define sizeof_wideband_cqi_rank2_2A_5MHz_NB_IoT 15
typedef struct __attribute__((packed))
{
uint32_t padding:14;
uint32_t diffcqi1:14;
uint32_t cqi1:4;
}
HLC_subband_cqi_nopmi_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_nopmi_5MHz_NB_IoT 18
typedef struct __attribute__((packed))
{
uint32_t padding:12;
uint32_t pmi:2;
uint32_t diffcqi1:14;
uint32_t cqi1:4;
}
HLC_subband_cqi_rank1_2A_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_rank1_2A_5MHz_NB_IoT 20
typedef struct __attribute__((packed))
{
uint64_t padding:27;
uint64_t pmi:1;
uint64_t diffcqi2:14;
uint64_t cqi2:4;
uint64_t diffcqi1:14;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_rank2_2A_5MHz_NB_IoT 37
typedef struct __attribute__((packed))
{
uint32_t padding:14;
uint32_t diffcqi1:14;
uint32_t cqi1:4;
}
HLC_subband_cqi_modes123_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_modes123_5MHz_NB_IoT 18
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t crnti:16;
uint32_t mcs:5;
}
HLC_subband_cqi_mcs_CBA_5MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_mcs_CBA_5MHz_NB_IoT 21
// **********************************************10 MHz***************************************************************************
typedef struct __attribute__((packed))
{
uint32_t padding:10;
uint32_t pmi:18;
uint32_t cqi1:4;
}
wideband_cqi_rank1_2A_10MHz_NB_IoT ;
#define sizeof_wideband_cqi_rank1_2A_10MHz_NB_IoT 22
typedef struct __attribute__((packed))
{
uint32_t padding:15;
uint32_t pmi:9;
uint32_t cqi2:4;
uint32_t cqi1:4;
}
wideband_cqi_rank2_2A_10MHz_NB_IoT ;
#define sizeof_wideband_cqi_rank2_2A_10MHz_NB_IoT 17
typedef struct __attribute__((packed))
{
uint32_t padding:10;
uint32_t diffcqi1:18;
uint32_t cqi1:4;
}
HLC_subband_cqi_nopmi_10MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_nopmi_10MHz_NB_IoT 22
typedef struct __attribute__((packed))
{
uint32_t padding:8;
uint32_t pmi:2;
uint32_t diffcqi1:18;
uint32_t cqi1:4;
}
HLC_subband_cqi_rank1_2A_10MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_rank1_2A_10MHz_NB_IoT 24
typedef struct __attribute__((packed))
{
uint64_t padding:19;
uint64_t pmi:1;
uint64_t diffcqi2:18;
uint64_t cqi2:4;
uint64_t diffcqi1:18;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_10MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_rank2_2A_10MHz_NB_IoT 45
typedef struct __attribute__((packed))
{
uint32_t padding:10;
uint32_t diffcqi1:18;
uint32_t cqi1:4;
}
HLC_subband_cqi_modes123_10MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_modes123_10MHz_NB_IoT 22
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t crnti:16;
uint32_t mcs:5;
}
HLC_subband_cqi_mcs_CBA_10MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_mcs_CBA_10MHz_NB_IoT 21
// **********************************************20 MHz***************************************************************************
typedef struct __attribute__((packed))
{
uint32_t padding:2;
uint32_t pmi:26;
uint32_t cqi1:4;
}
wideband_cqi_rank1_2A_20MHz_NB_IoT ;
#define sizeof_wideband_cqi_rank1_2A_20MHz_NB_IoT 20
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t pmi:13;
uint32_t cqi2:4;
uint32_t cqi1:4;
}
wideband_cqi_rank2_2A_20MHz_NB_IoT ;
#define sizeof_wideband_cqi_rank2_2A_20MHz_NB_IoT 21
typedef struct __attribute__((packed))
{
uint32_t padding:2;
uint32_t diffcqi1:26;
uint32_t cqi1:4;
}
HLC_subband_cqi_nopmi_20MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_nopmi_20MHz_NB_IoT 30
typedef struct __attribute__((packed))
{
// uint32_t padding:12;
uint32_t pmi:2;
uint32_t diffcqi1:26;
uint32_t cqi1:4;
}
HLC_subband_cqi_rank1_2A_20MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_rank1_2A_20MHz_NB_IoT 32
typedef struct __attribute__((packed))
{
uint64_t padding:3;
uint64_t pmi:1;
uint64_t diffcqi2:26;
uint64_t cqi2:4;
uint64_t diffcqi1:26;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_20MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_rank2_2A_20MHz_NB_IoT 61
typedef struct __attribute__((packed))
{
uint32_t padding:2;
uint32_t diffcqi1:26;
uint32_t cqi1:4;
}
HLC_subband_cqi_modes123_20MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_modes123_20MHz_NB_IoT 30
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t crnti:16;
uint32_t mcs:5;
}
HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT;
#define sizeof_HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT 21
#define MAX_CQI_PAYLOAD_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT)*8*20)
#define MAX_CQI_BITS_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT)*8)
#define MAX_CQI_BYTES_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT))
#define MAX_ACK_PAYLOAD_NB_IoT 18
#define MAX_RI_PAYLOAD_NB_IoT 6
#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.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
*/
//#include "dlsch_tbs.h"
//#include "dlsch_tbs_full.h"
//#include "sss.h"
#ifndef __PHY_LTE_TRANSPORT_VARS_NB_IOT__H__
#define __PHY_LTE_TRANSPORT_VARS_NB_IOT__H__
unsigned char cs_ri_normal_NB_IoT[4] = {1,4,7,10};
unsigned char cs_ri_extended_NB_IoT[4] = {0,3,5,8};
unsigned char cs_ack_normal_NB_IoT[4] = {2,3,8,9};
unsigned char cs_ack_extended_NB_IoT[4] = {1,2,6,7};
int G_tab[18] = {200,224,240,208,232,256,220,244,268,216,240,256,224,248,264,236,260,284};
int8_t wACK_RX_NB_IoT[5][4] = {{-1,-1,-1,-1},{-1,1,-1,1},{-1,-1,1,1},{-1,1,1,-1},{1,1,1,1}};
#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.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
*/
#ifndef __TIME_MEAS_DEFS_NB_IoT__H__
#define __TIME_MEAS_DEFS_NB_IoT__H__
#include <unistd.h>
#include <math.h>
#include <stdint.h>
#include <time.h>
#include <errno.h>
#include <stdio.h>
#include <pthread.h>
#include <linux/kernel.h>
#include <linux/types.h>
// global var to enable openair performance profiler
extern int opp_enabled_NB_IoT;
double cpu_freq_GHz;
#if defined(__x86_64__) || defined(__i386__)
typedef struct {
long long in;
long long diff;
long long diff_now;
long long p_time; /*!< \brief absolute process duration */
long long diff_square; /*!< \brief process duration square */
long long max;
int trials;
int meas_flag;
} time_stats_t_NB_IoT;
#elif defined(__arm__)
typedef struct {
uint32_t in;
uint32_t diff_now;
uint32_t diff;
uint32_t p_time; /*!< \brief absolute process duration */
uint32_t diff_square; /*!< \brief process duration square */
uint32_t max;
int trials;
} time_stats_t_NB_IoT;
#endif
static inline void start_meas_NB_IoT(time_stats_t_NB_IoT *ts) __attribute__((always_inline));
static inline void stop_meas_NB_IoT(time_stats_t_NB_IoT *ts) __attribute__((always_inline));
/*
void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name);
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time);
double get_time_meas_us(time_stats_t *ts);
double get_cpu_freq_GHz(void);
*/
#if defined(__i386__)
static inline unsigned long long rdtsc_oai_NB_IoT(void) __attribute__((always_inline));
static inline unsigned long long rdtsc_oai_NB_IoT(void)
{
unsigned long long int x;
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
return x;
}
#elif defined(__x86_64__)
static inline unsigned long long rdtsc_oai_NB_IoT(void) __attribute__((always_inline));
static inline unsigned long long rdtsc_oai_NB_IoT(void)
{
unsigned long long a, d;
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
return (d<<32) | a;
}
#elif defined(__arm__)
static inline uint32_t rdtsc_oai_NB_IoT(void) __attribute__((always_inline));
static inline uint32_t rdtsc_oai_NB_IoT(void)
{
uint32_t r = 0;
asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(r) );
return r;
}
#endif
static inline void start_meas_NB_IoT(time_stats_t_NB_IoT *ts)
{
if (opp_enabled_NB_IoT) {
if (ts->meas_flag==0) {
ts->trials++;
ts->in = rdtsc_oai_NB_IoT();
ts->meas_flag=1;
}
else {
ts->in = rdtsc_oai_NB_IoT();
}
}
}
static inline void stop_meas_NB_IoT(time_stats_t_NB_IoT *ts)
{
if (opp_enabled_NB_IoT) {
long long out = rdtsc_oai_NB_IoT();
ts->diff_now = (out-ts->in);
ts->diff_now = (out-ts->in);
ts->diff += (out-ts->in);
/// process duration is the difference between two clock points
ts->p_time = (out-ts->in);
ts->diff_square += (out-ts->in)*(out-ts->in);
if ((out-ts->in) > ts->max)
ts->max = out-ts->in;
ts->meas_flag=0;
}
}
static inline void reset_meas_NB_IoT(time_stats_t_NB_IoT *ts) {
ts->trials=0;
ts->diff=0;
ts->diff_now=0;
ts->p_time=0;
ts->diff_square=0;
ts->max=0;
ts->meas_flag=0;
}
static inline void copy_meas_NB_IoT(time_stats_t_NB_IoT *dst_ts,time_stats_t_NB_IoT *src_ts)
{
if (opp_enabled_NB_IoT) {
dst_ts->trials=src_ts->trials;
dst_ts->diff=src_ts->diff;
dst_ts->max=src_ts->max;
}
}
#endif
This diff is collapsed.
......@@ -33,7 +33,9 @@
#ifndef __PHY_IMPL_DEFS_NB_IOT__H__
#define __PHY_IMPL_DEFS_NB_IOT__H__
#include "types_NB_IoT.h"
#include "types.h"
//#include "types_NB_IoT.h"
//#include "defs.h"
typedef enum {TDD_NB_IoT=1,FDD_NB_IoT=0} NB_IoT_frame_type_t;
......@@ -278,8 +280,10 @@ typedef struct {
int32_t freq_offset;
/// eNb_id user is synched to
int32_t eNb_id;
} NB_IoT_UE_COMMON;
typedef struct {
/// \brief Received frequency-domain signal after extraction.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
......@@ -400,7 +404,9 @@ typedef struct NPRACH_Parameters_NB_IoT{
} nprach_parameters_NB_IoT_t;
typedef struct{
nprach_parameters_NB_IoT_t list[3];
nprach_parameters_NB_IoT_t list[3];
}NPRACH_List_NB_IoT_t;
typedef long RSRP_Range_t;
......@@ -415,7 +421,7 @@ typedef struct {
/// nprach_CP_Length_r13, for the CP length(unit us) only 66.7 and 266.7 is implemented
uint16_t nprach_CP_Length;
/// The criterion for UEs to select a NPRACH resource. Up to 2 RSRP threshold values can be signalled. \vr{[1..2]}
rsrp_ThresholdsNPrachInfoList *rsrp_ThresholdsPrachInfoList;
struct rsrp_ThresholdsNPrachInfoList *rsrp_ThresholdsPrachInfoList;
/// NPRACH Parameters List
NPRACH_List_NB_IoT_t nprach_ParametersList;
......@@ -469,9 +475,11 @@ typedef struct {
/// Ref signals configuration
UL_REFERENCE_SIGNALS_NPUSCH_t ul_ReferenceSignalsNPUSCH;
} NPUSCH_CONFIG_COMMON;
typedef struct{
/// See TS 36.213 [23, 16.2.1.1], unit dBm.
uint8_t p0_NominalNPUSCH;
......@@ -489,18 +497,32 @@ typedef struct {
uint16_t dl_GapDurationCoeff;
} DL_GapConfig_NB_IoT;
#define NBIOT_INBAND_LTEPCI 0
#define NBIOT_INBAND_IOTPCI 1
#define NBIOT_INGUARD 2
#define NBIOT_STANDALONE 3
typedef struct {
/// for inband, lte bandwidth
uint8_t LTE_N_RB_DL;
uint8_t LTE_N_RB_UL;
/// Frame type (0 FDD, 1 TDD)
NB_IoT_frame_type_t frame_type;
/// Number of resource blocks (RB) in DL of the LTE (for knowing the bandwidth)
uint8_t N_RB_DL;
/// Number of resource blocks (RB) in UL of the LTE ((for knowing the bandwidth)
uint8_t N_RB_UL;
/// TDD subframe assignment (0-7) (default = 3) (254=RX only, 255=TX only)
uint8_t tdd_config;
/// Cell ID
uint16_t Nid_cell;
/// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP)
NB_IoT_prefix_type_t Ncp;
/// Cyclic Prefix for UL (0=Normal CP, 1=Extended CP)
NB_IoT_prefix_type_t Ncp_UL;
/// shift of pilot position in one RB
uint8_t nushift;
/// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0).
......@@ -528,7 +550,9 @@ typedef struct {
/// flag to indicate SISO transmission
uint8_t mode1_flag;
/// Indicator that 20 MHz channel uses 3/4 sampling frequency
//uint8_t threequarter_fs;
uint8_t threequarter_fs;
/// Size of FFT
uint16_t ofdm_symbol_size;
/// Number of prefix samples in all but first symbol of slot
......@@ -582,6 +606,7 @@ typedef struct {
* 3 =stand alone
*/
uint16_t operating_mode;
/*
* Only for In-band operating mode with same PCI
* its measured in number of OFDM symbols
......@@ -607,20 +632,58 @@ typedef struct {
} NB_IoT_DL_FRAME_PARMS;
typedef struct {
/// \brief Pointers (dynamic) to the received data in the time domain.
/// - first index: rx antenna [0..nb_antennas_rx]
/// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti]
int32_t **rxdata;
/// \brief Pointers (dynamic) to the received data in the frequency domain.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti]
int32_t **rxdataF;
/// \brief Holds the transmit data in time domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index:
int32_t **txdata[3];
/// \brief holds the transmit data in the frequency domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
/// - third index: sample [0..]
int32_t **txdataF;
int32_t **txdataF[3];
/// \brief holds the transmit data after beamforming in the frequency domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index: sample [0..]
int32_t **txdataF_BF[3];
/// \brief Holds the received data in time domain.
/// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: sample [0..]
int32_t **rxdata[3];
/// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
/// - first index: secotr id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: sample [0..samples_per_tti[
int32_t **rxdata_7_5kHz[3];
/// \brief Holds the received data in the frequency domain.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
int32_t **rxdataF[3];
/// \brief Holds output of the sync correlator.
/// - first index: sector id [0..2] (hard coded)
/// - second index: sample [0..samples_per_tti*10[
uint32_t *sync_corr[3];
/// \brief Holds the beamforming weights
/// - first index: eNB id [0..2] (hard coded)
/// - second index: eNB antenna port index (hard coded)
/// - third index: tx antenna [0..nb_antennas_tx[
/// - fourth index: sample [0..]
int32_t **beam_weights[3][15];
/// \brief Holds the tdd reciprocity calibration coefficients
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index: frequency [0..]
int32_t **tdd_calib_coeffs[3];
} NB_IoT_eNB_COMMON;
typedef struct {
......@@ -645,6 +708,7 @@ typedef struct {
uint32_t *sync_corr[3];
} NB_IoT_RU_COMMON;
typedef struct {
/// \brief Hold the channel estimates in frequency domain based on SRS.
/// - first index: sector id [0..2] (hard coded)
......
......@@ -3,7 +3,9 @@
* 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
*
......
#ifndef __IF_MODULE_L1_PRIMITIVES_NB_IOT_H__
#define __IF_MODULE_L1_PRIMITIVES_NB_IOT_H__
#include "openair1/PHY/defs_L1_NB_IoT.h"
//#include "LAYER2/MAC/extern.h"
//#include "LAYER2/MAC/proto_NB_IoT.h"
//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
nfapi_dl_config_request_pdu_t *dl_config_pdu,
uint8_t *sdu);
#endif
#ifndef __openair_SCHED_NB_IOT_H__
#define __openair_SCHED_NB_IOT_H__
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/defs_L1_NB_IoT.h"
//#include "openair2/PHY_INTERFACE/IF_Module_nb_iot.h"
#include "nfapi_interface.h"
enum openair_HARQ_TYPE_NB_IoT {
openair_harq_DL_NB_IoT = 0,
openair_harq_UL_NB_IoT,
openair_harq_RA_NB_IoT
};
void process_schedule_rsp_NB_IoT(Sched_Rsp_NB_IoT_t *sched_rsp,
PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_NB_IoT_t *proc);
/* For NB-IoT, we put NPBCH in later part, since it would be scheduled by MAC scheduler,this generates NRS/NPSS/NSSS*/
void common_signal_procedures_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc);
/*Generate the ulsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/
void generate_eNB_ulsch_params_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc,nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu);
/*Generate the dlsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/
void generate_eNB_dlsch_params_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t * proc,nfapi_dl_config_request_pdu_t *dl_config_pdu);
/*Process all the scheduling result from MAC and also common signals.*/
void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc,relaying_type_t r_type,PHY_VARS_RN_NB_IoT *rn,int do_meas,int do_pdcch_flag);
int8_t find_ue_NB_IoT(uint16_t rnti, PHY_VARS_eNB_NB_IoT *eNB);
NB_IoT_DL_FRAME_PARMS *get_NB_IoT_frame_parms(module_id_t Mod_id, uint8_t CC_id);
int16_t get_hundred_times_delta_IF_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor);
uint32_t is_SIB1_NB_IoT(const frame_t frameP,
long schedulingInfoSIB1, //from the mib
int physCellId, //by configuration
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
);
uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,int frame, uint8_t subframe, uint16_t *rnti, uint16_t *preamble_index, uint16_t *timing_advance);
void npusch_procedures(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc);
////////////////// NB-IoT testing ////////////////////
void fill_rx_indication_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc,uint8_t data_or_control, uint8_t decode_flag);
void fill_crc_indication_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,int UE_id,int frame,int subframe,uint8_t decode_flag);
#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.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
*/
/*!\brief SCHED external variables */
#ifndef __SCHED_EXTERN_NB_IOT_H__
#define __SCHED_EXTERN_NB_IOT_H__
#include "defs_NB_IoT.h"
extern uint16_t hundred_times_log10_NPRB_NB_IoT[100];
#endif /*__SCHED_EXTERN_H__ */
This diff is collapsed.
......@@ -2,17 +2,16 @@
/*! \file config_NB_IoT.h
* \brief configured structures used by scheduler
* \author NTUST BMW Lab./
* \date 2017
* \date 2019
* \email:
* \version 1.0
* \version 2.0
*
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
//#include "NB_IoT_Message_definitions.h"
#define NUMBER_OF_SIBS_MAX_NB_IoT 6
///MIB
......@@ -23,6 +22,7 @@ typedef enum operationModeInf{
standalone_r13 = 4
} operationModeInf_t;
///SIB1_SchedulingInfo_NB_IoT_r13
typedef enum si_Periodicity{
si_Periodicity_rf64=640,
......@@ -51,14 +51,14 @@ typedef enum sib_MappingInfo{
} sib_MappingInfo_NB_IoT;
typedef enum si_TB{
si_TB_56=2,
si_TB_120=2,
si_TB_208=8,
si_TB_256=8,
si_TB_328=8,
si_TB_440=8,
si_TB_552=8,
si_TB_680=8
si_TB_56=0,
si_TB_120,
si_TB_208,
si_TB_256,
si_TB_328,
si_TB_440,
si_TB_552,
si_TB_680
} si_TB_NB_IoT;
///RACH_ConfigCommon configuration
......@@ -92,7 +92,7 @@ typedef enum nprach_Periodicity{
nprach_Periodicity_ms80=80,
nprach_Periodicity_ms160=160,
nprach_Periodicity_ms240=240,
nprach_Periodicity_ms320=320,
nprach_Periodicity_ms320=320,
nprach_Periodicity_ms640=640,
nprach_Periodicity_ms1280=1280,
nprach_Periodicity_ms2560=2560
......@@ -202,7 +202,7 @@ typedef enum si_periodicity_e{
rf128=1280,
rf256=2560,
rf512=5120,
rf1024=10240,
rf1024=10240,
rf2048=20480,
rf4096=40960
} si_periodicity_t;
......@@ -210,7 +210,7 @@ typedef enum si_periodicity_e{
typedef enum si_repetition_pattern_e{
every2ndRF=20,
every4thRF=40,
every8thRF=80,
every8thRF=80,
every16thRF=160
} si_repetition_pattern_t;
......@@ -225,13 +225,11 @@ typedef enum si_tb_e{
b680=8
} si_tb_t;
typedef struct sibs_NB_IoT_sched_s{
si_periodicity_t si_periodicity;
si_periodicity_t si_periodicity;
si_repetition_pattern_t si_repetition_pattern;
sib_MappingInfo_NB_IoT sib_mapping_info; //bit vector
si_tb_t si_tb;
} sibs_NB_IoT_sched_t;
......
This diff is collapsed.
/*
* 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
*/
/*! \file extern_NB_IoT.h
* \brief MAC extern
* \author NTUST BMW Lab./Nick HO, Xavier LIU, Calvin HSU
* \date 2017 - 2018
* \email: nick133371@gmail.com, sephiroth7277@gmail.com , kai-hsiang.hsu@eurecom.fr
* \version 1.0
*
*/
#ifndef __MAC_EXTERN_NB_IOT_H__
#define __MAC_EXTERN_NB_IOT_H__
#include "openair2/PHY_INTERFACE/defs_NB_IoT.h"
extern uint8_t Is_rrc_registered;
#ifndef PHY_EMUL
#ifndef PHYSIM
#define NB_INST 1
#else
extern unsigned char NB_INST;
#endif
extern unsigned char NB_eNB_INST;
extern uint16_t NB_UE_INST;
extern unsigned char NB_RN_INST;
extern unsigned short NODE_ID[1];
extern void* bigphys_malloc(int);
#else
extern EMULATION_VARS *Emul_vars;
#endif //PHY_EMUL
//NB-IoT---------------------------------
extern eNB_MAC_INST_NB_IoT *mac_inst;
extern uint8_t Is_rrc_registered_NB_IoT;
extern available_resource_DL_t *available_resource_DL;
extern available_resource_tones_UL_t *available_resource_UL;
extern available_resource_DL_t *available_resource_DL_last;
extern schedule_result_t *schedule_result_list_UL;
extern schedule_result_t *schedule_result_list_DL;
// array will be active when they are used
// 10 -> single-tone / 12 -> multi-tone
extern const uint32_t max_mcs[2];
// [CE level] [0 - 3] -> single-tone / [CE level] [4-7] -> multi-tone
extern const uint32_t mapped_mcs[3][8];
//TBS table for NPUSCH transmission TS 36.213 v14.2 table Table 16.5.1.2-2:
extern const int UL_TBS_Table[14][8];
const int UL_TBS_Table_msg3[8];
extern const int ULrep[8];
extern const int rachperiod[8];
extern const int rachstart[8];
extern const int rachrepeat[8];
extern const int rachscofst[7];
extern const int rachnumsc[4];
extern const int rmax[12];
extern const double gvalue[8];
extern const double pdcchoffset[4];
extern const uint32_t RU_table[8];
extern const uint32_t RU_table_msg3[8];
extern const uint32_t scheduling_delay[4];
extern const uint32_t msg3_scheduling_delay_table[4];
extern const uint32_t ack_nack_delay[4];
extern const uint32_t R_dl_table[16];
// TBS table for the case not containing SIB1-NB_IoT, Table 16.4.1.5.1-1 in TS 36.213 v14.2
extern const uint32_t MAC_TBStable_NB_IoT[14][8];
//TBS table for the case containing S1B1-NB_IoT, Table 16.4.1.5.2-1 in TS 36.213 v14.2 (Itbs = 12 ~ 15 is reserved field
//mapping ITBS to SIB1-NB_IoT
extern const unsigned int MAC_TBStable_NB_IoT_SIB1[16];
extern const int DV_table[16];
extern const int BSR_table[64];
extern const int dl_rep[3];
extern const uint32_t dci_rep[3];
extern const uint32_t harq_rep[3];
//SIBs
extern int extend_space[2];
extern int extend_alpha_offset[2];
extern const int si_repetition_pattern[4];
#endif //DEF_H
This diff is collapsed.
This diff is collapsed.
......@@ -54,6 +54,7 @@ typedef struct{
uint16_t npdcch_Offset_USS; //Alfa_offset (see TS 36.213 ch 16.6)
LTE_ACK_NACK_NumRepetitions_NB_r13_t *ack_nack_numRepetitions_MSG4; //pointer to the first cell of a list of ack_nack_num_repetitions
//ulPowerControlCommon (UE side)
......@@ -137,7 +138,9 @@ typedef struct{
/*preamble part*/
nfapi_nrach_indication_body_t NRACH;
nfapi_nrach_indication_body_t nrach_ind;
/*Uplink data part*/
......@@ -182,13 +185,16 @@ typedef struct{
}Sched_Rsp_NB_IoT_t;
/*IF_Module_t a group for gathering the Interface
It should be allocated at the main () in lte-softmodem.c*/
typedef struct IF_Module_NB_IoT_s{
//define the function pointer
void (*UL_indication)(UL_IND_NB_IoT_t *UL_INFO);
void (*schedule_response)(Sched_Rsp_NB_IoT_t *Sched_INFO);
void (*PHY_config_req)(PHY_Config_NB_IoT_t* config_INFO);
}IF_Module_NB_IoT_t;
/*Initial */
......@@ -201,15 +207,19 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO);
* */
void PHY_config_req_NB_IoT(PHY_Config_NB_IoT_t* config_INFO);
//int IF_Module_init(IF_Module_t *if_inst);
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
//void Schedule_Response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO);
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO);
/*Initial */
IF_Module_NB_IoT_t *IF_Module_init_NB_IoT(int Mod_id);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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