Commit edfa9041 authored by Ben Wojtowicz's avatar Ben Wojtowicz

Version 0.8.3: Added MAC functionality to the LTE library, fixed bugs in RRC...

Version 0.8.3: Added MAC functionality to the LTE library, fixed bugs in RRC portion of the LTE library, and added hackrf and SIB decode and print support to the scanner app
parent 975544e0
......@@ -23,7 +23,7 @@
########################################################################
cmake_minimum_required(VERSION 2.6)
project(openLTE CXX C)
set(openLTE_version 0.8.2)
set(openLTE_version 0.8.3)
enable_testing()
#select the release build type by default to get optimization flags
......@@ -89,6 +89,7 @@ find_package(Gruel)
find_package(GnuradioCore)
find_package(GnuradioOsmosdr)
find_package(Rtlsdr)
find_package(HackRf)
if(NOT GRUEL_FOUND)
message(FATAL_ERROR "Gruel required to compile openLTE")
......@@ -99,11 +100,15 @@ if(NOT GNURADIO_CORE_FOUND)
endif()
if(NOT GNURADIO_OSMOSDR_FOUND)
message(FATAL_ERROR "GnuRadio Osmosdr required to compile openLTE")
message(FATAL_ERROR "GnuRadio Osmosdr required to compile openLTE (sdr.osmocom.org/trac/)")
endif()
if(NOT RTLSDR_FOUND)
message(FATAL_ERROR "Rtlsdr required to compile openLTE")
message(FATAL_ERROR "Rtlsdr required to compile openLTE (sdr.osmocom.org/trac/wiki/rtl-sdr)")
endif()
if(NOT HACKRF_FOUND)
message(FATAL_ERROR "HackRf required to compile openLTE (github.com/mossmann/hackrf/wiki)")
endif()
########################################################################
......
......@@ -56,3 +56,6 @@ v00.08.00 Added a scanner application with support for rtl-sdr hardware.
v00.08.01 Converted fftw from double to single precision. Added paging
message printing. Fixed bugs in lte_fdd_dl_receive.m.
v00.08.02 Fixed two indexing bugs in liblte_phy.cc.
v00.08.03 Added MAC functionality to the LTE library, fixed bugs in RRC portion
of the LTE library, and added hackrf and SIB decode and print support
to the scanner app.
......@@ -32,6 +32,7 @@
a file size bug
01/07/2013 Ben Wojtowicz Moved from automake to cmake
03/03/2013 Ben Wojtowicz Added support for a test load.
07/21/2013 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -114,7 +115,7 @@ private:
// LTE parameters
void recreate_sched_info(void);
LIBLTE_RRC_MSG_STRUCT rrc_msg;
LIBLTE_MSG_STRUCT rrc_msg;
LIBLTE_RRC_MIB_STRUCT mib;
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT bcch_dlsch_msg;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1_STRUCT sib1;
......
......@@ -36,6 +36,7 @@
01/07/2013 Ben Wojtowicz Moved from automake to cmake
03/03/2013 Ben Wojtowicz Added support for a test load and using the
latest libraries.
07/21/2013 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -44,6 +45,7 @@
*******************************************************************************/
#include "LTE_fdd_dl_fg_samp_buf.h"
#include "liblte_mac.h"
#include "gr_io_signature.h"
#include <errno.h>
......@@ -344,9 +346,10 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
memcpy(&bcch_dlsch_msg.sibs[0].sib, &sib1, sizeof(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1_STRUCT));
liblte_rrc_pack_bcch_dlsch_msg(&bcch_dlsch_msg,
&pdcch.alloc[pdcch.N_alloc].msg);
liblte_phy_get_tbs_mcs_and_n_prb_for_si(pdcch.alloc[pdcch.N_alloc].msg.N_bits,
liblte_phy_get_tbs_mcs_and_n_prb_for_dl(pdcch.alloc[pdcch.N_alloc].msg.N_bits,
subframe.num,
N_rb_dl,
LIBLTE_MAC_SI_RNTI,
&pdcch.alloc[pdcch.N_alloc].tbs,
&pdcch.alloc[pdcch.N_alloc].mcs,
&pdcch.alloc[pdcch.N_alloc].N_prb);
......@@ -354,7 +357,7 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
pdcch.alloc[pdcch.N_alloc].mod_type = LIBLTE_PHY_MODULATION_TYPE_QPSK;
pdcch.alloc[pdcch.N_alloc].rv_idx = (uint32)ceilf(1.5 * ((sfn / 2) % 4)) % 4; //36.321 section 5.3.1
pdcch.alloc[pdcch.N_alloc].N_codewords = 1;
pdcch.alloc[pdcch.N_alloc].rnti = LIBLTE_PHY_SI_RNTI;
pdcch.alloc[pdcch.N_alloc].rnti = LIBLTE_MAC_SI_RNTI;
pdcch.alloc[pdcch.N_alloc].tx_mode = sib_tx_mode;
pdcch.N_alloc++;
}
......@@ -390,9 +393,10 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
}
liblte_rrc_pack_bcch_dlsch_msg(&bcch_dlsch_msg,
&pdcch.alloc[pdcch.N_alloc].msg);
liblte_phy_get_tbs_mcs_and_n_prb_for_si(pdcch.alloc[pdcch.N_alloc].msg.N_bits,
liblte_phy_get_tbs_mcs_and_n_prb_for_dl(pdcch.alloc[pdcch.N_alloc].msg.N_bits,
subframe.num,
N_rb_dl,
LIBLTE_MAC_SI_RNTI,
&pdcch.alloc[pdcch.N_alloc].tbs,
&pdcch.alloc[pdcch.N_alloc].mcs,
&pdcch.alloc[pdcch.N_alloc].N_prb);
......@@ -400,7 +404,7 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
pdcch.alloc[pdcch.N_alloc].mod_type = LIBLTE_PHY_MODULATION_TYPE_QPSK;
pdcch.alloc[pdcch.N_alloc].rv_idx = 0; //36.321 section 5.3.1
pdcch.alloc[pdcch.N_alloc].N_codewords = 1;
pdcch.alloc[pdcch.N_alloc].rnti = LIBLTE_PHY_SI_RNTI;
pdcch.alloc[pdcch.N_alloc].rnti = LIBLTE_MAC_SI_RNTI;
pdcch.alloc[pdcch.N_alloc].tx_mode = sib_tx_mode;
pdcch.N_alloc++;
}
......@@ -435,9 +439,10 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
{
liblte_rrc_pack_bcch_dlsch_msg(&bcch_dlsch_msg,
&pdcch.alloc[pdcch.N_alloc].msg);
liblte_phy_get_tbs_mcs_and_n_prb_for_si(pdcch.alloc[pdcch.N_alloc].msg.N_bits,
liblte_phy_get_tbs_mcs_and_n_prb_for_dl(pdcch.alloc[pdcch.N_alloc].msg.N_bits,
subframe.num,
N_rb_dl,
LIBLTE_MAC_SI_RNTI,
&pdcch.alloc[pdcch.N_alloc].tbs,
&pdcch.alloc[pdcch.N_alloc].mcs,
&pdcch.alloc[pdcch.N_alloc].N_prb);
......@@ -445,7 +450,7 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
pdcch.alloc[pdcch.N_alloc].mod_type = LIBLTE_PHY_MODULATION_TYPE_QPSK;
pdcch.alloc[pdcch.N_alloc].rv_idx = 0; //36.321 section 5.3.1
pdcch.alloc[pdcch.N_alloc].N_codewords = 1;
pdcch.alloc[pdcch.N_alloc].rnti = LIBLTE_PHY_SI_RNTI;
pdcch.alloc[pdcch.N_alloc].rnti = LIBLTE_MAC_SI_RNTI;
pdcch.alloc[pdcch.N_alloc].tx_mode = sib_tx_mode;
pdcch.N_alloc++;
}
......@@ -456,18 +461,20 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
{
pdcch.alloc[0].msg.N_bits = 0;
pdcch.alloc[0].N_prb = 0;
liblte_phy_get_tbs_mcs_and_n_prb_for_si(1480,
liblte_phy_get_tbs_mcs_and_n_prb_for_dl(1480,
subframe.num,
N_rb_dl,
LIBLTE_MAC_P_RNTI,
&pdcch.alloc[0].tbs,
&pdcch.alloc[0].mcs,
&max_N_prb);
while(pdcch.alloc[0].N_prb < (uint32)((float)(max_N_prb*percent_load)/100.0))
{
pdcch.alloc[0].msg.N_bits += 8;
liblte_phy_get_tbs_mcs_and_n_prb_for_si(pdcch.alloc[0].msg.N_bits,
liblte_phy_get_tbs_mcs_and_n_prb_for_dl(pdcch.alloc[0].msg.N_bits,
subframe.num,
N_rb_dl,
LIBLTE_MAC_P_RNTI,
&pdcch.alloc[0].tbs,
&pdcch.alloc[0].mcs,
&pdcch.alloc[0].N_prb);
......@@ -481,7 +488,7 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
pdcch.alloc[0].pre_coder_type = LIBLTE_PHY_PRE_CODER_TYPE_TX_DIVERSITY;
pdcch.alloc[0].mod_type = LIBLTE_PHY_MODULATION_TYPE_QPSK;
pdcch.alloc[0].N_codewords = 1;
pdcch.alloc[0].rnti = LIBLTE_PHY_P_RNTI;
pdcch.alloc[0].rnti = LIBLTE_MAC_P_RNTI;
pdcch.alloc[0].tx_mode = sib_tx_mode;
pdcch.N_alloc++;
}
......@@ -787,6 +794,7 @@ void LTE_fdd_dl_fg_samp_buf::print_config(void)
sib3_present);
if(sib3_present)
{
// Q_HYST
printf("\t%-30s = %10s, values = [0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]\n",
Q_HYST_PARAM,
liblte_rrc_q_hyst_text[sib3.q_hyst]);
......@@ -798,6 +806,7 @@ void LTE_fdd_dl_fg_samp_buf::print_config(void)
sib4_present);
if(sib4_present)
{
// NEIGH_CELL_LIST
printf("\t%-30s = %10d:",
NEIGH_CELL_LIST_PARAM,
sib4.intra_freq_neigh_cell_list_size);
......@@ -816,6 +825,7 @@ void LTE_fdd_dl_fg_samp_buf::print_config(void)
sib8_present);
if(sib8_present)
{
// SEARCH_WIN_SIZE
printf("\t%-30s = %10d, bounds = [0, 15]\n",
SEARCH_WIN_SIZE_PARAM,
sib8.search_win_size);
......
......@@ -35,6 +35,7 @@
libraries, and fixed a bug that allowed
multiple decodes of the same channel.
03/17/2013 Ben Wojtowicz Added paging message printing.
07/21/2013 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -101,7 +102,7 @@ private:
// LTE library
LIBLTE_PHY_STRUCT *phy_struct;
LIBLTE_PHY_COARSE_TIMING_STRUCT timing_struct;
LIBLTE_RRC_MSG_STRUCT rrc_msg;
LIBLTE_MSG_STRUCT rrc_msg;
LIBLTE_RRC_MIB_STRUCT mib;
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT bcch_dlsch_msg;
LIBLTE_RRC_PCCH_MSG_STRUCT pcch_msg;
......
......@@ -42,6 +42,7 @@
of the same channel, and fixed a frequency
offset correction bug.
03/17/2013 Ben Wojtowicz Added paging message printing.
07/21/2013 Ben Wojtowicz Fixed a bug and using the latest LTE library.
*******************************************************************************/
......@@ -50,6 +51,7 @@
*******************************************************************************/
#include "LTE_fdd_dl_fs_samp_buf.h"
#include "liblte_mac.h"
#include "liblte_mcc_mnc_list.h"
#include "gr_io_signature.h"
......@@ -448,7 +450,7 @@ int32 LTE_fdd_dl_fs_samp_buf::work(int32 ninput_items,
rrc_msg.msg,
&rrc_msg.N_bits))
{
if(LIBLTE_PHY_SI_RNTI == pdcch.alloc[0].rnti &&
if(LIBLTE_MAC_SI_RNTI == pdcch.alloc[0].rnti &&
LIBLTE_SUCCESS == liblte_rrc_unpack_bcch_dlsch_msg(&rrc_msg,
&bcch_dlsch_msg))
{
......@@ -485,7 +487,7 @@ int32 LTE_fdd_dl_fs_samp_buf::work(int32 ninput_items,
break;
}
}
}else if(LIBLTE_PHY_P_RNTI == pdcch.alloc[0].rnti){
}else if(LIBLTE_MAC_P_RNTI == pdcch.alloc[0].rnti){
for(i=0; i<8; i++)
{
if(rrc_msg.msg[i] != liblte_rrc_test_fill[i])
......@@ -1181,7 +1183,7 @@ void LTE_fdd_dl_fs_samp_buf::print_sib3(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_3_STRUCT
{
printf("\t\t%-40s=%17ddBm\n", "P Max", sib3->p_max);
}
if(true == sib3->s_intra_search)
if(true == sib3->s_intra_search_present)
{
printf("\t\t%-40s=%18udB\n", "S-Intra Search", sib3->s_intra_search);
}
......
......@@ -10,6 +10,6 @@ add_executable(LTE_fdd_dl_scan
src/LTE_fdd_dl_scan_flowgraph.cc
src/LTE_fdd_dl_scan_state_machine.cc
)
target_link_libraries(LTE_fdd_dl_scan lte fftw3f tools pthread ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES} ${GNURADIO_OSMOSDR_LIBRARIES})
target_link_libraries(LTE_fdd_dl_scan lte fftw3f tools pthread boost_system ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES} ${GNURADIO_OSMOSDR_LIBRARIES})
set_target_properties(LTE_fdd_dl_scan PROPERTIES DEFINE_SYMBOL "LTE_fdd_dl_scan_state_machine_EXPORTS")
install(TARGETS LTE_fdd_dl_scan DESTINATION bin)
......@@ -25,6 +25,7 @@
Revision History
---------- ------------- --------------------------------------------
02/26/2013 Ben Wojtowicz Created file
07/21/2013 Ben Wojtowicz Added support for HackRF Jawbreaker
*******************************************************************************/
......@@ -55,6 +56,11 @@
TYPEDEFS
*******************************************************************************/
typedef enum{
LTE_FDD_DL_SCAN_HW_TYPE_RTL_SDR = 0,
LTE_FDD_DL_SCAN_HW_TYPE_HACKRF,
LTE_FDD_DL_SCAN_HW_TYPE_UNKNOWN,
}LTE_FDD_DL_SCAN_HW_TYPE_ENUM;
/*******************************************************************************
CLASS DECLARATIONS
......
......@@ -25,6 +25,7 @@
Revision History
---------- ------------- --------------------------------------------
02/26/2013 Ben Wojtowicz Created file
07/21/2013 Ben Wojtowicz Added support for decoding SIBs.
*******************************************************************************/
......@@ -62,27 +63,8 @@ typedef enum{
}LTE_FDD_DL_SCAN_STATUS_ENUM;
typedef struct{
LIBLTE_RRC_MIB_STRUCT mib;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1_STRUCT sib1;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT sib2;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_3_STRUCT sib3;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_4_STRUCT sib4;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_5_STRUCT sib5;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_6_STRUCT sib6;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_7_STRUCT sib7;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_8_STRUCT sib8;
float freq_offset;
uint32 N_id_cell;
uint32 sfn;
uint8 N_ant;
bool sib1_present;
bool sib2_present;
bool sib3_present;
bool sib4_present;
bool sib5_present;
bool sib6_present;
bool sib7_present;
bool sib8_present;
float freq_offset;
uint32 N_id_cell;
}LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT;
/*******************************************************************************
......@@ -102,7 +84,16 @@ public:
void stop_ctrl_port(void);
void send_ctrl_msg(std::string msg);
void send_ctrl_info_msg(std::string msg);
void send_ctrl_channel_found_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data);
void send_ctrl_channel_found_begin_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_MIB_STRUCT *mib, uint32 sfn, uint8 N_ant);
void send_ctrl_sib1_decoded_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1_STRUCT *sib1, uint32 sfn);
void send_ctrl_sib2_decoded_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2, uint32 sfn);
void send_ctrl_sib3_decoded_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_3_STRUCT *sib3, uint32 sfn);
void send_ctrl_sib4_decoded_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_4_STRUCT *sib4, uint32 sfn);
void send_ctrl_sib5_decoded_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_5_STRUCT *sib5, uint32 sfn);
void send_ctrl_sib6_decoded_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_6_STRUCT *sib6, uint32 sfn);
void send_ctrl_sib7_decoded_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_7_STRUCT *sib7, uint32 sfn);
void send_ctrl_sib8_decoded_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_8_STRUCT *sib8, uint32 sfn);
void send_ctrl_channel_found_end_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data);
void send_ctrl_channel_not_found_msg(void);
void send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_ENUM status, std::string msg);
static void handle_ctrl_msg(std::string msg);
......
......@@ -25,6 +25,7 @@
Revision History
---------- ------------- --------------------------------------------
02/26/2013 Ben Wojtowicz Created file
07/21/2013 Ben Wojtowicz Added support for multiple sample rates
*******************************************************************************/
......@@ -72,7 +73,7 @@ typedef enum{
CLASS DECLARATIONS
*******************************************************************************/
LTE_FDD_DL_SCAN_STATE_MACHINE_API LTE_fdd_dl_scan_state_machine_sptr LTE_fdd_dl_scan_make_state_machine ();
LTE_FDD_DL_SCAN_STATE_MACHINE_API LTE_fdd_dl_scan_state_machine_sptr LTE_fdd_dl_scan_make_state_machine (uint32 samp_rate);
class LTE_FDD_DL_SCAN_STATE_MACHINE_API LTE_fdd_dl_scan_state_machine : public gr_sync_block
{
public:
......@@ -83,14 +84,14 @@ public:
gr_vector_void_star &output_items);
private:
friend LTE_FDD_DL_SCAN_STATE_MACHINE_API LTE_fdd_dl_scan_state_machine_sptr LTE_fdd_dl_scan_make_state_machine();
friend LTE_FDD_DL_SCAN_STATE_MACHINE_API LTE_fdd_dl_scan_state_machine_sptr LTE_fdd_dl_scan_make_state_machine(uint32 samp_rate);
LTE_fdd_dl_scan_state_machine();
LTE_fdd_dl_scan_state_machine(uint32 samp_rate);
// LTE library
LIBLTE_PHY_STRUCT *phy_struct;
LIBLTE_PHY_COARSE_TIMING_STRUCT timing_struct;
LIBLTE_RRC_MSG_STRUCT rrc_msg;
LIBLTE_MSG_STRUCT rrc_msg;
LIBLTE_RRC_MIB_STRUCT mib;
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT bcch_dlsch_msg;
......@@ -99,6 +100,15 @@ private:
float *q_buf;
uint32 samp_buf_w_idx;
uint32 samp_buf_r_idx;
uint32 one_subframe_num_samps;
uint32 one_frame_num_samps;
uint32 freq_change_wait_num_samps;
uint32 coarse_timing_search_num_samps;
uint32 pss_and_fine_timing_search_num_samps;
uint32 sss_search_num_samps;
uint32 bch_decode_num_samps;
uint32 pdsch_decode_sib1_num_samps;
uint32 pdsch_decode_si_generic_num_samps;
// Variables
LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT chan_data;
......@@ -112,33 +122,26 @@ private:
uint32 N_decoded_chans;
uint32 N_attempts;
uint32 N_bch_attempts;
uint32 N_pdsch_attempts;
uint32 N_samps_needed;
uint32 freq_change_wait_cnt;
uint32 sfn;
uint8 N_ant;
bool freq_change_wait_done;
bool mib_rxed;
bool sib1_rxed;
bool sib2_rxed;
bool sib3_rxed;
bool sib4_rxed;
bool sib5_rxed;
bool sib6_rxed;
bool sib7_rxed;
bool sib8_rxed;
bool sib1_sent;
bool sib2_sent;
bool sib3_sent;
bool sib4_sent;
bool sib5_sent;
bool sib6_sent;
bool sib7_sent;
bool sib8_sent;
bool send_cnf;
// Helpers
void init(void);
void copy_input_to_samp_buf(const gr_complex *in, int32 ninput_items);
void freq_shift(uint32 start_idx, uint32 num_samps, float freq_offset);
void save_mib(LIBLTE_RRC_MIB_STRUCT *mib);
void save_sib1(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1_STRUCT *sib1);
void save_sib2(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2);
void save_sib3(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_3_STRUCT *sib3);
void save_sib4(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_4_STRUCT *sib4);
void save_sib5(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_5_STRUCT *sib5);
void save_sib6(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_6_STRUCT *sib6);
void save_sib7(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_7_STRUCT *sib7);
void save_sib8(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_8_STRUCT *sib8);
void channel_found(bool &switch_freq, int32 &done_flag);
void channel_not_found(bool &switch_freq, int32 &done_flag);
};
......
......@@ -25,6 +25,7 @@
Revision History
---------- ------------- --------------------------------------------
02/26/2013 Ben Wojtowicz Created file
07/21/2013 Ben Wojtowicz Added support for HackRF Jawbreaker
*******************************************************************************/
......@@ -103,9 +104,11 @@ bool LTE_fdd_dl_scan_flowgraph::is_started(void)
}
LTE_FDD_DL_SCAN_STATUS_ENUM LTE_fdd_dl_scan_flowgraph::start(uint16 dl_earfcn)
{
boost::mutex::scoped_lock lock(start_mutex);
LTE_fdd_dl_scan_interface *interface = LTE_fdd_dl_scan_interface::get_instance();
LTE_FDD_DL_SCAN_STATUS_ENUM err = LTE_FDD_DL_SCAN_STATUS_FAIL;
boost::mutex::scoped_lock lock(start_mutex);
LTE_fdd_dl_scan_interface *interface = LTE_fdd_dl_scan_interface::get_instance();
LTE_FDD_DL_SCAN_STATUS_ENUM err = LTE_FDD_DL_SCAN_STATUS_FAIL;
LTE_FDD_DL_SCAN_HW_TYPE_ENUM hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_UNKNOWN;
std::vector<double> range;
if(!started)
{
......@@ -116,10 +119,31 @@ LTE_FDD_DL_SCAN_STATUS_ENUM LTE_fdd_dl_scan_flowgraph::start(uint16 dl_earfcn)
if(NULL == samp_src.get())
{
samp_src = osmosdr_make_source_c();
if(0 != samp_src->get_num_channels())
{
range = samp_src->get_sample_rates().values();
if(range[range.size()-1] == 20000000)
{
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_HACKRF;
}else if(range[range.size()-1] == 2400000){
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_RTL_SDR;
}
}
}
if(NULL == state_machine.get())
{
state_machine = LTE_fdd_dl_scan_make_state_machine();
switch(hardware_type)
{
case LTE_FDD_DL_SCAN_HW_TYPE_HACKRF:
state_machine = LTE_fdd_dl_scan_make_state_machine(15360000);
break;
case LTE_FDD_DL_SCAN_HW_TYPE_UNKNOWN:
default:
printf("Unknown hardware, treating like RTL-SDR\n");
case LTE_FDD_DL_SCAN_HW_TYPE_RTL_SDR:
state_machine = LTE_fdd_dl_scan_make_state_machine(1920000);
break;
}
}
if(NULL != top_block.get() &&
......@@ -128,8 +152,22 @@ LTE_FDD_DL_SCAN_STATUS_ENUM LTE_fdd_dl_scan_flowgraph::start(uint16 dl_earfcn)
{
if(0 != samp_src->get_num_channels())
{
samp_src->set_sample_rate(1920000);
samp_src->set_gain_mode(true);
switch(hardware_type)
{
case LTE_FDD_DL_SCAN_HW_TYPE_HACKRF:
samp_src->set_sample_rate(15360000);
samp_src->set_gain_mode(false);
samp_src->set_gain(14);
samp_src->set_dc_offset_mode(osmosdr_source_c::DCOffsetAutomatic);
break;
case LTE_FDD_DL_SCAN_HW_TYPE_UNKNOWN:
default:
printf("Unknown hardware, treating like RTL-SDR\n");
case LTE_FDD_DL_SCAN_HW_TYPE_RTL_SDR:
samp_src->set_sample_rate(1920000);
samp_src->set_gain_mode(true);
break;
}
samp_src->set_center_freq(liblte_interface_dl_earfcn_to_frequency(dl_earfcn));
top_block->connect(samp_src, 0, state_machine, 0);
if(0 == pthread_create(&start_thread, NULL, &run_thread, this))
......
......@@ -11,7 +11,7 @@ build Cmake generated build files
LTE_fdd_dl_file_scan A gnu-radio LTE FDD DL file scanner application
LTE_fdd_dl_file_gen A gnu-radio LTE FDD DL file generator application
LTE_fdd_dl_scan A gnu-radio LTE FDD DL scanner application that
currently supports rtl-sdr hardware
currently supports rtl-sdr and hackrf hardware
To build the C++ and python code use the following:
......@@ -66,11 +66,11 @@ input for the LTE_fdd_dl_file_scan application.
#############
To use the installed C++ live scanner, make sure LD_LIBRARY_PATH
is set to /usr/local/lib (export LD_LIBRARY_PATH=/usr/local/lib),
plug in rtl-sdr hardware, run LTE_fdd_dl_scan, and connect (via
telnet, nc, etc) to the control port at port number 20000. Scan
parameters can be changed and scan results can be observed on the
control port. For a list of parameters simply type help on the
control port.
plug in rtl-sdr or hackrf hardware, run LTE_fdd_dl_scan, and connect
(via telnet, nc, etc) to the control port at port number 20000.
Scan parameters can be changed and scan results can be observed
on the control port. For a list of parameters simply type help
on the control port.
############
# OCTAVE #
......
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_HACKRF libhackrf)
FIND_PATH(
HACKRF_INCLUDE_DIRS
NAMES hackrf.h
HINTS $ENV{HACKRF_DIR}/include
${PC_HACKRF_INCLUDEDIR}
PATHS /usr/local/include/libhackrf
/usr/include/libhackrf
)
FIND_LIBRARY(
HACKRF_LIBRARIES
NAMES hackrf
HINTS $ENV{HACKRF_DIR}/lib
${PC_HACKRF_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HACKRF DEFAULT_MSG HACKRF_LIBRARIES HACKRF_INCLUDE_DIRS)
MARK_AS_ADVANCED(HACKRF_LIBRARIES HACKRF_INCLUDE_DIRS)
......@@ -2,6 +2,7 @@ include(GrPlatform)
add_library(lte
src/liblte_interface.cc
src/liblte_phy.cc
src/liblte_mac.cc
src/liblte_rrc.cc
)
include_directories(hdr ${CMAKE_SOURCE_DIR}/cmn_hdr)
/*******************************************************************************
Copyright 2012 Ben Wojtowicz
Copyright 2012-2013 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -24,6 +24,7 @@
Revision History
---------- ------------- --------------------------------------------
02/26/2012 Ben Wojtowicz Created file.
07/21/2013 Ben Wojtowicz Added a common message structure.
*******************************************************************************/
......@@ -41,6 +42,8 @@
DEFINES
*******************************************************************************/
// FIXME: This was chosen arbitrarily
#define LIBLTE_MAX_MSG_SIZE 4096
/*******************************************************************************
TYPEDEFS
......@@ -53,6 +56,11 @@ typedef enum{
LIBLTE_ERROR_INVALID_CRC,
}LIBLTE_ERROR_ENUM;
typedef struct{
uint32 N_bits;
uint8 msg[LIBLTE_MAX_MSG_SIZE];
}LIBLTE_MSG_STRUCT;
/*******************************************************************************
DECLARATIONS
*******************************************************************************/
......
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************
File: liblte_mac.h
Description: Contains all the definitions for the LTE Medium Access Control
Layer library.
Revision History
---------- ------------- --------------------------------------------
07/21/2013 Ben Wojtowicz Created file.
*******************************************************************************/
#ifndef __LIBLTE_MAC_H__
#define __LIBLTE_MAC_H__
/*******************************************************************************
INCLUDES
*******************************************************************************/
#include "liblte_common.h"
/*******************************************************************************
DEFINES
*******************************************************************************/
// RNTIs 36.321 v10.2.0 Section 7.1
#define LIBLTE_MAC_INVALID_RNTI 0x0000
#define LIBLTE_MAC_RA_RNTI_START 0x0001
#define LIBLTE_MAC_RA_RNTI_END 0x003C
#define LIBLTE_MAC_C_RNTI_START 0x003D
#define LIBLTE_MAC_C_RNTI_END 0xFFF3
#define LIBLTE_MAC_RESV_RNTI_START 0xFFF4
#define LIBLTE_MAC_RESV_RNTI_END 0xFFFC
#define LIBLTE_MAC_M_RNTI 0xFFFD
#define LIBLTE_MAC_P_RNTI 0xFFFE
#define LIBLTE_MAC_SI_RNTI 0xFFFF
/*******************************************************************************
TYPEDEFS
*******************************************************************************/
/*******************************************************************************
PDU DECLARATIONS
*******************************************************************************/
/*********************************************************************
PDU Name: DL-SCH and UL-SCH
Description: PDU containing a MAC header, zero or more MAC SDUs,
and zero or more MAC control elements
Document Reference: 36.321 v10.2.0 Section 6.1.2
*********************************************************************/
// Defines
// Enums
// Structs
// Functions
// FIXME
/*********************************************************************
PDU Name: Transparent
Description: PDU containing a MAC SDU
Document Reference: 36.321 v10.2.0 Section 6.1.4
*********************************************************************/
// Defines
// Enums
// Structs
// Functions
// FIXME
/*********************************************************************
PDU Name: Random Access Response
Description: PDU containing a MAC header and zero or more MAC
Random Access Responses
Document Reference: 36.321 v10.2.0 Section 6.1.5
*********************************************************************/
// Defines
// Enums
typedef enum{
LIBLTE_MAC_RAR_HEADER_TYPE_BI = 0,
LIBLTE_MAC_RAR_HEADER_TYPE_RAPID,
LIBLTE_MAC_RAR_HEADER_TYPE_N_ITEMS,
}LIBLTE_MAC_RAR_HEADER_TYPE_ENUM;
static const char liblte_mac_rar_header_type_text[LIBLTE_MAC_RAR_HEADER_TYPE_N_ITEMS][20] = {"BI", "RAPID"};
typedef enum{
LIBLTE_MAC_RAR_HOPPING_DISABLED = 0,
LIBLTE_MAC_RAR_HOPPING_ENABLED,
LIBLTE_MAC_RAR_HOPPING_N_ITEMS,
}LIBLTE_MAC_RAR_HOPPING_ENUM;
static const char liblte_mac_rar_hopping_text[LIBLTE_MAC_RAR_HOPPING_N_ITEMS][20] = {"Disabled", "Enabled"};
typedef enum{
LIBLTE_MAC_RAR_TPC_COMMAND_N6dB = 0,
LIBLTE_MAC_RAR_TPC_COMMAND_N4dB,
LIBLTE_MAC_RAR_TPC_COMMAND_N2dB,