diff --git a/src/FileDmaInputFilter.cc b/src/FileDmaInputFilter.cc index 7f254cf139ca893506d3a7b789991f9b9f6115bb..1384e16b4a4b1af13f1b76ab956df6ac048e42d9 100644 --- a/src/FileDmaInputFilter.cc +++ b/src/FileDmaInputFilter.cc @@ -21,8 +21,8 @@ FileDmaInputFilter::FileDmaInputFilter(const std::string &filename, size_t packe #if DAX_INPUT == 1 auto fd = open("/dev/dax0.0", O_RDWR); if (fd == -1) { - LOG(FATAL) << "Error opening DAX device file." << std::endl; - throw std::invalid_argument("Invalid input file name: " + "/dev/dax0.0"); + LOG(FATAL) << "Error opening DAX device file."; + throw std::invalid_argument("Invalid input file name: /dev/dax0.0"); } uint32_t length = nbPacketBuffers * packetBufferSize; diff --git a/src/MicronDmaInputFilter.cc b/src/MicronDmaInputFilter.cc deleted file mode 100644 index 5482d4675c751747ff31f63c6a479434d47e804b..0000000000000000000000000000000000000000 --- a/src/MicronDmaInputFilter.cc +++ /dev/null @@ -1,116 +0,0 @@ -#include "MicronDmaInputFilter.h" - -#include <cctype> -#include <cstring> -#include <system_error> - -#include "config.h" -#include "format.h" -#include "log.h" - -MicronDmaInputFilter::MicronDmaInputFilter(size_t packetBufferSize, size_t nbPacketBuffers, - ctrl &control, Config::ProcessorType processor_type) - : InputFilter(packetBufferSize, nbPacketBuffers, control), processorType_(processor_type) { - // The RunBitFile function will locate a Pico card that can run the given bit - // file, and is not already opened in exclusive-access mode by another program. - // By default, it requests exclusive access to the Pico card so no other programs - // will try to reuse the card and interfere with us. - // first argument sets share access to true for the pico driver, - // to allow other programs to e.g., read registers - LOG(TRACE) << "Finding pico driver..."; - int err = micron_find_pico_sb852(true, &pico_); - - if (err < 0) { - // All functions in the Pico API return an error code. If that code is < 0, - // then you should use the PicoErrors_FullError function to decode the error message. - auto error = - "Find pico driver error " + std::string(micron_picoerrors_fullerror(stream2_, nullptr, 0)); - throw std::runtime_error(error); - } - LOG(TRACE) << "Opening streams to and from the FPGA"; - stream2_ = micron_create_stream(pico_, 2); - - if (stream2_ < 0) { - auto error = "CreateStream error: " + - std::string(micron_picoerrors_fullerror(stream2_, nullptr, int(packetBufferSize))); - throw std::runtime_error(error); - } - LOG(TRACE) << "Created Micron DMA input filter"; -} - -MicronDmaInputFilter::~MicronDmaInputFilter() { - // streams are automatically closed when the PicoDrv object is destroyed, or - // on program termination, but we can also close a stream manually. - micron_close_stream(pico_, stream2_); - LOG(TRACE) << "Destroyed Micron DMA input filter"; -} - -// add pad bytes to next multiple of 16 bytes -int pad_for_16bytes(int len) { - int pad_len = len; - if (len % 16 != 0) { - pad_len = len + (16 - len % 16); - } - return pad_len; -} - -ssize_t MicronDmaInputFilter::runMicronDAQ(char **buffer) { - // Usually Pico streams come in two flavors: 4Byte wide, 16Byte wide - // (equivalent to 32bit, 128bit respectively) However, all calls to ReadStream - // and WriteStream must be 16Byte aligned (even for 4B wide streams) There is - // also an 'undocumented' 32Byte wide (256 bit) stream. - // We are using that stream here (and in the firmware). - // - // Now allocate 32B aligned space for read and write stream buffers - // - // Similarly, the size of the call, in bytes, must also be a multiple of 16Bytes. - // - // As with WriteStream, a ReadStream will block until all data is returned - // from the FPGA to the host. - // - ///////////////////////////////// - // Note on reading streams/////// - // A user application will either have a deterministic amount of results, or a - // non-deterministic amount. - // When a non-deterministic amount of results are expected, and given the - // blocking nature of the ReadStream, - // a user should use the GetBytesAvailable() call to determine the amount of - // data available for retrieval. - // When a deterministic amount of results is expected, a user can skip the - // performance impacting - // GetBytesAvailable() call and request the full amount of results. The user - // could also call ReadStream() iteratively, without GetBytesAvailable(), in - // which case getting smaller chunks of results may allow additional - // processing of the data on the host while the FPGA generates more results. - // Either approach works, and should be kept in mind when tuning performance - // of your application. - //////////////////////////////// - - uint32_t packetSize; - int err; - - if (processorType_ == Config::ProcessorType::BRIL) { - packetSize = 32 * 1791; // fixed bril 1-histo packet size - } else { - packetSize = 32 * (*((uint32_t *)((*buffer) + 8)) + 2); - } - - // Here is where we actually call ReadStream - // This reads "size" number of bytes of data from the output stream specified - // by our stream handle (e.g. 'stream') into our host buffer (rbuf) This call - // will block until it is able to read the entire "size" Bytes of data. - err = micron_read_stream(pico_, stream2_, *buffer, static_cast<int>(packetSize)); - - if (err < 0) { - auto error = "ReadStream error: " + std::string(micron_picoerrors_fullerror( - stream2_, *buffer, static_cast<int>(packetSize))); - throw std::runtime_error(error); - } - return (packetSize); -} - -// Read a packet from DMA -ssize_t MicronDmaInputFilter::readInput(char **buffer, size_t) { return runMicronDAQ(buffer); } - -// Required for virtual function but currently unused -void MicronDmaInputFilter::print(std::ostream &) const {} diff --git a/src/MicronDmaInputFilter.h b/src/MicronDmaInputFilter.h deleted file mode 100644 index 6757734197bfd64af79c4aab7a81ce17db08ebde..0000000000000000000000000000000000000000 --- a/src/MicronDmaInputFilter.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef MICRONDMA_INPUT_FILER_H -#define MICRONDMA_INPUT_FILER_H - -#include <micron_dma.h> - -#include <memory> - -#include "InputFilter.h" -#include "config.h" - -class MicronDmaInputFilter : public InputFilter { - public: - MicronDmaInputFilter(size_t, size_t, ctrl &, Config::ProcessorType p); - ~MicronDmaInputFilter() override; - - protected: - ssize_t readInput(char **buffer, size_t bufferSize) override; - void print(std::ostream &out) const override; - - private: - micron_private *pico_{}; - int stream2_; - ssize_t runMicronDAQ(char **buffer); - Config::ProcessorType processorType_; -}; - -#endif // MICRONDMA_INPUT_FILER_H diff --git a/src/pipeline.cc b/src/pipeline.cc index 1c42549ae3679899514331996328b02e3689b6a2..2a076c5b0c41fd131811d1938e303f8fc98a2902 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -50,9 +50,7 @@ Pipeline::Pipeline(ConfigView conf_view, uint max_tokens_per_thread) control_, conf.scone_address_); } else if (input == Config::InputType::MICRONDMA) { - input_filter_ = std::make_shared<MicronDmaInputFilter>(packet_buffer_size, num_packet_buffers, - control_, conf_view_.GetProcessorType()); - + throw std::invalid_argument("MicronDMA removed"); } else if (input == Config::InputType::TCPIP) { if (conf.attempt_tcp_reconnect_) { input_filter_ = std::make_shared<TcpInputFilter>(stream_conf.tcp_dest_port_, diff --git a/src/pipeline.h b/src/pipeline.h index 7ade4a2e57d5699242b2d32fdf43d56931dde639..43014ce1df7c785e117337cceba80eab1615717f 100644 --- a/src/pipeline.h +++ b/src/pipeline.h @@ -16,7 +16,6 @@ #include "DmaInputFilter.h" #include "FileDmaInputFilter.h" #include "InputFilter.h" -#include "MicronDmaInputFilter.h" #include "OutputByOrbit.h" #include "OutputBySize.h" #include "TcpInputFilter.h"