Commit 22d2e9a3 authored by Laurent THOMAS's avatar Laurent THOMAS

fix warnings and race cond in polar codec

parent 11441023
...@@ -64,7 +64,7 @@ int8_t polar_decoder(double *input, ...@@ -64,7 +64,7 @@ int8_t polar_decoder(double *input,
uint8_t aggregation_level uint8_t aggregation_level
) )
{ {
const t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true); t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
//Assumes no a priori knowledge. //Assumes no a priori knowledge.
uint8_t bit[polarParams->N][polarParams->n+1][2*listSize]; uint8_t bit[polarParams->N][polarParams->n+1][2*listSize];
memset(bit,0,sizeof bit); memset(bit,0,sizeof bit);
...@@ -312,7 +312,7 @@ int8_t polar_decoder_dci(double *input, ...@@ -312,7 +312,7 @@ int8_t polar_decoder_dci(double *input,
int8_t messageType, int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level ) { uint8_t aggregation_level ) {
const t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true); t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
uint8_t bit[polarParams->N][polarParams->n+1][2*listSize]; uint8_t bit[polarParams->N][polarParams->n+1][2*listSize];
memset(bit,0,sizeof bit); memset(bit,0,sizeof bit);
...@@ -610,7 +610,7 @@ uint32_t polar_decoder_int16(int16_t *input, ...@@ -610,7 +610,7 @@ uint32_t polar_decoder_int16(int16_t *input,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level ) uint8_t aggregation_level )
{ {
const t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true); t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
int16_t d_tilde[polarParams->N];// = malloc(sizeof(double) * polarParams->N); int16_t d_tilde[polarParams->N];// = malloc(sizeof(double) * polarParams->N);
nr_polar_rate_matching_int16(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength); nr_polar_rate_matching_int16(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
......
...@@ -346,9 +346,10 @@ static inline void nr_polar_deinterleaver(uint8_t *input, ...@@ -346,9 +346,10 @@ static inline void nr_polar_deinterleaver(uint8_t *input,
} }
void delete_decoder_tree(t_nrPolar_params *); void delete_decoder_tree(t_nrPolar_params *);
extern pthread_mutex_t PolarListMutex;
#define polarReturn \ #define polarReturn \
pthread_mutex_lock(&PolarListMutex); \ pthread_mutex_lock(&PolarListMutex); \
currentPtr->busy=false; \ polarParams->busy=false; \
pthread_mutex_unlock(&PolarListMutex); \ pthread_mutex_unlock(&PolarListMutex); \
return return
......
...@@ -46,7 +46,7 @@ void polar_encoder(uint32_t *in, ...@@ -46,7 +46,7 @@ void polar_encoder(uint32_t *in,
int8_t messageType, int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level) { uint8_t aggregation_level) {
const t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false); t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
if (1) {//polarParams->idx == 0 || polarParams->idx == 1) { //PBCH or PDCCH if (1) {//polarParams->idx == 0 || polarParams->idx == 1) { //PBCH or PDCCH
/* /*
uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<<polarParams->payloadBits); uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<<polarParams->payloadBits);
...@@ -164,7 +164,7 @@ void polar_encoder_dci(uint32_t *in, ...@@ -164,7 +164,7 @@ void polar_encoder_dci(uint32_t *in,
int8_t messageType, int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level) { uint8_t aggregation_level) {
const t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false); t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
#ifdef DEBUG_POLAR_ENCODER_DCI #ifdef DEBUG_POLAR_ENCODER_DCI
printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]); printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]);
...@@ -433,7 +433,7 @@ void polar_encoder_fast(uint64_t *A, ...@@ -433,7 +433,7 @@ void polar_encoder_fast(uint64_t *A,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level) { uint8_t aggregation_level) {
const t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false); t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
// AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K); // AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K); AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits); AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define PolarKey ((messageType<<24)|(messageLength<<8)|aggregation_level) #define PolarKey ((messageType<<24)|(messageLength<<8)|aggregation_level)
static t_nrPolar_params * PolarList=NULL; static t_nrPolar_params * PolarList=NULL;
static pthread_mutex_t PolarListMutex=PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t PolarListMutex=PTHREAD_MUTEX_INITIALIZER;
static int intcmp(const void *p1,const void *p2) { static int intcmp(const void *p1,const void *p2) {
return(*(int16_t *)p1 > *(int16_t *)p2); return(*(int16_t *)p1 > *(int16_t *)p2);
......
...@@ -147,7 +147,7 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_ ...@@ -147,7 +147,7 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
} }
void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR, int tx_lev,int hold_channel,int abstx, int num_rounds, int trials, int round, channel_desc_t *eNB2UE[4], void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR, int tx_lev,int hold_channel,int abstx, int num_rounds, int trials, int round, channel_desc_t *eNB2UE[4],
double *s_re[NB_ANTENNAS_TX],double *s_im[[NB_ANTENNAS_TX],double *r_re[NB_ANTENNAS_RX],double *r_im[NB_ANTENNAS_RX],FILE *csv_fd) { double *s_re[NB_ANTENNAS_TX],double *s_im[NB_ANTENNAS_TX],double *r_re[NB_ANTENNAS_RX],double *r_im[NB_ANTENNAS_RX],FILE *csv_fd) {
int i,u; int i,u;
int aa,aarx,aatx; int aa,aarx,aatx;
double channelx,channely; double channelx,channely;
......
...@@ -101,13 +101,6 @@ typedef struct { ...@@ -101,13 +101,6 @@ typedef struct {
static rlc_data_req_queue q; static rlc_data_req_queue q;
extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
const NR_SRB_ToAddModList_t * const srb2add_listP,
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
static void *rlc_data_req_thread(void *_) static void *rlc_data_req_thread(void *_)
{ {
int i; int i;
......
...@@ -208,3 +208,24 @@ void ...@@ -208,3 +208,24 @@ void
rrc_gNB_generate_dedicatedRRCReconfiguration( rrc_gNB_generate_dedicatedRRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP); rrc_gNB_ue_context_t *ue_context_pP);
rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
const NR_SRB_ToAddModList_t * const srb2add_listP,
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
boolean_t nr_rrc_pdcp_config_asn1_req(
const protocol_ctxt_t *const ctxt_pP,
NR_SRB_ToAddModList_t *const srb2add_list,
NR_DRB_ToAddModList_t *const drb2add_list,
NR_DRB_ToReleaseList_t *const drb2release_list,
const uint8_t security_modeP,
uint8_t *const kRRCenc,
uint8_t *const kRRCint,
uint8_t *const kUPenc,
uint8_t *const kUPint
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
,rb_id_t *const defaultDRB,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
#include <openair2/RRC/NR/rrc_gNB_UE_context.h> #include <openair2/RRC/NR/rrc_gNB_UE_context.h>
#include <openair2/X2AP/x2ap_eNB.h> #include <openair2/X2AP/x2ap_eNB.h>
#include <openair3/ocp-gtpu/gtp_itf.h> #include <openair3/ocp-gtpu/gtp_itf.h>
#include <openair2/RRC/NR/nr_rrc_proto.h>
#include "BIT_STRING.h" #include "BIT_STRING.h"
#include "assertions.h" #include "assertions.h"
......
...@@ -42,27 +42,7 @@ ...@@ -42,27 +42,7 @@
#include <openair2/RRC/NR/rrc_gNB_UE_context.h> #include <openair2/RRC/NR/rrc_gNB_UE_context.h>
#include <openair3/ocp-gtpu/gtp_itf.h> #include <openair3/ocp-gtpu/gtp_itf.h>
#include "UTIL/OSA/osa_defs.h" #include "UTIL/OSA/osa_defs.h"
#include <openair2/RRC/NR/nr_rrc_proto.h>
extern boolean_t nr_rrc_pdcp_config_asn1_req(
const protocol_ctxt_t *const ctxt_pP,
NR_SRB_ToAddModList_t *const srb2add_list,
NR_DRB_ToAddModList_t *const drb2add_list,
NR_DRB_ToReleaseList_t *const drb2release_list,
const uint8_t security_modeP,
uint8_t *const kRRCenc,
uint8_t *const kRRCint,
uint8_t *const kUPenc,
uint8_t *const kUPint
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
,rb_id_t *const defaultDRB,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
const NR_SRB_ToAddModList_t * const srb2add_listP,
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t *cg_config_info) { void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t *cg_config_info) {
struct rrc_gNB_ue_context_s *ue_context_p = NULL; struct rrc_gNB_ue_context_s *ue_context_p = NULL;
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#include <executables/softmodem-common.h> #include <executables/softmodem-common.h>
#include "nr_nas_msg_sim.h" #include "nr_nas_msg_sim.h"
#include <openair2/RRC/NR/nr_rrc_proto.h>
NR_UE_RRC_INST_t *NR_UE_rrc_inst; NR_UE_RRC_INST_t *NR_UE_rrc_inst;
/* NAS Attach request with IMSI */ /* NAS Attach request with IMSI */
...@@ -178,27 +179,6 @@ static int nr_rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_NR_t subS ...@@ -178,27 +179,6 @@ static int nr_rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_NR_t subS
return (0); return (0);
} }
extern boolean_t nr_rrc_pdcp_config_asn1_req(
const protocol_ctxt_t *const ctxt_pP,
NR_SRB_ToAddModList_t *const srb2add_list,
NR_DRB_ToAddModList_t *const drb2add_list,
NR_DRB_ToReleaseList_t *const drb2release_list,
const uint8_t security_modeP,
uint8_t *const kRRCenc,
uint8_t *const kRRCint,
uint8_t *const kUPenc,
uint8_t *const kUPint
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
,rb_id_t *const defaultDRB,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
const NR_SRB_ToAddModList_t * const srb2add_listP,
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id, int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id,
const uint8_t *buffer, const uint8_t *buffer,
......
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