Commit 812f97f0 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'nr_fix_pucch_dmrs' into 'develop-nr'

issue401-nr-pucch-dmrs-format_2

See merge request oai/openairinterface5g!510
parents b4d7c62d 73c4d95c
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -736,7 +736,7 @@ typedef struct { ...@@ -736,7 +736,7 @@ typedef struct {
-- Corresponds to L1 parameter 'HoppingID' (see 38.211, section 6.3.2.2) -- Corresponds to L1 parameter 'HoppingID' (see 38.211, section 6.3.2.2)
hoppingId BIT STRING (SIZE (10)) OPTIONAL, -- Need R hoppingId BIT STRING (SIZE (10)) OPTIONAL, -- Need R
*/ */
uint16_t hoppingId; uint32_t hoppingId;
/* /*
-- Power control parameter P0 for PUCCH transmissions. Value in dBm. Only even values (step size 2) allowed. -- Power control parameter P0 for PUCCH transmissions. Value in dBm. Only even values (step size 2) allowed.
-- Corresponds to L1 parameter 'p0-nominal-pucch' (see 38.213, section 7.2) -- Corresponds to L1 parameter 'p0-nominal-pucch' (see 38.213, section 7.2)
......
File mode changed from 100644 to 100755
...@@ -96,3 +96,8 @@ target_link_libraries(pucch_uci_test ...@@ -96,3 +96,8 @@ target_link_libraries(pucch_uci_test
-Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES} pthread m ${ATLAS_LIBRARIES}
) )
add_executable(pucch_uci_generator_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c ${SRC_UNIT_TESTS} )
target_link_libraries(pucch_uci_generator_test
-Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES}
)
\ No newline at end of file
...@@ -192,11 +192,10 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf) { retu ...@@ -192,11 +192,10 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf) { retu
void * get_shlibmodule_fptr(char *modname, char *fname) { return(NULL) ; } void * get_shlibmodule_fptr(char *modname, char *fname) { return(NULL) ; }
void exit_fun(const char* s) /*void exit_fun (const char *s) {
{
VOID_PARAMETER s; VOID_PARAMETER s;
undefined_function(__FUNCTION__); undefined_function(__FUNCTION__);
} }*/
uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe){ uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe){
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
/*************** LOCAL VARIABLES***********************************/ /*************** LOCAL VARIABLES***********************************/
static nfapi_config_request_t config_t; static nfapi_config_request_t config_t;
static nfapi_config_request_t* config =&config_t; static nfapi_config_request_t *config =&config_t;
/*************** FUNCTIONS ****************************************/ /*************** FUNCTIONS ****************************************/
...@@ -86,8 +86,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_eNB, uint8_t abstract ...@@ -86,8 +86,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_eNB, uint8_t abstract
* *
*********************************************************************/ *********************************************************************/
void phase_shift_samples(int16_t *samples, int length, int16_t phase_shift_re, int16_t phase_shift_im) void phase_shift_samples(int16_t *samples, int length, int16_t phase_shift_re, int16_t phase_shift_im) {
{
int16_t sample_re, sample_im; int16_t sample_re, sample_im;
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
...@@ -112,22 +111,23 @@ void phase_shift_samples(int16_t *samples, int length, int16_t phase_shift_re, i ...@@ -112,22 +111,23 @@ void phase_shift_samples(int16_t *samples, int length, int16_t phase_shift_re, i
* *
*********************************************************************/ *********************************************************************/
void display_data(int pss_sequence_number, int16_t *rxdata, int position) void display_data(int pss_sequence_number, int16_t *rxdata, int position) {
{
#ifdef DEBUG_TEST_PSS #ifdef DEBUG_TEST_PSS
int16_t *pss_sequence[NUMBER_PSS_SEQUENCE] = {primary_synch0_time, primary_synch1_time, primary_synch2_time}; int16_t *pss_sequence[NUMBER_PSS_SEQUENCE] = {primary_synch0_time, primary_synch1_time, primary_synch2_time};
int16_t *pss_sequence_time = pss_sequence[pss_sequence_number]; int16_t *pss_sequence_time = pss_sequence[pss_sequence_number];
printf(" pss %6d data \n", pss_sequence_number); printf(" pss %6d data \n", pss_sequence_number);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (pss_sequence_number < NUMBER_PSS_SEQUENCE) { if (pss_sequence_number < NUMBER_PSS_SEQUENCE) {
printf("[i %6d] : %4d [i %6d] : %8i at address : %p \n", i, pss_sequence_time[2*i], (i + position), rxdata[2*i + (position*2)], &(rxdata[2*i + (position*2)])); printf("[i %6d] : %4d [i %6d] : %8i at address : %p \n", i, pss_sequence_time[2*i], (i + position), rxdata[2*i + (position*2)], &(rxdata[2*i + (position*2)]));
printf("[q %6d] : %4d [q %6d] : %8i at address : %p \n", i, pss_sequence_time[2*i+1], (i + position), rxdata[2*i + 1 + (position*2)], &(rxdata[2*i + 1 + (position*2)])); printf("[q %6d] : %4d [q %6d] : %8i at address : %p \n", i, pss_sequence_time[2*i+1], (i + position), rxdata[2*i + 1 + (position*2)], &(rxdata[2*i + 1 + (position*2)]));
} } else {
else {
printf("[i %6d] : Undef [i %6d] : %8i at address : %p \n", i, (i + position), rxdata[2*i + (position*2)], &(rxdata[2*i + (position*2)])); printf("[i %6d] : Undef [i %6d] : %8i at address : %p \n", i, (i + position), rxdata[2*i + (position*2)], &(rxdata[2*i + (position*2)]));
printf("[q %6d] : Undef [q %6d] : %8i at address : %p \n", i, (i + position), rxdata[2*i + 1 + (position*2)], &(rxdata[2*i + 1 + (position*2)])); printf("[q %6d] : Undef [q %6d] : %8i at address : %p \n", i, (i + position), rxdata[2*i + 1 + (position*2)], &(rxdata[2*i + 1 + (position*2)]));
} }
}nr_init_frame_parms }
nr_init_frame_parms
printf(" ... ... \n"); printf(" ... ... \n");
#else #else
(void) pss_sequence_number; (void) pss_sequence_number;
...@@ -149,11 +149,9 @@ void display_data(int pss_sequence_number, int16_t *rxdata, int position) ...@@ -149,11 +149,9 @@ void display_data(int pss_sequence_number, int16_t *rxdata, int position)
* *
*********************************************************************/ *********************************************************************/
void display_test_configuration_pss(int position, int pss_sequence_number) void display_test_configuration_pss(int position, int pss_sequence_number) {
{
const char next_test_text[] = "------------------------------------------------\n"; const char next_test_text[] = "------------------------------------------------\n";
const char test_text_pss[] = "Test nr pss with Nid2 %i at position %i \n"; const char test_text_pss[] = "Test nr pss with Nid2 %i at position %i \n";
printf(next_test_text); printf(next_test_text);
printf(test_text_pss, pss_sequence_number, position); printf(test_text_pss, pss_sequence_number, position);
} }
...@@ -171,8 +169,7 @@ void display_test_configuration_pss(int position, int pss_sequence_number) ...@@ -171,8 +169,7 @@ void display_test_configuration_pss(int position, int pss_sequence_number)
* *
*********************************************************************/ *********************************************************************/
void display_test_configuration_sss(int sss_sequence_number) void display_test_configuration_sss(int sss_sequence_number) {
{
const char test_text_sss[] = "Test nr sss with Nid1 %i \n"; const char test_text_sss[] = "Test nr sss with Nid1 %i \n";
printf(test_text_sss, sss_sequence_number); printf(test_text_sss, sss_sequence_number);
} }
...@@ -191,8 +188,7 @@ void display_test_configuration_sss(int sss_sequence_number) ...@@ -191,8 +188,7 @@ void display_test_configuration_sss(int sss_sequence_number)
* *
*********************************************************************/ *********************************************************************/
void undefined_function(const char *function) void undefined_function(const char *function) {
{
printf("%s undefined \n", function); printf("%s undefined \n", function);
printf("Warning: function \"%s\" has been replaced by an empty function for avoiding undefined function error at build \n", function); printf("Warning: function \"%s\" has been replaced by an empty function for avoiding undefined function error at build \n", function);
} }
...@@ -210,34 +206,22 @@ void undefined_function(const char *function) ...@@ -210,34 +206,22 @@ void undefined_function(const char *function)
*********************************************************************/ *********************************************************************/
int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode, int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode,
unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, uint8_t N_RB_DL) unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, uint8_t N_RB_DL) {
{
(void) transmission_mode; (void) transmission_mode;
NR_DL_FRAME_PARMS *frame_parms; NR_DL_FRAME_PARMS *frame_parms;
int log_level = OAILOG_TRACE; int log_level = OAILOG_TRACE;
logInit(); logInit();
// enable these lines if you need debug info // enable these lines if you need debug info
//set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1); //set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1);
set_glog(log_level); set_glog(log_level);
#ifndef NR_UNIT_TEST #ifndef NR_UNIT_TEST
cpuf = get_cpu_freq_GHz(); cpuf = get_cpu_freq_GHz();
//LOG_I(PHY, "[CONFIG] Test of UE synchronisation \n");
LOG_I(PHY, "[CONFIG] Test of UE synchronisation \n");
set_component_filelog(USIM); // file located in /tmp/testSynchroue.txt set_component_filelog(USIM); // file located in /tmp/testSynchroue.txt
#endif #endif
//randominit(0); //randominit(0);
//set_taus_seed(0); //set_taus_seed(0);
printf("Start lte_param_init, frame_type %d, extended_prefix %d\n",frame_type,extended_prefix_flag); printf("Start lte_param_init, frame_type %d, extended_prefix %d\n",frame_type,extended_prefix_flag);
PHY_vars_UE = malloc(sizeof(PHY_VARS_NR_UE)); PHY_vars_UE = malloc(sizeof(PHY_VARS_NR_UE));
bzero(PHY_vars_UE, sizeof(PHY_VARS_NR_UE)); bzero(PHY_vars_UE, sizeof(PHY_VARS_NR_UE));
...@@ -245,7 +229,6 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission ...@@ -245,7 +229,6 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission
return(-1); return(-1);
frame_parms = &(PHY_vars_UE->frame_parms); frame_parms = &(PHY_vars_UE->frame_parms);
frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
frame_parms->N_RB_UL = N_RB_DL; frame_parms->N_RB_UL = N_RB_DL;
frame_parms->Ncp = extended_prefix_flag; frame_parms->Ncp = extended_prefix_flag;
...@@ -257,38 +240,35 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission ...@@ -257,38 +240,35 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission
frame_parms->nb_antenna_ports_eNB = 1; frame_parms->nb_antenna_ports_eNB = 1;
frame_parms->threequarter_fs = 0; frame_parms->threequarter_fs = 0;
frame_parms->numerology_index = NUMEROLOGY_INDEX_MAX_NR; frame_parms->numerology_index = NUMEROLOGY_INDEX_MAX_NR;
int mu = 1;
nr_init_frame_parms_ue(frame_parms); int n_ssb_crb = 0;
int ssb_subcarrier_offset = 0;
nr_init_frame_parms_ue(frame_parms, mu, extended_prefix_flag, N_RB_DL, n_ssb_crb, ssb_subcarrier_offset);
PHY_vars_UE->frame_parms.Nid_cell = (3 * N_ID_1_NUMBER) + N_ID_2_NUMBER; /* set to unvalid value */ PHY_vars_UE->frame_parms.Nid_cell = (3 * N_ID_1_NUMBER) + N_ID_2_NUMBER; /* set to unvalid value */
//phy_init_nr_top(frame_parms); //phy_init_nr_top(frame_parms);
if (init_nr_ue_signal(PHY_vars_UE, 1, 0) != 0) if (init_nr_ue_signal(PHY_vars_UE, 1, 0) != 0) {
{
LOG_E(PHY,"Error at UE NR initialisation : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); LOG_E(PHY,"Error at UE NR initialisation : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
return (0); return (0);
} }
/* dummy initialisation of global structure PHY_vars_UE_g */ /* dummy initialisation of global structure PHY_vars_UE_g */
unsigned char NB_UE_INST=1; unsigned char NB_UE_INST=1;
PHY_vars_UE_g = (PHY_VARS_NR_UE ** *)calloc( NB_UE_INST, sizeof(PHY_VARS_NR_UE **));
PHY_vars_UE_g = (PHY_VARS_NR_UE***)calloc( NB_UE_INST, sizeof(PHY_VARS_NR_UE**));
for (int UE_id=0; UE_id<NB_UE_INST; UE_id++) {
for (int UE_id=0; UE_id<NB_UE_INST; UE_id++) { PHY_vars_UE_g[UE_id] = (PHY_VARS_NR_UE **) calloc( MAX_NUM_CCs, sizeof(PHY_VARS_NR_UE *));
PHY_vars_UE_g[UE_id] = (PHY_VARS_NR_UE**) calloc( MAX_NUM_CCs, sizeof(PHY_VARS_NR_UE*));
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { //(frame_parms[CC_id])->nb_antennas_tx = 1;
//(frame_parms[CC_id])->nb_antennas_tx = 1; //(frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx_ue;
//(frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx_ue; // PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag);
// PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag); PHY_vars_UE_g[UE_id][CC_id] = calloc(1, sizeof(PHY_VARS_NR_UE));
PHY_vars_UE_g[UE_id][CC_id]->Mod_id=UE_id;
PHY_vars_UE_g[UE_id][CC_id] = calloc(1, sizeof(PHY_VARS_NR_UE)); PHY_vars_UE_g[UE_id][CC_id]->CC_id=CC_id;
PHY_vars_UE_g[UE_id][CC_id]->Mod_id=UE_id; }
PHY_vars_UE_g[UE_id][CC_id]->CC_id=CC_id; }
}
}
return (0); return (0);
} }
...@@ -318,73 +298,66 @@ typedef enum { ...@@ -318,73 +298,66 @@ typedef enum {
#define FREQUENCY_15_MHZ (15360000L) #define FREQUENCY_15_MHZ (15360000L)
#define FREQUENCY (FREQUENCY_15_MHZ) /* to generate a frequency with a sampling of 30,72 MHz 5 gives 770 KHz, 20 gives 1,5 MHz, 40 gives 3 MHz */ #define FREQUENCY (FREQUENCY_15_MHZ) /* to generate a frequency with a sampling of 30,72 MHz 5 gives 770 KHz, 20 gives 1,5 MHz, 40 gives 3 MHz */
void set_random_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int amp) void set_random_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int amp) {
{ NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); int samples_for_frame = (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti);
int samples_for_frame = (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); int16_t random;
int16_t random; int16_t *data_p;
int16_t *data_p; random_data_format_t data_format = SINUSOIDAL_DATA;
random_data_format_t data_format = SINUSOIDAL_DATA;
/* reinitialise random for always getting same data */ /* reinitialise random for always getting same data */
srand(0); srand(0);
double n = 0; double n = 0;
for (int aa=0;aa<PHY_vars_UE->frame_parms.nb_antennas_rx;aa++) { for (int aa=0; aa<PHY_vars_UE->frame_parms.nb_antennas_rx; aa++) {
data_p = (int16_t *) &(PHY_vars_UE->common_vars.rxdata[aa][0]); data_p = (int16_t *) &(PHY_vars_UE->common_vars.rxdata[aa][0]);
int frequency_switch = samples_for_frame/LTE_NUMBER_OF_SUBFRAMES_PER_FRAME; int frequency_switch = samples_for_frame/LTE_NUMBER_OF_SUBFRAMES_PER_FRAME;
int frequency_step = 0; int frequency_step = 0;
double beat = (2*M_PI*FREQUENCY_15_MHZ)/(SAMPLING_RATE); double beat = (2*M_PI*FREQUENCY_15_MHZ)/(SAMPLING_RATE);
for (int i=0; i< samples_for_frame; i++) { for (int i=0; i< samples_for_frame; i++) {
switch(data_format) { switch(data_format) {
case ZERO_DATA: case ZERO_DATA: {
{
/* all data are forced to zero */ /* all data are forced to zero */
random = 0; random = 0;
break; break;
} }
case SINUSOIDAL_DATA:
{ case SINUSOIDAL_DATA: {
/* sinusoidal signal */ /* sinusoidal signal */
n = cos(beat*i); n = cos(beat*i);
random = n * (amp * SCALING_SINUSOIDAL_DATA); random = n * (amp * SCALING_SINUSOIDAL_DATA);
frequency_step++; frequency_step++;
if (frequency_step == frequency_switch) { if (frequency_step == frequency_switch) {
beat = beat/2; /* frequency is divided by 2 */ beat = beat/2; /* frequency is divided by 2 */
//printf("frequency %f at %d\n", (beat/2*M_PI), i); //printf("frequency %f at %d\n", (beat/2*M_PI), i);
frequency_step = 0; frequency_step = 0;
} }
//printf("%d : cos %d %d \n", i, n, random); //printf("%d : cos %d %d \n", i, n, random);
break; break;
} }
case RANDOM_DATA:
{ case RANDOM_DATA: {
/* random data can take any value between -SHRT_MAX and SHRT_MAX */ /* random data can take any value between -SHRT_MAX and SHRT_MAX */
/* in this case one can use maxim value for uint16 because there is no saturation */ /* in this case one can use maxim value for uint16 because there is no saturation */
#define SCALING_RANDOM_DATA (24) /* 48 is max value without decimation */ #define SCALING_RANDOM_DATA (24) /* 48 is max value without decimation */
#define RANDOM_MAX_AMP (amp * SCALING_RANDOM_DATA) #define RANDOM_MAX_AMP (amp * SCALING_RANDOM_DATA)
random = ((rand() % RANDOM_MAX_AMP) - RANDOM_MAX_AMP/2); random = ((rand() % RANDOM_MAX_AMP) - RANDOM_MAX_AMP/2);
break; break;
} }
case RANDOM_MAX_DATA:
{ case RANDOM_MAX_DATA: {
/* random data can take only two value (-RANDOM_MAX) or RANDOM_MAX */ /* random data can take only two value (-RANDOM_MAX) or RANDOM_MAX */
/* In this case saturation can occur with value of scaling_value greater than 23 */ /* In this case saturation can occur with value of scaling_value greater than 23 */
#define SCALING_RANDOM_MAX_DATA (8) #define SCALING_RANDOM_MAX_DATA (8)
#define RANDOM_VALUE (amp * SCALING_RANDOM_DATA) #define RANDOM_VALUE (amp * SCALING_RANDOM_DATA)
const int random_number[2] = {-1,+1}; const int random_number[2] = {-1,+1};
random = random_number[rand()%2] * RANDOM_VALUE; random = random_number[rand()%2] * RANDOM_VALUE;
break; break;
} }
default:
{ default: {
printf("Format of data is undefined \n"); printf("Format of data is undefined \n");
assert(0); assert(0);
break; break;
...@@ -393,12 +366,13 @@ random_data_format_t data_format = SINUSOIDAL_DATA; ...@@ -393,12 +366,13 @@ random_data_format_t data_format = SINUSOIDAL_DATA;
data_p[2*i] = random; data_p[2*i] = random;
data_p[2*i+1] = random; data_p[2*i+1] = random;
#if 0 #if 0
if (i < 10) { if (i < 10) {
printf("random %d \n", random); printf("random %d \n", random);
printf("data[%d] : %d %d at address %p \n", i, data_p[2*i], data_p[2*i+1], &data_p[2*i]); printf("data[%d] : %d %d at address %p \n", i, data_p[2*i], data_p[2*i+1], &data_p[2*i]);
} }
#endif #endif
} }
} }
...@@ -418,23 +392,22 @@ random_data_format_t data_format = SINUSOIDAL_DATA; ...@@ -418,23 +392,22 @@ random_data_format_t data_format = SINUSOIDAL_DATA;
* *
*********************************************************************/ *********************************************************************/
int set_pss_in_rx_buffer_from_external_buffer(PHY_VARS_NR_UE *PHY_vars_UE, short *input_buffer) int set_pss_in_rx_buffer_from_external_buffer(PHY_VARS_NR_UE *PHY_vars_UE, short *input_buffer) {
{
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
int samples_for_frame = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_subframe; /* both i and q */ int samples_for_frame = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_subframe; /* both i and q */
for (int aa=0;aa<PHY_vars_UE->frame_parms.nb_antennas_rx;aa++) { for (int aa=0; aa<PHY_vars_UE->frame_parms.nb_antennas_rx; aa++) {
for (int i = 0; i < samples_for_frame; i++) { for (int i = 0; i < samples_for_frame; i++) {
((int16_t*)PHY_vars_UE->common_vars.rxdata[aa])[2*i] = input_buffer[2*i]; /* real part */ ((int16_t *)PHY_vars_UE->common_vars.rxdata[aa])[2*i] = input_buffer[2*i]; /* real part */
((int16_t*)PHY_vars_UE->common_vars.rxdata[aa])[2*i+1] = input_buffer[2*i+1]; /* imaginary part */ ((int16_t *)PHY_vars_UE->common_vars.rxdata[aa])[2*i+1] = input_buffer[2*i+1]; /* imaginary part */
} }
} }
/* check that sequence has been properly copied */ /* check that sequence has been properly copied */
for (int aa=0;aa<PHY_vars_UE->frame_parms.nb_antennas_rx;aa++) { for (int aa=0; aa<PHY_vars_UE->frame_parms.nb_antennas_rx; aa++) {
for (int i=0; i<samples_for_frame; i++) { for (int i=0; i<samples_for_frame; i++) {
if ((input_buffer[2*i] != ((int16_t*)PHY_vars_UE->common_vars.rxdata[aa])[2*i]) if ((input_buffer[2*i] != ((int16_t *)PHY_vars_UE->common_vars.rxdata[aa])[2*i])
|| (input_buffer[2*i+1] != ((int16_t*)PHY_vars_UE->common_vars.rxdata[aa])[2*i+1])) { || (input_buffer[2*i+1] != ((int16_t *)PHY_vars_UE->common_vars.rxdata[aa])[2*i+1])) {
printf("Sequence pss was not properly copied into received buffer at index %d \n", i); printf("Sequence pss was not properly copied into received buffer at index %d \n", i);
exit(-1); exit(-1);
} }
...@@ -466,15 +439,13 @@ int set_pss_in_rx_buffer_from_external_buffer(PHY_VARS_NR_UE *PHY_vars_UE, short ...@@ -466,15 +439,13 @@ int set_pss_in_rx_buffer_from_external_buffer(PHY_VARS_NR_UE *PHY_vars_UE, short
* *
*********************************************************************/ *********************************************************************/
int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_sequence_number) int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_sequence_number) {
{
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
int samples_for_frame = frame_parms->samples_per_frame; int samples_for_frame = frame_parms->samples_per_frame;
int16_t *pss_sequence_time; int16_t *pss_sequence_time;
if ((position_symbol > samples_for_frame) if ((position_symbol > samples_for_frame)
|| ((position_symbol + frame_parms->ofdm_symbol_size) > samples_for_frame)) || ((position_symbol + frame_parms->ofdm_symbol_size) > samples_for_frame)) {
{
printf("This pss sequence can not be fully written in the received window \n"); printf("This pss sequence can not be fully written in the received window \n");
return (-1); return (-1);
} }
...@@ -486,18 +457,18 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p ...@@ -486,18 +457,18 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p
pss_sequence_time = primary_synchro_time_nr[pss_sequence_number]; pss_sequence_time = primary_synchro_time_nr[pss_sequence_number];
for (int aa=0;aa<PHY_vars_UE->frame_parms.nb_antennas_rx;aa++) { for (int aa=0; aa<PHY_vars_UE->frame_parms.nb_antennas_rx; aa++) {
for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) { for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) {
((int16_t*)PHY_vars_UE->common_vars.rxdata[aa])[(position_symbol*2) + (2*i)] = pss_sequence_time[2*i]; /* real part */ ((int16_t *)PHY_vars_UE->common_vars.rxdata[aa])[(position_symbol*2) + (2*i)] = pss_sequence_time[2*i]; /* real part */
((int16_t*)PHY_vars_UE->common_vars.rxdata[aa])[(position_symbol*2) + (2*i+1)] = pss_sequence_time[2*i+1]; /* imaginary part */ ((int16_t *)PHY_vars_UE->common_vars.rxdata[aa])[(position_symbol*2) + (2*i+1)] = pss_sequence_time[2*i+1]; /* imaginary part */
} }
} }
/* check that sequence has been properly copied */ /* check that sequence has been properly copied */
for (int aa=0;aa<PHY_vars_UE->frame_parms.nb_antennas_rx;aa++) { for (int aa=0; aa<PHY_vars_UE->frame_parms.nb_antennas_rx; aa++) {
for (int i=0; i<(frame_parms->ofdm_symbol_size); i++) { for (int i=0; i<(frame_parms->ofdm_symbol_size); i++) {
if ((pss_sequence_time[2*i] != ((int16_t*)PHY_vars_UE->common_vars.rxdata[aa])[(position_symbol*2) + (2*i)]) if ((pss_sequence_time[2*i] != ((int16_t *)PHY_vars_UE->common_vars.rxdata[aa])[(position_symbol*2) + (2*i)])
|| (pss_sequence_time[2*i+1] != ((int16_t*)PHY_vars_UE->common_vars.rxdata[aa])[(position_symbol*2) + (2*i+1)])) { || (pss_sequence_time[2*i+1] != ((int16_t *)PHY_vars_UE->common_vars.rxdata[aa])[(position_symbol*2) + (2*i+1)])) {
printf("Sequence pss was not properly copied into received buffer at index %d \n", i); printf("Sequence pss was not properly copied into received buffer at index %d \n", i);
exit(-1); exit(-1);
} }
...@@ -525,11 +496,9 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p ...@@ -525,11 +496,9 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p
* *
*********************************************************************/ *********************************************************************/
void set_sequence_pss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_sequence_number) void set_sequence_pss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_sequence_number) {
{
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
int samples_for_frame = frame_parms->samples_per_frame; int samples_for_frame = frame_parms->samples_per_frame;
/* initialise received ue data with random */ /* initialise received ue data with random */
set_random_rx_buffer(PHY_vars_UE, AMP); set_random_rx_buffer(PHY_vars_UE, AMP);
...@@ -543,6 +512,7 @@ void set_sequence_pss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_ ...@@ -543,6 +512,7 @@ void set_sequence_pss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_
printf("This position for pss sequence %d is not supported because it exceeds the frame length %d!\n", position_symbol, samples_for_frame); printf("This position for pss sequence %d is not supported because it exceeds the frame length %d!\n", position_symbol, samples_for_frame);
exit(0); exit(0);
} }
if (set_pss_in_rx_buffer(PHY_vars_UE, position_symbol, pss_sequence_number) != 0) if (set_pss_in_rx_buffer(PHY_vars_UE, position_symbol, pss_sequence_number) != 0)
printf("Warning: pss sequence can not be properly written into received buffer !\n"); printf("Warning: pss sequence can not be properly written into received buffer !\n");
} }
......
#include "../../unit_tests/src/pss_util_test.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/INIT/init_extern.h"
#include "PHY/phy_extern_nr_ue.h"
/*
#include "SCHED_NR_UE/defs.h"
#include "SCHED_NR/extern.h"
#include "SCHED_NR_UE/harq_nr.h"
*/
#include "SCHED_NR_UE/pucch_uci_ue_nr.h"
/**************** define **************************************/
#define TST_GNB_ID_0 (0) /* first index of gNB */
#define TST_THREAD_ID (0)
int test_pucch_generators(PHY_VARS_NR_UE *ue) {
int gNB_id = TST_GNB_ID_0;
int thread_number = TST_THREAD_ID;
int TB_identifier = 0;
int v_return = 0;
pucch_format_nr_t format = pucch_format2_nr;
uint8_t starting_symbol_index;
uint8_t nb_symbols_total = 4;
uint16_t starting_prb = 0;; /* it can be considered as first hop on case of pucch hopping */
uint16_t second_hop = 0; /* second part for pucch for hopping */
uint8_t nb_of_prbs = 1;
switch (format) {
case pucch_format0_nr:
nb_symbols_total = 2;
nb_of_prbs = 1;
starting_symbol_index = 0;
break;
case pucch_format1_nr:
nb_symbols_total = 5;
nb_of_prbs = 1;
starting_symbol_index = 0;
break;
case pucch_format2_nr:
nb_symbols_total = 2;
nb_of_prbs = 16;
starting_symbol_index = 0;
break;
}
int m_0 = 0; /* format 0 only */
int m_CS = 0; /* for all format except for format 0 */
int index_additional_dmrs = I_PUCCH_NO_ADDITIONAL_DMRS;
int index_hopping = I_PUCCH_NO_HOPPING;
int time_domain_occ = 0;
int occ_length = 0;
int occ_Index = 0;
uint64_t pucch_payload = 0;
int tx_amp = 512;
int nr_tti_tx = 0;
int N_UCI = 0; /* size in bits for Uplink Control Information */
switch(format) {
case pucch_format0_nr: {
nr_generate_pucch0(ue,ue->common_vars.txdataF,
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
tx_amp,
nr_tti_tx,
(uint8_t)m_0,
(uint8_t)m_CS,
nb_symbols_total,
starting_symbol_index,
starting_prb);
break;
}
case pucch_format1_nr: {
nr_generate_pucch1(ue,ue->common_vars.txdataF,
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
nr_tti_tx,
(uint8_t)m_0,
nb_symbols_total,
starting_symbol_index,
starting_prb,
second_hop,
(uint8_t)time_domain_occ,
(uint8_t)N_UCI);
break;
}
case pucch_format2_nr: {
nr_generate_pucch2(ue,
ue->pdcch_vars[ue->current_thread_id[nr_tti_tx]][gNB_id]->crnti,
ue->common_vars.txdataF,
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
nr_tti_tx,
nb_symbols_total,
starting_symbol_index,
nb_of_prbs,
starting_prb,
(uint8_t)N_UCI);
break;
}
case pucch_format3_nr:
case pucch_format4_nr: {
nr_generate_pucch3_4(ue,
ue->pdcch_vars[ue->current_thread_id[nr_tti_tx]][gNB_id]->crnti,
ue->common_vars.txdataF,
&ue->frame_parms,
format,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
nr_tti_tx,
nb_symbols_total,
starting_symbol_index,
nb_of_prbs,
starting_prb,
second_hop,
(uint8_t)N_UCI,
(uint8_t)occ_length,
(uint8_t)occ_Index);
break;
}
}
return (v_return);
}
int main(int argc, char *argv[]) {
uint8_t transmission_mode = 1;
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint8_t frame_type = FDD;
uint8_t N_RB_DL=106;
lte_prefix_type_t extended_prefix_flag = NORMAL;
int Nid_cell[] = {(3*1+3)};
VOID_PARAMETER argc;
VOID_PARAMETER argv;
printf(" PUCCH TEST \n");
printf("-----------\n");
if (init_test(nb_antennas_tx, nb_antennas_rx, transmission_mode, extended_prefix_flag, frame_type, Nid_cell[0], N_RB_DL) != 0) {
printf("Initialisation problem for test \n");
exit(-1);;
}
if (test_pucch_generators(PHY_vars_UE) != 0) {
printf("\nTest PUCCH is fail \n");
} else {
printf("\nTest PUCCH is pass \n");
}
free_context_synchro_nr();
return(0);
}
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