@ -105,7 +105,7 @@ void usage(prog_args_t *args, char *prog) {
printf ( " \t -p PRACH preamble idx [Default %d] \n " , args - > preamble_idx ) ;
printf ( " \t -p PRACH preamble idx [Default %d] \n " , args - > preamble_idx ) ;
printf ( " \t -l Force N_id_2 [Default best] \n " ) ;
printf ( " \t -l Force N_id_2 [Default best] \n " ) ;
printf ( " \t -n nof_subframes [Default %d] \n " , args - > nof_subframes ) ;
printf ( " \t -n nof_subframes [Default %d] \n " , args - > nof_subframes ) ;
printf ( " \t -v [set verbose to debug, default none]\n " ) ;
printf ( " \t -v [set srslte_ verbose to debug, default none]\n " ) ;
}
}
void parse_args ( prog_args_t * args , int argc , char * * argv ) {
void parse_args ( prog_args_t * args , int argc , char * * argv ) {
@ -147,7 +147,7 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
args - > force_N_id_2 = atoi ( argv [ optind ] ) ;
args - > force_N_id_2 = atoi ( argv [ optind ] ) ;
break ;
break ;
case ' v ' :
case ' v ' :
verbose+ + ;
srslte_ verbose+ + ;
break ;
break ;
default :
default :
usage ( args , argv [ 0 ] ) ;
usage ( args , argv [ 0 ] ) ;
@ -184,10 +184,10 @@ enum receiver_state { DECODE_MIB, SEND_PRACH, RECV_RAR, RECV_CONNSETUP} state;
# define NOF_PRACH_SEQUENCES 52
# define NOF_PRACH_SEQUENCES 52
ue_dl_t ue_dl ;
srs_ ue_dl_t ue_dl ;
ue_ul_t ue_ul ;
srslte_ ue_ul_t ue_ul ;
ue_sync_t ue_sync ;
srslte_ ue_sync_t ue_sync ;
prach_t prach ;
srslte_ prach_t prach ;
int prach_buffer_len ;
int prach_buffer_len ;
prog_args_t prog_args ;
prog_args_t prog_args ;
@ -265,20 +265,20 @@ int rar_unpack(uint8_t *buffer, rar_msg_t *msg)
msg - > hdr_type = * ptr + + ;
msg - > hdr_type = * ptr + + ;
if ( msg - > hdr_type = = rar_header_type_bi ) {
if ( msg - > hdr_type = = rar_header_type_bi ) {
ptr + = 2 ;
ptr + = 2 ;
msg - > BI = bit_unpack( & ptr , 4 ) ;
msg - > BI = srslte_ bit_unpack( & ptr , 4 ) ;
ret = SRSLTE_SUCCESS ;
ret = SRSLTE_SUCCESS ;
} else if ( msg - > hdr_type = = rar_header_type_rapid ) {
} else if ( msg - > hdr_type = = rar_header_type_rapid ) {
msg - > RAPID = bit_unpack( & ptr , 6 ) ;
msg - > RAPID = srslte_ bit_unpack( & ptr , 6 ) ;
ptr + + ;
ptr + + ;
msg - > timing_adv_cmd = bit_unpack( & ptr , 11 ) ;
msg - > timing_adv_cmd = srslte_ bit_unpack( & ptr , 11 ) ;
msg - > hopping_flag = * ptr + + ;
msg - > hopping_flag = * ptr + + ;
msg - > rba = bit_unpack( & ptr , 10 ) ;
msg - > rba = srslte_ bit_unpack( & ptr , 10 ) ;
msg - > mcs = bit_unpack( & ptr , 4 ) ;
msg - > mcs = srslte_ bit_unpack( & ptr , 4 ) ;
msg - > tpc_command = ( rar_tpc_command_t ) bit_unpack( & ptr , 3 ) ;
msg - > tpc_command = ( rar_tpc_command_t ) srslte_ bit_unpack( & ptr , 3 ) ;
msg - > ul_delay = * ptr + + ;
msg - > ul_delay = * ptr + + ;
msg - > csi_req = * ptr + + ;
msg - > csi_req = * ptr + + ;
msg - > temp_c_rnti = bit_unpack( & ptr , 16 ) ;
msg - > temp_c_rnti = srslte_ bit_unpack( & ptr , 16 ) ;
ret = SRSLTE_SUCCESS ;
ret = SRSLTE_SUCCESS ;
}
}
}
}
@ -293,13 +293,13 @@ int main(int argc, char **argv) {
int ret ;
int ret ;
srslte_cell_t cell ;
srslte_cell_t cell ;
int64_t sf_cnt ;
int64_t sf_cnt ;
ue_mib_t ue_mib ;
srslte_ ue_mib_t ue_mib ;
void * uhd ;
void * uhd ;
int n ;
int n ;
uint8_t bch_payload [ BCH_PAYLOAD_LEN ] , bch_payload_unpacked [ BCH_PAYLOAD_LEN ] ;
uint8_t bch_payload [ BCH_PAYLOAD_LEN ] , bch_payload_unpacked [ BCH_PAYLOAD_LEN ] ;
uint32_t sfn_offset ;
uint32_t sfn_offset ;
rar_msg_t rar_msg ;
rar_msg_t rar_msg ;
ra_pusch_t ra_pusch ;
srslte_ ra_pusch_t ra_pusch ;
uint32_t rar_window_start = 0 , rar_trials = 0 , rar_window_stop = 0 ;
uint32_t rar_window_start = 0 , rar_trials = 0 , rar_window_stop = 0 ;
srslte_timestamp_t uhd_time ;
srslte_timestamp_t uhd_time ;
srslte_timestamp_t next_tx_time ;
srslte_timestamp_t next_tx_time ;
@ -368,33 +368,33 @@ int main(int argc, char **argv) {
# endif
# endif
if ( ue_mib_init( & ue_mib , cell ) ) {
if ( srslte_ ue_mib_init( & ue_mib , cell ) ) {
fprintf ( stderr , " Error initaiting UE MIB decoder \n " ) ;
fprintf ( stderr , " Error initaiting UE MIB decoder \n " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
if ( prach_init( & prach , srslte_symbol_sz ( cell . nof_prb ) , 0 , 0 , false , 1 ) ) {
if ( srslte_ prach_init( & prach , srslte_symbol_sz ( cell . nof_prb ) , 0 , 0 , false , 1 ) ) {
fprintf ( stderr , " Error initializing PRACH \n " ) ;
fprintf ( stderr , " Error initializing PRACH \n " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
prach_buffer_len = prach . N_seq + prach . N_cp ;
prach_buffer_len = prach . N_seq + prach . N_cp ;
prach_buffer = vec_malloc( prach_buffer_len * sizeof ( cf_t ) ) ;
prach_buffer = srslte_ vec_malloc( prach_buffer_len * sizeof ( cf_t ) ) ;
if ( ! prach_buffer ) {
if ( ! prach_buffer ) {
perror ( " maloc " ) ;
perror ( " maloc " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
if ( prach_gen( & prach , prog_args . preamble_idx , 0 , prog_args . beta_prach , prach_buffer ) ) {
if ( srslte_ prach_gen( & prach , prog_args . preamble_idx , 0 , prog_args . beta_prach , prach_buffer ) ) {
fprintf ( stderr , " Error generating prach sequence \n " ) ;
fprintf ( stderr , " Error generating prach sequence \n " ) ;
return - 1 ;
return - 1 ;
}
}
if ( ue_ul_init( & ue_ul , cell ) ) {
if ( srslte_ ue_ul_init( & ue_ul , cell ) ) {
fprintf ( stderr , " Error initiating UE UL \n " ) ;
fprintf ( stderr , " Error initiating UE UL \n " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
pusch_hopping_cfg_t hop_cfg ;
srslte_ pusch_hopping_cfg_t hop_cfg ;
bzero ( & hop_cfg , sizeof ( pusch_hopping_cfg_t) ) ;
bzero ( & hop_cfg , sizeof ( srslte_ pusch_hopping_cfg_t) ) ;
srslte_refsignal_drms_pusch_cfg_t drms_cfg ;
srslte_refsignal_drms_pusch_cfg_t drms_cfg ;
bzero ( & drms_cfg , sizeof ( srslte_refsignal_drms_pusch_cfg_t ) ) ;
bzero ( & drms_cfg , sizeof ( srslte_refsignal_drms_pusch_cfg_t ) ) ;
drms_cfg . beta_pusch = 1.0 ;
drms_cfg . beta_pusch = 1.0 ;
@ -404,16 +404,16 @@ int main(int argc, char **argv) {
drms_cfg . cyclic_shift = 0 ;
drms_cfg . cyclic_shift = 0 ;
drms_cfg . cyclic_shift_for_drms = 0 ;
drms_cfg . cyclic_shift_for_drms = 0 ;
drms_cfg . en_drms_2 = false ;
drms_cfg . en_drms_2 = false ;
ue_ul_set_pusch_cfg( & ue_ul , & drms_cfg , & hop_cfg ) ;
srslte_ ue_ul_set_pusch_cfg( & ue_ul , & drms_cfg , & hop_cfg ) ;
cf_t * ul_signal = vec_malloc( sizeof ( cf_t ) * SRSLTE_SF_LEN_PRB ( cell . nof_prb ) ) ;
cf_t * ul_signal = srslte_ vec_malloc( sizeof ( cf_t ) * SRSLTE_SF_LEN_PRB ( cell . nof_prb ) ) ;
if ( ! ul_signal ) {
if ( ! ul_signal ) {
perror ( " malloc " ) ;
perror ( " malloc " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
bzero ( ul_signal , sizeof ( cf_t ) * SRSLTE_SF_LEN_PRB ( cell . nof_prb ) ) ;
bzero ( ul_signal , sizeof ( cf_t ) * SRSLTE_SF_LEN_PRB ( cell . nof_prb ) ) ;
if ( ue_dl_init( & ue_dl , cell ) ) {
if ( srs_ ue_dl_init( & ue_dl , cell ) ) {
fprintf ( stderr , " Error initiating UE downlink processing module \n " ) ;
fprintf ( stderr , " Error initiating UE downlink processing module \n " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
@ -423,7 +423,7 @@ int main(int argc, char **argv) {
# ifdef use_usrp
# ifdef use_usrp
if ( ue_sync_init( & ue_sync , cell , cuhd_recv_wrapper_timed , uhd ) ) {
if ( srslte_ ue_sync_init( & ue_sync , cell , cuhd_recv_wrapper_timed , uhd ) ) {
fprintf ( stderr , " Error initiating ue_sync \n " ) ;
fprintf ( stderr , " Error initiating ue_sync \n " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
@ -445,9 +445,9 @@ int main(int argc, char **argv) {
while ( ! go_exit & & ( sf_cnt < prog_args . nof_subframes | | prog_args . nof_subframes = = - 1 ) ) {
while ( ! go_exit & & ( sf_cnt < prog_args . nof_subframes | | prog_args . nof_subframes = = - 1 ) ) {
# ifdef kk
# ifdef kk
ret = ue_sync_get_buffer( & ue_sync , & sf_buffer ) ;
ret = srslte_ ue_sync_get_buffer( & ue_sync , & sf_buffer ) ;
if ( ret < 0 ) {
if ( ret < 0 ) {
fprintf ( stderr , " Error calling ue_sync_work()\n " ) ;
fprintf ( stderr , " Error calling srslte_ ue_sync_work()\n " ) ;
}
}
# else
# else
ret = 1 ;
ret = 1 ;
@ -455,28 +455,28 @@ int main(int argc, char **argv) {
cf_t dummy [ 4 ] ;
cf_t dummy [ 4 ] ;
# endif
# endif
/* ue_sync_get_buffer returns 1 if successfully read 1 aligned subframe */
/* srslte_ ue_sync_get_buffer returns 1 if successfully read 1 aligned subframe */
if ( ret = = 1 ) {
if ( ret = = 1 ) {
if ( state ! = RECV_RAR ) {
if ( state ! = RECV_RAR ) {
/* Run FFT for all subframe data */
/* Run FFT for all subframe data */
srslte_ fft_run _sf( & ue_dl . fft , sf_buffer , ue_dl . sf_symbols ) ;
srslte_ ofdm_tx _sf( & ue_dl . fft , sf_buffer , ue_dl . sf_symbols ) ;
/* Get channel estimates for each port */
/* Get channel estimates for each port */
srslte_chest_dl_estimate ( & ue_dl . chest , ue_dl . sf_symbols , ue_dl . ce , ue_sync_get_sfidx( & ue_sync ) ) ;
srslte_chest_dl_estimate ( & ue_dl . chest , ue_dl . sf_symbols , ue_dl . ce , srslte_ ue_sync_get_sfidx( & ue_sync ) ) ;
}
}
if ( sf_cnt > 1000 ) {
if ( sf_cnt > 1000 ) {
switch ( state ) {
switch ( state ) {
case DECODE_MIB :
case DECODE_MIB :
if ( ue_sync_get_sfidx( & ue_sync ) = = 0 ) {
if ( srslte_ ue_sync_get_sfidx( & ue_sync ) = = 0 ) {
pbch_ decode_reset( & ue_mib . pbch ) ;
decode_reset( & ue_mib . pbch ) ;
n = ue_mib_decode( & ue_mib , sf_buffer , bch_payload_unpacked , NULL , & sfn_offset ) ;
n = srslte_ ue_mib_decode( & ue_mib , sf_buffer , bch_payload_unpacked , NULL , & sfn_offset ) ;
if ( n < 0 ) {
if ( n < 0 ) {
fprintf ( stderr , " Error decoding UE MIB \n " ) ;
fprintf ( stderr , " Error decoding UE MIB \n " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
} else if ( n = = MIB_FOUND) {
} else if ( n = = SRSLTE_UE_ MIB_FOUND) {
bit_unpack_vector( bch_payload_unpacked , bch_payload , BCH_PAYLOAD_LEN ) ;
srslte_ bit_unpack_vector( bch_payload_unpacked , bch_payload , BCH_PAYLOAD_LEN ) ;
bcch_bch_unpack ( bch_payload , BCH_PAYLOAD_LEN , & cell , & sfn ) ;
bcch_bch_unpack ( bch_payload , BCH_PAYLOAD_LEN , & cell , & sfn ) ;
printf ( " Decoded MIB. SFN: %d, offset: %d \n " , sfn , sfn_offset ) ;
printf ( " Decoded MIB. SFN: %d, offset: %d \n " , sfn , sfn_offset ) ;
sfn = ( sfn + sfn_offset ) % 1024 ;
sfn = ( sfn + sfn_offset ) % 1024 ;
@ -487,8 +487,8 @@ int main(int argc, char **argv) {
case SEND_PRACH :
case SEND_PRACH :
# ifdef kk
# ifdef kk
if ( ( ( sfn % 2 ) = = 1 ) & & ( ue_sync_get_sfidx( & ue_sync ) = = 1 ) ) {
if ( ( ( sfn % 2 ) = = 1 ) & & ( srslte_ ue_sync_get_sfidx( & ue_sync ) = = 1 ) ) {
ue_sync_get_last_timestamp( & ue_sync , & uhd_time ) ;
srslte_ ue_sync_get_last_timestamp( & ue_sync , & uhd_time ) ;
srslte_timestamp_copy ( & next_tx_time , & uhd_time ) ;
srslte_timestamp_copy ( & next_tx_time , & uhd_time ) ;
srslte_timestamp_add ( & next_tx_time , 0 , 0.01 ) ; // send next frame (10 ms)
srslte_timestamp_add ( & next_tx_time , 0 , 0.01 ) ; // send next frame (10 ms)
@ -508,7 +508,7 @@ int main(int argc, char **argv) {
srslte_timestamp_copy ( & tx_time , & rx_time ) ;
srslte_timestamp_copy ( & tx_time , & rx_time ) ;
printf ( " Transmitting PRACH... \n " ) ;
printf ( " Transmitting PRACH... \n " ) ;
vec_save_file( " prach_tx" , prach_buffers [ 7 ] , prach_buffer_len * sizeof ( cf_t ) ) ;
srslte_ vec_save_file( " srslte_ prach_tx" , prach_buffers [ 7 ] , prach_buffer_len * sizeof ( cf_t ) ) ;
while ( 1 ) {
while ( 1 ) {
srslte_timestamp_add ( & tx_time , 0 , 0.001 ) ; // send every (10 ms)
srslte_timestamp_add ( & tx_time , 0 , 0.001 ) ; // send every (10 ms)
cuhd_send_timed ( uhd , prach_buffers [ 7 ] , prach_buffer_len ,
cuhd_send_timed ( uhd , prach_buffers [ 7 ] , prach_buffer_len ,
@ -520,9 +520,9 @@ int main(int argc, char **argv) {
case RECV_RAR :
case RECV_RAR :
# ifdef kk
# ifdef kk
if ( ( sfn = = rar_window_start & & ue_sync_get_sfidx( & ue_sync ) > 3 ) | | sfn > rar_window_start ) {
if ( ( sfn = = rar_window_start & & srslte_ ue_sync_get_sfidx( & ue_sync ) > 3 ) | | sfn > rar_window_start ) {
printf ( " Looking for RAR in sfn: %d sf_idx: %d \n " , sfn , ue_sync_get_sfidx( & ue_sync ) ) ;
printf ( " Looking for RAR in sfn: %d sf_idx: %d \n " , sfn , srslte_ ue_sync_get_sfidx( & ue_sync ) ) ;
n = ue_dl_decode_rnti( & ue_dl , sf_buffer , data_rx , ue_sync_get_sfidx( & ue_sync ) , ra_rnti ) ;
n = srs_ ue_dl_decode_rnti( & ue_dl , sf_buffer , data_rx , srslte_ ue_sync_get_sfidx( & ue_sync ) , ra_rnti ) ;
if ( n < 0 ) {
if ( n < 0 ) {
fprintf ( stderr , " Error decoding UE DL \n " ) ; fflush ( stdout ) ;
fprintf ( stderr , " Error decoding UE DL \n " ) ; fflush ( stdout ) ;
} else if ( n > 0 ) {
} else if ( n > 0 ) {
@ -535,14 +535,14 @@ int main(int argc, char **argv) {
//cuhd_flush_buffer(uhd);
//cuhd_flush_buffer(uhd);
rar_msg_fprint ( stdout , & rar_msg ) ;
rar_msg_fprint ( stdout , & rar_msg ) ;
dci_rar_to_ra_ul( rar_msg . rba , rar_msg . mcs , rar_msg . hopping_flag , cell . nof_prb , & ra_pusch ) ;
srslte_ dci_rar_to_ra_ul( rar_msg . rba , rar_msg . mcs , rar_msg . hopping_flag , cell . nof_prb , & ra_pusch ) ;
ra_pusch_fprint( stdout , & ra_pusch , cell . nof_prb ) ;
srslte_ ra_pusch_fprint( stdout , & ra_pusch , cell . nof_prb ) ;
ra_ul_alloc( & ra_pusch . prb_alloc , & ra_pusch , 0 , cell . nof_prb ) ;
srslte_ ra_ul_alloc( & ra_pusch . prb_alloc , & ra_pusch , 0 , cell . nof_prb ) ;
ue_sync_get_last_timestamp( & ue_sync , & uhd_time ) ;
srslte_ ue_sync_get_last_timestamp( & ue_sync , & uhd_time ) ;
bit_pack_vector( ( uint8_t * ) conn_request_msg , data , ra_pusch . mcs . tbs ) ;
srslte_ bit_pack_vector( ( uint8_t * ) conn_request_msg , data , ra_pusch . mcs . tbs ) ;
uint32_t n_ta = srssrslte_N_ta_new_rar ( rar_msg . timing_adv_cmd ) ;
uint32_t n_ta = srssrslte_N_ta_new_rar ( rar_msg . timing_adv_cmd ) ;
printf ( " ta: %d, n_ta: %d \n " , rar_msg . timing_adv_cmd , n_ta ) ;
printf ( " ta: %d, n_ta: %d \n " , rar_msg . timing_adv_cmd , n_ta ) ;
@ -554,15 +554,15 @@ int main(int argc, char **argv) {
const uint32_t rv [ N_TX ] = { 0 , 2 , 3 , 1 , 0 } ;
const uint32_t rv [ N_TX ] = { 0 , 2 , 3 , 1 , 0 } ;
for ( int i = 0 ; i < N_TX ; i + + ) {
for ( int i = 0 ; i < N_TX ; i + + ) {
ra_pusch . rv_idx = rv [ i ] ;
ra_pusch . rv_idx = rv [ i ] ;
ul_sf_idx = ( ue_sync_get_sfidx( & ue_sync ) + 6 + i * 8 ) % 10 ;
ul_sf_idx = ( srslte_ ue_sync_get_sfidx( & ue_sync ) + 6 + i * 8 ) % 10 ;
n = ue_ul_pusch_encode_rnti( & ue_ul , & ra_pusch , data , ul_sf_idx , rar_msg . temp_c_rnti , ul_signal ) ;
n = srslte_ ue_ul_srslte _pusch_encode_rnti( & ue_ul , & ra_pusch , data , ul_sf_idx , rar_msg . temp_c_rnti , ul_signal ) ;
if ( n < 0 ) {
if ( n < 0 ) {
fprintf ( stderr , " Error encoding PUSCH \n " ) ;
fprintf ( stderr , " Error encoding PUSCH \n " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
vec_sc_prod_cfc( ul_signal , prog_args . beta_pusch , ul_signal , SRSLTE_SF_LEN_PRB ( cell . nof_prb ) ) ;
srslte_ vec_sc_prod_cfc( ul_signal , prog_args . beta_pusch , ul_signal , SRSLTE_SF_LEN_PRB ( cell . nof_prb ) ) ;
srslte_timestamp_copy ( & next_tx_time , & uhd_time ) ;
srslte_timestamp_copy ( & next_tx_time , & uhd_time ) ;
srslte_timestamp_add ( & next_tx_time , 0 , 0.006 + i * 0.008 - time_adv_sec ) ; // send after 6 sub-frames (6 ms)
srslte_timestamp_add ( & next_tx_time , 0 , 0.006 + i * 0.008 - time_adv_sec ) ; // send after 6 sub-frames (6 ms)
@ -593,7 +593,7 @@ int main(int argc, char **argv) {
}
}
# else
# else
ra_pusch . mcs . mod = LTE_QPSK;
ra_pusch . mcs . mod = SRS LTE_MOD _QPSK;
ra_pusch . mcs . tbs = 94 ;
ra_pusch . mcs . tbs = 94 ;
ra_pusch . rv_idx = 0 ;
ra_pusch . rv_idx = 0 ;
ra_pusch . prb_alloc . freq_hopping = 0 ;
ra_pusch . prb_alloc . freq_hopping = 0 ;
@ -603,15 +603,15 @@ int main(int argc, char **argv) {
uint32_t ul_sf_idx = 4 ;
uint32_t ul_sf_idx = 4 ;
printf ( " L: %d \n " , ra_pusch . prb_alloc . L_prb ) ;
printf ( " L: %d \n " , ra_pusch . prb_alloc . L_prb ) ;
// ue_ul_set_cfo(&ue_ul, sync_get_cfo(&ue_sync.strack));
// srslte_ ue_ul_set_cfo(&ue_ul, srslte_ sync_get_cfo(&ue_sync.strack));
bit_pack_vector( ( uint8_t * ) conn_request_msg , data , ra_pusch . mcs . tbs ) ;
srslte_ bit_pack_vector( ( uint8_t * ) conn_request_msg , data , ra_pusch . mcs . tbs ) ;
n = ue_ul_pusch_encode_rnti( & ue_ul , & ra_pusch , data , ul_sf_idx , 111 , ul_signal ) ;
n = srslte_ ue_ul_srslte _pusch_encode_rnti( & ue_ul , & ra_pusch , data , ul_sf_idx , 111 , ul_signal ) ;
if ( n < 0 ) {
if ( n < 0 ) {
fprintf ( stderr , " Error encoding PUSCH \n " ) ;
fprintf ( stderr , " Error encoding PUSCH \n " ) ;
exit ( - 1 ) ;
exit ( - 1 ) ;
}
}
vec_save_file( " pusch_tx" , ul_signal , SRSLTE_SF_LEN_PRB ( cell . nof_prb ) * sizeof ( cf_t ) ) ;
srslte_ vec_save_file( " srslte_ pusch_tx" , ul_signal , SRSLTE_SF_LEN_PRB ( cell . nof_prb ) * sizeof ( cf_t ) ) ;
# ifdef use_usrp
# ifdef use_usrp
cuhd_recv_with_time ( uhd , dummy , 4 , 1 , & uhd_time . full_secs , & uhd_time . frac_secs ) ;
cuhd_recv_with_time ( uhd , dummy , 4 , 1 , & uhd_time . full_secs , & uhd_time . frac_secs ) ;
@ -629,19 +629,19 @@ int main(int argc, char **argv) {
break ;
break ;
case RECV_CONNSETUP :
case RECV_CONNSETUP :
if ( ue_sync_get_sfidx( & ue_sync ) = = ( ul_sf_idx + 4 ) % 10 ) {
if ( srslte_ ue_sync_get_sfidx( & ue_sync ) = = ( ul_sf_idx + 4 ) % 10 ) {
// verbose=VERBOSE_DEBUG;
// srslte_ verbose=SRSLTE_ VERBOSE_DEBUG;
vec_save_file( " connsetup " , sf_buffer , SRSLTE_SF_LEN_PRB ( cell . nof_prb ) * sizeof ( cf_t ) ) ;
srslte_ vec_save_file( " connsetup " , sf_buffer , SRSLTE_SF_LEN_PRB ( cell . nof_prb ) * sizeof ( cf_t ) ) ;
} else {
} else {
// verbose=VERBOSE_NONE;
// srslte_ verbose=SRSLTE_ VERBOSE_NONE;
}
}
printf ( " Looking for ConnectionSetup in sfn: %d sf_idx: %d, RNTI: %d \n " , sfn , ue_sync_get_sfidx( & ue_sync ) , rar_msg . temp_c_rnti ) ;
printf ( " Looking for ConnectionSetup in sfn: %d sf_idx: %d, RNTI: %d \n " , sfn , srslte_ ue_sync_get_sfidx( & ue_sync ) , rar_msg . temp_c_rnti ) ;
n = ue_dl_decode_rnti( & ue_dl , sf_buffer , data_rx , ue_sync_get_sfidx( & ue_sync ) , rar_msg . temp_c_rnti ) ;
n = srs_ ue_dl_decode_rnti( & ue_dl , sf_buffer , data_rx , srslte_ ue_sync_get_sfidx( & ue_sync ) , rar_msg . temp_c_rnti ) ;
if ( n < 0 ) {
if ( n < 0 ) {
fprintf ( stderr , " Error decoding UE DL \n " ) ; fflush ( stdout ) ;
fprintf ( stderr , " Error decoding UE DL \n " ) ; fflush ( stdout ) ;
} else if ( n > 0 ) {
} else if ( n > 0 ) {
printf ( " Received ConnectionSetup len: %d. \n " , n ) ;
printf ( " Received ConnectionSetup len: %d. \n " , n ) ;
vec_fprint_hex( stdout , data_rx , n ) ;
srslte_ vec_fprint_hex( stdout , data_rx , n ) ;
} else {
} else {
conn_setup_trial + + ;
conn_setup_trial + + ;
if ( conn_setup_trial = = 20 ) {
if ( conn_setup_trial = = 20 ) {
@ -651,7 +651,7 @@ int main(int argc, char **argv) {
break ;
break ;
}
}
if ( ue_sync_get_sfidx( & ue_sync ) = = 9 ) {
if ( srslte_ ue_sync_get_sfidx( & ue_sync ) = = 9 ) {
sfn + + ;
sfn + + ;
if ( sfn = = 1024 ) {
if ( sfn = = 1024 ) {
sfn = 0 ;
sfn = 0 ;
@ -662,17 +662,17 @@ int main(int argc, char **argv) {
} else if ( ret = = 0 ) {
} else if ( ret = = 0 ) {
printf ( " Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d \r " ,
printf ( " Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d \r " ,
s ync_get_peak_value( & ue_sync . sfind ) ,
s rslte_s ync_get_peak_value( & ue_sync . sfind ) ,
ue_sync . frame_total_cnt , ue_sync . state ) ;
ue_sync . frame_total_cnt , ue_sync . state ) ;
}
}
sf_cnt + + ;
sf_cnt + + ;
} // Main loop
} // Main loop
ue_dl_free( & ue_dl ) ;
srs_ ue_dl_free( & ue_dl ) ;
ue_sync_free( & ue_sync ) ;
srslte_ ue_sync_free( & ue_sync ) ;
ue_mib_free( & ue_mib ) ;
srslte_ ue_mib_free( & ue_mib ) ;
cuhd_close ( uhd ) ;
cuhd_close ( uhd ) ;
printf ( " \n Bye \n " ) ;
printf ( " \n Bye \n " ) ;
exit ( 0 ) ;
exit ( 0 ) ;