static int Run() { int retval = 0; try { // Find the list of addresses at the specified VID/PID. printf("\n" "Enumerating ASR-2300 devices...\n" "--------------------------------------\n"); int addr = s_cfgDevice.Attach(); printf("Attached to ASR-2300 at address = %d\n", addr); } catch (std::runtime_error& re) { printf("Error: %s\n", re.what()); return -8; } // Dump the device information DumpDeviceInformation(); // Calibrate the device retval = DoCalibrate (); // Detach from device s_cfgDevice.Detach(); return retval; }
static int Run() { int retval = 0; try { // Find the list of addresses at the specified VID/PID. printf("\n" "Enumerating ASR-2300 devices...\n" "--------------------------------------\n"); int addr = s_cfgDevice.Attach(); printf("Attached to ASR-2300 at address = %d\n", addr); } catch (std::runtime_error& re) { printf("Error: %s\n", re.what()); return -8; } // Dump the device information DumpDeviceInformation(); printf("**\n** PLEASE MAKE SURE ALL SIGNALS ARE DISCONNECTED\n** FROM THE ASR-2300 BEFORE CALIBRATING\n**\n\n\n"); SLEEP_SEC(5); // Calibrate the device retval = DoCalibrate (); // Detach from device s_cfgDevice.Detach(); return retval; }
static int Run() { int retval = 0; try { // Find the list of addresses at the specified VID/PID. printf("\n" "Enumerating ASR-2300 devices...\n" "--------------------------------------\n"); int addr = s_config.Attach(); printf("Attached to ASR-2300 at address = %d\n", addr); } catch (std::runtime_error& re) { printf("Error: %s\n", re.what()); return -8; } //Dump the device information DumpDeviceInformation(); // grab the DCI transport interface. s_ptd = &(s_config.Dci0Transport()); //1) Tell the user what we are doing printf("--------------------------------------\n"); printf( s_pOp->szDescriptionFormat, s_fileName); printf("--------------------------------------\n"); //2) set up the BIT operations manager Dci_BitOperationMgrInit(&s_bitmgr, &OnSendMessage); //3) set up the BIT client and its callbacks. //NOTE: Make our component ID the same as the target component, so it knows //how to send the data back. This worksaround a design issue with the BIT //structure. Dci_BitClient_Init(&s_BITClient, s_pOp->idTargetComponent); s_BITClient.fncInitiateSourceTransfer = &OnBitInitiateSourceTransfer; s_BITClient.fncInitiateTargetTransfer = &OnBitInitiateTargetTransfer; s_BITClient.fncGetFrameData = &OnBitGetFrameData; s_BITClient.fncSetFrameData = &OnBitSetFrameData; s_BITClient.fncTransferComplete = &OnBitTransferComplete; //4) Register the Client with the BIT operations manager. Dci_BitRegisterClient(&s_bitmgr, &s_BITClient); // Do the specified operation retval = (*(s_pOp->fncOpHandler))(); s_config.Detach(); return retval; }
/** * <summary> * Main Program Entry Point. * </summary> */ int main(int argc, const char** argv) { int retval = 0; WriteHeader(); //Add all the arguments. s_args.AddMapEntries( s_argmap); s_s1.RegisterArgs( "s1", s_args); s_s2.RegisterArgs( "s2", s_args); //Parse the arguments. retval = s_args.Parse( argc, argv); if( retval > 0) { int addr = (int) s_args.GetLong( "address"); try { addr = s_cfgDevice.Attach(addr); printf("Attached to ASR-2300 at address = %d\n", addr); } catch (std::runtime_error& re) { printf("Error: %s0\n", re.what()); return -1; } // Dump the device information DumpDeviceInformation(); //Initialize the stream loggers. retval = s_s1.Init( s_args, &s_cfgDevice); if( retval == 0) retval = s_s2.Init( s_args, &s_cfgDevice); //Receive the data and store to disk. if( retval == 0) { s_s1.DisplayConfiguration(); s_s2.DisplayConfiguration(); s_cfgDevice.Dci0Transport().ClearReceiveQueue(); retval = ReceiveData((size_t) (s_args.GetDouble("duration")*1000.0)); } s_s1.Terminate(); s_s2.Terminate(); s_cfgDevice.Detach(); } else //Arguments were not right. { PrintUsage(); } return retval; }
// This program demonstrates how to use the ConfigeDevice class to easily attach // to an ASR-2300 device. Then using the TransportDci to set a custom property on the default waveform // component. The property (A0) sets an LED blink rate in the custom HDL container demonstrated at the // Loctronix A2300 Open Source Webinar presentation dated 2/18/14. Be sure to build and load the corresponding // verilog container in the hdl/containers directory to use with this demo application. See // http://www.loctronix.com/news/webinars/LoctronixWebinar-2-140218.pdf for discussion and setup. int main(int, char**) { // Attach to the first device we find. ConfigDevice config; int result = config.Attach(); if( result < 0) { printf("Could not attach ASR-2300 device\n"); return result; } else printf( "ASR-2300 Device Opened\n"); //Get the FPGA ID and Version uint16 idFpga = config.FpgaId(); uint16 verFpga = config.FpgaVersion(); int iVer = (verFpga>>8); int iRev = (verFpga& 0x00ff); printf(" FPGA ID-Ver: %04X - %02X.%02X\n\n", idFpga, iVer, iRev); //Set the custom register( id = A0) setting the frequency //on the LED blinker from slowest rate to 16 times slowest rate TransportDci& dt = config.Dci0Transport(); for( uint32 i = 0; i < 4; i++) { uint32 countval = 1 + i*16; printf("Setting Blink Rate Count Value = %d\n", countval); dt.SetProperty<uint32>( 0x00, 0xA0, 1 + i*16); SLEEP_SEC(5); } //Detach from ASR-2300 config.Detach(); return(0); }