aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric <ewild@sysmocom.de>2020-04-29 17:26:17 +0200
committerEric <ewild@sysmocom.de>2020-04-29 17:26:17 +0200
commit57ece5a46f0ec5b5f1518efe72414cea163bf732 (patch)
treeb39aab45b590cd55c8fcf2d6c9a40dfba2513a64
parentdac7708ff3915f28969942727417730aa713f457 (diff)
ipc: remove intermediate class used for debugging
-rw-r--r--Transceiver52M/device/ipc/IPCDevice.cpp14
-rw-r--r--Transceiver52M/device/ipc/Makefile.am4
-rw-r--r--Transceiver52M/device/ipc/ipcb210.cpp210
-rw-r--r--Transceiver52M/device/ipc/ipcb210.h49
4 files changed, 16 insertions, 261 deletions
diff --git a/Transceiver52M/device/ipc/IPCDevice.cpp b/Transceiver52M/device/ipc/IPCDevice.cpp
index 7cf69a5..a96f796 100644
--- a/Transceiver52M/device/ipc/IPCDevice.cpp
+++ b/Transceiver52M/device/ipc/IPCDevice.cpp
@@ -1077,3 +1077,17 @@ bool IPCDevice::setRxFreq(double wFreq, size_t chan)
return ipc_sock_send(&sk_chan_state[chan], msg) < 0 ? false : true;
}
+
+RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
+ const std::vector<std::string> &tx_paths, const std::vector<std::string> &rx_paths)
+{
+ if (tx_sps != rx_sps) {
+ LOGC(DDEV, ERROR) << "IPC Requires tx_sps == rx_sps";
+ return NULL;
+ }
+ if (lo_offset != 0.0) {
+ LOGC(DDEV, ERROR) << "IPC doesn't support lo_offset";
+ return NULL;
+ }
+ return new IPCDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths);
+}
diff --git a/Transceiver52M/device/ipc/Makefile.am b/Transceiver52M/device/ipc/Makefile.am
index 20c8ec3..82be5a9 100644
--- a/Transceiver52M/device/ipc/Makefile.am
+++ b/Transceiver52M/device/ipc/Makefile.am
@@ -5,11 +5,11 @@ AM_CFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOVTY_C
AM_CXXFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOVTY_CFLAGS)
AM_LDFLAGS = -lpthread -lrt
-noinst_HEADERS = IPCDevice.h shm.h ipcb210.h ../uhd/UHDDevice.h uhdwrap.h
+noinst_HEADERS = IPCDevice.h shm.h ../uhd/UHDDevice.h uhdwrap.h
noinst_LTLIBRARIES = libdevice.la
-libdevice_la_SOURCES = ipc-driver-test.c ipcb210.cpp IPCDevice.cpp shm.c ../uhd/UHDDevice.cpp uhdwrap.cpp ipc_shm.c ipc_chan.c ipc_sock.c
+libdevice_la_SOURCES = ipc-driver-test.c IPCDevice.cpp shm.c ../uhd/UHDDevice.cpp uhdwrap.cpp ipc_shm.c ipc_chan.c ipc_sock.c
libdevice_la_LIBADD = $(top_builddir)/Transceiver52M/device/common/libdevice_common.la
libdevice_la_CXXFLAGS = $(AM_CXXFLAGS) $(UHD_CFLAGS) -DIPCMAGIC
diff --git a/Transceiver52M/device/ipc/ipcb210.cpp b/Transceiver52M/device/ipc/ipcb210.cpp
deleted file mode 100644
index a93a38d..0000000
--- a/Transceiver52M/device/ipc/ipcb210.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
-* Copyright 2020 sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
-* Author: Eric Wild <ewild@sysmocom.de>
-*
-* SPDX-License-Identifier: 0BSD
-*
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
-*/
-extern "C" {
-#include <osmocom/core/application.h>
-#include <osmocom/core/talloc.h>
-#include <osmocom/core/select.h>
-#include <osmocom/core/socket.h>
-#include <osmocom/core/logging.h>
-#include <osmocom/core/utils.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/core/select.h>
-#include <osmocom/core/timer.h>
-
-#include "shm.h"
-}
-//#include "../uhd/UHDDevice.h"
-
-#include "ipcb210.h"
-//#include "uhdwrap.h"
-//#include "trx_vty.h"
-//#include "Logger.h"
-//#include "Threads.h"
-//#include "Utils.h"
-
-#if 0
-//#include "uhdwrap.h"
-//extern uhd_wrap *uhd_wrap_dev;
-
-//extern "C" void magicmain(int, char **);
-//char *argv[] = {
-// "magic",
-//};
-//void magicthread()
-//{
-// pthread_setname_np(pthread_self(), "magicthread");
-// magicmain(1, argv);
-//}
-#endif
-template <typename... Args> IPC_b210::IPC_b210(Args... args) : IPCDevice(args...)
-{
-#if 0
- // t = new std::thread(magicthread);
- // // give the thread some time to start and set up
- // std::this_thread::sleep_for(std::chrono::seconds(1));
-#endif
-}
-
-IPC_b210::~IPC_b210()
-{
- //gshutdown = 1;
- //t->join();
-}
-
-#if 0
-
-bool IPC_b210::start()
-{
- return uhd_wrap_dev->start();
-}
-
-/** Returns the starting write Timestamp*/
-TIMESTAMP IPC_b210::initialWriteTimestamp(void)
-{
- return uhd_wrap_dev->initialWriteTimestamp();
-}
-
-/** Returns the starting read Timestamp*/
-TIMESTAMP IPC_b210::initialReadTimestamp(void)
-{
- return uhd_wrap_dev->initialReadTimestamp();
-}
-
-
-//// NOTE: Assumes sequential reads
-int IPC_b210::readSamples(std::vector<short *> &bufs, int len, bool *overrun, TIMESTAMP timestamp, bool *underrun)
-{
-#if 0
- return uhd_wrap_dev->readSamples(bufs, len, overrun, timestamp, underrun);
-#else
- int rc, num_smpls, expect_smpls;
- ssize_t avail_smpls;
- TIMESTAMP expect_timestamp, actual_timestamp;
- unsigned int i;
-
- if (bufs.size() != chans) {
- LOGC(DDEV, ERROR) << "Invalid channel combination " << bufs.size();
- return -1;
- }
-
- *overrun = false;
- *underrun = false;
-
- timestamp += uhd_wrap_dev->getTimingOffset();
-
- /* Check that timestamp is valid */
- rc = rx_buffers[0]->avail_smpls(timestamp);
- if (rc < 0) {
- LOGC(DDEV, ERROR) << rx_buffers[0]->str_code(rc);
- LOGC(DDEV, ERROR) << rx_buffers[0]->str_status(timestamp);
- return 0;
- }
-
- for (i = 0; i < chans; i++) {
- /* Receive samples from HW until we have enough */
- while ((avail_smpls = rx_buffers[i]->avail_smpls(timestamp)) < len) {
- uint64_t recv_timestamp = 0;
-
- num_smpls = uhd_wrap_dev->wrap_read((TIMESTAMP *)&recv_timestamp);
- // memcpy(bufs[i], &uhd_wrap_dev->wrap_buffs[i].front(), num_smpls * 4);
-
- expect_timestamp = timestamp + avail_smpls;
-
- LOGCHAN(i, DDEV, DEBUG)
- "Received timestamp = " << (TIMESTAMP)recv_timestamp << " (" << num_smpls << ")";
-
- expect_smpls = len - avail_smpls;
- // if (expect_smpls != num_smpls)
- // LOGCHAN(i, DDEV, NOTICE)
- // << "Unexpected recv buffer len: expect " << expect_smpls << " got " << num_smpls
- // << ", diff=" << expect_smpls - num_smpls;
-
- //expect_timestamp = timestamp + avail_smpls;
- if (expect_timestamp != (TIMESTAMP)recv_timestamp)
- LOGCHAN(i, DDEV, ERROR)
- << "Unexpected recv buffer timestamp: expect " << expect_timestamp << " got "
- << recv_timestamp << ", diff=" << recv_timestamp - expect_timestamp;
-
- rc = rx_buffers[i]->write(&uhd_wrap_dev->wrap_buffs[i].front(), num_smpls,
- (TIMESTAMP)recv_timestamp);
- if (rc < 0) {
- LOGCHAN(i, DDEV, ERROR) << rx_buffers[i]->str_code(rc);
- LOGCHAN(i, DDEV, ERROR) << rx_buffers[i]->str_status(timestamp);
- if (rc != smpl_buf::ERROR_OVERFLOW)
- return 0;
- }
- }
- }
-
- /* We have enough samples */
- for (size_t i = 0; i < rx_buffers.size(); i++) {
- rc = rx_buffers[i]->read(bufs[i], len, timestamp);
- if ((rc < 0) || (rc != len)) {
- LOGCHAN(i, DDEV, ERROR) << rx_buffers[i]->str_code(rc) << ". "
- << rx_buffers[i]->str_status(timestamp) << ", (len=" << len << ")";
- return 0;
- }
- }
-
- return len;
-#endif
-}
-#endif
-
-#if 0
-int IPC_b210::writeSamples(std::vector<short *> &bufs, int len, bool *underrun, unsigned long long timestamp)
-{
- return uhd_wrap_dev->writeSamples(bufs, len, underrun, timestamp);
-}
-#endif
-//bool IPC_b210::updateAlignment(TIMESTAMP timestamp)
-//{
-// return drvtest::dev->updateAlignment(timestamp);
-//}
-
-//double IPC_b210::setTxGain(double dB, size_t chan)
-//{
-// auto v = IPCDevice::setTxGain(dB, chan);
-// return uhd_wrap_dev->setTxGain(v, chan);
-//}
-
-//double IPC_b210::setRxGain(double dB, size_t chan)
-//{
-// auto v = IPCDevice::setRxGain(dB, chan);
-// return uhd_wrap_dev->setRxGain(v, chan);
-//}
-
-//bool IPC_b210::stop()
-//{
-// return uhd_wrap_dev->stop();
-//}
-
-//bool IPC_b210::flush_recv(size_t num_pkts)
-//{
-// return true; //drvtest::dev->flush_recv(num_pkts);
-//}
-
-RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
- const std::vector<std::string> &tx_paths, const std::vector<std::string> &rx_paths)
-{
- if (tx_sps != rx_sps) {
- LOGC(DDEV, ERROR) << "IPC Requires tx_sps == rx_sps";
- return NULL;
- }
- if (lo_offset != 0.0) {
- LOGC(DDEV, ERROR) << "IPC doesn't support lo_offset";
- return NULL;
- }
- return new IPC_b210(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths);
-}
diff --git a/Transceiver52M/device/ipc/ipcb210.h b/Transceiver52M/device/ipc/ipcb210.h
deleted file mode 100644
index c4c0cc9..0000000
--- a/Transceiver52M/device/ipc/ipcb210.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-* Copyright 2020 sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
-* Author: Eric Wild <ewild@sysmocom.de>
-*
-* SPDX-License-Identifier: 0BSD
-*
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
-*/
-#ifndef IPC_B210_H
-#define IPC_B210_H
-
-#include <thread>
-//#include "magicwrap.h"
-#include "IPCDevice.h"
-//#include "../uhd/UHDDevice.h"
-
-class IPC_b210 : public IPCDevice {
- // std::thread *t;
- // bool flush_recv(size_t num_pkts) override;
-
- public:
- template <typename... Args> IPC_b210(Args... args);
- virtual ~IPC_b210();
-
- // void ipc_sock_close() override {};
-#if 0
- int readSamples(std::vector<short *> &bufs, int len, bool *overrun, TIMESTAMP timestamp,
- bool *underrun) override;
- TIMESTAMP initialWriteTimestamp() override;
- TIMESTAMP initialReadTimestamp() override;
- bool start() override;
-#endif
-
-#if 0
- int writeSamples(std::vector<short *> &bufs, int len, bool *underrun, unsigned long long timestamp) override;
- bool updateAlignment(TIMESTAMP timestamp) override;
-#endif
- // double setTxGain(double dB, size_t chan) override;
- // double setRxGain(double dB, size_t chan) override;
-
- // bool stop() override;
-};
-
-#endif // IPC_B210_H