Clang format UE, eNB and lib (#850)

* Clang-formated UE, eNB and lib.
* Fixed compiling errors from clang-format.
* Fix linking issues introduced by clang-format
* Fix poor formating in initializing arrays of arrays.
* Fix mistake in conflict resolution on rm_turbo.c
* Re-apply clang format to gtpc_ies.h
master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 2ed2e35aa7
commit c5979f59eb

@ -23,24 +23,25 @@
char CHECK_FUNCTION_EXISTS(); char CHECK_FUNCTION_EXISTS();
#ifdef __CLASSIC_C__ #ifdef __CLASSIC_C__
int main(){ int main()
int ac; {
char*av[]; int ac;
char* av[];
#else #else
int main(int ac, char*av[]){ int main(int ac, char* av[])
{
#endif #endif
float ac2 = sqrtf(rand()); float ac2 = sqrtf(rand());
CHECK_FUNCTION_EXISTS(); CHECK_FUNCTION_EXISTS();
if(ac2 * ac > 1000) if (ac2 * ac > 1000) {
{
return *av[0]; return *av[0];
} }
return 0; return 0;
} }
#else /* CHECK_FUNCTION_EXISTS */ #else /* CHECK_FUNCTION_EXISTS */
# error "CHECK_FUNCTION_EXISTS has to specify the function" #error "CHECK_FUNCTION_EXISTS has to specify the function"
#endif /* CHECK_FUNCTION_EXISTS */ #endif /* CHECK_FUNCTION_EXISTS */

@ -19,37 +19,35 @@
* *
*/ */
#include <math.h>
#include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <math.h>
#include <sys/time.h> #include <sys/time.h>
#include <signal.h> #include <unistd.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/srslte.h" #include "srslte/srslte.h"
#include "srslte/phy/rf/rf_utils.h"
#include "srslte/common/crash_handler.h" #include "srslte/common/crash_handler.h"
#include "srslte/phy/rf/rf_utils.h"
#ifndef DISABLE_RF #ifndef DISABLE_RF
#include "srslte/phy/rf/rf.h" #include "srslte/phy/rf/rf.h"
#endif #endif
#define MHZ 1000000 #define MHZ 1000000
#define SAMP_FREQ 1920000 #define SAMP_FREQ 1920000
#define FLEN 9600 #define FLEN 9600
#define FLEN_PERIOD 0.005 #define FLEN_PERIOD 0.005
#define MAX_EARFCN 1000 #define MAX_EARFCN 1000
int band = -1;
int band = -1; int earfcn_start = -1, earfcn_end = -1;
int earfcn_start=-1, earfcn_end = -1;
cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSLTE_DEFAULT_MAX_FRAMES_PBCH, cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSLTE_DEFAULT_MAX_FRAMES_PBCH,
.max_frames_pss = SRSLTE_DEFAULT_MAX_FRAMES_PSS, .max_frames_pss = SRSLTE_DEFAULT_MAX_FRAMES_PSS,
@ -61,14 +59,15 @@ struct cells {
srslte_cell_t cell; srslte_cell_t cell;
float freq; float freq;
int dl_earfcn; int dl_earfcn;
float power; float power;
}; };
struct cells results[1024]; struct cells results[1024];
float rf_gain = 70.0; float rf_gain = 70.0;
char *rf_args=""; char* rf_args = "";
void usage(char *prog) { void usage(char* prog)
{
printf("Usage: %s [agsendtvb] -b band\n", prog); printf("Usage: %s [agsendtvb] -b band\n", prog);
printf("\t-a RF args [Default %s]\n", rf_args); printf("\t-a RF args [Default %s]\n", rf_args);
printf("\t-g RF gain [Default %.2f dB]\n", rf_gain); printf("\t-g RF gain [Default %.2f dB]\n", rf_gain);
@ -78,34 +77,35 @@ void usage(char *prog) {
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srslte_verbose to debug, default none]\n");
} }
void parse_args(int argc, char **argv) { void parse_args(int argc, char** argv)
{
int opt; int opt;
while ((opt = getopt(argc, argv, "agsendvb")) != -1) { while ((opt = getopt(argc, argv, "agsendvb")) != -1) {
switch(opt) { switch (opt) {
case 'a': case 'a':
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'b': case 'b':
band = (int)strtol(argv[optind], NULL, 10); band = (int)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
earfcn_start = (int)strtol(argv[optind], NULL, 10); earfcn_start = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
earfcn_end = (int)strtol(argv[optind], NULL, 10); earfcn_end = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell_detect_config.max_frames_pss = (uint32_t)strtol(argv[optind], NULL, 10); cell_detect_config.max_frames_pss = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'g': case 'g':
rf_gain = strtof(argv[optind], NULL); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
} }
} }
if (band == -1) { if (band == -1) {
@ -132,28 +132,29 @@ void sig_int_handler(int signo)
float srslte_rf_set_rx_gain_wrapper(void* h, float f) float srslte_rf_set_rx_gain_wrapper(void* h, float f)
{ {
return srslte_rf_set_rx_gain((srslte_rf_t*) h, f); return srslte_rf_set_rx_gain((srslte_rf_t*)h, f);
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
int n; {
srslte_rf_t rf; int n;
srslte_ue_cellsearch_t cs; srslte_rf_t rf;
srslte_ue_cellsearch_result_t found_cells[3]; srslte_ue_cellsearch_t cs;
int nof_freqs; srslte_ue_cellsearch_result_t found_cells[3];
srslte_earfcn_t channels[MAX_EARFCN]; int nof_freqs;
uint32_t freq; srslte_earfcn_t channels[MAX_EARFCN];
uint32_t n_found_cells=0; uint32_t freq;
uint32_t n_found_cells = 0;
srslte_debug_handle_crash(argc, argv); srslte_debug_handle_crash(argc, argv);
parse_args(argc, argv); parse_args(argc, argv);
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open(&rf, rf_args)) { if (srslte_rf_open(&rf, rf_args)) {
ERROR("Error opening rf\n"); ERROR("Error opening rf\n");
exit(-1); exit(-1);
} }
if (!cell_detect_config.init_agc) { if (!cell_detect_config.init_agc) {
srslte_rf_set_rx_gain(&rf, rf_gain); srslte_rf_set_rx_gain(&rf, rf_gain);
} else { } else {
@ -162,12 +163,12 @@ int main(int argc, char **argv) {
ERROR("Error opening rf\n"); ERROR("Error opening rf\n");
exit(-1); exit(-1);
} }
srslte_rf_set_rx_gain(&rf, 50); srslte_rf_set_rx_gain(&rf, 50);
} }
// Supress RF messages // Supress RF messages
srslte_rf_suppress_stdout(&rf); srslte_rf_suppress_stdout(&rf);
nof_freqs = srslte_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN); nof_freqs = srslte_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN);
if (nof_freqs < 0) { if (nof_freqs < 0) {
ERROR("Error getting EARFCN list\n"); ERROR("Error getting EARFCN list\n");
@ -189,7 +190,7 @@ int main(int argc, char **argv) {
srslte_ue_cellsearch_set_nof_valid_frames(&cs, cell_detect_config.nof_valid_pss_frames); srslte_ue_cellsearch_set_nof_valid_frames(&cs, cell_detect_config.nof_valid_pss_frames);
} }
if (cell_detect_config.init_agc) { if (cell_detect_config.init_agc) {
srslte_rf_info_t *rf_info = srslte_rf_get_info(&rf); srslte_rf_info_t* rf_info = srslte_rf_get_info(&rf);
srslte_ue_sync_start_agc(&cs.ue_sync, srslte_ue_sync_start_agc(&cs.ue_sync,
srslte_rf_set_rx_gain_wrapper, srslte_rf_set_rx_gain_wrapper,
rf_info->min_rx_gain, rf_info->min_rx_gain,
@ -197,11 +198,11 @@ int main(int argc, char **argv) {
cell_detect_config.init_agc); cell_detect_config.init_agc);
} }
for (freq=0;freq<nof_freqs && !go_exit;freq++) { for (freq = 0; freq < nof_freqs && !go_exit; freq++) {
/* set rf_freq */ /* set rf_freq */
srslte_rf_set_rx_freq(&rf, 0, (double)channels[freq].fd * MHZ); srslte_rf_set_rx_freq(&rf, 0, (double)channels[freq].fd * MHZ);
INFO("Set rf_freq to %.3f MHz\n", (double) channels[freq].fd * MHZ/1000000); INFO("Set rf_freq to %.3f MHz\n", (double)channels[freq].fd * MHZ / 1000000);
printf( printf(
"[%3d/%d]: EARFCN %d Freq. %.2f MHz looking for PSS.\n", freq, nof_freqs, channels[freq].id, channels[freq].fd); "[%3d/%d]: EARFCN %d Freq. %.2f MHz looking for PSS.\n", freq, nof_freqs, channels[freq].id, channels[freq].fd);
@ -210,24 +211,24 @@ int main(int argc, char **argv) {
if (SRSLTE_VERBOSE_ISINFO()) { if (SRSLTE_VERBOSE_ISINFO()) {
printf("\n"); printf("\n");
} }
bzero(found_cells, 3*sizeof(srslte_ue_cellsearch_result_t));
INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ/1000000); bzero(found_cells, 3 * sizeof(srslte_ue_cellsearch_result_t));
INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ / 1000000);
srslte_rf_set_rx_srate(&rf, SRSLTE_CS_SAMP_FREQ); srslte_rf_set_rx_srate(&rf, SRSLTE_CS_SAMP_FREQ);
INFO("Starting receiver...\n"); INFO("Starting receiver...\n");
srslte_rf_start_rx_stream(&rf, false); srslte_rf_start_rx_stream(&rf, false);
n = srslte_ue_cellsearch_scan(&cs, found_cells, NULL); n = srslte_ue_cellsearch_scan(&cs, found_cells, NULL);
if (n < 0) { if (n < 0) {
ERROR("Error searching cell\n"); ERROR("Error searching cell\n");
exit(-1); exit(-1);
} else if (n > 0) { } else if (n > 0) {
for (int i=0;i<3;i++) { for (int i = 0; i < 3; i++) {
if (found_cells[i].psr > 2.0) { if (found_cells[i].psr > 2.0) {
srslte_cell_t cell; srslte_cell_t cell;
cell.id = found_cells[i].cell_id; cell.id = found_cells[i].cell_id;
cell.cp = found_cells[i].cp; cell.cp = found_cells[i].cp;
int ret = rf_mib_decoder(&rf, 1, &cell_detect_config, &cell, NULL); int ret = rf_mib_decoder(&rf, 1, &cell_detect_config, &cell, NULL);
if (ret < 0) { if (ret < 0) {
ERROR("Error decoding MIB\n"); ERROR("Error decoding MIB\n");
@ -237,19 +238,19 @@ int main(int argc, char **argv) {
printf("Found CELL ID %d. %d PRB, %d ports\n", cell.id, cell.nof_prb, cell.nof_ports); printf("Found CELL ID %d. %d PRB, %d ports\n", cell.id, cell.nof_prb, cell.nof_ports);
if (cell.nof_ports > 0) { if (cell.nof_ports > 0) {
results[n_found_cells].cell = cell; results[n_found_cells].cell = cell;
results[n_found_cells].freq = channels[freq].fd; results[n_found_cells].freq = channels[freq].fd;
results[n_found_cells].dl_earfcn = channels[freq].id; results[n_found_cells].dl_earfcn = channels[freq].id;
results[n_found_cells].power = found_cells[i].peak; results[n_found_cells].power = found_cells[i].peak;
n_found_cells++; n_found_cells++;
} }
} }
} }
} }
} }
} }
printf("\n\nFound %d cells\n", n_found_cells); printf("\n\nFound %d cells\n", n_found_cells);
for (int i=0;i<n_found_cells;i++) { for (int i = 0; i < n_found_cells; i++) {
printf("Found CELL %.1f MHz, EARFCN=%d, PHYID=%d, %d PRB, %d ports, PSS power=%.1f dBm\n", printf("Found CELL %.1f MHz, EARFCN=%d, PHYID=%d, %d PRB, %d ports, PSS power=%.1f dBm\n",
results[i].freq, results[i].freq,
results[i].dl_earfcn, results[i].dl_earfcn,
@ -258,12 +259,10 @@ int main(int argc, char **argv) {
results[i].cell.nof_ports, results[i].cell.nof_ports,
srslte_convert_power_to_dB(results[i].power)); srslte_convert_power_to_dB(results[i].power));
} }
printf("\nBye\n"); printf("\nBye\n");
srslte_ue_cellsearch_free(&cs); srslte_ue_cellsearch_free(&cs);
srslte_rf_close(&rf); srslte_rf_close(&rf);
exit(0); exit(0);
} }

@ -19,37 +19,36 @@
* *
*/ */
#include "srslte/common/crash_handler.h"
#include "srslte/common/gen_mch_tables.h"
#include "srslte/srslte.h"
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <sys/select.h> #include <sys/select.h>
#include <pthread.h> #include <unistd.h>
#include <semaphore.h>
#include <signal.h>
#include "srslte/common/crash_handler.h"
#include "srslte/common/gen_mch_tables.h"
#include "srslte/srslte.h"
#define UE_CRNTI 0x1234 #define UE_CRNTI 0x1234
#define M_CRNTI 0xFFFD #define M_CRNTI 0xFFFD
#ifndef DISABLE_RF #ifndef DISABLE_RF
#include "srslte/phy/rf/rf.h"
#include "srslte/phy/common/phy_common.h" #include "srslte/phy/common/phy_common.h"
#include "srslte/phy/rf/rf.h"
srslte_rf_t rf; srslte_rf_t rf;
#else #else
#pragma message "Compiling pdsch_ue with no RF support" #pragma message "Compiling pdsch_ue with no RF support"
#endif #endif
char *output_file_name = NULL; char* output_file_name = NULL;
#define LEFT_KEY 68 #define LEFT_KEY 68
#define RIGHT_KEY 67 #define RIGHT_KEY 67
#define UP_KEY 65 #define UP_KEY 65
#define DOWN_KEY 66 #define DOWN_KEY 66
srslte_cell_t cell = { srslte_cell_t cell = {
25, // nof_prb 25, // nof_prb
@ -63,67 +62,65 @@ srslte_cell_t cell = {
}; };
uint16_t c = -1; uint16_t c = -1;
int net_port = -1; // -1 generates random dataThat means there is some problem sending samples to the device int net_port = -1; // -1 generates random dataThat means there is some problem sending samples to the device
uint32_t cfi = 2; uint32_t cfi = 2;
uint32_t mcs_idx = 1, last_mcs_idx = 1; uint32_t mcs_idx = 1, last_mcs_idx = 1;
int nof_frames = -1; int nof_frames = -1;
srslte_tm_t transmission_mode = SRSLTE_TM1; srslte_tm_t transmission_mode = SRSLTE_TM1;
uint32_t nof_tb = 1; uint32_t nof_tb = 1;
uint32_t multiplex_pmi = 0; uint32_t multiplex_pmi = 0;
uint32_t multiplex_nof_layers = 1; uint32_t multiplex_nof_layers = 1;
uint8_t mbsfn_sf_mask = 32; uint8_t mbsfn_sf_mask = 32;
int mbsfn_area_id = -1; int mbsfn_area_id = -1;
char *rf_args = ""; char* rf_args = "";
char *rf_dev = ""; char* rf_dev = "";
float rf_amp = 0.8, rf_gain = 60.0, rf_freq = 2400000000; float rf_amp = 0.8, rf_gain = 60.0, rf_freq = 2400000000;
static bool enable_256qam = false; static bool enable_256qam = false;
float output_file_snr = +INFINITY; float output_file_snr = +INFINITY;
bool null_file_sink=false; bool null_file_sink = false;
srslte_filesink_t fsink; srslte_filesink_t fsink;
srslte_ofdm_t ifft[SRSLTE_MAX_PORTS]; srslte_ofdm_t ifft[SRSLTE_MAX_PORTS];
srslte_ofdm_t ifft_mbsfn; srslte_ofdm_t ifft_mbsfn;
srslte_pbch_t pbch; srslte_pbch_t pbch;
srslte_pcfich_t pcfich; srslte_pcfich_t pcfich;
srslte_pdcch_t pdcch; srslte_pdcch_t pdcch;
srslte_pdsch_t pdsch; srslte_pdsch_t pdsch;
srslte_pdsch_cfg_t pdsch_cfg; srslte_pdsch_cfg_t pdsch_cfg;
srslte_pmch_t pmch; srslte_pmch_t pmch;
srslte_pmch_cfg_t pmch_cfg; srslte_pmch_cfg_t pmch_cfg;
srslte_softbuffer_tx_t *softbuffers[SRSLTE_MAX_CODEWORDS]; srslte_softbuffer_tx_t* softbuffers[SRSLTE_MAX_CODEWORDS];
srslte_regs_t regs; srslte_regs_t regs;
srslte_dci_dl_t dci_dl; srslte_dci_dl_t dci_dl;
int rvidx[SRSLTE_MAX_CODEWORDS] = {0, 0}; int rvidx[SRSLTE_MAX_CODEWORDS] = {0, 0};
cf_t *sf_buffer[SRSLTE_MAX_PORTS] = {NULL}, *output_buffer [SRSLTE_MAX_PORTS] = {NULL};
cf_t *sf_buffer[SRSLTE_MAX_PORTS] = {NULL}, *output_buffer[SRSLTE_MAX_PORTS] = {NULL};
int sf_n_re, sf_n_samples; int sf_n_re, sf_n_samples;
pthread_t net_thread; pthread_t net_thread;
void *net_thread_fnc(void *arg); void* net_thread_fnc(void* arg);
sem_t net_sem; sem_t net_sem;
bool net_packet_ready = false; bool net_packet_ready = false;
srslte_netsource_t net_source; srslte_netsource_t net_source;
srslte_netsink_t net_sink; srslte_netsink_t net_sink;
int prbset_num = 1, last_prbset_num = 1; int prbset_num = 1, last_prbset_num = 1;
int prbset_orig = 0; int prbset_orig = 0;
//#define DATA_BUFF_SZ 1024*128 //#define DATA_BUFF_SZ 1024*128
//uint8_t data[8*DATA_BUFF_SZ], data2[DATA_BUFF_SZ]; // uint8_t data[8*DATA_BUFF_SZ], data2[DATA_BUFF_SZ];
//uint8_t data_tmp[DATA_BUFF_SZ]; // uint8_t data_tmp[DATA_BUFF_SZ];
#define DATA_BUFF_SZ 1024 * 1024
#define DATA_BUFF_SZ 1024*1024
uint8_t *data_mbms, *data[2], data2[DATA_BUFF_SZ]; uint8_t *data_mbms, *data[2], data2[DATA_BUFF_SZ];
uint8_t data_tmp[DATA_BUFF_SZ]; uint8_t data_tmp[DATA_BUFF_SZ];
void usage(char *prog) { void usage(char* prog)
{
printf("Usage: %s [Iagmfoncvpuxb]\n", prog); printf("Usage: %s [Iagmfoncvpuxb]\n", prog);
#ifndef DISABLE_RF #ifndef DISABLE_RF
printf("\t-I RF device [Default %s]\n", rf_dev); printf("\t-I RF device [Default %s]\n", rf_dev);
@ -143,7 +140,9 @@ void usage(char *prog) {
printf("\t-x Transmission mode [1-4] [Default %d]\n", transmission_mode + 1); printf("\t-x Transmission mode [1-4] [Default %d]\n", transmission_mode + 1);
printf("\t-b Precoding Matrix Index (multiplex mode only)* [Default %d]\n", multiplex_pmi); printf("\t-b Precoding Matrix Index (multiplex mode only)* [Default %d]\n", multiplex_pmi);
printf("\t-w Number of codewords/layers (multiplex mode only)* [Default %d]\n", multiplex_nof_layers); printf("\t-w Number of codewords/layers (multiplex mode only)* [Default %d]\n", multiplex_nof_layers);
printf("\t-u listen TCP/UDP port for input data (if mbsfn is active then the stream is over mbsfn only) (-1 is random) [Default %d]\n", net_port); printf("\t-u listen TCP/UDP port for input data (if mbsfn is active then the stream is over mbsfn only) (-1 is "
"random) [Default %d]\n",
net_port);
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srslte_verbose to debug, default none]\n");
printf("\t-s output file SNR [Default %f]\n", output_file_snr); printf("\t-s output file SNR [Default %f]\n", output_file_snr);
printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", enable_256qam ? "enabled" : "disabled"); printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", enable_256qam ? "enabled" : "disabled");
@ -151,71 +150,72 @@ void usage(char *prog) {
printf("\t*: See 3GPP 36.212 Table 5.3.3.1.5-4 for more information\n"); printf("\t*: See 3GPP 36.212 Table 5.3.3.1.5-4 for more information\n");
} }
void parse_args(int argc, char **argv) { void parse_args(int argc, char** argv)
{
int opt; int opt;
while ((opt = getopt(argc, argv, "IadglfmoncpqvutxbwMsB")) != -1) { while ((opt = getopt(argc, argv, "IadglfmoncpqvutxbwMsB")) != -1) {
switch (opt) { switch (opt) {
case 'I': case 'I':
rf_dev = argv[optind]; rf_dev = argv[optind];
break; break;
case 'a': case 'a':
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'g': case 'g':
rf_gain = strtof(argv[optind], NULL); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'l': case 'l':
rf_amp = strtof(argv[optind], NULL); rf_amp = strtof(argv[optind], NULL);
break; break;
case 'f': case 'f':
rf_freq = strtof(argv[optind], NULL); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'o': case 'o':
output_file_name = argv[optind]; output_file_name = argv[optind];
break; break;
case 'm': case 'm':
mcs_idx = (uint32_t)strtol(argv[optind], NULL, 10); mcs_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'u': case 'u':
net_port = (int)strtol(argv[optind], NULL, 10); net_port = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
nof_frames = (int)strtol(argv[optind], NULL, 10); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = (uint32_t)strtol(argv[optind], NULL, 10); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'x': case 'x':
transmission_mode = (srslte_tm_t)(strtol(argv[optind], NULL, 10) - 1); transmission_mode = (srslte_tm_t)(strtol(argv[optind], NULL, 10) - 1);
break; break;
case 'b': case 'b':
multiplex_pmi = (uint32_t)strtol(argv[optind], NULL, 10); multiplex_pmi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'w': case 'w':
multiplex_nof_layers = (uint32_t)strtol(argv[optind], NULL, 10); multiplex_nof_layers = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'M': case 'M':
mbsfn_area_id = (int)strtol(argv[optind], NULL, 10); mbsfn_area_id = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
case 's': case 's':
output_file_snr = strtof(argv[optind], NULL); output_file_snr = strtof(argv[optind], NULL);
break; break;
case 'B': case 'B':
mbsfn_sf_mask = (uint8_t)strtol(argv[optind], NULL, 10); mbsfn_sf_mask = (uint8_t)strtol(argv[optind], NULL, 10);
break; break;
case 'q': case 'q':
enable_256qam ^= true; enable_256qam ^= true;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
} }
} }
#ifdef DISABLE_RF #ifdef DISABLE_RF
@ -225,8 +225,9 @@ void parse_args(int argc, char **argv) {
} }
#endif #endif
} }
void base_init() { void base_init()
{
int i; int i;
/* Configure cell and PDSCH in function of the transmission mode */ /* Configure cell and PDSCH in function of the transmission mode */
@ -245,7 +246,7 @@ void base_init() {
} }
/* Allocate memory */ /* Allocate memory */
for(i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
data[i] = srslte_vec_malloc(sizeof(uint8_t) * SOFTBUFFER_SIZE); data[i] = srslte_vec_malloc(sizeof(uint8_t) * SOFTBUFFER_SIZE);
if (!data[i]) { if (!data[i]) {
perror("malloc"); perror("malloc");
@ -254,7 +255,6 @@ void base_init() {
bzero(data[i], sizeof(uint8_t) * SOFTBUFFER_SIZE); bzero(data[i], sizeof(uint8_t) * SOFTBUFFER_SIZE);
} }
data_mbms = srslte_vec_malloc(sizeof(uint8_t) * SOFTBUFFER_SIZE); data_mbms = srslte_vec_malloc(sizeof(uint8_t) * SOFTBUFFER_SIZE);
/* init memory */ /* init memory */
for (i = 0; i < SRSLTE_MAX_PORTS; i++) { for (i = 0; i < SRSLTE_MAX_PORTS; i++) {
@ -274,17 +274,16 @@ void base_init() {
bzero(output_buffer[i], sizeof(cf_t) * sf_n_samples); bzero(output_buffer[i], sizeof(cf_t) * sf_n_samples);
} }
/* open file or USRP */ /* open file or USRP */
if (output_file_name) { if (output_file_name) {
if (strcmp(output_file_name, "NULL")) { if (strcmp(output_file_name, "NULL")) {
if (srslte_filesink_init(&fsink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { if (srslte_filesink_init(&fsink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) {
ERROR("Error opening file %s\n", output_file_name); ERROR("Error opening file %s\n", output_file_name);
exit(-1); exit(-1);
} }
null_file_sink = false; null_file_sink = false;
} else { } else {
null_file_sink = true; null_file_sink = true;
} }
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
@ -298,17 +297,17 @@ void base_init() {
exit(-1); exit(-1);
#endif #endif
} }
if (net_port > 0) { if (net_port > 0) {
if (srslte_netsource_init(&net_source, "127.0.0.1", net_port, SRSLTE_NETSOURCE_UDP)) { if (srslte_netsource_init(&net_source, "127.0.0.1", net_port, SRSLTE_NETSOURCE_UDP)) {
ERROR("Error creating input UDP socket at port %d\n", net_port); ERROR("Error creating input UDP socket at port %d\n", net_port);
exit(-1); exit(-1);
} }
if (null_file_sink) { if (null_file_sink) {
if (srslte_netsink_init(&net_sink, "127.0.0.1", net_port+1, SRSLTE_NETSINK_TCP)) { if (srslte_netsink_init(&net_sink, "127.0.0.1", net_port + 1, SRSLTE_NETSINK_TCP)) {
ERROR("Error sink\n"); ERROR("Error sink\n");
exit(-1); exit(-1);
} }
} }
if (sem_init(&net_sem, 0, 1)) { if (sem_init(&net_sem, 0, 1)) {
perror("sem_init"); perror("sem_init");
@ -332,7 +331,7 @@ void base_init() {
} }
srslte_ofdm_set_non_mbsfn_region(&ifft_mbsfn, 2); srslte_ofdm_set_non_mbsfn_region(&ifft_mbsfn, 2);
srslte_ofdm_set_normalize(&ifft_mbsfn, true); srslte_ofdm_set_normalize(&ifft_mbsfn, true);
if (srslte_pbch_init(&pbch)) { if (srslte_pbch_init(&pbch)) {
ERROR("Error creating PBCH object\n"); ERROR("Error creating PBCH object\n");
exit(-1); exit(-1);
@ -341,9 +340,6 @@ void base_init() {
ERROR("Error creating PBCH object\n"); ERROR("Error creating PBCH object\n");
exit(-1); exit(-1);
} }
if (srslte_regs_init(&regs, cell)) { if (srslte_regs_init(&regs, cell)) {
ERROR("Error initiating regs\n"); ERROR("Error initiating regs\n");
@ -378,14 +374,13 @@ void base_init() {
srslte_pdsch_set_rnti(&pdsch, UE_CRNTI); srslte_pdsch_set_rnti(&pdsch, UE_CRNTI);
if (mbsfn_area_id > -1) {
if(mbsfn_area_id > -1){
if (srslte_pmch_init(&pmch, cell.nof_prb, 1)) { if (srslte_pmch_init(&pmch, cell.nof_prb, 1)) {
ERROR("Error creating PMCH object\n"); ERROR("Error creating PMCH object\n");
} }
srslte_pmch_set_area_id(&pmch, mbsfn_area_id); srslte_pmch_set_area_id(&pmch, mbsfn_area_id);
} }
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
softbuffers[i] = calloc(sizeof(srslte_softbuffer_tx_t), 1); softbuffers[i] = calloc(sizeof(srslte_softbuffer_tx_t), 1);
if (!softbuffers[i]) { if (!softbuffers[i]) {
@ -400,8 +395,8 @@ void base_init() {
} }
} }
void base_free()
void base_free() { {
int i; int i;
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
srslte_softbuffer_tx_free(softbuffers[i]); srslte_softbuffer_tx_free(softbuffers[i]);
@ -413,8 +408,8 @@ void base_free() {
srslte_pdcch_free(&pdcch); srslte_pdcch_free(&pdcch);
srslte_regs_free(&regs); srslte_regs_free(&regs);
srslte_pbch_free(&pbch); srslte_pbch_free(&pbch);
if(mbsfn_area_id > -1){ if (mbsfn_area_id > -1) {
srslte_pmch_free(&pmch); srslte_pmch_free(&pmch);
} }
srslte_ofdm_tx_free(&ifft_mbsfn); srslte_ofdm_tx_free(&ifft_mbsfn);
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
@ -438,22 +433,21 @@ void base_free() {
} }
if (output_file_name) { if (output_file_name) {
if (!null_file_sink) { if (!null_file_sink) {
srslte_filesink_free(&fsink); srslte_filesink_free(&fsink);
} }
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
srslte_rf_close(&rf); srslte_rf_close(&rf);
#endif #endif
} }
if (net_port > 0) { if (net_port > 0) {
srslte_netsource_free(&net_source); srslte_netsource_free(&net_source);
sem_close(&net_sem); sem_close(&net_sem);
} }
} }
bool go_exit = false;
bool go_exit = false;
void sig_int_handler(int signo) void sig_int_handler(int signo)
{ {
printf("SIGINT received. Exiting...\n"); printf("SIGINT received. Exiting...\n");
@ -462,31 +456,29 @@ void sig_int_handler(int signo)
} }
} }
unsigned int reverse(register unsigned int x)
unsigned int
reverse(register unsigned int x)
{ {
x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
return((x >> 16) | (x << 16)); return ((x >> 16) | (x << 16));
} }
uint32_t prbset_to_bitmask() { uint32_t prbset_to_bitmask()
uint32_t mask=0; {
int nb = (int) ceilf((float) cell.nof_prb / srslte_ra_type0_P(cell.nof_prb)); uint32_t mask = 0;
for (int i=0;i<nb;i++) { int nb = (int)ceilf((float)cell.nof_prb / srslte_ra_type0_P(cell.nof_prb));
for (int i = 0; i < nb; i++) {
if (i >= prbset_orig && i < prbset_orig + prbset_num) { if (i >= prbset_orig && i < prbset_orig + prbset_num) {
mask = mask | (0x1<<i); mask = mask | (0x1 << i);
} }
} }
return reverse(mask)>>(32-nb); return reverse(mask) >> (32 - nb);
} }
int update_radl() { int update_radl()
{
ZERO_OBJECT(dci_dl); ZERO_OBJECT(dci_dl);
@ -494,16 +486,16 @@ int update_radl() {
switch (transmission_mode) { switch (transmission_mode) {
case SRSLTE_TM1: case SRSLTE_TM1:
case SRSLTE_TM2: case SRSLTE_TM2:
nof_tb = 1; nof_tb = 1;
dci_dl.format = SRSLTE_DCI_FORMAT1; dci_dl.format = SRSLTE_DCI_FORMAT1;
break; break;
case SRSLTE_TM3: case SRSLTE_TM3:
dci_dl.format = SRSLTE_DCI_FORMAT2A; dci_dl.format = SRSLTE_DCI_FORMAT2A;
nof_tb = 2; nof_tb = 2;
break; break;
case SRSLTE_TM4: case SRSLTE_TM4:
dci_dl.format = SRSLTE_DCI_FORMAT2; dci_dl.format = SRSLTE_DCI_FORMAT2;
nof_tb = multiplex_nof_layers; nof_tb = multiplex_nof_layers;
if (multiplex_nof_layers == 1) { if (multiplex_nof_layers == 1) {
dci_dl.pinfo = (uint8_t)(multiplex_pmi + 1); dci_dl.pinfo = (uint8_t)(multiplex_pmi + 1);
} else { } else {
@ -548,29 +540,30 @@ int update_radl() {
} }
fflush(stdout); fflush(stdout);
return 0; return 0;
} }
/* Read new MCS from stdin */ /* Read new MCS from stdin */
int update_control() { int update_control()
{
char input[128]; char input[128];
fd_set set; fd_set set;
FD_ZERO(&set); FD_ZERO(&set);
FD_SET(0, &set); FD_SET(0, &set);
struct timeval to; struct timeval to;
to.tv_sec = 0; to.tv_sec = 0;
to.tv_usec = 0; to.tv_usec = 0;
int n = select(1, &set, NULL, NULL, &to); int n = select(1, &set, NULL, NULL, &to);
if (n == 1) { if (n == 1) {
// stdin ready // stdin ready
if (fgets(input, sizeof(input), stdin)) { if (fgets(input, sizeof(input), stdin)) {
if(input[0] == 27) { if (input[0] == 27) {
switch(input[2]) { switch (input[2]) {
case RIGHT_KEY: case RIGHT_KEY:
if (prbset_orig + prbset_num < (int) ceilf((float) cell.nof_prb / srslte_ra_type0_P(cell.nof_prb))) if (prbset_orig + prbset_num < (int)ceilf((float)cell.nof_prb / srslte_ra_type0_P(cell.nof_prb)))
prbset_orig++; prbset_orig++;
break; break;
case LEFT_KEY: case LEFT_KEY:
@ -578,14 +571,14 @@ int update_control() {
prbset_orig--; prbset_orig--;
break; break;
case UP_KEY: case UP_KEY:
if (prbset_num < (int) ceilf((float) cell.nof_prb / srslte_ra_type0_P(cell.nof_prb))) if (prbset_num < (int)ceilf((float)cell.nof_prb / srslte_ra_type0_P(cell.nof_prb)))
prbset_num++; prbset_num++;
break; break;
case DOWN_KEY: case DOWN_KEY:
last_prbset_num = prbset_num; last_prbset_num = prbset_num;
if (prbset_num > 0) if (prbset_num > 0)
prbset_num--; prbset_num--;
break; break;
} }
} else { } else {
switch (input[0]) { switch (input[0]) {
@ -630,32 +623,32 @@ int update_control() {
mcs_idx = strtol(input, NULL, 10); mcs_idx = strtol(input, NULL, 10);
} }
} }
bzero(input,sizeof(input)); bzero(input, sizeof(input));
if (update_radl()) { if (update_radl()) {
printf("Trying with last known MCS index\n"); printf("Trying with last known MCS index\n");
mcs_idx = last_mcs_idx; mcs_idx = last_mcs_idx;
prbset_num = last_prbset_num; prbset_num = last_prbset_num;
return update_radl(); return update_radl();
} }
} }
return 0; return 0;
} else if (n < 0) { } else if (n < 0) {
// error // error
perror("select"); perror("select");
return -1; return -1;
} else { } else {
return 0; return 0;
} }
} }
/** Function run in a separate thread to receive UDP data */ /** Function run in a separate thread to receive UDP data */
void *net_thread_fnc(void *arg) { void* net_thread_fnc(void* arg)
int n; {
int rpm = 0, wpm=0; int n;
int rpm = 0, wpm = 0;
do { do {
n = srslte_netsource_read(&net_source, &data2[rpm], DATA_BUFF_SZ-rpm); n = srslte_netsource_read(&net_source, &data2[rpm], DATA_BUFF_SZ - rpm);
if (n > 0) { if (n > 0) {
// FIXME: I assume that both transport blocks have same size in case of 2 tb are active // FIXME: I assume that both transport blocks have same size in case of 2 tb are active
@ -663,23 +656,22 @@ void *net_thread_fnc(void *arg) {
: (pdsch_cfg.grant.tb[0].tbs + pdsch_cfg.grant.tb[1].tbs)) - : (pdsch_cfg.grant.tb[0].tbs + pdsch_cfg.grant.tb[1].tbs)) -
1) / 1) /
8; 8;
rpm += n; rpm += n;
INFO("received %d bytes. rpm=%d/%d\n",n,rpm,nbytes); INFO("received %d bytes. rpm=%d/%d\n", n, rpm, nbytes);
wpm = 0; wpm = 0;
while (rpm >= nbytes) { while (rpm >= nbytes) {
// wait for packet to be transmitted // wait for packet to be transmitted
sem_wait(&net_sem); sem_wait(&net_sem);
if(mbsfn_area_id > -1){ if (mbsfn_area_id > -1) {
memcpy(data_mbms, &data2[wpm], nbytes); memcpy(data_mbms, &data2[wpm], nbytes);
} } else {
else{ memcpy(data[0], &data2[wpm], nbytes / (size_t)2);
memcpy(data[0], &data2[wpm], nbytes / (size_t) 2); memcpy(data[1], &data2[wpm], nbytes / (size_t)2);
memcpy(data[1], &data2[wpm], nbytes / (size_t) 2);
} }
INFO("Sent %d/%d bytes ready\n", nbytes, rpm); INFO("Sent %d/%d bytes ready\n", nbytes, rpm);
rpm -= nbytes; rpm -= nbytes;
wpm += nbytes; wpm += nbytes;
net_packet_ready = true; net_packet_ready = true;
} }
if (wpm > 0) { if (wpm > 0) {
INFO("%d bytes left in buffer for next packet\n", rpm); INFO("%d bytes left in buffer for next packet\n", rpm);
@ -690,25 +682,25 @@ void *net_thread_fnc(void *arg) {
} else { } else {
ERROR("Error receiving from network\n"); ERROR("Error receiving from network\n");
exit(-1); exit(-1);
} }
} while(n >= 0); } while (n >= 0);
return NULL; return NULL;
} }
int main(int argc, char** argv)
int main(int argc, char **argv) { {
int nf=0, sf_idx=0, N_id_2=0; int nf = 0, sf_idx = 0, N_id_2 = 0;
cf_t pss_signal[SRSLTE_PSS_LEN]; cf_t pss_signal[SRSLTE_PSS_LEN];
float sss_signal0[SRSLTE_SSS_LEN]; // for subframe 0 float sss_signal0[SRSLTE_SSS_LEN]; // for subframe 0
float sss_signal5[SRSLTE_SSS_LEN]; // for subframe 5 float sss_signal5[SRSLTE_SSS_LEN]; // for subframe 5
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN]; uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
int i; int i;
cf_t* sf_symbols[SRSLTE_MAX_PORTS]; cf_t* sf_symbols[SRSLTE_MAX_PORTS];
srslte_dci_msg_t dci_msg; srslte_dci_msg_t dci_msg;
srslte_dci_location_t locations[SRSLTE_NOF_SF_X_FRAME][30]; srslte_dci_location_t locations[SRSLTE_NOF_SF_X_FRAME][30];
uint32_t sfn; uint32_t sfn;
srslte_refsignal_t csr_refs; srslte_refsignal_t csr_refs;
srslte_refsignal_t mbsfn_refs; srslte_refsignal_t mbsfn_refs;
srslte_debug_handle_crash(argc, argv); srslte_debug_handle_crash(argc, argv);
@ -722,21 +714,21 @@ int main(int argc, char **argv) {
parse_args(argc, argv); parse_args(argc, argv);
uint8_t mch_table[10]; uint8_t mch_table[10];
bzero(&mch_table[0], sizeof(uint8_t)*10); bzero(&mch_table[0], sizeof(uint8_t) * 10);
if(mbsfn_area_id > -1) { if (mbsfn_area_id > -1) {
generate_mcch_table(mch_table, mbsfn_sf_mask); generate_mcch_table(mch_table, mbsfn_sf_mask);
} }
N_id_2 = cell.id % 3; N_id_2 = cell.id % 3;
sf_n_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE; sf_n_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb)); sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb));
cell.phich_length = SRSLTE_PHICH_NORM; cell.phich_length = SRSLTE_PHICH_NORM;
cell.phich_resources = SRSLTE_PHICH_R_1; cell.phich_resources = SRSLTE_PHICH_R_1;
sfn = 0; sfn = 0;
prbset_num = (int)ceilf((float)cell.nof_prb / srslte_ra_type0_P(cell.nof_prb));
last_prbset_num = prbset_num;
prbset_num = (int) ceilf((float) cell.nof_prb / srslte_ra_type0_P(cell.nof_prb));
last_prbset_num = prbset_num;
/* this *must* be called after setting slot_len_* */ /* this *must* be called after setting slot_len_* */
base_init(); base_init();
@ -745,12 +737,12 @@ int main(int argc, char **argv) {
srslte_sss_generate(sss_signal0, sss_signal5, cell.id); srslte_sss_generate(sss_signal0, sss_signal5, cell.id);
/* Generate reference signals */ /* Generate reference signals */
if(srslte_refsignal_cs_init(&csr_refs, cell.nof_prb)) { if (srslte_refsignal_cs_init(&csr_refs, cell.nof_prb)) {
ERROR("Error initializing equalizer\n"); ERROR("Error initializing equalizer\n");
exit(-1); exit(-1);
} }
if (mbsfn_area_id > -1) { if (mbsfn_area_id > -1) {
if(srslte_refsignal_mbsfn_init(&mbsfn_refs, cell.nof_prb)) { if (srslte_refsignal_mbsfn_init(&mbsfn_refs, cell.nof_prb)) {
ERROR("Error initializing equalizer\n"); ERROR("Error initializing equalizer\n");
exit(-1); exit(-1);
} }
@ -758,23 +750,19 @@ int main(int argc, char **argv) {
ERROR("Error initializing MBSFNR signal\n"); ERROR("Error initializing MBSFNR signal\n");
exit(-1); exit(-1);
} }
} }
if(srslte_refsignal_cs_set_cell(&csr_refs, cell)){ if (srslte_refsignal_cs_set_cell(&csr_refs, cell)) {
ERROR("Error setting cell\n"); ERROR("Error setting cell\n");
exit(-1); exit(-1);
} }
for (i = 0; i < SRSLTE_MAX_PORTS; i++) { for (i = 0; i < SRSLTE_MAX_PORTS; i++) {
sf_symbols[i] = sf_buffer[i%cell.nof_ports]; sf_symbols[i] = sf_buffer[i % cell.nof_ports];
} }
#ifndef DISABLE_RF #ifndef DISABLE_RF
sigset_t sigset; sigset_t sigset;
sigemptyset(&sigset); sigemptyset(&sigset);
sigaddset(&sigset, SIGINT); sigaddset(&sigset, SIGINT);
@ -782,10 +770,10 @@ int main(int argc, char **argv) {
signal(SIGINT, sig_int_handler); signal(SIGINT, sig_int_handler);
if (!output_file_name) { if (!output_file_name) {
int srate = srslte_sampling_freq_hz(cell.nof_prb); int srate = srslte_sampling_freq_hz(cell.nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float) srate/1000000); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_tx_srate(&rf, (double)srate); float srate_rf = srslte_rf_set_tx_srate(&rf, (double)srate);
if (srate_rf != srate) { if (srate_rf != srate) {
ERROR("Could not set sampling rate\n"); ERROR("Could not set sampling rate\n");
@ -803,7 +791,7 @@ int main(int argc, char **argv) {
if (update_radl()) { if (update_radl()) {
exit(-1); exit(-1);
} }
if (net_port > 0) { if (net_port > 0) {
if (pthread_create(&net_thread, NULL, net_thread_fnc, NULL)) { if (pthread_create(&net_thread, NULL, net_thread_fnc, NULL)) {
perror("pthread_create"); perror("pthread_create");
@ -821,15 +809,14 @@ int main(int argc, char **argv) {
dl_sf.tti = i; dl_sf.tti = i;
srslte_pdcch_ue_locations(&pdcch, &dl_sf, locations[i], 30, UE_CRNTI); srslte_pdcch_ue_locations(&pdcch, &dl_sf, locations[i], 30, UE_CRNTI);
} }
nf = 0; nf = 0;
bool send_data = false; bool send_data = false;
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
srslte_softbuffer_tx_reset(softbuffers[i]); srslte_softbuffer_tx_reset(softbuffers[i]);
} }
#ifndef DISABLE_RF #ifndef DISABLE_RF
bool start_of_burst = true; bool start_of_burst = true;
#endif #endif
@ -847,13 +834,11 @@ int main(int argc, char **argv) {
/* Set Antenna port resource elements to zero */ /* Set Antenna port resource elements to zero */
bzero(sf_symbols[0], sizeof(cf_t) * sf_n_re); bzero(sf_symbols[0], sizeof(cf_t) * sf_n_re);
if (sf_idx == 0 || sf_idx == 5) { if (sf_idx == 0 || sf_idx == 5) {
srslte_pss_put_slot(pss_signal, sf_symbols[0], cell.nof_prb, SRSLTE_CP_NORM); srslte_pss_put_slot(pss_signal, sf_symbols[0], cell.nof_prb, SRSLTE_CP_NORM);
srslte_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_symbols[0], cell.nof_prb, srslte_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_symbols[0], cell.nof_prb, SRSLTE_CP_NORM);
SRSLTE_CP_NORM);
} }
/* Copy zeros, SSS, PSS into the rest of antenna ports */ /* Copy zeros, SSS, PSS into the rest of antenna ports */
for (i = 1; i < cell.nof_ports; i++) { for (i = 1; i < cell.nof_ports; i++) {
memcpy(sf_symbols[i], sf_symbols[0], sizeof(cf_t) * sf_n_re); memcpy(sf_symbols[i], sf_symbols[0], sizeof(cf_t) * sf_n_re);
@ -882,10 +867,10 @@ int main(int argc, char **argv) {
if (update_control()) { if (update_control()) {
ERROR("Error updating parameters from control port\n"); ERROR("Error updating parameters from control port\n");
} }
/* Transmit PDCCH + PDSCH only when there is data to send */ /* Transmit PDCCH + PDSCH only when there is data to send */
if ((net_port > 0) && (mch_table[sf_idx] == 1 && mbsfn_area_id > -1)) { if ((net_port > 0) && (mch_table[sf_idx] == 1 && mbsfn_area_id > -1)) {
send_data = net_packet_ready; send_data = net_packet_ready;
if (net_packet_ready) { if (net_packet_ready) {
INFO("Transmitting packet from port\n"); INFO("Transmitting packet from port\n");
} }
@ -894,15 +879,15 @@ int main(int argc, char **argv) {
for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) { for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) {
if (pdsch_cfg.grant.tb[tb].enabled) { if (pdsch_cfg.grant.tb[tb].enabled) {
for (i = 0; i < pdsch_cfg.grant.tb[tb].tbs / 8; i++) { for (i = 0; i < pdsch_cfg.grant.tb[tb].tbs / 8; i++) {
data[tb][i] = (uint8_t) rand(); data[tb][i] = (uint8_t)rand();
} }
} }
} }
/* Uncomment this to transmit on sf 0 and 5 only */ /* Uncomment this to transmit on sf 0 and 5 only */
if (sf_idx != 0 && sf_idx != 5) { if (sf_idx != 0 && sf_idx != 5) {
send_data = true; send_data = true;
} else { } else {
send_data = false; send_data = false;
} }
} }
if (send_data) { if (send_data) {
@ -929,7 +914,7 @@ int main(int argc, char **argv) {
if (srslte_pdsch_encode(&pdsch, &dl_sf, &pdsch_cfg, data, sf_symbols)) { if (srslte_pdsch_encode(&pdsch, &dl_sf, &pdsch_cfg, data, sf_symbols)) {
ERROR("Error encoding PDSCH\n"); ERROR("Error encoding PDSCH\n");
exit(-1); exit(-1);
} }
if (net_port > 0 && net_packet_ready) { if (net_port > 0 && net_packet_ready) {
if (null_file_sink) { if (null_file_sink) {
for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) { for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) {
@ -939,8 +924,8 @@ int main(int argc, char **argv) {
} }
} }
} }
if(mbsfn_area_id < 0){ if (mbsfn_area_id < 0) {
net_packet_ready = false; net_packet_ready = false;
sem_post(&net_sem); sem_post(&net_sem);
} }
} }
@ -992,8 +977,7 @@ int main(int argc, char **argv) {
} else { } else {
srslte_ofdm_tx_sf(&ifft_mbsfn); srslte_ofdm_tx_sf(&ifft_mbsfn);
} }
/* send to file or usrp */ /* send to file or usrp */
if (output_file_name) { if (output_file_name) {
if (!null_file_sink) { if (!null_file_sink) {
@ -1004,17 +988,18 @@ int main(int argc, char **argv) {
srslte_ch_awgn_c(output_buffer[k], output_buffer[k], var, sf_n_samples); srslte_ch_awgn_c(output_buffer[k], output_buffer[k], var, sf_n_samples);
} }
} }
srslte_filesink_write_multi(&fsink, (void**) output_buffer, sf_n_samples, cell.nof_ports); srslte_filesink_write_multi(&fsink, (void**)output_buffer, sf_n_samples, cell.nof_ports);
} }
usleep(1000); usleep(1000);
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
float norm_factor = (float) cell.nof_prb/15/sqrtf(pdsch_cfg.grant.nof_prb); float norm_factor = (float)cell.nof_prb / 15 / sqrtf(pdsch_cfg.grant.nof_prb);
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
srslte_vec_sc_prod_cfc(output_buffer[i], rf_amp * norm_factor, output_buffer[i], SRSLTE_SF_LEN_PRB(cell.nof_prb)); srslte_vec_sc_prod_cfc(
} output_buffer[i], rf_amp * norm_factor, output_buffer[i], SRSLTE_SF_LEN_PRB(cell.nof_prb));
srslte_rf_send_multi(&rf, (void**) output_buffer, sf_n_samples, true, start_of_burst, false); }
start_of_burst=false; srslte_rf_send_multi(&rf, (void**)output_buffer, sf_n_samples, true, start_of_burst, false);
start_of_burst = false;
#endif #endif
} }
} }
@ -1027,5 +1012,3 @@ int main(int argc, char **argv) {
printf("Done\n"); printf("Done\n");
exit(0); exit(0);
} }

@ -19,21 +19,20 @@
* *
*/ */
#include <assert.h>
#include <math.h>
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <math.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <assert.h>
#include <signal.h>
#include <pthread.h>
#include <semaphore.h>
#include "srslte/common/gen_mch_tables.h"
#include "srslte/common/crash_handler.h" #include "srslte/common/crash_handler.h"
#include "srslte/common/gen_mch_tables.h"
#include "srslte/phy/io/filesink.h" #include "srslte/phy/io/filesink.h"
#include "srslte/srslte.h" #include "srslte/srslte.h"
@ -77,40 +76,40 @@ char* output_file_name;
* Program arguments processing * Program arguments processing
***********************************************************************/ ***********************************************************************/
typedef struct { typedef struct {
int nof_subframes; int nof_subframes;
int cpu_affinity; int cpu_affinity;
bool disable_plots; bool disable_plots;
bool disable_plots_except_constellation; bool disable_plots_except_constellation;
bool disable_cfo; bool disable_cfo;
uint32_t time_offset; uint32_t time_offset;
int force_N_id_2; int force_N_id_2;
uint16_t rnti; uint16_t rnti;
char *input_file_name; char* input_file_name;
int file_offset_time; int file_offset_time;
float file_offset_freq; float file_offset_freq;
uint32_t file_nof_prb; uint32_t file_nof_prb;
uint32_t file_nof_ports; uint32_t file_nof_ports;
uint32_t file_cell_id; uint32_t file_cell_id;
bool enable_cfo_ref; bool enable_cfo_ref;
bool average_subframe; bool average_subframe;
char *rf_dev; char* rf_dev;
char* rf_args; char* rf_args;
uint32_t rf_nof_rx_ant; uint32_t rf_nof_rx_ant;
double rf_freq; double rf_freq;
float rf_gain; float rf_gain;
int net_port; int net_port;
char* net_address; char* net_address;
int net_port_signal; int net_port_signal;
char *net_address_signal; char* net_address_signal;
int decimate; int decimate;
int32_t mbsfn_area_id; int32_t mbsfn_area_id;
uint8_t non_mbsfn_region; uint8_t non_mbsfn_region;
uint8_t mbsfn_sf_mask; uint8_t mbsfn_sf_mask;
int tdd_special_sf; int tdd_special_sf;
int sf_config; int sf_config;
int verbose; int verbose;
bool enable_256qam; bool enable_256qam;
}prog_args_t; } prog_args_t;
void args_default(prog_args_t* args) void args_default(prog_args_t* args)
{ {
@ -145,14 +144,15 @@ void args_default(prog_args_t* args)
args->net_address = "127.0.0.1"; args->net_address = "127.0.0.1";
args->net_port_signal = -1; args->net_port_signal = -1;
args->net_address_signal = "127.0.0.1"; args->net_address_signal = "127.0.0.1";
args->decimate = 0; args->decimate = 0;
args->cpu_affinity = -1; args->cpu_affinity = -1;
args->mbsfn_area_id = -1; args->mbsfn_area_id = -1;
args->non_mbsfn_region = 2; args->non_mbsfn_region = 2;
args->mbsfn_sf_mask = 32; args->mbsfn_sf_mask = 32;
} }
void usage(prog_args_t *args, char *prog) { void usage(prog_args_t* args, char* prog)
{
printf("Usage: %s [adgpPoOcildFRDnruMNvTG] -f rx_frequency (in Hz) | -i input_file\n", prog); printf("Usage: %s [adgpPoOcildFRDnruMNvTG] -f rx_frequency (in Hz) | -i input_file\n", prog);
#ifndef DISABLE_RF #ifndef DISABLE_RF
printf("\t-I RF dev [Default %s]\n", args->rf_dev); printf("\t-I RF dev [Default %s]\n", args->rf_dev);
@ -198,118 +198,119 @@ void usage(prog_args_t *args, char *prog) {
printf("\t-v [set srslte_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)
{
int opt; int opt;
args_default(args); args_default(args);
while ((opt = getopt(argc, argv, "adAogliIpPcOCtdDFRqnvrfuUsSZyWMNBTG")) != -1) { while ((opt = getopt(argc, argv, "adAogliIpPcOCtdDFRqnvrfuUsSZyWMNBTG")) != -1) {
switch (opt) { switch (opt) {
case 'i': case 'i':
args->input_file_name = argv[optind]; args->input_file_name = argv[optind];
break; break;
case 'p': case 'p':
args->file_nof_prb = (uint32_t)strtol(argv[optind], NULL, 10); args->file_nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'P': case 'P':
args->file_nof_ports = (uint32_t)strtol(argv[optind], NULL, 10); args->file_nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
args->file_offset_freq = strtof(argv[optind], NULL); args->file_offset_freq = strtof(argv[optind], NULL);
break; break;
case 'O': case 'O':
args->file_offset_time = (int)strtol(argv[optind], NULL, 10); args->file_offset_time = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
args->file_cell_id = (uint32_t)strtol(argv[optind], NULL, 10); args->file_cell_id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'I': case 'I':
args->rf_dev = argv[optind]; args->rf_dev = argv[optind];
break; break;
case 'a': case 'a':
args->rf_args = argv[optind]; args->rf_args = argv[optind];
break; break;
case 'A': case 'A':
args->rf_nof_rx_ant = (uint32_t)strtol(argv[optind], NULL, 10); args->rf_nof_rx_ant = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'g': case 'g':
args->rf_gain = strtof(argv[optind], NULL); args->rf_gain = strtof(argv[optind], NULL);
break; break;
case 'C': case 'C':
args->disable_cfo = true; args->disable_cfo = true;
break; break;
case 'F': case 'F':
args->enable_cfo_ref = true; args->enable_cfo_ref = true;
break; break;
case 'R': case 'R':
args->average_subframe = true; args->average_subframe = true;
break; break;
case 't': case 't':
args->time_offset = (uint32_t)strtol(argv[optind], NULL, 10); args->time_offset = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
args->rf_freq = strtod(argv[optind], NULL); args->rf_freq = strtod(argv[optind], NULL);
break; break;
case 'T': case 'T':
args->tdd_special_sf = (int)strtol(argv[optind], NULL, 10); args->tdd_special_sf = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'G': case 'G':
args->sf_config = (int)strtol(argv[optind], NULL, 10); args->sf_config = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
args->nof_subframes = (int)strtol(argv[optind], NULL, 10); args->nof_subframes = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
args->rnti = strtol(argv[optind], NULL, 16); args->rnti = strtol(argv[optind], NULL, 16);
break; break;
case 'l': case 'l':
args->force_N_id_2 = (int)strtol(argv[optind], NULL, 10); args->force_N_id_2 = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'u': case 'u':
args->net_port = (int)strtol(argv[optind], NULL, 10); args->net_port = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'U': case 'U':
args->net_address = argv[optind]; args->net_address = argv[optind];
break; break;
case 's': case 's':
args->net_port_signal = (int)strtol(argv[optind], NULL, 10); args->net_port_signal = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'S': case 'S':
args->net_address_signal = argv[optind]; args->net_address_signal = argv[optind];
break; break;
case 'd': case 'd':
args->disable_plots = true; args->disable_plots = true;
break; break;
case 'D': case 'D':
args->disable_plots_except_constellation = true; args->disable_plots_except_constellation = true;
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
args->verbose = srslte_verbose; args->verbose = srslte_verbose;
break; break;
case 'Z': case 'Z':
args->decimate = (int)strtol(argv[optind], NULL, 10); args->decimate = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'y': case 'y':
args->cpu_affinity = (int)strtol(argv[optind], NULL, 10); args->cpu_affinity = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'W': case 'W':
output_file_name = argv[optind]; output_file_name = argv[optind];
break; break;
case 'M': case 'M':
args->mbsfn_area_id = (int32_t)strtol(argv[optind], NULL, 10); args->mbsfn_area_id = (int32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'N': case 'N':
args->non_mbsfn_region = (uint8_t)strtol(argv[optind], NULL, 10); args->non_mbsfn_region = (uint8_t)strtol(argv[optind], NULL, 10);
break; break;
case 'B': case 'B':
args->mbsfn_sf_mask = (uint8_t)strtol(argv[optind], NULL, 10); args->mbsfn_sf_mask = (uint8_t)strtol(argv[optind], NULL, 10);
break; break;
case 'q': case 'q':
args->enable_256qam ^= true; args->enable_256qam ^= true;
break; break;
default: default:
usage(args, argv[0]); usage(args, argv[0]);
exit(-1); exit(-1);
} }
} }
if (args->rf_freq < 0 && args->input_file_name == NULL) { if (args->rf_freq < 0 && args->input_file_name == NULL) {
@ -320,7 +321,7 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
/**********************************************************************/ /**********************************************************************/
uint8_t *data[SRSLTE_MAX_CODEWORDS]; uint8_t* data[SRSLTE_MAX_CODEWORDS];
bool go_exit = false; bool go_exit = false;
@ -334,8 +335,7 @@ void sig_int_handler(int signo)
} }
} }
cf_t *sf_buffer[SRSLTE_MAX_PORTS] = {NULL}; cf_t* sf_buffer[SRSLTE_MAX_PORTS] = {NULL};
#ifndef DISABLE_RF #ifndef DISABLE_RF
@ -379,10 +379,13 @@ srslte_netsink_t net_sink, net_sink_signal;
#define PRINT_LINE(_fmt, ...) \ #define PRINT_LINE(_fmt, ...) \
printf("\033[K" _fmt "\n", ##__VA_ARGS__); \ printf("\033[K" _fmt "\n", ##__VA_ARGS__); \
this_nof_lines++ this_nof_lines++
#define PRINT_LINE_RESET_CURSOR() printf("\033[%dA", this_nof_lines); prev_nof_lines = this_nof_lines #define PRINT_LINE_RESET_CURSOR() \
printf("\033[%dA", this_nof_lines); \
prev_nof_lines = this_nof_lines
#define PRINT_LINE_ADVANCE_CURSOR() printf("\033[%dB", prev_nof_lines + 1) #define PRINT_LINE_ADVANCE_CURSOR() printf("\033[%dB", prev_nof_lines + 1)
int main(int argc, char **argv) { int main(int argc, char** argv)
{
int ret; int ret;
#ifndef DISABLE_RF #ifndef DISABLE_RF
@ -500,7 +503,7 @@ int main(int argc, char **argv) {
int srate = srslte_sampling_freq_hz(cell.nof_prb); int srate = srslte_sampling_freq_hz(cell.nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_rx_srate(&rf, (double) srate); float srate_rf = srslte_rf_set_rx_srate(&rf, (double)srate);
if (srate_rf != srate) { if (srate_rf != srate) {
ERROR("Could not set sampling rate\n"); ERROR("Could not set sampling rate\n");
exit(-1); exit(-1);
@ -519,7 +522,7 @@ int main(int argc, char **argv) {
/* preset cell configuration */ /* preset cell configuration */
cell.id = prog_args.file_cell_id; cell.id = prog_args.file_cell_id;
cell.cp = SRSLTE_CP_NORM; cell.cp = SRSLTE_CP_NORM;
cell.phich_length = SRSLTE_PHICH_NORM; cell.phich_length = SRSLTE_PHICH_NORM;
cell.phich_resources = SRSLTE_PHICH_R_1; cell.phich_resources = SRSLTE_PHICH_R_1;
cell.nof_ports = prog_args.file_nof_ports; cell.nof_ports = prog_args.file_nof_ports;
cell.nof_prb = prog_args.file_nof_prb; cell.nof_prb = prog_args.file_nof_prb;
@ -600,16 +603,16 @@ int main(int argc, char **argv) {
} }
srslte_chest_dl_cfg_t chest_pdsch_cfg = {}; srslte_chest_dl_cfg_t chest_pdsch_cfg = {};
chest_pdsch_cfg.cfo_estimate_enable = prog_args.enable_cfo_ref; chest_pdsch_cfg.cfo_estimate_enable = prog_args.enable_cfo_ref;
chest_pdsch_cfg.cfo_estimate_sf_mask = 1023; chest_pdsch_cfg.cfo_estimate_sf_mask = 1023;
chest_pdsch_cfg.interpolate_subframe = !prog_args.average_subframe; chest_pdsch_cfg.interpolate_subframe = !prog_args.average_subframe;
// Special configuration for MBSFN channel estimation // Special configuration for MBSFN channel estimation
srslte_chest_dl_cfg_t chest_mbsfn_cfg = {}; srslte_chest_dl_cfg_t chest_mbsfn_cfg = {};
chest_mbsfn_cfg.filter_type = SRSLTE_CHEST_FILTER_TRIANGLE; chest_mbsfn_cfg.filter_type = SRSLTE_CHEST_FILTER_TRIANGLE;
chest_mbsfn_cfg.filter_coef[0] = 0.1; chest_mbsfn_cfg.filter_coef[0] = 0.1;
chest_mbsfn_cfg.interpolate_subframe = true; chest_mbsfn_cfg.interpolate_subframe = true;
chest_mbsfn_cfg.noise_alg = SRSLTE_NOISE_ALG_PSS; chest_mbsfn_cfg.noise_alg = SRSLTE_NOISE_ALG_PSS;
// Allocate softbuffer buffers // Allocate softbuffer buffers
srslte_softbuffer_rx_t rx_softbuffers[SRSLTE_MAX_CODEWORDS]; srslte_softbuffer_rx_t rx_softbuffers[SRSLTE_MAX_CODEWORDS];
@ -644,7 +647,7 @@ int main(int argc, char **argv) {
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (prog_args.rf_gain < 0 && !prog_args.input_file_name) { if (prog_args.rf_gain < 0 && !prog_args.input_file_name) {
srslte_rf_info_t *rf_info = srslte_rf_get_info(&rf); srslte_rf_info_t* rf_info = srslte_rf_get_info(&rf);
srslte_ue_sync_start_agc(&ue_sync, srslte_ue_sync_start_agc(&ue_sync,
srslte_rf_set_rx_gain_th_wrapper_, srslte_rf_set_rx_gain_th_wrapper_,
rf_info->min_rx_gain, rf_info->min_rx_gain,
@ -686,12 +689,12 @@ int main(int argc, char **argv) {
FD_SET(0, &set); FD_SET(0, &set);
struct timeval to; struct timeval to;
to.tv_sec = 0; to.tv_sec = 0;
to.tv_usec = 0; to.tv_usec = 0;
/* Set default verbose level */ /* Set default verbose level */
srslte_verbose = prog_args.verbose; srslte_verbose = prog_args.verbose;
int n = select(1, &set, NULL, NULL, &to); int n = select(1, &set, NULL, NULL, &to);
if (n == 1) { if (n == 1) {
/* If a new line is detected set verbose level to Debug */ /* If a new line is detected set verbose level to Debug */
if (fgets(input, sizeof(input), stdin)) { if (fgets(input, sizeof(input), stdin)) {
@ -699,7 +702,7 @@ int main(int argc, char **argv) {
pkt_errors = 0; pkt_errors = 0;
pkt_total = 0; pkt_total = 0;
nof_detected = 0; nof_detected = 0;
nof_trials = 0; nof_trials = 0;
} }
} }
@ -779,9 +782,9 @@ int main(int argc, char **argv) {
n = 0; n = 0;
for (uint32_t tm = 0; tm < 4 && !n; tm++) { for (uint32_t tm = 0; tm < 4 && !n; tm++) {
dl_sf.tti = tti; dl_sf.tti = tti;
dl_sf.sf_type = sf_type; dl_sf.sf_type = sf_type;
ue_dl_cfg.cfg.tm = (srslte_tm_t)tm; ue_dl_cfg.cfg.tm = (srslte_tm_t)tm;
ue_dl_cfg.cfg.pdsch.use_tbs_index_alt = prog_args.enable_256qam; ue_dl_cfg.cfg.pdsch.use_tbs_index_alt = prog_args.enable_256qam;
if ((ue_dl_cfg.cfg.tm == SRSLTE_TM1 && cell.nof_ports == 1) || if ((ue_dl_cfg.cfg.tm == SRSLTE_TM1 && cell.nof_ports == 1) ||
@ -919,7 +922,6 @@ int main(int argc, char **argv) {
PRINT_LINE("Press enter maximum printing debug log of 1 subframe."); PRINT_LINE("Press enter maximum printing debug log of 1 subframe.");
PRINT_LINE(""); PRINT_LINE("");
PRINT_LINE_RESET_CURSOR(); PRINT_LINE_RESET_CURSOR();
} }
break; break;
} }
@ -998,14 +1000,15 @@ int main(int argc, char **argv) {
***********************************************************************/ ***********************************************************************/
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
plot_real_t p_sync, pce; plot_real_t p_sync, pce;
plot_scatter_t pscatequal, pscatequal_pdcch, pscatequal_pmch; plot_scatter_t pscatequal, pscatequal_pdcch, pscatequal_pmch;
float tmp_plot[110 * 15 * 2048]; float tmp_plot[110 * 15 * 2048];
float tmp_plot2[110 * 15 * 2048]; float tmp_plot2[110 * 15 * 2048];
float tmp_plot3[110 * 15 * 2048]; float tmp_plot3[110 * 15 * 2048];
void *plot_thread_run(void *arg) { void* plot_thread_run(void* arg)
{
int i; int i;
uint32_t nof_re = SRSLTE_SF_LEN_RE(ue_dl.cell.nof_prb, ue_dl.cell.cp); uint32_t nof_re = SRSLTE_SF_LEN_RE(ue_dl.cell.nof_prb, ue_dl.cell.cp);
@ -1115,7 +1118,7 @@ void init_plots()
exit(-1); exit(-1);
} }
pthread_attr_t attr; pthread_attr_t attr;
struct sched_param param; struct sched_param param;
param.sched_priority = 0; param.sched_priority = 0;
pthread_attr_init(&attr); pthread_attr_init(&attr);

@ -22,21 +22,22 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h>
#include "srslte/srslte.h" #include "srslte/srslte.h"
char *input_file_name; char* input_file_name;
char *output_file_name="abs_corr.txt"; char* output_file_name = "abs_corr.txt";
int nof_frames=100, frame_length=9600, symbol_sz=128; int nof_frames = 100, frame_length = 9600, symbol_sz = 128;
float corr_peak_threshold=25.0; float corr_peak_threshold = 25.0;
int out_N_id_2 = 0, force_N_id_2=-1; int out_N_id_2 = 0, force_N_id_2 = -1;
#define CFO_AUTO -9999.0 #define CFO_AUTO -9999.0
float force_cfo = CFO_AUTO; float force_cfo = CFO_AUTO;
void usage(char *prog) { void usage(char* prog)
{
printf("Usage: %s [olntsNfcv] -i input_file\n", prog); printf("Usage: %s [olntsNfcv] -i input_file\n", prog);
printf("\t-o output_file [Default %s]\n", output_file_name); printf("\t-o output_file [Default %s]\n", output_file_name);
printf("\t-l frame_length [Default %d]\n", frame_length); printf("\t-l frame_length [Default %d]\n", frame_length);
@ -49,43 +50,44 @@ void usage(char *prog) {
printf("\t-v srslte_verbose\n"); printf("\t-v srslte_verbose\n");
} }
void parse_args(int argc, char **argv) { void parse_args(int argc, char** argv)
{
int opt; int opt;
while ((opt = getopt(argc, argv, "ionltsNfcv")) != -1) { while ((opt = getopt(argc, argv, "ionltsNfcv")) != -1) {
switch(opt) { switch (opt) {
case 'i': case 'i':
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'o': case 'o':
output_file_name = argv[optind]; output_file_name = argv[optind];
break; break;
case 'n': case 'n':
nof_frames = (int)strtol(argv[optind], NULL, 10); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
frame_length = (int)strtol(argv[optind], NULL, 10); frame_length = (int)strtol(argv[optind], NULL, 10);
break; break;
case 't': case 't':
corr_peak_threshold = strtof(argv[optind], NULL); corr_peak_threshold = strtof(argv[optind], NULL);
break; break;
case 's': case 's':
symbol_sz = (int)strtol(argv[optind], NULL, 10); symbol_sz = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'N': case 'N':
out_N_id_2 = (int)strtol(argv[optind], NULL, 10); out_N_id_2 = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
force_N_id_2 = (int)strtol(argv[optind], NULL, 10); force_N_id_2 = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
force_cfo = strtof(argv[optind], NULL); force_cfo = strtof(argv[optind], NULL);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
} }
} }
if (!input_file_name) { if (!input_file_name) {
@ -94,33 +96,35 @@ void parse_args(int argc, char **argv) {
} }
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
{
srslte_filesource_t fsrc; srslte_filesource_t fsrc;
srslte_filesink_t fsink; srslte_filesink_t fsink;
srslte_pss_t pss[3]; // One for each N_id_2 srslte_pss_t pss[3]; // One for each N_id_2
srslte_sss_t sss[3]; // One for each N_id_2 srslte_sss_t sss[3]; // One for each N_id_2
srslte_cfo_t cfocorr; srslte_cfo_t cfocorr;
int peak_pos[3]; int peak_pos[3];
float *cfo; float* cfo;
float peak_value[3]; float peak_value[3];
int frame_cnt; int frame_cnt;
cf_t *input; cf_t* input;
uint32_t m0, m1; uint32_t m0, m1;
float m0_value, m1_value; float m0_value, m1_value;
uint32_t N_id_2; uint32_t N_id_2;
int sss_idx; int sss_idx;
struct timeval tdata[3]; struct timeval tdata[3];
int *exec_time; int* exec_time;
if (argc < 3) { if (argc < 3) {
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
} }
parse_args(argc,argv); parse_args(argc, argv);
gettimeofday(&tdata[1], NULL); gettimeofday(&tdata[1], NULL);
printf("Initializing...");fflush(stdout); printf("Initializing...");
fflush(stdout);
if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) {
ERROR("Error opening file %s\n", input_file_name); ERROR("Error opening file %s\n", input_file_name);
@ -131,17 +135,17 @@ int main(int argc, char **argv) {
exit(-1); exit(-1);
} }
input = malloc(frame_length*sizeof(cf_t)); input = malloc(frame_length * sizeof(cf_t));
if (!input) { if (!input) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
cfo = malloc(nof_frames*sizeof(float)); cfo = malloc(nof_frames * sizeof(float));
if (!cfo) { if (!cfo) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
exec_time = malloc(nof_frames*sizeof(int)); exec_time = malloc(nof_frames * sizeof(int));
if (!exec_time) { if (!exec_time) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
@ -157,7 +161,7 @@ int main(int argc, char **argv) {
* b) We create 1 pss object which scans for each N_id_2 one after another. * b) We create 1 pss object which scans for each N_id_2 one after another.
* a) requries more memory but has less latency and is paralellizable. * a) requries more memory but has less latency and is paralellizable.
*/ */
for (N_id_2=0;N_id_2<3;N_id_2++) { for (N_id_2 = 0; N_id_2 < 3; N_id_2++) {
if (srslte_pss_init_fft(&pss[N_id_2], frame_length, symbol_sz)) { if (srslte_pss_init_fft(&pss[N_id_2], frame_length, symbol_sz)) {
ERROR("Error initializing PSS object\n"); ERROR("Error initializing PSS object\n");
exit(-1); exit(-1);
@ -177,35 +181,34 @@ int main(int argc, char **argv) {
} }
gettimeofday(&tdata[2], NULL); gettimeofday(&tdata[2], NULL);
get_time_interval(tdata); get_time_interval(tdata);
printf("done in %ld s %ld ms\n", tdata[0].tv_sec, tdata[0].tv_usec/1000); printf("done in %ld s %ld ms\n", tdata[0].tv_sec, tdata[0].tv_usec / 1000);
printf("\n\tFr.Cnt\tN_id_2\tN_id_1\tSubf\tPSS Peak/Avg\tIdx\tm0\tm1\tCFO\n"); printf("\n\tFr.Cnt\tN_id_2\tN_id_1\tSubf\tPSS Peak/Avg\tIdx\tm0\tm1\tCFO\n");
printf("\t===============================================================================\n"); printf("\t===============================================================================\n");
/* read all file or nof_frames */ /* read all file or nof_frames */
frame_cnt = 0; frame_cnt = 0;
while (frame_length == srslte_filesource_read(&fsrc, input, frame_length) while (frame_length == srslte_filesource_read(&fsrc, input, frame_length) && frame_cnt < nof_frames) {
&& frame_cnt < nof_frames) {
gettimeofday(&tdata[1], NULL); gettimeofday(&tdata[1], NULL);
if (force_cfo != CFO_AUTO) { if (force_cfo != CFO_AUTO) {
srslte_cfo_correct(&cfocorr, input, input, force_cfo/128); srslte_cfo_correct(&cfocorr, input, input, force_cfo / 128);
} }
if (force_N_id_2 != -1) { if (force_N_id_2 != -1) {
N_id_2 = force_N_id_2; N_id_2 = force_N_id_2;
peak_pos[N_id_2] = srslte_pss_find_pss(&pss[N_id_2], input, &peak_value[N_id_2]); peak_pos[N_id_2] = srslte_pss_find_pss(&pss[N_id_2], input, &peak_value[N_id_2]);
} else { } else {
for (N_id_2=0;N_id_2<3;N_id_2++) { for (N_id_2 = 0; N_id_2 < 3; N_id_2++) {
peak_pos[N_id_2] = srslte_pss_find_pss(&pss[N_id_2], input, &peak_value[N_id_2]); peak_pos[N_id_2] = srslte_pss_find_pss(&pss[N_id_2], input, &peak_value[N_id_2]);
} }
float max_value=-99999; float max_value = -99999;
N_id_2=-1; N_id_2 = -1;
int i; int i;
for (i=0;i<3;i++) { for (i = 0; i < 3; i++) {
if (peak_value[i] > max_value) { if (peak_value[i] > max_value) {
max_value = peak_value[i]; max_value = peak_value[i];
N_id_2 = i; N_id_2 = i;
} }
} }
} }
@ -213,12 +216,11 @@ int main(int argc, char **argv) {
/* If peak detected */ /* If peak detected */
if (peak_value[N_id_2] > corr_peak_threshold) { if (peak_value[N_id_2] > corr_peak_threshold) {
sss_idx = peak_pos[N_id_2]-2*(symbol_sz+SRSLTE_CP_LEN(symbol_sz,SRSLTE_CP_NORM_LEN)); sss_idx = peak_pos[N_id_2] - 2 * (symbol_sz + SRSLTE_CP_LEN(symbol_sz, SRSLTE_CP_NORM_LEN));
if (sss_idx >= 0) { if (sss_idx >= 0) {
srslte_sss_m0m1_diff(&sss[N_id_2], &input[sss_idx], srslte_sss_m0m1_diff(&sss[N_id_2], &input[sss_idx], &m0, &m0_value, &m1, &m1_value);
&m0, &m0_value, &m1, &m1_value);
cfo[frame_cnt] = srslte_pss_cfo_compute(&pss[N_id_2], &input[peak_pos[N_id_2]-128]); cfo[frame_cnt] = srslte_pss_cfo_compute(&pss[N_id_2], &input[peak_pos[N_id_2] - 128]);
printf("\t%d\t%d\t%d\t%d\t%.3f\t\t%3d\t%d\t%d\t%.3f\n", printf("\t%d\t%d\t%d\t%d\t%.3f\t\t%3d\t%d\t%d\t%.3f\n",
frame_cnt, frame_cnt,
N_id_2, N_id_2,
@ -237,23 +239,25 @@ int main(int argc, char **argv) {
frame_cnt++; frame_cnt++;
} }
int i; int i;
float avg_time=0; float avg_time = 0;
for (i=0;i<frame_cnt;i++) { for (i = 0; i < frame_cnt; i++) {
avg_time += (float) exec_time[i]; avg_time += (float)exec_time[i];
} }
avg_time /= frame_cnt; avg_time /= frame_cnt;
printf("\n"); printf("\n");
printf("Average exec time: %.3f ms / frame. %.3f Msamp/s (%.3f\%% CPU)\n", printf("Average exec time: %.3f ms / frame. %.3f Msamp/s (%.3f\%% CPU)\n",
avg_time / 1000, frame_length / avg_time, 100 * avg_time / 5000 * (9600 / (float) frame_length )); avg_time / 1000,
frame_length / avg_time,
100 * avg_time / 5000 * (9600 / (float)frame_length));
float cfo_mean=0; float cfo_mean = 0;
for (i=0;i<frame_cnt;i++) { for (i = 0; i < frame_cnt; i++) {
cfo_mean += cfo[i] / frame_cnt * (9600 / frame_length); cfo_mean += cfo[i] / frame_cnt * (9600 / frame_length);
} }
printf("Average CFO: %.3f\n", cfo_mean); printf("Average CFO: %.3f\n", cfo_mean);
for (N_id_2=0;N_id_2<3;N_id_2++) { for (N_id_2 = 0; N_id_2 < 3; N_id_2++) {
srslte_pss_free(&pss[N_id_2]); srslte_pss_free(&pss[N_id_2]);
srslte_sss_free(&sss[N_id_2]); srslte_sss_free(&sss[N_id_2]);
} }

@ -19,33 +19,35 @@
* *
*/ */
#include <stdio.h> #include <math.h>
#include <signal.h> #include <signal.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <math.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include <stdbool.h> #include <stdbool.h>
#include "srslte/srslte.h"
#include "srslte/phy/rf/rf.h"
#include "srslte/phy/io/filesink.h" #include "srslte/phy/io/filesink.h"
#include "srslte/phy/rf/rf.h"
#include "srslte/srslte.h"
static bool keep_running = true; static bool keep_running = true;
char *output_file_name; char* output_file_name;
char *rf_args=""; char* rf_args = "";
float rf_gain=40.0, rf_freq=-1.0, rf_rate=0.96e6; float rf_gain = 40.0, rf_freq = -1.0, rf_rate = 0.96e6;
int nof_samples = -1; int nof_samples = -1;
int nof_rx_antennas = 1; int nof_rx_antennas = 1;
void int_handler(int dummy) { void int_handler(int dummy)
{
keep_running = false; keep_running = false;
} }
void usage(char *prog) { void usage(char* prog)
{
printf("Usage: %s [agrnv] -f rx_frequency_hz -o output_file\n", prog); printf("Usage: %s [agrnv] -f rx_frequency_hz -o output_file\n", prog);
printf("\t-a RF args [Default %s]\n", rf_args); printf("\t-a RF args [Default %s]\n", rf_args);
printf("\t-g RF Gain [Default %.2f dB]\n", rf_gain); printf("\t-g RF Gain [Default %.2f dB]\n", rf_gain);
@ -55,37 +57,38 @@ void usage(char *prog) {
printf("\t-v srslte_verbose\n"); printf("\t-v srslte_verbose\n");
} }
void parse_args(int argc, char **argv) { void parse_args(int argc, char** argv)
{
int opt; int opt;
while ((opt = getopt(argc, argv, "agrnvfoA")) != -1) { while ((opt = getopt(argc, argv, "agrnvfoA")) != -1) {
switch (opt) { switch (opt) {
case 'o': case 'o':
output_file_name = argv[optind]; output_file_name = argv[optind];
break; break;
case 'a': case 'a':
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'g': case 'g':
rf_gain = strtof(argv[optind], NULL); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'r': case 'r':
rf_rate = strtof(argv[optind], NULL); rf_rate = strtof(argv[optind], NULL);
break; break;
case 'f': case 'f':
rf_freq = strtof(argv[optind], NULL); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'n': case 'n':
nof_samples = (int)strtol(argv[optind], NULL, 10); nof_samples = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'A': case 'A':
nof_rx_antennas = (int)strtol(argv[optind], NULL, 10); nof_rx_antennas = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
} }
} }
if (rf_freq < 0) { if (rf_freq < 0) {
@ -94,18 +97,19 @@ void parse_args(int argc, char **argv) {
} }
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
cf_t *buffer[SRSLTE_MAX_PORTS]; {
int sample_count, n; cf_t* buffer[SRSLTE_MAX_PORTS];
srslte_rf_t rf; int sample_count, n;
srslte_rf_t rf;
srslte_filesink_t sink; srslte_filesink_t sink;
uint32_t buflen; uint32_t buflen;
signal(SIGINT, int_handler); signal(SIGINT, int_handler);
parse_args(argc, argv); parse_args(argc, argv);
buflen = 4800; buflen = 4800;
sample_count = 0; sample_count = 0;
for (int i = 0; i < nof_rx_antennas; i++) { for (int i = 0; i < nof_rx_antennas; i++) {
@ -131,7 +135,7 @@ int main(int argc, char **argv) {
printf("Set RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq) / 1000000); printf("Set RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq) / 1000000);
printf("Set RX gain: %.2f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain)); printf("Set RX gain: %.2f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain));
float srate = srslte_rf_set_rx_srate(&rf, rf_rate); float srate = srslte_rf_set_rx_srate(&rf, rf_rate);
if (srate != rf_rate) { if (srate != rf_rate) {
srate = srslte_rf_set_rx_srate(&rf, rf_rate); srate = srslte_rf_set_rx_srate(&rf, rf_rate);
if (srate != rf_rate) { if (srate != rf_rate) {
@ -140,22 +144,20 @@ int main(int argc, char **argv) {
} }
} }
printf("Correctly RX rate: %.2f MHz\n", srate*1e-6); printf("Correctly RX rate: %.2f MHz\n", srate * 1e-6);
srslte_rf_start_rx_stream(&rf, false); srslte_rf_start_rx_stream(&rf, false);
while ((sample_count < nof_samples || nof_samples == -1) && keep_running) {
while((sample_count < nof_samples || nof_samples == -1) n = srslte_rf_recv_with_time_multi(&rf, (void**)buffer, buflen, true, NULL, NULL);
&& keep_running){
n = srslte_rf_recv_with_time_multi(&rf, (void**) buffer, buflen, true, NULL, NULL);
if (n < 0) { if (n < 0) {
ERROR("Error receiving samples\n"); ERROR("Error receiving samples\n");
exit(-1); exit(-1);
} }
srslte_filesink_write_multi(&sink, (void**) buffer, buflen, nof_rx_antennas); srslte_filesink_write_multi(&sink, (void**)buffer, buflen, nof_rx_antennas);
sample_count += buflen; sample_count += buflen;
} }
for (int i = 0; i < nof_rx_antennas; i++) { for (int i = 0; i < nof_rx_antennas; i++) {
if (buffer[i]) { if (buffer[i]) {
free(buffer[i]); free(buffer[i]);

@ -19,34 +19,36 @@
* *
*/ */
#include <stdio.h> #include <math.h>
#include <signal.h> #include <signal.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <math.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include <stdbool.h> #include <stdbool.h>
#include "srslte/srslte.h"
#include "srslte/phy/rf/rf.h" #include "srslte/phy/rf/rf.h"
#include "srslte/srslte.h"
static bool keep_running = true; static bool keep_running = true;
char *output_file_name = NULL; char* output_file_name = NULL;
char *rf_args=""; char* rf_args = "";
float rf_gain=60.0, rf_freq=-1.0; float rf_gain = 60.0, rf_freq = -1.0;
int nof_prb = 6; int nof_prb = 6;
int nof_subframes = -1; int nof_subframes = -1;
int N_id_2 = -1; int N_id_2 = -1;
uint32_t nof_rx_antennas = 1; uint32_t nof_rx_antennas = 1;
void int_handler(int dummy) { void int_handler(int dummy)
{
keep_running = false; keep_running = false;
} }
void usage(char *prog) { void usage(char* prog)
{
printf("Usage: %s [agrnv] -l N_id_2 -f rx_frequency_hz -o output_file\n", prog); printf("Usage: %s [agrnv] -l N_id_2 -f rx_frequency_hz -o output_file\n", prog);
printf("\t-a RF args [Default %s]\n", rf_args); printf("\t-a RF args [Default %s]\n", rf_args);
printf("\t-g RF Gain [Default %.2f dB]\n", rf_gain); printf("\t-g RF Gain [Default %.2f dB]\n", rf_gain);
@ -56,40 +58,41 @@ void usage(char *prog) {
printf("\t-v verbose\n"); printf("\t-v verbose\n");
} }
void parse_args(int argc, char **argv) { void parse_args(int argc, char** argv)
{
int opt; int opt;
while ((opt = getopt(argc, argv, "agpnvfolA")) != -1) { while ((opt = getopt(argc, argv, "agpnvfolA")) != -1) {
switch (opt) { switch (opt) {
case 'o': case 'o':
output_file_name = argv[optind]; output_file_name = argv[optind];
break; break;
case 'a': case 'a':
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'g': case 'g':
rf_gain = strtof(argv[optind], NULL); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'p': case 'p':
nof_prb = (int)strtol(argv[optind], NULL, 10); nof_prb = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
rf_freq = strtof(argv[optind], NULL); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'n': case 'n':
nof_subframes = (int)strtol(argv[optind], NULL, 10); nof_subframes = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
N_id_2 = (int)strtol(argv[optind], NULL, 10); N_id_2 = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'A': case 'A':
nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10); nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
} }
} }
if (&rf_freq < 0 || N_id_2 == -1 || output_file_name == NULL) { if (&rf_freq < 0 || N_id_2 == -1 || output_file_name == NULL) {
@ -108,18 +111,19 @@ int srslte_rf_recv_wrapper(void* h, cf_t* data_[SRSLTE_MAX_PORTS], uint32_t nsam
return srslte_rf_recv_with_time_multi(h, ptr, nsamples, true, NULL, NULL); return srslte_rf_recv_with_time_multi(h, ptr, nsamples, true, NULL, NULL);
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
{
cf_t* buffer[SRSLTE_MAX_PORTS] = {NULL}; cf_t* buffer[SRSLTE_MAX_PORTS] = {NULL};
int n; int n;
srslte_rf_t rf; srslte_rf_t rf;
srslte_filesink_t sink; srslte_filesink_t sink;
srslte_ue_sync_t ue_sync; srslte_ue_sync_t ue_sync;
srslte_cell_t cell; srslte_cell_t cell;
signal(SIGINT, int_handler); signal(SIGINT, int_handler);
parse_args(argc, argv); parse_args(argc, argv);
srslte_filesink_init(&sink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN); srslte_filesink_init(&sink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN);
printf("Opening RF device...\n"); printf("Opening RF device...\n");
@ -131,7 +135,7 @@ int main(int argc, char **argv) {
for (int i = 0; i < nof_rx_antennas; i++) { for (int i = 0; i < nof_rx_antennas; i++) {
buffer[i] = srslte_vec_malloc(3 * sizeof(cf_t) * SRSLTE_SF_LEN_PRB(100)); buffer[i] = srslte_vec_malloc(3 * sizeof(cf_t) * SRSLTE_SF_LEN_PRB(100));
} }
sigset_t sigset; sigset_t sigset;
sigemptyset(&sigset); sigemptyset(&sigset);
sigaddset(&sigset, SIGINT); sigaddset(&sigset, SIGINT);
@ -139,28 +143,29 @@ int main(int argc, char **argv) {
printf("Set RX freq: %.6f MHz\n", srslte_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq) / 1000000); printf("Set RX freq: %.6f MHz\n", srslte_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq) / 1000000);
printf("Set RX gain: %.1f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain)); printf("Set RX gain: %.1f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain));
int srate = srslte_sampling_freq_hz(nof_prb); int srate = srslte_sampling_freq_hz(nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float) srate/1000000); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_rx_srate(&rf, (double) srate); float srate_rf = srslte_rf_set_rx_srate(&rf, (double)srate);
if (srate_rf != srate) { if (srate_rf != srate) {
ERROR("Could not set sampling rate\n"); ERROR("Could not set sampling rate\n");
exit(-1);
}
} else {
ERROR("Invalid number of PRB %d\n", nof_prb);
exit(-1); exit(-1);
} }
} else {
ERROR("Invalid number of PRB %d\n", nof_prb);
exit(-1);
}
srslte_rf_start_rx_stream(&rf, false); srslte_rf_start_rx_stream(&rf, false);
cell.cp = SRSLTE_CP_NORM; cell.cp = SRSLTE_CP_NORM;
cell.id = N_id_2; cell.id = N_id_2;
cell.nof_prb = nof_prb; cell.nof_prb = nof_prb;
cell.nof_ports = 1; cell.nof_ports = 1;
if (srslte_ue_sync_init_multi(&ue_sync, cell.nof_prb, cell.id==1000, srslte_rf_recv_wrapper, nof_rx_antennas, (void*) &rf)) { if (srslte_ue_sync_init_multi(
&ue_sync, cell.nof_prb, cell.id == 1000, srslte_rf_recv_wrapper, nof_rx_antennas, (void*)&rf)) {
fprintf(stderr, "Error initiating ue_sync\n"); fprintf(stderr, "Error initiating ue_sync\n");
exit(-1); exit(-1);
} }
if (srslte_ue_sync_set_cell(&ue_sync, cell)) { if (srslte_ue_sync_set_cell(&ue_sync, cell)) {
ERROR("Error initiating ue_sync\n"); ERROR("Error initiating ue_sync\n");
@ -168,11 +173,9 @@ int main(int argc, char **argv) {
} }
uint32_t subframe_count = 0; uint32_t subframe_count = 0;
bool start_capture = false; bool start_capture = false;
bool stop_capture = false; bool stop_capture = false;
while((subframe_count < nof_subframes || nof_subframes == -1) while ((subframe_count < nof_subframes || nof_subframes == -1) && !stop_capture) {
&& !stop_capture)
{
n = srslte_ue_sync_zerocopy(&ue_sync, buffer); n = srslte_ue_sync_zerocopy(&ue_sync, buffer);
if (n < 0) { if (n < 0) {
ERROR("Error receiving samples\n"); ERROR("Error receiving samples\n");
@ -181,21 +184,21 @@ int main(int argc, char **argv) {
if (n == 1) { if (n == 1) {
if (!start_capture) { if (!start_capture) {
if (srslte_ue_sync_get_sfidx(&ue_sync) == 9) { if (srslte_ue_sync_get_sfidx(&ue_sync) == 9) {
start_capture = true; start_capture = true;
} }
} else { } else {
printf("Writing to file %6d subframes...\r", subframe_count); printf("Writing to file %6d subframes...\r", subframe_count);
srslte_filesink_write_multi(&sink, (void**) buffer, SRSLTE_SF_LEN_PRB(nof_prb),nof_rx_antennas); srslte_filesink_write_multi(&sink, (void**)buffer, SRSLTE_SF_LEN_PRB(nof_prb), nof_rx_antennas);
subframe_count++; subframe_count++;
} }
} }
if (!keep_running) { if (!keep_running) {
if (!start_capture || (start_capture && srslte_ue_sync_get_sfidx(&ue_sync) == 9)) { if (!start_capture || (start_capture && srslte_ue_sync_get_sfidx(&ue_sync) == 9)) {
stop_capture = true; stop_capture = true;
} }
} }
} }
srslte_filesink_free(&sink); srslte_filesink_free(&sink);
srslte_rf_close(&rf); srslte_rf_close(&rf);
srslte_ue_sync_free(&ue_sync); srslte_ue_sync_free(&ue_sync);

@ -134,8 +134,8 @@ int main(int argc, char** argv)
srslte_rf_start_rx_stream(&rf, false); srslte_rf_start_rx_stream(&rf, false);
srslte_nbiot_cell_t cell = {}; srslte_nbiot_cell_t cell = {};
cell.base.nof_prb = nof_prb; cell.base.nof_prb = nof_prb;
cell.base.nof_ports = 1; cell.base.nof_ports = 1;
cf_t* buff_ptrs[SRSLTE_MAX_PORTS] = {NULL, NULL, NULL, NULL}; cf_t* buff_ptrs[SRSLTE_MAX_PORTS] = {NULL, NULL, NULL, NULL};
buff_ptrs[0] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB_NBIOT * 10); buff_ptrs[0] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB_NBIOT * 10);

@ -19,77 +19,79 @@
* *
*/ */
#include <complex.h>
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <math.h>
#include <time.h> #include <time.h>
#include <complex.h> #include <unistd.h>
#include "srslte/phy/rf/rf.h" #include "srslte/phy/rf/rf.h"
#include "srslte/srslte.h" #include "srslte/srslte.h"
uint32_t nof_prb = 25; uint32_t nof_prb = 25;
uint32_t nof_frames = 20; uint32_t nof_frames = 20;
int time_adv_samples = 0; int time_adv_samples = 0;
float tone_offset_hz = 1e6; float tone_offset_hz = 1e6;
float rf_rx_gain=40, srslte_rf_tx_gain=40, rf_freq=2.4e9; float rf_rx_gain = 40, srslte_rf_tx_gain = 40, rf_freq = 2.4e9;
char *rf_args=""; char* rf_args = "";
char *output_filename = NULL; char* output_filename = NULL;
char *input_filename = NULL; char* input_filename = NULL;
void usage(char *prog) { void usage(char* prog)
{
printf("Usage: %s -o [rx_signal_file]\n", prog); printf("Usage: %s -o [rx_signal_file]\n", prog);
printf("\t-a RF args [Default %s]\n", rf_args); printf("\t-a RF args [Default %s]\n", rf_args);
printf("\t-f RF TX/RX frequency [Default %.2f MHz]\n", rf_freq/1e6); printf("\t-f RF TX/RX frequency [Default %.2f MHz]\n", rf_freq / 1e6);
printf("\t-g RF RX gain [Default %.1f dB]\n", rf_rx_gain); printf("\t-g RF RX gain [Default %.1f dB]\n", rf_rx_gain);
printf("\t-G RF TX gain [Default %.1f dB]\n", srslte_rf_tx_gain); printf("\t-G RF TX gain [Default %.1f dB]\n", srslte_rf_tx_gain);
printf("\t-t Single tone offset (Hz) [Default %f]\n", tone_offset_hz); printf("\t-t Single tone offset (Hz) [Default %f]\n", tone_offset_hz);
printf("\t-T Time advance samples [Default %d]\n", time_adv_samples); printf("\t-T Time advance samples [Default %d]\n", time_adv_samples);
printf("\t-i File name to read signal from [Default single tone]\n"); printf("\t-i File name to read signal from [Default single tone]\n");
printf("\t-p Number of UL RB [Default %d]\n", nof_prb); printf("\t-p Number of UL RB [Default %d]\n", nof_prb);
} }
void parse_args(int argc, char **argv) { void parse_args(int argc, char** argv)
{
int opt; int opt;
while ((opt = getopt(argc, argv, "ioafgGptT")) != -1) { while ((opt = getopt(argc, argv, "ioafgGptT")) != -1) {
switch (opt) { switch (opt) {
case 'a': case 'a':
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'o': case 'o':
output_filename = argv[optind]; output_filename = argv[optind];
break; break;
case 'i': case 'i':
input_filename = argv[optind]; input_filename = argv[optind];
break; break;
case 't': case 't':
tone_offset_hz = strtof(argv[optind], NULL); tone_offset_hz = strtof(argv[optind], NULL);
break; break;
case 'T': case 'T':
time_adv_samples = (int)strtol(argv[optind], NULL, 10); time_adv_samples = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
rf_freq = strtof(argv[optind], NULL); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'g': case 'g':
rf_rx_gain = strtof(argv[optind], NULL); rf_rx_gain = strtof(argv[optind], NULL);
break; break;
case 'G': case 'G':
srslte_rf_tx_gain = strtof(argv[optind], NULL); srslte_rf_tx_gain = strtof(argv[optind], NULL);
break; break;
case 'p': case 'p':
nof_prb = (uint32_t)strtol(argv[optind], NULL, 10); nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
if (!srslte_nofprb_isvalid(nof_prb)) { if (!srslte_nofprb_isvalid(nof_prb)) {
ERROR("Invalid number of UL RB %d\n", nof_prb); ERROR("Invalid number of UL RB %d\n", nof_prb);
exit(-1);
}
break;
default:
usage(argv[0]);
exit(-1); exit(-1);
}
break;
default:
usage(argv[0]);
exit(-1);
} }
} }
if (!output_filename) { if (!output_filename) {
@ -103,34 +105,35 @@ void parse_args(int argc, char **argv) {
} }
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
{
parse_args(argc, argv); parse_args(argc, argv);
uint32_t flen = srslte_sampling_freq_hz(nof_prb)/1000; uint32_t flen = srslte_sampling_freq_hz(nof_prb) / 1000;
cf_t *rx_buffer = malloc(sizeof(cf_t)*flen*nof_frames); cf_t* rx_buffer = malloc(sizeof(cf_t) * flen * nof_frames);
if (!rx_buffer) { if (!rx_buffer) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
cf_t *tx_buffer = malloc(sizeof(cf_t)*(flen+time_adv_samples)); cf_t* tx_buffer = malloc(sizeof(cf_t) * (flen + time_adv_samples));
if (!tx_buffer) { if (!tx_buffer) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
bzero(tx_buffer, sizeof(cf_t)*(flen+time_adv_samples)); bzero(tx_buffer, sizeof(cf_t) * (flen + time_adv_samples));
cf_t *zeros = calloc(sizeof(cf_t),flen); cf_t* zeros = calloc(sizeof(cf_t), flen);
if (!zeros) { if (!zeros) {
perror("calloc"); perror("calloc");
exit(-1); exit(-1);
} }
float time_adv_sec = (float) time_adv_samples/srslte_sampling_freq_hz(nof_prb); float time_adv_sec = (float)time_adv_samples / srslte_sampling_freq_hz(nof_prb);
// Send through RF // Send through RF
srslte_rf_t rf; srslte_rf_t rf;
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open(&rf, rf_args)) { if (srslte_rf_open(&rf, rf_args)) {
ERROR("Error opening rf\n"); ERROR("Error opening rf\n");
@ -138,48 +141,45 @@ int main(int argc, char **argv) {
} }
int srate = srslte_sampling_freq_hz(nof_prb); int srate = srslte_sampling_freq_hz(nof_prb);
srslte_rf_set_rx_srate(&rf, (double) srate); srslte_rf_set_rx_srate(&rf, (double)srate);
srslte_rf_set_tx_srate(&rf, (double) srate); srslte_rf_set_tx_srate(&rf, (double)srate);
printf("Subframe len: %d samples\n", flen); printf("Subframe len: %d samples\n", flen);
printf("Time advance: %f us\n",time_adv_sec*1e6); printf("Time advance: %f us\n", time_adv_sec * 1e6);
printf("Set TX/RX rate: %.2f MHz\n", (float) srate / 1000000); printf("Set TX/RX rate: %.2f MHz\n", (float)srate / 1000000);
printf("Set RX gain: %.1f dB\n", srslte_rf_set_rx_gain(&rf, rf_rx_gain)); printf("Set RX gain: %.1f dB\n", srslte_rf_set_rx_gain(&rf, rf_rx_gain));
printf("Set TX gain: %.1f dB\n", srslte_rf_set_tx_gain(&rf, srslte_rf_tx_gain)); printf("Set TX gain: %.1f dB\n", srslte_rf_set_tx_gain(&rf, srslte_rf_tx_gain));
printf("Set TX/RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&rf, 0, rf_freq) / 1000000); printf("Set TX/RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&rf, 0, rf_freq) / 1000000);
srslte_rf_set_tx_freq(&rf, 0, rf_freq); srslte_rf_set_tx_freq(&rf, 0, rf_freq);
sleep(1); sleep(1);
if (input_filename) { if (input_filename) {
srslte_vec_load_file(input_filename, &tx_buffer[time_adv_samples], flen*sizeof(cf_t)); srslte_vec_load_file(input_filename, &tx_buffer[time_adv_samples], flen * sizeof(cf_t));
} else { } else {
for (int i=0;i<flen-time_adv_samples;i++) { for (int i = 0; i < flen - time_adv_samples; i++) {
tx_buffer[i+time_adv_samples] = 0.3*cexpf(_Complex_I*2*M_PI*tone_offset_hz*((float) i/(float) srate)); tx_buffer[i + time_adv_samples] = 0.3 * cexpf(_Complex_I * 2 * M_PI * tone_offset_hz * ((float)i / (float)srate));
} }
srslte_vec_save_file("srslte_rf_txrx_tone", tx_buffer, flen*sizeof(cf_t)); srslte_vec_save_file("srslte_rf_txrx_tone", tx_buffer, flen * sizeof(cf_t));
} }
srslte_timestamp_t tstamp; srslte_timestamp_t tstamp;
srslte_rf_start_rx_stream(&rf, false); srslte_rf_start_rx_stream(&rf, false);
uint32_t nframe=0; uint32_t nframe = 0;
while(nframe<nof_frames) { while (nframe < nof_frames) {
printf("Rx subframe %d\n", nframe); printf("Rx subframe %d\n", nframe);
srslte_rf_recv_with_time(&rf, &rx_buffer[flen*nframe], flen, true, &tstamp.full_secs, &tstamp.frac_secs); srslte_rf_recv_with_time(&rf, &rx_buffer[flen * nframe], flen, true, &tstamp.full_secs, &tstamp.frac_secs);
nframe++; nframe++;
if (nframe==9) { if (nframe == 9) {
srslte_timestamp_add(&tstamp, 0, 2e-3-time_adv_sec); srslte_timestamp_add(&tstamp, 0, 2e-3 - time_adv_sec);
srslte_rf_send_timed2(&rf, tx_buffer, flen+time_adv_samples, tstamp.full_secs, tstamp.frac_secs, true, true); srslte_rf_send_timed2(&rf, tx_buffer, flen + time_adv_samples, tstamp.full_secs, tstamp.frac_secs, true, true);
printf("Transmitting Signal\n"); printf("Transmitting Signal\n");
} }
} }
srslte_vec_save_file(output_filename, &rx_buffer[10*flen], flen*sizeof(cf_t)); srslte_vec_save_file(output_filename, &rx_buffer[10 * flen], flen * sizeof(cf_t));
free(tx_buffer); free(tx_buffer);
free(rx_buffer); free(rx_buffer);

@ -19,37 +19,37 @@
* *
*/ */
#include <stdio.h> #include <math.h>
#include <signal.h> #include <signal.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <math.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include <zmq.h> #include <zmq.h>
#include <stdbool.h> #include <stdbool.h>
#include "srslte/srslte.h"
#include "srslte/phy/rf/rf.h" #include "srslte/phy/rf/rf.h"
#include "srslte/srslte.h"
static bool keep_running = true; static bool keep_running = true;
static uint32_t nof_rx_antennas = 1; static uint32_t nof_rx_antennas = 1;
static const uint32_t max_rx_antennas = 1; static const uint32_t max_rx_antennas = 1;
static void int_handler(int dummy); static void int_handler(int dummy);
static void usage(char *prog); static void usage(char* prog);
static void parse_args(int argc, char **argv); static void parse_args(int argc, char** argv);
static int init_radio(uint32_t *buf_len); static int init_radio(uint32_t* buf_len);
static int rx_radio(void **buffer, uint32_t buff_len); static int rx_radio(void** buffer, uint32_t buff_len);
static void close_radio(); static void close_radio();
/* Example function to initialize ZMQ socket */ /* Example function to initialize ZMQ socket */
static void *zmq_ctx = NULL; static void* zmq_ctx = NULL;
static void *zmq_sock = NULL; static void* zmq_sock = NULL;
static const char *zmq_args = "tcp://*:5550"; static const char* zmq_args = "tcp://*:5550";
static int init_zmq() static int init_zmq()
{ {
zmq_ctx = zmq_ctx_new(); zmq_ctx = zmq_ctx_new();
@ -69,7 +69,7 @@ static int init_zmq()
} }
/* Example function to write samples to ZMQ socket */ /* Example function to write samples to ZMQ socket */
static int tx_zmq(void **buffer, uint32_t buffer_len) static int tx_zmq(void** buffer, uint32_t buffer_len)
{ {
// wait for request // wait for request
uint8_t dummy; uint8_t dummy;
@ -77,10 +77,11 @@ static int tx_zmq(void **buffer, uint32_t buffer_len)
return zmq_send(zmq_sock, buffer[0], buffer_len, 0); return zmq_send(zmq_sock, buffer[0], buffer_len, 0);
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
void *buffer[max_rx_antennas]; {
int n = 0; void* buffer[max_rx_antennas];
uint32_t buflen = 0; // in samples int n = 0;
uint32_t buflen = 0; // in samples
uint32_t sample_size = 8; uint32_t sample_size = 8;
// Sets signal handlers // Sets signal handlers
@ -105,9 +106,9 @@ int main(int argc, char **argv) {
} }
// Initializes memory for input buffer // Initializes memory for input buffer
bzero(buffer, sizeof(void*)*max_rx_antennas); bzero(buffer, sizeof(void*) * max_rx_antennas);
for (int i = 0; i < nof_rx_antennas; i++) { for (int i = 0; i < nof_rx_antennas; i++) {
buffer[i] = malloc(buflen*sizeof(cf_t)); buffer[i] = malloc(buflen * sizeof(cf_t));
if (!buffer[i]) { if (!buffer[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
@ -116,7 +117,7 @@ int main(int argc, char **argv) {
printf("Streaming samples...\n"); printf("Streaming samples...\n");
uint32_t print_cnt = 0; uint32_t print_cnt = 0;
while(keep_running) { while (keep_running) {
n = rx_radio(buffer, buflen); n = rx_radio(buffer, buflen);
if (n < 0) { if (n < 0) {
ERROR("Error receiving samples\n"); ERROR("Error receiving samples\n");
@ -126,7 +127,7 @@ int main(int argc, char **argv) {
printf("Received %d samples from radio\n", n); printf("Received %d samples from radio\n", n);
} }
n = tx_zmq((void**) buffer, n*sample_size); n = tx_zmq((void**)buffer, n * sample_size);
if (n == -1) { if (n == -1) {
print_cnt++; print_cnt++;
@ -156,11 +157,11 @@ int main(int argc, char **argv) {
/* Example function to initialize the Radio frontend. In this case, we use srsLTE RF API to open a device, /* Example function to initialize the Radio frontend. In this case, we use srsLTE RF API to open a device,
* which automatically picks UHD, bladeRF, limeSDR, etc. * which automatically picks UHD, bladeRF, limeSDR, etc.
*/ */
static srslte_rf_t rf = {}; static srslte_rf_t rf = {};
static char *rf_args = "fastpath"; static char* rf_args = "fastpath";
static float rf_gain = 40.0, rf_freq = -1.0, rf_rate = 11.52e6; static float rf_gain = 40.0, rf_freq = -1.0, rf_rate = 11.52e6;
static uint32_t rf_recv_frame_size_ms = 1; static uint32_t rf_recv_frame_size_ms = 1;
static int init_radio(uint32_t *buffer_len) static int init_radio(uint32_t* buffer_len)
{ {
// Uses srsLTE RF API to open a device, could use other code here // Uses srsLTE RF API to open a device, could use other code here
printf("Opening RF device...\n"); printf("Opening RF device...\n");
@ -178,17 +179,17 @@ static int init_radio(uint32_t *buffer_len)
} }
if (buffer_len) { if (buffer_len) {
*buffer_len = srate*rf_recv_frame_size_ms*1e-3; *buffer_len = srate * rf_recv_frame_size_ms * 1e-3;
} }
printf("Set RX rate: %.2f MHz\n", srate*1e-6); printf("Set RX rate: %.2f MHz\n", srate * 1e-6);
srslte_rf_start_rx_stream(&rf, false); srslte_rf_start_rx_stream(&rf, false);
return 0; return 0;
} }
/* Example implementation to receive from Radio frontend. In this case we use srsLTE /* Example implementation to receive from Radio frontend. In this case we use srsLTE
*/ */
static int rx_radio(void **buffer, uint32_t buf_len) static int rx_radio(void** buffer, uint32_t buf_len)
{ {
return srslte_rf_recv_with_time_multi(&rf, buffer, buf_len, true, NULL, NULL); return srslte_rf_recv_with_time_multi(&rf, buffer, buf_len, true, NULL, NULL);
} }
@ -198,11 +199,13 @@ static void close_radio()
srslte_rf_close(&rf); srslte_rf_close(&rf);
} }
static void int_handler(int dummy) { static void int_handler(int dummy)
{
keep_running = false; keep_running = false;
} }
static void usage(char *prog) { static void usage(char* prog)
{
printf("Usage: %s [agrAzv] -f rx_frequency_hz\n", prog); printf("Usage: %s [agrAzv] -f rx_frequency_hz\n", prog);
printf("\t-a RF args [Default %s]\n", rf_args); printf("\t-a RF args [Default %s]\n", rf_args);
printf("\t-g RF Gain [Default %.2f dB]\n", rf_gain); printf("\t-g RF Gain [Default %.2f dB]\n", rf_gain);
@ -213,7 +216,8 @@ static void usage(char *prog) {
printf("\t-v srslte_verbose\n"); printf("\t-v srslte_verbose\n");
} }
static void parse_args(int argc, char **argv) { static void parse_args(int argc, char** argv)
{
int opt; int opt;
while ((opt = getopt(argc, argv, "agrfvmzA")) != -1) { while ((opt = getopt(argc, argv, "agrfvmzA")) != -1) {
switch (opt) { switch (opt) {
@ -256,4 +260,3 @@ static void parse_args(int argc, char **argv) {
exit(-1); exit(-1);
} }
} }

@ -21,11 +21,10 @@
#ifndef SRSLTE_GTPC_H #ifndef SRSLTE_GTPC_H
#define SRSLTE_GTPC_H #define SRSLTE_GTPC_H
#include <stdint.h>
#include "srslte/asn1/gtpc_msg.h" #include "srslte/asn1/gtpc_msg.h"
#include <stdint.h>
namespace srslte {
namespace srslte{
/*GTP-C Version*/ /*GTP-C Version*/
const uint8_t GTPC_V2 = 2; const uint8_t GTPC_V2 = 2;

@ -24,8 +24,7 @@
#include "srslte/phy/io/netsource.h" #include "srslte/phy/io/netsource.h"
namespace srslte namespace srslte {
{
/**************************************************************** /****************************************************************
* *
@ -33,111 +32,110 @@ namespace srslte
* Ref: TS 29.274 v10.14.0 Table 8.1-1 * Ref: TS 29.274 v10.14.0 Table 8.1-1
* *
****************************************************************/ ****************************************************************/
enum gtpc_ie_type enum gtpc_ie_type {
{ // const uint8_t GTPC_IE_TYPE_RESERVED = 0;
//const uint8_t GTPC_IE_TYPE_RESERVED = 0; GTPC_IE_TYPE_IMSI = 1,
GTPC_IE_TYPE_IMSI = 1, GTPC_IE_TYPE_CAUSE = 2,
GTPC_IE_TYPE_CAUSE = 2,
GTPC_IE_TYPE_RECOVERY = 3, GTPC_IE_TYPE_RECOVERY = 3,
//4 to 50 RESERVED_FOR_S101_INTERFACE // 4 to 50 RESERVED_FOR_S101_INTERFACE
GTPC_IE_TYPE_STN_SR = 51, GTPC_IE_TYPE_STN_SR = 51,
//52 to 70 RESERVED_FOR_SV_INTERFACE // 52 to 70 RESERVED_FOR_SV_INTERFACE
GTPC_IE_TYPE_APN = 71, GTPC_IE_TYPE_APN = 71,
GTPC_IE_TYPE_AMBR = 72, GTPC_IE_TYPE_AMBR = 72,
GTPC_IE_TYPE_EBI = 73, GTPC_IE_TYPE_EBI = 73,
GTPC_IE_TYPE_IP_ADDRESS = 74, GTPC_IE_TYPE_IP_ADDRESS = 74,
GTPC_IE_TYPE_MEI = 75, GTPC_IE_TYPE_MEI = 75,
GTPC_IE_TYPE_MSISDN = 76, GTPC_IE_TYPE_MSISDN = 76,
GTPC_IE_TYPE_INDICATION = 77, GTPC_IE_TYPE_INDICATION = 77,
GTPC_IE_TYPE_PCO = 78, GTPC_IE_TYPE_PCO = 78,
GTPC_IE_TYPE_PDN_ADDRESS_ALLOCATION = 79, GTPC_IE_TYPE_PDN_ADDRESS_ALLOCATION = 79,
GTPC_IE_TYPE_BEARER_QOS = 80, GTPC_IE_TYPE_BEARER_QOS = 80,
GTPC_IE_TYPE_FLOW_QOS = 81, GTPC_IE_TYPE_FLOW_QOS = 81,
GTPC_IE_TYPE_RAT_TYPE = 82, GTPC_IE_TYPE_RAT_TYPE = 82,
GTPC_IE_TYPE_SERVING_NETWORK = 83, GTPC_IE_TYPE_SERVING_NETWORK = 83,
GTPC_IE_TYPE_BEARER_TFT = 84, GTPC_IE_TYPE_BEARER_TFT = 84,
GTPC_IE_TYPE_TAD = 85, GTPC_IE_TYPE_TAD = 85,
GTPC_IE_TYPE_ULI = 86, GTPC_IE_TYPE_ULI = 86,
GTPC_IE_TYPE_F_TEID = 87, GTPC_IE_TYPE_F_TEID = 87,
GTPC_IE_TYPE_TMSI = 88, GTPC_IE_TYPE_TMSI = 88,
GTPC_IE_TYPE_GLOBAL_CN_ID = 89, GTPC_IE_TYPE_GLOBAL_CN_ID = 89,
GTPC_IE_TYPE_S103_PDN_DATA_FORWARDING_INFO = 90, GTPC_IE_TYPE_S103_PDN_DATA_FORWARDING_INFO = 90,
GTPC_IE_TYPE_S1_U_DATA_FORWARDING_INFO = 91, GTPC_IE_TYPE_S1_U_DATA_FORWARDING_INFO = 91,
GTPC_IE_TYPE_DELAY_VALUE = 92, GTPC_IE_TYPE_DELAY_VALUE = 92,
GTPC_IE_TYPE_BEARER_CONTEXT = 93, GTPC_IE_TYPE_BEARER_CONTEXT = 93,
GTPC_IE_TYPE_CHARGING_ID = 94, GTPC_IE_TYPE_CHARGING_ID = 94,
GTPC_IE_TYPE_CHARGING_CHARACTERISTICS = 95, GTPC_IE_TYPE_CHARGING_CHARACTERISTICS = 95,
GTPC_IE_TYPE_TRACE_INFORMATION = 96, GTPC_IE_TYPE_TRACE_INFORMATION = 96,
GTPC_IE_TYPE_BEARER_FLAGS = 97, GTPC_IE_TYPE_BEARER_FLAGS = 97,
//98 Reserved // 98 Reserved
GTPC_IE_TYPE_PDN_TYPE = 99, GTPC_IE_TYPE_PDN_TYPE = 99,
GTPC_IE_TYPE_PROCEDURE_TRANSACTION_ID = 100, GTPC_IE_TYPE_PROCEDURE_TRANSACTION_ID = 100,
GTPC_IE_TYPE_DRX_PARAMETER = 101, GTPC_IE_TYPE_DRX_PARAMETER = 101,
//102 Reserved // 102 Reserved
GTPC_IE_TYPE_MM_CONTEXT_GSM_KEY_AND_TRIPLETS = 103, GTPC_IE_TYPE_MM_CONTEXT_GSM_KEY_AND_TRIPLETS = 103,
GTPC_IE_TYPE_MM_CONTEXT_UMTS_KEY_USED_CIPHER_AND_QUINTUPLETS = 104, GTPC_IE_TYPE_MM_CONTEXT_UMTS_KEY_USED_CIPHER_AND_QUINTUPLETS = 104,
GTPC_IE_TYPE_MM_CONTEXT_GSM_KEY_USED_CIPHER_AND_QUINTUPLETS = 105, GTPC_IE_TYPE_MM_CONTEXT_GSM_KEY_USED_CIPHER_AND_QUINTUPLETS = 105,
GTPC_IE_TYPE_MM_CONTEXT_UMTS_KEY_AND_QUINTUPLETS = 106, GTPC_IE_TYPE_MM_CONTEXT_UMTS_KEY_AND_QUINTUPLETS = 106,
GTPC_IE_TYPE_MM_CONTEXT_EPS_SECURITY_CONTEXT_QUADRUPLETS_AND_QUINTUPLETS = 107, GTPC_IE_TYPE_MM_CONTEXT_EPS_SECURITY_CONTEXT_QUADRUPLETS_AND_QUINTUPLETS = 107,
GTPC_IE_TYPE_MM_CONTEXT_UMTS_KEY_QUADRUPLETS_AND_QUINTUPLETS = 108, GTPC_IE_TYPE_MM_CONTEXT_UMTS_KEY_QUADRUPLETS_AND_QUINTUPLETS = 108,
GTPC_IE_TYPE_PDN_CONNECTION = 109, GTPC_IE_TYPE_PDN_CONNECTION = 109,
GTPC_IE_TYPE_PDU_NUMBERS = 110, GTPC_IE_TYPE_PDU_NUMBERS = 110,
GTPC_IE_TYPE_P_TMSI = 111, GTPC_IE_TYPE_P_TMSI = 111,
GTPC_IE_TYPE_P_TMSI_SIGNATURE = 112, GTPC_IE_TYPE_P_TMSI_SIGNATURE = 112,
GTPC_IE_TYPE_HOP_COUNTER = 113, GTPC_IE_TYPE_HOP_COUNTER = 113,
GTPC_IE_TYPE_UE_TIME_ZONE = 114, GTPC_IE_TYPE_UE_TIME_ZONE = 114,
GTPC_IE_TYPE_TRACE_REFERENCE = 115, GTPC_IE_TYPE_TRACE_REFERENCE = 115,
GTPC_IE_TYPE_COMPLETE_REQUEST_MESSAGE = 116, GTPC_IE_TYPE_COMPLETE_REQUEST_MESSAGE = 116,
GTPC_IE_TYPE_GUTI = 117, GTPC_IE_TYPE_GUTI = 117,
GTPC_IE_TYPE_F_CONTAINER = 118, GTPC_IE_TYPE_F_CONTAINER = 118,
GTPC_IE_TYPE_F_CAUSE = 119, GTPC_IE_TYPE_F_CAUSE = 119,
GTPC_IE_TYPE_SELECTED_PLMN_ID = 120, GTPC_IE_TYPE_SELECTED_PLMN_ID = 120,
GTPC_IE_TYPE_TARGET_IDENTIFICATION = 121, GTPC_IE_TYPE_TARGET_IDENTIFICATION = 121,
//122 Reserved // 122 Reserved
GTPC_IE_TYPE_PACKET_FLOW_ID = 123, GTPC_IE_TYPE_PACKET_FLOW_ID = 123,
GTPC_IE_TYPE_RAB_CONTEXT = 124, GTPC_IE_TYPE_RAB_CONTEXT = 124,
GTPC_IE_TYPE_SOURCE_RNC_PDCP_CONTEXT_INFO = 125, GTPC_IE_TYPE_SOURCE_RNC_PDCP_CONTEXT_INFO = 125,
GTPC_IE_TYPE_UDP_SOURCE_PORT_NUMBER = 126, GTPC_IE_TYPE_UDP_SOURCE_PORT_NUMBER = 126,
GTPC_IE_TYPE_APN_RESTRICTION = 127, GTPC_IE_TYPE_APN_RESTRICTION = 127,
GTPC_IE_TYPE_SELECTION_MODE = 128, GTPC_IE_TYPE_SELECTION_MODE = 128,
GTPC_IE_TYPE_SOURCE_IDENTIFICATION = 129, GTPC_IE_TYPE_SOURCE_IDENTIFICATION = 129,
//130 RESERVED // 130 RESERVED
GTPC_IE_TYPE_CHANGE_REPORTING_ACTION = 131, GTPC_IE_TYPE_CHANGE_REPORTING_ACTION = 131,
GTPC_IE_TYPE_FQ_CSID = 132, GTPC_IE_TYPE_FQ_CSID = 132,
GTPC_IE_TYPE_CHANNEL_NEEDED = 133, GTPC_IE_TYPE_CHANNEL_NEEDED = 133,
GTPC_IE_TYPE_EMLPP_PRIORITY = 134, GTPC_IE_TYPE_EMLPP_PRIORITY = 134,
GTPC_IE_TYPE_NODE_TYPE = 135, GTPC_IE_TYPE_NODE_TYPE = 135,
GTPC_IE_TYPE_FQDN = 136, GTPC_IE_TYPE_FQDN = 136,
GTPC_IE_TYPE_TI = 137, GTPC_IE_TYPE_TI = 137,
GTPC_IE_TYPE_MBMS_SESSION_DURATION = 138, GTPC_IE_TYPE_MBMS_SESSION_DURATION = 138,
GTPC_IE_TYPE_MBMS_SERVICE_AREA = 139, GTPC_IE_TYPE_MBMS_SERVICE_AREA = 139,
GTPC_IE_TYPE_MBMS_SESSION_IDENTIFIER = 140, GTPC_IE_TYPE_MBMS_SESSION_IDENTIFIER = 140,
GTPC_IE_TYPE_MBMS_FLOW_IDENTIFIER = 141, GTPC_IE_TYPE_MBMS_FLOW_IDENTIFIER = 141,
GTPC_IE_TYPE_MBMS_IP_MULTICAST_DISTRIBUTION = 142, GTPC_IE_TYPE_MBMS_IP_MULTICAST_DISTRIBUTION = 142,
GTPC_IE_TYPE_MBMS_DISTRIBUTION_ACKNOWLEDGE = 143, GTPC_IE_TYPE_MBMS_DISTRIBUTION_ACKNOWLEDGE = 143,
GTPC_IE_TYPE_RFSP_INDEX = 144, GTPC_IE_TYPE_RFSP_INDEX = 144,
GTPC_IE_TYPE_UCI = 145, GTPC_IE_TYPE_UCI = 145,
GTPC_IE_TYPE_CSG_INFORMATION_REPORTING_ACTION = 146, GTPC_IE_TYPE_CSG_INFORMATION_REPORTING_ACTION = 146,
GTPC_IE_TYPE_CSG_ID = 147, GTPC_IE_TYPE_CSG_ID = 147,
GTPC_IE_TYPE_CMI = 148, GTPC_IE_TYPE_CMI = 148,
GTPC_IE_TYPE_SERVICE_INDICATOR = 149, GTPC_IE_TYPE_SERVICE_INDICATOR = 149,
GTPC_IE_TYPE_DETACH_TYPE = 150, GTPC_IE_TYPE_DETACH_TYPE = 150,
GTPC_IE_TYPE_LDN = 151, GTPC_IE_TYPE_LDN = 151,
GTPC_IE_TYPE_NODE_FEATURES = 152, GTPC_IE_TYPE_NODE_FEATURES = 152,
GTPC_IE_TYPE_MBMS_TIME_TO_DATA_TRANSFER = 153, GTPC_IE_TYPE_MBMS_TIME_TO_DATA_TRANSFER = 153,
GTPC_IE_TYPE_THROTTLING =154, GTPC_IE_TYPE_THROTTLING = 154,
GTPC_IE_TYPE_ARP = 155, GTPC_IE_TYPE_ARP = 155,
GTPC_IE_TYPE_EPC_TIMER = 156, GTPC_IE_TYPE_EPC_TIMER = 156,
GTPC_IE_TYPE_SIGNALLING_PRIORITY_INDICATION = 157, GTPC_IE_TYPE_SIGNALLING_PRIORITY_INDICATION = 157,
GTPC_IE_TYPE_TMGI = 158, GTPC_IE_TYPE_TMGI = 158,
GTPC_IE_TYPE_ADDITIONAL_MM_CONTEXT_FOR_SRVCC = 159, GTPC_IE_TYPE_ADDITIONAL_MM_CONTEXT_FOR_SRVCC = 159,
GTPC_IE_TYPE_ADDITIONAL_FLAGS_FOR_SRVCC = 160, GTPC_IE_TYPE_ADDITIONAL_FLAGS_FOR_SRVCC = 160,
//161 RESERVED // 161 RESERVED
GTPC_IE_TYPE_MDT_CONFIGURATION = 162, GTPC_IE_TYPE_MDT_CONFIGURATION = 162,
GTPC_IE_TYPE_APCO = 163, GTPC_IE_TYPE_APCO = 163,
//164 RESERVED // 164 RESERVED
GTPC_IE_TYPE_CHANGE_TO_REPORT_FLAGS = 165, GTPC_IE_TYPE_CHANGE_TO_REPORT_FLAGS = 165,
//168 TO 254 SPARE. FOR FUTURE USE. // 168 TO 254 SPARE. FOR FUTURE USE.
GTPC_IE_TYPE_PRIVATE_EXTENSION = 255 GTPC_IE_TYPE_PRIVATE_EXTENSION = 255
}; };
@ -149,7 +147,7 @@ enum gtpc_ie_type
****************************************************************/ ****************************************************************/
/* /*
* The IMSI should be kept as an uint64_t. * The IMSI should be kept as an uint64_t.
* The responsibility to convert from uint64_t to BCD coded is on * The responsibility to convert from uint64_t to BCD coded is on
* the pack_imsi_ie function * the pack_imsi_ie function
*/ */
@ -159,91 +157,89 @@ enum gtpc_ie_type
* Ref: 3GPP TS 29.274 v10.14.0 Figure 8.4-1 and Table 8.4-1 * Ref: 3GPP TS 29.274 v10.14.0 Figure 8.4-1 and Table 8.4-1
* *
***************************************************************************/ ***************************************************************************/
enum gtpc_cause_value enum gtpc_cause_value {
{ // Reserved
//Reserved GTPC_CAUSE_VALUE_LOCAL_DETACH = 2,
GTPC_CAUSE_VALUE_LOCAL_DETACH = 2, GTPC_CAUSE_VALUE_COMPLETE_DETACH = 3,
GTPC_CAUSE_VALUE_COMPLETE_DETACH = 3, GTPC_CAUSE_VALUE_RAT_CHANGED_FROM_3GPP_TO_NON_3GPP = 4,
GTPC_CAUSE_VALUE_RAT_CHANGED_FROM_3GPP_TO_NON_3GPP = 4, GTPC_CAUSE_VALUE_ISR_DEACTIVATION = 5,
GTPC_CAUSE_VALUE_ISR_DEACTIVATION = 5,
GTPC_CAUSE_VALUE_ERROR_INDICATION_RECEIVED_FROM_RNC_ENODEB_S4_SGSN = 6, GTPC_CAUSE_VALUE_ERROR_INDICATION_RECEIVED_FROM_RNC_ENODEB_S4_SGSN = 6,
GTPC_CAUSE_VALUE_IMSI_DETACH_ONLY = 7, GTPC_CAUSE_VALUE_IMSI_DETACH_ONLY = 7,
GTPC_CAUSE_VALUE_REACTIVATION_REQUESTED = 8, GTPC_CAUSE_VALUE_REACTIVATION_REQUESTED = 8,
GTPC_CAUSE_VALUE_PDN_RECONNECTION_TO_THIS_APN_DISALLOWED = 9, GTPC_CAUSE_VALUE_PDN_RECONNECTION_TO_THIS_APN_DISALLOWED = 9,
GTPC_CAUSE_VALUE_ACCESS_CHANGED_FROM_NON_3GPP_TO_3GPP = 10, GTPC_CAUSE_VALUE_ACCESS_CHANGED_FROM_NON_3GPP_TO_3GPP = 10,
GTPC_CAUSE_VALUE_PDN_CONNECTION_INACTIVITY_TIMER_EXPIRES = 11, GTPC_CAUSE_VALUE_PDN_CONNECTION_INACTIVITY_TIMER_EXPIRES = 11,
//Spare. This value range shall be used by Cause values in an initial/request message. // Spare. This value range shall be used by Cause values in an initial/request message.
GTPC_CAUSE_VALUE_REQUEST_ACCEPTED = 16, GTPC_CAUSE_VALUE_REQUEST_ACCEPTED = 16,
GTPC_CAUSE_VALUE_REQUEST_ACCEPTED_PARTIALLY = 17, GTPC_CAUSE_VALUE_REQUEST_ACCEPTED_PARTIALLY = 17,
GTPC_CAUSE_VALUE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE = 18, GTPC_CAUSE_VALUE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE = 18,
GTPC_CAUSE_VALUE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY = 19, GTPC_CAUSE_VALUE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY = 19,
//20-63 Spare. // 20-63 Spare.
GTPC_CAUSE_VALUE_CONTEXT_NOT_FOUND = 64, GTPC_CAUSE_VALUE_CONTEXT_NOT_FOUND = 64,
GTPC_CAUSE_VALUE_INVALID_MESSAGE_FORMAT = 65, GTPC_CAUSE_VALUE_INVALID_MESSAGE_FORMAT = 65,
GTPC_CAUSE_VALUE_VERSION_NOT_SUPPORTED_BY_NEXT_PEER = 66, GTPC_CAUSE_VALUE_VERSION_NOT_SUPPORTED_BY_NEXT_PEER = 66,
GTPC_CAUSE_VALUE_INVALID_LENGTH = 67, GTPC_CAUSE_VALUE_INVALID_LENGTH = 67,
GTPC_CAUSE_VALUE_SERVICE_NOT_SUPPORTED = 68, GTPC_CAUSE_VALUE_SERVICE_NOT_SUPPORTED = 68,
GTPC_CAUSE_VALUE_MANDATORY_IE_INCORRECT = 69, GTPC_CAUSE_VALUE_MANDATORY_IE_INCORRECT = 69,
GTPC_CAUSE_VALUE_MANDATORY_IE_MISSING = 70, GTPC_CAUSE_VALUE_MANDATORY_IE_MISSING = 70,
//71 Shall not be used. // 71 Shall not be used.
GTPC_CAUSE_VALUE_SYSTEM_FAILURE = 72, GTPC_CAUSE_VALUE_SYSTEM_FAILURE = 72,
GTPC_CAUSE_VALUE_NO_RESOURCES_AVAILABLE = 73, GTPC_CAUSE_VALUE_NO_RESOURCES_AVAILABLE = 73,
GTPC_CAUSE_VALUE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION = 74, GTPC_CAUSE_VALUE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION = 74,
GTPC_CAUSE_VALUE_SYNTACTIC_ERROR_IN_THE_TFT_OPERATION = 75, GTPC_CAUSE_VALUE_SYNTACTIC_ERROR_IN_THE_TFT_OPERATION = 75,
GTPC_CAUSE_VALUE_SEMANTIC_ERRORS_IN_PACKET_FILTER = 76, GTPC_CAUSE_VALUE_SEMANTIC_ERRORS_IN_PACKET_FILTER = 76,
GTPC_CAUSE_VALUE_SYNTACTIC_ERRORS_IN_PACKET_FILTER = 77, GTPC_CAUSE_VALUE_SYNTACTIC_ERRORS_IN_PACKET_FILTER = 77,
GTPC_CAUSE_VALUE_MISSING_OR_UNKNOWN_APN = 78, GTPC_CAUSE_VALUE_MISSING_OR_UNKNOWN_APN = 78,
//79 Shall not be used. // 79 Shall not be used.
GTPC_CAUSE_VALUE_GRE_KEY_NOT_FOUND = 80, GTPC_CAUSE_VALUE_GRE_KEY_NOT_FOUND = 80,
GTPC_CAUSE_VALUE_RELOCATION_FAILURE = 81, GTPC_CAUSE_VALUE_RELOCATION_FAILURE = 81,
GTPC_CAUSE_VALUE_DENIED_IN_RAT = 82, GTPC_CAUSE_VALUE_DENIED_IN_RAT = 82,
GTPC_CAUSE_VALUE_PREFERRED_PDN_TYPE_NOT_SUPPORTED = 83, GTPC_CAUSE_VALUE_PREFERRED_PDN_TYPE_NOT_SUPPORTED = 83,
GTPC_CAUSE_VALUE_ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED = 84, GTPC_CAUSE_VALUE_ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED = 84,
GTPC_CAUSE_VALUE_UE_CONTEXT_WITHOUT_TFT_ALREADY_ACTIVATED = 85, GTPC_CAUSE_VALUE_UE_CONTEXT_WITHOUT_TFT_ALREADY_ACTIVATED = 85,
GTPC_CAUSE_VALUE_PROTOCOL_TYPE_NOT_SUPPORTED = 86, GTPC_CAUSE_VALUE_PROTOCOL_TYPE_NOT_SUPPORTED = 86,
GTPC_CAUSE_VALUE_UE_NOT_RESPONDING = 87, GTPC_CAUSE_VALUE_UE_NOT_RESPONDING = 87,
GTPC_CAUSE_VALUE_UE_REFUSES = 88, GTPC_CAUSE_VALUE_UE_REFUSES = 88,
GTPC_CAUSE_VALUE_SERVICE_DENIED = 89, GTPC_CAUSE_VALUE_SERVICE_DENIED = 89,
GTPC_CAUSE_VALUE_UNABLE_TO_PAGE_UE = 90, GTPC_CAUSE_VALUE_UNABLE_TO_PAGE_UE = 90,
GTPC_CAUSE_VALUE_NO_MEMORY_AVAILABLE = 91, GTPC_CAUSE_VALUE_NO_MEMORY_AVAILABLE = 91,
GTPC_CAUSE_VALUE_USER_AUTHENTICATION_FAILED = 92, GTPC_CAUSE_VALUE_USER_AUTHENTICATION_FAILED = 92,
GTPC_CAUSE_VALUE_APN_ACCESS_DENIED_NO_SUBSCRIPTION = 93, GTPC_CAUSE_VALUE_APN_ACCESS_DENIED_NO_SUBSCRIPTION = 93,
GTPC_CAUSE_VALUE_REQUEST_REJECTED = 94, GTPC_CAUSE_VALUE_REQUEST_REJECTED = 94,
GTPC_CAUSE_VALUE_P_TMSI_SIGNATURE_MISMATCH = 95, GTPC_CAUSE_VALUE_P_TMSI_SIGNATURE_MISMATCH = 95,
GTPC_CAUSE_VALUE_IMSI_IMEI_NOT_KNOWN = 96, GTPC_CAUSE_VALUE_IMSI_IMEI_NOT_KNOWN = 96,
GTPC_CAUSE_VALUE_SEMANTIC_ERROR_IN_THE_TAD_OPERATION = 97, GTPC_CAUSE_VALUE_SEMANTIC_ERROR_IN_THE_TAD_OPERATION = 97,
GTPC_CAUSE_VALUE_SYNTACTIC_ERROR_IN_THE_TAD_OPERATION = 98, GTPC_CAUSE_VALUE_SYNTACTIC_ERROR_IN_THE_TAD_OPERATION = 98,
//99 Shall not be used. // 99 Shall not be used.
GTPC_CAUSE_VALUE_REMOTE_PEER_NOT_RESPONDING = 100, GTPC_CAUSE_VALUE_REMOTE_PEER_NOT_RESPONDING = 100,
GTPC_CAUSE_VALUE_COLLISION_WITH_NETWORK_INITIATED_REQUEST = 101, GTPC_CAUSE_VALUE_COLLISION_WITH_NETWORK_INITIATED_REQUEST = 101,
GTPC_CAUSE_VALUE_UNABLE_TO_PAGE_UE_DUE_TO_SUSPENSION = 102, GTPC_CAUSE_VALUE_UNABLE_TO_PAGE_UE_DUE_TO_SUSPENSION = 102,
GTPC_CAUSE_VALUE_CONDITIONAL_IE_MISSING = 103, GTPC_CAUSE_VALUE_CONDITIONAL_IE_MISSING = 103,
GTPC_CAUSE_VALUE_APN_RESTRICTION_TYPE_INCOMPATIBLE_WITH_CURRENTLY_ACTIVE_PDN_CONNECTION = 104, GTPC_CAUSE_VALUE_APN_RESTRICTION_TYPE_INCOMPATIBLE_WITH_CURRENTLY_ACTIVE_PDN_CONNECTION = 104,
GTPC_CAUSE_VALUE_INVALID_OVERALL_LENGTH_OF_THE_TRIGGERED_RESPONSE_MSG_AND_A_PIGGYBACKED_INITIAL_MSG = 105, GTPC_CAUSE_VALUE_INVALID_OVERALL_LENGTH_OF_THE_TRIGGERED_RESPONSE_MSG_AND_A_PIGGYBACKED_INITIAL_MSG = 105,
GTPC_CAUSE_VALUE_DATA_FORWARDING_NOT_SUPPORTED = 106, GTPC_CAUSE_VALUE_DATA_FORWARDING_NOT_SUPPORTED = 106,
GTPC_CAUSE_VALUE_INVALID_REPLY_FROM_REMOTE_PEER = 107, GTPC_CAUSE_VALUE_INVALID_REPLY_FROM_REMOTE_PEER = 107,
GTPC_CAUSE_VALUE_FALLBACK_TO_GTPV1 = 108, GTPC_CAUSE_VALUE_FALLBACK_TO_GTPV1 = 108,
GTPC_CAUSE_VALUE_INVALID_PEER = 109, GTPC_CAUSE_VALUE_INVALID_PEER = 109,
GTPC_CAUSE_VALUE_TEMPORARILY_REJECTED_DUE_TO_HANDOVER_PROCEDURE_IN_PROGRESS = 110, GTPC_CAUSE_VALUE_TEMPORARILY_REJECTED_DUE_TO_HANDOVER_PROCEDURE_IN_PROGRESS = 110,
GTPC_CAUSE_VALUE_MODIFICATIONS_NOT_LIMITED_TO_S1_U_BEARERS = 111, GTPC_CAUSE_VALUE_MODIFICATIONS_NOT_LIMITED_TO_S1_U_BEARERS = 111,
GTPC_CAUSE_VALUE_REQUEST_REJECTED_FOR_A_PMIPV6_REASON = 112, GTPC_CAUSE_VALUE_REQUEST_REJECTED_FOR_A_PMIPV6_REASON = 112,
GTPC_CAUSE_VALUE_APN_CONGESTION = 113, GTPC_CAUSE_VALUE_APN_CONGESTION = 113,
GTPC_CAUSE_VALUE_BEARER_HANDLING_NOT_SUPPORTED = 114, GTPC_CAUSE_VALUE_BEARER_HANDLING_NOT_SUPPORTED = 114,
GTPC_CAUSE_VALUE_UE_ALREADY_RE_ATTACHED = 115, GTPC_CAUSE_VALUE_UE_ALREADY_RE_ATTACHED = 115,
GTPC_CAUSE_VALUE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED = 116 GTPC_CAUSE_VALUE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED = 116
//117-239 Spare. For future use in a triggered/response message. // 117-239 Spare. For future use in a triggered/response message.
//240-255 Spare. For future use in an initial/request message. // 240-255 Spare. For future use in an initial/request message.
}; };
struct gtpc_cause_ie struct gtpc_cause_ie {
{
enum gtpc_cause_value cause_value; enum gtpc_cause_value cause_value;
bool pce; bool pce;
bool bce; bool bce;
bool cs; bool cs;
enum gtpc_ie_type offending_ie_type; enum gtpc_ie_type offending_ie_type;
uint16_t length_of_offending_ie; uint16_t length_of_offending_ie;
uint8_t offending_ie_instance; uint8_t offending_ie_instance;
}; };
/**************************************************************************** /****************************************************************************
@ -274,8 +270,7 @@ struct gtpc_cause_ie
* Ref: 3GPP TS 29.274 v10.14.0 Table 8.7-1 * Ref: 3GPP TS 29.274 v10.14.0 Table 8.7-1
* *
***************************************************************************/ ***************************************************************************/
struct gtpc_ambr_ie struct gtpc_ambr_ie {
{
uint32_t apn_ambr_uplink; uint32_t apn_ambr_uplink;
uint32_t apn_ambr_downlink; uint32_t apn_ambr_downlink;
}; };
@ -301,9 +296,9 @@ struct gtpc_ambr_ie
* and IPv6 addresses. * and IPv6 addresses.
*/ */
//TODO // TODO
//TODO IEs between 8.10 and 8.13 missing // TODO IEs between 8.10 and 8.13 missing
//TODO // TODO
/**************************************************************************** /****************************************************************************
* *
@ -311,20 +306,14 @@ struct gtpc_ambr_ie
* Ref: 3GPP TS 29.274 v10.14.0 Figure 8.14-1 * Ref: 3GPP TS 29.274 v10.14.0 Figure 8.14-1
* *
***************************************************************************/ ***************************************************************************/
enum gtpc_pdn_type enum gtpc_pdn_type { GTPC_PDN_TYPE_IPV4 = 1, GTPC_PDN_TYPE_IPV6 = 2, GTPC_PDN_TYPE_IPV4V6 = 3 };
{
GTPC_PDN_TYPE_IPV4 = 1,
GTPC_PDN_TYPE_IPV6 = 2,
GTPC_PDN_TYPE_IPV4V6 = 3
};
struct gtpc_pdn_address_allocation_ie struct gtpc_pdn_address_allocation_ie {
{
enum gtpc_pdn_type pdn_type; enum gtpc_pdn_type pdn_type;
bool ipv4_present; bool ipv4_present;
bool ipv6_present; bool ipv6_present;
in_addr_t ipv4; in_addr_t ipv4;
struct in6_addr ipv6; struct in6_addr ipv6;
}; };
/**************************************************************************** /****************************************************************************
@ -333,8 +322,7 @@ struct gtpc_pdn_address_allocation_ie
* Ref: 3GPP TS 29.274 v10.14.0 Figure 8.15-1 * Ref: 3GPP TS 29.274 v10.14.0 Figure 8.15-1
* *
***************************************************************************/ ***************************************************************************/
struct gtpc_bearer_qos_ie struct gtpc_bearer_qos_ie {
{
struct { struct {
uint8_t pvi : 1; uint8_t pvi : 1;
uint8_t spare : 1; uint8_t spare : 1;
@ -349,9 +337,9 @@ struct gtpc_bearer_qos_ie
uint8_t gbr_dl; uint8_t gbr_dl;
}; };
//TODO // TODO
//TODO IEs between 8.16 and 8.17 missing // TODO IEs between 8.16 and 8.17 missing
//TODO // TODO
/**************************************************************************** /****************************************************************************
* *
@ -360,20 +348,11 @@ struct gtpc_bearer_qos_ie
* *
***************************************************************************/ ***************************************************************************/
enum gtpc_rat_type enum gtpc_rat_type { UTRAN = 1, GERAN, WLAN, GAN, HSPA_EVOLUTION, EUTRAN, Virtual };
{
UTRAN = 1,
GERAN,
WLAN,
GAN,
HSPA_EVOLUTION,
EUTRAN,
Virtual
};
//TODO // TODO
//TODO IEs between 8.17 and 8.22 missing // TODO IEs between 8.17 and 8.22 missing
//TODO // TODO
/**************************************************************************** /****************************************************************************
* *
@ -381,8 +360,7 @@ enum gtpc_rat_type
* Ref: 3GPP TS 29.274 v10.14.0 Figure 8.22-1 * Ref: 3GPP TS 29.274 v10.14.0 Figure 8.22-1
* *
***************************************************************************/ ***************************************************************************/
enum gtpc_interface_type enum gtpc_interface_type {
{
S1_U_ENODEB_GTP_U_INTERFACE, S1_U_ENODEB_GTP_U_INTERFACE,
S1_U_SGW_GTP_U_INTERFACE, S1_U_SGW_GTP_U_INTERFACE,
S12_RNC_GTP_U_INTERFACE, S12_RNC_GTP_U_INTERFACE,
@ -391,8 +369,10 @@ enum gtpc_interface_type
S5_S8_PGW_GTP_U_INTERFACE, S5_S8_PGW_GTP_U_INTERFACE,
S5_S8_SGW_GTP_C_INTERFACE, S5_S8_SGW_GTP_C_INTERFACE,
S5_S8_PGW_GTP_C_INTERFACE, S5_S8_PGW_GTP_C_INTERFACE,
S5_S8_SGW_PMIPV6_INTERFACE, //(the 32 bit GRE key is encoded in 32 bit TEID field and since alternate CoA is not used the control plane and user plane addresses are the same for PMIPv6) S5_S8_SGW_PMIPV6_INTERFACE, //(the 32 bit GRE key is encoded in 32 bit TEID field and since alternate CoA is not used
S5_S8_PGW_PMIPV6_INTERFACE, //(the 32 bit GRE key is encoded in 32 bit TEID field and the control plane and user plane addresses are the same for PMIPv6) // the control plane and user plane addresses are the same for PMIPv6)
S5_S8_PGW_PMIPV6_INTERFACE, //(the 32 bit GRE key is encoded in 32 bit TEID field and the control plane and user plane
// addresses are the same for PMIPv6)
S11_MME_GTP_C_INTERFACE, S11_MME_GTP_C_INTERFACE,
S11_S4_SGW_GTP_C_INTERFACE, S11_S4_SGW_GTP_C_INTERFACE,
S10_MME_GTP_C_INTERFACE, S10_MME_GTP_C_INTERFACE,
@ -419,20 +399,18 @@ enum gtpc_interface_type
S2B_U_PGW_GTP_U_INTERFACE S2B_U_PGW_GTP_U_INTERFACE
}; };
typedef struct gtpc_f_teid_ie {
typedef struct gtpc_f_teid_ie bool ipv4_present;
{ bool ipv6_present;
bool ipv4_present;
bool ipv6_present;
enum gtpc_interface_type interface_type; enum gtpc_interface_type interface_type;
uint32_t teid; uint32_t teid;
in_addr_t ipv4; in_addr_t ipv4;
struct in6_addr ipv6; //FIXME struct in6_addr ipv6; // FIXME
} gtp_fteid_t; } gtp_fteid_t;
//TODO // TODO
//TODO IEs between 8.22 and 8.28 missing // TODO IEs between 8.22 and 8.28 missing
//TODO // TODO
/**************************************************************************** /****************************************************************************
* *
@ -440,9 +418,9 @@ typedef struct gtpc_f_teid_ie
* Ref: 3GPP TS 29.274 v10.14.0 Table 8.28-1 * Ref: 3GPP TS 29.274 v10.14.0 Table 8.28-1
* *
***************************************************************************/ ***************************************************************************/
//The usage of this grouped IE is specific to the GTP-C message being sent. // The usage of this grouped IE is specific to the GTP-C message being sent.
//As such, each GTP-C message will define it's bearer context structures // As such, each GTP-C message will define it's bearer context structures
//locally, according to the rules of TS 29.274 v10.14.0 Section 7. // locally, according to the rules of TS 29.274 v10.14.0 Section 7.
} //namespace } // namespace srslte
#endif // SRSLTE_GTPC_IES_H #endif // SRSLTE_GTPC_IES_H

@ -168,7 +168,7 @@ struct gtpc_create_session_request {
bool pgw_addr_present; bool pgw_addr_present;
struct gtpc_f_teid_ie pgw_addr; // C struct gtpc_f_teid_ie pgw_addr; // C
char apn[MAX_APN_LENGTH]; // M char apn[MAX_APN_LENGTH]; // M
// bool selection_mode_present; // bool selection_mode_present;
// enum selection_mode_ selection_mode; // C/CO // enum selection_mode_ selection_mode; // C/CO
// bool pdn_type_present; // bool pdn_type_present;
@ -384,11 +384,11 @@ struct gtpc_delete_session_request {
}; };
/**************************************************************************** /****************************************************************************
* *
* GTP-C v2 Delete Session Response * GTP-C v2 Delete Session Response
* Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.10.1-1 * Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.10.1-1
* *
***************************************************************************/ ***************************************************************************/
struct gtpc_delete_session_response { struct gtpc_delete_session_response {
struct gtpc_cause_ie cause; struct gtpc_cause_ie cause;
// Recovery // Recovery
@ -402,17 +402,16 @@ struct gtpc_delete_session_response {
* Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.11.1-1 * Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.11.1-1
* *
***************************************************************************/ ***************************************************************************/
struct gtpc_downlink_data_notification struct gtpc_downlink_data_notification {
{ bool cause_present;
bool cause_present;
struct gtpc_cause_ie cause; struct gtpc_cause_ie cause;
bool eps_bearer_id_present; bool eps_bearer_id_present;
uint8_t eps_bearer_id; uint8_t eps_bearer_id;
bool allocation_retention_priority_present; bool allocation_retention_priority_present;
// struct gtpc_allocation_rention_priority_ie // struct gtpc_allocation_rention_priority_ie
bool imsi_present; bool imsi_present;
uint64_t imsi; uint64_t imsi;
//Private extension // Private extension
}; };
/**************************************************************************** /****************************************************************************
@ -421,12 +420,11 @@ struct gtpc_downlink_data_notification
* Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.11.2-1 * Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.11.2-1
* *
***************************************************************************/ ***************************************************************************/
struct gtpc_downlink_data_notification_acknowledge struct gtpc_downlink_data_notification_acknowledge {
{
struct gtpc_cause_ie cause; struct gtpc_cause_ie cause;
//Data Notification Delay // Data Notification Delay
//Recovery // Recovery
//Private extension // Private extension
}; };
/**************************************************************************** /****************************************************************************
@ -435,10 +433,9 @@ struct gtpc_downlink_data_notification_acknowledge
* Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.11.3-1 * Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.11.3-1
* *
***************************************************************************/ ***************************************************************************/
struct gtpc_downlink_data_notification_failure_indication struct gtpc_downlink_data_notification_failure_indication {
{
struct gtpc_cause_ie cause; struct gtpc_cause_ie cause;
//Private extension // Private extension
}; };
/**************************************************************************** /****************************************************************************

@ -383,7 +383,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_protocolie_singlecontainer(uint8_t**
*******************************************************************************/ *******************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_M2AP_PROTOCOLEXTENSIONFIELD_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_M2AP_PROTOCOLEXTENSIONFIELD_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_M2AP_PROTOCOLEXTENSIONCONTAINER_STRUCT; } LIBLTE_M2AP_PROTOCOLEXTENSIONCONTAINER_STRUCT;
@ -532,7 +532,7 @@ typedef struct {
*******************************************************************************/ *******************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_M2AP_CRITICALITYDIAGNOSTICS_IE_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_M2AP_CRITICALITYDIAGNOSTICS_IE_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_M2AP_CRITICALITYDIAGNOSTICS_IE_LIST_STRUCT; } LIBLTE_M2AP_CRITICALITYDIAGNOSTICS_IE_LIST_STRUCT;
@ -628,7 +628,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mbmsservicearea(uint8_t** ptr, LIBLTE_M2AP_
* ProtocolIE MBMS-Service-Area-Id-List SEQUENCE * ProtocolIE MBMS-Service-Area-Id-List SEQUENCE
*******************************************************************************/ *******************************************************************************/
typedef struct { typedef struct {
uint8_t len; uint8_t len;
LIBLTE_M2AP_MBMS_SERVICE_AREA_STRUCT buffer[32]; // Waring: Artificial limit to reduce memory footprint LIBLTE_M2AP_MBMS_SERVICE_AREA_STRUCT buffer[32]; // Waring: Artificial limit to reduce memory footprint
} LIBLTE_M2AP_MBMS_SERVICE_AREA_ID_LIST_STRUCT; } LIBLTE_M2AP_MBMS_SERVICE_AREA_ID_LIST_STRUCT;
@ -664,9 +664,11 @@ typedef struct {
} LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_CONFIGUPDATE_ITEM_STRUCT; } LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_CONFIGUPDATE_ITEM_STRUCT;
LIBLTE_ERROR_ENUM liblte_m2ap_pack_enbmbmsconfigurationdataconfigupdateitem( LIBLTE_ERROR_ENUM liblte_m2ap_pack_enbmbmsconfigurationdataconfigupdateitem(
LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_CONFIGUPDATE_ITEM_STRUCT* ie, uint8_t** ptr); LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_CONFIGUPDATE_ITEM_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_m2ap_unpack_enbmbmsconfigurationdataconfigupdateitem( LIBLTE_ERROR_ENUM liblte_m2ap_unpack_enbmbmsconfigurationdataconfigupdateitem(
uint8_t** ptr, LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_CONFIGUPDATE_ITEM_STRUCT* ie); uint8_t** ptr,
LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_CONFIGUPDATE_ITEM_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
* ProtocolIE ENB-MBMS-M2AP-ID INTEGER * ProtocolIE ENB-MBMS-M2AP-ID INTEGER
@ -761,9 +763,11 @@ typedef struct {
} LIBLTE_M2AP_MBMS_SERVICE_ASSOCIATEDLOGICALM2_CONNECTIONITEM_STRUCT; } LIBLTE_M2AP_MBMS_SERVICE_ASSOCIATEDLOGICALM2_CONNECTIONITEM_STRUCT;
LIBLTE_ERROR_ENUM liblte_m2ap_pack_mbmsserviceassociatedlogicalm2connectionitem( LIBLTE_ERROR_ENUM liblte_m2ap_pack_mbmsserviceassociatedlogicalm2connectionitem(
LIBLTE_M2AP_MBMS_SERVICE_ASSOCIATEDLOGICALM2_CONNECTIONITEM_STRUCT* ie, uint8_t** ptr); LIBLTE_M2AP_MBMS_SERVICE_ASSOCIATEDLOGICALM2_CONNECTIONITEM_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mbmsserviceassociatedlogicalm2connectionitem( LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mbmsserviceassociatedlogicalm2connectionitem(
uint8_t** ptr, LIBLTE_M2AP_MBMS_SERVICE_ASSOCIATEDLOGICALM2_CONNECTIONITEM_STRUCT* ie); uint8_t** ptr,
LIBLTE_M2AP_MBMS_SERVICE_ASSOCIATEDLOGICALM2_CONNECTIONITEM_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
* ProtocolIE MBMS-Session-Id STATIC OCTET STRING * ProtocolIE MBMS-Session-Id STATIC OCTET STRING
@ -1001,9 +1005,11 @@ typedef struct {
} LIBLTE_M2AP_MCCH_RELATED_BCCH_CONFIG_PER_MBSFN_AREA_ITEM_STRUCT; } LIBLTE_M2AP_MCCH_RELATED_BCCH_CONFIG_PER_MBSFN_AREA_ITEM_STRUCT;
LIBLTE_ERROR_ENUM liblte_m2ap_pack_mcchrelatedbcchconfigpermbsfnareaitem( LIBLTE_ERROR_ENUM liblte_m2ap_pack_mcchrelatedbcchconfigpermbsfnareaitem(
LIBLTE_M2AP_MCCH_RELATED_BCCH_CONFIG_PER_MBSFN_AREA_ITEM_STRUCT* ie, uint8_t** ptr); LIBLTE_M2AP_MCCH_RELATED_BCCH_CONFIG_PER_MBSFN_AREA_ITEM_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mcchrelatedbcchconfigpermbsfnareaitem( LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mcchrelatedbcchconfigpermbsfnareaitem(
uint8_t** ptr, LIBLTE_M2AP_MCCH_RELATED_BCCH_CONFIG_PER_MBSFN_AREA_ITEM_STRUCT* ie); uint8_t** ptr,
LIBLTE_M2AP_MCCH_RELATED_BCCH_CONFIG_PER_MBSFN_AREA_ITEM_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
* ProtocolIE MCCHrelatedBCCH-ConfigPerMBSFNArea DYNAMIC SEQUENCE * ProtocolIE MCCHrelatedBCCH-ConfigPerMBSFNArea DYNAMIC SEQUENCE
@ -1200,7 +1206,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_tnlinformation(uint8_t** ptr, LIBLTE_M2AP_T
*******************************************************************************/ *******************************************************************************/
// lb:1;ub:maxnofCells (256) // lb:1;ub:maxnofCells (256)
typedef struct { typedef struct {
uint8_t len; uint8_t len;
LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_ITEM_STRUCT buffer[32]; // Waring: Artificial limit to reduce memory footprint LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_ITEM_STRUCT buffer[32]; // Waring: Artificial limit to reduce memory footprint
} LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_LIST_STRUCT; } LIBLTE_M2AP_ENB_MBMS_CONFIGURATION_DATA_LIST_STRUCT;
@ -1229,7 +1235,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mbsfnareaconfigurationitem(uint8_t**
*******************************************************************************/ *******************************************************************************/
// lb:1;ub:maxnofCells (256) // lb:1;ub:maxnofCells (256)
typedef struct { typedef struct {
uint8_t len; uint8_t len;
LIBLTE_M2AP_MBSFN_AREA_CONFIGURATION_ITEM_STRUCT buffer[32]; // Waring: Artificial limit to reduce memory footprint LIBLTE_M2AP_MBSFN_AREA_CONFIGURATION_ITEM_STRUCT buffer[32]; // Waring: Artificial limit to reduce memory footprint
} LIBLTE_M2AP_MBSFN_AREA_CONFIGURATION_LIST_STRUCT; } LIBLTE_M2AP_MBSFN_AREA_CONFIGURATION_LIST_STRUCT;

@ -97,11 +97,12 @@ typedef enum {
LIBLTE_MME_DEVICE_PROPERTIES_N_ITEMS, LIBLTE_MME_DEVICE_PROPERTIES_N_ITEMS,
} LIBLTE_MME_DEVICE_PROPERTIES_ENUM; } LIBLTE_MME_DEVICE_PROPERTIES_ENUM;
static const char liblte_mme_device_properties_text[LIBLTE_MME_DEVICE_PROPERTIES_N_ITEMS][50] = { static const char liblte_mme_device_properties_text[LIBLTE_MME_DEVICE_PROPERTIES_N_ITEMS][50] = {
"Not configured for low priority", "Configured for low priority"}; "Not configured for low priority",
"Configured for low priority"};
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_mme_pack_device_properties_ie(LIBLTE_MME_DEVICE_PROPERTIES_ENUM device_props, uint8 bit_offset, uint8** ie_ptr); liblte_mme_pack_device_properties_ie(LIBLTE_MME_DEVICE_PROPERTIES_ENUM device_props, uint8 bit_offset, uint8** ie_ptr);
LIBLTE_ERROR_ENUM liblte_mme_unpack_device_properties_ie(uint8** ie_ptr, LIBLTE_ERROR_ENUM liblte_mme_unpack_device_properties_ie(uint8** ie_ptr,
uint8 bit_offset, uint8 bit_offset,
LIBLTE_MME_DEVICE_PROPERTIES_ENUM* device_props); LIBLTE_MME_DEVICE_PROPERTIES_ENUM* device_props);
@ -194,8 +195,10 @@ typedef enum {
LIBLTE_MME_REVISION_LEVEL_RESERVED, LIBLTE_MME_REVISION_LEVEL_RESERVED,
LIBLTE_MME_REVISION_LEVEL_N_ITEMS, LIBLTE_MME_REVISION_LEVEL_N_ITEMS,
} LIBLTE_MME_REVISION_LEVEL_ENUM; } LIBLTE_MME_REVISION_LEVEL_ENUM;
static const char liblte_mme_revision_level_text[LIBLTE_MME_REVISION_LEVEL_N_ITEMS][20] = { static const char liblte_mme_revision_level_text[LIBLTE_MME_REVISION_LEVEL_N_ITEMS][20] = {"GSM Phase 1",
"GSM Phase 1", "GSM Phase 2", "R99", "RESERVED"}; "GSM Phase 2",
"R99",
"RESERVED"};
typedef enum { typedef enum {
LIBLTE_MME_RF_POWER_CAPABILITY_CLASS_1 = 0, LIBLTE_MME_RF_POWER_CAPABILITY_CLASS_1 = 0,
LIBLTE_MME_RF_POWER_CAPABILITY_CLASS_2, LIBLTE_MME_RF_POWER_CAPABILITY_CLASS_2,
@ -204,8 +207,11 @@ typedef enum {
LIBLTE_MME_RF_POWER_CAPABILITY_CLASS_5, LIBLTE_MME_RF_POWER_CAPABILITY_CLASS_5,
LIBLTE_MME_RF_POWER_CAPABILITY_N_ITEMS, LIBLTE_MME_RF_POWER_CAPABILITY_N_ITEMS,
} LIBLTE_MME_RF_POWER_CAPABILITY_ENUM; } LIBLTE_MME_RF_POWER_CAPABILITY_ENUM;
static const char liblte_mme_rf_power_capability_text[LIBLTE_MME_RF_POWER_CAPABILITY_N_ITEMS][20] = { static const char liblte_mme_rf_power_capability_text[LIBLTE_MME_RF_POWER_CAPABILITY_N_ITEMS][20] = {"Class 1",
"Class 1", "Class 2", "Class 3", "Class 4", "Class 5"}; "Class 2",
"Class 3",
"Class 4",
"Class 5"};
typedef enum { typedef enum {
LIBLTE_MME_SS_SCREEN_INDICATOR_0 = 0, LIBLTE_MME_SS_SCREEN_INDICATOR_0 = 0,
LIBLTE_MME_SS_SCREEN_INDICATOR_1, LIBLTE_MME_SS_SCREEN_INDICATOR_1,
@ -213,8 +219,8 @@ typedef enum {
LIBLTE_MME_SS_SCREEN_INDICATOR_3, LIBLTE_MME_SS_SCREEN_INDICATOR_3,
LIBLTE_MME_SS_SCREEN_INDICATOR_N_ITEMS, LIBLTE_MME_SS_SCREEN_INDICATOR_N_ITEMS,
} LIBLTE_MME_SS_SCREEN_INDICATOR_ENUM; } LIBLTE_MME_SS_SCREEN_INDICATOR_ENUM;
static const char liblte_mme_ss_screen_indicator_text[LIBLTE_MME_SS_SCREEN_INDICATOR_N_ITEMS][100] = { static const char liblte_mme_ss_screen_indicator_text[LIBLTE_MME_SS_SCREEN_INDICATOR_N_ITEMS][100] =
"Default Phase 1", "Ellipsis Notation Phase 2", "RESERVED", "RESERVED"}; {"Default Phase 1", "Ellipsis Notation Phase 2", "RESERVED", "RESERVED"};
// Structs // Structs
typedef struct { typedef struct {
LIBLTE_MME_REVISION_LEVEL_ENUM rev_lev; LIBLTE_MME_REVISION_LEVEL_ENUM rev_lev;
@ -300,8 +306,8 @@ typedef enum {
LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_EIA7, LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_EIA7,
LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_N_ITEMS, LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_N_ITEMS,
} LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_ENUM; } LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_ENUM;
static const char liblte_mme_type_of_integrity_algorithm_text[LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_N_ITEMS][20] = { static const char liblte_mme_type_of_integrity_algorithm_text[LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_N_ITEMS][20] =
"EIA0", "128-EIA1", "128-EIA2", "EIA3", "EIA4", "EIA5", "EIA6", "EIA7"}; {"EIA0", "128-EIA1", "128-EIA2", "EIA3", "EIA4", "EIA5", "EIA6", "EIA7"};
typedef enum { typedef enum {
LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_EEA0 = 0, LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_EEA0 = 0,
LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_128_EEA1, LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_128_EEA1,
@ -313,8 +319,8 @@ typedef enum {
LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_EEA7, LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_EEA7,
LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_N_ITEMS, LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_N_ITEMS,
} LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_ENUM; } LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_ENUM;
static const char liblte_mme_type_of_ciphering_algorithm_text[LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_N_ITEMS][20] = { static const char liblte_mme_type_of_ciphering_algorithm_text[LIBLTE_MME_TYPE_OF_CIPHERING_ALGORITHM_N_ITEMS][20] =
"EEA0", "128-EEA1", "128-EEA2", "EEA3", "EEA4", "EEA5", "EEA6", "EEA7"}; {"EEA0", "128-EEA1", "128-EEA2", "EEA3", "EEA4", "EEA5", "EEA6", "EEA7"};
typedef enum { typedef enum {
LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_NATIVE = 0, LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_NATIVE = 0,
LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_MAPPED, LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_MAPPED,
@ -418,8 +424,8 @@ typedef enum {
LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_RESERVED, LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_RESERVED,
LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_N_ITEMS, LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_N_ITEMS,
} LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_ENUM; } LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_ENUM;
static const char liblte_mme_additional_update_result_text[LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_N_ITEMS][100] = { static const char liblte_mme_additional_update_result_text[LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_N_ITEMS][100] =
"No Additional Information", "CS Fallback Not Preferred", "SMS Only", "RESERVED"}; {"No Additional Information", "CS Fallback Not Preferred", "SMS Only", "RESERVED"};
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_additional_update_result_ie(LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_ENUM result, LIBLTE_ERROR_ENUM liblte_mme_pack_additional_update_result_ie(LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_ENUM result,
@ -446,11 +452,12 @@ typedef enum {
LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_N_ITEMS, LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_N_ITEMS,
} LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_ENUM; } LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_ENUM;
static const char liblte_mme_additional_update_type_text[LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_N_ITEMS][20] = { static const char liblte_mme_additional_update_type_text[LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_N_ITEMS][20] = {
"No additional info", "SMS Only"}; "No additional info",
"SMS Only"};
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_mme_pack_additional_update_type_ie(LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_ENUM aut, uint8 bit_offset, uint8** ie_ptr); liblte_mme_pack_additional_update_type_ie(LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_ENUM aut, uint8 bit_offset, uint8** ie_ptr);
LIBLTE_ERROR_ENUM liblte_mme_unpack_additional_update_type_ie(uint8** ie_ptr, LIBLTE_ERROR_ENUM liblte_mme_unpack_additional_update_type_ie(uint8** ie_ptr,
uint8 bit_offset, uint8 bit_offset,
LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_ENUM* aut); LIBLTE_MME_ADDITIONAL_UPDATE_TYPE_ENUM* aut);
@ -575,8 +582,10 @@ typedef enum {
LIBLTE_MME_DAYLIGHT_SAVING_TIME_RESERVED, LIBLTE_MME_DAYLIGHT_SAVING_TIME_RESERVED,
LIBLTE_MME_DAYLIGHT_SAVING_TIME_N_ITEMS, LIBLTE_MME_DAYLIGHT_SAVING_TIME_N_ITEMS,
} LIBLTE_MME_DAYLIGHT_SAVING_TIME_ENUM; } LIBLTE_MME_DAYLIGHT_SAVING_TIME_ENUM;
static const char liblte_mme_daylight_saving_time_text[LIBLTE_MME_DAYLIGHT_SAVING_TIME_N_ITEMS][20] = { static const char liblte_mme_daylight_saving_time_text[LIBLTE_MME_DAYLIGHT_SAVING_TIME_N_ITEMS][20] = {"No Adjustment",
"No Adjustment", "+1 Hour", "+2 Hours", "RESERVED"}; "+1 Hour",
"+2 Hours",
"RESERVED"};
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_daylight_saving_time_ie(LIBLTE_MME_DAYLIGHT_SAVING_TIME_ENUM dst, uint8** ie_ptr); LIBLTE_ERROR_ENUM liblte_mme_pack_daylight_saving_time_ie(LIBLTE_MME_DAYLIGHT_SAVING_TIME_ENUM dst, uint8** ie_ptr);
@ -781,8 +790,10 @@ typedef enum {
LIBLTE_MME_CS_LCS_RESERVED, LIBLTE_MME_CS_LCS_RESERVED,
LIBLTE_MME_CS_LCS_N_ITEMS, LIBLTE_MME_CS_LCS_N_ITEMS,
} LIBLTE_MME_CS_LCS_ENUM; } LIBLTE_MME_CS_LCS_ENUM;
static const char liblte_mme_cs_lcs_text[LIBLTE_MME_CS_LCS_N_ITEMS][100] = { static const char liblte_mme_cs_lcs_text[LIBLTE_MME_CS_LCS_N_ITEMS][100] = {"No Information Available",
"No Information Available", "Not Supported", "Supported", "RESERVED"}; "Not Supported",
"Supported",
"RESERVED"};
// Structs // Structs
typedef struct { typedef struct {
LIBLTE_MME_CS_LCS_ENUM cs_lcs; LIBLTE_MME_CS_LCS_ENUM cs_lcs;
@ -834,8 +845,8 @@ typedef enum {
LIBLTE_MME_EPS_UPDATE_TYPE_PERIODIC_UPDATING, LIBLTE_MME_EPS_UPDATE_TYPE_PERIODIC_UPDATING,
LIBLTE_MME_EPS_UPDATE_TYPE_N_ITEMS, LIBLTE_MME_EPS_UPDATE_TYPE_N_ITEMS,
} LIBLTE_MME_EPS_UPDATE_TYPE_ENUM; } LIBLTE_MME_EPS_UPDATE_TYPE_ENUM;
static const char liblte_mme_eps_update_type_text[LIBLTE_MME_EPS_UPDATE_TYPE_N_ITEMS][100] = { static const char liblte_mme_eps_update_type_text[LIBLTE_MME_EPS_UPDATE_TYPE_N_ITEMS][100] =
"TA Updating", "Combined TA/LA Updating", "Combined TA/LA Updating With IMSI Attach", "Periodic Updating"}; {"TA Updating", "Combined TA/LA Updating", "Combined TA/LA Updating With IMSI Attach", "Periodic Updating"};
// Structs // Structs
typedef struct { typedef struct {
LIBLTE_MME_EPS_UPDATE_TYPE_ENUM type; LIBLTE_MME_EPS_UPDATE_TYPE_ENUM type;
@ -1013,8 +1024,8 @@ typedef enum {
LIBLTE_MME_SS_SCREENING_INDICATOR_RESERVED_2, LIBLTE_MME_SS_SCREENING_INDICATOR_RESERVED_2,
LIBLTE_MME_SS_SCREENING_INDICATOR_N_ITEMS, LIBLTE_MME_SS_SCREENING_INDICATOR_N_ITEMS,
} LIBLTE_MME_SS_SCREENING_INDICATOR_ENUM; } LIBLTE_MME_SS_SCREENING_INDICATOR_ENUM;
static const char liblte_mme_ss_screening_indicator_text[LIBLTE_MME_SS_SCREENING_INDICATOR_N_ITEMS][20] = { static const char liblte_mme_ss_screening_indicator_text[LIBLTE_MME_SS_SCREENING_INDICATOR_N_ITEMS][20] =
"Phase 1", "Phase 2", "Reserved 1", "Reserved 2"}; {"Phase 1", "Phase 2", "Reserved 1", "Reserved 2"};
// Structs // Structs
typedef struct { typedef struct {
LIBLTE_MME_SS_SCREENING_INDICATOR_ENUM ss_screening; LIBLTE_MME_SS_SCREENING_INDICATOR_ENUM ss_screening;
@ -1306,9 +1317,10 @@ typedef enum {
LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_TYPE_DIFFERENT_PLMNS, LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_TYPE_DIFFERENT_PLMNS,
LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_TYPE_N_ITEMS, LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_TYPE_N_ITEMS,
} LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_TYPE_ENUM; } LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_TYPE_ENUM;
static const char static const char liblte_mme_tracking_area_identity_list_type_text[LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_TYPE_N_ITEMS]
liblte_mme_tracking_area_identity_list_type_text[LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_TYPE_N_ITEMS][100] = { [100] = {"One PLMN, Non-Consecutive TACs",
"One PLMN, Non-Consecutive TACs", "One PLMN, Consecutive TACs", "Different PLMNs"}; "One PLMN, Consecutive TACs",
"Different PLMNs"};
// Structs // Structs
typedef struct { typedef struct {
LIBLTE_MME_TRACKING_AREA_ID_STRUCT tai[LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_MAX_SIZE]; LIBLTE_MME_TRACKING_AREA_ID_STRUCT tai[LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_MAX_SIZE];
@ -1569,8 +1581,10 @@ typedef enum {
LIBLTE_MME_VOICE_DOMAIN_PREF_PS_PREFFERED, LIBLTE_MME_VOICE_DOMAIN_PREF_PS_PREFFERED,
LIBLTE_MME_VOICE_DOMAIN_PREF_N_ITEMS, LIBLTE_MME_VOICE_DOMAIN_PREF_N_ITEMS,
} LIBLTE_MME_VOICE_DOMAIN_PREF_ENUM; } LIBLTE_MME_VOICE_DOMAIN_PREF_ENUM;
static const char liblte_mme_voice_domain_pref_text[LIBLTE_MME_VOICE_DOMAIN_PREF_N_ITEMS][20] = { static const char liblte_mme_voice_domain_pref_text[LIBLTE_MME_VOICE_DOMAIN_PREF_N_ITEMS][20] = {"CS Only",
"CS Only", "PS Only", "CS Preffered", "PS Preffered"}; "PS Only",
"CS Preffered",
"PS Preffered"};
// Structs // Structs
typedef struct { typedef struct {
LIBLTE_MME_UE_USAGE_SETTING_ENUM ue_usage_setting; LIBLTE_MME_UE_USAGE_SETTING_ENUM ue_usage_setting;
@ -1578,9 +1592,11 @@ typedef struct {
} LIBLTE_MME_VOICE_DOMAIN_PREF_AND_UE_USAGE_SETTING_STRUCT; } LIBLTE_MME_VOICE_DOMAIN_PREF_AND_UE_USAGE_SETTING_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_voice_domain_pref_and_ue_usage_setting_ie( LIBLTE_ERROR_ENUM liblte_mme_pack_voice_domain_pref_and_ue_usage_setting_ie(
LIBLTE_MME_VOICE_DOMAIN_PREF_AND_UE_USAGE_SETTING_STRUCT* voice_domain_pref_and_ue_usage_setting, uint8** ie_ptr); LIBLTE_MME_VOICE_DOMAIN_PREF_AND_UE_USAGE_SETTING_STRUCT* voice_domain_pref_and_ue_usage_setting,
uint8** ie_ptr);
LIBLTE_ERROR_ENUM liblte_mme_unpack_voice_domain_pref_and_ue_usage_setting_ie( LIBLTE_ERROR_ENUM liblte_mme_unpack_voice_domain_pref_and_ue_usage_setting_ie(
uint8** ie_ptr, LIBLTE_MME_VOICE_DOMAIN_PREF_AND_UE_USAGE_SETTING_STRUCT* voice_domain_pref_and_ue_usage_setting); uint8** ie_ptr,
LIBLTE_MME_VOICE_DOMAIN_PREF_AND_UE_USAGE_SETTING_STRUCT* voice_domain_pref_and_ue_usage_setting);
/********************************************************************* /*********************************************************************
IE Name: GUTI Type IE Name: GUTI Type
@ -1779,13 +1795,18 @@ typedef enum {
LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_N_ITEMS, LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_N_ITEMS,
} LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_ENUM; } LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_ENUM;
static const char liblte_mme_esm_info_transfer_flag_text[LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_N_ITEMS][20] = { static const char liblte_mme_esm_info_transfer_flag_text[LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_N_ITEMS][20] = {
"Not Required", "Required"}; "Not Required",
"Required"};
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_esm_info_transfer_flag_ie( LIBLTE_ERROR_ENUM
LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_ENUM esm_info_transfer_flag, uint8 bit_offset, uint8** ie_ptr); liblte_mme_pack_esm_info_transfer_flag_ie(LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_ENUM esm_info_transfer_flag,
LIBLTE_ERROR_ENUM liblte_mme_unpack_esm_info_transfer_flag_ie( uint8 bit_offset,
uint8** ie_ptr, uint8 bit_offset, LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_ENUM* esm_info_transfer_flag); uint8** ie_ptr);
LIBLTE_ERROR_ENUM
liblte_mme_unpack_esm_info_transfer_flag_ie(uint8** ie_ptr,
uint8 bit_offset,
LIBLTE_MME_ESM_INFO_TRANSFER_FLAG_ENUM* esm_info_transfer_flag);
/********************************************************************* /*********************************************************************
IE Name: Linked EPS Bearer Identity IE Name: Linked EPS Bearer Identity
@ -2229,8 +2250,8 @@ typedef enum {
LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_BIDIRECTIONAL, LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_BIDIRECTIONAL,
LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_N_ITEMS, LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_N_ITEMS,
} LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_ENUM; } LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_ENUM;
static const char liblte_mme_tft_packet_filter_direction_text[LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_N_ITEMS][100] = { static const char liblte_mme_tft_packet_filter_direction_text[LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_N_ITEMS][100] =
"Pre Rel-7 TFT Filter", "Downlink Only", "Uplink Only", "Bidirectional"}; {"Pre Rel-7 TFT Filter", "Downlink Only", "Uplink Only", "Bidirectional"};
// Structs // Structs
typedef struct { typedef struct {
LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_ENUM dir; LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_ENUM dir;
@ -2895,12 +2916,13 @@ typedef struct {
} LIBLTE_MME_GUTI_REALLOCATION_COMPLETE_MSG_STRUCT; } LIBLTE_MME_GUTI_REALLOCATION_COMPLETE_MSG_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_mme_pack_guti_reallocation_complete_msg(LIBLTE_MME_GUTI_REALLOCATION_COMPLETE_MSG_STRUCT* guti_realloc_complete, liblte_mme_pack_guti_reallocation_complete_msg(LIBLTE_MME_GUTI_REALLOCATION_COMPLETE_MSG_STRUCT* guti_realloc_complete,
uint8 sec_hdr_type, uint8 sec_hdr_type,
uint32 count, uint32 count,
LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_guti_reallocation_complete_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_guti_reallocation_complete_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_GUTI_REALLOCATION_COMPLETE_MSG_STRUCT* guti_realloc_complete); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_GUTI_REALLOCATION_COMPLETE_MSG_STRUCT* guti_realloc_complete);
/********************************************************************* /*********************************************************************
Message Name: Identity Request Message Name: Identity Request
@ -3150,7 +3172,8 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_tracking_area_update_complete_msg(
uint32 count, uint32 count,
LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_tracking_area_update_complete_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_tracking_area_update_complete_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_TRACKING_AREA_UPDATE_COMPLETE_MSG_STRUCT* ta_update_complete); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_TRACKING_AREA_UPDATE_COMPLETE_MSG_STRUCT* ta_update_complete);
/********************************************************************* /*********************************************************************
Message Name: Tracking Area Update Reject Message Name: Tracking Area Update Reject
@ -3239,7 +3262,8 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_downlink_generic_nas_transport_msg(
uint32 count, uint32 count,
LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_downlink_generic_nas_transport_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_downlink_generic_nas_transport_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_DOWNLINK_GENERIC_NAS_TRANSPORT_MSG_STRUCT* dl_generic_nas_transport); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_DOWNLINK_GENERIC_NAS_TRANSPORT_MSG_STRUCT* dl_generic_nas_transport);
/********************************************************************* /*********************************************************************
Message Name: Uplink Generic NAS Transport Message Name: Uplink Generic NAS Transport
@ -3265,7 +3289,8 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_uplink_generic_nas_transport_msg(
uint32 count, uint32 count,
LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_uplink_generic_nas_transport_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_uplink_generic_nas_transport_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_UPLINK_GENERIC_NAS_TRANSPORT_MSG_STRUCT* ul_generic_nas_transport); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_UPLINK_GENERIC_NAS_TRANSPORT_MSG_STRUCT* ul_generic_nas_transport);
/********************************************************************* /*********************************************************************
Message Name: Activate Dedicated EPS Bearer Context Accept Message Name: Activate Dedicated EPS Bearer Context Accept
@ -3489,9 +3514,11 @@ typedef struct {
} LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REJECT_MSG_STRUCT; } LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REJECT_MSG_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_bearer_resource_allocation_reject_msg( LIBLTE_ERROR_ENUM liblte_mme_pack_bearer_resource_allocation_reject_msg(
LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REJECT_MSG_STRUCT* bearer_res_alloc_rej, LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REJECT_MSG_STRUCT* bearer_res_alloc_rej,
LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_bearer_resource_allocation_reject_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_bearer_resource_allocation_reject_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REJECT_MSG_STRUCT* bearer_res_alloc_rej); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REJECT_MSG_STRUCT* bearer_res_alloc_rej);
/********************************************************************* /*********************************************************************
Message Name: Bearer Resource Allocation Request Message Name: Bearer Resource Allocation Request
@ -3518,9 +3545,11 @@ typedef struct {
} LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REQUEST_MSG_STRUCT; } LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REQUEST_MSG_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_bearer_resource_allocation_request_msg( LIBLTE_ERROR_ENUM liblte_mme_pack_bearer_resource_allocation_request_msg(
LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REQUEST_MSG_STRUCT* bearer_res_alloc_req, LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REQUEST_MSG_STRUCT* bearer_res_alloc_req,
LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_bearer_resource_allocation_request_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_bearer_resource_allocation_request_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REQUEST_MSG_STRUCT* bearer_res_alloc_req); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_BEARER_RESOURCE_ALLOCATION_REQUEST_MSG_STRUCT* bearer_res_alloc_req);
/********************************************************************* /*********************************************************************
Message Name: Bearer Resource Modification Reject Message Name: Bearer Resource Modification Reject
@ -3544,9 +3573,11 @@ typedef struct {
} LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REJECT_MSG_STRUCT; } LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REJECT_MSG_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_bearer_resource_modification_reject_msg( LIBLTE_ERROR_ENUM liblte_mme_pack_bearer_resource_modification_reject_msg(
LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REJECT_MSG_STRUCT* bearer_res_mod_rej, LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REJECT_MSG_STRUCT* bearer_res_mod_rej,
LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_bearer_resource_modification_reject_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_bearer_resource_modification_reject_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REJECT_MSG_STRUCT* bearer_res_mod_rej); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REJECT_MSG_STRUCT* bearer_res_mod_rej);
/********************************************************************* /*********************************************************************
Message Name: Bearer Resource Modification Request Message Name: Bearer Resource Modification Request
@ -3577,9 +3608,11 @@ typedef struct {
} LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REQUEST_MSG_STRUCT; } LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REQUEST_MSG_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_bearer_resource_modification_request_msg( LIBLTE_ERROR_ENUM liblte_mme_pack_bearer_resource_modification_request_msg(
LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REQUEST_MSG_STRUCT* bearer_res_mod_req, LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REQUEST_MSG_STRUCT* bearer_res_mod_req,
LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_bearer_resource_modification_request_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_bearer_resource_modification_request_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REQUEST_MSG_STRUCT* bearer_res_mod_req); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_BEARER_RESOURCE_MODIFICATION_REQUEST_MSG_STRUCT* bearer_res_mod_req);
/********************************************************************* /*********************************************************************
Message Name: Deactivate EPS Bearer Context Accept Message Name: Deactivate EPS Bearer Context Accept
@ -3744,7 +3777,8 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_modify_eps_bearer_context_accept_msg(
uint32 count, uint32 count,
LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_modify_eps_bearer_context_accept_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_modify_eps_bearer_context_accept_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT* mod_eps_bearer_context_accept); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT* mod_eps_bearer_context_accept);
/********************************************************************* /*********************************************************************
Message Name: Modify EPS Bearer Context Reject Message Name: Modify EPS Bearer Context Reject
@ -3766,9 +3800,11 @@ typedef struct {
} LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REJECT_MSG_STRUCT; } LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REJECT_MSG_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_modify_eps_bearer_context_reject_msg( LIBLTE_ERROR_ENUM liblte_mme_pack_modify_eps_bearer_context_reject_msg(
LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REJECT_MSG_STRUCT* mod_eps_bearer_context_rej, LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REJECT_MSG_STRUCT* mod_eps_bearer_context_rej,
LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_modify_eps_bearer_context_reject_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_modify_eps_bearer_context_reject_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REJECT_MSG_STRUCT* mod_eps_bearer_context_rej); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REJECT_MSG_STRUCT* mod_eps_bearer_context_rej);
/********************************************************************* /*********************************************************************
Message Name: Modify EPS Bearer Context Request Message Name: Modify EPS Bearer Context Request
@ -3805,9 +3841,11 @@ typedef struct {
} LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT; } LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_modify_eps_bearer_context_request_msg( LIBLTE_ERROR_ENUM liblte_mme_pack_modify_eps_bearer_context_request_msg(
LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT* mod_eps_bearer_context_req, LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT* mod_eps_bearer_context_req,
LIBLTE_BYTE_MSG_STRUCT* msg);
LIBLTE_ERROR_ENUM liblte_mme_unpack_modify_eps_bearer_context_request_msg( LIBLTE_ERROR_ENUM liblte_mme_unpack_modify_eps_bearer_context_request_msg(
LIBLTE_BYTE_MSG_STRUCT* msg, LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT* mod_eps_bearer_context_req); LIBLTE_BYTE_MSG_STRUCT* msg,
LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT* mod_eps_bearer_context_req);
/********************************************************************* /*********************************************************************
Message Name: Notification Message Name: Notification

@ -746,7 +746,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_protocolie_fieldpair(uint8_t** ptr, LIBLTE_
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_PROTOCOLEXTENSIONFIELD_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_PROTOCOLEXTENSIONFIELD_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_PROTOCOLEXTENSIONCONTAINER_STRUCT; } LIBLTE_S1AP_PROTOCOLEXTENSIONCONTAINER_STRUCT;
@ -760,7 +760,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_protocolextensioncontainer(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:0, ub:65535 // lb:0, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_PROTOCOLIE_FIELDPAIR_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_PROTOCOLIE_FIELDPAIR_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_PROTOCOLIE_CONTAINERPAIR_STRUCT; } LIBLTE_S1AP_PROTOCOLIE_CONTAINERPAIR_STRUCT;
@ -774,7 +774,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_protocolie_containerpair(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:None, ub:None // lb:None, ub:None
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_PROTOCOLIE_CONTAINERPAIR_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_PROTOCOLIE_CONTAINERPAIR_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_PROTOCOLIE_CONTAINERPAIRLIST_STRUCT; } LIBLTE_S1AP_PROTOCOLIE_CONTAINERPAIRLIST_STRUCT;
@ -814,7 +814,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_protocolie_singlecontainer(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_PRIVATEIE_FIELD_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_PRIVATEIE_FIELD_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_PRIVATEIE_CONTAINER_STRUCT; } LIBLTE_S1AP_PRIVATEIE_CONTAINER_STRUCT;
@ -1921,9 +1921,11 @@ typedef struct {
} LIBLTE_S1AP_SOURCERNC_TOTARGETRNC_TRANSPARENTCONTAINER_STRUCT; } LIBLTE_S1AP_SOURCERNC_TOTARGETRNC_TRANSPARENTCONTAINER_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_sourcernc_totargetrnc_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_pack_sourcernc_totargetrnc_transparentcontainer(
LIBLTE_S1AP_SOURCERNC_TOTARGETRNC_TRANSPARENTCONTAINER_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_SOURCERNC_TOTARGETRNC_TRANSPARENTCONTAINER_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourcernc_totargetrnc_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourcernc_totargetrnc_transparentcontainer(
uint8_t** ptr, LIBLTE_S1AP_SOURCERNC_TOTARGETRNC_TRANSPARENTCONTAINER_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_SOURCERNC_TOTARGETRNC_TRANSPARENTCONTAINER_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE SubscriberProfileIDforRFP INTEGER /* ProtocolIE SubscriberProfileIDforRFP INTEGER
@ -1969,9 +1971,11 @@ typedef struct {
} LIBLTE_S1AP_TARGETRNC_TOSOURCERNC_TRANSPARENTCONTAINER_STRUCT; } LIBLTE_S1AP_TARGETRNC_TOSOURCERNC_TRANSPARENTCONTAINER_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetrnc_tosourcernc_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetrnc_tosourcernc_transparentcontainer(
LIBLTE_S1AP_TARGETRNC_TOSOURCERNC_TRANSPARENTCONTAINER_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_TARGETRNC_TOSOURCERNC_TRANSPARENTCONTAINER_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetrnc_tosourcernc_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetrnc_tosourcernc_transparentcontainer(
uint8_t** ptr, LIBLTE_S1AP_TARGETRNC_TOSOURCERNC_TRANSPARENTCONTAINER_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_TARGETRNC_TOSOURCERNC_TRANSPARENTCONTAINER_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE Threshold_RSRQ INTEGER /* ProtocolIE Threshold_RSRQ INTEGER
@ -2255,7 +2259,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_datacodingscheme(uint8_t** ptr, LIBLTE_S1AP
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_EMERGENCYAREAID_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_EMERGENCYAREAID_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_EMERGENCYAREAIDLIST_STRUCT; } LIBLTE_S1AP_EMERGENCYAREAIDLIST_STRUCT;
@ -2267,7 +2271,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_emergencyareaidlist(uint8_t** ptr, LIBLTE_S
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_EMERGENCYAREAID_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_EMERGENCYAREAID_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_EMERGENCYAREAIDLISTFORRESTART_STRUCT; } LIBLTE_S1AP_EMERGENCYAREAIDLISTFORRESTART_STRUCT;
@ -2333,7 +2337,7 @@ liblte_s1ap_unpack_eutranroundtripdelayestimationinfo(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:4096 // lb:1, ub:4096
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_LAC_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_LAC_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_FORBIDDENLACS_STRUCT; } LIBLTE_S1AP_FORBIDDENLACS_STRUCT;
@ -2774,9 +2778,11 @@ typedef struct {
} LIBLTE_S1AP_SOURCEBSS_TOTARGETBSS_TRANSPARENTCONTAINER_STRUCT; } LIBLTE_S1AP_SOURCEBSS_TOTARGETBSS_TRANSPARENTCONTAINER_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_sourcebss_totargetbss_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_pack_sourcebss_totargetbss_transparentcontainer(
LIBLTE_S1AP_SOURCEBSS_TOTARGETBSS_TRANSPARENTCONTAINER_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_SOURCEBSS_TOTARGETBSS_TRANSPARENTCONTAINER_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourcebss_totargetbss_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourcebss_totargetbss_transparentcontainer(
uint8_t** ptr, LIBLTE_S1AP_SOURCEBSS_TOTARGETBSS_TRANSPARENTCONTAINER_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_SOURCEBSS_TOTARGETBSS_TRANSPARENTCONTAINER_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE SRVCCOperationPossible ENUMERATED /* ProtocolIE SRVCCOperationPossible ENUMERATED
@ -2804,7 +2810,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_srvccoperationpossible(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_MME_GROUP_ID_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_MME_GROUP_ID_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_SERVEDGROUPIDS_STRUCT; } LIBLTE_S1AP_SERVEDGROUPIDS_STRUCT;
@ -2838,7 +2844,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_tac(uint8_t** ptr, LIBLTE_S1AP_TAC_STRUCT*
********************************************************************************/ ********************************************************************************/
// lb:1, ub:8 // lb:1, ub:8
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TAC_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TAC_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_TALISTFORMDT_STRUCT; } LIBLTE_S1AP_TALISTFORMDT_STRUCT;
@ -2890,9 +2896,11 @@ typedef struct {
} LIBLTE_S1AP_TIME_UE_STAYEDINCELL_ENHANCEDGRANULARITY_STRUCT; } LIBLTE_S1AP_TIME_UE_STAYEDINCELL_ENHANCEDGRANULARITY_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_time_ue_stayedincell_enhancedgranularity( LIBLTE_ERROR_ENUM liblte_s1ap_pack_time_ue_stayedincell_enhancedgranularity(
LIBLTE_S1AP_TIME_UE_STAYEDINCELL_ENHANCEDGRANULARITY_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_TIME_UE_STAYEDINCELL_ENHANCEDGRANULARITY_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_time_ue_stayedincell_enhancedgranularity( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_time_ue_stayedincell_enhancedgranularity(
uint8_t** ptr, LIBLTE_S1AP_TIME_UE_STAYEDINCELL_ENHANCEDGRANULARITY_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_TIME_UE_STAYEDINCELL_ENHANCEDGRANULARITY_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE E_UTRAN_Trace_ID STATIC OCTET STRING /* ProtocolIE E_UTRAN_Trace_ID STATIC OCTET STRING
@ -3021,7 +3029,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_warningsecurityinfo(uint8_t** ptr, LIBLTE_S
********************************************************************************/ ********************************************************************************/
// lb:1, ub:16 // lb:1, ub:16
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TRANSPORTLAYERADDRESS_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TRANSPORTLAYERADDRESS_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_ENBX2GTPTLAS_STRUCT; } LIBLTE_S1AP_ENBX2GTPTLAS_STRUCT;
@ -3137,7 +3145,7 @@ liblte_s1ap_unpack_criticalitydiagnostics_ie_item(uint8_t** ptr, LIBLTE_S1AP_CRI
********************************************************************************/ ********************************************************************************/
// lb:1, ub:2 // lb:1, ub:2
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TRANSPORTLAYERADDRESS_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TRANSPORTLAYERADDRESS_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_ENBX2TLAS_STRUCT; } LIBLTE_S1AP_ENBX2TLAS_STRUCT;
@ -3161,7 +3169,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_extendedrepetitionperiod(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:4096 // lb:1, ub:4096
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TAC_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TAC_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_FORBIDDENTACS_STRUCT; } LIBLTE_S1AP_FORBIDDENTACS_STRUCT;
@ -3383,7 +3391,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_securitycontext(uint8_t** ptr, LIBLTE_S1AP_
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_MME_CODE_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_MME_CODE_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_SERVEDMMECS_STRUCT; } LIBLTE_S1AP_SERVEDMMECS_STRUCT;
@ -3444,9 +3452,11 @@ typedef struct {
} LIBLTE_S1AP_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_STRUCT; } LIBLTE_S1AP_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetenb_tosourceenb_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetenb_tosourceenb_transparentcontainer(
LIBLTE_S1AP_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetenb_tosourceenb_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetenb_tosourceenb_transparentcontainer(
uint8_t** ptr, LIBLTE_S1AP_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE M1ThresholdEventA2 SEQUENCE /* ProtocolIE M1ThresholdEventA2 SEQUENCE
@ -3536,7 +3546,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_enbx2exttla(uint8_t** ptr, LIBLTE_S1AP_ENBX
********************************************************************************/ ********************************************************************************/
// lb:1, ub:6 // lb:1, ub:6
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TBCD_STRING_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TBCD_STRING_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_BPLMNS_STRUCT; } LIBLTE_S1AP_BPLMNS_STRUCT;
@ -3630,7 +3640,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_countvalueextended(uint8_t** ptr, LIBLTE_S1
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_CRITICALITYDIAGNOSTICS_IE_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_CRITICALITYDIAGNOSTICS_IE_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_CRITICALITYDIAGNOSTICS_IE_LIST_STRUCT; } LIBLTE_S1AP_CRITICALITYDIAGNOSTICS_IE_LIST_STRUCT;
@ -3658,7 +3668,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_global_enb_id(uint8_t** ptr, LIBLTE_S1AP_GL
********************************************************************************/ ********************************************************************************/
// lb:1, ub:15 // lb:1, ub:15
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TBCD_STRING_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TBCD_STRING_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_EPLMNS_STRUCT; } LIBLTE_S1AP_EPLMNS_STRUCT;
@ -3754,7 +3764,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_m4configuration(uint8_t** ptr, LIBLTE_S1AP_
********************************************************************************/ ********************************************************************************/
// lb:1, ub:16 // lb:1, ub:16
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TBCD_STRING_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TBCD_STRING_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_MDTPLMNLIST_STRUCT; } LIBLTE_S1AP_MDTPLMNLIST_STRUCT;
@ -3830,7 +3840,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_prioritylevel(uint8_t** ptr, LIBLTE_S1AP_PR
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_EUTRAN_CGI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_EUTRAN_CGI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_ECGILISTFORRESTART_STRUCT; } LIBLTE_S1AP_ECGILISTFORRESTART_STRUCT;
@ -3855,7 +3865,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourceenb_id(uint8_t** ptr, LIBLTE_S1AP_SOU
********************************************************************************/ ********************************************************************************/
// lb:1, ub:32 // lb:1, ub:32
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TBCD_STRING_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TBCD_STRING_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_SERVEDPLMNS_STRUCT; } LIBLTE_S1AP_SERVEDPLMNS_STRUCT;
@ -3881,7 +3891,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_supportedtas_item(uint8_t** ptr, LIBLTE_S1A
********************************************************************************/ ********************************************************************************/
// lb:1, ub:8 // lb:1, ub:8
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TAI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TAI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_TAILISTFORMDT_STRUCT; } LIBLTE_S1AP_TAILISTFORMDT_STRUCT;
@ -3927,16 +3937,18 @@ typedef struct {
} LIBLTE_S1AP_TARGETBSS_TOSOURCEBSS_TRANSPARENTCONTAINER_STRUCT; } LIBLTE_S1AP_TARGETBSS_TOSOURCEBSS_TRANSPARENTCONTAINER_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetbss_tosourcebss_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetbss_tosourcebss_transparentcontainer(
LIBLTE_S1AP_TARGETBSS_TOSOURCEBSS_TRANSPARENTCONTAINER_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_TARGETBSS_TOSOURCEBSS_TRANSPARENTCONTAINER_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetbss_tosourcebss_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetbss_tosourcebss_transparentcontainer(
uint8_t** ptr, LIBLTE_S1AP_TARGETBSS_TOSOURCEBSS_TRANSPARENTCONTAINER_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_TARGETBSS_TOSOURCEBSS_TRANSPARENTCONTAINER_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE TAIListForRestart DYNAMIC SEQUENCE OF /* ProtocolIE TAIListForRestart DYNAMIC SEQUENCE OF
********************************************************************************/ ********************************************************************************/
// lb:1, ub:2048 // lb:1, ub:2048
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TAI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TAI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_TAILISTFORRESTART_STRUCT; } LIBLTE_S1AP_TAILISTFORRESTART_STRUCT;
@ -3964,7 +3976,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_userlocationinformation(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:16 // lb:1, ub:16
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_ENBX2EXTTLA_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_ENBX2EXTTLA_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_ENBX2EXTTLAS_STRUCT; } LIBLTE_S1AP_ENBX2EXTTLAS_STRUCT;
@ -4052,7 +4064,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_cellid_cancelled_item(uint8_t** ptr, LIBLTE
********************************************************************************/ ********************************************************************************/
// lb:1, ub:32 // lb:1, ub:32
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_EUTRAN_CGI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_EUTRAN_CGI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_CELLIDLISTFORMDT_STRUCT; } LIBLTE_S1AP_CELLIDLISTFORMDT_STRUCT;
@ -4128,7 +4140,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_completedcellineai_item(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABINFORMATIONLISTITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABINFORMATIONLISTITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABINFORMATIONLIST_STRUCT; } LIBLTE_S1AP_E_RABINFORMATIONLIST_STRUCT;
@ -4140,7 +4152,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabinformationlist(uint8_t** ptr, LIBLTE_
********************************************************************************/ ********************************************************************************/
// lb:1, ub:16 // lb:1, ub:16
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_FORBIDDENTAS_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_FORBIDDENTAS_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_FORBIDDENTAS_STRUCT; } LIBLTE_S1AP_FORBIDDENTAS_STRUCT;
@ -4254,7 +4266,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_s_tmsi(uint8_t** ptr, LIBLTE_S1AP_S_TMSI_ST
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TAI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TAI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_TAILISTFORWARNING_STRUCT; } LIBLTE_S1AP_TAILISTFORWARNING_STRUCT;
@ -4266,7 +4278,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_tailistforwarning(uint8_t** ptr, LIBLTE_S1A
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_COMPLETEDCELLINTAI_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_COMPLETEDCELLINTAI_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_COMPLETEDCELLINTAI_STRUCT; } LIBLTE_S1AP_COMPLETEDCELLINTAI_STRUCT;
@ -4364,7 +4376,7 @@ liblte_s1ap_unpack_bearers_subjecttostatustransfer_item(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_CANCELLEDCELLINEAI_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_CANCELLEDCELLINEAI_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_CANCELLEDCELLINEAI_STRUCT; } LIBLTE_S1AP_CANCELLEDCELLINEAI_STRUCT;
@ -4376,7 +4388,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_cancelledcellineai(uint8_t** ptr, LIBLTE_S1
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_CELLID_BROADCAST_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_CELLID_BROADCAST_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_CELLID_BROADCAST_STRUCT; } LIBLTE_S1AP_CELLID_BROADCAST_STRUCT;
@ -4401,7 +4413,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_cellbasedmdt(uint8_t** ptr, LIBLTE_S1AP_CEL
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_CSG_IDLIST_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_CSG_IDLIST_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_CSG_IDLIST_STRUCT; } LIBLTE_S1AP_CSG_IDLIST_STRUCT;
@ -4413,7 +4425,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_csg_idlist(uint8_t** ptr, LIBLTE_S1AP_CSG_I
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_EUTRAN_CGI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_EUTRAN_CGI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_ECGILIST_STRUCT; } LIBLTE_S1AP_ECGILIST_STRUCT;
@ -4456,7 +4468,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_geran_cell_id(uint8_t** ptr, LIBLTE_S1AP_GE
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABLIST_STRUCT; } LIBLTE_S1AP_E_RABLIST_STRUCT;
@ -4468,7 +4480,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rablist(uint8_t** ptr, LIBLTE_S1AP_E_RABL
********************************************************************************/ ********************************************************************************/
// lb:1, ub:16 // lb:1, ub:16
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_FORBIDDENLAS_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_FORBIDDENLAS_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_FORBIDDENLAS_STRUCT; } LIBLTE_S1AP_FORBIDDENLAS_STRUCT;
@ -4547,7 +4559,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_rimroutingaddress(uint8_t** ptr, LIBLTE_S1A
********************************************************************************/ ********************************************************************************/
// lb:1, ub:8 // lb:1, ub:8
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_SERVEDGUMMEISITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_SERVEDGUMMEISITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_SERVEDGUMMEIS_STRUCT; } LIBLTE_S1AP_SERVEDGUMMEIS_STRUCT;
@ -4681,7 +4693,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_areascopeofmdt(uint8_t** ptr, LIBLTE_S1AP_A
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_CANCELLEDCELLINTAI_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_CANCELLEDCELLINTAI_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_CANCELLEDCELLINTAI_STRUCT; } LIBLTE_S1AP_CANCELLEDCELLINTAI_STRUCT;
@ -4706,7 +4718,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_celltype(uint8_t** ptr, LIBLTE_S1AP_CELLTYP
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_EMERGENCYAREAID_CANCELLED_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_EMERGENCYAREAID_CANCELLED_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_EMERGENCYAREAID_CANCELLED_STRUCT; } LIBLTE_S1AP_EMERGENCYAREAID_CANCELLED_STRUCT;
@ -4720,7 +4732,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_emergencyareaid_cancelled(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_GUMMEI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_GUMMEI_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_GUMMEILIST_STRUCT; } LIBLTE_S1AP_GUMMEILIST_STRUCT;
@ -4784,7 +4796,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_rimtransfer(uint8_t** ptr, LIBLTE_S1AP_RIMT
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_SUPPORTEDTAS_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_SUPPORTEDTAS_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_SUPPORTEDTAS_STRUCT; } LIBLTE_S1AP_SUPPORTEDTAS_STRUCT;
@ -4826,7 +4838,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_x2tnlconfigurationinfo(uint8_t**
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEM_STRUCT LIBLTE_S1AP_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEM_STRUCT
buffer[32]; // WARNING: Artificial limit to reduce memory footprint buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_BEARERS_SUBJECTTOSTATUSTRANSFERLIST_STRUCT; } LIBLTE_S1AP_BEARERS_SUBJECTTOSTATUSTRANSFERLIST_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
@ -4841,7 +4853,7 @@ liblte_s1ap_unpack_bearers_subjecttostatustransferlist(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_CELLID_CANCELLED_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_CELLID_CANCELLED_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_CELLID_CANCELLED_STRUCT; } LIBLTE_S1AP_CELLID_CANCELLED_STRUCT;
@ -4853,7 +4865,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_cellid_cancelled(uint8_t** ptr, LIBLTE_S1AP
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_COMPLETEDCELLINEAI_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_COMPLETEDCELLINEAI_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_COMPLETEDCELLINEAI_STRUCT; } LIBLTE_S1AP_COMPLETEDCELLINEAI_STRUCT;
@ -4932,7 +4944,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_soninformationreply(uint8_t** ptr, LIBLTE_S
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TAI_BROADCAST_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TAI_BROADCAST_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_TAI_BROADCAST_STRUCT; } LIBLTE_S1AP_TAI_BROADCAST_STRUCT;
@ -5080,16 +5092,18 @@ typedef struct {
} LIBLTE_S1AP_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_STRUCT; } LIBLTE_S1AP_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_sourceenb_totargetenb_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_pack_sourceenb_totargetenb_transparentcontainer(
LIBLTE_S1AP_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourceenb_totargetenb_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourceenb_totargetenb_transparentcontainer(
uint8_t** ptr, LIBLTE_S1AP_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE EmergencyAreaID_Broadcast DYNAMIC SEQUENCE OF /* ProtocolIE EmergencyAreaID_Broadcast DYNAMIC SEQUENCE OF
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_EMERGENCYAREAID_BROADCAST_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_EMERGENCYAREAID_BROADCAST_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_EMERGENCYAREAID_BROADCAST_STRUCT; } LIBLTE_S1AP_EMERGENCYAREAID_BROADCAST_STRUCT;
@ -5118,7 +5132,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_mdt_configuration(uint8_t** ptr, LIBLTE_S1A
********************************************************************************/ ********************************************************************************/
// lb:1, ub:65535 // lb:1, ub:65535
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TAI_CANCELLED_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TAI_CANCELLED_ITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_TAI_CANCELLED_STRUCT; } LIBLTE_S1AP_TAI_CANCELLED_STRUCT;
@ -5169,10 +5183,11 @@ typedef struct {
} LIBLTE_S1AP_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_STRUCT; } LIBLTE_S1AP_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_s1ap_pack_enb_statustransfer_transparentcontainer(LIBLTE_S1AP_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_STRUCT* ie, liblte_s1ap_pack_enb_statustransfer_transparentcontainer(LIBLTE_S1AP_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_STRUCT* ie,
uint8_t** ptr); uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_enb_statustransfer_transparentcontainer( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_enb_statustransfer_transparentcontainer(
uint8_t** ptr, LIBLTE_S1AP_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE TraceActivation SEQUENCE /* ProtocolIE TraceActivation SEQUENCE
@ -5320,7 +5335,7 @@ liblte_s1ap_unpack_inter_systeminformationtransfertype(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_PROTOCOLIE_CONTAINERPAIR_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_PROTOCOLIE_CONTAINERPAIR_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RAB_IE_CONTAINERPAIRLIST_STRUCT; } LIBLTE_S1AP_E_RAB_IE_CONTAINERPAIRLIST_STRUCT;
@ -5585,13 +5600,15 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_taiitem(uint8_t** ptr, LIBLTE_S1AP_TAIITEM_
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT
buffer[32]; // WARNING: Artificial limit to reduce memory footprint buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRES_STRUCT; } LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRES_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionlistres( LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionlistres(
LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRES_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRES_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionlistres( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionlistres(
uint8_t** ptr, LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRES_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRES_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Container List UE_associatedLogicalS1_ConnectionListResAck DYNAMIC SEQUENCE OF /* Protocol Container List UE_associatedLogicalS1_ConnectionListResAck DYNAMIC SEQUENCE OF
@ -5600,13 +5617,15 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionlistres(
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT
buffer[32]; // WARNING: Artificial limit to reduce memory footprint buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRESACK_STRUCT; } LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRESACK_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionlistresack( LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionlistresack(
LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRESACK_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRESACK_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionlistresack( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionlistresack(
uint8_t** ptr, LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRESACK_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_UE_ASSOCIATEDLOGICALS1_CONNECTIONLISTRESACK_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* ProtocolIE PrivateMessage SEQUENCE /* ProtocolIE PrivateMessage SEQUENCE
@ -5651,7 +5670,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_resettype(uint8_t** ptr, LIBLTE_S1AP_RESETT
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABDATAFORWARDINGITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABDATAFORWARDINGITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABSUBJECTTODATAFORWARDINGLIST_STRUCT; } LIBLTE_S1AP_E_RABSUBJECTTODATAFORWARDINGLIST_STRUCT;
@ -5667,7 +5686,7 @@ liblte_s1ap_unpack_e_rabsubjecttodataforwardinglist(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABTOBESETUPITEMHOREQ_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABTOBESETUPITEMHOREQ_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABTOBESETUPLISTHOREQ_STRUCT; } LIBLTE_S1AP_E_RABTOBESETUPLISTHOREQ_STRUCT;
@ -5681,7 +5700,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabtobesetuplisthoreq(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABADMITTEDITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABADMITTEDITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABADMITTEDLIST_STRUCT; } LIBLTE_S1AP_E_RABADMITTEDLIST_STRUCT;
@ -5693,7 +5712,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabadmittedlist(uint8_t** ptr, LIBLTE_S1A
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABTOBESWITCHEDDLITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABTOBESWITCHEDDLITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABTOBESWITCHEDDLLIST_STRUCT; } LIBLTE_S1AP_E_RABTOBESWITCHEDDLLIST_STRUCT;
@ -5707,7 +5726,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabtobeswitcheddllist(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABTOBESWITCHEDULITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABTOBESWITCHEDULITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABTOBESWITCHEDULLIST_STRUCT; } LIBLTE_S1AP_E_RABTOBESWITCHEDULLIST_STRUCT;
@ -5721,7 +5740,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabtobeswitchedullist(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABTOBESETUPITEMBEARERSUREQ_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABTOBESETUPITEMBEARERSUREQ_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABTOBESETUPLISTBEARERSUREQ_STRUCT; } LIBLTE_S1AP_E_RABTOBESETUPLISTBEARERSUREQ_STRUCT;
@ -5735,7 +5754,7 @@ liblte_s1ap_unpack_e_rabtobesetuplistbearersureq(uint8_t** ptr, LIBLTE_S1AP_E_RA
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABSETUPITEMBEARERSURES_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABSETUPITEMBEARERSURES_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABSETUPLISTBEARERSURES_STRUCT; } LIBLTE_S1AP_E_RABSETUPLISTBEARERSURES_STRUCT;
@ -5751,7 +5770,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabsetuplistbearersures(uint8_t**
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABTOBEMODIFIEDITEMBEARERMODREQ_STRUCT LIBLTE_S1AP_E_RABTOBEMODIFIEDITEMBEARERMODREQ_STRUCT
buffer[32]; // WARNING: Artificial limit to reduce memory footprint buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABTOBEMODIFIEDLISTBEARERMODREQ_STRUCT; } LIBLTE_S1AP_E_RABTOBEMODIFIEDLISTBEARERMODREQ_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
@ -5766,7 +5785,7 @@ liblte_s1ap_unpack_e_rabtobemodifiedlistbearermodreq(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABMODIFYITEMBEARERMODRES_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABMODIFYITEMBEARERMODRES_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABMODIFYLISTBEARERMODRES_STRUCT; } LIBLTE_S1AP_E_RABMODIFYLISTBEARERMODRES_STRUCT;
@ -5780,7 +5799,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabmodifylistbearermodres(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABRELEASEITEMBEARERRELCOMP_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABRELEASEITEMBEARERRELCOMP_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABRELEASELISTBEARERRELCOMP_STRUCT; } LIBLTE_S1AP_E_RABRELEASELISTBEARERRELCOMP_STRUCT;
@ -5794,7 +5813,7 @@ liblte_s1ap_unpack_e_rabreleaselistbearerrelcomp(uint8_t** ptr, LIBLTE_S1AP_E_RA
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABTOBESETUPITEMCTXTSUREQ_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABTOBESETUPITEMCTXTSUREQ_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABTOBESETUPLISTCTXTSUREQ_STRUCT; } LIBLTE_S1AP_E_RABTOBESETUPLISTCTXTSUREQ_STRUCT;
@ -5808,7 +5827,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabtobesetuplistctxtsureq(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABSETUPITEMCTXTSURES_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABSETUPITEMCTXTSURES_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABSETUPLISTCTXTSURES_STRUCT; } LIBLTE_S1AP_E_RABSETUPLISTCTXTSURES_STRUCT;
@ -5822,7 +5841,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabsetuplistctxtsures(uint8_t**
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_TAIITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_TAIITEM_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_TAILIST_STRUCT; } LIBLTE_S1AP_TAILIST_STRUCT;
@ -5834,7 +5853,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_tailist(uint8_t** ptr, LIBLTE_S1AP_TAILIST_
********************************************************************************/ ********************************************************************************/
// lb:1, ub:256 // lb:1, ub:256
typedef struct { typedef struct {
uint32_t len; uint32_t len;
LIBLTE_S1AP_E_RABFAILEDTOSETUPITEMHOREQACK_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint LIBLTE_S1AP_E_RABFAILEDTOSETUPITEMHOREQACK_STRUCT buffer[32]; // WARNING: Artificial limit to reduce memory footprint
} LIBLTE_S1AP_E_RABFAILEDTOSETUPLISTHOREQACK_STRUCT; } LIBLTE_S1AP_E_RABFAILEDTOSETUPLISTHOREQACK_STRUCT;
@ -5851,10 +5870,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_ALLOCATIONANDRETENTIONPRIORITY_EXT_STRUCT; } LIBLTE_S1AP_MESSAGE_ALLOCATIONANDRETENTIONPRIORITY_EXT_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_s1ap_pack_allocationandretentionpriority_ext(LIBLTE_S1AP_MESSAGE_ALLOCATIONANDRETENTIONPRIORITY_EXT_STRUCT* ie, liblte_s1ap_pack_allocationandretentionpriority_ext(LIBLTE_S1AP_MESSAGE_ALLOCATIONANDRETENTIONPRIORITY_EXT_STRUCT* ie,
uint8_t** ptr); uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_allocationandretentionpriority_ext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_allocationandretentionpriority_ext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_ALLOCATIONANDRETENTIONPRIORITY_EXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_ALLOCATIONANDRETENTIONPRIORITY_EXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message CancelledCellinEAI_Item_Ext STRUCT /* Protocol Message CancelledCellinEAI_Item_Ext STRUCT
@ -6002,10 +6022,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_CRITICALITYDIAGNOSTICS_IE_ITEM_EXT_STRUCT; } LIBLTE_S1AP_MESSAGE_CRITICALITYDIAGNOSTICS_IE_ITEM_EXT_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_s1ap_pack_criticalitydiagnostics_ie_item_ext(LIBLTE_S1AP_MESSAGE_CRITICALITYDIAGNOSTICS_IE_ITEM_EXT_STRUCT* ie, liblte_s1ap_pack_criticalitydiagnostics_ie_item_ext(LIBLTE_S1AP_MESSAGE_CRITICALITYDIAGNOSTICS_IE_ITEM_EXT_STRUCT* ie,
uint8_t** ptr); uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_criticalitydiagnostics_ie_item_ext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_criticalitydiagnostics_ie_item_ext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_CRITICALITYDIAGNOSTICS_IE_ITEM_EXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_CRITICALITYDIAGNOSTICS_IE_ITEM_EXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message EmergencyAreaID_Broadcast_Item_Ext STRUCT /* Protocol Message EmergencyAreaID_Broadcast_Item_Ext STRUCT
@ -6015,10 +6036,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_BROADCAST_ITEM_EXT_STRUCT; } LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_BROADCAST_ITEM_EXT_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_s1ap_pack_emergencyareaid_broadcast_item_ext(LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_BROADCAST_ITEM_EXT_STRUCT* ie, liblte_s1ap_pack_emergencyareaid_broadcast_item_ext(LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_BROADCAST_ITEM_EXT_STRUCT* ie,
uint8_t** ptr); uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_emergencyareaid_broadcast_item_ext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_emergencyareaid_broadcast_item_ext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_BROADCAST_ITEM_EXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_BROADCAST_ITEM_EXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message EmergencyAreaID_Cancelled_Item_Ext STRUCT /* Protocol Message EmergencyAreaID_Cancelled_Item_Ext STRUCT
@ -6028,10 +6050,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_CANCELLED_ITEM_EXT_STRUCT; } LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_CANCELLED_ITEM_EXT_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_s1ap_pack_emergencyareaid_cancelled_item_ext(LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_CANCELLED_ITEM_EXT_STRUCT* ie, liblte_s1ap_pack_emergencyareaid_cancelled_item_ext(LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_CANCELLED_ITEM_EXT_STRUCT* ie,
uint8_t** ptr); uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_emergencyareaid_cancelled_item_ext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_emergencyareaid_cancelled_item_ext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_CANCELLED_ITEM_EXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_EMERGENCYAREAID_CANCELLED_ITEM_EXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message CompletedCellinEAI_Item_Ext STRUCT /* Protocol Message CompletedCellinEAI_Item_Ext STRUCT
@ -6074,9 +6097,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_EXT_STRUCT; } LIBLTE_S1AP_MESSAGE_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_EXT_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_enb_statustransfer_transparentcontainer_ext( LIBLTE_ERROR_ENUM liblte_s1ap_pack_enb_statustransfer_transparentcontainer_ext(
LIBLTE_S1AP_MESSAGE_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_EXT_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_EXT_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_enb_statustransfer_transparentcontainer_ext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_enb_statustransfer_transparentcontainer_ext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_EXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_ENB_STATUSTRANSFER_TRANSPARENTCONTAINER_EXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message E_RABInformationListItem_Ext STRUCT /* Protocol Message E_RABInformationListItem_Ext STRUCT
@ -6435,9 +6460,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_EXT_STRUCT; } LIBLTE_S1AP_MESSAGE_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_EXT_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetenb_tosourceenb_transparentcontainer_ext( LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetenb_tosourceenb_transparentcontainer_ext(
LIBLTE_S1AP_MESSAGE_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_EXT_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_EXT_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetenb_tosourceenb_transparentcontainer_ext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetenb_tosourceenb_transparentcontainer_ext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_EXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_EXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message M1ThresholdEventA2_Ext STRUCT /* Protocol Message M1ThresholdEventA2_Ext STRUCT
@ -6497,9 +6524,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMEXT_STRUCT; } LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMEXT_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionitemext( LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionitemext(
LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMEXT_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMEXT_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionitemext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionitemext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMEXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMEXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message UESecurityCapabilities_Ext STRUCT /* Protocol Message UESecurityCapabilities_Ext STRUCT
@ -6546,9 +6575,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_EXT_STRUCT; } LIBLTE_S1AP_MESSAGE_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_EXT_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_sourceenb_totargetenb_transparentcontainer_ext( LIBLTE_ERROR_ENUM liblte_s1ap_pack_sourceenb_totargetenb_transparentcontainer_ext(
LIBLTE_S1AP_MESSAGE_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_EXT_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_EXT_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourceenb_totargetenb_transparentcontainer_ext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_sourceenb_totargetenb_transparentcontainer_ext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_EXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_SOURCEENB_TOTARGETENB_TRANSPARENTCONTAINER_EXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message E_RABInformationList STRUCT /* Protocol Message E_RABInformationList STRUCT
@ -6575,9 +6606,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_LASTVISITEDEUTRANCELLINFORMATION_EXT_STRUCT; } LIBLTE_S1AP_MESSAGE_LASTVISITEDEUTRANCELLINFORMATION_EXT_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_lastvisitedeutrancellinformation_ext( LIBLTE_ERROR_ENUM liblte_s1ap_pack_lastvisitedeutrancellinformation_ext(
LIBLTE_S1AP_MESSAGE_LASTVISITEDEUTRANCELLINFORMATION_EXT_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_LASTVISITEDEUTRANCELLINFORMATION_EXT_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_lastvisitedeutrancellinformation_ext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_lastvisitedeutrancellinformation_ext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_LASTVISITEDEUTRANCELLINFORMATION_EXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_LASTVISITEDEUTRANCELLINFORMATION_EXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message SONInformationReply_Ext STRUCT /* Protocol Message SONInformationReply_Ext STRUCT
@ -6607,9 +6640,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEMEXT_STRUCT; } LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEMEXT_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_bearers_subjecttostatustransfer_itemext( LIBLTE_ERROR_ENUM liblte_s1ap_pack_bearers_subjecttostatustransfer_itemext(
LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEMEXT_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEMEXT_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_bearers_subjecttostatustransfer_itemext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_bearers_subjecttostatustransfer_itemext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEMEXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEMEXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message E_RABItem STRUCT /* Protocol Message E_RABItem STRUCT
@ -6659,9 +6694,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEM_STRUCT; } LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEM_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_bearers_subjecttostatustransfer_item( LIBLTE_ERROR_ENUM liblte_s1ap_pack_bearers_subjecttostatustransfer_item(
LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEM_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEM_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_bearers_subjecttostatustransfer_item( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_bearers_subjecttostatustransfer_item(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEM_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_BEARERS_SUBJECTTOSTATUSTRANSFER_ITEM_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message ImmediateMDT_Ext STRUCT /* Protocol Message ImmediateMDT_Ext STRUCT
@ -6960,10 +6997,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_E_RABTOBEMODIFYITEMBEARERMODREQEXT_STRUCT; } LIBLTE_S1AP_MESSAGE_E_RABTOBEMODIFYITEMBEARERMODREQEXT_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_s1ap_pack_e_rabtobemodifyitembearermodreqext(LIBLTE_S1AP_MESSAGE_E_RABTOBEMODIFYITEMBEARERMODREQEXT_STRUCT* ie, liblte_s1ap_pack_e_rabtobemodifyitembearermodreqext(LIBLTE_S1AP_MESSAGE_E_RABTOBEMODIFYITEMBEARERMODREQEXT_STRUCT* ie,
uint8_t** ptr); uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabtobemodifyitembearermodreqext( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_e_rabtobemodifyitembearermodreqext(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_E_RABTOBEMODIFYITEMBEARERMODREQEXT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_E_RABTOBEMODIFYITEMBEARERMODREQEXT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message E_RABModifyItemBearerModResExt STRUCT /* Protocol Message E_RABModifyItemBearerModResExt STRUCT
@ -7342,9 +7380,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT; } LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionitem( LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionitem(
LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionitem( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionitem(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEM_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message UE_associatedLogicalS1_ConnectionItemRes STRUCT /* Protocol Message UE_associatedLogicalS1_ConnectionItemRes STRUCT
@ -7355,9 +7395,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMRES_STRUCT; } LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMRES_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionitemres( LIBLTE_ERROR_ENUM liblte_s1ap_pack_ue_associatedlogicals1_connectionitemres(
LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMRES_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMRES_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionitemres( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_ue_associatedlogicals1_connectionitemres(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMRES_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_UE_ASSOCIATEDLOGICALS1_CONNECTIONITEMRES_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message ErrorIndication STRUCT /* Protocol Message ErrorIndication STRUCT
@ -7686,10 +7728,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_LOCATIONREPORTINGFAILUREINDICATION_STRUCT; } LIBLTE_S1AP_MESSAGE_LOCATIONREPORTINGFAILUREINDICATION_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_s1ap_pack_locationreportingfailureindication(LIBLTE_S1AP_MESSAGE_LOCATIONREPORTINGFAILUREINDICATION_STRUCT* ie, liblte_s1ap_pack_locationreportingfailureindication(LIBLTE_S1AP_MESSAGE_LOCATIONREPORTINGFAILUREINDICATION_STRUCT* ie,
uint8_t** ptr); uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_locationreportingfailureindication( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_locationreportingfailureindication(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_LOCATIONREPORTINGFAILUREINDICATION_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_LOCATIONREPORTINGFAILUREINDICATION_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message LocationReport STRUCT /* Protocol Message LocationReport STRUCT
@ -7930,9 +7973,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_DOWNLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT; } LIBLTE_S1AP_MESSAGE_DOWNLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT;
LIBLTE_ERROR_ENUM liblte_s1ap_pack_downlinknonueassociatedlppatransport( LIBLTE_ERROR_ENUM liblte_s1ap_pack_downlinknonueassociatedlppatransport(
LIBLTE_S1AP_MESSAGE_DOWNLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT* ie, uint8_t** ptr); LIBLTE_S1AP_MESSAGE_DOWNLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT* ie,
uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_downlinknonueassociatedlppatransport( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_downlinknonueassociatedlppatransport(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_DOWNLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_DOWNLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message UplinkNonUEAssociatedLPPaTransport STRUCT /* Protocol Message UplinkNonUEAssociatedLPPaTransport STRUCT
@ -7944,10 +7989,11 @@ typedef struct {
} LIBLTE_S1AP_MESSAGE_UPLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT; } LIBLTE_S1AP_MESSAGE_UPLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT;
LIBLTE_ERROR_ENUM LIBLTE_ERROR_ENUM
liblte_s1ap_pack_uplinknonueassociatedlppatransport(LIBLTE_S1AP_MESSAGE_UPLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT* ie, liblte_s1ap_pack_uplinknonueassociatedlppatransport(LIBLTE_S1AP_MESSAGE_UPLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT* ie,
uint8_t** ptr); uint8_t** ptr);
LIBLTE_ERROR_ENUM liblte_s1ap_unpack_uplinknonueassociatedlppatransport( LIBLTE_ERROR_ENUM liblte_s1ap_unpack_uplinknonueassociatedlppatransport(
uint8_t** ptr, LIBLTE_S1AP_MESSAGE_UPLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT* ie); uint8_t** ptr,
LIBLTE_S1AP_MESSAGE_UPLINKNONUEASSOCIATEDLPPATRANSPORT_STRUCT* ie);
/******************************************************************************* /*******************************************************************************
/* Protocol Message ENBDirectInformationTransfer STRUCT /* Protocol Message ENBDirectInformationTransfer STRUCT

@ -33,25 +33,25 @@ namespace srslte {
* Digits are represented by 4-bit nibbles. Unused nibbles are filled with 0xF. * Digits are represented by 4-bit nibbles. Unused nibbles are filled with 0xF.
* MCC 001 results in 0xF001 * MCC 001 results in 0xF001
*****************************************************************************/ *****************************************************************************/
inline bool string_to_mcc(std::string str, uint16_t *mcc) inline bool string_to_mcc(std::string str, uint16_t* mcc)
{ {
uint32_t len = (uint32_t)str.size(); uint32_t len = (uint32_t)str.size();
if(len != 3) { if (len != 3) {
return false; return false;
} }
if(!isdigit(str[0]) || !isdigit(str[1]) || !isdigit(str[2])) { if (!isdigit(str[0]) || !isdigit(str[1]) || !isdigit(str[2])) {
return false; return false;
} }
*mcc = 0xF000; *mcc = 0xF000;
*mcc |= ((uint8_t)(str[0]-'0') << 8); *mcc |= ((uint8_t)(str[0] - '0') << 8);
*mcc |= ((uint8_t)(str[1]-'0') << 4); *mcc |= ((uint8_t)(str[1] - '0') << 4);
*mcc |= ((uint8_t)(str[2]-'0')); *mcc |= ((uint8_t)(str[2] - '0'));
return true; return true;
} }
inline bool mcc_to_string(uint16_t mcc, std::string *str) inline bool mcc_to_string(uint16_t mcc, std::string* str)
{ {
if((mcc & 0xF000) != 0xF000) { if ((mcc & 0xF000) != 0xF000) {
return false; return false;
} }
*str = ""; *str = "";
@ -104,40 +104,40 @@ inline std::string mcc_bytes_to_string(uint8_t* mcc_bytes)
* MNC 001 results in 0xF001 * MNC 001 results in 0xF001
* MNC 01 results in 0xFF01 * MNC 01 results in 0xFF01
*****************************************************************************/ *****************************************************************************/
inline bool string_to_mnc(std::string str, uint16_t *mnc) inline bool string_to_mnc(std::string str, uint16_t* mnc)
{ {
uint32_t len = str.size(); uint32_t len = str.size();
if(len != 3 && len != 2) { if (len != 3 && len != 2) {
return false; return false;
} }
if(len == 3) { if (len == 3) {
if(!isdigit(str[0]) || !isdigit(str[1]) || !isdigit(str[2])) { if (!isdigit(str[0]) || !isdigit(str[1]) || !isdigit(str[2])) {
return false; return false;
} }
*mnc = 0xF000; *mnc = 0xF000;
*mnc |= ((uint8_t)(str[0]-'0') << 8); *mnc |= ((uint8_t)(str[0] - '0') << 8);
*mnc |= ((uint8_t)(str[1]-'0') << 4); *mnc |= ((uint8_t)(str[1] - '0') << 4);
*mnc |= ((uint8_t)(str[2]-'0')); *mnc |= ((uint8_t)(str[2] - '0'));
} }
if(len == 2) { if (len == 2) {
if(!isdigit(str[0]) || !isdigit(str[1])) { if (!isdigit(str[0]) || !isdigit(str[1])) {
return false; return false;
} }
*mnc = 0xFF00; *mnc = 0xFF00;
*mnc |= ((uint8_t)(str[0]-'0') << 4); *mnc |= ((uint8_t)(str[0] - '0') << 4);
*mnc |= ((uint8_t)(str[1]-'0')); *mnc |= ((uint8_t)(str[1] - '0'));
} }
return true; return true;
} }
inline bool mnc_to_string(uint16_t mnc, std::string *str) inline bool mnc_to_string(uint16_t mnc, std::string* str)
{ {
if((mnc & 0xF000) != 0xF000) { if ((mnc & 0xF000) != 0xF000) {
return false; return false;
} }
*str = ""; *str = "";
if((mnc & 0xFF00) != 0xFF00) { if ((mnc & 0xFF00) != 0xFF00) {
*str += ((mnc & 0x0F00) >> 8) + '0'; *str += ((mnc & 0x0F00) >> 8) + '0';
} }
*str += ((mnc & 0x00F0) >> 4) + '0'; *str += ((mnc & 0x00F0) >> 4) + '0';
@ -220,7 +220,7 @@ std::string mnc_bytes_to_string(Vec mnc_bytes)
* MNC 01 represented as 0xFF01 * MNC 01 represented as 0xFF01
* PLMN encoded as per TS 36.413 sec 9.2.3.8 * PLMN encoded as per TS 36.413 sec 9.2.3.8
*****************************************************************************/ *****************************************************************************/
inline void s1ap_plmn_to_mccmnc(uint32_t plmn, uint16_t *mcc, uint16_t *mnc) inline void s1ap_plmn_to_mccmnc(uint32_t plmn, uint16_t* mcc, uint16_t* mnc)
{ {
uint8_t nibbles[6]; uint8_t nibbles[6];
nibbles[0] = (plmn & 0xF00000) >> 20; nibbles[0] = (plmn & 0xF00000) >> 20;
@ -232,20 +232,20 @@ inline void s1ap_plmn_to_mccmnc(uint32_t plmn, uint16_t *mcc, uint16_t *mnc)
*mcc = 0xF000; *mcc = 0xF000;
*mnc = 0xF000; *mnc = 0xF000;
*mcc |= nibbles[1] << 8; // MCC digit 1 *mcc |= nibbles[1] << 8; // MCC digit 1
*mcc |= nibbles[0] << 4; // MCC digit 2 *mcc |= nibbles[0] << 4; // MCC digit 2
*mcc |= nibbles[3]; // MCC digit 3 *mcc |= nibbles[3]; // MCC digit 3
if(nibbles[2] == 0xF) { if (nibbles[2] == 0xF) {
// 2-digit MNC // 2-digit MNC
*mnc |= 0x0F00; // MNC digit 1 *mnc |= 0x0F00; // MNC digit 1
*mnc |= nibbles[5] << 4; // MNC digit 2 *mnc |= nibbles[5] << 4; // MNC digit 2
*mnc |= nibbles[4]; // MNC digit 3 *mnc |= nibbles[4]; // MNC digit 3
} else { } else {
// 3-digit MNC // 3-digit MNC
*mnc |= nibbles[2] << 8; // MNC digit 1 *mnc |= nibbles[2] << 8; // MNC digit 1
*mnc |= nibbles[5] << 4; // MNC digit 2 *mnc |= nibbles[5] << 4; // MNC digit 2
*mnc |= nibbles[4] ; // MNC digit 3 *mnc |= nibbles[4]; // MNC digit 3
} }
} }
@ -256,14 +256,14 @@ inline void s1ap_plmn_to_mccmnc(uint32_t plmn, uint16_t *mcc, uint16_t *mnc)
* MNC 01 represented as 0xFF01 * MNC 01 represented as 0xFF01
* PLMN encoded as per TS 36.413 sec 9.2.3.8 * PLMN encoded as per TS 36.413 sec 9.2.3.8
*****************************************************************************/ *****************************************************************************/
inline void s1ap_mccmnc_to_plmn(uint16_t mcc, uint16_t mnc, uint32_t *plmn) inline void s1ap_mccmnc_to_plmn(uint16_t mcc, uint16_t mnc, uint32_t* plmn)
{ {
uint8_t nibbles[6]; uint8_t nibbles[6];
nibbles[1] = (mcc & 0x0F00) >> 8; // MCC digit 1 nibbles[1] = (mcc & 0x0F00) >> 8; // MCC digit 1
nibbles[0] = (mcc & 0x00F0) >> 4; // MCC digit 2 nibbles[0] = (mcc & 0x00F0) >> 4; // MCC digit 2
nibbles[3] = (mcc & 0x000F); // MCC digit 3 nibbles[3] = (mcc & 0x000F); // MCC digit 3
if((mnc & 0xFF00) == 0xFF00) { if ((mnc & 0xFF00) == 0xFF00) {
// 2-digit MNC // 2-digit MNC
nibbles[2] = 0x0F; // MNC digit 1 nibbles[2] = 0x0F; // MNC digit 1
nibbles[5] = (mnc & 0x00F0) >> 4; // MNC digit 2 nibbles[5] = (mnc & 0x00F0) >> 4; // MNC digit 2

@ -26,28 +26,28 @@
* operations in both push and pop * operations in both push and pop
*****************************************************************************/ *****************************************************************************/
#ifndef SRSLTE_BLOCK_QUEUE_H #ifndef SRSLTE_BLOCK_QUEUE_H
#define SRSLTE_BLOCK_QUEUE_H #define SRSLTE_BLOCK_QUEUE_H
#include <queue>
#include <memory> #include <memory>
#include <utility>
#include <pthread.h> #include <pthread.h>
#include <stdio.h> #include <queue>
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <stdio.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <utility>
namespace srslte { namespace srslte {
template<typename myobj> template <typename myobj>
class block_queue { class block_queue
{
public: public:
// Callback functions for mutexed operations inside pop/push methods // Callback functions for mutexed operations inside pop/push methods
class call_mutexed_itf { class call_mutexed_itf
{
public: public:
virtual void popping(const myobj& obj) = 0; virtual void popping(const myobj& obj) = 0;
virtual void pushing(const myobj& obj) = 0; virtual void pushing(const myobj& obj) = 0;
@ -60,10 +60,11 @@ public:
pthread_cond_init(&cv_full, NULL); pthread_cond_init(&cv_full, NULL);
capacity = capacity_; capacity = capacity_;
mutexed_callback = NULL; mutexed_callback = NULL;
enable = true; enable = true;
num_threads = 0; num_threads = 0;
} }
~block_queue() { ~block_queue()
{
// Unlock threads waiting at push or pop // Unlock threads waiting at push or pop
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
enable = false; enable = false;
@ -72,10 +73,10 @@ public:
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
// Wait threads blocked in push/pop to exit // Wait threads blocked in push/pop to exit
while(num_threads>0) { while (num_threads > 0) {
usleep(100); usleep(100);
} }
// Wait them to exit and destroy cv and mutex // Wait them to exit and destroy cv and mutex
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
pthread_cond_destroy(&cv_full); pthread_cond_destroy(&cv_full);
@ -83,56 +84,48 @@ public:
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
pthread_mutex_destroy(&mutex); pthread_mutex_destroy(&mutex);
} }
void set_mutexed_itf(call_mutexed_itf *itf) { void set_mutexed_itf(call_mutexed_itf* itf) { mutexed_callback = itf; }
mutexed_callback = itf; void resize(int new_capacity) { capacity = new_capacity; }
}
void resize(int new_capacity) {
capacity = new_capacity;
}
void push(const myobj& value) { void push(const myobj& value) { push_(value, true); }
push_(value, true);
}
void push(myobj&& value) { push_(std::move(value), true); } void push(myobj&& value) { push_(std::move(value), true); }
bool try_push(const myobj& value) { bool try_push(const myobj& value) { return push_(value, false); }
return push_(value, false);
}
std::pair<bool, myobj> try_push(myobj&& value) { return push_(std::move(value), false); } std::pair<bool, myobj> try_push(myobj&& value) { return push_(std::move(value), false); }
bool try_pop(myobj *value) { bool try_pop(myobj* value) { return pop_(value, false); }
return pop_(value, false);
}
myobj wait_pop() { // blocking pop myobj wait_pop()
{ // blocking pop
myobj value = myobj(); myobj value = myobj();
pop_(&value, true); pop_(&value, true);
return value; return value;
} }
bool empty() { // queue is empty? bool empty()
{ // queue is empty?
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
bool ret = q.empty(); bool ret = q.empty();
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
return ret; return ret;
} }
void clear() { // remove all items void clear()
myobj *item = NULL; { // remove all items
while (try_pop(item)); myobj* item = NULL;
while (try_pop(item))
;
} }
const myobj& front() const { return q.front(); } const myobj& front() const { return q.front(); }
size_t size() { size_t size() { return q.size(); }
return q.size();
}
private: private:
bool pop_(myobj* value, bool block)
bool pop_(myobj *value, bool block) { {
if (!enable) { if (!enable) {
return false; return false;
} }
@ -169,14 +162,14 @@ private:
bool ret = false; bool ret = false;
if (capacity > 0) { if (capacity > 0) {
if (block) { if (block) {
while(q.size() >= (uint32_t) capacity && enable) { while (q.size() >= (uint32_t)capacity && enable) {
pthread_cond_wait(&cv_full, &mutex); pthread_cond_wait(&cv_full, &mutex);
} }
if (!enable) { if (!enable) {
num_threads--; num_threads--;
return false; return false;
} }
} else if (q.size() >= (uint32_t) capacity) { } else if (q.size() >= (uint32_t)capacity) {
num_threads--; num_threads--;
return false; return false;
} }
@ -221,16 +214,16 @@ private:
return ret; return ret;
} }
std::queue<myobj> q; std::queue<myobj> q;
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cv_empty; pthread_cond_t cv_empty;
pthread_cond_t cv_full; pthread_cond_t cv_full;
call_mutexed_itf *mutexed_callback; call_mutexed_itf* mutexed_callback;
int capacity; int capacity;
bool enable; bool enable;
uint32_t num_threads; uint32_t num_threads;
}; };
} } // namespace srslte
#endif // SRSLTE_BLOCK_QUEUE_H #endif // SRSLTE_BLOCK_QUEUE_H

@ -22,19 +22,19 @@
#ifndef SRSLTE_BUFFER_POOL_H #ifndef SRSLTE_BUFFER_POOL_H
#define SRSLTE_BUFFER_POOL_H #define SRSLTE_BUFFER_POOL_H
#include <algorithm>
#include <map>
#include <pthread.h> #include <pthread.h>
#include <vector>
#include <stack> #include <stack>
#include <map>
#include <string> #include <string>
#include <algorithm> #include <vector>
/******************************************************************************* /*******************************************************************************
INCLUDES INCLUDES
*******************************************************************************/ *******************************************************************************/
#include "srslte/common/log.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/log.h"
namespace srslte { namespace srslte {
@ -43,33 +43,34 @@ namespace srslte {
* *
* Preallocates a large number of buffer_t and provides allocate and * Preallocates a large number of buffer_t and provides allocate and
* deallocate functions. Provides quick object creation and deletion as well * deallocate functions. Provides quick object creation and deletion as well
* as object reuse. * as object reuse.
* Singleton class of byte_buffer_t (but other pools of different type can be created) * Singleton class of byte_buffer_t (but other pools of different type can be created)
*****************************************************************************/ *****************************************************************************/
template <class buffer_t> template <class buffer_t>
class buffer_pool{ class buffer_pool
{
public: public:
// non-static methods // non-static methods
buffer_pool(int capacity_ = -1) buffer_pool(int capacity_ = -1)
{ {
uint32_t nof_buffers = POOL_SIZE; uint32_t nof_buffers = POOL_SIZE;
if (capacity_ > 0) { if (capacity_ > 0) {
nof_buffers = (uint32_t) capacity_; nof_buffers = (uint32_t)capacity_;
} }
pthread_mutex_init(&mutex, NULL); pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cv_not_empty, NULL); pthread_cond_init(&cv_not_empty, NULL);
for(uint32_t i=0;i<nof_buffers;i++) { for (uint32_t i = 0; i < nof_buffers; i++) {
buffer_t *b = new buffer_t; buffer_t* b = new buffer_t;
available.push(b); available.push(b);
} }
capacity = nof_buffers; capacity = nof_buffers;
} }
~buffer_pool() { ~buffer_pool()
// this destructor assumes all buffers have been properly deallocated {
while(available.size()) { // this destructor assumes all buffers have been properly deallocated
while (available.size()) {
delete available.top(); delete available.top();
available.pop(); available.pop();
} }
@ -80,14 +81,14 @@ public:
pthread_cond_destroy(&cv_not_empty); pthread_cond_destroy(&cv_not_empty);
pthread_mutex_destroy(&mutex); pthread_mutex_destroy(&mutex);
} }
void print_all_buffers() void print_all_buffers()
{ {
printf("%d buffers in queue\n", (int) used.size()); printf("%d buffers in queue\n", (int)used.size());
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
std::map<std::string, uint32_t> buffer_cnt; std::map<std::string, uint32_t> buffer_cnt;
for (uint32_t i=0;i<used.size();i++) { for (uint32_t i = 0; i < used.size(); i++) {
buffer_cnt[strlen(used[i]->debug_name)?used[i]->debug_name:"Undefined"]++; buffer_cnt[strlen(used[i]->debug_name) ? used[i]->debug_name : "Undefined"]++;
} }
std::map<std::string, uint32_t>::iterator it; std::map<std::string, uint32_t>::iterator it;
for (it = buffer_cnt.begin(); it != buffer_cnt.end(); it++) { for (it = buffer_cnt.begin(); it != buffer_cnt.end(); it++) {
@ -96,17 +97,14 @@ public:
#endif #endif
} }
uint32_t nof_available_pdus() { uint32_t nof_available_pdus() { return available.size(); }
return available.size();
}
bool is_almost_empty() { bool is_almost_empty() { return available.size() < capacity / 20; }
return available.size() < capacity/20;
}
buffer_t* allocate(const char *debug_name = NULL, bool blocking = false) { buffer_t* allocate(const char* debug_name = NULL, bool blocking = false)
{
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
buffer_t *b = NULL; buffer_t* b = NULL;
if (available.size() > 0) { if (available.size() > 0) {
b = available.top(); b = available.top();
@ -114,7 +112,7 @@ public:
available.pop(); available.pop();
if (is_almost_empty()) { if (is_almost_empty()) {
printf("Warning buffer pool capacity is %f %%\n", (float) 100 * available.size() / capacity); printf("Warning buffer pool capacity is %f %%\n", (float)100 * available.size() / capacity);
} }
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
if (debug_name) { if (debug_name) {
@ -124,7 +122,7 @@ public:
#endif #endif
} else if (blocking) { } else if (blocking) {
// blocking allocation // blocking allocation
while(available.size() == 0) { while (available.size() == 0) {
pthread_cond_wait(&cv_not_empty, &mutex); pthread_cond_wait(&cv_not_empty, &mutex);
} }
@ -134,10 +132,9 @@ public:
available.pop(); available.pop();
// do not print any warning // do not print any warning
} } else {
else {
printf("Error - buffer pool is empty\n"); printf("Error - buffer pool is empty\n");
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
print_all_buffers(); print_all_buffers();
#endif #endif
@ -146,56 +143,54 @@ public:
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
return b; return b;
} }
bool deallocate(buffer_t *b) bool deallocate(buffer_t* b)
{ {
bool ret = false; bool ret = false;
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
typename std::vector<buffer_t*>::iterator elem = std::find(used.begin(), used.end(), b); typename std::vector<buffer_t*>::iterator elem = std::find(used.begin(), used.end(), b);
if (elem != used.end()) { if (elem != used.end()) {
used.erase(elem); used.erase(elem);
available.push(b); available.push(b);
ret = true; ret = true;
} }
pthread_cond_signal(&cv_not_empty); pthread_cond_signal(&cv_not_empty);
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
return ret; return ret;
} }
private:
private:
static const int POOL_SIZE = 4096; static const int POOL_SIZE = 4096;
std::stack<buffer_t*> available; std::stack<buffer_t*> available;
std::vector<buffer_t*> used; std::vector<buffer_t*> used;
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cv_not_empty; pthread_cond_t cv_not_empty;
uint32_t capacity; uint32_t capacity;
}; };
class byte_buffer_pool
class byte_buffer_pool { {
public: public:
// Singleton static methods // Singleton static methods
static byte_buffer_pool *instance; static byte_buffer_pool* instance;
static byte_buffer_pool* get_instance(int capacity = -1); static byte_buffer_pool* get_instance(int capacity = -1);
static void cleanup(void); static void cleanup(void);
byte_buffer_pool(int capacity = -1) { byte_buffer_pool(int capacity = -1)
log = NULL; {
log = NULL;
pool = new buffer_pool<byte_buffer_t>(capacity); pool = new buffer_pool<byte_buffer_t>(capacity);
} }
byte_buffer_pool(const byte_buffer_pool& other) = delete; byte_buffer_pool(const byte_buffer_pool& other) = delete;
byte_buffer_pool& operator=(const byte_buffer_pool& other) = delete; byte_buffer_pool& operator=(const byte_buffer_pool& other) = delete;
~byte_buffer_pool() { ~byte_buffer_pool() { delete pool; }
delete pool; byte_buffer_t* allocate(const char* debug_name = NULL, bool blocking = false)
} {
byte_buffer_t* allocate(const char *debug_name = NULL, bool blocking = false) {
return pool->allocate(debug_name, blocking); return pool->allocate(debug_name, blocking);
} }
void set_log(srslte::log *log) { void set_log(srslte::log* log) { this->log = log; }
this->log = log; void deallocate(byte_buffer_t* b)
} {
void deallocate(byte_buffer_t *b) { if (!b) {
if(!b) {
return; return;
} }
b->clear(); b->clear();
@ -216,12 +211,11 @@ public:
} }
b = NULL; b = NULL;
} }
void print_all_buffers() { void print_all_buffers() { pool->print_all_buffers(); }
pool->print_all_buffers();
}
private: private:
srslte::log *log; srslte::log* log;
buffer_pool<byte_buffer_t> *pool; buffer_pool<byte_buffer_t>* pool;
}; };
inline void byte_buffer_deleter::operator()(byte_buffer_t* buf) const inline void byte_buffer_deleter::operator()(byte_buffer_t* buf) const

@ -46,14 +46,14 @@
#define MSG3_DELAY_MS 2 // Delay added to TX_DELAY #define MSG3_DELAY_MS 2 // Delay added to TX_DELAY
#define TTI_SUB(a, b) ((((a) + 10240) - (b)) % 10240) #define TTI_SUB(a, b) ((((a) + 10240) - (b)) % 10240)
#define TTI_ADD(a, b) (((a) + (b)) % 10240) #define TTI_ADD(a, b) (((a) + (b)) % 10240)
#define TTI_TX(tti) TTI_ADD(tti, TX_DELAY) #define TTI_TX(tti) TTI_ADD(tti, TX_DELAY)
// Use only in FDD mode!! // Use only in FDD mode!!
#define FDD_HARQ_DELAY_MS 4 #define FDD_HARQ_DELAY_MS 4
#define TTI_RX(tti) (TTI_SUB(tti, FDD_HARQ_DELAY_MS)) #define TTI_RX(tti) (TTI_SUB(tti, FDD_HARQ_DELAY_MS))
#define TTI_RX_ACK(tti) (TTI_ADD(tti, FDD_HARQ_DELAY_MS + TX_DELAY)) #define TTI_RX_ACK(tti) (TTI_ADD(tti, FDD_HARQ_DELAY_MS + TX_DELAY))
#define TTIMOD_SZ 20 #define TTIMOD_SZ 20
#define TTIMOD(tti) (tti % TTIMOD_SZ) #define TTIMOD(tti) (tti % TTIMOD_SZ)

@ -22,17 +22,17 @@
#ifndef SRSLTE_CONFIG_FILE_H #ifndef SRSLTE_CONFIG_FILE_H
#define SRSLTE_CONFIG_FILE_H #define SRSLTE_CONFIG_FILE_H
#include "common.h"
#include <fstream> #include <fstream>
#include <pwd.h> #include <pwd.h>
#include "common.h"
bool config_exists(std::string &filename, std::string default_name) bool config_exists(std::string& filename, std::string default_name)
{ {
std::ifstream conf(filename.c_str(), std::ios::in); std::ifstream conf(filename.c_str(), std::ios::in);
if (conf.fail()) { if (conf.fail()) {
// try config folder instead // try config folder instead
const char* homedir = NULL; const char* homedir = NULL;
char full_path[256]; char full_path[256];
ZERO_OBJECT(full_path); ZERO_OBJECT(full_path);
if ((homedir = getenv("HOME")) == NULL) { if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir; homedir = getpwuid(getuid())->pw_dir;

@ -30,14 +30,14 @@
#ifndef SRSLTE_CRASH_HANDLER_H #ifndef SRSLTE_CRASH_HANDLER_H
#define SRSLTE_CRASH_HANDLER_H #define SRSLTE_CRASH_HANDLER_H
#include <stdio.h>
#include "srslte/config.h" #include "srslte/config.h"
#include <stdio.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif // __cplusplus #endif // __cplusplus
void srslte_debug_handle_crash(int argc, char **argv); void srslte_debug_handle_crash(int argc, char** argv);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -26,22 +26,19 @@
* Common mch table generation - used in phch_common of UE and ENB for MBMS * Common mch table generation - used in phch_common of UE and ENB for MBMS
*****************************************************************************/ *****************************************************************************/
#include <pthread.h> #include <pthread.h>
#include <string.h>
#include <stdint.h> #include <stdint.h>
#include <string.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif // __cplusplus #endif // __cplusplus
void generate_frame_mch_table(uint8_t* table, uint8_t alloc);
void generate_frame_mch_table(uint8_t *table, uint8_t alloc); void generate_mch_table(uint8_t* table, uint32_t sf_alloc, uint8_t num_frames);
void generate_mch_table(uint8_t *table, uint32_t sf_alloc, uint8_t num_frames); void generate_mcch_table(uint8_t* table, uint32_t sf_alloc);
void generate_mcch_table(uint8_t *table, uint32_t sf_alloc);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif // __cplusplus #endif // __cplusplus
#endif // SECURITY_H #endif // SECURITY_H

@ -107,7 +107,9 @@ typedef enum {
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS, LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS,
} LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM; } LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM;
static const char liblte_security_ciphering_algorithm_id_text[LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS][20] = { static const char liblte_security_ciphering_algorithm_id_text[LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS][20] = {
"EEA0", "128-EEA1", "128-EEA2"}; "EEA0",
"128-EEA1",
"128-EEA2"};
typedef enum { typedef enum {
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_EIA0 = 0, LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_EIA0 = 0,
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA1, LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA1,
@ -116,7 +118,9 @@ typedef enum {
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS, LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS,
} LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM; } LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM;
static const char liblte_security_integrity_algorithm_id_text[LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS][20] = { static const char liblte_security_integrity_algorithm_id_text[LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS][20] = {
"EIA0", "128-EIA1", "128-EIA2"}; "EIA0",
"128-EIA1",
"128-EIA2"};
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8* k_asme, LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8* k_asme,
@ -175,12 +179,26 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_up(uint8*
// Enums // Enums
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_128_eia2( LIBLTE_ERROR_ENUM liblte_security_128_eia2(uint8* key,
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* mac); uint32 count,
LIBLTE_ERROR_ENUM liblte_security_128_eia2( uint8 bearer,
uint8* key, uint32 count, uint8 bearer, uint8 direction, LIBLTE_BIT_MSG_STRUCT* msg, uint8* mac); uint8 direction,
LIBLTE_ERROR_ENUM liblte_security_128_eia3( uint8* msg,
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* mac); uint32 msg_len,
uint8* mac);
LIBLTE_ERROR_ENUM liblte_security_128_eia2(uint8* key,
uint32 count,
uint8 bearer,
uint8 direction,
LIBLTE_BIT_MSG_STRUCT* msg,
uint8* mac);
LIBLTE_ERROR_ENUM liblte_security_128_eia3(uint8* key,
uint32 count,
uint8 bearer,
uint8 direction,
uint8* msg,
uint32 msg_len,
uint8* mac);
/********************************************************************* /*********************************************************************
Name: liblte_security_encryption_eea1 Name: liblte_security_encryption_eea1
@ -192,8 +210,13 @@ LIBLTE_ERROR_ENUM liblte_security_128_eia3(
Specification of the 3GPP Confidentiality and Specification of the 3GPP Confidentiality and
Integrity Algorithms UEA2 & UIA2 D1 v2.1 Integrity Algorithms UEA2 & UIA2 D1 v2.1
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_security_encryption_eea1( LIBLTE_ERROR_ENUM liblte_security_encryption_eea1(uint8* key,
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* out); uint32 count,
uint8 bearer,
uint8 direction,
uint8* msg,
uint32 msg_len,
uint8* out);
/********************************************************************* /*********************************************************************
Name: liblte_security_decryption_eea1 Name: liblte_security_decryption_eea1
@ -205,8 +228,13 @@ LIBLTE_ERROR_ENUM liblte_security_encryption_eea1(
Specification of the 3GPP Confidentiality and Specification of the 3GPP Confidentiality and
Integrity Algorithms UEA2 & UIA2 D1 v2.1 Integrity Algorithms UEA2 & UIA2 D1 v2.1
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_security_decryption_eea1( LIBLTE_ERROR_ENUM liblte_security_decryption_eea1(uint8* key,
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* ct, uint32 ct_len, uint8* out); uint32 count,
uint8 bearer,
uint8 direction,
uint8* ct,
uint32 ct_len,
uint8* out);
/********************************************************************* /*********************************************************************
Name: liblte_security_encryption_eea2 Name: liblte_security_encryption_eea2
@ -215,8 +243,13 @@ LIBLTE_ERROR_ENUM liblte_security_decryption_eea1(
Document Reference: 33.401 v13.1.0 Annex B.1.3 Document Reference: 33.401 v13.1.0 Annex B.1.3
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_security_encryption_eea2( LIBLTE_ERROR_ENUM liblte_security_encryption_eea2(uint8* key,
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* out); uint32 count,
uint8 bearer,
uint8 direction,
uint8* msg,
uint32 msg_len,
uint8* out);
/********************************************************************* /*********************************************************************
Name: liblte_security_decryption_eea2 Name: liblte_security_decryption_eea2
@ -225,14 +258,29 @@ LIBLTE_ERROR_ENUM liblte_security_encryption_eea2(
Document Reference: 33.401 v13.1.0 Annex B.1.3 Document Reference: 33.401 v13.1.0 Annex B.1.3
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_security_decryption_eea2( LIBLTE_ERROR_ENUM liblte_security_decryption_eea2(uint8* key,
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* ct, uint32 ct_len, uint8* out); uint32 count,
uint8 bearer,
LIBLTE_ERROR_ENUM liblte_security_encryption_eea3( uint8 direction,
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* out); uint8* ct,
uint32 ct_len,
LIBLTE_ERROR_ENUM liblte_security_decryption_eea3( uint8* out);
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* out);
LIBLTE_ERROR_ENUM liblte_security_encryption_eea3(uint8* key,
uint32 count,
uint8 bearer,
uint8 direction,
uint8* msg,
uint32 msg_len,
uint8* out);
LIBLTE_ERROR_ENUM liblte_security_decryption_eea3(uint8* key,
uint32 count,
uint8 bearer,
uint8 direction,
uint8* msg,
uint32 msg_len,
uint8* out);
/********************************************************************* /*********************************************************************
Name: liblte_security_milenage_f1 Name: liblte_security_milenage_f1

@ -33,10 +33,10 @@
#include <stdarg.h> #include <stdarg.h>
#include <string> #include <string>
#include "srslte/phy/common/timestamp.h"
#include "srslte/common/log.h" #include "srslte/common/log.h"
#include "srslte/common/logger.h" #include "srslte/common/logger.h"
#include "srslte/common/logger_stdout.h" #include "srslte/common/logger_stdout.h"
#include "srslte/phy/common/timestamp.h"
namespace srslte { namespace srslte {
@ -45,48 +45,45 @@ typedef std::string* str_ptr;
class log_filter : public srslte::log class log_filter : public srslte::log
{ {
public: public:
log_filter(); log_filter();
log_filter(std::string layer); log_filter(std::string layer);
log_filter(std::string layer, logger *logger_, bool tti=false); log_filter(std::string layer, logger* logger_, bool tti = false);
~log_filter(); ~log_filter();
void init(std::string layer, logger *logger_, bool tti=false); void init(std::string layer, logger* logger_, bool tti = false);
void console(const char * message, ...) __attribute__ ((format (printf, 2, 3))); void console(const char* message, ...) __attribute__((format(printf, 2, 3)));
void error(const char * message, ...) __attribute__ ((format (printf, 2, 3))); void error(const char* message, ...) __attribute__((format(printf, 2, 3)));
void warning(const char * message, ...) __attribute__ ((format (printf, 2, 3))); void warning(const char* message, ...) __attribute__((format(printf, 2, 3)));
void info(const char * message, ...) __attribute__ ((format (printf, 2, 3))); void info(const char* message, ...) __attribute__((format(printf, 2, 3)));
void info_long(const char* message, ...) __attribute__((format(printf, 2, 3))); void info_long(const char* message, ...) __attribute__((format(printf, 2, 3)));
void debug(const char * message, ...) __attribute__ ((format (printf, 2, 3))); void debug(const char* message, ...) __attribute__((format(printf, 2, 3)));
void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3))); void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3)));
void error_hex(const uint8_t *hex, int size, const char * message, ...) __attribute__((format (printf, 4, 5))); void error_hex(const uint8_t* hex, int size, const char* message, ...) __attribute__((format(printf, 4, 5)));
void warning_hex(const uint8_t *hex, int size, const char * message, ...) __attribute__((format (printf, 4, 5))); void warning_hex(const uint8_t* hex, int size, const char* message, ...) __attribute__((format(printf, 4, 5)));
void info_hex(const uint8_t *hex, int size, const char * message, ...) __attribute__((format (printf, 4, 5))); void info_hex(const uint8_t* hex, int size, const char* message, ...) __attribute__((format(printf, 4, 5)));
void debug_hex(const uint8_t *hex, int size, const char * message, ...) __attribute__((format (printf, 4, 5))); void debug_hex(const uint8_t* hex, int size, const char* message, ...) __attribute__((format(printf, 4, 5)));
srslte::LOG_LEVEL_ENUM get_level(std::string l); srslte::LOG_LEVEL_ENUM get_level(std::string l);
class time_itf { class time_itf
{
public: public:
virtual srslte_timestamp_t get_time() = 0; virtual srslte_timestamp_t get_time() = 0;
}; };
typedef enum { typedef enum { TIME, EPOCH } time_format_t;
TIME,
EPOCH
} time_format_t;
void set_time_src(time_itf *source, time_format_t format); void set_time_src(time_itf* source, time_format_t format);
protected: protected:
logger *logger_h; logger* logger_h;
bool do_tti; bool do_tti;
static const int char_buff_size = logger::preallocated_log_str_size - 64 * 3; static const int char_buff_size = logger::preallocated_log_str_size - 64 * 3;
time_itf *time_src; time_itf* time_src;
time_format_t time_format; time_format_t time_format;
logger_stdout def_logger_stdout; logger_stdout def_logger_stdout;
@ -99,7 +96,7 @@ protected:
bool long_msg = false); bool long_msg = false);
void now_time(char* buffer, const uint32_t buffer_len); void now_time(char* buffer, const uint32_t buffer_len);
void get_tti_str(const uint32_t tti_, char* buffer, const uint32_t buffer_len); void get_tti_str(const uint32_t tti_, char* buffer, const uint32_t buffer_len);
std::string hex_string(const uint8_t *hex, int size); std::string hex_string(const uint8_t* hex, int size);
}; };
} // namespace srslte } // namespace srslte

@ -30,11 +30,11 @@
#ifndef SRSLTE_LOGGER_FILE_H #ifndef SRSLTE_LOGGER_FILE_H
#define SRSLTE_LOGGER_FILE_H #define SRSLTE_LOGGER_FILE_H
#include <stdio.h>
#include <deque>
#include <string>
#include "srslte/common/logger.h" #include "srslte/common/logger.h"
#include "srslte/common/threads.h" #include "srslte/common/threads.h"
#include <deque>
#include <stdio.h>
#include <string>
namespace srslte { namespace srslte {
@ -52,17 +52,17 @@ public:
void log(unique_log_str_t msg); void log(unique_log_str_t msg);
private: private:
void run_thread(); void run_thread();
void flush(); void flush();
uint32_t name_idx; uint32_t name_idx;
int64_t max_length; int64_t max_length;
int64_t cur_length; int64_t cur_length;
FILE* logfile; FILE* logfile;
bool is_running; bool is_running;
std::string filename; std::string filename;
pthread_cond_t not_empty; pthread_cond_t not_empty;
pthread_mutex_t mutex; pthread_mutex_t mutex;
std::deque<unique_log_str_t> buffer; std::deque<unique_log_str_t> buffer;
}; };

@ -27,17 +27,17 @@
#ifndef SRSLTE_LOGGER_STDOUT_H #ifndef SRSLTE_LOGGER_STDOUT_H
#define SRSLTE_LOGGER_STDOUT_H #define SRSLTE_LOGGER_STDOUT_H
#include "srslte/common/logger.h"
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include "srslte/common/logger.h"
namespace srslte { namespace srslte {
class logger_stdout : public logger class logger_stdout : public logger
{ {
public: public:
void log(unique_log_str_t log_str) { fprintf(stdout, "%s", log_str->str()); } void log(unique_log_str_t log_str) { fprintf(stdout, "%s", log_str->str()); }
}; };
} // namespace srslte } // namespace srslte

@ -94,11 +94,11 @@ class mac_nr_sch_pdu
public: public:
mac_nr_sch_pdu(bool ulsch_ = false) : ulsch(ulsch_) {} mac_nr_sch_pdu(bool ulsch_ = false) : ulsch(ulsch_) {}
void pack(); void pack();
void unpack(const uint8_t* payload, const uint32_t& len); void unpack(const uint8_t* payload, const uint32_t& len);
uint32_t get_num_subpdus(); uint32_t get_num_subpdus();
const mac_nr_sch_subpdu& get_subpdu(const uint32_t& index); const mac_nr_sch_subpdu& get_subpdu(const uint32_t& index);
bool is_ulsch(); bool is_ulsch();
void init_tx(byte_buffer_t* buffer_, uint32_t pdu_len_, bool is_ulsch_ = false); void init_tx(byte_buffer_t* buffer_, uint32_t pdu_len_, bool is_ulsch_ = false);
@ -109,8 +109,8 @@ public:
private: private:
uint32_t size_header_sdu(const uint32_t lcid_, const uint32_t nbytes); uint32_t size_header_sdu(const uint32_t lcid_, const uint32_t nbytes);
bool ulsch = false; bool ulsch = false;
std::vector<mac_nr_sch_subpdu> subpdus; std::vector<mac_nr_sch_subpdu> subpdus;
byte_buffer_t* buffer = nullptr; byte_buffer_t* buffer = nullptr;
uint32_t pdu_len = 0; uint32_t pdu_len = 0;

@ -22,8 +22,8 @@
#ifndef SRSLTE_MAC_PCAP_H #ifndef SRSLTE_MAC_PCAP_H
#define SRSLTE_MAC_PCAP_H #define SRSLTE_MAC_PCAP_H
#include <stdint.h>
#include "srslte/common/pcap.h" #include "srslte/common/pcap.h"
#include <stdint.h>
namespace srslte { namespace srslte {
@ -33,20 +33,20 @@ public:
mac_pcap(); mac_pcap();
~mac_pcap(); ~mac_pcap();
void enable(bool en); void enable(bool en);
void open(const char *filename, uint32_t ue_id = 0); void open(const char* filename, uint32_t ue_id = 0);
void close(); void close();
void set_ue_id(uint16_t ue_id); void set_ue_id(uint16_t ue_id);
void write_ul_crnti(uint8_t *pdu, uint32_t pdu_len_bytes, uint16_t crnti, uint32_t reTX, uint32_t tti); void write_ul_crnti(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t crnti, uint32_t reTX, uint32_t tti);
void write_dl_crnti(uint8_t *pdu, uint32_t pdu_len_bytes, uint16_t crnti, bool crc_ok, uint32_t tti); void write_dl_crnti(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t crnti, bool crc_ok, uint32_t tti);
void write_dl_ranti(uint8_t *pdu, uint32_t pdu_len_bytes, uint16_t ranti, bool crc_ok, uint32_t tti); void write_dl_ranti(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t ranti, bool crc_ok, uint32_t tti);
// SI and BCH only for DL // SI and BCH only for DL
void write_dl_sirnti(uint8_t *pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti); void write_dl_sirnti(uint8_t* pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti);
void write_dl_bch(uint8_t *pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti); void write_dl_bch(uint8_t* pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti);
void write_dl_pch(uint8_t *pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti); void write_dl_pch(uint8_t* pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti);
void write_dl_mch(uint8_t *pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti); void write_dl_mch(uint8_t* pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti);
void write_ul_rrc_pdu(const uint8_t* input, const int32_t input_len); void write_ul_rrc_pdu(const uint8_t* input, const int32_t input_len);
@ -54,8 +54,14 @@ private:
bool enable_write; bool enable_write;
FILE* pcap_file; FILE* pcap_file;
uint32_t ue_id; uint32_t ue_id;
void pack_and_write(uint8_t* pdu, uint32_t pdu_len_bytes, uint32_t reTX, bool crc_ok, uint32_t tti, void pack_and_write(uint8_t* pdu,
uint16_t crnti_, uint8_t direction, uint8_t rnti_type); uint32_t pdu_len_bytes,
uint32_t reTX,
bool crc_ok,
uint32_t tti,
uint16_t crnti_,
uint8_t direction,
uint8_t rnti_type);
}; };
} // namespace srslte } // namespace srslte

@ -22,7 +22,7 @@
/****************************************************************************** /******************************************************************************
* File: metrics_hub.h * File: metrics_hub.h
* Description: Centralizes metrics interfaces to allow different metrics clients * Description: Centralizes metrics interfaces to allow different metrics clients
* to get metrics * to get metrics
*****************************************************************************/ *****************************************************************************/
#ifndef SRSLTE_METRICS_HUB_H #ifndef SRSLTE_METRICS_HUB_H
@ -35,22 +35,22 @@
namespace srslte { namespace srslte {
template<typename metrics_t> template <typename metrics_t>
class metrics_interface class metrics_interface
{ {
public: public:
virtual bool get_metrics(metrics_t* m) = 0; virtual bool get_metrics(metrics_t* m) = 0;
}; };
template<typename metrics_t> template <typename metrics_t>
class metrics_listener class metrics_listener
{ {
public: public:
virtual void set_metrics(metrics_t &m, const uint32_t period_usec) = 0; virtual void set_metrics(metrics_t& m, const uint32_t period_usec) = 0;
virtual void stop() = 0; virtual void stop() = 0;
}; };
template<typename metrics_t> template <typename metrics_t>
class metrics_hub : public periodic_thread class metrics_hub : public periodic_thread
{ {
public: public:
@ -59,23 +59,22 @@ public:
{ {
m = m_; m = m_;
// Start with user-default priority // Start with user-default priority
start_periodic(report_period_secs_*1e6, -2); start_periodic(report_period_secs_ * 1e6, -2);
return true; return true;
} }
void stop() { void stop()
{
stop_thread(); stop_thread();
// stop all listeners // stop all listeners
for (uint32_t i=0;i<listeners.size();i++) { for (uint32_t i = 0; i < listeners.size(); i++) {
listeners[i]->stop(); listeners[i]->stop();
} }
thread_cancel(); thread_cancel();
wait_thread_finish(); wait_thread_finish();
} }
void add_listener(metrics_listener<metrics_t> *listener) { void add_listener(metrics_listener<metrics_t>* listener) { listeners.push_back(listener); }
listeners.push_back(listener);
}
private: private:
void run_period() void run_period()
{ {
@ -86,14 +85,14 @@ private:
if (m) { if (m) {
metrics_t metric; metrics_t metric;
m->get_metrics(&metric); m->get_metrics(&metric);
for (uint32_t i=0;i<listeners.size();i++) { for (uint32_t i = 0; i < listeners.size(); i++) {
listeners[i]->set_metrics(metric, period_usec.count()); listeners[i]->set_metrics(metric, period_usec.count());
} }
} }
// store start of sleep period // store start of sleep period
sleep_start = std::chrono::steady_clock::now(); sleep_start = std::chrono::steady_clock::now();
} }
metrics_interface<metrics_t> *m; metrics_interface<metrics_t>* m;
std::vector<metrics_listener<metrics_t>*> listeners; std::vector<metrics_listener<metrics_t>*> listeners;
std::chrono::steady_clock::time_point sleep_start; std::chrono::steady_clock::time_point sleep_start;
}; };

@ -29,18 +29,24 @@ namespace srslte {
class nas_pcap class nas_pcap
{ {
public: public:
nas_pcap() {enable_write=false; ue_id=0; pcap_file = NULL; } nas_pcap()
void enable(); {
void open(const char *filename, uint32_t ue_id=0); enable_write = false;
void close(); ue_id = 0;
void write_nas(uint8_t *pdu, uint32_t pdu_len_bytes); pcap_file = NULL;
}
void enable();
void open(const char* filename, uint32_t ue_id = 0);
void close();
void write_nas(uint8_t* pdu, uint32_t pdu_len_bytes);
private: private:
bool enable_write; bool enable_write;
FILE *pcap_file; FILE* pcap_file;
uint32_t ue_id; uint32_t ue_id;
void pack_and_write(uint8_t* pdu, uint32_t pdu_len_bytes); void pack_and_write(uint8_t* pdu, uint32_t pdu_len_bytes);
}; };
} //namespace srslte } // namespace srslte
#endif // SRSLTE_NAS_PCAP_H #endif // SRSLTE_NAS_PCAP_H

@ -22,79 +22,76 @@
#ifndef SRSLTE_PCAP_H #ifndef SRSLTE_PCAP_H
#define SRSLTE_PCAP_H #define SRSLTE_PCAP_H
#include <arpa/inet.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <arpa/inet.h>
#include <sys/time.h> #include <sys/time.h>
#define MAC_LTE_DLT 147 #define MAC_LTE_DLT 147
#define NAS_LTE_DLT 148 #define NAS_LTE_DLT 148
#define UDP_DLT 149 // UDP needs to be selected as protocol #define UDP_DLT 149 // UDP needs to be selected as protocol
#define S1AP_LTE_DLT 150 #define S1AP_LTE_DLT 150
/* This structure gets written to the start of the file */ /* This structure gets written to the start of the file */
typedef struct pcap_hdr_s { typedef struct pcap_hdr_s {
unsigned int magic_number; /* magic number */ unsigned int magic_number; /* magic number */
unsigned short version_major; /* major version number */ unsigned short version_major; /* major version number */
unsigned short version_minor; /* minor version number */ unsigned short version_minor; /* minor version number */
unsigned int thiszone; /* GMT to local correction */ unsigned int thiszone; /* GMT to local correction */
unsigned int sigfigs; /* accuracy of timestamps */ unsigned int sigfigs; /* accuracy of timestamps */
unsigned int snaplen; /* max length of captured packets, in octets */ unsigned int snaplen; /* max length of captured packets, in octets */
unsigned int network; /* data link type */ unsigned int network; /* data link type */
} pcap_hdr_t; } pcap_hdr_t;
/* This structure precedes each packet */ /* This structure precedes each packet */
typedef struct pcaprec_hdr_s { typedef struct pcaprec_hdr_s {
unsigned int ts_sec; /* timestamp seconds */ unsigned int ts_sec; /* timestamp seconds */
unsigned int ts_usec; /* timestamp microseconds */ unsigned int ts_usec; /* timestamp microseconds */
unsigned int incl_len; /* number of octets of packet saved in file */ unsigned int incl_len; /* number of octets of packet saved in file */
unsigned int orig_len; /* actual length of packet */ unsigned int orig_len; /* actual length of packet */
} pcaprec_hdr_t; } pcaprec_hdr_t;
/* radioType */ /* radioType */
#define FDD_RADIO 1 #define FDD_RADIO 1
#define TDD_RADIO 2 #define TDD_RADIO 2
/* Direction */ /* Direction */
#define DIRECTION_UPLINK 0 #define DIRECTION_UPLINK 0
#define DIRECTION_DOWNLINK 1 #define DIRECTION_DOWNLINK 1
/* rntiType */ /* rntiType */
#define NO_RNTI 0 /* Used for BCH-BCH */ #define NO_RNTI 0 /* Used for BCH-BCH */
#define P_RNTI 1 #define P_RNTI 1
#define RA_RNTI 2 #define RA_RNTI 2
#define C_RNTI 3 #define C_RNTI 3
#define SI_RNTI 4 #define SI_RNTI 4
#define SPS_RNTI 5 #define SPS_RNTI 5
#define M_RNTI 6 #define M_RNTI 6
#define MAC_LTE_START_STRING "mac-lte" #define MAC_LTE_START_STRING "mac-lte"
#define MAC_LTE_PAYLOAD_TAG 0x01 #define MAC_LTE_PAYLOAD_TAG 0x01
#define MAC_LTE_RNTI_TAG 0x02 #define MAC_LTE_RNTI_TAG 0x02
#define MAC_LTE_UEID_TAG 0x03 #define MAC_LTE_UEID_TAG 0x03
#define MAC_LTE_FRAME_SUBFRAME_TAG 0x04 #define MAC_LTE_FRAME_SUBFRAME_TAG 0x04
#define MAC_LTE_PREDFINED_DATA_TAG 0x05 #define MAC_LTE_PREDFINED_DATA_TAG 0x05
#define MAC_LTE_RETX_TAG 0x06 #define MAC_LTE_RETX_TAG 0x06
#define MAC_LTE_CRC_STATUS_TAG 0x07 #define MAC_LTE_CRC_STATUS_TAG 0x07
#define MAC_LTE_NB_MODE_TAG 0x0F #define MAC_LTE_NB_MODE_TAG 0x0F
/* Context information for every MAC PDU that will be logged */ /* Context information for every MAC PDU that will be logged */
typedef struct MAC_Context_Info_t { typedef struct MAC_Context_Info_t {
unsigned short radioType; unsigned short radioType;
unsigned char direction; unsigned char direction;
unsigned char rntiType; unsigned char rntiType;
unsigned short rnti; unsigned short rnti;
unsigned short ueid; unsigned short ueid;
unsigned char isRetx; unsigned char isRetx;
unsigned char crcStatusOK; unsigned char crcStatusOK;
unsigned short sysFrameNumber; unsigned short sysFrameNumber;
unsigned short subFrameNumber; unsigned short subFrameNumber;
unsigned char nbiotMode; unsigned char nbiotMode;
} MAC_Context_Info_t; } MAC_Context_Info_t;
/* Context information for every NAS PDU that will be logged */ /* Context information for every NAS PDU that will be logged */
@ -128,7 +125,7 @@ typedef struct {
#define RLC_TM_MODE 1 #define RLC_TM_MODE 1
#define RLC_UM_MODE 2 #define RLC_UM_MODE 2
#define RLC_AM_MODE 4 #define RLC_AM_MODE 4
#define RLC_PREDEF 8 #define RLC_PREDEF 8
/* priority ? */ /* priority ? */
@ -149,10 +146,7 @@ typedef struct {
#define AM_SN_LENGTH_16_BITS 16 #define AM_SN_LENGTH_16_BITS 16
/* Narrow band mode */ /* Narrow band mode */
typedef enum { typedef enum { rlc_no_nb_mode = 0, rlc_nb_mode = 1 } rlc_lte_nb_mode;
rlc_no_nb_mode = 0,
rlc_nb_mode = 1
} rlc_lte_nb_mode;
/* Context information for every RLC PDU that will be logged */ /* Context information for every RLC PDU that will be logged */
typedef struct { typedef struct {
@ -168,19 +162,17 @@ typedef struct {
rlc_lte_nb_mode nbMode; rlc_lte_nb_mode nbMode;
} RLC_Context_Info_t; } RLC_Context_Info_t;
// See Wireshark's packet-rlc-lte.h for details // See Wireshark's packet-rlc-lte.h for details
#define RLC_LTE_START_STRING "rlc-lte" #define RLC_LTE_START_STRING "rlc-lte"
#define RLC_LTE_SN_LENGTH_TAG 0x02 #define RLC_LTE_SN_LENGTH_TAG 0x02
#define RLC_LTE_DIRECTION_TAG 0x03 #define RLC_LTE_DIRECTION_TAG 0x03
#define RLC_LTE_PRIORITY_TAG 0x04 #define RLC_LTE_PRIORITY_TAG 0x04
#define RLC_LTE_UEID_TAG 0x05 #define RLC_LTE_UEID_TAG 0x05
#define RLC_LTE_CHANNEL_TYPE_TAG 0x06 #define RLC_LTE_CHANNEL_TYPE_TAG 0x06
#define RLC_LTE_CHANNEL_ID_TAG 0x07 #define RLC_LTE_CHANNEL_ID_TAG 0x07
#define RLC_LTE_EXT_LI_FIELD_TAG 0x08 #define RLC_LTE_EXT_LI_FIELD_TAG 0x08
#define RLC_LTE_NB_MODE_TAG 0x09 #define RLC_LTE_NB_MODE_TAG 0x09
#define RLC_LTE_PAYLOAD_TAG 0x01 #define RLC_LTE_PAYLOAD_TAG 0x01
/* Context information for every S1AP PDU that will be logged */ /* Context information for every S1AP PDU that will be logged */
typedef struct S1AP_Context_Info_s { typedef struct S1AP_Context_Info_s {
@ -192,235 +184,227 @@ typedef struct S1AP_Context_Info_s {
**************************************************************************/ **************************************************************************/
/* Open the file and write file header */ /* Open the file and write file header */
inline FILE *LTE_PCAP_Open(uint32_t DLT, const char *fileName) inline FILE* LTE_PCAP_Open(uint32_t DLT, const char* fileName)
{ {
pcap_hdr_t file_header = pcap_hdr_t file_header = {
{ 0xa1b2c3d4, /* magic number */
0xa1b2c3d4, /* magic number */ 2,
2, 4, /* version number is 2.4 */ 4, /* version number is 2.4 */
0, /* timezone */ 0, /* timezone */
0, /* sigfigs - apparently all tools do this */ 0, /* sigfigs - apparently all tools do this */
65535, /* snaplen - this should be long enough */ 65535, /* snaplen - this should be long enough */
DLT /* Data Link Type (DLT). Set as unused value 147 for now */ DLT /* Data Link Type (DLT). Set as unused value 147 for now */
}; };
FILE *fd = fopen(fileName, "w"); FILE* fd = fopen(fileName, "w");
if (fd == NULL) { if (fd == NULL) {
printf("Failed to open file \"%s\" for writing\n", fileName); printf("Failed to open file \"%s\" for writing\n", fileName);
return NULL; return NULL;
} }
/* Write the file header */ /* Write the file header */
fwrite(&file_header, sizeof(pcap_hdr_t), 1, fd); fwrite(&file_header, sizeof(pcap_hdr_t), 1, fd);
return fd; return fd;
} }
/* Close the PCAP file */ /* Close the PCAP file */
inline void LTE_PCAP_Close(FILE *fd) inline void LTE_PCAP_Close(FILE* fd)
{ {
if(fd) if (fd)
fclose(fd); fclose(fd);
} }
/************************************************************************** /**************************************************************************
* API functions for writing MAC-LTE PCAP files * * API functions for writing MAC-LTE PCAP files *
**************************************************************************/ **************************************************************************/
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */ /* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
inline int LTE_PCAP_MAC_WritePDU(FILE *fd, MAC_Context_Info_t *context, inline int LTE_PCAP_MAC_WritePDU(FILE* fd, MAC_Context_Info_t* context, const unsigned char* PDU, unsigned int length)
const unsigned char *PDU, unsigned int length)
{ {
pcaprec_hdr_t packet_header; pcaprec_hdr_t packet_header;
char context_header[256]; char context_header[256];
int offset = 0; int offset = 0;
uint16_t tmp16; uint16_t tmp16;
/* Can't write if file wasn't successfully opened */ /* Can't write if file wasn't successfully opened */
if (fd == NULL) { if (fd == NULL) {
printf("Error: Can't write to empty file handle\n"); printf("Error: Can't write to empty file handle\n");
return 0; return 0;
} }
/*****************************************************************/ /*****************************************************************/
/* Context information (same as written by UDP heuristic clients */ /* Context information (same as written by UDP heuristic clients */
context_header[offset++] = context->radioType; context_header[offset++] = context->radioType;
context_header[offset++] = context->direction; context_header[offset++] = context->direction;
context_header[offset++] = context->rntiType; context_header[offset++] = context->rntiType;
/* RNTI */ /* RNTI */
context_header[offset++] = MAC_LTE_RNTI_TAG; context_header[offset++] = MAC_LTE_RNTI_TAG;
tmp16 = htons(context->rnti); tmp16 = htons(context->rnti);
memcpy(context_header+offset, &tmp16, 2); memcpy(context_header + offset, &tmp16, 2);
offset += 2; offset += 2;
/* UEId */ /* UEId */
context_header[offset++] = MAC_LTE_UEID_TAG; context_header[offset++] = MAC_LTE_UEID_TAG;
tmp16 = htons(context->ueid); tmp16 = htons(context->ueid);
memcpy(context_header+offset, &tmp16, 2); memcpy(context_header + offset, &tmp16, 2);
offset += 2; offset += 2;
/* Subframe Number and System Frame Number */ /* Subframe Number and System Frame Number */
/* SFN is stored in 12 MSB and SF in 4 LSB */ /* SFN is stored in 12 MSB and SF in 4 LSB */
context_header[offset++] = MAC_LTE_FRAME_SUBFRAME_TAG; context_header[offset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
tmp16 = (context->sysFrameNumber << 4) | context->subFrameNumber; tmp16 = (context->sysFrameNumber << 4) | context->subFrameNumber;
tmp16 = htons(tmp16); tmp16 = htons(tmp16);
memcpy(context_header+offset, &tmp16, 2); memcpy(context_header + offset, &tmp16, 2);
offset += 2; offset += 2;
/* CRC Status */
context_header[offset++] = MAC_LTE_CRC_STATUS_TAG;
context_header[offset++] = context->crcStatusOK;
/* NB-IoT mode tag */
context_header[offset++] = MAC_LTE_NB_MODE_TAG;
context_header[offset++] = context->nbiotMode;
/* Data tag immediately preceding PDU */
context_header[offset++] = MAC_LTE_PAYLOAD_TAG;
/****************************************************************/
/* PCAP Header */
struct timeval t;
gettimeofday(&t, NULL);
packet_header.ts_sec = t.tv_sec;
packet_header.ts_usec = t.tv_usec;
packet_header.incl_len = offset + length;
packet_header.orig_len = offset + length;
/***************************************************************/
/* Now write everything to the file */
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, fd);
fwrite(context_header, 1, offset, fd);
fwrite(PDU, 1, length, fd);
return 1;
}
/* CRC Status */
context_header[offset++] = MAC_LTE_CRC_STATUS_TAG;
context_header[offset++] = context->crcStatusOK;
/* NB-IoT mode tag */
context_header[offset++] = MAC_LTE_NB_MODE_TAG;
context_header[offset++] = context->nbiotMode;
/* Data tag immediately preceding PDU */
context_header[offset++] = MAC_LTE_PAYLOAD_TAG;
/****************************************************************/
/* PCAP Header */
struct timeval t;
gettimeofday(&t, NULL);
packet_header.ts_sec = t.tv_sec;
packet_header.ts_usec = t.tv_usec;
packet_header.incl_len = offset + length;
packet_header.orig_len = offset + length;
/***************************************************************/
/* Now write everything to the file */
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, fd);
fwrite(context_header, 1, offset, fd);
fwrite(PDU, 1, length, fd);
return 1;
}
/************************************************************************** /**************************************************************************
* API functions for writing NAS-EPS PCAP files * * API functions for writing NAS-EPS PCAP files *
**************************************************************************/ **************************************************************************/
/* Write an individual PDU (PCAP packet header + nas-context + nas-pdu) */ /* Write an individual PDU (PCAP packet header + nas-context + nas-pdu) */
inline int LTE_PCAP_NAS_WritePDU(FILE *fd, NAS_Context_Info_t *context, inline int LTE_PCAP_NAS_WritePDU(FILE* fd, NAS_Context_Info_t* context, const unsigned char* PDU, unsigned int length)
const unsigned char *PDU, unsigned int length)
{ {
pcaprec_hdr_t packet_header; pcaprec_hdr_t packet_header;
/* Can't write if file wasn't successfully opened */ /* Can't write if file wasn't successfully opened */
if (fd == NULL) { if (fd == NULL) {
printf("Error: Can't write to empty file handle\n"); printf("Error: Can't write to empty file handle\n");
return 0; return 0;
} }
/****************************************************************/
/* PCAP Header */
struct timeval t;
gettimeofday(&t, NULL);
packet_header.ts_sec = t.tv_sec;
packet_header.ts_usec = t.tv_usec;
packet_header.incl_len = length;
packet_header.orig_len = length;
/***************************************************************/
/* Now write everything to the file */
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, fd);
fwrite(PDU, 1, length, fd);
return 1;
}
/****************************************************************/
/* PCAP Header */
struct timeval t;
gettimeofday(&t, NULL);
packet_header.ts_sec = t.tv_sec;
packet_header.ts_usec = t.tv_usec;
packet_header.incl_len = length;
packet_header.orig_len = length;
/***************************************************************/
/* Now write everything to the file */
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, fd);
fwrite(PDU, 1, length, fd);
return 1;
}
/************************************************************************** /**************************************************************************
* API functions for writing RLC-LTE PCAP files * * API functions for writing RLC-LTE PCAP files *
**************************************************************************/ **************************************************************************/
/* Write an individual RLC PDU (PCAP packet header + UDP header + rlc-context + rlc-pdu) */ /* Write an individual RLC PDU (PCAP packet header + UDP header + rlc-context + rlc-pdu) */
inline int LTE_PCAP_RLC_WritePDU(FILE *fd, RLC_Context_Info_t *context, inline int LTE_PCAP_RLC_WritePDU(FILE* fd, RLC_Context_Info_t* context, const unsigned char* PDU, unsigned int length)
const unsigned char *PDU, unsigned int length)
{ {
pcaprec_hdr_t packet_header; pcaprec_hdr_t packet_header;
char context_header[256]; char context_header[256];
int offset = 0; int offset = 0;
uint16_t tmp16; uint16_t tmp16;
/* Can't write if file wasn't successfully opened */ /* Can't write if file wasn't successfully opened */
if (fd == NULL) { if (fd == NULL) {
printf("Error: Can't write to empty file handle\n"); printf("Error: Can't write to empty file handle\n");
return 0; return 0;
} }
/*****************************************************************/ /*****************************************************************/
// Add dummy UDP header, start with src and dest port // Add dummy UDP header, start with src and dest port
context_header[offset++] = 0xde; context_header[offset++] = 0xde;
context_header[offset++] = 0xad; context_header[offset++] = 0xad;
context_header[offset++] = 0xbe; context_header[offset++] = 0xbe;
context_header[offset++] = 0xef; context_header[offset++] = 0xef;
// length // length
tmp16 = length + 12; tmp16 = length + 12;
memcpy(context_header+offset, &tmp16, 2); memcpy(context_header + offset, &tmp16, 2);
offset += 2; offset += 2;
// dummy CRC // dummy CRC
context_header[offset++] = 0xde; context_header[offset++] = 0xde;
context_header[offset++] = 0xad; context_header[offset++] = 0xad;
// Start magic string // Start magic string
memcpy(&context_header[offset], RLC_LTE_START_STRING, strlen(RLC_LTE_START_STRING)); memcpy(&context_header[offset], RLC_LTE_START_STRING, strlen(RLC_LTE_START_STRING));
offset += strlen(RLC_LTE_START_STRING); offset += strlen(RLC_LTE_START_STRING);
// Fixed field RLC mode // Fixed field RLC mode
context_header[offset++] = context->rlcMode; context_header[offset++] = context->rlcMode;
// Conditional fields // Conditional fields
if (context->rlcMode == RLC_UM_MODE) { if (context->rlcMode == RLC_UM_MODE) {
context_header[offset++] = RLC_LTE_SN_LENGTH_TAG; context_header[offset++] = RLC_LTE_SN_LENGTH_TAG;
context_header[offset++] = context->sequenceNumberLength; context_header[offset++] = context->sequenceNumberLength;
} }
// Optional fields // Optional fields
context_header[offset++] = RLC_LTE_DIRECTION_TAG; context_header[offset++] = RLC_LTE_DIRECTION_TAG;
context_header[offset++] = context->direction; context_header[offset++] = context->direction;
context_header[offset++] = RLC_LTE_PRIORITY_TAG; context_header[offset++] = RLC_LTE_PRIORITY_TAG;
context_header[offset++] = context->priority; context_header[offset++] = context->priority;
context_header[offset++] = RLC_LTE_UEID_TAG; context_header[offset++] = RLC_LTE_UEID_TAG;
tmp16 = htons(context->ueid); tmp16 = htons(context->ueid);
memcpy(context_header+offset, &tmp16, 2); memcpy(context_header + offset, &tmp16, 2);
offset += 2; offset += 2;
context_header[offset++] = RLC_LTE_CHANNEL_TYPE_TAG; context_header[offset++] = RLC_LTE_CHANNEL_TYPE_TAG;
tmp16 = htons(context->channelType); tmp16 = htons(context->channelType);
memcpy(context_header+offset, &tmp16, 2); memcpy(context_header + offset, &tmp16, 2);
offset += 2; offset += 2;
context_header[offset++] = RLC_LTE_CHANNEL_ID_TAG; context_header[offset++] = RLC_LTE_CHANNEL_ID_TAG;
tmp16 = htons(context->channelId); tmp16 = htons(context->channelId);
memcpy(context_header+offset, &tmp16, 2); memcpy(context_header + offset, &tmp16, 2);
offset += 2; offset += 2;
// Now the actual PDU // Now the actual PDU
context_header[offset++] = RLC_LTE_PAYLOAD_TAG; context_header[offset++] = RLC_LTE_PAYLOAD_TAG;
// PCAP header // PCAP header
struct timeval t; struct timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
packet_header.ts_sec = t.tv_sec; packet_header.ts_sec = t.tv_sec;
packet_header.ts_usec = t.tv_usec; packet_header.ts_usec = t.tv_usec;
packet_header.incl_len = offset + length; packet_header.incl_len = offset + length;
packet_header.orig_len = offset + length; packet_header.orig_len = offset + length;
// Write everything to file // Write everything to file
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, fd); fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, fd);
fwrite(context_header, 1, offset, fd); fwrite(context_header, 1, offset, fd);
fwrite(PDU, 1, length, fd); fwrite(PDU, 1, length, fd);
return 1; return 1;
} }
/************************************************************************** /**************************************************************************
@ -428,32 +412,31 @@ inline int LTE_PCAP_RLC_WritePDU(FILE *fd, RLC_Context_Info_t *context,
**************************************************************************/ **************************************************************************/
/* Write an individual PDU (PCAP packet header + s1ap-context + s1ap-pdu) */ /* Write an individual PDU (PCAP packet header + s1ap-context + s1ap-pdu) */
inline int LTE_PCAP_S1AP_WritePDU(FILE *fd, S1AP_Context_Info_t *context, inline int LTE_PCAP_S1AP_WritePDU(FILE* fd, S1AP_Context_Info_t* context, const unsigned char* PDU, unsigned int length)
const unsigned char *PDU, unsigned int length)
{ {
pcaprec_hdr_t packet_header; pcaprec_hdr_t packet_header;
/* Can't write if file wasn't successfully opened */ /* Can't write if file wasn't successfully opened */
if (fd == NULL) { if (fd == NULL) {
printf("Error: Can't write to empty file handle\n"); printf("Error: Can't write to empty file handle\n");
return 0; return 0;
} }
/****************************************************************/ /****************************************************************/
/* PCAP Header */ /* PCAP Header */
struct timeval t; struct timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
packet_header.ts_sec = t.tv_sec; packet_header.ts_sec = t.tv_sec;
packet_header.ts_usec = t.tv_usec; packet_header.ts_usec = t.tv_usec;
packet_header.incl_len = length; packet_header.incl_len = length;
packet_header.orig_len = length; packet_header.orig_len = length;
/***************************************************************/ /***************************************************************/
/* Now write everything to the file */ /* Now write everything to the file */
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, fd); fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, fd);
fwrite(PDU, 1, length, fd); fwrite(PDU, 1, length, fd);
return 1; return 1;
} }
/************************************************************************** /**************************************************************************

@ -120,10 +120,7 @@ public:
uint8_t* get_current_sdu_ptr() { return &buffer_tx->msg[buffer_tx->N_bytes]; } uint8_t* get_current_sdu_ptr() { return &buffer_tx->msg[buffer_tx->N_bytes]; }
void add_sdu(uint32_t sdu_sz) void add_sdu(uint32_t sdu_sz) { buffer_tx->N_bytes += sdu_sz; }
{
buffer_tx->N_bytes += sdu_sz;
}
// Section 6.1.2 // Section 6.1.2
void parse_packet(uint8_t* ptr) void parse_packet(uint8_t* ptr)
@ -167,12 +164,12 @@ protected:
/* Prepares the PDU for parsing or writing by setting the number of subheaders to 0 and the pdu length */ /* Prepares the PDU for parsing or writing by setting the number of subheaders to 0 and the pdu length */
virtual void init_(byte_buffer_t* buffer_tx_, uint32_t pdu_len_bytes, bool is_ulsch) virtual void init_(byte_buffer_t* buffer_tx_, uint32_t pdu_len_bytes, bool is_ulsch)
{ {
nof_subheaders = 0; nof_subheaders = 0;
pdu_len = pdu_len_bytes; pdu_len = pdu_len_bytes;
rem_len = pdu_len; rem_len = pdu_len;
pdu_is_ul = is_ulsch; pdu_is_ul = is_ulsch;
buffer_tx = buffer_tx_; buffer_tx = buffer_tx_;
last_sdu_idx = -1; last_sdu_idx = -1;
reset(); reset();
for (uint32_t i = 0; i < max_subheaders; i++) { for (uint32_t i = 0; i < max_subheaders; i++) {
subheaders[i].parent = this; subheaders[i].parent = this;
@ -391,12 +388,12 @@ private:
/* Prepares the PDU for parsing or writing by setting the number of subheaders to 0 and the pdu length */ /* Prepares the PDU for parsing or writing by setting the number of subheaders to 0 and the pdu length */
virtual void init_(byte_buffer_t* buffer_tx_, uint32_t pdu_len_bytes, bool is_ulsch) virtual void init_(byte_buffer_t* buffer_tx_, uint32_t pdu_len_bytes, bool is_ulsch)
{ {
nof_subheaders = 0; nof_subheaders = 0;
pdu_len = pdu_len_bytes; pdu_len = pdu_len_bytes;
rem_len = pdu_len; rem_len = pdu_len;
pdu_is_ul = is_ulsch; pdu_is_ul = is_ulsch;
buffer_tx = buffer_tx_; buffer_tx = buffer_tx_;
last_sdu_idx = -1; last_sdu_idx = -1;
reset(); reset();
for (uint32_t i = 0; i < max_subheaders; i++) { for (uint32_t i = 0; i < max_subheaders; i++) {
subheaders[i].set_type(MCH_SUBH_TYPE); subheaders[i].set_type(MCH_SUBH_TYPE);

@ -22,64 +22,56 @@
#ifndef SRSLTE_PDU_QUEUE_H #ifndef SRSLTE_PDU_QUEUE_H
#define SRSLTE_PDU_QUEUE_H #define SRSLTE_PDU_QUEUE_H
#include "srslte/common/log.h"
#include "srslte/common/block_queue.h" #include "srslte/common/block_queue.h"
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
#include "srslte/common/timers.h" #include "srslte/common/log.h"
#include "srslte/common/pdu.h" #include "srslte/common/pdu.h"
#include "srslte/common/timers.h"
/* Logical Channel Demultiplexing and MAC CE dissassemble */ /* Logical Channel Demultiplexing and MAC CE dissassemble */
namespace srslte { namespace srslte {
class pdu_queue class pdu_queue
{ {
public: public:
typedef enum { typedef enum { DCH, BCH, MCH } channel_t;
DCH,
BCH,
MCH
} channel_t;
class process_callback class process_callback
{ {
public: public:
virtual void process_pdu(uint8_t* buff, uint32_t len, channel_t channel) = 0; virtual void process_pdu(uint8_t* buff, uint32_t len, channel_t channel) = 0;
}; };
pdu_queue(uint32_t pool_size = DEFAULT_POOL_SIZE) : pool(pool_size), callback(NULL), log_h(NULL) {} pdu_queue(uint32_t pool_size = DEFAULT_POOL_SIZE) : pool(pool_size), callback(NULL), log_h(NULL) {}
void init(process_callback *callback, log* log_h_); void init(process_callback* callback, log* log_h_);
uint8_t* request(uint32_t len); uint8_t* request(uint32_t len);
void deallocate(uint8_t* pdu); void deallocate(uint8_t* pdu);
void push(uint8_t* ptr, uint32_t len, channel_t channel = DCH); void push(uint8_t* ptr, uint32_t len, channel_t channel = DCH);
bool process_pdus(); bool process_pdus();
private: private:
const static int DEFAULT_POOL_SIZE = 64; // Number of PDU buffers in total const static int DEFAULT_POOL_SIZE = 64; // Number of PDU buffers in total
const static int MAX_PDU_LEN = 150*1024/8; // ~ 150 Mbps const static int MAX_PDU_LEN = 150 * 1024 / 8; // ~ 150 Mbps
typedef struct { typedef struct {
uint8_t ptr[MAX_PDU_LEN]; uint8_t ptr[MAX_PDU_LEN];
uint32_t len; uint32_t len;
channel_t channel; channel_t channel;
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
char debug_name[128]; char debug_name[128];
#endif #endif
} pdu_t; } pdu_t;
block_queue<pdu_t*> pdu_q; block_queue<pdu_t*> pdu_q;
buffer_pool<pdu_t> pool; buffer_pool<pdu_t> pool;
process_callback *callback; process_callback* callback;
log *log_h; log* log_h;
}; };
} // namespace srslte } // namespace srslte
#endif // SRSLTE_PDU_QUEUE_H #endif // SRSLTE_PDU_QUEUE_H

@ -22,37 +22,42 @@
#ifndef RLCPCAP_H #ifndef RLCPCAP_H
#define RLCPCAP_H #define RLCPCAP_H
#include <stdint.h>
#include "srslte/common/pcap.h" #include "srslte/common/pcap.h"
#include <stdint.h>
namespace srslte { namespace srslte {
class rlc_pcap class rlc_pcap
{ {
public: public:
rlc_pcap() {enable_write=false; ue_id=0; pcap_file = NULL; }; rlc_pcap()
{
enable_write = false;
ue_id = 0;
pcap_file = NULL;
};
void enable(bool en); void enable(bool en);
void open(const char *filename, uint32_t ue_id = 0); void open(const char* filename, uint32_t ue_id = 0);
void close(); void close();
void set_ue_id(uint16_t ue_id); void set_ue_id(uint16_t ue_id);
void write_dl_am_ccch(uint8_t* pdu, uint32_t pdu_len_bytes); void write_dl_am_ccch(uint8_t* pdu, uint32_t pdu_len_bytes);
void write_ul_am_ccch(uint8_t* pdu, uint32_t pdu_len_bytes); void write_ul_am_ccch(uint8_t* pdu, uint32_t pdu_len_bytes);
private: private:
bool enable_write; bool enable_write;
FILE *pcap_file; FILE* pcap_file;
uint32_t ue_id; uint32_t ue_id;
void pack_and_write(uint8_t* pdu, void pack_and_write(uint8_t* pdu,
uint32_t pdu_len_bytes, uint32_t pdu_len_bytes,
uint8_t mode, uint8_t mode,
uint8_t direction, uint8_t direction,
uint8_t priority, uint8_t priority,
uint8_t seqnumberlength, uint8_t seqnumberlength,
uint16_t ueid, uint16_t ueid,
uint16_t channel_type, uint16_t channel_type,
uint16_t channel_id); uint16_t channel_id);
}; };
} // namespace srslte } // namespace srslte

@ -29,16 +29,21 @@ namespace srslte {
class s1ap_pcap class s1ap_pcap
{ {
public: public:
s1ap_pcap() {enable_write=false; pcap_file = NULL; } s1ap_pcap()
void enable(); {
void open(const char *filename); enable_write = false;
void close(); pcap_file = NULL;
void write_s1ap(uint8_t *pdu, uint32_t pdu_len_bytes); }
void enable();
void open(const char* filename);
void close();
void write_s1ap(uint8_t* pdu, uint32_t pdu_len_bytes);
private: private:
bool enable_write; bool enable_write;
FILE *pcap_file; FILE* pcap_file;
}; };
} //namespace srslte } // namespace srslte
#endif // SRSLTE_NAS_PCAP_H #endif // SRSLTE_NAS_PCAP_H

@ -26,7 +26,6 @@
* Common security header - wraps ciphering/integrity check algorithms. * Common security header - wraps ciphering/integrity check algorithms.
*****************************************************************************/ *****************************************************************************/
#include "srslte/common/common.h" #include "srslte/common/common.h"
namespace srslte { namespace srslte {
@ -38,8 +37,10 @@ typedef enum {
CIPHERING_ALGORITHM_ID_128_EEA3, CIPHERING_ALGORITHM_ID_128_EEA3,
CIPHERING_ALGORITHM_ID_N_ITEMS, CIPHERING_ALGORITHM_ID_N_ITEMS,
} CIPHERING_ALGORITHM_ID_ENUM; } CIPHERING_ALGORITHM_ID_ENUM;
static const char ciphering_algorithm_id_text[CIPHERING_ALGORITHM_ID_N_ITEMS][20] = { static const char ciphering_algorithm_id_text[CIPHERING_ALGORITHM_ID_N_ITEMS][20] = {"EEA0",
"EEA0", "128-EEA1", "128-EEA2", "128-EEA3"}; "128-EEA1",
"128-EEA2",
"128-EEA3"};
typedef enum { typedef enum {
INTEGRITY_ALGORITHM_ID_EIA0 = 0, INTEGRITY_ALGORITHM_ID_EIA0 = 0,
@ -48,8 +49,10 @@ typedef enum {
INTEGRITY_ALGORITHM_ID_128_EIA3, INTEGRITY_ALGORITHM_ID_128_EIA3,
INTEGRITY_ALGORITHM_ID_N_ITEMS, INTEGRITY_ALGORITHM_ID_N_ITEMS,
} INTEGRITY_ALGORITHM_ID_ENUM; } INTEGRITY_ALGORITHM_ID_ENUM;
static const char integrity_algorithm_id_text[INTEGRITY_ALGORITHM_ID_N_ITEMS][20] = { static const char integrity_algorithm_id_text[INTEGRITY_ALGORITHM_ID_N_ITEMS][20] = {"EIA0",
"EIA0", "128-EIA1", "128-EIA2", "128-EIA3"}; "128-EIA1",
"128-EIA2",
"128-EIA3"};
typedef enum { typedef enum {
SECURITY_DIRECTION_UPLINK = 0, SECURITY_DIRECTION_UPLINK = 0,
@ -61,70 +64,93 @@ static const char security_direction_text[INTEGRITY_ALGORITHM_ID_N_ITEMS][20] =
/****************************************************************************** /******************************************************************************
* Key Generation * Key Generation
*****************************************************************************/ *****************************************************************************/
uint8_t security_generate_k_asme( uint8_t *ck, uint8_t security_generate_k_asme(uint8_t* ck,
uint8_t *ik, uint8_t* ik,
uint8_t *ak, uint8_t* ak,
uint8_t *sqn, uint8_t* sqn,
uint16_t mcc, uint16_t mcc,
uint16_t mnc, uint16_t mnc,
uint8_t *k_asme); uint8_t* k_asme);
uint8_t security_generate_k_enb( uint8_t *k_asme, uint8_t security_generate_k_enb(uint8_t* k_asme, uint32_t nas_count, uint8_t* k_enb);
uint32_t nas_count,
uint8_t *k_enb); uint8_t security_generate_k_enb_star(uint8_t* k_enb, uint32_t pci, uint32_t earfcn, uint8_t* k_enb_star);
uint8_t security_generate_k_enb_star( uint8_t *k_enb, uint8_t security_generate_nh(uint8_t* k_asme, uint8_t* sync, uint8_t* nh);
uint32_t pci,
uint32_t earfcn, uint8_t security_generate_k_nas(uint8_t* k_asme,
uint8_t *k_enb_star); CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
uint8_t security_generate_nh( uint8_t *k_asme, uint8_t* k_nas_enc,
uint8_t *sync, uint8_t* k_nas_int);
uint8_t *nh);
uint8_t security_generate_k_rrc(uint8_t* k_enb,
uint8_t security_generate_k_nas( uint8_t *k_asme, CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
CIPHERING_ALGORITHM_ID_ENUM enc_alg_id, INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
INTEGRITY_ALGORITHM_ID_ENUM int_alg_id, uint8_t* k_rrc_enc,
uint8_t *k_nas_enc, uint8_t* k_rrc_int);
uint8_t *k_nas_int);
uint8_t security_generate_k_up(uint8_t* k_enb,
uint8_t security_generate_k_rrc( uint8_t *k_enb, CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
CIPHERING_ALGORITHM_ID_ENUM enc_alg_id, INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
INTEGRITY_ALGORITHM_ID_ENUM int_alg_id, uint8_t* k_up_enc,
uint8_t *k_rrc_enc, uint8_t* k_up_int);
uint8_t *k_rrc_int);
uint8_t security_generate_k_up( uint8_t *k_enb,
CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
uint8_t *k_up_enc,
uint8_t *k_up_int);
/****************************************************************************** /******************************************************************************
* Integrity Protection * Integrity Protection
*****************************************************************************/ *****************************************************************************/
uint8_t security_128_eia1( uint8_t security_128_eia1(uint8_t* key,
uint8_t* key, uint32_t count, uint32_t bearer, uint8_t direction, uint8_t* msg, uint32_t msg_len, uint8_t* mac); uint32_t count,
uint32_t bearer,
uint8_t security_128_eia2( uint8_t direction,
uint8_t* key, uint32_t count, uint32_t bearer, uint8_t direction, uint8_t* msg, uint32_t msg_len, uint8_t* mac); uint8_t* msg,
uint32_t msg_len,
uint8_t security_128_eia3( uint8_t* mac);
uint8_t* key, uint32_t count, uint32_t bearer, uint8_t direction, uint8_t* msg, uint32_t msg_len, uint8_t* mac);
uint8_t security_128_eia2(uint8_t* key,
uint32_t count,
uint32_t bearer,
uint8_t direction,
uint8_t* msg,
uint32_t msg_len,
uint8_t* mac);
uint8_t security_128_eia3(uint8_t* key,
uint32_t count,
uint32_t bearer,
uint8_t direction,
uint8_t* msg,
uint32_t msg_len,
uint8_t* mac);
uint8_t security_md5(const uint8_t* input, size_t len, uint8_t* output); uint8_t security_md5(const uint8_t* input, size_t len, uint8_t* output);
/****************************************************************************** /******************************************************************************
* Encryption / Decryption * Encryption / Decryption
*****************************************************************************/ *****************************************************************************/
uint8_t security_128_eea1( uint8_t security_128_eea1(uint8_t* key,
uint8_t* key, uint32_t count, uint8_t bearer, uint8_t direction, uint8_t* msg, uint32_t msg_len, uint8_t* msg_out); uint32_t count,
uint8_t bearer,
uint8_t security_128_eea2( uint8_t direction,
uint8_t* key, uint32_t count, uint8_t bearer, uint8_t direction, uint8_t* msg, uint32_t msg_len, uint8_t* msg_out); uint8_t* msg,
uint32_t msg_len,
uint8_t security_128_eea3( uint8_t* msg_out);
uint8_t* key, uint32_t count, uint8_t bearer, uint8_t direction, uint8_t* msg, uint32_t msg_len, uint8_t* msg_out);
uint8_t security_128_eea2(uint8_t* key,
uint32_t count,
uint8_t bearer,
uint8_t direction,
uint8_t* msg,
uint32_t msg_len,
uint8_t* msg_out);
uint8_t security_128_eea3(uint8_t* key,
uint32_t count,
uint8_t bearer,
uint8_t direction,
uint8_t* msg,
uint32_t msg_len,
uint8_t* msg_out);
/****************************************************************************** /******************************************************************************
* Authentication * Authentication
@ -138,10 +164,7 @@ uint8_t security_milenage_f1_star(uint8_t* k, uint8_t* op, uint8_t* rand, uint8_
uint8_t uint8_t
security_milenage_f2345(uint8_t* k, uint8_t* op, uint8_t* rand, uint8_t* res, uint8_t* ck, uint8_t* ik, uint8_t* ak); security_milenage_f2345(uint8_t* k, uint8_t* op, uint8_t* rand, uint8_t* res, uint8_t* ck, uint8_t* ik, uint8_t* ak);
uint8_t security_milenage_f5_star( uint8_t *k, uint8_t security_milenage_f5_star(uint8_t* k, uint8_t* op, uint8_t* rand, uint8_t* ak);
uint8_t *op,
uint8_t *rand,
uint8_t *ak);
} // namespace srslte } // namespace srslte
#endif // SRSLTE_SECURITY_H #endif // SRSLTE_SECURITY_H

@ -1,74 +1,72 @@
/*--------------------------------------------------------- /*---------------------------------------------------------
* snow_3g.h * snow_3g.h
* *
* Adapted from ETSI/SAGE specifications: * Adapted from ETSI/SAGE specifications:
* "Specification of the 3GPP Confidentiality and * "Specification of the 3GPP Confidentiality and
* Integrity Algorithms UEA2 & UIA2. * Integrity Algorithms UEA2 & UIA2.
* Document 1: UEA2 and UIA2 Specification" * Document 1: UEA2 and UIA2 Specification"
* "Specification of the 3GPP Confidentiality * "Specification of the 3GPP Confidentiality
* and Integrity Algorithms UEA2 & UIA2. * and Integrity Algorithms UEA2 & UIA2.
* Document 2: SNOW 3G Specification" * Document 2: SNOW 3G Specification"
*---------------------------------------------------------*/ *---------------------------------------------------------*/
#ifndef SRSLTE_SNOW_3G_H #ifndef SRSLTE_SNOW_3G_H
#define SRSLTE_SNOW_3G_H #define SRSLTE_SNOW_3G_H
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h>
typedef unsigned char u8; typedef unsigned char u8;
typedef unsigned int u32; typedef unsigned int u32;
typedef unsigned long long u64; typedef unsigned long long u64;
/* Initialization. /* Initialization.
* Input k[4]: Four 32-bit words making up 128-bit key. * Input k[4]: Four 32-bit words making up 128-bit key.
* Input IV[4]: Four 32-bit words making 128-bit initialization variable. * Input IV[4]: Four 32-bit words making 128-bit initialization variable.
* Output: All the LFSRs and FSM are initialized for key generation. * Output: All the LFSRs and FSM are initialized for key generation.
* See Section 4.1. * See Section 4.1.
*/ */
void snow3g_initialize(u32 k[4], u32 IV[4]); void snow3g_initialize(u32 k[4], u32 IV[4]);
/* Generation of Keystream. /* Generation of Keystream.
* input n: number of 32-bit words of keystream. * input n: number of 32-bit words of keystream.
* input z: space for the generated keystream, assumes * input z: space for the generated keystream, assumes
* memory is allocated already. * memory is allocated already.
* output: generated keystream which is filled in z * output: generated keystream which is filled in z
* See section 4.2. * See section 4.2.
*/ */
void snow3g_generate_keystream(u32 n, u32 *z); void snow3g_generate_keystream(u32 n, u32* z);
/* f8. /* f8.
* Input key: 128 bit Confidentiality Key. * Input key: 128 bit Confidentiality Key.
* Input count:32-bit Count, Frame dependent input. * Input count:32-bit Count, Frame dependent input.
* Input bearer: 5-bit Bearer identity (in the LSB side). * Input bearer: 5-bit Bearer identity (in the LSB side).
* Input dir:1 bit, direction of transmission. * Input dir:1 bit, direction of transmission.
* Input data: length number of bits, input bit stream. * Input data: length number of bits, input bit stream.
* Input length: 32 bit Length, i.e., the number of bits to be encrypted or * Input length: 32 bit Length, i.e., the number of bits to be encrypted or
* decrypted. * decrypted.
* Output data: Output bit stream. Assumes data is suitably memory * Output data: Output bit stream. Assumes data is suitably memory
* allocated. * allocated.
* Encrypts/decrypts blocks of data between 1 and 2^32 bits in length as * Encrypts/decrypts blocks of data between 1 and 2^32 bits in length as
* defined in Section 3. * defined in Section 3.
*/ */
void snow3g_f8( u8 *key, u32 count, u32 bearer, u32 dir, \ void snow3g_f8(u8* key, u32 count, u32 bearer, u32 dir, u8* data, u32 length);
u8 *data, u32 length );
/* f9. /* f9.
* Input key: 128 bit Integrity Key. * Input key: 128 bit Integrity Key.
* Input count:32-bit Count, Frame dependent input. * Input count:32-bit Count, Frame dependent input.
* Input fresh: 32-bit Random number. * Input fresh: 32-bit Random number.
* Input dir:1 bit, direction of transmission (in the LSB). * Input dir:1 bit, direction of transmission (in the LSB).
* Input data: length number of bits, input bit stream. * Input data: length number of bits, input bit stream.
* Input length: 64 bit Length, i.e., the number of bits to be MAC'd. * Input length: 64 bit Length, i.e., the number of bits to be MAC'd.
* Output : 32 bit block used as MAC * Output : 32 bit block used as MAC
* Generates 32-bit MAC using UIA2 algorithm as defined in Section 4. * Generates 32-bit MAC using UIA2 algorithm as defined in Section 4.
*/ */
u8* snow3g_f9( u8* key, u32 count, u32 fresh, u32 dir, \ u8* snow3g_f9(u8* key, u32 count, u32 fresh, u32 dir, u8* data, u64 length);
u8 *data, u64 length);
#endif // SRSLTE_SNOW_3G_H #endif // SRSLTE_SNOW_3G_H

@ -21,8 +21,8 @@
/****************************************************************************** /******************************************************************************
* File: thread_pool.h * File: thread_pool.h
* Description: Implements a pool of threads. Pending tasks to execute are * Description: Implements a pool of threads. Pending tasks to execute are
* identified by a pointer. * identified by a pointer.
* Reference: * Reference:
*****************************************************************************/ *****************************************************************************/
@ -46,58 +46,51 @@ namespace srslte {
class thread_pool class thread_pool
{ {
public: public:
class worker : public thread class worker : public thread
{ {
public: public:
worker(); worker();
void setup(uint32_t id, thread_pool *parent, uint32_t prio=0, uint32_t mask = 255); void setup(uint32_t id, thread_pool* parent, uint32_t prio = 0, uint32_t mask = 255);
virtual void stop(); virtual void stop();
uint32_t get_id(); uint32_t get_id();
void release(); void release();
protected:
protected:
virtual void work_imp() = 0; virtual void work_imp() = 0;
private:
uint32_t my_id; private:
thread_pool *my_parent; uint32_t my_id;
bool running; thread_pool* my_parent;
void run_thread(); bool running;
void wait_to_start(); void run_thread();
void finished(); void wait_to_start();
void finished();
}; };
thread_pool(uint32_t nof_workers);
thread_pool(uint32_t nof_workers); void init_worker(uint32_t id, worker*, uint32_t prio = 0, uint32_t mask = 255);
void init_worker(uint32_t id, worker*, uint32_t prio = 0, uint32_t mask = 255); void stop();
void stop(); worker* wait_worker();
worker* wait_worker(); worker* wait_worker(uint32_t tti);
worker* wait_worker(uint32_t tti); worker* wait_worker_nb(uint32_t tti);
worker* wait_worker_nb(uint32_t tti); void start_worker(worker*);
void start_worker(worker*); void start_worker(uint32_t id);
void start_worker(uint32_t id); worker* get_worker(uint32_t id);
worker* get_worker(uint32_t id);
uint32_t get_nof_workers(); uint32_t get_nof_workers();
private: private:
bool find_finished_worker(uint32_t tti, uint32_t* id);
bool find_finished_worker(uint32_t tti, uint32_t *id);
typedef enum { IDLE, START_WORK, WORKER_READY, WORKING } worker_status;
typedef enum {
IDLE, std::vector<worker*> workers;
START_WORK, uint32_t nof_workers;
WORKER_READY, uint32_t max_workers;
WORKING bool running;
}worker_status; pthread_cond_t cvar_queue;
pthread_mutex_t mutex_queue;
std::vector<worker*> workers; std::vector<worker_status> status;
uint32_t nof_workers; std::vector<pthread_cond_t> cvar;
uint32_t max_workers;
bool running;
pthread_cond_t cvar_queue;
pthread_mutex_t mutex_queue;
std::vector<worker_status> status;
std::vector<pthread_cond_t> cvar;
std::vector<pthread_mutex_t> mutex; std::vector<pthread_mutex_t> mutex;
std::stack<worker*> available_workers; std::stack<worker*> available_workers;
}; };

@ -24,25 +24,25 @@
#include <pthread.h> #include <pthread.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <sys/timerfd.h> #include <sys/timerfd.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h>
// Default priority for all threads below UHD threads // Default priority for all threads below UHD threads
#define DEFAULT_PRIORITY 60 #define DEFAULT_PRIORITY 60
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif // __cplusplus #endif // __cplusplus
bool threads_new_rt(pthread_t *thread, void *(*start_routine) (void*), void *arg); bool threads_new_rt(pthread_t* thread, void* (*start_routine)(void*), void* arg);
bool threads_new_rt_prio(pthread_t *thread, void *(*start_routine) (void*), void *arg, int prio_offset); bool threads_new_rt_prio(pthread_t* thread, void* (*start_routine)(void*), void* arg, int prio_offset);
bool threads_new_rt_cpu(pthread_t *thread, void *(*start_routine) (void*), void *arg, int cpu, int prio_offset); bool threads_new_rt_cpu(pthread_t* thread, void* (*start_routine)(void*), void* arg, int cpu, int prio_offset);
bool threads_new_rt_mask(pthread_t *thread, void *(*start_routine) (void*), void *arg, int mask, int prio_offset); bool threads_new_rt_mask(pthread_t* thread, void* (*start_routine)(void*), void* arg, int mask, int prio_offset);
void threads_print_self(); void threads_print_self();
#ifdef __cplusplus #ifdef __cplusplus
} }
#include <string> #include <string>
@ -62,7 +62,7 @@ public:
thread& operator=(thread&&) noexcept = delete; thread& operator=(thread&&) noexcept = delete;
bool start(int prio = -1) { return threads_new_rt_prio(&_thread, thread_function_entry, this, prio); } bool start(int prio = -1) { return threads_new_rt_prio(&_thread, thread_function_entry, this, prio); }
bool start_cpu(int prio, int cpu) { return threads_new_rt_cpu(&_thread, thread_function_entry, this, cpu, prio); } bool start_cpu(int prio, int cpu) { return threads_new_rt_cpu(&_thread, thread_function_entry, this, cpu, prio); }
bool start_cpu_mask(int prio, int mask) bool start_cpu_mask(int prio, int mask)
{ {
return threads_new_rt_mask(&_thread, thread_function_entry, this, mask, prio); return threads_new_rt_mask(&_thread, thread_function_entry, this, mask, prio);
} }
@ -72,12 +72,8 @@ public:
name = name_; name = name_;
pthread_setname_np(pthread_self(), name.c_str()); pthread_setname_np(pthread_self(), name.c_str());
} }
void wait_thread_finish() { void wait_thread_finish() { pthread_join(_thread, NULL); }
pthread_join(_thread, NULL); void thread_cancel() { pthread_cancel(_thread); }
}
void thread_cancel() {
pthread_cancel(_thread);
}
static std::string get_name() static std::string get_name()
{ {
@ -104,56 +100,62 @@ private:
std::string name; std::string name;
}; };
class periodic_thread : public thread class periodic_thread : public thread
{ {
public: public:
periodic_thread(const std::string name_) : thread(name_) {} periodic_thread(const std::string name_) : thread(name_) {}
void start_periodic(int period_us_, int priority = -1) { void start_periodic(int period_us_, int priority = -1)
{
run_enable = true; run_enable = true;
period_us = period_us_; period_us = period_us_;
start(priority); start(priority);
} }
void stop_thread() { void stop_thread()
{
run_enable = false; run_enable = false;
wait_thread_finish(); wait_thread_finish();
} }
protected:
virtual void run_period() = 0; protected:
virtual void run_period() = 0;
private: private:
int wakeups_missed; int wakeups_missed;
int timer_fd; int timer_fd;
int period_us; int period_us;
bool run_enable; bool run_enable;
void run_thread() { void run_thread()
{
if (make_periodic()) { if (make_periodic()) {
return; return;
} }
while(run_enable) { while (run_enable) {
run_period(); run_period();
if (run_enable) { if (run_enable) {
wait_period(); wait_period();
} }
} }
} }
int make_periodic() { int make_periodic()
int ret = -1; {
unsigned int ns; int ret = -1;
unsigned int sec; unsigned int ns;
unsigned int sec;
struct itimerspec itval; struct itimerspec itval;
/* Create the timer */ /* Create the timer */
ret = timerfd_create (CLOCK_MONOTONIC, 0); ret = timerfd_create(CLOCK_MONOTONIC, 0);
wakeups_missed = 0; wakeups_missed = 0;
timer_fd = ret; timer_fd = ret;
if (ret > 0) { if (ret > 0) {
/* Make the timer periodic */ /* Make the timer periodic */
sec = period_us/1e6; sec = period_us / 1e6;
ns = (period_us - (sec * 1000000)) * 1000; ns = (period_us - (sec * 1000000)) * 1000;
itval.it_interval.tv_sec = sec; itval.it_interval.tv_sec = sec;
itval.it_interval.tv_nsec = ns; itval.it_interval.tv_nsec = ns;
itval.it_value.tv_sec = sec; itval.it_value.tv_sec = sec;
itval.it_value.tv_nsec = ns; itval.it_value.tv_nsec = ns;
ret = timerfd_settime (timer_fd, 0, &itval, NULL); ret = timerfd_settime(timer_fd, 0, &itval, NULL);
if (ret < 0) { if (ret < 0) {
perror("timerfd_settime"); perror("timerfd_settime");
} }
@ -162,16 +164,16 @@ private:
} }
return ret; return ret;
} }
void wait_period() { void wait_period()
{
unsigned long long missed; unsigned long long missed;
int ret; int ret;
/* Wait for the next timer event. If we have missed any the /* Wait for the next timer event. If we have missed any the
number is written to "missed" */ number is written to "missed" */
ret = read (timer_fd, &missed, sizeof (missed)); ret = read(timer_fd, &missed, sizeof(missed));
if (ret == -1) if (ret == -1) {
{ perror("read timer");
perror ("read timer");
return; return;
} }
@ -180,7 +182,7 @@ private:
wakeups_missed += (missed - 1); wakeups_missed += (missed - 1);
} }
} }
}; };
#endif // __cplusplus #endif // __cplusplus

@ -29,32 +29,32 @@
#ifndef SRSLTE_TIMEOUT_H #ifndef SRSLTE_TIMEOUT_H
#define SRSLTE_TIMEOUT_H #define SRSLTE_TIMEOUT_H
#include <stdint.h> #include "srslte/srslte.h"
#include <pthread.h> #include <pthread.h>
#include <unistd.h> #include <stdint.h>
#include <sys/time.h> #include <sys/time.h>
#include "srslte/srslte.h" #include <unistd.h>
namespace srslte { namespace srslte {
class timeout_callback class timeout_callback
{ {
public: public:
virtual void timeout_expired(uint32_t timeout_id) = 0; virtual void timeout_expired(uint32_t timeout_id) = 0;
}; };
class timeout class timeout
{ {
public: public:
timeout():running(false),callback(NULL), thread(0), timeout_id(0) {} timeout() : running(false), callback(NULL), thread(0), timeout_id(0) {}
~timeout() ~timeout()
{ {
if(running && callback) if (running && callback)
pthread_join(thread, NULL); pthread_join(thread, NULL);
} }
void start(int duration_msec_, uint32_t timeout_id_=0,timeout_callback *callback_=NULL) void start(int duration_msec_, uint32_t timeout_id_ = 0, timeout_callback* callback_ = NULL)
{ {
if(duration_msec_ < 0) if (duration_msec_ < 0)
return; return;
reset(); reset();
gettimeofday(&start_time[1], NULL); gettimeofday(&start_time[1], NULL);
@ -62,65 +62,63 @@ public:
running = true; running = true;
timeout_id = timeout_id_; timeout_id = timeout_id_;
callback = callback_; callback = callback_;
if(callback) if (callback)
pthread_create(&thread, NULL, &thread_start, this); pthread_create(&thread, NULL, &thread_start, this);
} }
void reset() void reset()
{ {
if(callback) if (callback)
pthread_cancel(thread); pthread_cancel(thread);
running = false; running = false;
} }
static void* thread_start(void *t_) static void* thread_start(void* t_)
{ {
timeout *t = (timeout*)t_; timeout* t = (timeout*)t_;
t->thread_func(); t->thread_func();
return NULL; return NULL;
} }
void thread_func() void thread_func()
{ {
// substract time elapsed until now from timer duration // substract time elapsed until now from timer duration
gettimeofday(&start_time[2], NULL); gettimeofday(&start_time[2], NULL);
get_time_interval(start_time); get_time_interval(start_time);
int32_t usec = duration_msec*1000-start_time[0].tv_usec; int32_t usec = duration_msec * 1000 - start_time[0].tv_usec;
if(usec > 0) if (usec > 0)
usleep(usec); usleep(usec);
if(callback && running) if (callback && running)
callback->timeout_expired(timeout_id); callback->timeout_expired(timeout_id);
} }
bool expired() bool expired()
{ {
if(running) { if (running) {
gettimeofday(&start_time[2], NULL); gettimeofday(&start_time[2], NULL);
get_time_interval(start_time); get_time_interval(start_time);
return start_time[0].tv_usec > duration_msec*1000; return start_time[0].tv_usec > duration_msec * 1000;
} else { } else {
return false; return false;
} }
} }
int32_t get_msec_to_expire() { int32_t get_msec_to_expire()
{
if (running) { if (running) {
gettimeofday(&start_time[2], NULL); gettimeofday(&start_time[2], NULL);
get_time_interval(start_time); get_time_interval(start_time);
return (duration_msec*1000 - start_time[0].tv_usec)/1000; return (duration_msec * 1000 - start_time[0].tv_usec) / 1000;
} }
return 0; return 0;
} }
bool is_running() bool is_running() { return running; }
{
return running;
}
private: private:
struct timeval start_time[3]; struct timeval start_time[3];
pthread_t thread; pthread_t thread;
uint32_t timeout_id; uint32_t timeout_id;
timeout_callback *callback; timeout_callback* callback;
bool running; bool running;
int duration_msec; int duration_msec;
}; };
} // namespace srslte } // namespace srslte
#endif // SRSLTE_TIMEOUT_H #endif // SRSLTE_TIMEOUT_H

@ -34,64 +34,67 @@
#include <vector> #include <vector>
namespace srslte { namespace srslte {
template<class elemType> template <class elemType>
class trace class trace
{ {
public: public:
trace(uint32_t nof_elems_) : tti(nof_elems_), data(nof_elems_)
trace(uint32_t nof_elems_) : tti(nof_elems_), data(nof_elems_) { {
rpm=0; rpm = 0;
nof_elems=nof_elems_; nof_elems = nof_elems_;
wrapped = false; wrapped = false;
}; };
void push_cur_time_us(uint32_t cur_tti) { void push_cur_time_us(uint32_t cur_tti)
struct timeval t; {
gettimeofday(&t, NULL); struct timeval t;
elemType us = t.tv_sec*1e6+t.tv_usec; gettimeofday(&t, NULL);
elemType us = t.tv_sec * 1e6 + t.tv_usec;
push(cur_tti, us); push(cur_tti, us);
} }
void push(uint32_t value_tti, elemType value) { void push(uint32_t value_tti, elemType value)
{
tti[rpm] = value_tti; tti[rpm] = value_tti;
data[rpm] = value; data[rpm] = value;
rpm++; rpm++;
if (rpm >= nof_elems) { if (rpm >= nof_elems) {
rpm = 0; rpm = 0;
wrapped = true; wrapped = true;
} }
} }
bool writeToBinary(std::string filename) { bool writeToBinary(std::string filename)
FILE *f = fopen(filename.c_str(), "w"); {
FILE* f = fopen(filename.c_str(), "w");
if (f != NULL) { if (f != NULL) {
uint32_t st=wrapped?(rpm+1):0; uint32_t st = wrapped ? (rpm + 1) : 0;
do { do {
writeToBinaryValue(f, st++); writeToBinaryValue(f, st++);
if (st >= nof_elems) { if (st >= nof_elems) {
st=0; st = 0;
} }
} while(st!=rpm); } while (st != rpm);
fclose(f); fclose(f);
return true; return true;
} else { } else {
perror("fopen"); perror("fopen");
return false; return false;
} }
} }
private: private:
std::vector<uint32_t> tti; std::vector<uint32_t> tti;
std::vector<elemType> data; std::vector<elemType> data;
uint32_t rpm; uint32_t rpm;
uint32_t nof_elems; uint32_t nof_elems;
bool wrapped; bool wrapped;
void writeToBinaryValue(FILE *f, uint32_t idx) { void writeToBinaryValue(FILE* f, uint32_t idx)
fwrite(&tti[idx], 1, sizeof(uint32_t), f); {
fwrite(&tti[idx], 1, sizeof(uint32_t), f);
fwrite(&data[idx], 1, sizeof(elemType), f); fwrite(&data[idx], 1, sizeof(elemType), f);
} }
}; };
} // namespace srslte } // namespace srslte
#endif // SRSLTE_TRACE_H #endif // SRSLTE_TRACE_H

@ -34,40 +34,39 @@
#include <stdint.h> #include <stdint.h>
namespace srslte { namespace srslte {
class tti_sync class tti_sync
{ {
public: public:
tti_sync(uint32_t modulus_) tti_sync(uint32_t modulus_)
{ {
modulus = modulus_; modulus = modulus_;
increment = 1; increment = 1;
init_counters(0); init_counters(0);
} }
virtual void increase() = 0; virtual void increase() = 0;
virtual void increase(uint32_t cnt) = 0; virtual void increase(uint32_t cnt) = 0;
virtual void resync() = 0; virtual void resync() = 0;
virtual uint32_t wait() = 0; virtual uint32_t wait() = 0;
virtual void set_producer_cntr(uint32_t) = 0; virtual void set_producer_cntr(uint32_t) = 0;
uint32_t get_producer_cntr() { return producer_cntr; } uint32_t get_producer_cntr() { return producer_cntr; }
uint32_t get_consumer_cntr() { return consumer_cntr; } uint32_t get_consumer_cntr() { return consumer_cntr; }
void set_increment(uint32_t increment_) { void set_increment(uint32_t increment_) { increment = increment_; }
increment = increment_;
} protected:
protected: void increase_producer() { producer_cntr = (producer_cntr + increment) % modulus; }
void increase_producer() { producer_cntr = (producer_cntr + increment)%modulus; } void increase_producer(uint32_t cnt) { producer_cntr = cnt % modulus; }
void increase_producer(uint32_t cnt) { producer_cntr = cnt%modulus; } void increase_consumer() { consumer_cntr = (consumer_cntr + increment) % modulus; }
void increase_consumer() { consumer_cntr = (consumer_cntr + increment)%modulus; } bool wait_condition() { return producer_cntr == consumer_cntr; }
bool wait_condition() { return producer_cntr == consumer_cntr; } void init_counters(uint32_t val)
void init_counters(uint32_t val) {
{ consumer_cntr = val;
consumer_cntr = val; producer_cntr = val;
producer_cntr = val; }
} uint32_t increment;
uint32_t increment; uint32_t modulus;
uint32_t modulus; uint32_t producer_cntr;
uint32_t producer_cntr; uint32_t consumer_cntr;
uint32_t consumer_cntr;
}; };
} // namespace srslte } // namespace srslte

@ -28,26 +28,26 @@
#ifndef SRSLTE_TTI_SYNC_CV_H #ifndef SRSLTE_TTI_SYNC_CV_H
#define SRSLTE_TTI_SYNC_CV_H #define SRSLTE_TTI_SYNC_CV_H
#include <pthread.h>
#include "srslte/common/tti_sync.h" #include "srslte/common/tti_sync.h"
#include <pthread.h>
namespace srslte { namespace srslte {
class tti_sync_cv : public tti_sync class tti_sync_cv : public tti_sync
{ {
public: public:
tti_sync_cv(uint32_t modulus = 10240); tti_sync_cv(uint32_t modulus = 10240);
~tti_sync_cv(); ~tti_sync_cv();
void increase(); void increase();
void increase(uint32_t cnt); void increase(uint32_t cnt);
uint32_t wait(); uint32_t wait();
void resync(); void resync();
void set_producer_cntr(uint32_t producer_cntr); void set_producer_cntr(uint32_t producer_cntr);
private: private:
pthread_cond_t cond; pthread_cond_t cond;
pthread_mutex_t mutex; pthread_mutex_t mutex;
}; };
} // namespace srslte } // namespace srslte

@ -24,32 +24,31 @@
// Generic helper definitions for shared library support // Generic helper definitions for shared library support
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__
#define SRSLTE_IMPORT __declspec(dllimport) #define SRSLTE_IMPORT __declspec(dllimport)
#define SRSLTE_EXPORT __declspec(dllexport) #define SRSLTE_EXPORT __declspec(dllexport)
#define SRSLTE_LOCAL #define SRSLTE_LOCAL
#else #else
#if __GNUC__ >= 4 #if __GNUC__ >= 4
#define SRSLTE_IMPORT __attribute__ ((visibility ("default"))) #define SRSLTE_IMPORT __attribute__((visibility("default")))
#define SRSLTE_EXPORT __attribute__ ((visibility ("default"))) #define SRSLTE_EXPORT __attribute__((visibility("default")))
#else #else
#define SRSLTE_IMPORT #define SRSLTE_IMPORT
#define SRSLTE_EXPORT #define SRSLTE_EXPORT
#define SRSLTE_LOCAL #define SRSLTE_LOCAL
#endif #endif
#endif #endif
// Define SRSLTE_API // Define SRSLTE_API
// SRSLTE_API is used for the public API symbols. // SRSLTE_API is used for the public API symbols.
#ifdef SRSLTE_DLL_EXPORTS // defined if we are building the SRSLTE DLL (instead of using it) #ifdef SRSLTE_DLL_EXPORTS // defined if we are building the SRSLTE DLL (instead of using it)
#define SRSLTE_API SRSLTE_EXPORT #define SRSLTE_API SRSLTE_EXPORT
#else #else
#define SRSLTE_API SRSLTE_IMPORT #define SRSLTE_API SRSLTE_IMPORT
#endif #endif
// Useful macros for templates // Useful macros for templates
#define CONCAT(a, b) a##b #define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a,b) #define CONCAT2(a, b) CONCAT(a, b)
#define STRING2(x) #x #define STRING2(x) #x
#define STRING(x) STRING2(x) #define STRING(x) STRING2(x)

@ -51,10 +51,10 @@ public:
virtual void set_tx_freq(const uint32_t& radio_idx, const uint32_t& channel_idx, const double& freq) = 0; virtual void set_tx_freq(const uint32_t& radio_idx, const uint32_t& channel_idx, const double& freq) = 0;
virtual void set_rx_freq(const uint32_t& radio_idx, const uint32_t& channel_idx, const double& freq) = 0; virtual void set_rx_freq(const uint32_t& radio_idx, const uint32_t& channel_idx, const double& freq) = 0;
virtual float set_rx_gain_th(const float& gain) = 0; virtual float set_rx_gain_th(const float& gain) = 0;
virtual void set_rx_gain(const uint32_t& radio_idx, const float& gain) = 0; virtual void set_rx_gain(const uint32_t& radio_idx, const float& gain) = 0;
virtual void set_tx_srate(const uint32_t& radio_idx, const double& srate) = 0; virtual void set_tx_srate(const uint32_t& radio_idx, const double& srate) = 0;
virtual void set_rx_srate(const uint32_t& radio_idx, const double& srate) = 0; virtual void set_rx_srate(const uint32_t& radio_idx, const double& srate) = 0;
// getter // getter
virtual float get_rx_gain(const uint32_t& radio_idx) = 0; virtual float get_rx_gain(const uint32_t& radio_idx) = 0;

@ -82,7 +82,7 @@ public:
virtual bool resync_sqn(uint64_t imsi, uint8_t* auts) = 0; virtual bool resync_sqn(uint64_t imsi, uint8_t* auts) = 0;
}; };
class mme_interface_nas //NAS -> MME class mme_interface_nas // NAS -> MME
{ {
public: public:
virtual bool add_nas_timer(int timer_fd, enum nas_timer_type type, uint64_t imsi) = 0; virtual bool add_nas_timer(int timer_fd, enum nas_timer_type type, uint64_t imsi) = 0;
@ -90,7 +90,7 @@ public:
virtual bool remove_nas_timer(enum nas_timer_type type, uint64_t imsi) = 0; virtual bool remove_nas_timer(enum nas_timer_type type, uint64_t imsi) = 0;
}; };
class s1ap_interface_mme //MME -> S1AP class s1ap_interface_mme // MME -> S1AP
{ {
public: public:
virtual bool expire_nas_timer(enum nas_timer_type type, uint64_t imsi) = 0; virtual bool expire_nas_timer(enum nas_timer_type type, uint64_t imsi) = 0;
@ -111,11 +111,11 @@ public:
std::queue<srslte::byte_buffer_t*>& pkt_queue) = 0; std::queue<srslte::byte_buffer_t*>& pkt_queue) = 0;
}; };
class gtpc_interface_gtpu //GTP-U -> GTP-C class gtpc_interface_gtpu // GTP-U -> GTP-C
{ {
public: public:
virtual bool queue_downlink_packet(uint32_t spgw_ctr_teid, srslte::byte_buffer_t *msg) = 0; virtual bool queue_downlink_packet(uint32_t spgw_ctr_teid, srslte::byte_buffer_t* msg) = 0;
virtual bool send_downlink_data_notification(uint32_t spgw_ctr_teid) = 0; virtual bool send_downlink_data_notification(uint32_t spgw_ctr_teid) = 0;
}; };
} // namespace srsepc } // namespace srsepc

@ -218,25 +218,25 @@ public:
class pdcp_interface_rrc class pdcp_interface_rrc
{ {
public: public:
virtual void reestablish() = 0; virtual void reestablish() = 0;
virtual void reestablish(uint32_t lcid) = 0; virtual void reestablish(uint32_t lcid) = 0;
virtual void reset() = 0; virtual void reset() = 0;
virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking = false) = 0; virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking = false) = 0;
virtual void add_bearer(uint32_t lcid, srslte::pdcp_config_t cnfg) = 0; virtual void add_bearer(uint32_t lcid, srslte::pdcp_config_t cnfg) = 0;
virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0; virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0;
virtual void config_security(uint32_t lcid, virtual void config_security(uint32_t lcid,
uint8_t* k_rrc_enc_, uint8_t* k_rrc_enc_,
uint8_t* k_rrc_int_, uint8_t* k_rrc_int_,
uint8_t* k_up_enc_, uint8_t* k_up_enc_,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo_, srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo_,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0; srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0;
virtual void config_security_all(uint8_t* k_rrc_enc_, virtual void config_security_all(uint8_t* k_rrc_enc_,
uint8_t* k_rrc_int_, uint8_t* k_rrc_int_,
uint8_t* k_up_enc_, uint8_t* k_up_enc_,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo_, srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo_,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0; srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0;
virtual void enable_integrity(uint32_t lcid) = 0; virtual void enable_integrity(uint32_t lcid) = 0;
virtual void enable_encryption(uint32_t lcid) = 0; virtual void enable_encryption(uint32_t lcid) = 0;
}; };
// PDCP interface for RLC // PDCP interface for RLC

@ -31,40 +31,37 @@
#ifndef SRSLTE_AGC_H #ifndef SRSLTE_AGC_H
#define SRSLTE_AGC_H #define SRSLTE_AGC_H
#include <complex.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <complex.h>
#include "srslte/config.h" #include "srslte/config.h"
#define SRSLTE_AGC_DEFAULT_TARGET 0.3 #define SRSLTE_AGC_DEFAULT_TARGET 0.3
#define SRSLTE_AGC_DEFAULT_BW 0.7 #define SRSLTE_AGC_DEFAULT_BW 0.7
typedef enum SRSLTE_API { typedef enum SRSLTE_API { SRSLTE_AGC_MODE_ENERGY = 0, SRSLTE_AGC_MODE_PEAK_AMPLITUDE } srslte_agc_mode_t;
SRSLTE_AGC_MODE_ENERGY = 0,
SRSLTE_AGC_MODE_PEAK_AMPLITUDE
} srslte_agc_mode_t;
typedef struct SRSLTE_API{ typedef struct SRSLTE_API {
float bandwidth; float bandwidth;
float gain; float gain;
float min_gain_db; float min_gain_db;
float max_gain_db; float max_gain_db;
float y_out; float y_out;
bool lock; bool lock;
bool isfirst; bool isfirst;
void* uhd_handler; void* uhd_handler;
float (*set_gain_callback)(void*, float); float (*set_gain_callback)(void*, float);
srslte_agc_mode_t mode; srslte_agc_mode_t mode;
float target; float target;
uint32_t nof_frames; uint32_t nof_frames;
uint32_t frame_cnt; uint32_t frame_cnt;
float *y_tmp; float* y_tmp;
} srslte_agc_t; } srslte_agc_t;
SRSLTE_API int srslte_agc_init(srslte_agc_t *q, srslte_agc_mode_t mode); SRSLTE_API int srslte_agc_init(srslte_agc_t* q, srslte_agc_mode_t mode);
SRSLTE_API int srslte_agc_init_acc(srslte_agc_t *q, srslte_agc_mode_t mode, uint32_t nof_frames); SRSLTE_API int srslte_agc_init_acc(srslte_agc_t* q, srslte_agc_mode_t mode, uint32_t nof_frames);
SRSLTE_API int srslte_agc_init_uhd(srslte_agc_t* q, SRSLTE_API int srslte_agc_init_uhd(srslte_agc_t* q,
srslte_agc_mode_t mode, srslte_agc_mode_t mode,
@ -72,32 +69,26 @@ SRSLTE_API int srslte_agc_init_uhd(srslte_agc_t* q,
float(set_gain_callback)(void*, float), float(set_gain_callback)(void*, float),
void* uhd_handler); void* uhd_handler);
SRSLTE_API void srslte_agc_free(srslte_agc_t *q); SRSLTE_API void srslte_agc_free(srslte_agc_t* q);
SRSLTE_API void srslte_agc_reset(srslte_agc_t *q); SRSLTE_API void srslte_agc_reset(srslte_agc_t* q);
SRSLTE_API void srslte_agc_set_gain_range(srslte_agc_t *q, float min_gain_db, float max_gain_db); SRSLTE_API void srslte_agc_set_gain_range(srslte_agc_t* q, float min_gain_db, float max_gain_db);
SRSLTE_API void srslte_agc_set_bandwidth(srslte_agc_t *q, SRSLTE_API void srslte_agc_set_bandwidth(srslte_agc_t* q, float bandwidth);
float bandwidth);
SRSLTE_API void srslte_agc_set_target(srslte_agc_t *q, SRSLTE_API void srslte_agc_set_target(srslte_agc_t* q, float target);
float target);
SRSLTE_API float srslte_agc_get_rssi(srslte_agc_t *q); SRSLTE_API float srslte_agc_get_rssi(srslte_agc_t* q);
SRSLTE_API float srslte_agc_get_output_level(srslte_agc_t *q); SRSLTE_API float srslte_agc_get_output_level(srslte_agc_t* q);
SRSLTE_API float srslte_agc_get_gain(srslte_agc_t *q); SRSLTE_API float srslte_agc_get_gain(srslte_agc_t* q);
SRSLTE_API void srslte_agc_set_gain(srslte_agc_t *q, SRSLTE_API void srslte_agc_set_gain(srslte_agc_t* q, float init_gain_value_db);
float init_gain_value_db);
SRSLTE_API void srslte_agc_lock(srslte_agc_t *q, SRSLTE_API void srslte_agc_lock(srslte_agc_t* q, bool enable);
bool enable);
SRSLTE_API void srslte_agc_process(srslte_agc_t *q, SRSLTE_API void srslte_agc_process(srslte_agc_t* q, cf_t* signal, uint32_t len);
cf_t *signal,
uint32_t len);
#endif // SRSLTE_AGC_H #endif // SRSLTE_AGC_H

@ -22,8 +22,8 @@
#ifndef SRSLTE_CHEST_COMMON_H #ifndef SRSLTE_CHEST_COMMON_H
#define SRSLTE_CHEST_COMMON_H #define SRSLTE_CHEST_COMMON_H
#include <stdint.h>
#include "srslte/config.h" #include "srslte/config.h"
#include <stdint.h>
#define SRSLTE_CHEST_MAX_SMOOTH_FIL_LEN 64 #define SRSLTE_CHEST_MAX_SMOOTH_FIL_LEN 64
@ -33,8 +33,12 @@ typedef enum SRSLTE_API {
SRSLTE_CHEST_FILTER_NONE SRSLTE_CHEST_FILTER_NONE
} srslte_chest_filter_t; } srslte_chest_filter_t;
SRSLTE_API void srslte_chest_average_pilots( SRSLTE_API void srslte_chest_average_pilots(cf_t* input,
cf_t* input, cf_t* output, float* filter, uint32_t nof_ref, uint32_t nof_symbols, uint32_t filter_len); cf_t* output,
float* filter,
uint32_t nof_ref,
uint32_t nof_symbols,
uint32_t filter_len);
SRSLTE_API uint32_t srslte_chest_set_smooth_filter3_coeff(float* smooth_filter, float w); SRSLTE_API uint32_t srslte_chest_set_smooth_filter3_coeff(float* smooth_filter, float w);

@ -41,9 +41,9 @@
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/phy/ch_estimation/chest_common.h" #include "srslte/phy/ch_estimation/chest_common.h"
#include "srslte/phy/resampling/interp.h"
#include "srslte/phy/ch_estimation/refsignal_dl.h" #include "srslte/phy/ch_estimation/refsignal_dl.h"
#include "srslte/phy/common/phy_common.h" #include "srslte/phy/common/phy_common.h"
#include "srslte/phy/resampling/interp.h"
#include "srslte/phy/sync/pss.h" #include "srslte/phy/sync/pss.h"
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
@ -77,25 +77,25 @@ typedef struct SRSLTE_API {
uint32_t nof_rx_antennas; uint32_t nof_rx_antennas;
srslte_refsignal_t csr_refs; srslte_refsignal_t csr_refs;
srslte_refsignal_t **mbsfn_refs; srslte_refsignal_t** mbsfn_refs;
cf_t *pilot_estimates; cf_t* pilot_estimates;
cf_t *pilot_estimates_average; cf_t* pilot_estimates_average;
cf_t *pilot_recv_signal; cf_t* pilot_recv_signal;
cf_t *tmp_noise; cf_t* tmp_noise;
cf_t *tmp_cfo_estimate; cf_t* tmp_cfo_estimate;
#ifdef FREQ_SEL_SNR #ifdef FREQ_SEL_SNR
float snr_vector[12000]; float snr_vector[12000];
float pilot_power[12000]; float pilot_power[12000];
#endif #endif
srslte_interp_linsrslte_vec_t srslte_interp_linvec; srslte_interp_linsrslte_vec_t srslte_interp_linvec;
srslte_interp_lin_t srslte_interp_lin; srslte_interp_lin_t srslte_interp_lin;
srslte_interp_lin_t srslte_interp_lin_3; srslte_interp_lin_t srslte_interp_lin_3;
srslte_interp_lin_t srslte_interp_lin_mbsfn; srslte_interp_lin_t srslte_interp_lin_mbsfn;
float rssi[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; float rssi[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rsrp[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; float rsrp[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rsrp_corr[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; float rsrp_corr[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float noise_estimate[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; float noise_estimate[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
@ -106,7 +106,7 @@ typedef struct SRSLTE_API {
cf_t pss_signal[SRSLTE_PSS_LEN]; cf_t pss_signal[SRSLTE_PSS_LEN];
cf_t tmp_pss[SRSLTE_PSS_LEN]; cf_t tmp_pss[SRSLTE_PSS_LEN];
cf_t tmp_pss_noisy[SRSLTE_PSS_LEN]; cf_t tmp_pss_noisy[SRSLTE_PSS_LEN];
} srslte_chest_dl_t; } srslte_chest_dl_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {

@ -56,34 +56,32 @@ typedef struct SRSLTE_API {
} srslte_chest_ul_res_t; } srslte_chest_ul_res_t;
typedef struct { typedef struct {
srslte_cell_t cell; srslte_cell_t cell;
srslte_refsignal_ul_t dmrs_signal; srslte_refsignal_ul_t dmrs_signal;
srslte_refsignal_ul_dmrs_pregen_t dmrs_pregen; srslte_refsignal_ul_dmrs_pregen_t dmrs_pregen;
bool dmrs_signal_configured; bool dmrs_signal_configured;
cf_t *pilot_estimates; cf_t* pilot_estimates;
cf_t *pilot_estimates_tmp[4]; cf_t* pilot_estimates_tmp[4];
cf_t *pilot_recv_signal; cf_t* pilot_recv_signal;
cf_t *pilot_known_signal; cf_t* pilot_known_signal;
cf_t *tmp_noise; cf_t* tmp_noise;
#ifdef FREQ_SEL_SNR #ifdef FREQ_SEL_SNR
float snr_vector[12000]; float snr_vector[12000];
float pilot_power[12000]; float pilot_power[12000];
#endif #endif
uint32_t smooth_filter_len; uint32_t smooth_filter_len;
float smooth_filter[SRSLTE_CHEST_MAX_SMOOTH_FIL_LEN]; float smooth_filter[SRSLTE_CHEST_MAX_SMOOTH_FIL_LEN];
srslte_interp_linsrslte_vec_t srslte_interp_linvec; srslte_interp_linsrslte_vec_t srslte_interp_linvec;
} srslte_chest_ul_t; } srslte_chest_ul_t;
SRSLTE_API int srslte_chest_ul_init(srslte_chest_ul_t* q, uint32_t max_prb);
SRSLTE_API int srslte_chest_ul_init(srslte_chest_ul_t *q, SRSLTE_API void srslte_chest_ul_free(srslte_chest_ul_t* q);
uint32_t max_prb);
SRSLTE_API void srslte_chest_ul_free(srslte_chest_ul_t *q);
SRSLTE_API int srslte_chest_ul_res_init(srslte_chest_ul_res_t* q, uint32_t max_prb); SRSLTE_API int srslte_chest_ul_res_init(srslte_chest_ul_res_t* q, uint32_t max_prb);
@ -95,10 +93,16 @@ SRSLTE_API int srslte_chest_ul_set_cell(srslte_chest_ul_t* q, srslte_cell_t cell
SRSLTE_API void srslte_chest_ul_pregen(srslte_chest_ul_t* q, srslte_refsignal_dmrs_pusch_cfg_t* cfg); SRSLTE_API void srslte_chest_ul_pregen(srslte_chest_ul_t* q, srslte_refsignal_dmrs_pusch_cfg_t* cfg);
SRSLTE_API int srslte_chest_ul_estimate_pusch( SRSLTE_API int srslte_chest_ul_estimate_pusch(srslte_chest_ul_t* q,
srslte_chest_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_pusch_cfg_t* cfg, cf_t* input, srslte_chest_ul_res_t* res); srslte_ul_sf_cfg_t* sf,
srslte_pusch_cfg_t* cfg,
SRSLTE_API int srslte_chest_ul_estimate_pucch( cf_t* input,
srslte_chest_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_pucch_cfg_t* cfg, cf_t* input, srslte_chest_ul_res_t* res); srslte_chest_ul_res_t* res);
SRSLTE_API int srslte_chest_ul_estimate_pucch(srslte_chest_ul_t* q,
srslte_ul_sf_cfg_t* sf,
srslte_pucch_cfg_t* cfg,
cf_t* input,
srslte_chest_ul_res_t* res);
#endif // SRSLTE_CHEST_UL_H #endif // SRSLTE_CHEST_UL_H

@ -34,16 +34,14 @@
#include "srslte/phy/common/phy_common.h" #include "srslte/phy/common/phy_common.h"
// Number of references in a subframe: there are 2 symbols for port_id=0,1 x 2 slots x 2 refs per prb // Number of references in a subframe: there are 2 symbols for port_id=0,1 x 2 slots x 2 refs per prb
#define SRSLTE_REFSIGNAL_NUM_SF_MBSFN(nof_prb, port_id) ((2 + 18)*(nof_prb)) #define SRSLTE_REFSIGNAL_NUM_SF_MBSFN(nof_prb, port_id) ((2 + 18) * (nof_prb))
#define SRSLTE_REFSIGNAL_MAX_NUM_SF(nof_prb) (8 * nof_prb) #define SRSLTE_REFSIGNAL_MAX_NUM_SF(nof_prb) (8 * nof_prb)
#define SRSLTE_REFSIGNAL_MAX_NUM_SF_MBSFN(nof_prb) SRSLTE_REFSIGNAL_NUM_SF_MBSFN(nof_prb,0) #define SRSLTE_REFSIGNAL_MAX_NUM_SF_MBSFN(nof_prb) SRSLTE_REFSIGNAL_NUM_SF_MBSFN(nof_prb, 0)
#define SRSLTE_REFSIGNAL_PILOT_IDX(i,l,cell) (2*cell.nof_prb*(l)+(i))
#define SRSLTE_REFSIGNAL_PILOT_IDX_MBSFN(i,l,cell) ((6*cell.nof_prb*(l)+(i)))
#define SRSLTE_REFSIGNAL_PILOT_IDX(i, l, cell) (2 * cell.nof_prb * (l) + (i))
#define SRSLTE_REFSIGNAL_PILOT_IDX_MBSFN(i, l, cell) ((6 * cell.nof_prb * (l) + (i)))
/** Cell-Specific Reference Signal */ /** Cell-Specific Reference Signal */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
@ -53,26 +51,24 @@ typedef struct SRSLTE_API {
uint16_t mbsfn_area_id; uint16_t mbsfn_area_id;
} srslte_refsignal_t; } srslte_refsignal_t;
SRSLTE_API int srslte_refsignal_cs_init(srslte_refsignal_t* q, uint32_t max_prb);
SRSLTE_API int srslte_refsignal_cs_init(srslte_refsignal_t *q, SRSLTE_API int srslte_refsignal_cs_set_cell(srslte_refsignal_t* q, srslte_cell_t cell);
uint32_t max_prb);
SRSLTE_API int srslte_refsignal_cs_set_cell(srslte_refsignal_t * q, SRSLTE_API void srslte_refsignal_free(srslte_refsignal_t* q);
srslte_cell_t cell);
SRSLTE_API void srslte_refsignal_free(srslte_refsignal_t *q);
SRSLTE_API int SRSLTE_API int
srslte_refsignal_cs_put_sf(srslte_refsignal_t* q, srslte_dl_sf_cfg_t* sf, uint32_t port_id, cf_t* sf_symbols); srslte_refsignal_cs_put_sf(srslte_refsignal_t* q, srslte_dl_sf_cfg_t* sf, uint32_t port_id, cf_t* sf_symbols);
SRSLTE_API int srslte_refsignal_cs_get_sf( SRSLTE_API int srslte_refsignal_cs_get_sf(srslte_refsignal_t* q,
srslte_refsignal_t* q, srslte_dl_sf_cfg_t* sf, uint32_t port_id, cf_t* sf_symbols, cf_t* pilots); srslte_dl_sf_cfg_t* sf,
uint32_t port_id,
cf_t* sf_symbols,
cf_t* pilots);
SRSLTE_API uint32_t srslte_refsignal_cs_fidx(srslte_cell_t cell, uint32_t l, uint32_t port_id, uint32_t m); SRSLTE_API uint32_t srslte_refsignal_cs_fidx(srslte_cell_t cell, uint32_t l, uint32_t port_id, uint32_t m);
SRSLTE_API uint32_t srslte_refsignal_cs_nsymbol(uint32_t l, SRSLTE_API uint32_t srslte_refsignal_cs_nsymbol(uint32_t l, srslte_cp_t cp, uint32_t port_id);
srslte_cp_t cp,
uint32_t port_id);
SRSLTE_API uint32_t srslte_refsignal_cs_v(uint32_t port_id, uint32_t ref_symbol_idx); SRSLTE_API uint32_t srslte_refsignal_cs_v(uint32_t port_id, uint32_t ref_symbol_idx);
@ -80,7 +76,7 @@ SRSLTE_API uint32_t srslte_refsignal_cs_nof_symbols(srslte_refsignal_t* q, srslt
SRSLTE_API uint32_t srslte_refsignal_cs_nof_re(srslte_refsignal_t* q, srslte_dl_sf_cfg_t* sf, uint32_t port_id); SRSLTE_API uint32_t srslte_refsignal_cs_nof_re(srslte_refsignal_t* q, srslte_dl_sf_cfg_t* sf, uint32_t port_id);
SRSLTE_API int srslte_refsignal_mbsfn_init(srslte_refsignal_t *q, uint32_t max_prb); SRSLTE_API int srslte_refsignal_mbsfn_init(srslte_refsignal_t* q, uint32_t max_prb);
SRSLTE_API int srslte_refsignal_mbsfn_set_cell(srslte_refsignal_t* q, srslte_cell_t cell, uint16_t mbsfn_area_id); SRSLTE_API int srslte_refsignal_mbsfn_set_cell(srslte_refsignal_t* q, srslte_cell_t cell, uint16_t mbsfn_area_id);
@ -93,14 +89,11 @@ SRSLTE_API uint32_t srslte_refsignal_mbsfn_fidx(uint32_t l);
SRSLTE_API uint32_t srslte_refsignal_mbsfn_nof_symbols(); SRSLTE_API uint32_t srslte_refsignal_mbsfn_nof_symbols();
SRSLTE_API int srslte_refsignal_mbsfn_put_sf(srslte_cell_t cell, SRSLTE_API int srslte_refsignal_mbsfn_put_sf(srslte_cell_t cell,
uint32_t port_id, uint32_t port_id,
cf_t *cs_pilots, cf_t* cs_pilots,
cf_t *mbsfn_pilots, cf_t* mbsfn_pilots,
cf_t *sf_symbols); cf_t* sf_symbols);
SRSLTE_API int srslte_refsignal_mbsfn_gen_seq(srslte_refsignal_t * q,
srslte_cell_t cell,
uint32_t N_mbsfn_id);
SRSLTE_API int srslte_refsignal_mbsfn_gen_seq(srslte_refsignal_t* q, srslte_cell_t cell, uint32_t N_mbsfn_id);
#endif // SRSLTE_REFSIGNAL_DL_H #endif // SRSLTE_REFSIGNAL_DL_H

@ -35,18 +35,18 @@
#include "srslte/phy/phch/pucch_cfg.h" #include "srslte/phy/phch/pucch_cfg.h"
#include "srslte/phy/phch/pusch_cfg.h" #include "srslte/phy/phch/pusch_cfg.h"
#define SRSLTE_NOF_GROUPS_U 30 #define SRSLTE_NOF_GROUPS_U 30
#define SRSLTE_NOF_SEQUENCES_U 2 #define SRSLTE_NOF_SEQUENCES_U 2
#define SRSLTE_NOF_DELTA_SS 30 #define SRSLTE_NOF_DELTA_SS 30
#define SRSLTE_NOF_CSHIFT 8 #define SRSLTE_NOF_CSHIFT 8
#define SRSLTE_REFSIGNAL_UL_L(ns_idx, cp) ((ns_idx+1)*SRSLTE_CP_NSYMB(cp)-4) #define SRSLTE_REFSIGNAL_UL_L(ns_idx, cp) ((ns_idx + 1) * SRSLTE_CP_NSYMB(cp) - 4)
/* PUSCH DMRS common configuration (received in SIB2) */ /* PUSCH DMRS common configuration (received in SIB2) */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t cyclic_shift; uint32_t cyclic_shift;
uint32_t delta_ss; uint32_t delta_ss;
bool group_hopping_en; bool group_hopping_en;
bool sequence_hopping_en; bool sequence_hopping_en;
} srslte_refsignal_dmrs_pusch_cfg_t; } srslte_refsignal_dmrs_pusch_cfg_t;
@ -57,12 +57,12 @@ typedef struct SRSLTE_API {
uint32_t bw_cfg; uint32_t bw_cfg;
bool simul_ack; bool simul_ack;
// Dedicated configuration // Dedicated configuration
uint32_t B; uint32_t B;
uint32_t b_hop; uint32_t b_hop;
uint32_t n_srs; uint32_t n_srs;
uint32_t I_srs; uint32_t I_srs;
uint32_t k_tc; uint32_t k_tc;
uint32_t n_rrc; uint32_t n_rrc;
bool dedicated_enabled; bool dedicated_enabled;
bool common_enabled; bool common_enabled;
@ -75,8 +75,9 @@ typedef struct SRSLTE_API {
float* tmp_arg; float* tmp_arg;
uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB]; uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB];
uint32_t n_prs_pusch[SRSLTE_NOF_DELTA_SS][SRSLTE_NSLOTS_X_FRAME]; // We precompute n_prs needed for cyclic shift alpha at srslte_refsignal_dl_init() uint32_t n_prs_pusch[SRSLTE_NOF_DELTA_SS][SRSLTE_NSLOTS_X_FRAME]; // We precompute n_prs needed for cyclic shift alpha
// at srslte_refsignal_dl_init()
uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME]; uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME];
uint32_t u_pucch[SRSLTE_NSLOTS_X_FRAME]; uint32_t u_pucch[SRSLTE_NSLOTS_X_FRAME];
uint32_t v_pusch[SRSLTE_NSLOTS_X_FRAME][SRSLTE_NOF_DELTA_SS]; uint32_t v_pusch[SRSLTE_NSLOTS_X_FRAME][SRSLTE_NOF_DELTA_SS];
@ -90,13 +91,11 @@ typedef struct {
cf_t* r[SRSLTE_NOF_SF_X_FRAME]; cf_t* r[SRSLTE_NOF_SF_X_FRAME];
} srslte_refsignal_srs_pregen_t; } srslte_refsignal_srs_pregen_t;
SRSLTE_API int srslte_refsignal_ul_init(srslte_refsignal_ul_t *q, SRSLTE_API int srslte_refsignal_ul_init(srslte_refsignal_ul_t* q, uint32_t max_prb);
uint32_t max_prb);
SRSLTE_API int srslte_refsignal_ul_set_cell(srslte_refsignal_ul_t *q, SRSLTE_API int srslte_refsignal_ul_set_cell(srslte_refsignal_ul_t* q, srslte_cell_t cell);
srslte_cell_t cell);
SRSLTE_API void srslte_refsignal_ul_free(srslte_refsignal_ul_t *q); SRSLTE_API void srslte_refsignal_ul_free(srslte_refsignal_ul_t* q);
SRSLTE_API void srslte_refsignal_r_uv_arg_1prb(float* arg, uint32_t u); SRSLTE_API void srslte_refsignal_r_uv_arg_1prb(float* arg, uint32_t u);
@ -166,8 +165,11 @@ SRSLTE_API int srslte_refsignal_srs_gen(srslte_refsignal_ul_t* q,
uint32_t sf_idx, uint32_t sf_idx,
cf_t* r_srs); cf_t* r_srs);
SRSLTE_API int srslte_refsignal_srs_put( SRSLTE_API int srslte_refsignal_srs_put(srslte_refsignal_ul_t* q,
srslte_refsignal_ul_t* q, srslte_refsignal_srs_cfg_t* cfg, uint32_t tti, cf_t* r_srs, cf_t* sf_symbols); srslte_refsignal_srs_cfg_t* cfg,
uint32_t tti,
cf_t* r_srs,
cf_t* sf_symbols);
SRSLTE_API void srslte_refsignal_srs_pusch_shortened(srslte_refsignal_ul_t* q, SRSLTE_API void srslte_refsignal_srs_pusch_shortened(srslte_refsignal_ul_t* q,
srslte_ul_sf_cfg_t* sf, srslte_ul_sf_cfg_t* sf,

@ -35,18 +35,10 @@
#ifndef SRSLTE_CH_AWGN_H #ifndef SRSLTE_CH_AWGN_H
#define SRSLTE_CH_AWGN_H #define SRSLTE_CH_AWGN_H
SRSLTE_API void srslte_ch_awgn_c(const cf_t* input, SRSLTE_API void srslte_ch_awgn_c(const cf_t* input, cf_t* output, float variance, uint32_t len);
cf_t* output,
float variance,
uint32_t len);
SRSLTE_API void srslte_ch_awgn_f(const float* x, SRSLTE_API void srslte_ch_awgn_f(const float* x, float* y, float variance, uint32_t len);
float* y,
float variance,
uint32_t len);
SRSLTE_API float srslte_ch_awgn_get_variance(float ebno_db,
float rate);
SRSLTE_API float srslte_ch_awgn_get_variance(float ebno_db, float rate);
#endif // SRSLTE_CH_AWGN_H #endif // SRSLTE_CH_AWGN_H

@ -53,8 +53,11 @@ SRSLTE_API void srslte_channel_delay_update_srate(srslte_channel_delay_t* q, uin
SRSLTE_API void srslte_channel_delay_free(srslte_channel_delay_t* q); SRSLTE_API void srslte_channel_delay_free(srslte_channel_delay_t* q);
SRSLTE_API void srslte_channel_delay_execute( SRSLTE_API void srslte_channel_delay_execute(srslte_channel_delay_t* q,
srslte_channel_delay_t* q, const cf_t* in, cf_t* out, uint32_t len, const srslte_timestamp_t* ts); const cf_t* in,
cf_t* out,
uint32_t len,
const srslte_timestamp_t* ts);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -66,8 +66,11 @@ SRSLTE_API int srslte_channel_fading_init(srslte_channel_fading_t* q, double sra
SRSLTE_API void srslte_channel_fading_free(srslte_channel_fading_t* q); SRSLTE_API void srslte_channel_fading_free(srslte_channel_fading_t* q);
SRSLTE_API double srslte_channel_fading_execute( SRSLTE_API double srslte_channel_fading_execute(srslte_channel_fading_t* q,
srslte_channel_fading_t* q, const cf_t* in, cf_t* out, uint32_t nof_samples, double init_time); const cf_t* in,
cf_t* out,
uint32_t nof_samples,
double init_time);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -35,8 +35,11 @@ extern "C" {
SRSLTE_API void srslte_channel_rlf_init(srslte_channel_rlf_t* q, uint32_t t_on_ms, uint32_t t_off_ms); SRSLTE_API void srslte_channel_rlf_init(srslte_channel_rlf_t* q, uint32_t t_on_ms, uint32_t t_off_ms);
SRSLTE_API void srslte_channel_rlf_execute( SRSLTE_API void srslte_channel_rlf_execute(srslte_channel_rlf_t* q,
srslte_channel_rlf_t* q, const cf_t* in, cf_t* out, uint32_t nsamples, const srslte_timestamp_t* ts); const cf_t* in,
cf_t* out,
uint32_t nsamples,
const srslte_timestamp_t* ts);
SRSLTE_API void srslte_channel_rlf_free(srslte_channel_rlf_t* q); SRSLTE_API void srslte_channel_rlf_free(srslte_channel_rlf_t* q);

@ -30,10 +30,10 @@
#ifndef SRSLTE_PHY_COMMON_H #ifndef SRSLTE_PHY_COMMON_H
#define SRSLTE_PHY_COMMON_H #define SRSLTE_PHY_COMMON_H
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h> #include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "srslte/config.h" #include "srslte/config.h"
@ -41,39 +41,39 @@
#define SRSLTE_NOF_SLOTS_PER_SF 2 #define SRSLTE_NOF_SLOTS_PER_SF 2
#define SRSLTE_NSLOTS_X_FRAME (SRSLTE_NOF_SLOTS_PER_SF * SRSLTE_NOF_SF_X_FRAME) #define SRSLTE_NSLOTS_X_FRAME (SRSLTE_NOF_SLOTS_PER_SF * SRSLTE_NOF_SF_X_FRAME)
#define SRSLTE_NSOFT_BITS 250368 // Soft buffer size for Category 1 UE #define SRSLTE_NSOFT_BITS 250368 // Soft buffer size for Category 1 UE
#define SRSLTE_PC_MAX 23 // Maximum TX power for Category 1 UE (in dBm) #define SRSLTE_PC_MAX 23 // Maximum TX power for Category 1 UE (in dBm)
#define SRSLTE_MAX_RADIOS 3 // Maximum number of supported RF devices #define SRSLTE_MAX_RADIOS 3 // Maximum number of supported RF devices
#define SRSLTE_MAX_CARRIERS 5 // Maximum number of supported simultaneous carriers #define SRSLTE_MAX_CARRIERS 5 // Maximum number of supported simultaneous carriers
#define SRSLTE_MAX_PORTS 4 #define SRSLTE_MAX_PORTS 4
#define SRSLTE_MAX_LAYERS 4 #define SRSLTE_MAX_LAYERS 4
#define SRSLTE_MAX_CODEWORDS 2 #define SRSLTE_MAX_CODEWORDS 2
#define SRSLTE_MAX_TB SRSLTE_MAX_CODEWORDS #define SRSLTE_MAX_TB SRSLTE_MAX_CODEWORDS
#define SRSLTE_MAX_CODEBLOCKS 32 #define SRSLTE_MAX_CODEBLOCKS 32
#define SRSLTE_MAX_CODEBOOKS 4 #define SRSLTE_MAX_CODEBOOKS 4
#define SRSLTE_LTE_CRC24A 0x1864CFB #define SRSLTE_LTE_CRC24A 0x1864CFB
#define SRSLTE_LTE_CRC24B 0X1800063 #define SRSLTE_LTE_CRC24B 0X1800063
#define SRSLTE_LTE_CRC16 0x11021 #define SRSLTE_LTE_CRC16 0x11021
#define SRSLTE_LTE_CRC8 0x19B #define SRSLTE_LTE_CRC8 0x19B
#define SRSLTE_MAX_MBSFN_AREA_IDS 256 #define SRSLTE_MAX_MBSFN_AREA_IDS 256
#define SRSLTE_PMCH_RV 0 #define SRSLTE_PMCH_RV 0
typedef enum { SRSLTE_CP_NORM = 0, SRSLTE_CP_EXT } srslte_cp_t; typedef enum { SRSLTE_CP_NORM = 0, SRSLTE_CP_EXT } srslte_cp_t;
typedef enum { SRSLTE_SF_NORM = 0, SRSLTE_SF_MBSFN } srslte_sf_t; typedef enum { SRSLTE_SF_NORM = 0, SRSLTE_SF_MBSFN } srslte_sf_t;
#define SRSLTE_CRNTI_START 0x000B #define SRSLTE_CRNTI_START 0x000B
#define SRSLTE_CRNTI_END 0xFFF3 #define SRSLTE_CRNTI_END 0xFFF3
#define SRSLTE_RARNTI_START 0x0001 #define SRSLTE_RARNTI_START 0x0001
#define SRSLTE_RARNTI_END 0x000A #define SRSLTE_RARNTI_END 0x000A
#define SRSLTE_SIRNTI 0xFFFF #define SRSLTE_SIRNTI 0xFFFF
#define SRSLTE_PRNTI 0xFFFE #define SRSLTE_PRNTI 0xFFFE
#define SRSLTE_MRNTI 0xFFFD #define SRSLTE_MRNTI 0xFFFD
#define SRSLTE_RNTI_ISRAR(rnti) (rnti >= SRSLTE_RARNTI_START && rnti <= SRSLTE_RARNTI_END) #define SRSLTE_RNTI_ISRAR(rnti) (rnti >= SRSLTE_RARNTI_START && rnti <= SRSLTE_RARNTI_END)
#define SRSLTE_RNTI_ISUSER(rnti) (rnti >= SRSLTE_CRNTI_START && rnti <= SRSLTE_CRNTI_END) #define SRSLTE_RNTI_ISUSER(rnti) (rnti >= SRSLTE_CRNTI_START && rnti <= SRSLTE_CRNTI_END)
@ -84,30 +84,31 @@ typedef enum { SRSLTE_SF_NORM = 0, SRSLTE_SF_MBSFN } srslte_sf_t;
#define SRSLTE_CELL_ID_UNKNOWN 1000 #define SRSLTE_CELL_ID_UNKNOWN 1000
#define SRSLTE_MAX_NSYMB 7 #define SRSLTE_MAX_NSYMB 7
#define SRSLTE_MAX_PRB 110 #define SRSLTE_MAX_PRB 110
#define SRSLTE_NRE 12 #define SRSLTE_NRE 12
#define SRSLTE_SYMBOL_SZ_MAX 2048 #define SRSLTE_SYMBOL_SZ_MAX 2048
#define SRSLTE_CP_NORM_NSYMB 7 #define SRSLTE_CP_NORM_NSYMB 7
#define SRSLTE_CP_NORM_SF_NSYMB (2*SRSLTE_CP_NORM_NSYMB) #define SRSLTE_CP_NORM_SF_NSYMB (2 * SRSLTE_CP_NORM_NSYMB)
#define SRSLTE_CP_NORM_0_LEN 160 #define SRSLTE_CP_NORM_0_LEN 160
#define SRSLTE_CP_NORM_LEN 144 #define SRSLTE_CP_NORM_LEN 144
#define SRSLTE_CP_EXT_NSYMB 6 #define SRSLTE_CP_EXT_NSYMB 6
#define SRSLTE_CP_EXT_SF_NSYMB (2*SRSLTE_CP_EXT_NSYMB) #define SRSLTE_CP_EXT_SF_NSYMB (2 * SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_CP_EXT_LEN 512 #define SRSLTE_CP_EXT_LEN 512
#define SRSLTE_CP_EXT_7_5_LEN 1024 #define SRSLTE_CP_EXT_7_5_LEN 1024
#define SRSLTE_CP_ISNORM(cp) (cp==SRSLTE_CP_NORM) #define SRSLTE_CP_ISNORM(cp) (cp == SRSLTE_CP_NORM)
#define SRSLTE_CP_ISEXT(cp) (cp==SRSLTE_CP_EXT) #define SRSLTE_CP_ISEXT(cp) (cp == SRSLTE_CP_EXT)
#define SRSLTE_CP_NSYMB(cp) (SRSLTE_CP_ISNORM(cp)?SRSLTE_CP_NORM_NSYMB:SRSLTE_CP_EXT_NSYMB) #define SRSLTE_CP_NSYMB(cp) (SRSLTE_CP_ISNORM(cp) ? SRSLTE_CP_NORM_NSYMB : SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_CP_LEN(symbol_sz, c) ((int) ceilf((((float) (c)*(symbol_sz))/2048.0f))) #define SRSLTE_CP_LEN(symbol_sz, c) ((int)ceilf((((float)(c) * (symbol_sz)) / 2048.0f)))
#define SRSLTE_CP_LEN_NORM(symbol, symbol_sz) (((symbol)==0)?SRSLTE_CP_LEN((symbol_sz),SRSLTE_CP_NORM_0_LEN):SRSLTE_CP_LEN((symbol_sz),SRSLTE_CP_NORM_LEN)) #define SRSLTE_CP_LEN_NORM(symbol, symbol_sz) \
#define SRSLTE_CP_LEN_EXT(symbol_sz) (SRSLTE_CP_LEN((symbol_sz),SRSLTE_CP_EXT_LEN)) (((symbol) == 0) ? SRSLTE_CP_LEN((symbol_sz), SRSLTE_CP_NORM_0_LEN) : SRSLTE_CP_LEN((symbol_sz), SRSLTE_CP_NORM_LEN))
#define SRSLTE_CP_LEN_EXT(symbol_sz) (SRSLTE_CP_LEN((symbol_sz), SRSLTE_CP_EXT_LEN))
#define SRSLTE_CP_SZ(symbol_sz, cp) \ #define SRSLTE_CP_SZ(symbol_sz, cp) \
(SRSLTE_CP_LEN(symbol_sz, (SRSLTE_CP_ISNORM(cp) ? SRSLTE_CP_NORM_LEN : SRSLTE_CP_EXT_LEN))) (SRSLTE_CP_LEN(symbol_sz, (SRSLTE_CP_ISNORM(cp) ? SRSLTE_CP_NORM_LEN : SRSLTE_CP_EXT_LEN)))
@ -116,52 +117,52 @@ typedef enum { SRSLTE_SF_NORM = 0, SRSLTE_SF_MBSFN } srslte_sf_t;
#define SRSLTE_SF_LEN(symbol_sz) (symbol_sz * 15) #define SRSLTE_SF_LEN(symbol_sz) (symbol_sz * 15)
#define SRSLTE_SF_LEN_MAX (SRSLTE_SF_LEN(SRSLTE_SYMBOL_SZ_MAX)) #define SRSLTE_SF_LEN_MAX (SRSLTE_SF_LEN(SRSLTE_SYMBOL_SZ_MAX))
#define SRSLTE_SLOT_LEN_PRB(nof_prb) (SRSLTE_SLOT_LEN(srslte_symbol_sz(nof_prb))) #define SRSLTE_SLOT_LEN_PRB(nof_prb) (SRSLTE_SLOT_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SF_LEN_PRB(nof_prb) (SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb))) #define SRSLTE_SF_LEN_PRB(nof_prb) (SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SLOT_LEN_RE(nof_prb, cp) (nof_prb*SRSLTE_NRE*SRSLTE_CP_NSYMB(cp)) #define SRSLTE_SLOT_LEN_RE(nof_prb, cp) (nof_prb * SRSLTE_NRE * SRSLTE_CP_NSYMB(cp))
#define SRSLTE_SF_LEN_RE(nof_prb, cp) (2*SRSLTE_SLOT_LEN_RE(nof_prb, cp)) #define SRSLTE_SF_LEN_RE(nof_prb, cp) (2 * SRSLTE_SLOT_LEN_RE(nof_prb, cp))
#define SRSLTE_NOF_RE(cell) (2 * SRSLTE_SLOT_LEN_RE(cell.nof_prb, cell.cp)) #define SRSLTE_NOF_RE(cell) (2 * SRSLTE_SLOT_LEN_RE(cell.nof_prb, cell.cp))
#define SRSLTE_TA_OFFSET (10e-6) #define SRSLTE_TA_OFFSET (10e-6)
#define SRSLTE_LTE_TS 1.0/(15000.0*2048) #define SRSLTE_LTE_TS 1.0 / (15000.0 * 2048)
#define SRSLTE_SLOT_IDX_CPNORM(symbol_idx, symbol_sz) (symbol_idx==0?0:(symbol_sz + SRSLTE_CP_LEN(symbol_sz, SRSLTE_CP_NORM_0_LEN) + \ #define SRSLTE_SLOT_IDX_CPNORM(symbol_idx, symbol_sz) \
(symbol_idx-1)*(symbol_sz+SRSLTE_CP_LEN(symbol_sz, SRSLTE_CP_NORM_LEN)))) (symbol_idx == 0 ? 0 \
#define SRSLTE_SLOT_IDX_CPEXT(idx, symbol_sz) (idx*(symbol_sz+SRSLTE_CP(symbol_sz, SRSLTE_CP_EXT_LEN))) : (symbol_sz + SRSLTE_CP_LEN(symbol_sz, SRSLTE_CP_NORM_0_LEN) + \
(symbol_idx - 1) * (symbol_sz + SRSLTE_CP_LEN(symbol_sz, SRSLTE_CP_NORM_LEN))))
#define SRSLTE_SLOT_IDX_CPEXT(idx, symbol_sz) (idx * (symbol_sz + SRSLTE_CP(symbol_sz, SRSLTE_CP_EXT_LEN)))
#define SRSLTE_RE_IDX(nof_prb, symbol_idx, sample_idx) ((symbol_idx)*(nof_prb)*(SRSLTE_NRE) + sample_idx) #define SRSLTE_RE_IDX(nof_prb, symbol_idx, sample_idx) ((symbol_idx) * (nof_prb) * (SRSLTE_NRE) + sample_idx)
#define SRSLTE_RS_VSHIFT(cell_id) (cell_id%6) #define SRSLTE_RS_VSHIFT(cell_id) (cell_id % 6)
#define SRSLTE_GUARD_RE(nof_prb) ((srslte_symbol_sz(nof_prb)-nof_prb*SRSLTE_NRE)/2) #define SRSLTE_GUARD_RE(nof_prb) ((srslte_symbol_sz(nof_prb) - nof_prb * SRSLTE_NRE) / 2)
#define SRSLTE_SYMBOL_HAS_REF(l, cp, nof_ports) ((l == 1 && nof_ports == 4) \ #define SRSLTE_SYMBOL_HAS_REF(l, cp, nof_ports) ((l == 1 && nof_ports == 4) || l == 0 || l == SRSLTE_CP_NSYMB(cp) - 3)
|| l == 0 \
|| l == SRSLTE_CP_NSYMB(cp) - 3)
#define SRSLTE_NOF_CTRL_SYMBOLS(cell, cfi) (cfi + (cell.nof_prb < 10 ? 1 : 0)) #define SRSLTE_NOF_CTRL_SYMBOLS(cell, cfi) (cfi + (cell.nof_prb < 10 ? 1 : 0))
#define SRSLTE_SYMBOL_HAS_REF_MBSFN(l, s) ((l == 2 && s == 0) || (l == 0 && s == 1) || (l == 4 && s == 1)) #define SRSLTE_SYMBOL_HAS_REF_MBSFN(l, s) ((l == 2 && s == 0) || (l == 0 && s == 1) || (l == 4 && s == 1))
#define SRSLTE_NON_MBSFN_REGION_GUARD_LENGTH(non_mbsfn_region,symbol_sz) ((non_mbsfn_region == 1)?(SRSLTE_CP_LEN_EXT(symbol_sz) - SRSLTE_CP_LEN_NORM(0, symbol_sz)):(2*SRSLTE_CP_LEN_EXT(symbol_sz) - SRSLTE_CP_LEN_NORM(0, symbol_sz)- SRSLTE_CP_LEN_NORM(1, symbol_sz))) #define SRSLTE_NON_MBSFN_REGION_GUARD_LENGTH(non_mbsfn_region, symbol_sz) \
((non_mbsfn_region == 1) \
? (SRSLTE_CP_LEN_EXT(symbol_sz) - SRSLTE_CP_LEN_NORM(0, symbol_sz)) \
: (2 * SRSLTE_CP_LEN_EXT(symbol_sz) - SRSLTE_CP_LEN_NORM(0, symbol_sz) - SRSLTE_CP_LEN_NORM(1, symbol_sz)))
#define SRSLTE_FDD_NOF_HARQ (TX_DELAY + FDD_HARQ_DELAY_MS) #define SRSLTE_FDD_NOF_HARQ (TX_DELAY + FDD_HARQ_DELAY_MS)
#define SRSLTE_MAX_HARQ_PROC 15 #define SRSLTE_MAX_HARQ_PROC 15
#define SRSLTE_NOF_LTE_BANDS 58 #define SRSLTE_NOF_LTE_BANDS 58
#define SRSLTE_DEFAULT_MAX_FRAMES_PBCH 500 #define SRSLTE_DEFAULT_MAX_FRAMES_PBCH 500
#define SRSLTE_DEFAULT_MAX_FRAMES_PSS 10 #define SRSLTE_DEFAULT_MAX_FRAMES_PSS 10
#define SRSLTE_DEFAULT_NOF_VALID_PSS_FRAMES 10 #define SRSLTE_DEFAULT_NOF_VALID_PSS_FRAMES 10
#define ZERO_OBJECT(x) memset(&(x), 0x0, sizeof((x))) #define ZERO_OBJECT(x) memset(&(x), 0x0, sizeof((x)))
typedef enum SRSLTE_API { typedef enum SRSLTE_API { SRSLTE_PHICH_NORM = 0, SRSLTE_PHICH_EXT } srslte_phich_length_t;
SRSLTE_PHICH_NORM = 0,
SRSLTE_PHICH_EXT
} srslte_phich_length_t;
typedef enum SRSLTE_API { typedef enum SRSLTE_API {
SRSLTE_PHICH_R_1_6 = 0, SRSLTE_PHICH_R_1_6 = 0,
@ -278,12 +279,12 @@ typedef struct SRSLTE_API {
} srslte_earfcn_t; } srslte_earfcn_t;
enum band_geographical_area { enum band_geographical_area {
SRSLTE_BAND_GEO_AREA_ALL, SRSLTE_BAND_GEO_AREA_ALL,
SRSLTE_BAND_GEO_AREA_NAR, SRSLTE_BAND_GEO_AREA_NAR,
SRSLTE_BAND_GEO_AREA_APAC, SRSLTE_BAND_GEO_AREA_APAC,
SRSLTE_BAND_GEO_AREA_EMEA, SRSLTE_BAND_GEO_AREA_EMEA,
SRSLTE_BAND_GEO_AREA_JAPAN, SRSLTE_BAND_GEO_AREA_JAPAN,
SRSLTE_BAND_GEO_AREA_CALA, SRSLTE_BAND_GEO_AREA_CALA,
SRSLTE_BAND_GEO_AREA_NA SRSLTE_BAND_GEO_AREA_NA
}; };
@ -328,11 +329,9 @@ typedef struct SRSLTE_API {
#define SRSLTE_NBIOT_NPBCH_NOF_BITS_SF \ #define SRSLTE_NBIOT_NPBCH_NOF_BITS_SF \
(SRSLTE_NBIOT_NPBCH_NOF_TOTAL_BITS / 8) ///< The NPBCH is transmitted in 8 blocks (See 36.211 Sec 10.2.4.4) (SRSLTE_NBIOT_NPBCH_NOF_TOTAL_BITS / 8) ///< The NPBCH is transmitted in 8 blocks (See 36.211 Sec 10.2.4.4)
SRSLTE_API bool srslte_cell_isvalid(srslte_cell_t *cell); SRSLTE_API bool srslte_cell_isvalid(srslte_cell_t* cell);
SRSLTE_API void srslte_cell_fprint(FILE *stream, SRSLTE_API void srslte_cell_fprint(FILE* stream, srslte_cell_t* cell, uint32_t sfn);
srslte_cell_t *cell,
uint32_t sfn);
SRSLTE_API bool srslte_cellid_isvalid(uint32_t cell_id); SRSLTE_API bool srslte_cellid_isvalid(uint32_t cell_id);
@ -358,43 +357,35 @@ SRSLTE_API bool srslte_N_id_2_isvalid(uint32_t N_id_2);
SRSLTE_API bool srslte_N_id_1_isvalid(uint32_t N_id_1); SRSLTE_API bool srslte_N_id_1_isvalid(uint32_t N_id_1);
SRSLTE_API bool srslte_symbol_sz_isvalid(uint32_t symbol_sz); SRSLTE_API bool srslte_symbol_sz_isvalid(uint32_t symbol_sz);
SRSLTE_API int srslte_symbol_sz(uint32_t nof_prb); SRSLTE_API int srslte_symbol_sz(uint32_t nof_prb);
SRSLTE_API int srslte_symbol_sz_power2(uint32_t nof_prb); SRSLTE_API int srslte_symbol_sz_power2(uint32_t nof_prb);
SRSLTE_API int srslte_nof_prb(uint32_t symbol_sz); SRSLTE_API int srslte_nof_prb(uint32_t symbol_sz);
SRSLTE_API int srslte_sampling_freq_hz(uint32_t nof_prb); SRSLTE_API int srslte_sampling_freq_hz(uint32_t nof_prb);
SRSLTE_API void srslte_use_standard_symbol_size(bool enabled); SRSLTE_API void srslte_use_standard_symbol_size(bool enabled);
SRSLTE_API uint32_t srslte_re_x_prb(uint32_t ns, SRSLTE_API uint32_t srslte_re_x_prb(uint32_t ns, uint32_t symbol, uint32_t nof_ports, uint32_t nof_symbols);
uint32_t symbol,
uint32_t nof_ports,
uint32_t nof_symbols);
SRSLTE_API uint32_t srslte_voffset(uint32_t symbol_id, SRSLTE_API uint32_t srslte_voffset(uint32_t symbol_id, uint32_t cell_id, uint32_t nof_ports);
uint32_t cell_id,
uint32_t nof_ports);
SRSLTE_API int srslte_group_hopping_f_gh(uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME], SRSLTE_API int srslte_group_hopping_f_gh(uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME], uint32_t cell_id);
uint32_t cell_id);
SRSLTE_API uint32_t srslte_N_ta_new_rar(uint32_t ta); SRSLTE_API uint32_t srslte_N_ta_new_rar(uint32_t ta);
SRSLTE_API uint32_t srslte_N_ta_new(uint32_t N_ta_old, SRSLTE_API uint32_t srslte_N_ta_new(uint32_t N_ta_old, uint32_t ta);
uint32_t ta);
SRSLTE_API float srslte_coderate(uint32_t tbs, SRSLTE_API float srslte_coderate(uint32_t tbs, uint32_t nof_re);
uint32_t nof_re);
SRSLTE_API char *srslte_cp_string(srslte_cp_t cp); SRSLTE_API char* srslte_cp_string(srslte_cp_t cp);
SRSLTE_API srslte_mod_t srslte_str2mod (char * mod_str); SRSLTE_API srslte_mod_t srslte_str2mod(char* mod_str);
SRSLTE_API char *srslte_mod_string(srslte_mod_t mod); SRSLTE_API char* srslte_mod_string(srslte_mod_t mod);
SRSLTE_API uint32_t srslte_mod_bits_x_symbol(srslte_mod_t mod); SRSLTE_API uint32_t srslte_mod_bits_x_symbol(srslte_mod_t mod);
@ -406,21 +397,15 @@ SRSLTE_API float srslte_band_fd(uint32_t dl_earfcn);
SRSLTE_API float srslte_band_fu(uint32_t ul_earfcn); SRSLTE_API float srslte_band_fu(uint32_t ul_earfcn);
SRSLTE_API uint32_t srslte_band_ul_earfcn(uint32_t dl_earfcn); SRSLTE_API uint32_t srslte_band_ul_earfcn(uint32_t dl_earfcn);
SRSLTE_API int srslte_band_get_fd_band(uint32_t band, SRSLTE_API int
srslte_earfcn_t *earfcn, srslte_band_get_fd_band(uint32_t band, srslte_earfcn_t* earfcn, int earfcn_start, int earfcn_end, uint32_t max_elems);
int earfcn_start,
int earfcn_end,
uint32_t max_elems);
SRSLTE_API int srslte_band_get_fd_band_all(uint32_t band, SRSLTE_API int srslte_band_get_fd_band_all(uint32_t band, srslte_earfcn_t* earfcn, uint32_t max_nelems);
srslte_earfcn_t *earfcn,
uint32_t max_nelems);
SRSLTE_API int srslte_band_get_fd_region(enum band_geographical_area region, SRSLTE_API int
srslte_earfcn_t *earfcn, srslte_band_get_fd_region(enum band_geographical_area region, srslte_earfcn_t* earfcn, uint32_t max_elems);
uint32_t max_elems);
SRSLTE_API int srslte_str2mimotype(char* mimo_type_str, srslte_tx_scheme_t* type); SRSLTE_API int srslte_str2mimotype(char* mimo_type_str, srslte_tx_scheme_t* type);

@ -35,66 +35,40 @@
#include "srslte/phy/common/phy_common.h" #include "srslte/phy/common/phy_common.h"
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint8_t *c; uint8_t* c;
uint8_t *c_bytes; uint8_t* c_bytes;
float *c_float; float* c_float;
short *c_short; short* c_short;
int8_t *c_char; int8_t* c_char;
uint32_t cur_len; uint32_t cur_len;
uint32_t max_len; uint32_t max_len;
} srslte_sequence_t; } srslte_sequence_t;
SRSLTE_API int srslte_sequence_init(srslte_sequence_t *q, uint32_t len); SRSLTE_API int srslte_sequence_init(srslte_sequence_t* q, uint32_t len);
SRSLTE_API void srslte_sequence_free(srslte_sequence_t *q); SRSLTE_API void srslte_sequence_free(srslte_sequence_t* q);
SRSLTE_API int srslte_sequence_LTE_pr(srslte_sequence_t *q, SRSLTE_API int srslte_sequence_LTE_pr(srslte_sequence_t* q, uint32_t len, uint32_t seed);
uint32_t len,
uint32_t seed); SRSLTE_API int srslte_sequence_set_LTE_pr(srslte_sequence_t* q, uint32_t len, uint32_t seed);
SRSLTE_API int srslte_sequence_set_LTE_pr(srslte_sequence_t *q, SRSLTE_API int srslte_sequence_pbch(srslte_sequence_t* seq, srslte_cp_t cp, uint32_t cell_id);
uint32_t len,
uint32_t seed); SRSLTE_API int srslte_sequence_pcfich(srslte_sequence_t* seq, uint32_t nslot, uint32_t cell_id);
SRSLTE_API int srslte_sequence_pbch(srslte_sequence_t *seq, SRSLTE_API int srslte_sequence_phich(srslte_sequence_t* seq, uint32_t nslot, uint32_t cell_id);
srslte_cp_t cp,
uint32_t cell_id); SRSLTE_API int srslte_sequence_pdcch(srslte_sequence_t* seq, uint32_t nslot, uint32_t cell_id, uint32_t len);
SRSLTE_API int srslte_sequence_pcfich(srslte_sequence_t *seq, SRSLTE_API int
uint32_t nslot, srslte_sequence_pdsch(srslte_sequence_t* seq, uint16_t rnti, int q, uint32_t nslot, uint32_t cell_id, uint32_t len);
uint32_t cell_id);
SRSLTE_API int
SRSLTE_API int srslte_sequence_phich(srslte_sequence_t *seq, srslte_sequence_pusch(srslte_sequence_t* seq, uint16_t rnti, uint32_t nslot, uint32_t cell_id, uint32_t len);
uint32_t nslot,
uint32_t cell_id); SRSLTE_API int srslte_sequence_pucch(srslte_sequence_t* seq, uint16_t rnti, uint32_t nslot, uint32_t cell_id);
SRSLTE_API int srslte_sequence_pdcch(srslte_sequence_t *seq, SRSLTE_API int srslte_sequence_pmch(srslte_sequence_t* seq, uint32_t nslot, uint32_t mbsfn_id, uint32_t len);
uint32_t nslot,
uint32_t cell_id,
uint32_t len);
SRSLTE_API int srslte_sequence_pdsch(srslte_sequence_t *seq,
uint16_t rnti,
int q,
uint32_t nslot,
uint32_t cell_id,
uint32_t len);
SRSLTE_API int srslte_sequence_pusch(srslte_sequence_t *seq,
uint16_t rnti,
uint32_t nslot,
uint32_t cell_id,
uint32_t len);
SRSLTE_API int srslte_sequence_pucch(srslte_sequence_t *seq,
uint16_t rnti,
uint32_t nslot,
uint32_t cell_id);
SRSLTE_API int srslte_sequence_pmch(srslte_sequence_t *seq,
uint32_t nslot,
uint32_t mbsfn_id,
uint32_t len);
SRSLTE_API int srslte_sequence_npbch(srslte_sequence_t* seq, srslte_cp_t cp, uint32_t cell_id); SRSLTE_API int srslte_sequence_npbch(srslte_sequence_t* seq, srslte_cp_t cp, uint32_t cell_id);

@ -37,10 +37,10 @@
#include <stdint.h> #include <stdint.h>
#include <time.h> #include <time.h>
typedef struct SRSLTE_API{ typedef struct SRSLTE_API {
time_t full_secs; time_t full_secs;
double frac_secs; double frac_secs;
}srslte_timestamp_t; } srslte_timestamp_t;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -58,11 +58,11 @@ SRSLTE_API int srslte_timestamp_add(srslte_timestamp_t* t, time_t full_secs, dou
SRSLTE_API int srslte_timestamp_sub(srslte_timestamp_t* t, time_t full_secs, double frac_secs); SRSLTE_API int srslte_timestamp_sub(srslte_timestamp_t* t, time_t full_secs, double frac_secs);
SRSLTE_API double srslte_timestamp_real(srslte_timestamp_t *t); SRSLTE_API double srslte_timestamp_real(srslte_timestamp_t* t);
SRSLTE_API bool srslte_timestamp_iszero(const srslte_timestamp_t* t); SRSLTE_API bool srslte_timestamp_iszero(const srslte_timestamp_t* t);
SRSLTE_API uint32_t srslte_timestamp_uint32(srslte_timestamp_t *t); SRSLTE_API uint32_t srslte_timestamp_uint32(srslte_timestamp_t* t);
SRSLTE_API uint64_t srslte_timestamp_uint64(const srslte_timestamp_t* t, double srate); SRSLTE_API uint64_t srslte_timestamp_uint64(const srslte_timestamp_t* t, double srate);

@ -21,9 +21,9 @@
#ifndef SRSLTE_DFT_H #ifndef SRSLTE_DFT_H
#define SRSLTE_DFT_H #define SRSLTE_DFT_H
#include <stdbool.h>
#include "srslte/config.h" #include "srslte/config.h"
#include <stdbool.h>
/********************************************************************************************** /**********************************************************************************************
* File: dft.h * File: dft.h
@ -43,113 +43,85 @@
* Reference: * Reference:
*********************************************************************************************/ *********************************************************************************************/
typedef enum { typedef enum { SRSLTE_DFT_COMPLEX, SRSLTE_REAL } srslte_dft_mode_t;
SRSLTE_DFT_COMPLEX, SRSLTE_REAL
}srslte_dft_mode_t;
typedef enum { typedef enum { SRSLTE_DFT_FORWARD, SRSLTE_DFT_BACKWARD } srslte_dft_dir_t;
SRSLTE_DFT_FORWARD, SRSLTE_DFT_BACKWARD
}srslte_dft_dir_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
int init_size; // DFT length used in the first initialization int init_size; // DFT length used in the first initialization
int size; // DFT length int size; // DFT length
void *in; // Input buffer void* in; // Input buffer
void *out; // Output buffer void* out; // Output buffer
void *p; // DFT plan void* p; // DFT plan
bool is_guru; bool is_guru;
bool forward; // Forward transform? bool forward; // Forward transform?
bool mirror; // Shift negative and positive frequencies? bool mirror; // Shift negative and positive frequencies?
bool db; // Provide output in dB? bool db; // Provide output in dB?
bool norm; // Normalize output? bool norm; // Normalize output?
bool dc; // Handle insertion/removal of null DC carrier internally? bool dc; // Handle insertion/removal of null DC carrier internally?
srslte_dft_dir_t dir; // Forward/Backward srslte_dft_dir_t dir; // Forward/Backward
srslte_dft_mode_t mode; // Complex/Real srslte_dft_mode_t mode; // Complex/Real
}srslte_dft_plan_t; } srslte_dft_plan_t;
SRSLTE_API void srslte_dft_load(); SRSLTE_API void srslte_dft_load();
SRSLTE_API void srslte_dft_exit(); SRSLTE_API void srslte_dft_exit();
SRSLTE_API int srslte_dft_plan(srslte_dft_plan_t *plan, SRSLTE_API int srslte_dft_plan(srslte_dft_plan_t* plan, int dft_points, srslte_dft_dir_t dir, srslte_dft_mode_t type);
int dft_points,
srslte_dft_dir_t dir,
srslte_dft_mode_t type);
SRSLTE_API int srslte_dft_plan_c(srslte_dft_plan_t *plan, SRSLTE_API int srslte_dft_plan_c(srslte_dft_plan_t* plan, int dft_points, srslte_dft_dir_t dir);
int dft_points,
srslte_dft_dir_t dir);
SRSLTE_API int srslte_dft_plan_guru_c(srslte_dft_plan_t *plan, SRSLTE_API int srslte_dft_plan_guru_c(srslte_dft_plan_t* plan,
int dft_points, int dft_points,
srslte_dft_dir_t dir, srslte_dft_dir_t dir,
cf_t *in_buffer, cf_t* in_buffer,
cf_t *out_buffer, cf_t* out_buffer,
int istride, int istride,
int ostride, int ostride,
int how_many, int how_many,
int idist, int idist,
int odist); int odist);
SRSLTE_API int srslte_dft_plan_r(srslte_dft_plan_t *plan, SRSLTE_API int srslte_dft_plan_r(srslte_dft_plan_t* plan, int dft_points, srslte_dft_dir_t dir);
int dft_points,
srslte_dft_dir_t dir);
SRSLTE_API int srslte_dft_replan(srslte_dft_plan_t *plan, SRSLTE_API int srslte_dft_replan(srslte_dft_plan_t* plan, const int new_dft_points);
const int new_dft_points);
SRSLTE_API int srslte_dft_replan_guru_c(srslte_dft_plan_t *plan, SRSLTE_API int srslte_dft_replan_guru_c(srslte_dft_plan_t* plan,
const int new_dft_points, const int new_dft_points,
cf_t *in_buffer, cf_t* in_buffer,
cf_t *out_buffer, cf_t* out_buffer,
int istride, int istride,
int ostride, int ostride,
int how_many, int how_many,
int idist, int idist,
int odist); int odist);
SRSLTE_API int srslte_dft_replan_c(srslte_dft_plan_t *plan, SRSLTE_API int srslte_dft_replan_c(srslte_dft_plan_t* plan, int new_dft_points);
int new_dft_points);
SRSLTE_API int srslte_dft_replan_r(srslte_dft_plan_t *plan, SRSLTE_API int srslte_dft_replan_r(srslte_dft_plan_t* plan, int new_dft_points);
int new_dft_points);
SRSLTE_API void srslte_dft_plan_free(srslte_dft_plan_t* plan);
SRSLTE_API void srslte_dft_plan_free(srslte_dft_plan_t *plan);
/* Set options */ /* Set options */
SRSLTE_API void srslte_dft_plan_set_mirror(srslte_dft_plan_t *plan, SRSLTE_API void srslte_dft_plan_set_mirror(srslte_dft_plan_t* plan, bool val);
bool val);
SRSLTE_API void srslte_dft_plan_set_db(srslte_dft_plan_t *plan, SRSLTE_API void srslte_dft_plan_set_db(srslte_dft_plan_t* plan, bool val);
bool val);
SRSLTE_API void srslte_dft_plan_set_norm(srslte_dft_plan_t *plan, SRSLTE_API void srslte_dft_plan_set_norm(srslte_dft_plan_t* plan, bool val);
bool val);
SRSLTE_API void srslte_dft_plan_set_dc(srslte_dft_plan_t *plan, SRSLTE_API void srslte_dft_plan_set_dc(srslte_dft_plan_t* plan, bool val);
bool val);
/* Compute DFT */ /* Compute DFT */
SRSLTE_API void srslte_dft_run(srslte_dft_plan_t *plan, SRSLTE_API void srslte_dft_run(srslte_dft_plan_t* plan, const void* in, void* out);
const void *in,
void *out);
SRSLTE_API void srslte_dft_run_c_zerocopy(srslte_dft_plan_t *plan, SRSLTE_API void srslte_dft_run_c_zerocopy(srslte_dft_plan_t* plan, const cf_t* in, cf_t* out);
const cf_t *in,
cf_t *out);
SRSLTE_API void srslte_dft_run_c(srslte_dft_plan_t *plan, SRSLTE_API void srslte_dft_run_c(srslte_dft_plan_t* plan, const cf_t* in, cf_t* out);
const cf_t *in,
cf_t *out);
SRSLTE_API void srslte_dft_run_guru_c(srslte_dft_plan_t *plan); SRSLTE_API void srslte_dft_run_guru_c(srslte_dft_plan_t* plan);
SRSLTE_API void srslte_dft_run_r(srslte_dft_plan_t *plan, SRSLTE_API void srslte_dft_run_r(srslte_dft_plan_t* plan, const float* in, float* out);
const float *in,
float *out);
#endif // SRSLTE_DFT_H #endif // SRSLTE_DFT_H

@ -38,29 +38,22 @@
/* DFT-based Transform Precoding object */ /* DFT-based Transform Precoding object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_prb; uint32_t max_prb;
srslte_dft_plan_t dft_plan[SRSLTE_MAX_PRB+1]; srslte_dft_plan_t dft_plan[SRSLTE_MAX_PRB + 1];
}srslte_dft_precoding_t; } srslte_dft_precoding_t;
SRSLTE_API int srslte_dft_precoding_init(srslte_dft_precoding_t *q, SRSLTE_API int srslte_dft_precoding_init(srslte_dft_precoding_t* q, uint32_t max_prb, bool is_tx);
uint32_t max_prb,
bool is_tx);
SRSLTE_API int srslte_dft_precoding_init_tx(srslte_dft_precoding_t *q, SRSLTE_API int srslte_dft_precoding_init_tx(srslte_dft_precoding_t* q, uint32_t max_prb);
uint32_t max_prb);
SRSLTE_API int srslte_dft_precoding_init_rx(srslte_dft_precoding_t *q, SRSLTE_API int srslte_dft_precoding_init_rx(srslte_dft_precoding_t* q, uint32_t max_prb);
uint32_t max_prb);
SRSLTE_API void srslte_dft_precoding_free(srslte_dft_precoding_t *q); SRSLTE_API void srslte_dft_precoding_free(srslte_dft_precoding_t* q);
SRSLTE_API bool srslte_dft_precoding_valid_prb(uint32_t nof_prb); SRSLTE_API bool srslte_dft_precoding_valid_prb(uint32_t nof_prb);
SRSLTE_API int srslte_dft_precoding(srslte_dft_precoding_t *q, SRSLTE_API int
cf_t *input, srslte_dft_precoding(srslte_dft_precoding_t* q, cf_t* input, cf_t* output, uint32_t nof_prb, uint32_t nof_symbols);
cf_t *output,
uint32_t nof_prb,
uint32_t nof_symbols);
#endif // SRSLTE_DFT_PRECODING_H #endif // SRSLTE_DFT_PRECODING_H

@ -31,125 +31,94 @@
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6 * Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6
*********************************************************************************************/ *********************************************************************************************/
#include <strings.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h>
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/phy/common/phy_common.h" #include "srslte/phy/common/phy_common.h"
#include "srslte/phy/dft/dft.h" #include "srslte/phy/dft/dft.h"
/* This is common for both directions */ /* This is common for both directions */
typedef struct SRSLTE_API{ typedef struct SRSLTE_API {
srslte_dft_plan_t fft_plan; srslte_dft_plan_t fft_plan;
srslte_dft_plan_t fft_plan_sf[2]; srslte_dft_plan_t fft_plan_sf[2];
uint32_t max_prb; uint32_t max_prb;
uint32_t nof_symbols; uint32_t nof_symbols;
uint32_t symbol_sz; uint32_t symbol_sz;
uint32_t nof_guards; uint32_t nof_guards;
uint32_t nof_re; uint32_t nof_re;
uint32_t slot_sz; uint32_t slot_sz;
uint32_t sf_sz; uint32_t sf_sz;
srslte_cp_t cp; srslte_cp_t cp;
cf_t *tmp; // for removing zero padding cf_t* tmp; // for removing zero padding
cf_t *in_buffer; cf_t* in_buffer;
cf_t *out_buffer; cf_t* out_buffer;
bool mbsfn_subframe; bool mbsfn_subframe;
uint32_t mbsfn_guard_len; uint32_t mbsfn_guard_len;
uint32_t nof_symbols_mbsfn; uint32_t nof_symbols_mbsfn;
uint8_t non_mbsfn_region; uint8_t non_mbsfn_region;
bool freq_shift;
bool freq_shift;
float freq_shift_f; float freq_shift_f;
cf_t *shift_buffer; cf_t* shift_buffer;
}srslte_ofdm_t; } srslte_ofdm_t;
SRSLTE_API int srslte_ofdm_init_(srslte_ofdm_t *q, SRSLTE_API int srslte_ofdm_init_(srslte_ofdm_t* q,
srslte_cp_t cp, srslte_cp_t cp,
cf_t *in_buffer, cf_t* in_buffer,
cf_t *out_buffer, cf_t* out_buffer,
int symbol_sz, int symbol_sz,
int nof_prb, int nof_prb,
srslte_dft_dir_t dir); srslte_dft_dir_t dir);
SRSLTE_API int srslte_ofdm_init_mbsfn_(srslte_ofdm_t *q, SRSLTE_API int srslte_ofdm_init_mbsfn_(srslte_ofdm_t* q,
srslte_cp_t cp, srslte_cp_t cp,
cf_t *in_buffer, cf_t* in_buffer,
cf_t *out_buffer, cf_t* out_buffer,
int symbol_sz, int symbol_sz,
int nof_prb, int nof_prb,
srslte_dft_dir_t dir, srslte_dft_dir_t dir,
srslte_sf_t sf_type); srslte_sf_t sf_type);
SRSLTE_API int srslte_ofdm_rx_init_mbsfn(srslte_ofdm_t *q,
srslte_cp_t cp_type,
cf_t *in_buffer,
cf_t *out_buffer,
uint32_t max_prb);
SRSLTE_API int srslte_ofdm_rx_init(srslte_ofdm_t *q,
srslte_cp_t cp_type,
cf_t *in_buffer,
cf_t *out_buffer,
uint32_t max_prb);
SRSLTE_API int srslte_ofdm_tx_set_prb(srslte_ofdm_t *q,
srslte_cp_t cp,
uint32_t nof_prb);
SRSLTE_API int srslte_ofdm_rx_set_prb(srslte_ofdm_t *q, SRSLTE_API int
srslte_cp_t cp, srslte_ofdm_rx_init_mbsfn(srslte_ofdm_t* q, srslte_cp_t cp_type, cf_t* in_buffer, cf_t* out_buffer, uint32_t max_prb);
uint32_t nof_prb);
SRSLTE_API void srslte_ofdm_rx_free(srslte_ofdm_t *q); SRSLTE_API int
srslte_ofdm_rx_init(srslte_ofdm_t* q, srslte_cp_t cp_type, cf_t* in_buffer, cf_t* out_buffer, uint32_t max_prb);
SRSLTE_API void srslte_ofdm_rx_slot(srslte_ofdm_t *q, SRSLTE_API int srslte_ofdm_tx_set_prb(srslte_ofdm_t* q, srslte_cp_t cp, uint32_t nof_prb);
int slot_in_sf);
SRSLTE_API void srslte_ofdm_rx_slot_ng(srslte_ofdm_t *q, SRSLTE_API int srslte_ofdm_rx_set_prb(srslte_ofdm_t* q, srslte_cp_t cp, uint32_t nof_prb);
cf_t *input,
cf_t *output);
SRSLTE_API void srslte_ofdm_rx_sf(srslte_ofdm_t *q); SRSLTE_API void srslte_ofdm_rx_free(srslte_ofdm_t* q);
SRSLTE_API void srslte_ofdm_rx_sf_ng(srslte_ofdm_t *q, SRSLTE_API void srslte_ofdm_rx_slot(srslte_ofdm_t* q, int slot_in_sf);
cf_t *input,
cf_t *output);
SRSLTE_API int srslte_ofdm_tx_init(srslte_ofdm_t *q, SRSLTE_API void srslte_ofdm_rx_slot_ng(srslte_ofdm_t* q, cf_t* input, cf_t* output);
srslte_cp_t cp_type,
cf_t *in_buffer,
cf_t *out_buffer,
uint32_t nof_prb);
SRSLTE_API int srslte_ofdm_tx_init_mbsfn(srslte_ofdm_t *q, SRSLTE_API void srslte_ofdm_rx_sf(srslte_ofdm_t* q);
srslte_cp_t cp,
cf_t *in_buffer,
cf_t *out_buffer,
uint32_t nof_prb);
SRSLTE_API void srslte_ofdm_rx_sf_ng(srslte_ofdm_t* q, cf_t* input, cf_t* output);
SRSLTE_API void srslte_ofdm_tx_free(srslte_ofdm_t *q); SRSLTE_API int
srslte_ofdm_tx_init(srslte_ofdm_t* q, srslte_cp_t cp_type, cf_t* in_buffer, cf_t* out_buffer, uint32_t nof_prb);
SRSLTE_API void srslte_ofdm_tx_slot(srslte_ofdm_t *q, SRSLTE_API int
int slot_in_sf); srslte_ofdm_tx_init_mbsfn(srslte_ofdm_t* q, srslte_cp_t cp, cf_t* in_buffer, cf_t* out_buffer, uint32_t nof_prb);
SRSLTE_API void srslte_ofdm_tx_slot_mbsfn(srslte_ofdm_t *q, SRSLTE_API void srslte_ofdm_tx_free(srslte_ofdm_t* q);
cf_t *input,
cf_t *output);
SRSLTE_API void srslte_ofdm_tx_slot(srslte_ofdm_t* q, int slot_in_sf);
SRSLTE_API void srslte_ofdm_tx_sf(srslte_ofdm_t *q); SRSLTE_API void srslte_ofdm_tx_slot_mbsfn(srslte_ofdm_t* q, cf_t* input, cf_t* output);
SRSLTE_API int srslte_ofdm_set_freq_shift(srslte_ofdm_t *q, SRSLTE_API void srslte_ofdm_tx_sf(srslte_ofdm_t* q);
float freq_shift);
SRSLTE_API void srslte_ofdm_set_normalize(srslte_ofdm_t *q, SRSLTE_API int srslte_ofdm_set_freq_shift(srslte_ofdm_t* q, float freq_shift);
bool normalize_enable);
SRSLTE_API void srslte_ofdm_set_non_mbsfn_region(srslte_ofdm_t *q, SRSLTE_API void srslte_ofdm_set_normalize(srslte_ofdm_t* q, bool normalize_enable);
uint8_t non_mbsfn_region);
SRSLTE_API void srslte_ofdm_set_non_mbsfn_region(srslte_ofdm_t* q, uint8_t non_mbsfn_region);
#endif // SRSLTE_OFDM_H #endif // SRSLTE_OFDM_H

@ -54,8 +54,8 @@
#include "srslte/phy/enb/enb_ul.h" #include "srslte/phy/enb/enb_ul.h"
#include "srslte/phy/ue/ue_dl.h" #include "srslte/phy/ue/ue_dl.h"
#include "srslte/phy/utils/vector.h"
#include "srslte/phy/utils/debug.h" #include "srslte/phy/utils/debug.h"
#include "srslte/phy/utils/vector.h"
#include "srslte/config.h" #include "srslte/config.h"
@ -66,8 +66,8 @@ typedef struct SRSLTE_API {
cf_t* sf_symbols[SRSLTE_MAX_PORTS]; cf_t* sf_symbols[SRSLTE_MAX_PORTS];
srslte_ofdm_t ifft[SRSLTE_MAX_PORTS]; srslte_ofdm_t ifft[SRSLTE_MAX_PORTS];
srslte_ofdm_t ifft_mbsfn; srslte_ofdm_t ifft_mbsfn;
srslte_pbch_t pbch; srslte_pbch_t pbch;
srslte_pcfich_t pcfich; srslte_pcfich_t pcfich;
@ -75,8 +75,8 @@ typedef struct SRSLTE_API {
srslte_pdcch_t pdcch; srslte_pdcch_t pdcch;
srslte_pdsch_t pdsch; srslte_pdsch_t pdsch;
srslte_pmch_t pmch; srslte_pmch_t pmch;
srslte_phich_t phich; srslte_phich_t phich;
srslte_refsignal_t csr_signal; srslte_refsignal_t csr_signal;
srslte_refsignal_t mbsfnr_signal; srslte_refsignal_t mbsfnr_signal;
@ -93,14 +93,11 @@ typedef struct {
} srslte_enb_dl_phich_t; } srslte_enb_dl_phich_t;
/* This function shall be called just after the initial synchronization */ /* This function shall be called just after the initial synchronization */
SRSLTE_API int srslte_enb_dl_init(srslte_enb_dl_t *q, SRSLTE_API int srslte_enb_dl_init(srslte_enb_dl_t* q, cf_t* out_buffer[SRSLTE_MAX_PORTS], uint32_t max_prb);
cf_t *out_buffer[SRSLTE_MAX_PORTS],
uint32_t max_prb);
SRSLTE_API void srslte_enb_dl_free(srslte_enb_dl_t *q); SRSLTE_API void srslte_enb_dl_free(srslte_enb_dl_t* q);
SRSLTE_API int srslte_enb_dl_set_cell(srslte_enb_dl_t *q, SRSLTE_API int srslte_enb_dl_set_cell(srslte_enb_dl_t* q, srslte_cell_t cell);
srslte_cell_t cell);
SRSLTE_API int srslte_enb_dl_add_rnti(srslte_enb_dl_t* q, uint16_t rnti); SRSLTE_API int srslte_enb_dl_add_rnti(srslte_enb_dl_t* q, uint16_t rnti);
@ -121,8 +118,11 @@ SRSLTE_API int srslte_enb_dl_put_pmch(srslte_enb_dl_t* q, srslte_pmch_cfg_t* pmc
SRSLTE_API void srslte_enb_dl_gen_signal(srslte_enb_dl_t* q); SRSLTE_API void srslte_enb_dl_gen_signal(srslte_enb_dl_t* q);
SRSLTE_API bool srslte_enb_dl_gen_cqi_periodic( SRSLTE_API bool srslte_enb_dl_gen_cqi_periodic(srslte_cell_t* cell,
srslte_cell_t* cell, srslte_dl_cfg_t* dl_cfg, uint32_t tti, uint32_t ri, srslte_cqi_cfg_t* cqi_cfg); srslte_dl_cfg_t* dl_cfg,
uint32_t tti,
uint32_t ri,
srslte_cqi_cfg_t* cqi_cfg);
SRSLTE_API bool SRSLTE_API bool
srslte_enb_dl_gen_cqi_aperiodic(srslte_cell_t* cell, srslte_dl_cfg_t* dl_cfg, uint32_t ri, srslte_cqi_cfg_t* cqi_cfg); srslte_enb_dl_gen_cqi_aperiodic(srslte_cell_t* cell, srslte_dl_cfg_t* dl_cfg, uint32_t ri, srslte_cqi_cfg_t* cqi_cfg);

@ -44,8 +44,8 @@
#include "srslte/phy/phch/pusch_cfg.h" #include "srslte/phy/phch/pusch_cfg.h"
#include "srslte/phy/phch/ra.h" #include "srslte/phy/phch/ra.h"
#include "srslte/phy/utils/vector.h"
#include "srslte/phy/utils/debug.h" #include "srslte/phy/utils/debug.h"
#include "srslte/phy/utils/vector.h"
#include "srslte/config.h" #include "srslte/config.h"
@ -63,22 +63,18 @@ typedef struct SRSLTE_API {
} srslte_enb_ul_t; } srslte_enb_ul_t;
/* This function shall be called just after the initial synchronization */ /* This function shall be called just after the initial synchronization */
SRSLTE_API int srslte_enb_ul_init(srslte_enb_ul_t *q, SRSLTE_API int srslte_enb_ul_init(srslte_enb_ul_t* q, cf_t* in_buffer, uint32_t max_prb);
cf_t *in_buffer,
uint32_t max_prb);
SRSLTE_API void srslte_enb_ul_free(srslte_enb_ul_t *q); SRSLTE_API void srslte_enb_ul_free(srslte_enb_ul_t* q);
SRSLTE_API int SRSLTE_API int
srslte_enb_ul_set_cell(srslte_enb_ul_t* q, srslte_cell_t cell, srslte_refsignal_dmrs_pusch_cfg_t* pusch_cfg); srslte_enb_ul_set_cell(srslte_enb_ul_t* q, srslte_cell_t cell, srslte_refsignal_dmrs_pusch_cfg_t* pusch_cfg);
SRSLTE_API int srslte_enb_ul_add_rnti(srslte_enb_ul_t *q, SRSLTE_API int srslte_enb_ul_add_rnti(srslte_enb_ul_t* q, uint16_t rnti);
uint16_t rnti);
SRSLTE_API void srslte_enb_ul_rem_rnti(srslte_enb_ul_t *q, SRSLTE_API void srslte_enb_ul_rem_rnti(srslte_enb_ul_t* q, uint16_t rnti);
uint16_t rnti);
SRSLTE_API void srslte_enb_ul_fft(srslte_enb_ul_t *q); SRSLTE_API void srslte_enb_ul_fft(srslte_enb_ul_t* q);
SRSLTE_API int srslte_enb_ul_get_pucch(srslte_enb_ul_t* q, SRSLTE_API int srslte_enb_ul_get_pucch(srslte_enb_ul_t* q,
srslte_ul_sf_cfg_t* ul_sf, srslte_ul_sf_cfg_t* ul_sf,

@ -19,8 +19,8 @@
* *
*/ */
#include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include "srslte/config.h" #include "srslte/config.h"
@ -29,8 +29,7 @@
#define SRSLTE_NOF_TC_CB_SIZES 188 #define SRSLTE_NOF_TC_CB_SIZES 188
typedef struct SRSLTE_API {
typedef struct SRSLTE_API {
uint32_t F; uint32_t F;
uint32_t C; uint32_t C;
uint32_t K1; uint32_t K1;
@ -39,16 +38,15 @@
uint32_t K2_idx; uint32_t K2_idx;
uint32_t C1; uint32_t C1;
uint32_t C2; uint32_t C2;
uint32_t tbs; uint32_t tbs;
} srslte_cbsegm_t; } srslte_cbsegm_t;
SRSLTE_API int srslte_cbsegm(srslte_cbsegm_t *s, SRSLTE_API int srslte_cbsegm(srslte_cbsegm_t* s, uint32_t tbs);
uint32_t tbs);
SRSLTE_API int srslte_cbsegm_cbsize(uint32_t index); SRSLTE_API int srslte_cbsegm_cbsize(uint32_t index);
SRSLTE_API bool srslte_cbsegm_cbsize_isvalid(uint32_t size); SRSLTE_API bool srslte_cbsegm_cbsize_isvalid(uint32_t size);
SRSLTE_API int srslte_cbsegm_cbindex(uint32_t long_cb); SRSLTE_API int srslte_cbsegm_cbindex(uint32_t long_cb);
#endif // SRSLTE_CBSEGM_H #endif // SRSLTE_CBSEGM_H

@ -32,20 +32,16 @@
#ifndef SRSLTE_CONVCODER_H #ifndef SRSLTE_CONVCODER_H
#define SRSLTE_CONVCODER_H #define SRSLTE_CONVCODER_H
#include <stdbool.h>
#include "srslte/config.h" #include "srslte/config.h"
#include <stdbool.h>
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t R; uint32_t R;
uint32_t K; uint32_t K;
int poly[3]; int poly[3];
bool tail_biting; bool tail_biting;
}srslte_convcoder_t; } srslte_convcoder_t;
SRSLTE_API int srslte_convcoder_encode(srslte_convcoder_t *q,
uint8_t *input,
uint8_t *output,
uint32_t frame_length);
SRSLTE_API int srslte_convcoder_encode(srslte_convcoder_t* q, uint8_t* input, uint8_t* output, uint32_t frame_length);
#endif // SRSLTE_CONVCODER_H #endif // SRSLTE_CONVCODER_H

@ -37,49 +37,40 @@
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint64_t table[256]; uint64_t table[256];
int polynom; int polynom;
int order; int order;
uint64_t crcinit; uint64_t crcinit;
uint64_t crcmask; uint64_t crcmask;
uint64_t crchighbit; uint64_t crchighbit;
uint32_t srslte_crc_out; uint32_t srslte_crc_out;
} srslte_crc_t; } srslte_crc_t;
SRSLTE_API int srslte_crc_init(srslte_crc_t *h, SRSLTE_API int srslte_crc_init(srslte_crc_t* h, uint32_t srslte_crc_poly, int srslte_crc_order);
uint32_t srslte_crc_poly,
int srslte_crc_order);
SRSLTE_API int srslte_crc_set_init(srslte_crc_t *h, SRSLTE_API int srslte_crc_set_init(srslte_crc_t* h, uint64_t init_value);
uint64_t init_value);
SRSLTE_API uint32_t srslte_crc_attach(srslte_crc_t *h, SRSLTE_API uint32_t srslte_crc_attach(srslte_crc_t* h, uint8_t* data, int len);
uint8_t *data,
int len);
SRSLTE_API uint32_t srslte_crc_attach_byte(srslte_crc_t *h, SRSLTE_API uint32_t srslte_crc_attach_byte(srslte_crc_t* h, uint8_t* data, int len);
uint8_t *data,
int len);
static inline void srslte_crc_checksum_put_byte(srslte_crc_t *h, uint8_t byte) { static inline void srslte_crc_checksum_put_byte(srslte_crc_t* h, uint8_t byte)
{
// Polynom order 8, 16, 24 or 32 only. // Polynom order 8, 16, 24 or 32 only.
int ord = h->order - 8; int ord = h->order - 8;
uint64_t crc = h->crcinit; uint64_t crc = h->crcinit;
crc = (crc << 8) ^ h->table[((crc >> (ord)) & 0xff) ^ byte]; crc = (crc << 8) ^ h->table[((crc >> (ord)) & 0xff) ^ byte];
h->crcinit = crc; h->crcinit = crc;
} }
static inline uint64_t srslte_crc_checksum_get(srslte_crc_t *h) { static inline uint64_t srslte_crc_checksum_get(srslte_crc_t* h)
return (h->crcinit & h->crcmask); {
return (h->crcinit & h->crcmask);
} }
SRSLTE_API uint32_t srslte_crc_checksum_byte(srslte_crc_t *h, SRSLTE_API uint32_t srslte_crc_checksum_byte(srslte_crc_t* h, uint8_t* data, int len);
uint8_t *data,
int len);
SRSLTE_API uint32_t srslte_crc_checksum(srslte_crc_t *h, SRSLTE_API uint32_t srslte_crc_checksum(srslte_crc_t* h, uint8_t* data, int len);
uint8_t *data,
int len);
#endif // SRSLTE_CRC_H #endif // SRSLTE_CRC_H

@ -40,22 +40,12 @@
#ifndef SRSLTE_TX_NULL #ifndef SRSLTE_TX_NULL
#define SRSLTE_TX_NULL 100 #define SRSLTE_TX_NULL 100
#endif #endif
SRSLTE_API int srslte_rm_conv_tx(uint8_t *input, SRSLTE_API int srslte_rm_conv_tx(uint8_t* input, uint32_t in_len, uint8_t* output, uint32_t out_len);
uint32_t in_len,
uint8_t *output,
uint32_t out_len);
SRSLTE_API int srslte_rm_conv_rx(float *input, SRSLTE_API int srslte_rm_conv_rx(float* input, uint32_t in_len, float* output, uint32_t out_len);
uint32_t in_len,
float *output,
uint32_t out_len);
/************* FIX THIS. MOVE ALL PROCESSING TO INT16 AND HAVE ONLY 1 IMPLEMENTATION ******/
/************* FIX THIS. MOVE ALL PROCESSING TO INT16 AND HAVE ONLY 1 IMPLEMENTATION ******/ SRSLTE_API int srslte_rm_conv_rx_s(int16_t* input, uint32_t in_len, int16_t* output, uint32_t out_len);
SRSLTE_API int srslte_rm_conv_rx_s(int16_t *input,
uint32_t in_len,
int16_t *output,
uint32_t out_len);
#endif // SRSLTE_RM_CONV_H #endif // SRSLTE_RM_CONV_H

@ -43,53 +43,47 @@
#include "srslte/config.h" #include "srslte/config.h"
SRSLTE_API int srslte_rm_turbo_tx(uint8_t *w_buff, SRSLTE_API int srslte_rm_turbo_tx(uint8_t* w_buff,
uint32_t buff_len, uint32_t buff_len,
uint8_t *input, uint8_t* input,
uint32_t in_len, uint32_t in_len,
uint8_t *output, uint8_t* output,
uint32_t out_len, uint32_t out_len,
uint32_t rv_idx); uint32_t rv_idx);
SRSLTE_API void srslte_rm_turbo_gentables(); SRSLTE_API void srslte_rm_turbo_gentables();
SRSLTE_API void srslte_rm_turbo_free_tables(); SRSLTE_API void srslte_rm_turbo_free_tables();
SRSLTE_API int srslte_rm_turbo_tx_lut(uint8_t *w_buff, SRSLTE_API int srslte_rm_turbo_tx_lut(uint8_t* w_buff,
uint8_t *systematic, uint8_t* systematic,
uint8_t *parity, uint8_t* parity,
uint8_t *output, uint8_t* output,
uint32_t cb_idx, uint32_t cb_idx,
uint32_t out_len, uint32_t out_len,
uint32_t w_offset, uint32_t w_offset,
uint32_t rv_idx); uint32_t rv_idx);
SRSLTE_API int srslte_rm_turbo_rx(float *w_buff, SRSLTE_API int srslte_rm_turbo_rx(float* w_buff,
uint32_t buff_len, uint32_t buff_len,
float *input, float* input,
uint32_t in_len, uint32_t in_len,
float *output, float* output,
uint32_t out_len, uint32_t out_len,
uint32_t rv_idx, uint32_t rv_idx,
uint32_t nof_filler_bits); uint32_t nof_filler_bits);
SRSLTE_API int srslte_rm_turbo_rx_lut(int16_t *input, SRSLTE_API int
int16_t *output, srslte_rm_turbo_rx_lut(int16_t* input, int16_t* output, uint32_t in_len, uint32_t cb_idx, uint32_t rv_idx);
uint32_t in_len,
uint32_t cb_idx,
uint32_t rv_idx);
SRSLTE_API int srslte_rm_turbo_rx_lut_(int16_t *input, SRSLTE_API int srslte_rm_turbo_rx_lut_(int16_t* input,
int16_t *output, int16_t* output,
uint32_t in_len, uint32_t in_len,
uint32_t cb_idx, uint32_t cb_idx,
uint32_t rv_idx, uint32_t rv_idx,
bool enable_input_tdec); bool enable_input_tdec);
SRSLTE_API int srslte_rm_turbo_rx_lut_8bit(int8_t *input, SRSLTE_API int
int8_t *output, srslte_rm_turbo_rx_lut_8bit(int8_t* input, int8_t* output, uint32_t in_len, uint32_t cb_idx, uint32_t rv_idx);
uint32_t in_len,
uint32_t cb_idx,
uint32_t rv_idx);
#endif // SRSLTE_RM_TURBO_H #endif // SRSLTE_RM_TURBO_H

@ -22,8 +22,8 @@
/****************************************************************************** /******************************************************************************
* File: softbuffer.h * File: softbuffer.h
* *
* Description: Buffer for RX and TX soft bits. This should be provided by MAC. * Description: Buffer for RX and TX soft bits. This should be provided by MAC.
* Provided here basically for the examples. * Provided here basically for the examples.
* *
* Reference: * Reference:
*****************************************************************************/ *****************************************************************************/
@ -35,46 +35,38 @@
#include "srslte/phy/common/phy_common.h" #include "srslte/phy/common/phy_common.h"
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_cb; uint32_t max_cb;
int16_t **buffer_f; int16_t** buffer_f;
uint8_t **data; uint8_t** data;
bool *cb_crc; bool* cb_crc;
bool tb_crc; bool tb_crc;
} srslte_softbuffer_rx_t; } srslte_softbuffer_rx_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_cb; uint32_t max_cb;
uint8_t **buffer_b; uint8_t** buffer_b;
} srslte_softbuffer_tx_t; } srslte_softbuffer_tx_t;
#define SOFTBUFFER_SIZE 18600 #define SOFTBUFFER_SIZE 18600
SRSLTE_API int srslte_softbuffer_rx_init(srslte_softbuffer_rx_t * q, SRSLTE_API int srslte_softbuffer_rx_init(srslte_softbuffer_rx_t* q, uint32_t nof_prb);
uint32_t nof_prb);
SRSLTE_API void srslte_softbuffer_rx_reset(srslte_softbuffer_rx_t *p); SRSLTE_API void srslte_softbuffer_rx_reset(srslte_softbuffer_rx_t* p);
SRSLTE_API void srslte_softbuffer_rx_reset_tbs(srslte_softbuffer_rx_t *q, SRSLTE_API void srslte_softbuffer_rx_reset_tbs(srslte_softbuffer_rx_t* q, uint32_t tbs);
uint32_t tbs);
SRSLTE_API void srslte_softbuffer_rx_reset_cb(srslte_softbuffer_rx_t *q, SRSLTE_API void srslte_softbuffer_rx_reset_cb(srslte_softbuffer_rx_t* q, uint32_t nof_cb);
uint32_t nof_cb);
SRSLTE_API void srslte_softbuffer_rx_free(srslte_softbuffer_rx_t *p); SRSLTE_API void srslte_softbuffer_rx_free(srslte_softbuffer_rx_t* p);
SRSLTE_API int srslte_softbuffer_tx_init(srslte_softbuffer_tx_t * q, SRSLTE_API int srslte_softbuffer_tx_init(srslte_softbuffer_tx_t* q, uint32_t nof_prb);
uint32_t nof_prb);
SRSLTE_API void srslte_softbuffer_tx_reset(srslte_softbuffer_tx_t *p); SRSLTE_API void srslte_softbuffer_tx_reset(srslte_softbuffer_tx_t* p);
SRSLTE_API void srslte_softbuffer_tx_reset_tbs(srslte_softbuffer_tx_t *q, SRSLTE_API void srslte_softbuffer_tx_reset_tbs(srslte_softbuffer_tx_t* q, uint32_t tbs);
uint32_t tbs);
SRSLTE_API void srslte_softbuffer_tx_reset_cb(srslte_softbuffer_tx_t *q,
uint32_t nof_cb);
SRSLTE_API void srslte_softbuffer_tx_free(srslte_softbuffer_tx_t *p);
SRSLTE_API void srslte_softbuffer_tx_reset_cb(srslte_softbuffer_tx_t* q, uint32_t nof_cb);
SRSLTE_API void srslte_softbuffer_tx_free(srslte_softbuffer_tx_t* p);
#endif // SRSLTE_SOFTBUFFER_H #endif // SRSLTE_SOFTBUFFER_H

@ -34,21 +34,17 @@
#include <stdint.h> #include <stdint.h>
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint16_t *forward; uint16_t* forward;
uint16_t *reverse; uint16_t* reverse;
uint32_t max_long_cb; uint32_t max_long_cb;
} srslte_tc_interl_t; } srslte_tc_interl_t;
SRSLTE_API int srslte_tc_interl_LTE_gen(srslte_tc_interl_t *h, SRSLTE_API int srslte_tc_interl_LTE_gen(srslte_tc_interl_t* h, uint32_t long_cb);
uint32_t long_cb);
SRSLTE_API int srslte_tc_interl_LTE_gen_interl(srslte_tc_interl_t *h, SRSLTE_API int srslte_tc_interl_LTE_gen_interl(srslte_tc_interl_t* h, uint32_t long_cb, uint32_t interl_win);
uint32_t long_cb,
uint32_t interl_win);
SRSLTE_API int srslte_tc_interl_init(srslte_tc_interl_t *h, SRSLTE_API int srslte_tc_interl_init(srslte_tc_interl_t* h, uint32_t max_long_cb);
uint32_t max_long_cb);
SRSLTE_API void srslte_tc_interl_free(srslte_tc_interl_t *h); SRSLTE_API void srslte_tc_interl_free(srslte_tc_interl_t* h);
#endif // SRSLTE_TC_INTERL_H #endif // SRSLTE_TC_INTERL_H

@ -34,10 +34,10 @@
#define SRSLTE_TURBOCODER_H #define SRSLTE_TURBOCODER_H
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/phy/fec/tc_interl.h"
#include "srslte/phy/fec/crc.h" #include "srslte/phy/fec/crc.h"
#include "srslte/phy/fec/tc_interl.h"
#define SRSLTE_TCOD_MAX_LEN_CB_BYTES (6144/8) #define SRSLTE_TCOD_MAX_LEN_CB_BYTES (6144 / 8)
#ifndef SRSLTE_TX_NULL #ifndef SRSLTE_TX_NULL
#define SRSLTE_TX_NULL 100 #define SRSLTE_TX_NULL 100
@ -45,34 +45,28 @@
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_long_cb; uint32_t max_long_cb;
uint8_t *temp; uint8_t* temp;
} srslte_tcod_t; } srslte_tcod_t;
/* This structure is used as an output for the LUT version of the encoder.
/* This structure is used as an output for the LUT version of the encoder.
* The encoder produces parity bits only and rate matching will interleave them * The encoder produces parity bits only and rate matching will interleave them
* with the systematic bits * with the systematic bits
*/ */
SRSLTE_API int srslte_tcod_init(srslte_tcod_t *h, SRSLTE_API int srslte_tcod_init(srslte_tcod_t* h, uint32_t max_long_cb);
uint32_t max_long_cb);
SRSLTE_API void srslte_tcod_free(srslte_tcod_t *h); SRSLTE_API void srslte_tcod_free(srslte_tcod_t* h);
SRSLTE_API int srslte_tcod_encode(srslte_tcod_t *h, SRSLTE_API int srslte_tcod_encode(srslte_tcod_t* h, uint8_t* input, uint8_t* output, uint32_t long_cb);
uint8_t *input,
uint8_t *output,
uint32_t long_cb);
SRSLTE_API int srslte_tcod_encode_lut(srslte_tcod_t *h, SRSLTE_API int srslte_tcod_encode_lut(srslte_tcod_t* h,
srslte_crc_t *crc_tb, srslte_crc_t* crc_tb,
srslte_crc_t *crc_cb, srslte_crc_t* crc_cb,
uint8_t *input, uint8_t* input,
uint8_t *parity, uint8_t* parity,
uint32_t cblen_idx, uint32_t cblen_idx,
bool last_cb); bool last_cb);
SRSLTE_API void srslte_tcod_gentable(); SRSLTE_API void srslte_tcod_gentable();
#endif // SRSLTE_TURBOCODER_H #endif // SRSLTE_TURBOCODER_H

@ -35,13 +35,13 @@
#define SRSLTE_TURBODECODER_H #define SRSLTE_TURBODECODER_H
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/phy/fec/tc_interl.h"
#include "srslte/phy/fec/cbsegm.h" #include "srslte/phy/fec/cbsegm.h"
#include "srslte/phy/fec/tc_interl.h"
#define SRSLTE_TCOD_RATE 3 #define SRSLTE_TCOD_RATE 3
#define SRSLTE_TCOD_TOTALTAIL 12 #define SRSLTE_TCOD_TOTALTAIL 12
#define SRSLTE_TCOD_MAX_LEN_CB 6144 #define SRSLTE_TCOD_MAX_LEN_CB 6144
// Expect the input to be aligned for sub-block window processing. // Expect the input to be aligned for sub-block window processing.
#define SRSLTE_TDEC_EXPECT_INPUT_SB 1 #define SRSLTE_TDEC_EXPECT_INPUT_SB 1
@ -55,84 +55,69 @@
#include "srslte/phy/fec/turbodecoder_impl.h" #include "srslte/phy/fec/turbodecoder_impl.h"
#undef LLR_IS_16BIT #undef LLR_IS_16BIT
#define SRSLTE_TDEC_NOF_AUTO_MODES_8 2 #define SRSLTE_TDEC_NOF_AUTO_MODES_8 2
#define SRSLTE_TDEC_NOF_AUTO_MODES_16 3 #define SRSLTE_TDEC_NOF_AUTO_MODES_16 3
typedef enum {SRSLTE_TDEC_8, SRSLTE_TDEC_16} srslte_tdec_llr_type_t; typedef enum { SRSLTE_TDEC_8, SRSLTE_TDEC_16 } srslte_tdec_llr_type_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_long_cb; uint32_t max_long_cb;
void *dec8_hdlr[SRSLTE_TDEC_NOF_AUTO_MODES_8]; void* dec8_hdlr[SRSLTE_TDEC_NOF_AUTO_MODES_8];
void *dec16_hdlr[SRSLTE_TDEC_NOF_AUTO_MODES_16]; void* dec16_hdlr[SRSLTE_TDEC_NOF_AUTO_MODES_16];
srslte_tdec_8bit_impl_t *dec8[SRSLTE_TDEC_NOF_AUTO_MODES_8]; srslte_tdec_8bit_impl_t* dec8[SRSLTE_TDEC_NOF_AUTO_MODES_8];
srslte_tdec_16bit_impl_t *dec16[SRSLTE_TDEC_NOF_AUTO_MODES_16]; srslte_tdec_16bit_impl_t* dec16[SRSLTE_TDEC_NOF_AUTO_MODES_16];
int nof_blocks8[SRSLTE_TDEC_NOF_AUTO_MODES_8]; int nof_blocks8[SRSLTE_TDEC_NOF_AUTO_MODES_8];
int nof_blocks16[SRSLTE_TDEC_NOF_AUTO_MODES_16]; int nof_blocks16[SRSLTE_TDEC_NOF_AUTO_MODES_16];
// Declare as void types as can be int8 or int16 // Declare as void types as can be int8 or int16
void *app1; void* app1;
void *app2; void* app2;
void *ext1; void* ext1;
void *ext2; void* ext2;
void *syst0; void* syst0;
void *parity0; void* parity0;
void *parity1; void* parity1;
void *input_conv; void* input_conv;
bool force_not_sb; bool force_not_sb;
srslte_tdec_impl_type_t dec_type; srslte_tdec_impl_type_t dec_type;
srslte_tdec_llr_type_t current_llr_type; srslte_tdec_llr_type_t current_llr_type;
uint32_t current_dec; uint32_t current_dec;
uint32_t current_long_cb; uint32_t current_long_cb;
uint32_t current_inter_idx; uint32_t current_inter_idx;
int current_cbidx; int current_cbidx;
srslte_tc_interl_t interleaver[4][SRSLTE_NOF_TC_CB_SIZES]; srslte_tc_interl_t interleaver[4][SRSLTE_NOF_TC_CB_SIZES];
int n_iter; int n_iter;
} srslte_tdec_t; } srslte_tdec_t;
SRSLTE_API int srslte_tdec_init(srslte_tdec_t * h, SRSLTE_API int srslte_tdec_init(srslte_tdec_t* h, uint32_t max_long_cb);
uint32_t max_long_cb);
SRSLTE_API int srslte_tdec_init_manual(srslte_tdec_t * h, SRSLTE_API int srslte_tdec_init_manual(srslte_tdec_t* h, uint32_t max_long_cb, srslte_tdec_impl_type_t dec_type);
uint32_t max_long_cb,
srslte_tdec_impl_type_t dec_type);
SRSLTE_API void srslte_tdec_free(srslte_tdec_t * h); SRSLTE_API void srslte_tdec_free(srslte_tdec_t* h);
SRSLTE_API void srslte_tdec_force_not_sb(srslte_tdec_t *h); SRSLTE_API void srslte_tdec_force_not_sb(srslte_tdec_t* h);
SRSLTE_API int srslte_tdec_new_cb(srslte_tdec_t * h, SRSLTE_API int srslte_tdec_new_cb(srslte_tdec_t* h, uint32_t long_cb);
uint32_t long_cb);
SRSLTE_API int srslte_tdec_get_nof_iterations(srslte_tdec_t * h); SRSLTE_API int srslte_tdec_get_nof_iterations(srslte_tdec_t* h);
SRSLTE_API uint32_t srslte_tdec_autoimp_get_subblocks(uint32_t long_cb); SRSLTE_API uint32_t srslte_tdec_autoimp_get_subblocks(uint32_t long_cb);
SRSLTE_API uint32_t srslte_tdec_autoimp_get_subblocks_8bit(uint32_t long_cb); SRSLTE_API uint32_t srslte_tdec_autoimp_get_subblocks_8bit(uint32_t long_cb);
SRSLTE_API void srslte_tdec_iteration(srslte_tdec_t * h, SRSLTE_API void srslte_tdec_iteration(srslte_tdec_t* h, int16_t* input, uint8_t* output);
int16_t* input,
uint8_t *output);
SRSLTE_API int srslte_tdec_run_all(srslte_tdec_t * h,
int16_t * input,
uint8_t *output,
uint32_t nof_iterations,
uint32_t long_cb);
SRSLTE_API void srslte_tdec_iteration_8bit(srslte_tdec_t * h, SRSLTE_API int
int8_t* input, srslte_tdec_run_all(srslte_tdec_t* h, int16_t* input, uint8_t* output, uint32_t nof_iterations, uint32_t long_cb);
uint8_t *output);
SRSLTE_API int srslte_tdec_run_all_8bit(srslte_tdec_t * h, SRSLTE_API void srslte_tdec_iteration_8bit(srslte_tdec_t* h, int8_t* input, uint8_t* output);
int8_t * input,
uint8_t *output,
uint32_t nof_iterations,
uint32_t long_cb);
SRSLTE_API int
srslte_tdec_run_all_8bit(srslte_tdec_t* h, int8_t* input, uint8_t* output, uint32_t nof_iterations, uint32_t long_cb);
#endif // SRSLTE_TURBODECODER_H #endif // SRSLTE_TURBODECODER_H

@ -35,23 +35,28 @@
#define SRSLTE_TURBODECODER_GEN_H #define SRSLTE_TURBODECODER_GEN_H
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/phy/fec/tc_interl.h"
#include "srslte/phy/fec/cbsegm.h" #include "srslte/phy/fec/cbsegm.h"
#include "srslte/phy/fec/tc_interl.h"
#define SRSLTE_TCOD_RATE 3 #define SRSLTE_TCOD_RATE 3
#define SRSLTE_TCOD_TOTALTAIL 12 #define SRSLTE_TCOD_TOTALTAIL 12
#define SRSLTE_TCOD_MAX_LEN_CB 6144 #define SRSLTE_TCOD_MAX_LEN_CB 6144
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_long_cb; uint32_t max_long_cb;
int16_t *beta; int16_t* beta;
} tdec_gen_t; } tdec_gen_t;
int tdec_gen_init(void **h, uint32_t max_long_cb); int tdec_gen_init(void** h, uint32_t max_long_cb);
void tdec_gen_free(void *h); void tdec_gen_free(void* h);
void tdec_gen_dec(void *h, int16_t * input, int16_t *app, int16_t * parity, int16_t *output, uint32_t long_cb); void tdec_gen_dec(void* h, int16_t* input, int16_t* app, int16_t* parity, int16_t* output, uint32_t long_cb);
void tdec_gen_extract_input(int16_t *input, int16_t *syst, int16_t *parity0, int16_t *parity1, int16_t *app2, uint32_t long_cb); void tdec_gen_extract_input(int16_t* input,
void tdec_gen_decision_byte(int16_t *app1, uint8_t *output, uint32_t long_cb); int16_t* syst,
int16_t* parity0,
int16_t* parity1,
int16_t* app2,
uint32_t long_cb);
void tdec_gen_decision_byte(int16_t* app1, uint8_t* output, uint32_t long_cb);
#endif // SRSLTE_TURBODECODER_GEN_H #endif // SRSLTE_TURBODECODER_GEN_H

@ -43,21 +43,20 @@ typedef enum SRSLTE_API {
#define llr_t int8_t #define llr_t int8_t
#define type_name srslte_tdec_8bit_impl_t #define type_name srslte_tdec_8bit_impl_t
#else #else
#ifdef LLR_IS_16BIT #ifdef LLR_IS_16BIT
#define llr_t int16_t #define llr_t int16_t
#define type_name srslte_tdec_16bit_impl_t #define type_name srslte_tdec_16bit_impl_t
#else #else
#error "Unsupported LLR mode" #error "Unsupported LLR mode"
#endif #endif
#endif #endif
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
int (*tdec_init)(void **h, uint32_t max_long_cb); int (*tdec_init)(void** h, uint32_t max_long_cb);
void (*tdec_free)(void *h); void (*tdec_free)(void* h);
void (*tdec_dec)(void *h, llr_t * input, llr_t *app, llr_t * parity, llr_t *output, uint32_t long_cb); void (*tdec_dec)(void* h, llr_t* input, llr_t* app, llr_t* parity, llr_t* output, uint32_t long_cb);
void (*tdec_extract_input)(llr_t *input, llr_t *syst, llr_t *parity0, llr_t *parity1, llr_t *app2, uint32_t long_cb); void (*tdec_extract_input)(llr_t* input, llr_t* syst, llr_t* parity0, llr_t* parity1, llr_t* app2, uint32_t long_cb);
void (*tdec_decision_byte)(llr_t *app1, uint8_t *output, uint32_t long_cb); void (*tdec_decision_byte)(llr_t* app1, uint8_t* output, uint32_t long_cb);
} type_name; } type_name;
#undef llr_t #undef llr_t

@ -21,9 +21,9 @@
#include "srslte/config.h" #include "srslte/config.h"
#define MAKE_CALL(a) CONCAT2(a,type_name) #define MAKE_CALL(a) CONCAT2(a, type_name)
#define MAKE_VEC(a) CONCAT2(a,vec_suffix) #define MAKE_VEC(a) CONCAT2(a, vec_suffix)
#define PRINT CONCAT2(srslte_vec_fprint,print_suffix) #define PRINT CONCAT2(srslte_vec_fprint, print_suffix)
#ifdef LLR_IS_8BIT #ifdef LLR_IS_8BIT
#define llr_t int8_t #define llr_t int8_t
@ -35,59 +35,63 @@
#define input_is_interleaved 1 #define input_is_interleaved 1
#else #else
#ifdef LLR_IS_16BIT #ifdef LLR_IS_16BIT
#define llr_t int16_t #define llr_t int16_t
#define vec_suffix _sss #define vec_suffix _sss
#define print_suffix _s #define print_suffix _s
#define decptr h->dec16[h->current_dec] #define decptr h->dec16[h->current_dec]
#define dechdlr h->dec16_hdlr[h->current_dec] #define dechdlr h->dec16_hdlr[h->current_dec]
#define input_is_interleaved (h->current_dec > 0) #define input_is_interleaved (h->current_dec > 0)
#define type_name _16bit #define type_name _16bit
#else #else
#pragma message "Unsupported LLR mode" #pragma message "Unsupported LLR mode"
#endif #endif
#endif #endif
#define debug_enabled_iter 0 #define debug_enabled_iter 0
#define debug_len 20 #define debug_len 20
#define debug_vec(a) if (debug_enabled_iter) {printf("%s it=%d: ", STRING(a), n_iter);PRINT(stdout, a, debug_len);}
#define debug_vec(a) \
if (debug_enabled_iter) { \
printf("%s it=%d: ", STRING(a), n_iter); \
PRINT(stdout, a, debug_len); \
}
static void MAKE_CALL(extract_input_tail_sb)(llr_t *input, llr_t *syst, llr_t *app2, llr_t *parity0, llr_t *parity1, uint32_t long_cb) static void MAKE_CALL(
extract_input_tail_sb)(llr_t* input, llr_t* syst, llr_t* app2, llr_t* parity0, llr_t* parity1, uint32_t long_cb)
{ {
for (int i = long_cb; i < long_cb + 3; i++) { for (int i = long_cb; i < long_cb + 3; i++) {
syst[i] = input[3*(long_cb+32) + 2*(i - long_cb)]; syst[i] = input[3 * (long_cb + 32) + 2 * (i - long_cb)];
parity0[i] = input[3*(long_cb+32)+ 2*(i - long_cb) + 1]; parity0[i] = input[3 * (long_cb + 32) + 2 * (i - long_cb) + 1];
app2[i] = input[3*(long_cb+32) + 6 + 2*(i - long_cb)]; app2[i] = input[3 * (long_cb + 32) + 6 + 2 * (i - long_cb)];
parity1[i] = input[3*(long_cb+32) + 6 + 2*(i - long_cb) + 1]; parity1[i] = input[3 * (long_cb + 32) + 6 + 2 * (i - long_cb) + 1];
} }
} }
/* Runs 1 turbo decoder iteration */ /* Runs 1 turbo decoder iteration */
void MAKE_CALL(run_tdec_iteration)(srslte_tdec_t * h, llr_t * input) void MAKE_CALL(run_tdec_iteration)(srslte_tdec_t* h, llr_t* input)
{ {
if (h->current_cbidx >= 0) { if (h->current_cbidx >= 0) {
uint16_t *inter = h->interleaver[h->current_inter_idx][h->current_cbidx].forward; uint16_t* inter = h->interleaver[h->current_inter_idx][h->current_cbidx].forward;
uint16_t *deinter = h->interleaver[h->current_inter_idx][h->current_cbidx].reverse; uint16_t* deinter = h->interleaver[h->current_inter_idx][h->current_cbidx].reverse;
llr_t *syst = (llr_t*) h->syst0; llr_t* syst = (llr_t*)h->syst0;
llr_t *parity0 = (llr_t*) h->parity0; llr_t* parity0 = (llr_t*)h->parity0;
llr_t *parity1 = (llr_t*) h->parity1; llr_t* parity1 = (llr_t*)h->parity1;
llr_t *app1 = (llr_t*) h->app1; llr_t* app1 = (llr_t*)h->app1;
llr_t *app2 = (llr_t*) h->app2; llr_t* app2 = (llr_t*)h->app2;
llr_t *ext1 = (llr_t*) h->ext1; llr_t* ext1 = (llr_t*)h->ext1;
llr_t *ext2 = (llr_t*) h->ext2; llr_t* ext2 = (llr_t*)h->ext2;
uint32_t long_cb = h->current_long_cb; uint32_t long_cb = h->current_long_cb;
uint32_t n_iter = h->n_iter; uint32_t n_iter = h->n_iter;
if (SRSLTE_TDEC_EXPECT_INPUT_SB && !h->force_not_sb && input_is_interleaved) { if (SRSLTE_TDEC_EXPECT_INPUT_SB && !h->force_not_sb && input_is_interleaved) {
syst = input; syst = input;
// align to 32 bytes (warning: must be same alignment as in rm_turbo.c) // align to 32 bytes (warning: must be same alignment as in rm_turbo.c)
parity0 = &input[long_cb+32]; parity0 = &input[long_cb + 32];
parity1 = &input[2*(long_cb+32)]; parity1 = &input[2 * (long_cb + 32)];
if (n_iter == 0) { if (n_iter == 0) {
MAKE_CALL(extract_input_tail_sb)(input, syst, app2, parity0, parity1, long_cb); MAKE_CALL(extract_input_tail_sb)(input, syst, app2, parity0, parity1, long_cb);
} }
@ -96,8 +100,8 @@ void MAKE_CALL(run_tdec_iteration)(srslte_tdec_t * h, llr_t * input)
decptr->tdec_extract_input(input, syst, app2, parity0, parity1, long_cb); decptr->tdec_extract_input(input, syst, app2, parity0, parity1, long_cb);
} }
} }
if ((n_iter%2) == 0) { if ((n_iter % 2) == 0) {
// Add apriori information to decoder 1 // Add apriori information to decoder 1
if (n_iter) { if (n_iter) {
@ -106,10 +110,9 @@ void MAKE_CALL(run_tdec_iteration)(srslte_tdec_t * h, llr_t * input)
// Run MAP DEC #1 // Run MAP DEC #1
decptr->tdec_dec(dechdlr, syst, n_iter ? app1 : NULL, parity0, ext1, long_cb); decptr->tdec_dec(dechdlr, syst, n_iter ? app1 : NULL, parity0, ext1, long_cb);
} }
// Interleave extrinsic output of DEC1 to form apriori info for decoder 2 // Interleave extrinsic output of DEC1 to form apriori info for decoder 2
if (n_iter%2) { if (n_iter % 2) {
// Convert aposteriori information into extrinsic information // Convert aposteriori information into extrinsic information
if (n_iter > 1) { if (n_iter > 1) {
MAKE_VEC(srslte_vec_sub)(ext1, app1, ext1, long_cb); MAKE_VEC(srslte_vec_sub)(ext1, app1, ext1, long_cb);
@ -121,8 +124,7 @@ void MAKE_CALL(run_tdec_iteration)(srslte_tdec_t * h, llr_t * input)
decptr->tdec_dec(dechdlr, app2, NULL, parity1, ext2, long_cb); decptr->tdec_dec(dechdlr, app2, NULL, parity1, ext2, long_cb);
// Deinterleaved extrinsic bits become apriori info for decoder 1 // Deinterleaved extrinsic bits become apriori info for decoder 1
MAKE_VEC(srslte_vec_lut)(ext2, inter, app1, long_cb); MAKE_VEC(srslte_vec_lut)(ext2, inter, app1, long_cb);
} }
if (h->n_iter == 0) { if (h->n_iter == 0) {

@ -26,15 +26,19 @@
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t max_long_cb; uint32_t max_long_cb;
int16_t *alpha; int16_t* alpha;
int16_t *branch; int16_t* branch;
} tdec_sse_t; } tdec_sse_t;
int tdec_sse_init(void **h, uint32_t max_long_cb); int tdec_sse_init(void** h, uint32_t max_long_cb);
void tdec_sse_free(void *h); void tdec_sse_free(void* h);
void tdec_sse_dec(void *h, int16_t * input, int16_t *app, int16_t * parity, void tdec_sse_dec(void* h, int16_t* input, int16_t* app, int16_t* parity, int16_t* output, uint32_t long_cb);
int16_t *output, uint32_t long_cb); void tdec_sse_extract_input(int16_t* input,
void tdec_sse_extract_input(int16_t *input, int16_t *syst, int16_t *parity0, int16_t *parity1, int16_t *app2, uint32_t long_cb); int16_t* syst,
void tdec_sse_decision_byte(int16_t *app1, uint8_t *output, uint32_t long_cb); int16_t* parity0,
int16_t* parity1,
int16_t* app2,
uint32_t long_cb);
void tdec_sse_decision_byte(int16_t* app1, uint8_t* output, uint32_t long_cb);
#endif // SRSLTE_TURBODECODER_SSE_H #endif // SRSLTE_TURBODECODER_SSE_H

File diff suppressed because it is too large Load Diff

@ -31,87 +31,65 @@
#ifndef SRSLTE_VITERBI_H #ifndef SRSLTE_VITERBI_H
#define SRSLTE_VITERBI_H #define SRSLTE_VITERBI_H
#include <stdbool.h>
#include "srslte/config.h" #include "srslte/config.h"
#include <stdbool.h>
typedef enum { SRSLTE_VITERBI_27 = 0, SRSLTE_VITERBI_29, SRSLTE_VITERBI_37, SRSLTE_VITERBI_39 } srslte_viterbi_type_t;
typedef struct SRSLTE_API {
typedef enum { void* ptr;
SRSLTE_VITERBI_27 = 0,
SRSLTE_VITERBI_29,
SRSLTE_VITERBI_37,
SRSLTE_VITERBI_39
}srslte_viterbi_type_t;
typedef struct SRSLTE_API{
void *ptr;
uint32_t R; uint32_t R;
uint32_t K; uint32_t K;
uint32_t framebits; uint32_t framebits;
bool tail_biting; bool tail_biting;
float gain_quant; float gain_quant;
int16_t gain_quant_s; int16_t gain_quant_s;
int (*decode) (void*, uint8_t*, uint8_t*, uint32_t); int (*decode)(void*, uint8_t*, uint8_t*, uint32_t);
int (*decode_s) (void*, uint16_t*, uint8_t*, uint32_t); int (*decode_s)(void*, uint16_t*, uint8_t*, uint32_t);
int (*decode_f) (void*, float*, uint8_t*, uint32_t); int (*decode_f)(void*, float*, uint8_t*, uint32_t);
void (*free) (void*); void (*free)(void*);
uint8_t *tmp; uint8_t* tmp;
uint16_t *tmp_s; uint16_t* tmp_s;
uint8_t *symbols_uc; uint8_t* symbols_uc;
uint16_t *symbols_us; uint16_t* symbols_us;
}srslte_viterbi_t; } srslte_viterbi_t;
SRSLTE_API int srslte_viterbi_init(srslte_viterbi_t *q, SRSLTE_API int srslte_viterbi_init(srslte_viterbi_t* q,
srslte_viterbi_type_t type, srslte_viterbi_type_t type,
int poly[3], int poly[3],
uint32_t max_frame_length, uint32_t max_frame_length,
bool tail_bitting); bool tail_bitting);
SRSLTE_API void srslte_viterbi_set_gain_quant(srslte_viterbi_t *q, SRSLTE_API void srslte_viterbi_set_gain_quant(srslte_viterbi_t* q, float gain_quant);
float gain_quant);
SRSLTE_API void srslte_viterbi_set_gain_quant_s(srslte_viterbi_t* q, int16_t gain_quant);
SRSLTE_API void srslte_viterbi_set_gain_quant_s(srslte_viterbi_t *q,
int16_t gain_quant); SRSLTE_API void srslte_viterbi_free(srslte_viterbi_t* q);
SRSLTE_API void srslte_viterbi_free(srslte_viterbi_t *q); SRSLTE_API int srslte_viterbi_decode_f(srslte_viterbi_t* q, float* symbols, uint8_t* data, uint32_t frame_length);
SRSLTE_API int srslte_viterbi_decode_f(srslte_viterbi_t *q, SRSLTE_API int srslte_viterbi_decode_s(srslte_viterbi_t* q, int16_t* symbols, uint8_t* data, uint32_t frame_length);
float *symbols,
uint8_t *data, SRSLTE_API int srslte_viterbi_decode_us(srslte_viterbi_t* q, uint16_t* symbols, uint8_t* data, uint32_t frame_length);
uint32_t frame_length);
SRSLTE_API int srslte_viterbi_decode_uc(srslte_viterbi_t* q, uint8_t* symbols, uint8_t* data, uint32_t frame_length);
SRSLTE_API int srslte_viterbi_decode_s(srslte_viterbi_t *q,
int16_t *symbols, SRSLTE_API int srslte_viterbi_init_sse(srslte_viterbi_t* q,
uint8_t *data, srslte_viterbi_type_t type,
uint32_t frame_length); int poly[3],
uint32_t max_frame_length,
SRSLTE_API int srslte_viterbi_decode_us(srslte_viterbi_t *q, uint16_t *symbols, uint8_t *data, uint32_t frame_length); bool tail_bitting);
SRSLTE_API int srslte_viterbi_decode_uc(srslte_viterbi_t *q, SRSLTE_API int srslte_viterbi_init_neon(srslte_viterbi_t* q,
uint8_t *symbols, srslte_viterbi_type_t type,
uint8_t *data, int poly[3],
uint32_t frame_length); uint32_t max_frame_length,
bool tail_bitting);
SRSLTE_API int srslte_viterbi_init_avx2(srslte_viterbi_t* q,
SRSLTE_API int srslte_viterbi_init_sse(srslte_viterbi_t *q, srslte_viterbi_type_t type,
srslte_viterbi_type_t type, int poly[3],
int poly[3], uint32_t max_frame_length,
uint32_t max_frame_length, bool tail_bitting);
bool tail_bitting);
SRSLTE_API int srslte_viterbi_init_neon(srslte_viterbi_t *q,
srslte_viterbi_type_t type,
int poly[3],
uint32_t max_frame_length,
bool tail_bitting);
SRSLTE_API int srslte_viterbi_init_avx2(srslte_viterbi_t *q,
srslte_viterbi_type_t type,
int poly[3],
uint32_t max_frame_length,
bool tail_bitting);
#endif // SRSLTE_VITERBI_H #endif // SRSLTE_VITERBI_H

@ -30,37 +30,30 @@
#ifndef SRSLTE_BINSOURCE_H #ifndef SRSLTE_BINSOURCE_H
#define SRSLTE_BINSOURCE_H #define SRSLTE_BINSOURCE_H
#include <stdint.h>
#include "srslte/config.h" #include "srslte/config.h"
#include <stdint.h>
/* Low-level API */ /* Low-level API */
typedef struct SRSLTE_API{ typedef struct SRSLTE_API {
uint32_t seed; uint32_t seed;
uint32_t *seq_buff; uint32_t* seq_buff;
int seq_buff_nwords; int seq_buff_nwords;
int seq_cache_nbits; int seq_cache_nbits;
int seq_cache_rp; int seq_cache_rp;
}srslte_binsource_t; } srslte_binsource_t;
SRSLTE_API void srslte_binsource_init(srslte_binsource_t* q); SRSLTE_API void srslte_binsource_init(srslte_binsource_t* q);
SRSLTE_API void srslte_binsource_free(srslte_binsource_t* q); SRSLTE_API void srslte_binsource_free(srslte_binsource_t* q);
SRSLTE_API void srslte_binsource_seed_set(srslte_binsource_t* q, SRSLTE_API void srslte_binsource_seed_set(srslte_binsource_t* q, uint32_t seed);
uint32_t seed);
SRSLTE_API void srslte_binsource_seed_time(srslte_binsource_t *q); SRSLTE_API void srslte_binsource_seed_time(srslte_binsource_t* q);
SRSLTE_API int srslte_binsource_cache_gen(srslte_binsource_t* q, SRSLTE_API int srslte_binsource_cache_gen(srslte_binsource_t* q, int nbits);
int nbits);
SRSLTE_API void srslte_binsource_cache_cpy(srslte_binsource_t* q, SRSLTE_API void srslte_binsource_cache_cpy(srslte_binsource_t* q, uint8_t* bits, int nbits);
uint8_t *bits,
int nbits);
SRSLTE_API int srslte_binsource_generate(srslte_binsource_t* q, SRSLTE_API int srslte_binsource_generate(srslte_binsource_t* q, uint8_t* bits, int nbits);
uint8_t *bits,
int nbits);
#endif // SRSLTE_BINSOURCE_H #endif // SRSLTE_BINSOURCE_H

@ -41,23 +41,16 @@
/* Low-level API */ /* Low-level API */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
FILE *f; FILE* f;
srslte_datatype_t type; srslte_datatype_t type;
} srslte_filesink_t; } srslte_filesink_t;
SRSLTE_API int srslte_filesink_init(srslte_filesink_t *q, SRSLTE_API int srslte_filesink_init(srslte_filesink_t* q, char* filename, srslte_datatype_t type);
char *filename,
srslte_datatype_t type);
SRSLTE_API void srslte_filesink_free(srslte_filesink_t *q); SRSLTE_API void srslte_filesink_free(srslte_filesink_t* q);
SRSLTE_API int srslte_filesink_write(srslte_filesink_t *q, SRSLTE_API int srslte_filesink_write(srslte_filesink_t* q, void* buffer, int nsamples);
void *buffer,
int nsamples);
SRSLTE_API int srslte_filesink_write_multi(srslte_filesink_t *q, SRSLTE_API int srslte_filesink_write_multi(srslte_filesink_t* q, void** buffer, int nsamples, int nchannels);
void **buffer,
int nsamples,
int nchannels);
#endif // SRSLTE_FILESINK_H #endif // SRSLTE_FILESINK_H

@ -40,26 +40,18 @@
/* Low-level API */ /* Low-level API */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
FILE *f; FILE* f;
srslte_datatype_t type; srslte_datatype_t type;
} srslte_filesource_t; } srslte_filesource_t;
SRSLTE_API int srslte_filesource_init(srslte_filesource_t *q, SRSLTE_API int srslte_filesource_init(srslte_filesource_t* q, char* filename, srslte_datatype_t type);
char *filename,
srslte_datatype_t type);
SRSLTE_API void srslte_filesource_free(srslte_filesource_t *q); SRSLTE_API void srslte_filesource_free(srslte_filesource_t* q);
SRSLTE_API void srslte_filesource_seek(srslte_filesource_t *q, SRSLTE_API void srslte_filesource_seek(srslte_filesource_t* q, int pos);
int pos);
SRSLTE_API int srslte_filesource_read(srslte_filesource_t *q, SRSLTE_API int srslte_filesource_read(srslte_filesource_t* q, void* buffer, int nsamples);
void *buffer,
int nsamples);
SRSLTE_API int srslte_filesource_read_multi(srslte_filesource_t *q, SRSLTE_API int srslte_filesource_read_multi(srslte_filesource_t* q, void** buffer, int nsamples, int nof_channels);
void **buffer,
int nsamples,
int nof_channels);
#endif // SRSLTE_FILESOURCE_H #endif // SRSLTE_FILESOURCE_H

@ -24,12 +24,12 @@
typedef enum { typedef enum {
SRSLTE_TEXT, SRSLTE_TEXT,
SRSLTE_FLOAT, SRSLTE_FLOAT,
SRSLTE_COMPLEX_FLOAT, SRSLTE_COMPLEX_FLOAT,
SRSLTE_COMPLEX_SHORT, SRSLTE_COMPLEX_SHORT,
SRSLTE_FLOAT_BIN, SRSLTE_FLOAT_BIN,
SRSLTE_COMPLEX_FLOAT_BIN, SRSLTE_COMPLEX_FLOAT_BIN,
SRSLTE_COMPLEX_SHORT_BIN SRSLTE_COMPLEX_SHORT_BIN
} srslte_datatype_t; } srslte_datatype_t;
#endif // SRSLTE_FORMAT_H #endif // SRSLTE_FORMAT_H

@ -31,39 +31,31 @@
#ifndef SRSLTE_NETSINK_H #ifndef SRSLTE_NETSINK_H
#define SRSLTE_NETSINK_H #define SRSLTE_NETSINK_H
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <sys/socket.h>
#include "srslte/config.h" #include "srslte/config.h"
typedef enum { typedef enum { SRSLTE_NETSINK_UDP, SRSLTE_NETSINK_TCP } srslte_netsink_type_t;
SRSLTE_NETSINK_UDP,
SRSLTE_NETSINK_TCP
} srslte_netsink_type_t;
/* Low-level API */ /* Low-level API */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
int sockfd; int sockfd;
bool connected; bool connected;
srslte_netsink_type_t type; srslte_netsink_type_t type;
struct sockaddr_in servaddr; struct sockaddr_in servaddr;
}srslte_netsink_t; } srslte_netsink_t;
SRSLTE_API int srslte_netsink_init(srslte_netsink_t *q, SRSLTE_API int srslte_netsink_init(srslte_netsink_t* q, const char* address, uint16_t port, srslte_netsink_type_t type);
const char *address,
uint16_t port,
srslte_netsink_type_t type);
SRSLTE_API void srslte_netsink_free(srslte_netsink_t *q); SRSLTE_API void srslte_netsink_free(srslte_netsink_t* q);
SRSLTE_API int srslte_netsink_write(srslte_netsink_t *q, SRSLTE_API int srslte_netsink_write(srslte_netsink_t* q, void* buffer, int nof_bytes);
void *buffer,
int nof_bytes);
SRSLTE_API int srslte_netsink_set_nonblocking(srslte_netsink_t *q); SRSLTE_API int srslte_netsink_set_nonblocking(srslte_netsink_t* q);
#endif // SRSLTE_NETSINK_H #endif // SRSLTE_NETSINK_H

@ -31,45 +31,37 @@
#ifndef SRSLTE_NETSOURCE_H #ifndef SRSLTE_NETSOURCE_H
#define SRSLTE_NETSOURCE_H #define SRSLTE_NETSOURCE_H
#include <stdbool.h>
#include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <stdio.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/socket.h>
#include "srslte/config.h" #include "srslte/config.h"
typedef enum { typedef enum { SRSLTE_NETSOURCE_UDP, SRSLTE_NETSOURCE_TCP } srslte_netsource_type_t;
SRSLTE_NETSOURCE_UDP,
SRSLTE_NETSOURCE_TCP
} srslte_netsource_type_t;
/* Low-level API */ /* Low-level API */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
int sockfd; int sockfd;
int connfd; int connfd;
struct sockaddr_in servaddr; struct sockaddr_in servaddr;
srslte_netsource_type_t type; srslte_netsource_type_t type;
struct sockaddr_in cliaddr; struct sockaddr_in cliaddr;
}srslte_netsource_t; } srslte_netsource_t;
SRSLTE_API int srslte_netsource_init(srslte_netsource_t *q, SRSLTE_API int
const char *address, srslte_netsource_init(srslte_netsource_t* q, const char* address, uint16_t port, srslte_netsource_type_t type);
uint16_t port,
srslte_netsource_type_t type);
SRSLTE_API void srslte_netsource_free(srslte_netsource_t *q); SRSLTE_API void srslte_netsource_free(srslte_netsource_t* q);
SRSLTE_API int srslte_netsource_set_nonblocking(srslte_netsource_t *q); SRSLTE_API int srslte_netsource_set_nonblocking(srslte_netsource_t* q);
SRSLTE_API int srslte_netsource_read(srslte_netsource_t *q, SRSLTE_API int srslte_netsource_read(srslte_netsource_t* q, void* buffer, int nof_bytes);
void *buffer,
int nof_bytes);
SRSLTE_API int srslte_netsource_write(srslte_netsource_t* q, void* buffer, int nbytes); SRSLTE_API int srslte_netsource_write(srslte_netsource_t* q, void* buffer, int nbytes);
SRSLTE_API int srslte_netsource_set_timeout(srslte_netsource_t *q, SRSLTE_API int srslte_netsource_set_timeout(srslte_netsource_t* q, uint32_t microseconds);
uint32_t microseconds);
#endif // SRSLTE_NETSOURCE_H #endif // SRSLTE_NETSOURCE_H

@ -37,20 +37,15 @@
/* Generates the vector of layer-mapped symbols "x" based on the vector of data symbols "d" /* Generates the vector of layer-mapped symbols "x" based on the vector of data symbols "d"
*/ */
SRSLTE_API int srslte_layermap_single(cf_t *d, SRSLTE_API int srslte_layermap_single(cf_t* d, cf_t* x, int nof_symbols);
cf_t *x,
int nof_symbols);
SRSLTE_API int srslte_layermap_diversity(cf_t *d, SRSLTE_API int srslte_layermap_diversity(cf_t* d, cf_t* x[SRSLTE_MAX_LAYERS], int nof_layers, int nof_symbols);
cf_t *x[SRSLTE_MAX_LAYERS],
int nof_layers,
int nof_symbols);
SRSLTE_API int srslte_layermap_multiplex(cf_t *d[SRSLTE_MAX_CODEWORDS], SRSLTE_API int srslte_layermap_multiplex(cf_t* d[SRSLTE_MAX_CODEWORDS],
cf_t *x[SRSLTE_MAX_LAYERS], cf_t* x[SRSLTE_MAX_LAYERS],
int nof_cw, int nof_cw,
int nof_layers, int nof_layers,
int nof_symbols[SRSLTE_MAX_CODEWORDS]); int nof_symbols[SRSLTE_MAX_CODEWORDS]);
SRSLTE_API int srslte_layermap_type(cf_t* d[SRSLTE_MAX_CODEWORDS], SRSLTE_API int srslte_layermap_type(cf_t* d[SRSLTE_MAX_CODEWORDS],
cf_t* x[SRSLTE_MAX_LAYERS], cf_t* x[SRSLTE_MAX_LAYERS],
@ -61,21 +56,16 @@ SRSLTE_API int srslte_layermap_type(cf_t* d[SRSLTE_MAX_CODEWORDS],
/* Generates the vector of data symbols "d" based on the vector of layer-mapped symbols "x" /* Generates the vector of data symbols "d" based on the vector of layer-mapped symbols "x"
*/ */
SRSLTE_API int srslte_layerdemap_single(cf_t *x, SRSLTE_API int srslte_layerdemap_single(cf_t* x, cf_t* d, int nof_symbols);
cf_t *d,
int nof_symbols);
SRSLTE_API int srslte_layerdemap_diversity(cf_t *x[SRSLTE_MAX_LAYERS], SRSLTE_API int srslte_layerdemap_diversity(cf_t* x[SRSLTE_MAX_LAYERS], cf_t* d, int nof_layers, int nof_layer_symbols);
cf_t *d,
int nof_layers,
int nof_layer_symbols);
SRSLTE_API int srslte_layerdemap_multiplex(cf_t *x[SRSLTE_MAX_LAYERS], SRSLTE_API int srslte_layerdemap_multiplex(cf_t* x[SRSLTE_MAX_LAYERS],
cf_t *d[SRSLTE_MAX_CODEWORDS], cf_t* d[SRSLTE_MAX_CODEWORDS],
int nof_layers, int nof_layers,
int nof_cw, int nof_cw,
int nof_layer_symbols, int nof_layer_symbols,
int nof_symbols[SRSLTE_MAX_CODEWORDS]); int nof_symbols[SRSLTE_MAX_CODEWORDS]);
SRSLTE_API int srslte_layerdemap_type(cf_t* x[SRSLTE_MAX_LAYERS], SRSLTE_API int srslte_layerdemap_type(cf_t* x[SRSLTE_MAX_LAYERS],
cf_t* d[SRSLTE_MAX_CODEWORDS], cf_t* d[SRSLTE_MAX_CODEWORDS],

@ -39,25 +39,21 @@
* resources on each of the antenna ports. * resources on each of the antenna ports.
*/ */
/* Generates the vector "y" from the input vector "x" /* Generates the vector "y" from the input vector "x"
*/ */
SRSLTE_API int srslte_precoding_single(cf_t *x, SRSLTE_API int srslte_precoding_single(cf_t* x, cf_t* y, int nof_symbols, float scaling);
cf_t *y,
int nof_symbols, SRSLTE_API int srslte_precoding_diversity(cf_t* x[SRSLTE_MAX_LAYERS],
float scaling); cf_t* y[SRSLTE_MAX_PORTS],
int nof_ports,
SRSLTE_API int srslte_precoding_diversity(cf_t *x[SRSLTE_MAX_LAYERS], int nof_symbols,
cf_t *y[SRSLTE_MAX_PORTS],
int nof_ports,
int nof_symbols,
float scaling); float scaling);
SRSLTE_API int srslte_precoding_cdd(cf_t *x[SRSLTE_MAX_LAYERS], SRSLTE_API int srslte_precoding_cdd(cf_t* x[SRSLTE_MAX_LAYERS],
cf_t *y[SRSLTE_MAX_PORTS], cf_t* y[SRSLTE_MAX_PORTS],
int nof_layers, int nof_layers,
int nof_ports, int nof_ports,
int nof_symbols, int nof_symbols,
float scaling); float scaling);
SRSLTE_API int srslte_precoding_type(cf_t* x[SRSLTE_MAX_LAYERS], SRSLTE_API int srslte_precoding_type(cf_t* x[SRSLTE_MAX_LAYERS],
@ -71,40 +67,35 @@ SRSLTE_API int srslte_precoding_type(cf_t* x[SRSLTE_MAX_LAYERS],
/* Estimates the vector "x" based on the received signal "y" and the channel estimates "h" /* Estimates the vector "x" based on the received signal "y" and the channel estimates "h"
*/ */
SRSLTE_API int srslte_predecoding_single(cf_t *y, SRSLTE_API int
cf_t *h, srslte_predecoding_single(cf_t* y, cf_t* h, cf_t* x, float* csi, int nof_symbols, float scaling, float noise_estimate);
cf_t *x,
float *csi, SRSLTE_API int srslte_predecoding_single_multi(cf_t* y[SRSLTE_MAX_PORTS],
int nof_symbols, cf_t* h[SRSLTE_MAX_PORTS],
float scaling, cf_t* x,
float noise_estimate); float* csi[SRSLTE_MAX_CODEWORDS],
int nof_rxant,
SRSLTE_API int srslte_predecoding_single_multi(cf_t *y[SRSLTE_MAX_PORTS], int nof_symbols,
cf_t *h[SRSLTE_MAX_PORTS], float scaling,
cf_t *x, float noise_estimate);
float *csi[SRSLTE_MAX_CODEWORDS],
int nof_rxant, SRSLTE_API int srslte_predecoding_diversity(cf_t* y,
int nof_symbols, cf_t* h[SRSLTE_MAX_PORTS],
float scaling, cf_t* x[SRSLTE_MAX_LAYERS],
float noise_estimate); int nof_ports,
int nof_symbols,
SRSLTE_API int srslte_predecoding_diversity(cf_t *y,
cf_t *h[SRSLTE_MAX_PORTS],
cf_t *x[SRSLTE_MAX_LAYERS],
int nof_ports,
int nof_symbols,
float scaling); float scaling);
SRSLTE_API int srslte_predecoding_diversity_multi(cf_t *y[SRSLTE_MAX_PORTS], SRSLTE_API int srslte_predecoding_diversity_multi(cf_t* y[SRSLTE_MAX_PORTS],
cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS],
cf_t *x[SRSLTE_MAX_LAYERS], cf_t* x[SRSLTE_MAX_LAYERS],
float *csi[SRSLTE_MAX_LAYERS], float* csi[SRSLTE_MAX_LAYERS],
int nof_rxant, int nof_rxant,
int nof_ports, int nof_ports,
int nof_symbols, int nof_symbols,
float scaling); float scaling);
SRSLTE_API void srslte_predecoding_set_mimo_decoder (srslte_mimo_decoder_t _mimo_decoder); SRSLTE_API void srslte_predecoding_set_mimo_decoder(srslte_mimo_decoder_t _mimo_decoder);
SRSLTE_API int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS], SRSLTE_API int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS],
cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS],
@ -119,18 +110,17 @@ SRSLTE_API int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS],
float scaling, float scaling,
float noise_estimate); float noise_estimate);
SRSLTE_API int srslte_precoding_pmi_select(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], SRSLTE_API int srslte_precoding_pmi_select(cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS],
uint32_t nof_symbols, uint32_t nof_symbols,
float noise_estimate, float noise_estimate,
int nof_layers, int nof_layers,
uint32_t *pmi, uint32_t* pmi,
float sinr[SRSLTE_MAX_CODEBOOKS]); float sinr[SRSLTE_MAX_CODEBOOKS]);
SRSLTE_API int srslte_precoding_cn(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], SRSLTE_API int srslte_precoding_cn(cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS],
uint32_t nof_tx_antennas, uint32_t nof_tx_antennas,
uint32_t nof_rx_antennas, uint32_t nof_rx_antennas,
uint32_t nof_symbols, uint32_t nof_symbols,
float *cn); float* cn);
#endif // SRSLTE_PRECODING_H #endif // SRSLTE_PRECODING_H

@ -33,22 +33,19 @@
#include <stdint.h> #include <stdint.h>
#include "srslte/config.h"
#include "modem_table.h" #include "modem_table.h"
#include "srslte/config.h"
typedef _Complex float cf_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
srslte_mod_t mod; /* In this implementation, mapping table is hard-coded */ srslte_mod_t mod; /* In this implementation, mapping table is hard-coded */
}srslte_demod_hard_t; } srslte_demod_hard_t;
SRSLTE_API void srslte_demod_hard_init(srslte_demod_hard_t* q); SRSLTE_API void srslte_demod_hard_init(srslte_demod_hard_t* q);
SRSLTE_API void srslte_demod_hard_table_set(srslte_demod_hard_t* q, SRSLTE_API void srslte_demod_hard_table_set(srslte_demod_hard_t* q, srslte_mod_t mod);
srslte_mod_t mod);
SRSLTE_API int srslte_demod_hard_demodulate(srslte_demod_hard_t* q, SRSLTE_API int srslte_demod_hard_demodulate(srslte_demod_hard_t* q, cf_t* symbols, uint8_t* bits, uint32_t nsymbols);
cf_t* symbols,
uint8_t *bits,
uint32_t nsymbols);
#endif // SRSLTE_DEMOD_HARD_H #endif // SRSLTE_DEMOD_HARD_H

@ -33,23 +33,13 @@
#include <stdint.h> #include <stdint.h>
#include "srslte/config.h"
#include "modem_table.h" #include "modem_table.h"
#include "srslte/config.h"
SRSLTE_API int srslte_demod_soft_demodulate(srslte_mod_t modulation, const cf_t* symbols, float* llr, int nsymbols);
SRSLTE_API int srslte_demod_soft_demodulate(srslte_mod_t modulation, SRSLTE_API int srslte_demod_soft_demodulate_s(srslte_mod_t modulation, const cf_t* symbols, short* llr, int nsymbols);
const cf_t* symbols,
float* llr,
int nsymbols);
SRSLTE_API int srslte_demod_soft_demodulate_s(srslte_mod_t modulation,
const cf_t* symbols,
short* llr,
int nsymbols);
SRSLTE_API int srslte_demod_soft_demodulate_b(srslte_mod_t modulation, SRSLTE_API int srslte_demod_soft_demodulate_b(srslte_mod_t modulation, const cf_t* symbols, int8_t* llr, int nsymbols);
const cf_t* symbols,
int8_t* llr,
int nsymbols);
#endif // SRSLTE_DEMOD_SOFT_H #endif // SRSLTE_DEMOD_SOFT_H

@ -33,17 +33,11 @@
#include <stdint.h> #include <stdint.h>
#include "srslte/config.h"
#include "modem_table.h" #include "modem_table.h"
#include "srslte/config.h"
SRSLTE_API int srslte_mod_modulate(srslte_modem_table_t* table, SRSLTE_API int srslte_mod_modulate(srslte_modem_table_t* table, uint8_t* bits, cf_t* symbols, uint32_t nbits);
uint8_t *bits,
cf_t* symbols,
uint32_t nbits);
SRSLTE_API int srslte_mod_modulate_bytes(srslte_modem_table_t* q, SRSLTE_API int srslte_mod_modulate_bytes(srslte_modem_table_t* q, uint8_t* bits, cf_t* symbols, uint32_t nbits);
uint8_t *bits,
cf_t* symbols,
uint32_t nbits);
#endif // SRSLTE_MOD_H #endif // SRSLTE_MOD_H

@ -34,8 +34,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "srslte/phy/common/phy_common.h"
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/phy/common/phy_common.h"
typedef struct { typedef struct {
cf_t symbol[8]; cf_t symbol[8];
@ -54,17 +54,16 @@ typedef struct {
} qam256_packed_t; } qam256_packed_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
cf_t* symbol_table; // bit-to-symbol mapping cf_t* symbol_table; // bit-to-symbol mapping
uint32_t nsymbols; // number of modulation symbols uint32_t nsymbols; // number of modulation symbols
uint32_t nbits_x_symbol; // number of bits per symbol uint32_t nbits_x_symbol; // number of bits per symbol
bool byte_tables_init; bool byte_tables_init;
bpsk_packed_t *symbol_table_bpsk; bpsk_packed_t* symbol_table_bpsk;
qpsk_packed_t *symbol_table_qpsk; qpsk_packed_t* symbol_table_qpsk;
qam16_packed_t* symbol_table_16qam; qam16_packed_t* symbol_table_16qam;
qam256_packed_t* symbol_table_256qam; qam256_packed_t* symbol_table_256qam;
}srslte_modem_table_t; } srslte_modem_table_t;
SRSLTE_API void srslte_modem_table_init(srslte_modem_table_t* q); SRSLTE_API void srslte_modem_table_init(srslte_modem_table_t* q);
@ -72,14 +71,10 @@ SRSLTE_API void srslte_modem_table_free(srslte_modem_table_t* q);
SRSLTE_API void srslte_modem_table_reset(srslte_modem_table_t* q); SRSLTE_API void srslte_modem_table_reset(srslte_modem_table_t* q);
SRSLTE_API int srslte_modem_table_set(srslte_modem_table_t* q, SRSLTE_API int srslte_modem_table_set(srslte_modem_table_t* q, cf_t* table, uint32_t nsymbols, uint32_t nbits_x_symbol);
cf_t* table,
uint32_t nsymbols,
uint32_t nbits_x_symbol);
SRSLTE_API int srslte_modem_table_lte(srslte_modem_table_t* q, SRSLTE_API int srslte_modem_table_lte(srslte_modem_table_t* q, srslte_mod_t modulation);
srslte_mod_t modulation);
SRSLTE_API void srslte_modem_table_bytes(srslte_modem_table_t* q); SRSLTE_API void srslte_modem_table_bytes(srslte_modem_table_t* q);
#endif // SRSLTE_MODEM_TABLE_H #endif // SRSLTE_MODEM_TABLE_H

@ -56,7 +56,7 @@ typedef struct {
bool periodic_configured; bool periodic_configured;
bool aperiodic_configured; bool aperiodic_configured;
uint32_t pmi_idx; uint32_t pmi_idx;
uint32_t ri_idx; uint32_t ri_idx;
bool ri_idx_present; bool ri_idx_present;
bool format_is_subband; bool format_is_subband;
uint32_t subband_size; uint32_t subband_size;
@ -72,11 +72,11 @@ typedef struct {
reports (transmission mode 4, transmission mode 5 and transmission mode 6). */ reports (transmission mode 4, transmission mode 5 and transmission mode 6). */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint8_t wideband_cqi_cw0; // 4-bit width uint8_t wideband_cqi_cw0; // 4-bit width
uint32_t subband_diff_cqi_cw0; // 2N-bit width uint32_t subband_diff_cqi_cw0; // 2N-bit width
uint8_t wideband_cqi_cw1; // if RI > 1 then 4-bit width otherwise 0-bit width uint8_t wideband_cqi_cw1; // if RI > 1 then 4-bit width otherwise 0-bit width
uint32_t subband_diff_cqi_cw1; // if RI > 1 then 2N-bit width otherwise 0-bit width uint32_t subband_diff_cqi_cw1; // if RI > 1 then 2N-bit width otherwise 0-bit width
uint32_t pmi; // if RI > 1 then 2-bit width otherwise 1-bit width uint32_t pmi; // if RI > 1 then 2-bit width otherwise 1-bit width
} srslte_cqi_hl_subband_t; } srslte_cqi_hl_subband_t;
/* Table 5.2.2.6.3-1: Fields for channel quality information feedback for UE selected subband CQI /* Table 5.2.2.6.3-1: Fields for channel quality information feedback for UE selected subband CQI
@ -84,14 +84,14 @@ reports
(transmission mode 1, transmission mode 2, transmission mode 3, transmission mode 7 and (transmission mode 1, transmission mode 2, transmission mode 3, transmission mode 7 and
transmission mode 8 configured without PMI/RI reporting). */ transmission mode 8 configured without PMI/RI reporting). */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint8_t wideband_cqi; // 4-bit width uint8_t wideband_cqi; // 4-bit width
uint8_t subband_diff_cqi; // 2-bit width uint8_t subband_diff_cqi; // 2-bit width
uint32_t position_subband; // L-bit width uint32_t position_subband; // L-bit width
} srslte_cqi_ue_subband_t; } srslte_cqi_ue_subband_t;
/* Table 5.2.3.3.1-1: Fields for channel quality information feedback for wideband CQI reports /* Table 5.2.3.3.1-1: Fields for channel quality information feedback for wideband CQI reports
(transmission mode 1, transmission mode 2, transmission mode 3, transmission mode 7 and (transmission mode 1, transmission mode 2, transmission mode 3, transmission mode 7 and
transmission mode 8 configured without PMI/RI reporting). transmission mode 8 configured without PMI/RI reporting).
This is for PUCCH Format 2 reports This is for PUCCH Format 2 reports
*/ */
@ -101,14 +101,14 @@ This is for PUCCH Format 2 reports
*/ */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint8_t wideband_cqi; // 4-bit width uint8_t wideband_cqi; // 4-bit width
uint8_t spatial_diff_cqi; // If Rank==1 then it is 0-bit width otherwise it is 3-bit width uint8_t spatial_diff_cqi; // If Rank==1 then it is 0-bit width otherwise it is 3-bit width
uint8_t pmi; uint8_t pmi;
} srslte_cqi_format2_wideband_t; } srslte_cqi_format2_wideband_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint8_t subband_cqi; // 4-bit width uint8_t subband_cqi; // 4-bit width
uint8_t subband_label; // 1- or 2-bit width uint8_t subband_label; // 1- or 2-bit width
} srslte_cqi_format2_subband_t; } srslte_cqi_format2_subband_t;
typedef enum { typedef enum {
@ -134,7 +134,7 @@ typedef struct SRSLTE_API {
typedef struct { typedef struct {
union { union {
srslte_cqi_format2_wideband_t wideband; srslte_cqi_format2_wideband_t wideband;
srslte_cqi_format2_subband_t subband; srslte_cqi_format2_subband_t subband;
srslte_cqi_ue_subband_t subband_ue; srslte_cqi_ue_subband_t subband_ue;
srslte_cqi_hl_subband_t subband_hl; srslte_cqi_hl_subband_t subband_hl;
}; };
@ -145,20 +145,17 @@ SRSLTE_API int srslte_cqi_size(srslte_cqi_cfg_t* cfg);
SRSLTE_API int srslte_cqi_value_pack(srslte_cqi_cfg_t* cfg, srslte_cqi_value_t* value, uint8_t* buff); SRSLTE_API int srslte_cqi_value_pack(srslte_cqi_cfg_t* cfg, srslte_cqi_value_t* value, uint8_t* buff);
SRSLTE_API int srslte_cqi_value_unpack(srslte_cqi_cfg_t* cfg, SRSLTE_API int
uint8_t buff[SRSLTE_CQI_MAX_BITS], srslte_cqi_value_unpack(srslte_cqi_cfg_t* cfg, uint8_t buff[SRSLTE_CQI_MAX_BITS], srslte_cqi_value_t* value);
srslte_cqi_value_t* value);
SRSLTE_API int srslte_cqi_value_tostring(srslte_cqi_cfg_t* cfg, SRSLTE_API int
srslte_cqi_value_t* value, srslte_cqi_value_tostring(srslte_cqi_cfg_t* cfg, srslte_cqi_value_t* value, char* buff, uint32_t buff_len);
char* buff,
uint32_t buff_len);
SRSLTE_API bool srslte_cqi_periodic_send(srslte_cqi_report_cfg_t* periodic_cfg,uint32_t tti, srslte_frame_type_t frame_type); SRSLTE_API bool
srslte_cqi_periodic_send(srslte_cqi_report_cfg_t* periodic_cfg, uint32_t tti, srslte_frame_type_t frame_type);
SRSLTE_API bool srslte_cqi_periodic_ri_send(srslte_cqi_report_cfg_t* periodic_cfg, SRSLTE_API bool
uint32_t tti, srslte_cqi_periodic_ri_send(srslte_cqi_report_cfg_t* periodic_cfg, uint32_t tti, srslte_frame_type_t frame_type);
srslte_frame_type_t frame_type);
SRSLTE_API int srslte_cqi_hl_get_no_subbands(int nof_prb); SRSLTE_API int srslte_cqi_hl_get_no_subbands(int nof_prb);

@ -22,8 +22,8 @@
/****************************************************************************** /******************************************************************************
* File: dci.h * File: dci.h
* *
* Description: Downlink control information (DCI). * Description: Downlink control information (DCI).
* Packing/Unpacking functions to convert between bit streams * Packing/Unpacking functions to convert between bit streams
* and packed DCI UL/DL grants defined in ra.h * and packed DCI UL/DL grants defined in ra.h
* *
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.3.3 * Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.3.3
@ -38,7 +38,7 @@
#include "srslte/phy/common/phy_common.h" #include "srslte/phy/common/phy_common.h"
#include "srslte/phy/phch/ra.h" #include "srslte/phy/phch/ra.h"
#define SRSLTE_DCI_MAX_BITS 128 #define SRSLTE_DCI_MAX_BITS 128
#define SRSLTE_RAR_GRANT_LEN 20 #define SRSLTE_RAR_GRANT_LEN 20
#define SRSLTE_DCI_IS_TB_EN(tb) (!(tb.mcs_idx == 0 && tb.rv == 1)) #define SRSLTE_DCI_IS_TB_EN(tb) (!(tb.mcs_idx == 0 && tb.rv == 1))
@ -180,7 +180,7 @@ typedef struct SRSLTE_API {
uint32_t rba; uint32_t rba;
uint32_t trunc_mcs; uint32_t trunc_mcs;
uint32_t tpc_pusch; uint32_t tpc_pusch;
bool ul_delay; bool ul_delay;
bool cqi_request; bool cqi_request;
bool hopping_flag; bool hopping_flag;
} srslte_dci_rar_grant_t; } srslte_dci_rar_grant_t;
@ -191,44 +191,40 @@ SRSLTE_API void srslte_dci_rar_pack(srslte_dci_rar_grant_t* rar, uint8_t payload
SRSLTE_API int srslte_dci_rar_to_ul_dci(srslte_cell_t* cell, srslte_dci_rar_grant_t* rar, srslte_dci_ul_t* dci_ul); SRSLTE_API int srslte_dci_rar_to_ul_dci(srslte_cell_t* cell, srslte_dci_rar_grant_t* rar, srslte_dci_ul_t* dci_ul);
SRSLTE_API int srslte_dci_msg_pack_pusch(srslte_cell_t* cell, SRSLTE_API int srslte_dci_msg_pack_pusch(srslte_cell_t* cell,
srslte_dl_sf_cfg_t* sf, srslte_dl_sf_cfg_t* sf,
srslte_dci_cfg_t* cfg, srslte_dci_cfg_t* cfg,
srslte_dci_ul_t* dci, srslte_dci_ul_t* dci,
srslte_dci_msg_t* msg); srslte_dci_msg_t* msg);
SRSLTE_API int srslte_dci_msg_unpack_pusch(srslte_cell_t* cell, SRSLTE_API int srslte_dci_msg_unpack_pusch(srslte_cell_t* cell,
srslte_dl_sf_cfg_t* sf, srslte_dl_sf_cfg_t* sf,
srslte_dci_cfg_t* cfg, srslte_dci_cfg_t* cfg,
srslte_dci_msg_t* msg, srslte_dci_msg_t* msg,
srslte_dci_ul_t* dci); srslte_dci_ul_t* dci);
SRSLTE_API int srslte_dci_msg_pack_pdsch(srslte_cell_t* cell, SRSLTE_API int srslte_dci_msg_pack_pdsch(srslte_cell_t* cell,
srslte_dl_sf_cfg_t* sf, srslte_dl_sf_cfg_t* sf,
srslte_dci_cfg_t* cfg, srslte_dci_dl_t* dci, srslte_dci_msg_t* msg); srslte_dci_cfg_t* cfg,
srslte_dci_dl_t* dci,
srslte_dci_msg_t* msg);
SRSLTE_API int srslte_dci_msg_unpack_pdsch(srslte_cell_t* cell, SRSLTE_API int srslte_dci_msg_unpack_pdsch(srslte_cell_t* cell,
srslte_dl_sf_cfg_t* sf, srslte_dl_sf_cfg_t* sf,
srslte_dci_cfg_t* cfg, srslte_dci_cfg_t* cfg,
srslte_dci_msg_t* msg, srslte_dci_msg_t* msg,
srslte_dci_dl_t* dci); srslte_dci_dl_t* dci);
SRSLTE_API uint32_t srslte_dci_format_sizeof(srslte_cell_t* cell, SRSLTE_API uint32_t srslte_dci_format_sizeof(srslte_cell_t* cell,
srslte_dl_sf_cfg_t* sf, srslte_dl_sf_cfg_t* sf,
srslte_dci_cfg_t* cfg, srslte_dci_cfg_t* cfg,
srslte_dci_format_t format); srslte_dci_format_t format);
SRSLTE_API void srslte_dci_dl_fprint(FILE* f, SRSLTE_API void srslte_dci_dl_fprint(FILE* f, srslte_dci_dl_t* dci, uint32_t nof_prb);
srslte_dci_dl_t* dci,
uint32_t nof_prb);
SRSLTE_API uint32_t srslte_dci_dl_info(srslte_dci_dl_t* dci_dl, SRSLTE_API uint32_t srslte_dci_dl_info(srslte_dci_dl_t* dci_dl, char* str, uint32_t str_len);
char* str,
uint32_t str_len);
SRSLTE_API uint32_t srslte_dci_ul_info(srslte_dci_ul_t* dci_ul, SRSLTE_API uint32_t srslte_dci_ul_info(srslte_dci_ul_t* dci_ul, char* info_str, uint32_t len);
char* info_str,
uint32_t len);
SRSLTE_API srslte_dci_format_t srslte_dci_format_from_string(char* str); SRSLTE_API srslte_dci_format_t srslte_dci_format_from_string(char* str);
@ -236,9 +232,7 @@ SRSLTE_API char* srslte_dci_format_string(srslte_dci_format_t format);
SRSLTE_API char* srslte_dci_format_string_short(srslte_dci_format_t format); SRSLTE_API char* srslte_dci_format_string_short(srslte_dci_format_t format);
SRSLTE_API int srslte_dci_location_set(srslte_dci_location_t* c, SRSLTE_API int srslte_dci_location_set(srslte_dci_location_t* c, uint32_t L, uint32_t nCCE);
uint32_t L,
uint32_t nCCE);
SRSLTE_API bool srslte_dci_location_isvalid(srslte_dci_location_t* c); SRSLTE_API bool srslte_dci_location_isvalid(srslte_dci_location_t* c);

@ -22,9 +22,9 @@
/****************************************************************************** /******************************************************************************
* File: pbch.h * File: pbch.h
* *
* Description: Physical broadcast channel. If cell.nof_ports = 0, the number * Description: Physical broadcast channel. If cell.nof_ports = 0, the number
* of ports is blindly determined using the CRC of the received * of ports is blindly determined using the CRC of the received
* codeword for 1, 2 and 4 ports * codeword for 1, 2 and 4 ports
* *
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.6 * Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.6
*****************************************************************************/ *****************************************************************************/
@ -45,48 +45,47 @@
#include "srslte/phy/modem/mod.h" #include "srslte/phy/modem/mod.h"
#include "srslte/phy/scrambling/scrambling.h" #include "srslte/phy/scrambling/scrambling.h"
#define SRSLTE_BCH_PAYLOAD_LEN 24 #define SRSLTE_BCH_PAYLOAD_LEN 24
#define SRSLTE_BCH_PAYLOADCRC_LEN (SRSLTE_BCH_PAYLOAD_LEN+16) #define SRSLTE_BCH_PAYLOADCRC_LEN (SRSLTE_BCH_PAYLOAD_LEN + 16)
#define SRSLTE_BCH_ENCODED_LEN 3*(SRSLTE_BCH_PAYLOADCRC_LEN) #define SRSLTE_BCH_ENCODED_LEN 3 * (SRSLTE_BCH_PAYLOADCRC_LEN)
#define SRSLTE_PBCH_MAX_RE 256 // make it avx2-aligned #define SRSLTE_PBCH_MAX_RE 256 // make it avx2-aligned
/* PBCH object */ /* PBCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
srslte_cell_t cell; srslte_cell_t cell;
uint32_t nof_symbols; uint32_t nof_symbols;
/* buffers */ /* buffers */
cf_t *ce[SRSLTE_MAX_PORTS]; cf_t* ce[SRSLTE_MAX_PORTS];
cf_t *symbols[SRSLTE_MAX_PORTS]; cf_t* symbols[SRSLTE_MAX_PORTS];
cf_t *x[SRSLTE_MAX_PORTS]; cf_t* x[SRSLTE_MAX_PORTS];
cf_t *d; cf_t* d;
float *llr; float* llr;
float *temp; float* temp;
float rm_f[SRSLTE_BCH_ENCODED_LEN]; float rm_f[SRSLTE_BCH_ENCODED_LEN];
uint8_t *rm_b; uint8_t* rm_b;
uint8_t data[SRSLTE_BCH_PAYLOADCRC_LEN]; uint8_t data[SRSLTE_BCH_PAYLOADCRC_LEN];
uint8_t data_enc[SRSLTE_BCH_ENCODED_LEN]; uint8_t data_enc[SRSLTE_BCH_ENCODED_LEN];
uint32_t frame_idx; uint32_t frame_idx;
/* tx & rx objects */ /* tx & rx objects */
srslte_modem_table_t mod; srslte_modem_table_t mod;
srslte_sequence_t seq; srslte_sequence_t seq;
srslte_viterbi_t decoder; srslte_viterbi_t decoder;
srslte_crc_t crc; srslte_crc_t crc;
srslte_convcoder_t encoder; srslte_convcoder_t encoder;
bool search_all_ports; bool search_all_ports;
} srslte_pbch_t; } srslte_pbch_t;
SRSLTE_API int srslte_pbch_init(srslte_pbch_t *q); SRSLTE_API int srslte_pbch_init(srslte_pbch_t* q);
SRSLTE_API void srslte_pbch_free(srslte_pbch_t *q); SRSLTE_API void srslte_pbch_free(srslte_pbch_t* q);
SRSLTE_API int srslte_pbch_set_cell(srslte_pbch_t *q, SRSLTE_API int srslte_pbch_set_cell(srslte_pbch_t* q, srslte_cell_t cell);
srslte_cell_t cell);
SRSLTE_API int srslte_pbch_decode(srslte_pbch_t* q, SRSLTE_API int srslte_pbch_decode(srslte_pbch_t* q,
srslte_chest_dl_res_t* channel, srslte_chest_dl_res_t* channel,
@ -100,7 +99,7 @@ SRSLTE_API int srslte_pbch_encode(srslte_pbch_t* q,
cf_t* sf_symbols[SRSLTE_MAX_PORTS], cf_t* sf_symbols[SRSLTE_MAX_PORTS],
uint32_t frame_idx); uint32_t frame_idx);
SRSLTE_API void srslte_pbch_decode_reset(srslte_pbch_t *q); SRSLTE_API void srslte_pbch_decode_reset(srslte_pbch_t* q);
SRSLTE_API void srslte_pbch_mib_unpack(uint8_t* msg, srslte_cell_t* cell, uint32_t* sfn); SRSLTE_API void srslte_pbch_mib_unpack(uint8_t* msg, srslte_cell_t* cell, uint32_t* sfn);

@ -40,33 +40,33 @@
#include "srslte/phy/phch/regs.h" #include "srslte/phy/phch/regs.h"
#include "srslte/phy/scrambling/scrambling.h" #include "srslte/phy/scrambling/scrambling.h"
#define PCFICH_CFI_LEN 32 #define PCFICH_CFI_LEN 32
#define PCFICH_RE PCFICH_CFI_LEN/2 #define PCFICH_RE PCFICH_CFI_LEN / 2
/* PCFICH object */ /* PCFICH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
srslte_cell_t cell; srslte_cell_t cell;
int nof_symbols; int nof_symbols;
uint32_t nof_rx_antennas; uint32_t nof_rx_antennas;
/* handler to REGs resource mapper */ /* handler to REGs resource mapper */
srslte_regs_t *regs; srslte_regs_t* regs;
/* buffers */ /* buffers */
cf_t ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS][PCFICH_RE]; cf_t ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS][PCFICH_RE];
cf_t symbols[SRSLTE_MAX_PORTS][PCFICH_RE]; cf_t symbols[SRSLTE_MAX_PORTS][PCFICH_RE];
cf_t x[SRSLTE_MAX_PORTS][PCFICH_RE]; cf_t x[SRSLTE_MAX_PORTS][PCFICH_RE];
cf_t d[PCFICH_RE]; cf_t d[PCFICH_RE];
// cfi table in floats // cfi table in floats
float cfi_table_float[3][PCFICH_CFI_LEN]; float cfi_table_float[3][PCFICH_CFI_LEN];
/* bit message */ /* bit message */
uint8_t data[PCFICH_CFI_LEN]; uint8_t data[PCFICH_CFI_LEN];
/* received soft bits */ /* received soft bits */
float data_f[PCFICH_CFI_LEN]; float data_f[PCFICH_CFI_LEN];
/* tx & rx objects */ /* tx & rx objects */
srslte_modem_table_t mod; srslte_modem_table_t mod;
@ -74,14 +74,11 @@ typedef struct SRSLTE_API {
} srslte_pcfich_t; } srslte_pcfich_t;
SRSLTE_API int srslte_pcfich_init(srslte_pcfich_t *q, SRSLTE_API int srslte_pcfich_init(srslte_pcfich_t* q, uint32_t nof_rx_antennas);
uint32_t nof_rx_antennas);
SRSLTE_API int srslte_pcfich_set_cell(srslte_pcfich_t *q, SRSLTE_API int srslte_pcfich_set_cell(srslte_pcfich_t* q, srslte_regs_t* regs, srslte_cell_t cell);
srslte_regs_t *regs,
srslte_cell_t cell);
SRSLTE_API void srslte_pcfich_free(srslte_pcfich_t *q); SRSLTE_API void srslte_pcfich_free(srslte_pcfich_t* q);
SRSLTE_API int srslte_pcfich_decode(srslte_pcfich_t* q, SRSLTE_API int srslte_pcfich_decode(srslte_pcfich_t* q,
srslte_dl_sf_cfg_t* sf, srslte_dl_sf_cfg_t* sf,

@ -45,56 +45,47 @@
#include "srslte/phy/phch/regs.h" #include "srslte/phy/phch/regs.h"
#include "srslte/phy/scrambling/scrambling.h" #include "srslte/phy/scrambling/scrambling.h"
typedef enum SRSLTE_API { typedef enum SRSLTE_API { SEARCH_UE, SEARCH_COMMON } srslte_pdcch_search_mode_t;
SEARCH_UE, SEARCH_COMMON
} srslte_pdcch_search_mode_t;
/* PDCCH object */ /* PDCCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
srslte_cell_t cell; srslte_cell_t cell;
uint32_t nof_regs[3]; uint32_t nof_regs[3];
uint32_t nof_cce[3]; uint32_t nof_cce[3];
uint32_t max_bits; uint32_t max_bits;
uint32_t nof_rx_antennas; uint32_t nof_rx_antennas;
bool is_ue; bool is_ue;
srslte_regs_t *regs; srslte_regs_t* regs;
/* buffers */ /* buffers */
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; cf_t* ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
cf_t *symbols[SRSLTE_MAX_PORTS]; cf_t* symbols[SRSLTE_MAX_PORTS];
cf_t *x[SRSLTE_MAX_PORTS]; cf_t* x[SRSLTE_MAX_PORTS];
cf_t *d; cf_t* d;
uint8_t *e; uint8_t* e;
float rm_f[3 * (SRSLTE_DCI_MAX_BITS + 16)]; float rm_f[3 * (SRSLTE_DCI_MAX_BITS + 16)];
float *llr; float* llr;
/* tx & rx objects */ /* tx & rx objects */
srslte_modem_table_t mod; srslte_modem_table_t mod;
srslte_sequence_t seq[SRSLTE_NOF_SF_X_FRAME]; srslte_sequence_t seq[SRSLTE_NOF_SF_X_FRAME];
srslte_viterbi_t decoder; srslte_viterbi_t decoder;
srslte_crc_t crc; srslte_crc_t crc;
} srslte_pdcch_t; } srslte_pdcch_t;
SRSLTE_API int srslte_pdcch_init_ue(srslte_pdcch_t *q, SRSLTE_API int srslte_pdcch_init_ue(srslte_pdcch_t* q, uint32_t max_prb, uint32_t nof_rx_antennas);
uint32_t max_prb,
uint32_t nof_rx_antennas);
SRSLTE_API int srslte_pdcch_init_enb(srslte_pdcch_t *q, SRSLTE_API int srslte_pdcch_init_enb(srslte_pdcch_t* q, uint32_t max_prb);
uint32_t max_prb);
SRSLTE_API int srslte_pdcch_set_cell(srslte_pdcch_t *q, SRSLTE_API int srslte_pdcch_set_cell(srslte_pdcch_t* q, srslte_regs_t* regs, srslte_cell_t cell);
srslte_regs_t *regs,
srslte_cell_t cell);
SRSLTE_API void srslte_pdcch_set_regs(srslte_pdcch_t* q, srslte_regs_t* regs); SRSLTE_API void srslte_pdcch_set_regs(srslte_pdcch_t* q, srslte_regs_t* regs);
SRSLTE_API void srslte_pdcch_free(srslte_pdcch_t* q); SRSLTE_API void srslte_pdcch_free(srslte_pdcch_t* q);
SRSLTE_API float srslte_pdcch_coderate(uint32_t nof_bits, SRSLTE_API float srslte_pdcch_coderate(uint32_t nof_bits, uint32_t l);
uint32_t l);
/* Encoding function */ /* Encoding function */
SRSLTE_API int srslte_pdcch_encode(srslte_pdcch_t* q, SRSLTE_API int srslte_pdcch_encode(srslte_pdcch_t* q,
@ -110,50 +101,37 @@ SRSLTE_API int srslte_pdcch_extract_llr(srslte_pdcch_t* q,
cf_t* sf_symbols[SRSLTE_MAX_PORTS]); cf_t* sf_symbols[SRSLTE_MAX_PORTS]);
/* Decoding functions: Try to decode a DCI message after calling srslte_pdcch_extract_llr */ /* Decoding functions: Try to decode a DCI message after calling srslte_pdcch_extract_llr */
SRSLTE_API int srslte_pdcch_decode_msg(srslte_pdcch_t* q, SRSLTE_API int
srslte_dl_sf_cfg_t* sf, srslte_pdcch_decode_msg(srslte_pdcch_t* q, srslte_dl_sf_cfg_t* sf, srslte_dci_cfg_t* dci_cfg, srslte_dci_msg_t* msg);
srslte_dci_cfg_t* dci_cfg,
srslte_dci_msg_t* msg); SRSLTE_API int
srslte_pdcch_dci_decode(srslte_pdcch_t* q, float* e, uint8_t* data, uint32_t E, uint32_t nof_bits, uint16_t* crc);
SRSLTE_API int srslte_pdcch_dci_decode(srslte_pdcch_t* q,
float* e, SRSLTE_API int
uint8_t* data, srslte_pdcch_dci_encode(srslte_pdcch_t* q, uint8_t* data, uint8_t* e, uint32_t nof_bits, uint32_t E, uint16_t rnti);
uint32_t E,
uint32_t nof_bits, SRSLTE_API void
uint16_t* crc); srslte_pdcch_dci_encode_conv(srslte_pdcch_t* q, uint8_t* data, uint32_t nof_bits, uint8_t* coded_data, uint16_t rnti);
SRSLTE_API int srslte_pdcch_dci_encode(srslte_pdcch_t *q,
uint8_t *data,
uint8_t *e,
uint32_t nof_bits,
uint32_t E,
uint16_t rnti);
SRSLTE_API void srslte_pdcch_dci_encode_conv(srslte_pdcch_t *q,
uint8_t *data,
uint32_t nof_bits,
uint8_t *coded_data,
uint16_t rnti);
/* Function for generation of UE-specific search space DCI locations */ /* Function for generation of UE-specific search space DCI locations */
SRSLTE_API uint32_t srslte_pdcch_ue_locations(srslte_pdcch_t* q, SRSLTE_API uint32_t srslte_pdcch_ue_locations(srslte_pdcch_t* q,
srslte_dl_sf_cfg_t* sf, srslte_dl_sf_cfg_t* sf,
srslte_dci_location_t* locations, srslte_dci_location_t* locations,
uint32_t max_locations, uint32_t max_locations,
uint16_t rnti); uint16_t rnti);
SRSLTE_API uint32_t srslte_pdcch_ue_locations_ncce(uint32_t nof_cce, SRSLTE_API uint32_t srslte_pdcch_ue_locations_ncce(uint32_t nof_cce,
srslte_dci_location_t* c, srslte_dci_location_t* c,
uint32_t max_candidates, uint32_t max_candidates,
uint32_t sf_idx, uint32_t sf_idx,
uint16_t rnti); uint16_t rnti);
SRSLTE_API uint32_t srslte_pdcch_ue_locations_ncce_L(uint32_t nof_cce, SRSLTE_API uint32_t srslte_pdcch_ue_locations_ncce_L(uint32_t nof_cce,
srslte_dci_location_t* c, srslte_dci_location_t* c,
uint32_t max_candidates, uint32_t max_candidates,
uint32_t sf_idx, uint32_t sf_idx,
uint16_t rnti, uint16_t rnti,
int L); int L);
/* Function for generation of common search space DCI locations */ /* Function for generation of common search space DCI locations */
SRSLTE_API uint32_t srslte_pdcch_common_locations(srslte_pdcch_t* q, SRSLTE_API uint32_t srslte_pdcch_common_locations(srslte_pdcch_t* q,

@ -45,43 +45,43 @@
typedef struct { typedef struct {
srslte_sequence_t seq[SRSLTE_MAX_CODEWORDS][SRSLTE_NOF_SF_X_FRAME]; srslte_sequence_t seq[SRSLTE_MAX_CODEWORDS][SRSLTE_NOF_SF_X_FRAME];
uint32_t cell_id; uint32_t cell_id;
bool sequence_generated; bool sequence_generated;
} srslte_pdsch_user_t; } srslte_pdsch_user_t;
/* PDSCH object */ /* PDSCH object */
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
srslte_cell_t cell; srslte_cell_t cell;
uint32_t nof_rx_antennas; uint32_t nof_rx_antennas;
uint32_t max_re; uint32_t max_re;
uint16_t ue_rnti; uint16_t ue_rnti;
bool is_ue; bool is_ue;
bool llr_is_8bit; bool llr_is_8bit;
/* buffers */ /* buffers */
// void buffers are shared for tx and rx // void buffers are shared for tx and rx
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; /* Channel estimation (Rx only) */ cf_t* ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; /* Channel estimation (Rx only) */
cf_t *symbols[SRSLTE_MAX_PORTS]; /* PDSCH Encoded/Decoded Symbols */ cf_t* symbols[SRSLTE_MAX_PORTS]; /* PDSCH Encoded/Decoded Symbols */
cf_t *x[SRSLTE_MAX_LAYERS]; /* Layer mapped */ cf_t* x[SRSLTE_MAX_LAYERS]; /* Layer mapped */
cf_t *d[SRSLTE_MAX_CODEWORDS]; /* Modulated/Demodulated codewords */ cf_t* d[SRSLTE_MAX_CODEWORDS]; /* Modulated/Demodulated codewords */
void *e[SRSLTE_MAX_CODEWORDS]; void* e[SRSLTE_MAX_CODEWORDS];
float *csi[SRSLTE_MAX_CODEWORDS]; /* Channel Strengh Indicator */ float* csi[SRSLTE_MAX_CODEWORDS]; /* Channel Strengh Indicator */
/* tx & rx objects */ /* tx & rx objects */
srslte_modem_table_t mod[5]; srslte_modem_table_t mod[5];
// This is to generate the scrambling seq for multiple CRNTIs // This is to generate the scrambling seq for multiple CRNTIs
srslte_pdsch_user_t **users; srslte_pdsch_user_t** users;
srslte_sequence_t tmp_seq; srslte_sequence_t tmp_seq;
srslte_sch_t dl_sch; srslte_sch_t dl_sch;
void *coworker_ptr; void* coworker_ptr;
} srslte_pdsch_t; } srslte_pdsch_t;
@ -91,22 +91,18 @@ typedef struct {
float avg_iterations_block; float avg_iterations_block;
} srslte_pdsch_res_t; } srslte_pdsch_res_t;
SRSLTE_API int srslte_pdsch_init_ue(srslte_pdsch_t *q, SRSLTE_API int srslte_pdsch_init_ue(srslte_pdsch_t* q, uint32_t max_prb, uint32_t nof_rx_antennas);
uint32_t max_prb,
uint32_t nof_rx_antennas);
SRSLTE_API int srslte_pdsch_init_enb(srslte_pdsch_t *q, SRSLTE_API int srslte_pdsch_init_enb(srslte_pdsch_t* q, uint32_t max_prb);
uint32_t max_prb);
SRSLTE_API void srslte_pdsch_free(srslte_pdsch_t *q); SRSLTE_API void srslte_pdsch_free(srslte_pdsch_t* q);
/* These functions modify the state of the object and may take some time */ /* These functions modify the state of the object and may take some time */
SRSLTE_API int srslte_pdsch_enable_coworker(srslte_pdsch_t* q); SRSLTE_API int srslte_pdsch_enable_coworker(srslte_pdsch_t* q);
SRSLTE_API int srslte_pdsch_set_cell(srslte_pdsch_t* q, srslte_cell_t cell); SRSLTE_API int srslte_pdsch_set_cell(srslte_pdsch_t* q, srslte_cell_t cell);
SRSLTE_API int srslte_pdsch_set_rnti(srslte_pdsch_t *q, SRSLTE_API int srslte_pdsch_set_rnti(srslte_pdsch_t* q, uint16_t rnti);
uint16_t rnti);
SRSLTE_API void srslte_pdsch_free_rnti(srslte_pdsch_t* q, uint16_t rnti); SRSLTE_API void srslte_pdsch_free_rnti(srslte_pdsch_t* q, uint16_t rnti);

@ -30,9 +30,9 @@
#ifndef SRSLTE_PDSCH_CFG_H #ifndef SRSLTE_PDSCH_CFG_H
#define SRSLTE_PDSCH_CFG_H #define SRSLTE_PDSCH_CFG_H
#include "srslte/phy/phch/ra.h"
#include "srslte/phy/fec/softbuffer.h"
#include "srslte/phy/fec/cbsegm.h" #include "srslte/phy/fec/cbsegm.h"
#include "srslte/phy/fec/softbuffer.h"
#include "srslte/phy/phch/ra.h"
typedef struct SRSLTE_API { typedef struct SRSLTE_API {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save