lists.osmocom.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
List overview
Download
gerrit-log
May 2023
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
gerrit-log@lists.osmocom.org
1 participants
2583 discussions
Start a n
N
ew thread
[S] Change in osmo-trx[master]: ms: flexible template for value_type buffer sum
by Hoernchen
Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32955
) Change subject: ms: flexible template for value_type buffer sum ...................................................................... ms: flexible template for value_type buffer sum Manual attempts to get the number of complex and single samples right turned out to be a bit error prone at times... Change-Id: I3c9953073555e3a7f70b78b0946dfdf949175a82 --- M Transceiver52M/ms/ms.h M Transceiver52M/ms/ms_rx_lower.cpp 2 files changed, 30 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/55/32955/1 diff --git a/Transceiver52M/ms/ms.h b/Transceiver52M/ms/ms.h index 8ca9b02..9245fa5 100644 --- a/Transceiver52M/ms/ms.h +++ b/Transceiver52M/ms/ms.h @@ -84,16 +84,19 @@ template <typename T> struct is_complex : std::false_type { using baset = T; + static const int len_mul = 1; }; template <typename T> struct is_complex<std::complex<T>> : std::true_type { using baset = typename std::complex<T>::value_type; + static const int len_mul = 2; }; template <typename T> struct is_complex<Complex<T>> : std::true_type { using baset = typename Complex<T>::value_type; + static const int len_mul = 2; }; } // namespace cvt_internal @@ -106,6 +109,19 @@ return cvt_internal::convert_and_scale_i((vd *)dst, (vs *)src, src_len, scale); } +template <typename array_t> +float normed_abs_sum(array_t *src, int len) +{ + using vd = typename cvt_internal::is_complex<array_t>::baset; + auto len_mul = cvt_internal::is_complex<array_t>::len_mul; + auto ptr = reinterpret_cast<const vd *>(src); + float sum = 0; + for (unsigned int i = 0; i < len * len_mul; i++) + sum += std::abs(ptr[i]); + sum /= len * len_mul; + return sum; +} + struct one_burst { one_burst() { diff --git a/Transceiver52M/ms/ms_rx_lower.cpp b/Transceiver52M/ms/ms_rx_lower.cpp index 26ee131..1872c6c 100644 --- a/Transceiver52M/ms/ms_rx_lower.cpp +++ b/Transceiver52M/ms/ms_rx_lower.cpp @@ -101,11 +101,7 @@ const unsigned int rx_max_cutoff = (rxFullScale * 2) / 3; static int gain_check = 0; static float runmean = 0; - float sum = 0; - for (auto i : brst.burst) - sum += abs(i.real()) + abs(i.imag()); - sum /= ONE_TS_BURST_LEN * 2; - + float sum = normed_abs_sum(&brst.burst[0], ONE_TS_BURST_LEN); runmean = gain_check ? (runmean * (gain_check + 2) - 1 + sum) / (gain_check + 2) : sum; if (gain_check == avgburst_num - 1) { @@ -231,12 +227,8 @@ sch_pos = 0; rcv_done = true; auto sch_search_fun = [this] { - auto ptr = reinterpret_cast<const int16_t *>(first_sch_buf); const auto target_val = rxFullScale / 8; - float sum = 0; - for (unsigned int i = 0; i < SCH_LEN_SPS * 2; i++) - sum += std::abs(ptr[i]); - sum /= SCH_LEN_SPS * 2; + float sum = normed_abs_sum(first_sch_buf, SCH_LEN_SPS); //FIXME: arbitrary value, gain cutoff if (sum > target_val || rxgain >= 60) // enough ? -- To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32955
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I3c9953073555e3a7f70b78b0946dfdf949175a82 Gerrit-Change-Number: 32955 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-MessageType: newchange
2 years, 1 month
1
0
0
0
[M] Change in osmo-trx[master]: ms: first exit fix using queue timeouts
by Hoernchen
Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32954
) Change subject: ms: first exit fix using queue timeouts ...................................................................... ms: first exit fix using queue timeouts Change-Id: I0b8deebc63cf4d936666fd68e1666d1917e89a5d --- M Transceiver52M/ms/bladerf_specific.h M Transceiver52M/ms/itrq.h M Transceiver52M/ms/ms.cpp M Transceiver52M/ms/ms.h M Transceiver52M/ms/ms_rx_lower.cpp M Transceiver52M/ms/ms_upper.cpp M Transceiver52M/ms/ms_upper.h 7 files changed, 94 insertions(+), 39 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/54/32954/1 diff --git a/Transceiver52M/ms/bladerf_specific.h b/Transceiver52M/ms/bladerf_specific.h index 3dc4777..e32d77c 100644 --- a/Transceiver52M/ms/bladerf_specific.h +++ b/Transceiver52M/ms/bladerf_specific.h @@ -192,7 +192,7 @@ struct bladerf_stream *rx_stream; struct bladerf_stream *tx_stream; // using pkt2buf = blade_otw_buffer<2, blade_speed_buffer_type::SS>; - using tx_buf_q_type = spsc_cond<BLADE_NUM_BUFFERS, dev_buf_t *, true, false>; + using tx_buf_q_type = spsc_cond_timeout<BLADE_NUM_BUFFERS, dev_buf_t *, true, false>; const unsigned int rxFullScale, txFullScale; const int rxtxdelay; diff --git a/Transceiver52M/ms/itrq.h b/Transceiver52M/ms/itrq.h index 1d9e217..69ff515 100644 --- a/Transceiver52M/ms/itrq.h +++ b/Transceiver52M/ms/itrq.h @@ -29,7 +29,58 @@ namespace spsc_detail { -template <bool block_read, bool block_write> class spsc_cond_detail { +template <bool block_read, bool block_write> +class spsc_cond_timeout_detail { + std::condition_variable cond_r, cond_w; + std::mutex lr, lw; + std::atomic_int r_flag, w_flag; + const int timeout_ms = 200; + + public: + explicit spsc_cond_timeout_detail() : r_flag(0), w_flag(0) + { + } + + ~spsc_cond_timeout_detail() + { + } + + ssize_t spsc_check_r() + { + std::unique_lock<std::mutex> lk(lr); + if (cond_r.wait_for(lk, std::chrono::milliseconds(timeout_ms), [&] { return r_flag != 0; })) { + r_flag--; + return 1; + } else { + return 0; + } + } + ssize_t spsc_check_w() + { + std::unique_lock<std::mutex> lk(lw); + if (cond_w.wait_for(lk, std::chrono::milliseconds(timeout_ms), [&] { return w_flag != 0; })) { + w_flag--; + return 1; + } else { + return 0; + } + } + void spsc_notify_r() + { + std::unique_lock<std::mutex> lk(lr); + r_flag++; + cond_r.notify_one(); + } + void spsc_notify_w() + { + std::unique_lock<std::mutex> lk(lw); + w_flag++; + cond_w.notify_one(); + } +}; + +template <bool block_read, bool block_write> +class spsc_cond_detail { std::condition_variable cond_r, cond_w; std::mutex lr, lw; std::atomic_int r_flag, w_flag; @@ -74,7 +125,8 @@ }; // originally designed for select loop integration -template <bool block_read, bool block_write> class spsc_efd_detail { +template <bool block_read, bool block_write> +class spsc_efd_detail { int efd_r, efd_w; /* eventfds used to block/notify readers/writers */ public: @@ -191,4 +243,7 @@ template <unsigned int SZ, typename ELEM, bool block_read, bool block_write> class spsc_evfd : public spsc_detail::spsc<SZ, ELEM, block_read, block_write, spsc_detail::spsc_efd_detail> {}; template <unsigned int SZ, typename ELEM, bool block_read, bool block_write> -class spsc_cond : public spsc_detail::spsc<SZ, ELEM, block_read, block_write, spsc_detail::spsc_cond_detail> {}; \ No newline at end of file +class spsc_cond : public spsc_detail::spsc<SZ, ELEM, block_read, block_write, spsc_detail::spsc_cond_detail> {}; +template <unsigned int SZ, typename ELEM, bool block_read, bool block_write> +class spsc_cond_timeout + : public spsc_detail::spsc<SZ, ELEM, block_read, block_write, spsc_detail::spsc_cond_timeout_detail> {}; \ No newline at end of file diff --git a/Transceiver52M/ms/ms.cpp b/Transceiver52M/ms/ms.cpp index 2e91cae..e587c05 100644 --- a/Transceiver52M/ms/ms.cpp +++ b/Transceiver52M/ms/ms.cpp @@ -78,7 +78,7 @@ }; } -void ms_trx::start() +void ms_trx::start_lower_ms() { if (stop_lower_threads_flag) return; diff --git a/Transceiver52M/ms/ms.h b/Transceiver52M/ms/ms.h index efccffc..8ca9b02 100644 --- a/Transceiver52M/ms/ms.h +++ b/Transceiver52M/ms/ms.h @@ -117,7 +117,7 @@ }; }; -using rx_queue_t = spsc_cond<8 * NUM_RXQ_FRAMES, one_burst, true, false>; +using rx_queue_t = spsc_cond_timeout<8 * NUM_RXQ_FRAMES, one_burst, true, false>; enum class SCH_STATE { SEARCHING, FOUND }; @@ -267,7 +267,7 @@ sched_params::target hw_target; single_thread_pool worker_thread; - void start(); + void start_lower_ms(); std::atomic<bool> upper_is_ready; void set_upper_ready(bool is_ready); diff --git a/Transceiver52M/ms/ms_rx_lower.cpp b/Transceiver52M/ms/ms_rx_lower.cpp index 4d6ce18..26ee131 100644 --- a/Transceiver52M/ms/ms_rx_lower.cpp +++ b/Transceiver52M/ms/ms_rx_lower.cpp @@ -142,10 +142,8 @@ memcpy(brst.sch_bits, sch_demod_bits, sizeof(sch_demod_bits)); } - if (upper_is_ready) { // this is blocking, so only submit if there is a reader - only if upper exists! - while (!rxqueue.spsc_push(&brst)) - ; - } + while (upper_is_ready && !rxqueue.spsc_push(&brst)) + ; if (do_auto_gain) maybe_update_gain(brst); diff --git a/Transceiver52M/ms/ms_upper.cpp b/Transceiver52M/ms/ms_upper.cpp index a10d542..4b2f919 100644 --- a/Transceiver52M/ms/ms_upper.cpp +++ b/Transceiver52M/ms/ms_upper.cpp @@ -80,37 +80,16 @@ while (!g_exit_flag) { driveControl(); } - std::cerr << "exit control!" << std::endl; + std::cerr << "exit U control!" << std::endl; }); - msleep(1); thr_tx = std::thread([this] { set_name_aff_sched(sched_params::thread_names::U_TX); while (!g_exit_flag) { driveTx(); } - std::cerr << "exit tx U!" << std::endl; + std::cerr << "exit U tx!" << std::endl; }); - // atomic ensures data is not written to q until loop reads - start_lower_ms(); - - set_name_aff_sched(sched_params::thread_names::U_RX); - while (!g_exit_flag) { - // set_upper_ready(true) needs to happen during cmd handling: - // the main loop is driven by rx, so unless rx is on AND transceiver is on we get stuck.. - driveReceiveFIFO(); - osmo_select_main(1); - - trxcon_phyif_rsp r; - if (cmdq_from_phy.spsc_pop(&r)) { - DBGLG() << "HAVE RESP:" << r.type << std::endl; - trxcon_phyif_handle_rsp(g_trxcon, &r); - } - } - set_upper_ready(false); - std::cerr << "exit rx U!" << std::endl; - mOn = false; - #ifdef LSANDEBUG std::thread([this] { set_name_aff_sched(sched_params::thread_names::LEAKCHECK); @@ -123,9 +102,23 @@ #endif } -void upper_trx::start_lower_ms() +void upper_trx::main_loop() { - ms_trx::start(); + set_name_aff_sched(sched_params::thread_names::U_RX); + set_upper_ready(true); + while (!g_exit_flag) { + driveReceiveFIFO(); + osmo_select_main(1); + + trxcon_phyif_rsp r; + if (cmdq_from_phy.spsc_pop(&r)) { + DBGLG() << "HAVE RESP:" << r.type << std::endl; + trxcon_phyif_handle_rsp(g_trxcon, &r); + } + } + set_upper_ready(false); + std::cerr << "exit U rx!" << std::endl; + mOn = false; } // signalvector is owning despite claiming not to, but we can pretend, too.. @@ -346,7 +339,7 @@ case TRXCON_PHYIF_CMDT_POWERON: if (!mOn) { mOn = true; - set_upper_ready(true); + start_lower_ms(); } break; case TRXCON_PHYIF_CMDT_POWEROFF: @@ -430,7 +423,7 @@ // blocking, will return when global exit is requested trx->start_threads(); - + trx->main_loop(); trx->stop_threads(); trx->stop_upper_threads(); diff --git a/Transceiver52M/ms/ms_upper.h b/Transceiver52M/ms/ms_upper.h index bc9bd14..2362365 100644 --- a/Transceiver52M/ms/ms_upper.h +++ b/Transceiver52M/ms/ms_upper.h @@ -41,7 +41,7 @@ public: void start_threads(); - void start_lower_ms(); + void main_loop(); void stop_upper_threads(); upper_trx(){}; -- To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32954
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I0b8deebc63cf4d936666fd68e1666d1917e89a5d Gerrit-Change-Number: 32954 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-MessageType: newchange
2 years, 1 month
1
0
0
0
[S] Change in osmo-trx[master]: ms: sch: drop intermediate softvector
by Hoernchen
Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32956
) Change subject: ms: sch: drop intermediate softvector ...................................................................... ms: sch: drop intermediate softvector Change-Id: Iadc8f224f9e43282339197b11f388fc574656299 --- M Transceiver52M/ms/ms.h M Transceiver52M/ms/ms_rx_lower.cpp 2 files changed, 15 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/56/32956/1 diff --git a/Transceiver52M/ms/ms.h b/Transceiver52M/ms/ms.h index 9245fa5..466812a 100644 --- a/Transceiver52M/ms/ms.h +++ b/Transceiver52M/ms/ms.h @@ -289,7 +289,7 @@ bool handle_sch_or_nb(); bool handle_sch(bool first = false); - bool decode_sch(float *bits, bool update_global_clock); + bool decode_sch(char *bits, bool update_global_clock); SCH_STATE search_for_sch(dev_buf_t *rcd); void grab_bursts(dev_buf_t *rcd); diff --git a/Transceiver52M/ms/ms_rx_lower.cpp b/Transceiver52M/ms/ms_rx_lower.cpp index 1872c6c..5a07df5 100644 --- a/Transceiver52M/ms/ms_rx_lower.cpp +++ b/Transceiver52M/ms/ms_rx_lower.cpp @@ -51,15 +51,16 @@ #endif #define PRINT_Q_OVERFLOW -bool ms_trx::decode_sch(float *bits, bool update_global_clock) + +bool ms_trx::decode_sch(char *bits, bool update_global_clock) { int fn; struct sch_info sch; ubit_t info[GSM_SCH_INFO_LEN]; sbit_t data[GSM_SCH_CODED_LEN]; - float_to_sbit(&bits[3], &data[0], 1, 39); - float_to_sbit(&bits[106], &data[39], 1, 39); + memcpy(&data[0], &bits[3], 39); + memcpy(&data[39], &bits[106], 39); if (!gsm_sch_decode(info, data)) { gsm_sch_parse(info, &sch); @@ -171,12 +172,7 @@ } detect_burst(&ss[start], &channel_imp_resp[0], 0, sch_demod_bits); - SoftVector bitss(148); - for (int i = 0; i < 148; i++) { - bitss[i] = (sch_demod_bits[i]); - } - - auto sch_decode_success = decode_sch(bitss.begin(), is_first_sch_acq); + auto sch_decode_success = decode_sch(sch_demod_bits, is_first_sch_acq); if (sch_decode_success) { const auto ts_offset_symb = 0; -- To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32956
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Iadc8f224f9e43282339197b11f388fc574656299 Gerrit-Change-Number: 32956 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-MessageType: newchange
2 years, 1 month
1
0
0
0
[S] Change in osmo-trx[master]: ms: make init call less confusing
by Hoernchen
Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32957
) Change subject: ms: make init call less confusing ...................................................................... ms: make init call less confusing Change-Id: I122b0c8cf97e5efcbc60cd95e8bd06a50d57eb57 --- M Transceiver52M/ms/ms.cpp M Transceiver52M/ms/ms.h 2 files changed, 10 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/57/32957/1 diff --git a/Transceiver52M/ms/ms.cpp b/Transceiver52M/ms/ms.cpp index e587c05..896928e 100644 --- a/Transceiver52M/ms/ms.cpp +++ b/Transceiver52M/ms/ms.cpp @@ -49,7 +49,7 @@ int ms_trx::init_dev_and_streams() { int status = 0; - status = base::init_device(rx_bh(), tx_bh()); + status = init_device(rx_bh(), tx_bh()); if (status < 0) { std::cerr << "failed to init dev!" << std::endl; return -1; diff --git a/Transceiver52M/ms/ms.h b/Transceiver52M/ms/ms.h index 466812a..0b69420 100644 --- a/Transceiver52M/ms/ms.h +++ b/Transceiver52M/ms/ms.h @@ -293,7 +293,6 @@ SCH_STATE search_for_sch(dev_buf_t *rcd); void grab_bursts(dev_buf_t *rcd); - int init_device(); int init_dev_and_streams(); void stop_threads(); void *rx_cb(ms_trx *t); -- To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32957
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I122b0c8cf97e5efcbc60cd95e8bd06a50d57eb57 Gerrit-Change-Number: 32957 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-MessageType: newchange
2 years, 1 month
1
0
0
0
[M] Change in osmo-trx[master]: ms: xray
by Hoernchen
Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32958
) Change subject: ms: xray ...................................................................... ms: xray Only used for development, will be removed later. Change-Id: I2039204860f1d6c4a7f4fe78200f560d75a8b90e --- M Transceiver52M/ms/ms_upper.cpp 1 file changed, 55 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/58/32958/1 diff --git a/Transceiver52M/ms/ms_upper.cpp b/Transceiver52M/ms/ms_upper.cpp index 4b2f919..4944269 100644 --- a/Transceiver52M/ms/ms_upper.cpp +++ b/Transceiver52M/ms/ms_upper.cpp @@ -386,8 +386,51 @@ } } +#ifdef XRAY +#include <fstream> +#include <string> +// #include <iostream> +#include <sstream> +#include "xray/xray_interface.h" +// patch_premain=false ! +[[clang::xray_never_instrument]] void init_xray_patches() +{ + std::vector<int> result; + std::ifstream f("trace.txt"); + std::stringstream ss; + if (f) { + ss << f.rdbuf(); + f.close(); + } else + return; + + while (ss.good()) { + std::string substr; + if (getline(ss, substr, ',')) + result.push_back(std::stoi(substr)); + } + + for (const auto id : result) { + std::cout << id << std::endl; + assert(__xray_patch_function(id) == XRayPatchingStatus::SUCCESS); + } + if (result.empty()) + assert(__xray_patch() == XRayPatchingStatus::SUCCESS); +} +#define XRAY_INIT \ + { \ + assert(__xray_unpatch() == XRayPatchingStatus::SUCCESS); \ + init_xray_patches(); \ + } +#define XRAY_DEINIT assert(__xray_unpatch() == XRayPatchingStatus::SUCCESS); +#else +#define XRAY_INIT +#define XRAY_DEINIT +#endif + int main(int argc, char *argv[]) { + XRAY_INIT auto tall_trxcon_ctx = talloc_init("trxcon context"); signal(SIGPIPE, sighandler); signal(SIGINT, sighandler); @@ -427,5 +470,6 @@ trx->stop_threads(); trx->stop_upper_threads(); + XRAY_DEINIT return status; } -- To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32958
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I2039204860f1d6c4a7f4fe78200f560d75a8b90e Gerrit-Change-Number: 32958 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-MessageType: newchange
2 years, 1 month
1
0
0
0
[S] Change in osmo-trx[master]: ms : fix the template formatting
by Hoernchen
Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32941
) Change subject: ms : fix the template formatting ...................................................................... ms : fix the template formatting Those lines predate the .clang-format changes. Change-Id: I891bdf95004accebbbe54916e4472bd381fac545 --- M Transceiver52M/ms/bladerf_specific.h M Transceiver52M/ms/ms.cpp M Transceiver52M/ms/uhd_specific.h 3 files changed, 35 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/41/32941/1 diff --git a/Transceiver52M/ms/bladerf_specific.h b/Transceiver52M/ms/bladerf_specific.h index d5088a7..e1e8cc6 100644 --- a/Transceiver52M/ms/bladerf_specific.h +++ b/Transceiver52M/ms/bladerf_specific.h @@ -39,14 +39,16 @@ const int SAMPLE_SCALE_FACTOR = 15; // actually 16 but sigproc complains about clipping.. // see
https://en.cppreference.com/w/cpp/language/parameter_pack
"Brace-enclosed initializers" example -template <typename Arg, typename... Args> void expand_args(std::ostream &out, Arg &&arg, Args &&...args) +template <typename Arg, typename... Args> +void expand_args(std::ostream &out, Arg &&arg, Args &&...args) { out << '(' << std::forward<Arg>(arg); (void)(int[]){ 0, (void((out << "," << std::forward<Args>(args))), 0)... }; out << ')' << std::endl; } -template <class R, class... Args> using RvalFunc = R (*)(Args...); +template <class R, class... Args> +using RvalFunc = R (*)(Args...); template <class R, class... Args> R exec_and_check(RvalFunc<R, Args...> func, const char *fname, const char *finame, const char *funcname, int line, @@ -67,7 +69,8 @@ #pragma pack(push, 1) using blade_sample_type = std::complex<int16_t>; enum class blade_speed_buffer_type { HS, SS }; -template <blade_speed_buffer_type T> struct blade_usb_message { +template <blade_speed_buffer_type T> +struct blade_usb_message { uint32_t reserved; uint64_t ts; uint32_t meta_flags; @@ -76,7 +79,8 @@ static_assert(sizeof(blade_usb_message<blade_speed_buffer_type::SS>) == 2048, "blade buffer mismatch!"); static_assert(sizeof(blade_usb_message<blade_speed_buffer_type::HS>) == 1024, "blade buffer mismatch!"); -template <unsigned int SZ, blade_speed_buffer_type T> struct blade_otw_buffer { +template <unsigned int SZ, blade_speed_buffer_type T> +struct blade_otw_buffer { static_assert((SZ >= 2 && !(SZ % 2)), "min size is 2x usb buffer!"); blade_usb_message<T> m[SZ]; int actual_samples_per_msg() @@ -172,7 +176,8 @@ }; #pragma pack(pop) -template <unsigned int SZ, blade_speed_buffer_type T> struct blade_otw_buffer_helper { +template <unsigned int SZ, blade_speed_buffer_type T> +struct blade_otw_buffer_helper { static_assert((SZ >= 1024 && ((SZ & (SZ - 1)) == 0)), "only buffer size multiples of 1024 allowed!"); static blade_otw_buffer<SZ / 512, T> x; }; @@ -181,7 +186,8 @@ // using buf_in_use = blade_otw_buffer<2, blade_speed_buffer_type::SS>; using bh_fn_t = std::function<int(dev_buf_t *)>; -template <typename T> struct blade_hw { +template <typename T> +struct blade_hw { struct bladerf *dev; struct bladerf_stream *rx_stream; struct bladerf_stream *tx_stream; diff --git a/Transceiver52M/ms/ms.cpp b/Transceiver52M/ms/ms.cpp index ec2c5f8..d191ed5 100644 --- a/Transceiver52M/ms/ms.cpp +++ b/Transceiver52M/ms/ms.cpp @@ -49,7 +49,8 @@ static int offset_ctr = 0; #endif -template <> std::atomic<bool> ms_trx::base::stop_me_flag(false); +template <> +std::atomic<bool> ms_trx::base::stop_me_flag(false); void tx_test(ms_trx *t, ts_hitter_q_t *q, unsigned int *tsc) { @@ -137,7 +138,8 @@ } } #ifdef SYNCTHINGONLY -template <typename A> auto parsec(std::vector<std::string> &v, A &itr, std::string arg, bool *rv) +template <typename A> +auto parsec(std::vector<std::string> &v, A &itr, std::string arg, bool *rv) { if (*itr == arg) { *rv = true; @@ -158,15 +160,17 @@ } return false; } -template <typename A> bool parsec(std::vector<std::string> &v, A &itr, std::string arg, int scale, int *rv) +template <typename A> +bool parsec(std::vector<std::string> &v, A &itr, std::string arg, int scale, int *rv) { return parsec( - v, itr, arg, [scale](const char *v) -> auto{ return atoi(v) * scale; }, rv); + v, itr, arg, [scale](const char *v) -> auto { return atoi(v) * scale; }, rv); } -template <typename A> bool parsec(std::vector<std::string> &v, A &itr, std::string arg, int scale, unsigned int *rv) +template <typename A> +bool parsec(std::vector<std::string> &v, A &itr, std::string arg, int scale, unsigned int *rv) { return parsec( - v, itr, arg, [scale](const char *v) -> auto{ return atoi(v) * scale; }, rv); + v, itr, arg, [scale](const char *v) -> auto { return atoi(v) * scale; }, rv); } int main(int argc, char *argv[]) diff --git a/Transceiver52M/ms/uhd_specific.h b/Transceiver52M/ms/uhd_specific.h index 8295a54..726bb95 100644 --- a/Transceiver52M/ms/uhd_specific.h +++ b/Transceiver52M/ms/uhd_specific.h @@ -65,7 +65,8 @@ using dev_buf_t = uhd_buf_wrap; using bh_fn_t = std::function<int(dev_buf_t *)>; -template <typename T> struct uhd_hw { +template <typename T> +struct uhd_hw { uhd::usrp::multi_usrp::sptr dev; uhd::rx_streamer::sptr rx_stream; uhd::tx_streamer::sptr tx_stream; -- To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32941
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I891bdf95004accebbbe54916e4472bd381fac545 Gerrit-Change-Number: 32941 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-MessageType: newchange
2 years, 1 month
1
0
0
0
[M] Change in osmo-trx[master]: ms: prettify scheduling + add odroid
by Hoernchen
Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32943
) Change subject: ms: prettify scheduling + add odroid ...................................................................... ms: prettify scheduling + add odroid Change-Id: Icaf42fd5f76dc2d53dc526558aa8ceaa9c190f7b --- M Transceiver52M/ms/ms.cpp M Transceiver52M/ms/ms.h M Transceiver52M/ms/ms_rx_lower.cpp M Transceiver52M/ms/ms_upper.cpp 4 files changed, 68 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/43/32943/1 diff --git a/Transceiver52M/ms/ms.cpp b/Transceiver52M/ms/ms.cpp index d191ed5..1dc2587 100644 --- a/Transceiver52M/ms/ms.cpp +++ b/Transceiver52M/ms/ms.cpp @@ -278,12 +278,13 @@ { auto fn = get_rx_burst_handler_fn(rx_bh()); rx_task = std::thread(fn); - set_name_aff_sched(rx_task.native_handle(), "rxrun", 2, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 2); + set_name_aff_sched(rx_task.native_handle(), sched_params::thread_names::RXRUN); usleep(1000); auto fn2 = get_tx_burst_handler_fn(tx_bh()); tx_task = std::thread(fn2); - set_name_aff_sched(tx_task.native_handle(), "txrun", 2, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 1); + set_name_aff_sched(tx_task.native_handle(), sched_params::thread_names::TXRUN); + } void ms_trx::set_upper_ready(bool is_ready) diff --git a/Transceiver52M/ms/ms.h b/Transceiver52M/ms/ms.h index 8ea9932..6f8d54f 100644 --- a/Transceiver52M/ms/ms.h +++ b/Transceiver52M/ms/ms.h @@ -200,6 +200,40 @@ } }; +static struct sched_params { + enum thread_names { U_CTL = 0, U_RX, U_TX, SCH_SEARCH, MAIN, LEAKCHECK, RXRUN, TXRUN, _THRD_NAME_COUNT }; + enum target { ODROID = 0, PI4 }; + const char *name; + int core; + int schedtype; + int prio; +} schdp[][sched_params::_THRD_NAME_COUNT]{ + { + { "upper_ctrl", 2, SCHED_RR, sched_get_priority_max(SCHED_RR) }, + { "upper_rx", 2, SCHED_RR, sched_get_priority_max(SCHED_RR) - 5 }, + { "upper_tx", 2, SCHED_RR, sched_get_priority_max(SCHED_RR) - 1 }, + + { "sch_search", 3, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 5 }, + { "main", 3, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 5 }, + { "leakcheck", 3, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 10 }, + + { "rxrun", 4, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 2 }, + { "txrun", 5, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 1 }, + }, + { + { "upper_ctrl", 1, SCHED_RR, sched_get_priority_max(SCHED_RR) }, + { "upper_rx", 1, SCHED_RR, sched_get_priority_max(SCHED_RR) - 5 }, + { "upper_tx", 1, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 1 }, + + { "sch_search", 1, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 5 }, + { "main", 3, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 5 }, + { "leakcheck", 1, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 10 }, + + { "rxrun", 2, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 2 }, + { "txrun", 3, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 1 }, + }, +}; + using ts_hitter_q_t = spsc_cond<64, GSM::Time, true, false>; struct ms_trx : public BASET { @@ -230,6 +264,8 @@ int64_t first_sch_ts_start = -1; time_keeper timekeeper; + int hw_cpus; + sched_params::target hw_target; void start(); std::atomic<bool> upper_is_ready; @@ -250,8 +286,11 @@ ms_trx() : timing_advance(0), do_auto_gain(false), rxqueue(), first_sch_buf(new blade_sample_type[SCH_LEN_SPS]), - burst_copy_buffer(new blade_sample_type[ONE_TS_BURST_LEN]), rcv_done{ false }, sch_thread_done{ false } + burst_copy_buffer(new blade_sample_type[ONE_TS_BURST_LEN]), rcv_done{ false }, + sch_thread_done{ false }, hw_cpus(std::thread::hardware_concurrency()), + hw_target(hw_cpus > 4 ? sched_params::target::ODROID : sched_params::target::PI4) { + std::cerr << "scheduling for: " << (hw_cpus > 4 ? "odroid" : "pi4") << std::endl; } virtual ~ms_trx() @@ -269,11 +308,19 @@ timing_advance = val * 4; } - void set_name_aff_sched(const char *name, int cpunum, int schedtype, int prio) + void set_name_aff_sched(sched_params::thread_names name) { - set_name_aff_sched(pthread_self(), name, cpunum, schedtype, prio); + set_name_aff_sched(pthread_self(), name); } + void set_name_aff_sched(std::thread::native_handle_type h, sched_params::thread_names name) + { + auto tgt = schdp[hw_target][name]; + // std::cerr << "scheduling for: " << tgt.name << ":" << tgt.core << std::endl; + set_name_aff_sched(h, tgt.name, tgt.core, tgt.schedtype, tgt.prio); + } + + private: void set_name_aff_sched(std::thread::native_handle_type h, const char *name, int cpunum, int schedtype, int prio) { diff --git a/Transceiver52M/ms/ms_rx_lower.cpp b/Transceiver52M/ms/ms_rx_lower.cpp index e39d72d..e8d8e0e 100644 --- a/Transceiver52M/ms/ms_rx_lower.cpp +++ b/Transceiver52M/ms/ms_rx_lower.cpp @@ -235,7 +235,7 @@ sch_pos = 0; rcv_done = true; std::thread([this] { - set_name_aff_sched("sch_search", 1, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 5); + set_name_aff_sched(sched_params::thread_names::SCH_SEARCH); auto ptr = reinterpret_cast<const int16_t *>(first_sch_buf); const auto target_val = rxFullScale / 8; diff --git a/Transceiver52M/ms/ms_upper.cpp b/Transceiver52M/ms/ms_upper.cpp index 63f5926..3cb27e3 100644 --- a/Transceiver52M/ms/ms_upper.cpp +++ b/Transceiver52M/ms/ms_upper.cpp @@ -97,14 +97,14 @@ void upper_trx::start_threads() { thr_control = std::thread([this] { - set_name_aff_sched("upper_ctrl", 1, SCHED_RR, sched_get_priority_max(SCHED_RR)); + set_name_aff_sched(sched_params::thread_names::U_CTL); while (!g_exit_flag) { driveControl(); } }); msleep(1); thr_tx = std::thread([this] { - set_name_aff_sched("upper_tx", 1, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 1); + set_name_aff_sched(sched_params::thread_names::U_TX); while (!g_exit_flag) { driveTx(); } @@ -113,7 +113,7 @@ // atomic ensures data is not written to q until loop reads start_lower_ms(); - set_name_aff_sched("upper_rx", 1, SCHED_FIFO, sched_get_priority_max(SCHED_RR) - 5); + set_name_aff_sched(sched_params::thread_names::U_RX); while (!g_exit_flag) { // set_upper_ready(true); driveReceiveFIFO(); @@ -128,7 +128,7 @@ #ifdef LSANDEBUG std::thread([this] { - set_name_aff_sched("leakcheck", 1, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 10); + set_name_aff_sched(sched_params::thread_names::LEAKCHECK); while (1) { std::this_thread::sleep_for(std::chrono::seconds{ 5 }); @@ -485,7 +485,7 @@ std::cerr << "Error initializing hardware, quitting.." << std::endl; return -1; } - trx->set_name_aff_sched("main", 3, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 5); + trx->set_name_aff_sched(sched_params::thread_names::MAIN); if (!trxcon::trxc_l1ctl_init(tall_trxcon_ctx)) { std::cerr << "Error initializing l1ctl, quitting.." << std::endl; -- To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32943
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Icaf42fd5f76dc2d53dc526558aa8ceaa9c190f7b Gerrit-Change-Number: 32943 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-MessageType: newchange
2 years, 1 month
1
0
0
0
[S] Change in osmo-trx[master]: ms: fix the gain init for blade
by Hoernchen
Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32942
) Change subject: ms: fix the gain init for blade ...................................................................... ms: fix the gain init for blade Change-Id: Ic5a25d6f5606fba599b8144fbec7285047dca3c9 --- M Transceiver52M/ms/bladerf_specific.h 1 file changed, 12 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/42/32942/1 diff --git a/Transceiver52M/ms/bladerf_specific.h b/Transceiver52M/ms/bladerf_specific.h index e1e8cc6..78c51ab 100644 --- a/Transceiver52M/ms/bladerf_specific.h +++ b/Transceiver52M/ms/bladerf_specific.h @@ -222,7 +222,7 @@ { close_device(); } - blade_hw() : rxFullScale(2047), txFullScale(2047), rxtxdelay(-60) + blade_hw() : rxFullScale(2047), txFullScale(2047), rxtxdelay(-60), rxgain(30), txgain(30) { } @@ -290,8 +290,8 @@ (bladerf_bandwidth *)NULL); blade_check(bladerf_set_gain_mode, dev, BLADERF_CHANNEL_RX(0), BLADERF_GAIN_MGC); - blade_check(bladerf_set_gain, dev, BLADERF_CHANNEL_RX(0), (bladerf_gain)30); - blade_check(bladerf_set_gain, dev, BLADERF_CHANNEL_TX(0), (bladerf_gain)30); + setRxGain(rxgain, 0); + setTxGain(txgain, 0); usleep(1000); blade_check(bladerf_enable_module, dev, BLADERF_MODULE_RX, true); usleep(1000); @@ -308,8 +308,6 @@ buf_mgmt.bufptrqueue.spsc_push(&cur_buffer[i]); } - setRxGain(20); - setTxGain(30); usleep(1000); -- To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32942
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ic5a25d6f5606fba599b8144fbec7285047dca3c9 Gerrit-Change-Number: 32942 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-MessageType: newchange
2 years, 1 month
1
0
0
0
[S] Change in osmo-msc[master]: contrib/jenkins: create workspace.tar.xz on error
by fixeria
Attention is currently required from: osmith. fixeria has posted comments on this change. (
https://gerrit.osmocom.org/c/osmo-msc/+/32939
) Change subject: contrib/jenkins: create workspace.tar.xz on error ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit
https://gerrit.osmocom.org/c/osmo-msc/+/32939
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: If7b4eb050e2b3f763b5cfddf1a5b6a18bb41f46e Gerrit-Change-Number: 32939 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Tue, 23 May 2023 14:28:01 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
2 years, 1 month
1
0
0
0
[S] Change in osmo-bsc[master]: contrib/jenkins: create workspace.tar.xz on error
by fixeria
Attention is currently required from: osmith. fixeria has posted comments on this change. (
https://gerrit.osmocom.org/c/osmo-bsc/+/32940
) Change subject: contrib/jenkins: create workspace.tar.xz on error ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/32940
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I1439c06316edbe11f162c14774c2d507152b97a7 Gerrit-Change-Number: 32940 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Tue, 23 May 2023 14:27:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
2 years, 1 month
1
0
0
0
← Newer
1
...
99
100
101
102
103
104
105
...
259
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
Results per page:
10
25
50
100
200