From e44cf44af4abe3ba2b43964d2a1243bbff9a1768 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 21 Apr 2023 11:25:42 +0200 Subject: ms: pretty tx buf class Change-Id: I96c5dd79426a52e7fff2df27bdaa3fae0c69491a --- Transceiver52M/ms/ms_upper.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Transceiver52M/ms/ms_upper.cpp b/Transceiver52M/ms/ms_upper.cpp index 5b213f7..cae1893 100644 --- a/Transceiver52M/ms/ms_upper.cpp +++ b/Transceiver52M/ms/ms_upper.cpp @@ -72,6 +72,13 @@ struct trxcon_inst *g_trxcon; struct internal_q_tx_buf { trxcon_phyif_burst_req r; uint8_t buf[148]; + internal_q_tx_buf() = default; + internal_q_tx_buf(const internal_q_tx_buf &) = delete; + internal_q_tx_buf &operator=(const internal_q_tx_buf &) = default; + internal_q_tx_buf(const struct trxcon::trxcon_phyif_burst_req *br) : r(*br) + { + memcpy(buf, (void *)br->burst, br->burst_len); + } }; using tx_queue_t = spsc_cond<8 * 1, internal_q_tx_buf, true, false>; using cmd_queue_t = spsc_cond<8 * 1, trxcon_phyif_cmd, true, false>; @@ -415,10 +422,7 @@ int trxcon_phyif_handle_burst_req(void *phyif, const struct trxcon::trxcon_phyif return 0; OSMO_ASSERT(br->burst != 0); - trxcon::internal_q_tx_buf b; - b.r = *br; - memcpy(b.buf, (void *)br->burst, br->burst_len); - + trxcon::internal_q_tx_buf b(br); if (!g_exit_flag) trxcon::txq.spsc_push(&b); return 0; -- cgit v1.2.3