otsdaq_demo  v2_05_02_indev
test.cc
1 //Generated Macro Name: test
2 //Macro Notes: Testing notes
3 //Generated Time: Jan-20-2020 10:32:32
4 //Paste this whole file into an interface to transfer Macro functionality.
5 {
6  char *address = new char[universalAddressSize_]{0}; //create address buffer of interface size and init to all 0
7  char *data = new char[universalDataSize_]{0}; //create data buffer of interface size and init to all 0
8  uint64_t macroAddress; //create macro address buffer (size 8 bytes)
9  uint64_t macroData; //create macro address buffer (size 8 bytes)
10  std::map<std::string /*arg name*/,uint64_t /*arg val*/> macroArgs; //create map from arg name to 64-bit number
11 
12  // command-#0: Write(0x4 /*address*/,0x2 /*data*/);
13  macroAddress = 0x4; memcpy(address,&macroAddress,8); //copy macro address to buffer
14  macroData = 0x2; memcpy(data,&macroData,8); //copy macro data to buffer
15  universalWrite(address,data);
16 
17  // command-#1: Read(0x4 /*address*/,data);
18  macroAddress = 0x4; memcpy(address,&macroAddress,8); //copy macro address to buffer
19  universalRead(address,data); memcpy(&macroArgs["outArg1"],data,8); //copy buffer to argument map
20 
21  delete[] address; //free the memory
22  delete[] data; //free the memory
23 }