35 int main(
int argc,
const char *argv[]) {
38 std::cerr <<
"Expected usage: " << argv[0]
39 <<
" <backend> <connection specifier> [command]" << std::endl;
43 const char *backend = argv[1];
44 const char *conn = argv[2];
51 std::unique_ptr<AcceleratorConnection> acc =
ctxt.connect(backend, conn);
54 Accelerator *accel = manifest.buildAccelerator(*acc);
55 acc->getServiceThread()->addPoll(*accel);
61 std::this_thread::sleep_for(std::chrono::milliseconds(100));
63 }
else if (cmd ==
"wait") {
64 std::this_thread::sleep_for(std::chrono::seconds(1));
65 }
else if (cmd ==
"dmatest") {
70 std::cerr <<
"Exiting successfully\n";
73 }
catch (std::exception &e) {
74 std::cerr <<
"Error: " << e.what() << std::endl;
81 auto f = ports.find(
AppID(
"PrintfExample"));
82 if (f != ports.end()) {
88 [&](std::string &subsystem, std::string &msg,
89 std::unique_ptr<std::map<std::string, std::any>> &details) {
90 subsystem =
"ESITESTER";
91 msg =
"Received PrintfExample message";
92 details = std::make_unique<std::map<std::string, std::any>>();
93 details->emplace(
"data", data);
95 std::cout <<
"PrintfExample: " << *data.as<uint32_t>() << std::endl;
109 acc->
getPorts().at(
AppID(
"ReadMem")).getAs<services::MMIO::MMIORegion>();
110 uint64_t *dataPtr =
new uint64_t;
111 *dataPtr = 0x12345678;
112 readMem->write(8, (uint64_t)dataPtr);
117 for (
int i = 0; i < 100; ++i) {
118 val = readMem->read(0);
121 std::this_thread::sleep_for(std::chrono::microseconds(100));
124 throw std::runtime_error(
"DMA test failed");
Abstract class representing a connection to an accelerator.
Logger & getLogger() const
ServiceClass * getService(AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
Get a typed reference to a particular service type.
Top level accelerator class.
AcceleratorConnections, Accelerators, and Manifests must all share a context.
const std::map< AppID, const BundlePort & > & getPorts() const
Access the module's ports by ID.
void debug(const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details=nullptr)
Report a debug message.
Class to parse a manifest.
A logical chunk of data representing serialized data.
A function call which gets attached to a service port.
void connect(std::function< MessageData(const MessageData &)> callback, bool quick=false)
Connect a callback to code which will be executed when the accelerator invokes the callback.
virtual void start()
In cases where necessary, enable host memory services.
Information about the Accelerator system.
static void registerCallbacks(AcceleratorConnection *, Accelerator *)
int main(int argc, const char *argv[])
static void dmaTest(AcceleratorConnection *, Accelerator *)