Merged the changes for building on OSX #161
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8fac31..0387fc5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,6 +142,21 @@
set(GR_GSM_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
########################################################################
+# On Apple only, set install name and use rpath correctly, if not already set
+########################################################################
+if(APPLE)
+ if(NOT CMAKE_INSTALL_NAME_DIR)
+ set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE PATH "Library Install Name Destination Directory" FORCE)
+ endif(NOT CMAKE_INSTALL_NAME_DIR)
+ if(NOT CMAKE_INSTALL_RPATH)
+ set(cmakE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE PATH "Library Install RPath" FORCE)
+ endif(NOT CMAKE_INSTALL_RPATH)
+ if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "Do Build Using Library Install RPath" FORCE)
+ endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
+endif(APPLE)
+
+########################################################################
# Create uninstall target
########################################################################
configure_file(
diff --git a/lib/decoding/control_channels_decoder_impl.cc b/lib/decoding/control_channels_decoder_impl.cc
index 1d25664..532e255 100644
--- a/lib/decoding/control_channels_decoder_impl.cc
+++ b/lib/decoding/control_channels_decoder_impl.cc
@@ -124,7 +124,7 @@
//std::cout << "Everything correct" << std::endl;
}
//compress bits
- unsigned char outmsg[27];
+ unsigned char outmsg[28];
unsigned char sbuf_len=224;
int i, j, c, pos=0;
for(i = 0; i < sbuf_len; i += 8) {
diff --git a/lib/decoding/tch_f_decoder_impl.cc b/lib/decoding/tch_f_decoder_impl.cc
index cbb1481..f409d37 100644
--- a/lib/decoding/tch_f_decoder_impl.cc
+++ b/lib/decoding/tch_f_decoder_impl.cc
@@ -143,7 +143,7 @@
if (syndrome == 0)
{
- unsigned char outmsg[27];
+ unsigned char outmsg[28];
unsigned char sbuf_len=224;
int i, j, c, pos=0;
for(i = 0; i < sbuf_len; i += 8) {
diff --git a/lib/flow_control/burst_fnr_filter_impl.cc b/lib/flow_control/burst_fnr_filter_impl.cc
index 1aa6f5b..e665acf 100644
--- a/lib/flow_control/burst_fnr_filter_impl.cc
+++ b/lib/flow_control/burst_fnr_filter_impl.cc
@@ -70,7 +70,7 @@
unsigned int frame_nr = be32toh(header->frame_number);
if ((d_mode == FILTER_LESS_OR_EQUAL && frame_nr <= d_framenr)
- || d_mode == FILTER_GREATER_OR_EQUAL && frame_nr >= d_framenr)
+ || (d_mode == FILTER_GREATER_OR_EQUAL && frame_nr >= d_framenr))
{
message_port_pub(pmt::mp("out"), msg);
}
diff --git a/lib/flow_control/burst_sdcch_subslot_filter_impl.cc b/lib/flow_control/burst_sdcch_subslot_filter_impl.cc
index 33e67b8..8e8a66c 100644
--- a/lib/flow_control/burst_sdcch_subslot_filter_impl.cc
+++ b/lib/flow_control/burst_sdcch_subslot_filter_impl.cc
@@ -30,15 +30,6 @@
#include <grgsm/endian.h>
#include <grgsm/gsmtap.h>
-static const int8_t subslots_sdcch4[102] = {
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1
-};
-static const int8_t subslots_sdcch8[102] = {
- 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1,
- 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1
-};
-
namespace gr {
namespace gsm {
@@ -56,9 +47,7 @@
: gr::block("burst_sdcch_subslot_filter",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
- d_mode(mode),
- d_subslots_sdcch4(subslots_sdcch4),
- d_subslots_sdcch8(subslots_sdcch8)
+ d_mode(mode)
{
message_port_register_in(pmt::mp("in"));
message_port_register_out(pmt::mp("out"));
@@ -73,6 +62,17 @@
void burst_sdcch_subslot_filter_impl::process_burst(pmt::pmt_t msg)
{
+ // hardcoded subslots of the channels, both SDCCH and the associated SACCH
+ // -1 means that the particular position in the frame is not SDCCH
+ static const int8_t subslots_sdcch4[102] = {
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1
+ };
+ static const int8_t subslots_sdcch8[102] = {
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1,
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1
+ };
+
pmt::pmt_t header_plus_burst = pmt::cdr(msg);
gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
@@ -83,11 +83,11 @@
if (d_mode == SS_FILTER_SDCCH8)
{
- subslot = d_subslots_sdcch8[fn_mod102];
+ subslot = subslots_sdcch8[fn_mod102];
}
else if (d_mode == SS_FILTER_SDCCH4)
{
- subslot = d_subslots_sdcch4[fn_mod102];
+ subslot = subslots_sdcch4[fn_mod102];
}
if ((subslot == -1) || (d_mode == SS_FILTER_SDCCH4 && subslot > 3))
diff --git a/lib/flow_control/burst_sdcch_subslot_filter_impl.h b/lib/flow_control/burst_sdcch_subslot_filter_impl.h
index 0f2bbe3..40a603e 100644
--- a/lib/flow_control/burst_sdcch_subslot_filter_impl.h
+++ b/lib/flow_control/burst_sdcch_subslot_filter_impl.h
@@ -31,10 +31,6 @@
class burst_sdcch_subslot_filter_impl : public burst_sdcch_subslot_filter
{
private:
- // hardcoded subslots of the channels, both SDCCH and the associated SACCH
- // -1 means that the particular position in the frame is not SDCCH
- const int8_t * const d_subslots_sdcch4;
- const int8_t * const d_subslots_sdcch8;
subslot_filter_mode d_mode;
unsigned int d_subslot;
public:
diff --git a/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc b/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc
index 9774eaa..4115634 100644
--- a/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc
+++ b/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc
@@ -57,9 +57,7 @@
: gr::block("burst_sdcch_subslot_splitter",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
- d_mode(mode),
- d_subslots_sdcch4(subslots_sdcch4),
- d_subslots_sdcch8(subslots_sdcch8)
+ d_mode(mode)
{
message_port_register_in(pmt::mp("in"));
@@ -85,6 +83,17 @@
void burst_sdcch_subslot_splitter_impl::process_burst(pmt::pmt_t msg)
{
+ // hardcoded subslots of the channels, both SDCCH and the associated SACCH
+ // -1 means that the particular position in the frame is not SDCCH
+ static const int8_t subslots_sdcch4[102] = {
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1
+ };
+ static const int8_t subslots_sdcch8[102] = {
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1,
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1
+ };
+
pmt::pmt_t header_plus_burst = pmt::cdr(msg);
gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
@@ -92,14 +101,14 @@
uint32_t fn_mod102 = frame_nr % 102;
int8_t subslot;
-
+
if (d_mode == SPLITTER_SDCCH8)
{
- subslot = d_subslots_sdcch8[fn_mod102];
+ subslot = subslots_sdcch8[fn_mod102];
}
else if (d_mode == SPLITTER_SDCCH4)
{
- subslot = d_subslots_sdcch4[fn_mod102];
+ subslot = subslots_sdcch4[fn_mod102];
}
if ((subslot == -1) || (d_mode == SPLITTER_SDCCH4 && subslot > 3))
diff --git a/lib/flow_control/burst_sdcch_subslot_splitter_impl.h b/lib/flow_control/burst_sdcch_subslot_splitter_impl.h
index d68adce..b8eaaea 100644
--- a/lib/flow_control/burst_sdcch_subslot_splitter_impl.h
+++ b/lib/flow_control/burst_sdcch_subslot_splitter_impl.h
@@ -31,10 +31,6 @@
class burst_sdcch_subslot_splitter_impl : public burst_sdcch_subslot_splitter
{
private:
- // hardcoded subslots of the channels, both SDCCH and the associated SACCH
- // -1 means that the particular position in the frame is not SDCCH
- const int8_t * const d_subslots_sdcch4;
- const int8_t * const d_subslots_sdcch8;
splitter_mode d_mode;
public:
burst_sdcch_subslot_splitter_impl(splitter_mode mode);
diff --git a/lib/receiver/clock_offset_control_impl.cc b/lib/receiver/clock_offset_control_impl.cc
index a590a6d..43a9b8e 100644
--- a/lib/receiver/clock_offset_control_impl.cc
+++ b/lib/receiver/clock_offset_control_impl.cc
@@ -103,7 +103,7 @@
float ppm = -freq_offset/d_fc*1.0e6;
std::string state = pmt::symbol_to_string(pmt::tuple_ref(msg,2));
d_last_state = state;
- if(abs(ppm) > 100) //safeguard against flawed measurements
+ if(std::abs(ppm) > 100.0) //safeguard against flawed measurements
{
ppm=0;
reset();
@@ -132,7 +132,7 @@
if(d_counter == 5)
{
d_counter = 0;
- if(abs(d_last_ppm_estimate-d_ppm_estimate) > 0.1)
+ if(std::abs(d_last_ppm_estimate-d_ppm_estimate) > 0.1)
{
pmt::pmt_t msg_ppm = pmt::from_double(ppm);
message_port_pub(pmt::intern("ppm"), msg_ppm);
diff --git a/lib/receiver/sch.c b/lib/receiver/sch.c
index 2e7de44..3273237 100644
--- a/lib/receiver/sch.c
+++ b/lib/receiver/sch.c
@@ -261,7 +261,7 @@
memcpy(data + SCH_DATA_LEN, buf + SCH_DATA_LEN + N_SYNC_BITS, SCH_DATA_LEN);
// Viterbi decode
- if (errors = conv_decode(data, decoded_data)) {
+ if ((errors = conv_decode(data, decoded_data))) {
// fprintf(stderr, "error: sch: conv_decode (%d)\n", errors);
//DEBUGF("ERR: conv_decode %d\n", errors);
//return errors;