51 const std::string &channelName,
57 virtual std::unique_ptr<ChannelPort>
62 std::map<std::pair<AppIDPath, std::string>, std::unique_ptr<ChannelPort>>
89 const std::string &dmaEngineName,
103template <
typename TEngine>
108#define REGISTER_ENGINE(Name, TEngine) \
109 static ::esi::registry::internal::RegisterEngine<TEngine> \
110 __register_engine____LINE__(Name)
Abstract class representing a connection to an accelerator.
Since engines can support multiple channels BUT not necessarily all of the channels in a bundle,...
PortMap requestPorts(const AppIDPath &idPath, const BundleType *bundleType) const
Request ports for all the channels in a bundle.
std::map< std::string, Engine * > bundleEngineMap
void setEngine(const std::string &channelName, Engine *engine)
Set a particlar engine for a particular channel.
Bundles represent a collection of channels.
Unidirectional channels are the basic communication primitive between the host and accelerator.
Engines implement the actual channel communication between the host and the accelerator.
virtual void connect()
Start the engine, if applicable.
virtual ChannelPort & requestPort(AppIDPath idPath, const std::string &channelName, BundleType::Direction dir, const Type *type)
Get a port for a channel, from the cache if it exists or create it.
virtual std::unique_ptr< ChannelPort > createPort(AppIDPath idPath, const std::string &channelName, BundleType::Direction dir, const Type *type)=0
Each engine needs to know how to create a ports.
virtual ~Engine()=default
virtual void disconnect()
Stop the engine, if applicable.
std::map< std::pair< AppIDPath, std::string >, std::unique_ptr< ChannelPort > > ownedPorts
Root class of the ESI type system.
std::function< std::unique_ptr< Engine >(AcceleratorConnection &conn, AppIDPath idPath, const ServiceImplDetails &details, const HWClientDetails &clients)> EngineCreate
Engines can register themselves for pluggable functionality.
void registerEngine(const std::string &name, EngineCreate create)
std::unique_ptr< Engine > createEngine(AcceleratorConnection &conn, const std::string &dmaEngineName, AppIDPath idPath, const ServiceImplDetails &details, const HWClientDetails &clients)
Create an engine by name.
std::map< std::string, std::any > ServiceImplDetails
std::map< std::string, ChannelPort & > PortMap
std::vector< HWClientDetail > HWClientDetails
Helper struct to register engines.
RegisterEngine(const char *name)