53 const std::string &channelName,
59 virtual std::unique_ptr<ChannelPort>
67 std::map<std::pair<AppIDPath, std::string>, std::unique_ptr<ChannelPort>>
94 const std::string &dmaEngineName,
108template <
typename TEngine>
113#define CONCAT_(prefix, suffix) prefix##suffix
114#define CONCAT(prefix, suffix) CONCAT_(prefix, suffix)
115#define REGISTER_ENGINE(Name, TEngine) \
116 static ::esi::registry::internal::RegisterEngine<TEngine> CONCAT( \
117 __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.
Engine(AcceleratorConnection &conn)
AcceleratorConnection & conn
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)