Files
salmanoff/stimBuffApis/livoxGen1/ioUringAssemblyEngine.h
T
hayodea 94982d50b9 IoUringAssmEngn: map StagingBuff w/mmap; reg w/io_uring; add eventFd
StagingBuffer:
We now allocate memory with mmap(MAP_ANONYMOUS) so that we can be
sure it can be pinned with io_uring_register_buffers(). This
ensures that if DMA is possible, it should be usable.

	IoUringAssemblyEngine:
We now register an eventfd with io_uring so that we can listen
for CQEs with boost::asio.
2025-11-05 15:34:23 -04:00

66 lines
1.5 KiB
C++

#ifndef _LIVOX_GEN1_IOURING_ASSEMBLY_ENGINE_H
#define _LIVOX_GEN1_IOURING_ASSEMBLY_ENGINE_H
#include <boostAsioLinkageFix.h>
#include <cstdint>
#include <cstddef>
#include <memory>
#include <functional>
#include <vector>
#include <chrono>
#include <atomic>
#include <liburing.h>
#include <boost/asio/io_service.hpp>
#include <boost/asio/deadline_timer.hpp>
#include <livoxProto1/device.h>
#include "frameAssemblyDesc.h"
namespace smo {
namespace stim_buff {
class PcloudStimulusBuffer;
class IoUringAssemblyEngine
{
public:
explicit IoUringAssemblyEngine(PcloudStimulusBuffer& parent);
~IoUringAssemblyEngine() = default;
bool setup();
void finalize();
void resetAndAssembleFrame();
void stop();
// Telemetry helpers
static size_t computePointsPerDgram(int returnMode);
static size_t computePointsPerFrame(int returnMode, size_t nDgramsPerFrame)
{ return computePointsPerDgram(returnMode) * nDgramsPerFrame; }
private:
PcloudStimulusBuffer& parent;
// Cached descriptor for reuse across iterations
std::shared_ptr<FrameAssemblyDesc> frameAssemblyDesc;
// io_uring infrastructure
struct io_uring ring;
bool isSetup;
// Eventfd for CQE notifications (used with boost's unified loop)
int eventfdFd;
// Point cloud data socket descriptor
std::shared_ptr<boost::asio::posix::stream_descriptor> pcloudDataFdDesc;
// Stall detection timer
boost::asio::deadline_timer stallTimer;
void cancelIncompleteAndFillDummies();
};
} // namespace stim_buff
} // namespace smo
#endif // _LIVOX_GEN1_IOURING_ASSEMBLY_ENGINE_H