public RAMLoader(Parameters pars, FTDIdevice USB, string binfilepath, MainForm mf) { parameters = pars; thisUSB = USB; filepathtoload = binfilepath; mf_parent = mf; }
public Trimmer(Parameters pars, FTDIdevice USB) { parameters = pars; thisUSB = USB; //Frequency counter must be programmed with the following address information: GPIB ID 0, primary address 9, and no secondary address. //FREQ_COUNTER = new Device(0, 15, 0); // create an object to hold the frequency counter, with GPIB ID 0, primary addr 9, and no secondary addr. the primary addr was manually set on the counter itself. FREQ_COUNTER = new Device(0, parameters.counter_id, 0); // create an object to hold the frequency counter, with GPIB ID 0, primary addr 9, and no secondary addr. the primary addr was manually set on the counter itself. }
public MainForm() { InitializeComponent(); parameters = new Parameters(); parameters.ReadSettingsFile(); //must happen after new parameters is built in order for settings to be saved as params if (parameters.testing && !parameters.loading) progressBar_overall.Maximum = 60; //adjust progress bar for testing only case else progressBar_overall.Maximum = 100; bool refradioattached = true; bool counterattached = true; CheckConnections(ref counterattached, ref refradioattached); if(refradioattached && counterattached) UpdateOutputText("Welcome to the ThinkEco USB Tester Module A. Please attach the dongle to be tested and scan its bottom housing MAC address label to begin."); }
public static void WaitForZTCResponse(FTDIdevice thisdevice, Parameters parameters) { byte[] readResult; int PLengthInt; int i = 1; bool responseA = false; string cache = string.Empty; string readOut = string.Empty; string packet = string.Empty; char[] charcache; byte[] PLength = new Byte[1]; while (i <parameters.listenlooptimeout && responseA == false) { readResult = thisdevice.poll(); readOut = ConvertByteArrayToSpacedHexString(readResult); cache = cache + readOut; charcache = cache.ToCharArray(0, cache.Length); if (cache.Length > 11) { PLength = ConvertHexStringToByteArray(cache.Substring(9, 2)); byte[] PLengthB = new byte[2]; PLengthB[0] = PLength[0]; PLengthInt = BitConverter.ToInt16(PLengthB, 0); if (cache.Length > 12 + PLengthInt * 3) { packet = cache.Substring(0, 14 + PLengthInt * 3); cache = cache.Remove(0, 14 + PLengthInt * 3); packet = packet.Remove(0, 2); packet = packet.Remove(packet.Length - 2); //Console.WriteLine("From Port 1: {0}", packet); responseA = true; } } System.Threading.Thread.Sleep(20); i++; if (i == parameters.listenlooptimeout) throw new Exception_Yellow("No response received during listen."); } }
public byte[] AddtoReceiveList_ListenForNewFWResponse(FTDIdevice thisdevice, Parameters parameters) { Queue<byte> incomingbytequeue = new Queue<byte>(); byte ZTCHeader = 0x02; int initialqueuelen = incomingbytequeue.Count; int indexofZTCheaderinqueue = 0; byte[] incomingdata = thisdevice.poll(); int arraylen = incomingdata.Length; for (int i = 0; i < arraylen; i++) incomingbytequeue.Enqueue(incomingdata[i]); int queuelen = incomingbytequeue.Count; byte temp; bool packetstarted = false; for (int j = 0; j < queuelen; j++) { temp = incomingbytequeue.Dequeue(); if (temp == ZTCHeader && incomingbytequeue.Count > 3) { packetstarted = true; break; } else { //incomingbytequeue.Enqueue(temp); //this is a problem. we should throw this out. indexofZTCheaderinqueue++; } } if (packetstarted) { byte tempheader = incomingbytequeue.Dequeue(); byte tempopcode = incomingbytequeue.Dequeue(); int payloadlen = incomingbytequeue.Dequeue(); if (incomingbytequeue.Count < payloadlen + 1) //if the packet hasn't fully arrived yet, just put the packets we've read so far back on the queue and then exit, to come back and read again later { int count = incomingbytequeue.Count; incomingbytequeue.Enqueue(ZTCHeader); incomingbytequeue.Enqueue(tempheader); incomingbytequeue.Enqueue(tempopcode); incomingbytequeue.Enqueue((byte)payloadlen); for (int k = 0; k < count; k++) incomingbytequeue.Enqueue(incomingbytequeue.Dequeue()); return null; //throw new Exception_Yellow("incomplete packet received."); } byte[] packet = new byte[payloadlen + 5]; packet[0] = ZTCHeader; packet[1] = tempheader; packet[2] = tempopcode; packet[3] = (byte)payloadlen; for (int k = 0; k < payloadlen; k++) packet[4 + k] = incomingbytequeue.Dequeue(); packet[payloadlen + 4] = incomingbytequeue.Dequeue(); //CRC //if (packet[payloadlen + 4] == 0) packet[0] = 2; //dummy just to have breakpoint to test theory that 0 is returned sometimes return packet; //RxPacket rx = new RxPacket(); //rx.completepacket = packet; //RxFIFO.Enqueue(rx); //AllRxPacketQueueDebugging.Enqueue(rx); ////now figure out what to do with the rest of the packets that are hanging out there. re-enqueue them probably } else return null; //if(incomingpacket!=null && incomingpacket.Length!=0) //RxFIFO.Enqueue(incomingpacket); }
public Trimmer_NI4882(Parameters pars, FTDIdevice USB) { parameters = pars; thisUSB = USB; FREQ_COUNTER = new Device(0, 9, 0); // create an object to hold the frequency counter, with GPIB ID 0, primary addr 9, and no secondary addr. the primary addr was manually set on the counter itself. }
//, string imagefilepath) //int BIN_FILE_BUFFER_SIZE = 4 * 1024; //Buffer allocated for reading the SSL binary image public FirmwareLoader(Parameters pars, FTDIdevice USB, MainForm mf) { parameters = pars; thisUSB = USB; mf_parent = mf; }
public SSLInterface(Parameters pars, FTDIdevice USB) { parameters = pars; thisUSB = USB; }
public void RunButton_Click(object sender, EventArgs e) { UpdateOutputText("Process has begun."); UpdateColorDisplay("white"); UpdateProgressBar_Overall(0); UpdateProgressBar_Detail(0); pictureBox1.Visible = false; pictureBox2.Visible = false; parameters = new Parameters(); parameters.ReadSettingsFile(); //must happen after new parameters is built in order for settings to be saved as params if (parameters.testing) parameters.refradioplugged = true; //we need to re-set this to true because we've made a new set of parameters, and if testing is true but the ref radio isn't there, we would already have seen an error. //open dialog box for filename, if option is selected if (!parameters.takingFWfilenamefromsettingsfile) { CancelEventArgs e2 = new CancelEventArgs(); parameters.FWimagefilepath = openFileDialog1_FileOk(sender, e2); int lastslash = parameters.FWimagefilepath.LastIndexOf('\\') + 1; parameters.FWimagefilename = parameters.FWimagefilepath.Substring(lastslash, parameters.FWimagefilepath.Length-lastslash); } thisUSB = new FTDIdevice(parameters, this); //must happen after settings file is read MainThread = new Thread(new ThreadStart(MainProcess)); MainThread.Start(); }
public FTDIdevice(Parameters pars, MainForm mf) { parameters = pars; ftdi = new FTDI(); mf_parent = mf; }