public void TransferStreamCancelTest() { Console.WriteLine("Starting transfer stream cancel test..."); long firstCount, secondCount; uint[] mosi1 = new[] { 0u, 1u, 2u, 3u }; uint[] mosi2 = new[] { 4u, 5u, 6u, 7u }; FX3.SensorType = DeviceType.AutomotiveSpi; FX3.PartType = DUTType.IMU; for (int trial = 0; trial < 5; trial++) { Console.WriteLine("Starting trial " + trial.ToString()); /* Start stream */ Console.WriteLine("Starting first stream"); ((ISpi32Interface)FX3).StartBufferedStream(mosi1, 1, 1000000, 10, null); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(100); secondCount = FX3.GetNumBuffersRead; Assert.Greater(secondCount, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (stop stream) */ FX3.StopStream(); System.Threading.Thread.Sleep(40); TestTransferStreamData(mosi1); /* Start stream */ Console.WriteLine("Starting second stream"); ((ISpi32Interface)FX3).StartBufferedStream(mosi2, 1, 1000000, 10, null); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(100); secondCount = FX3.GetNumBuffersRead; Assert.Greater(secondCount, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (cancel stream) */ FX3.CancelStreamAsync(); System.Threading.Thread.Sleep(40); TestTransferStreamData(mosi2); /* Check device functionality */ CheckFirmwareResponsiveness(); TestSpiFunctionality(); } }
public void BurstStreamCancelTest() { Console.WriteLine("Starting burst stream cancel test..."); long firstCount; FX3.BurstByteCount = 16; FX3.TriggerReg = new RegClass() { Address = 0, NumBytes = 2, Page = 0 }; FX3.SetupBurstMode(); FX3.DrActive = false; for (int trial = 0; trial < 5; trial++) { Console.WriteLine("Starting trial " + trial.ToString()); /* Start stream */ FX3.StartBurstStream(1000000, FX3.BurstMOSIData); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(100); Assert.Greater(FX3.GetNumBuffersRead, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (stop stream) */ FX3.StopStream(); System.Threading.Thread.Sleep(20); /* Check SPI functionality */ TestSpiFunctionality(); /* Start stream */ FX3.StartBurstStream(1000000, FX3.BurstMOSIData); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(100); Assert.Greater(FX3.GetNumBuffersRead, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (cancel stream) */ FX3.CancelStreamAsync(); System.Threading.Thread.Sleep(20); /* Check SPI functionality */ TestSpiFunctionality(); } }
public void I2CStreamCancelTest() { Console.WriteLine("Starting I2C stream cancel test..."); long firstCount; I2CPreamble pre = new I2CPreamble(); pre.DeviceAddress = 0xA0; pre.PreambleData.Add(0); pre.PreambleData.Add(0); pre.StartMask = 4; for (int trial = 0; trial < 5; trial++) { Console.WriteLine("Starting trial " + trial.ToString()); /* Start stream */ FX3.StartI2CStream(pre, 64, 1000000); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(100); Assert.Greater(FX3.GetNumBuffersRead, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (stop stream) */ FX3.StopStream(); System.Threading.Thread.Sleep(20); /* Test read functionality */ TestI2CFunctionality(); /* Start stream */ FX3.StartI2CStream(pre, 64, 1000000); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(100); Assert.Greater(FX3.GetNumBuffersRead, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (cancel stream) */ FX3.CancelStreamAsync(); System.Threading.Thread.Sleep(20); /* Test read functionality */ TestI2CFunctionality(); } }
public void ADcmXLStreamCancelTest() { Console.WriteLine("Starting ADcmXL stream cancel test..."); long firstCount; FX3.DrActive = true; FX3.SensorType = DeviceType.ADcmXL; FX3.PartType = DUTType.ADcmXL3021; FX3.DrPin = FX3.DIO3; /* Start 6KHz DR signal on DIO4 */ FX3.StartPWM(6000, 0.1, FX3.DIO4); for (int trial = 0; trial < 4; trial++) { Console.WriteLine("Starting trial " + trial.ToString()); /* Start stream */ FX3.StartRealTimeStreaming(1000000); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(50); Assert.Greater(FX3.GetNumBuffersRead, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (stop stream) */ FX3.StopStream(); System.Threading.Thread.Sleep(50); /* Check SPI functionality */ TestSpiFunctionality(); /* Start stream */ FX3.StartRealTimeStreaming(1000000); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(50); Assert.Greater(FX3.GetNumBuffersRead, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (cancel stream) */ FX3.CancelStreamAsync(); System.Threading.Thread.Sleep(50); /* Check SPI functionality */ TestSpiFunctionality(); } }
public void GenericStreamCancelTest() { Console.WriteLine("Starting generic stream cancel test..."); long firstCount; FX3.SensorType = DeviceType.IMU; FX3.PartType = DUTType.IMU; for (int trial = 0; trial < 10; trial++) { Console.WriteLine("Starting trial " + trial.ToString()); /* Start stream */ FX3.StartBufferedStream(new[] { 0U, 1U, 2U }, 1, 1000000, 10, null); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(100); Assert.Greater(FX3.GetNumBuffersRead, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (stop stream) */ FX3.StopStream(); System.Threading.Thread.Sleep(20); /* Check SPI functionality */ TestSpiFunctionality(); /* Start stream */ FX3.StartBufferedStream(new[] { 0U, 1U, 2U }, 1, 1000000, 10, null); firstCount = FX3.GetNumBuffersRead; System.Threading.Thread.Sleep(100); Assert.Greater(FX3.GetNumBuffersRead, firstCount, "ERROR: Expected to have read buffers"); /* Cancel stream (cancel stream) */ FX3.CancelStreamAsync(); System.Threading.Thread.Sleep(20); /* Check SPI functionality */ TestSpiFunctionality(); } }