Commit 79fc7447 authored by frtabu's avatar frtabu

fix usrp problem, and some cppcheck errors

parent 10a3565d
......@@ -187,7 +187,6 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
// UE-specific RX processing for subframe n
if (nfapi_mode == 0 || nfapi_mode == 1) */
pthread_mutex_lock(&gNB->UL_INFO_mutex);
gNB->UL_INFO.frame = frame_rx;
gNB->UL_INFO.slot = slot_rx;
......@@ -206,8 +205,8 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
if (oai_exit) return(-1);
//if (slot_rx == NR_UPLINK_SLOT || gNB->frame_parms.frame_type == FDD)
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
//if (slot_rx == NR_UPLINK_SLOT || gNB->frame_parms.frame_type == FDD)
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
if(get_thread_parallel_conf() != PARALLEL_RU_L1_TRX_SPLIT) {
phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1);
......@@ -907,7 +906,6 @@ void init_gNB(int single_thread_flag,int wait_for_sync) {
gNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = gNB->harq_pdu_list;
gNB->UL_INFO.cqi_ind.cqi_pdu_list = gNB->cqi_pdu_list;
gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list;
gNB->prach_energy_counter = 0;
}
}
......
......@@ -525,8 +525,9 @@ void trashFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
dummy_rx,
UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_rx);
if (IS_SOFTMODEM_RFSIM ) {
usleep(1000); // slow down, as would do actuall rf to let cpu for the synchro thread
usleep(1000); // slow down, as would do actuall rf to let cpu for the synchro thread
}
}
......@@ -681,14 +682,12 @@ void *UE_thread(void *arg) {
curMsg->proc.decoded_frame_rx=-1;
//LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB);
#ifdef OAI_ADRV9371_ZC706
/*uint32_t total_gain_dB_prev = 0;
if (total_gain_dB_prev != UE->rx_total_gain_dB) {
total_gain_dB_prev = UE->rx_total_gain_dB;
total_gain_dB_prev = UE->rx_total_gain_dB;
openair0_cfg[0].rx_gain[0] = UE->rx_total_gain_dB;
UE->rfdevice.trx_set_gains_func(&UE->rfdevice,&openair0_cfg[0]);
}*/
#endif
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
......@@ -721,17 +720,17 @@ void *UE_thread(void *arg) {
readBlockSize,
UE->frame_parms.nb_antennas_rx),"");
if (slot_nr==18)
AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+
(DURATION_RX_TO_TX*UE->frame_parms.samples_per_slot) -
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 -
openair0_cfg[0].tx_sample_advance,
txp,
writeBlockSize,
UE->frame_parms.nb_antennas_tx,
4),"");
if (slot_nr==18)
AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+
(DURATION_RX_TO_TX*UE->frame_parms.samples_per_slot) -
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 -
openair0_cfg[0].tx_sample_advance,
txp,
writeBlockSize,
UE->frame_parms.nb_antennas_tx,
4),"");
if( slot_nr==(nb_slot_frame-1)) {
// read in first symbol of next frame and adjust for timing drift
......
......@@ -478,24 +478,22 @@ void init_openair0(void) {
if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=92.16e6;
openair0_cfg[card].samples_per_frame = 921600;
}
else {
} else {
openair0_cfg[card].sample_rate=122.88e6;
openair0_cfg[card].samples_per_frame = 1228800;
}
}
} else {
LOG_E(PHY,"Unsupported numerology!\n");
exit(-1);
}
}else if(frame_parms[0]->N_RB_DL == 273) {
} else if(frame_parms[0]->N_RB_DL == 273) {
if (numerology==1) {
if (frame_parms[0]->threequarter_fs) {
AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n");
}
else {
} else {
openair0_cfg[card].sample_rate=122.88e6;
openair0_cfg[card].samples_per_frame = 1228800;
}
}
} else {
LOG_E(PHY,"Unsupported numerology!\n");
exit(-1);
......@@ -511,13 +509,12 @@ void init_openair0(void) {
}
} else if (numerology==1) {
if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=46.08e6;
openair0_cfg[card].samples_per_frame = 480800;
}
else {
openair0_cfg[card].sample_rate=61.44e6;
openair0_cfg[card].samples_per_frame = 614400;
}
openair0_cfg[card].sample_rate=46.08e6;
openair0_cfg[card].samples_per_frame = 480800;
} else {
openair0_cfg[card].sample_rate=61.44e6;
openair0_cfg[card].samples_per_frame = 614400;
}
} else if (numerology==2) {
openair0_cfg[card].sample_rate=122.88e6;
openair0_cfg[card].samples_per_frame = 1228800;
......@@ -534,8 +531,7 @@ void init_openair0(void) {
} else if (frame_parms[0]->N_RB_DL == 6) {
openair0_cfg[card].sample_rate=1.92e6;
openair0_cfg[card].samples_per_frame = 19200;
}
else {
} else {
LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms[0]->N_RB_DL);
exit(-1);
}
......@@ -620,10 +616,7 @@ int main( int argc, char **argv ) {
logInit();
// get options and fill parameters from configuration file
get_options (); //Command-line options, enb_properties
set_softmodem_optmask(SOFTMODEM_NRUE_BIT);
#if T_TRACER
T_Config_Init();
#endif
......
......@@ -94,7 +94,7 @@ void get_common_options(void) {
}
if (nokrnmod) {
printf("nokrnmod bit enabled \n");
printf("nokrnmod bit enabled \n");
set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
}
......@@ -114,7 +114,6 @@ void get_common_options(void) {
set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT);
}
if(parallel_config != NULL) set_parallel_conf(parallel_config);
if(worker_config != NULL) set_worker_conf(worker_config);
......
......@@ -56,8 +56,7 @@
int16_t *base_sequence_less_than_36(unsigned int M_ZC,
unsigned int u,
unsigned int scaling)
{
unsigned int scaling) {
char *phi_table;
int16_t *rv_overbar;
double x;
......@@ -67,17 +66,22 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC,
case 6:
phi_table = (char *)phi_M_ZC_6;
break;
case 12:
phi_table = (char *)phi_M_ZC_12;
break;
case 18:
phi_table = (char *)phi_M_ZC_18;
break;
case 24:
phi_table = (char *)phi_M_ZC_24;
break;
case 30:
break;
default:
printf("function base_sequence_less_than 36_: unsupported base sequence size : %u \n", M_ZC);
abort();
......@@ -97,14 +101,14 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC,
rv_overbar[2*n] =(int16_t)(floor(scaling*cos(x)));
rv_overbar[2*n+1] =(int16_t)(floor(scaling*sin(x)));
}
}
else {
} else {
for (n=0; n<M_ZC; n++) {
x = (double)phi_table[n + u*M_ZC] * (M_PI/4);
rv_overbar[2*n] = (int16_t)(floor(scaling*cos(x)));
rv_overbar[2*n+1] = (int16_t)(floor(scaling*sin(x)));
}
}
return rv_overbar;
}
......@@ -126,22 +130,20 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC,
int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
unsigned int u,
unsigned int v,
unsigned int scaling)
{
unsigned int scaling) {
int16_t *rv_overbar;
unsigned int N_ZC;
double q_overbar, x;
unsigned int q,m,n;
unsigned int M_ZC = ul_allocated_re[Msc_RS];
rv_overbar = malloc16(IQ_SIZE*M_ZC);
if (rv_overbar == NULL) {
msg("Fatal memory allocation problem \n");
assert(0);
}
N_ZC = ref_ul_primes[Msc_RS]; /* The length N_ZC is given by the largest prime number such that N_ZC < M_ZC */
q_overbar = N_ZC * (u+1)/(double)31;
/* q = (q_overbar + 1/2) + v.(-1)^(2q_overbar) */
......@@ -156,6 +158,7 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
rv_overbar[2*n] = (int16_t)(floor(scaling*cos(M_PI*x))); /* cos(-x) = cos(x) */
rv_overbar[2*n+1] = -(int16_t)(floor(scaling*sin(M_PI*x))); /* sin(-x) = -sin(x) */
}
return rv_overbar;
}
......@@ -173,19 +176,16 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
*
*********************************************************************/
void generate_ul_reference_signal_sequences(unsigned int scaling)
{
unsigned int u,v,Msc_RS;
void generate_ul_reference_signal_sequences(unsigned int scaling) {
unsigned int u,v,Msc_RS;
#if 0
char output_file[255];
char sequence_name[255];
char output_file[255];
char sequence_name[255];
#endif
for (Msc_RS=0; Msc_RS <= INDEX_SB_LESS_32; Msc_RS++) {
v = 0;
v = 0;
for (u=0; u < U_GROUP_NUMBER; u++) {
rv_ul_ref_sig[u][v][Msc_RS] = base_sequence_less_than_36(ul_allocated_re[Msc_RS], u, scaling);
#if 0
......@@ -193,7 +193,6 @@ void generate_ul_reference_signal_sequences(unsigned int scaling)
sprintf(sequence_name, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]);
printf("u %d Msc_RS %d allocate memory %x of size %d \n", u, Msc_RS, rv_ul_ref_sig[u][v][Msc_RS], (IQ_SIZE* ul_allocated_re[Msc_RS]));
write_output(output_file, sequence_name, rv_ul_ref_sig[u][v][Msc_RS], ul_allocated_re[Msc_RS], 1, 1);
#endif
}
}
......@@ -207,7 +206,6 @@ void generate_ul_reference_signal_sequences(unsigned int scaling)
sprintf(sequence_name, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]);
printf("u %d Msc_RS %d allocate memory %x of size %d \n", u, Msc_RS, rv_ul_ref_sig[u][v][Msc_RS], (IQ_SIZE* ul_allocated_re[Msc_RS]));
write_output(output_file, sequence_name, rv_ul_ref_sig[u][v][Msc_RS], ul_allocated_re[Msc_RS], 1, 1);
#endif
}
}
......@@ -225,9 +223,9 @@ void generate_ul_reference_signal_sequences(unsigned int scaling)
* DESCRIPTION : free of uplink reference signal sequences
*
*********************************************************************/
void free_ul_reference_signal_sequences(void)
{
void free_ul_reference_signal_sequences(void) {
unsigned int u,v,Msc_RS;
for (Msc_RS=0; Msc_RS < SRS_SB_CONF; Msc_RS++) {
for (u=0; u < U_GROUP_NUMBER; u++) {
for (v=0; v < V_BASE_SEQUENCE_NUMBER; v++) {
......
......@@ -80,7 +80,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
time_stats_t *dlsch_modulation_stats);
void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlsch);
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
......
This diff is collapsed.
......@@ -32,7 +32,7 @@
#include "PHY/defs_gNB.h"
void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch);
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch);
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
......@@ -67,11 +67,11 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
@param n_RNTI, CRNTI
*/
void nr_ulsch_unscrambling(int16_t* llr,
uint32_t size,
uint8_t q,
uint32_t Nid,
uint32_t n_RNTI);
void nr_ulsch_unscrambling(int16_t *llr,
uint32_t size,
uint8_t q,
uint32_t Nid,
uint32_t n_RNTI);
void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -737,7 +737,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
NRRRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= N_RB_DL;
if ((N_RB_DL != 273) && (N_RB_DL != 217) && (N_RB_DL != 106))
AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for N_RB_DL choice: 106, 217 !\n", RC.config_file_name, i, N_RB_DL);
AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for N_RB_DL choice: 106, 217 !\n", RC.config_file_name, i, N_RB_DL);
/*
if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) {
......
......@@ -540,9 +540,6 @@ rrc_pdcp_config_security(
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
ue_context_pP->ue_context.kenb,
&kRRCint);
#if !defined(USRP_REC_PLAY)
SET_LOG_DUMP(DEBUG_SECURITY) ;
#endif
if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) {
if (print_keys ==1 ) {
......
......@@ -115,7 +115,6 @@ typedef struct {
size_t mapsize;
iqrec_t *ms_sample; // memory for all subframes
unsigned int nb_samples;
unsigned int u_sf_mode; // 1=record, 2=replay
char u_sf_filename[1024]; // subframes file path
unsigned int u_sf_max ; // max number of recorded subframes
unsigned int u_sf_loops ; // number of loops in replay mode
......
......@@ -80,7 +80,7 @@ unsigned short config_frames[4] = {2,9,11,13};
//#include "PHY/TOOLS/time_meas.h"
#ifndef OPENAIR2
#include "UTIL/OTG/otg_vars.h"
#include "UTIL/OTG/otg_vars.h"
#endif
......@@ -256,6 +256,7 @@ void exit_function(const char *file, const char *function, const int line, const
if (s != NULL) {
printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
}
close_log_mem();
oai_exit = 1;
......@@ -515,8 +516,7 @@ static void wait_nfapi_init(char *thread_name) {
printf( "NFAPI: got sync (%s)\n", thread_name);
}
int main ( int argc, char **argv )
{
int main ( int argc, char **argv ) {
int i;
int CC_id = 0;
int ru_id;
......@@ -531,14 +531,14 @@ int main ( int argc, char **argv )
logInit();
printf("Reading in command-line options\n");
get_options ();
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n");
exit(-1);
}
set_softmodem_optmask(SOFTMODEM_ENB_BIT);
set_softmodem_optmask(SOFTMODEM_ENB_BIT);
#if T_TRACER
T_Config_Init();
#endif
......@@ -598,6 +598,7 @@ int main ( int argc, char **argv )
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
}
node_type = RC.rrc[0]->node_type;
} else {
printf("RC.nb_inst = 0, Initializing L1\n");
......@@ -614,7 +615,7 @@ int main ( int argc, char **argv )
ctxt.subframe = 0;
pdcp_run(&ctxt);
}
/* start threads if only L1 or not a CU */
if (RC.nb_inst == 0 || !NODE_IS_CU(node_type) || NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) {
// init UE_PF_PO and mutex lock
......@@ -623,27 +624,26 @@ int main ( int argc, char **argv )
mlockall(MCL_CURRENT | MCL_FUTURE);
pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL);
rt_sleep_ns(10*100000000ULL);
if (NFAPI_MODE!=NFAPI_MONOLITHIC) {
LOG_I(ENB_APP,"NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL);
}
if (NFAPI_MODE==NFAPI_MODE_VNF) {// VNF
#if defined(PRE_SCD_THREAD)
init_ru_vnf(); // ru pointer is necessary for pre_scd.
#endif
wait_nfapi_init("main?");
}
LOG_I(ENB_APP,"START MAIN THREADS\n");
// start the main threads
number_of_cards = 1;
printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst);
if (RC.nb_L1_inst > 0) {
printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
init_eNB(get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
......@@ -655,25 +655,25 @@ int main ( int argc, char **argv )
printf("wait_eNBs()\n");
wait_eNBs();
printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
// RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator.
// but RU thread deals with pre_scd and this is necessary in VNF and simulator.
// some initialization is necessary and init_ru_vnf do this.
if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) {
printf("Initializing RU threads\n");
init_RU(get_softmodem_params()->rf_config_file,get_softmodem_params()->clock_source,get_softmodem_params()->timing_source,get_softmodem_params()->send_dmrs_sync);
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
RC.ru[ru_id]->rf_map.card=0;
RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
}
config_sync_var=0;
if (NFAPI_MODE==NFAPI_MODE_PNF) { // PNF
wait_nfapi_init("main?");
}
printf("wait RUs\n");
// CI -- Flushing the std outputs for the previous marker to show on the eNB / RRU log file
fflush(stdout);
......@@ -701,15 +701,18 @@ int main ( int argc, char **argv )
pthread_mutex_unlock(&sync_mutex);
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
}
// wait for end of program
LOG_UI(ENB_APP,"TYPE <CTRL-C> TO TERMINATE\n");
// CI -- Flushing the std outputs for the previous marker to show on the eNB / DU / CU log file
fflush(stdout);
fflush(stderr);
// end of CI modifications
//getchar();
if(IS_SOFTMODEM_DOFORMS)
load_softscope("enb");
load_softscope("enb");
itti_wait_tasks_end();
oai_exit=1;
LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
......@@ -727,8 +730,8 @@ int main ( int argc, char **argv )
* threads have been stopped (they partially use the same memory) */
for (int inst = 0; inst < NB_eNB_INST; inst++) {
for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
free_transport(RC.eNB[inst][cc_id]);
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
free_transport(RC.eNB[inst][cc_id]);
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
}
}
......@@ -746,17 +749,17 @@ int main ( int argc, char **argv )
for(ru_id=0; ru_id<RC.nb_RU; ru_id++) {
if (RC.ru[ru_id]->rfdevice.trx_end_func) {
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
}
if (RC.ru[ru_id]->ifdevice.trx_end_func) {
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
}
}
}
terminate_opt();
logClean();
printf("Bye.\n");
......
......@@ -314,7 +314,6 @@ static void get_options(void) {
int timingadv = 0;
uint8_t nfapi_mode = NFAPI_MONOLITHIC;
int simL1flag = 0;
set_default_frame_parms(frame_parms);
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
/* unknown parameters on command line will be checked in main
......@@ -593,7 +592,7 @@ int main( int argc, char **argv ) {
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
get_options ();
set_softmodem_optmask(SOFTMODEM_LTEUE_BIT);
set_softmodem_optmask(SOFTMODEM_LTEUE_BIT);
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
printf("Running with %d UE instances\n",NB_UE_INST);
......@@ -622,7 +621,6 @@ int main( int argc, char **argv ) {
cpuf=get_cpu_freq_GHz();
pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL);
printf("ITTI init\n");
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
......@@ -680,10 +678,7 @@ int main( int argc, char **argv ) {
}
cpuf=get_cpu_freq_GHz();
#if 0 // #ifndef DEADLINE_SCHEDULER
printf("NO deadline scheduler\n");
/* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
cpu_set_t cpuset;
......@@ -692,16 +687,18 @@ int main( int argc, char **argv ) {
CPU_ZERO(&cpuset);
#ifdef CPU_AFFINITY
int j;
if (get_nprocs() > 2) {
for (j = 2; j < get_nprocs(); j++)
CPU_SET(j, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0) {
perror( "pthread_setaffinity_np");
exit_fun("Error setting processor affinity");
}
LOG_I(HW, "Setting the affinity of main function to all CPUs, for device library to use CPU 0 only!\n");
}
......
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