本文整理汇总了C#中Microsoft.SPOT.Debugger.Engine.PauseExecution方法的典型用法代码示例。如果您正苦于以下问题:C# Engine.PauseExecution方法的具体用法?C# Engine.PauseExecution怎么用?C# Engine.PauseExecution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.SPOT.Debugger.Engine
的用法示例。
在下文中一共展示了Engine.PauseExecution方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
private bool Connect()
{
Disconnect();
try
{
_DBG.PortDefinition pd = (_DBG.PortDefinition)comboBoxPort.SelectedItem;
string port = pd.Port;
uint baudrate = uint.Parse( ((string)comboBoxBaud.SelectedItem) );
using(_DBG.AsyncSerialStream stream = new _DBG.AsyncSerialStream( port, baudrate ))
{
stream.Close();
}
m_eng = new _DBG.Engine( new Microsoft.SPOT.Debugger.PortDefinition_Serial( port, port, baudrate ) );
m_eng.Silent = true;
m_eng.Start();
if(m_eng.TryToConnect( 4, 250 ))
{
m_deviceRunning = true;
m_eng.PauseExecution();
m_ranges = m_eng.MemoryMap();
if(m_ranges == null)
{
//
// Fallback to some defaults.
//
m_ranges = new _DBG.WireProtocol.Commands.Monitor_MemoryMap.Range[2];
m_ranges[0] = new _DBG.WireProtocol.Commands.Monitor_MemoryMap.Range();
m_ranges[0].m_address = 0x00000000;
m_ranges[0].m_length = 0x00060000;
m_ranges[0].m_flags = _DBG.WireProtocol.Commands.Monitor_MemoryMap.c_RAM;
m_ranges[1] = new _DBG.WireProtocol.Commands.Monitor_MemoryMap.Range();
m_ranges[1].m_address = 0x10000000;
m_ranges[1].m_length = 1024*1024;
m_ranges[1].m_flags = _DBG.WireProtocol.Commands.Monitor_MemoryMap.c_FLASH;
}
}
else
{
m_deviceRunning = false;
}
m_ah = new _DBG.AbortHandler( m_eng, m_deviceRunning );
m_ah.Start();
bool connected = false;
for(int tries=0; tries < 5; tries++)
{
if(m_ah.ReadRegisters( m_snapshot.m_registers, out m_snapshot.m_cpsr, out m_snapshot.m_BWA, out m_snapshot.m_BWC ))
{
connected = true; break;
}
Thread.Sleep( 1000 );
}
if(connected)
{
for(int tries=0; tries < 5; tries++)
{
if(m_ah.ReadLayout( out m_snapshot.m_flashBase, out m_snapshot.m_flashSize, out m_snapshot.m_ramBase, out m_snapshot.m_ramSize ))
{
break;
}
Thread.Sleep( 1000 );
}
return true;
}
if(!connected)
{
MessageBox.Show( "Cannot connect to device" );
}
return connected;
}
catch(Exception ex)
{
MessageBox.Show( ex.Message );
return false;
}
}
示例2: ConnectToDevice
private void ConnectToDevice(string buildPath, string exePath, ArrayList referenceList)
{
TestSystem.IncludesDeviceTest = true;
PortDefinition port = Utils.GetPort(m_device, m_transport, exePath);
try
{
for (int retry = 0; retry < 3; retry++)
{
m_engine = new Microsoft.SPOT.Debugger.Engine(port);
m_engine.StopDebuggerOnConnect = true;
m_engine.Start();
bool connected = false;
connected = m_engine.TryToConnect(200, 500, true, ConnectionSource.TinyCLR);
if (connected)
{
m_engine.PauseExecution();
if (!string.Equals(m_transport.ToLower(), "emulator"))
{
// Deploy the test files to the device.
Utils.DeployToDevice(buildPath, referenceList, m_engine, m_transport, m_isDevEnvironment, m_assemblyName);
// Connect to the device and execute the deployed test.
m_engine.RebootDevice(Microsoft.SPOT.Debugger.Engine.RebootOption.RebootClrWaitForDebugger);
// give the device some time to restart (especially for tcp/ip)
Thread.Sleep(500);
if (m_engine.PortDefinition is PortDefinition_Tcp)
{
Thread.Sleep(1000);
}
connected = false;
connected = m_engine.TryToConnect(200, 500, true, ConnectionSource.TinyCLR);
}
if (!connected)
{
DetachFromEngine();
throw new ApplicationException("Reboot Failed");
}
AttachToProcess();
m_engine.ThrowOnCommunicationFailure = true;
m_engine.OnMessage += new MessageEventHandler(OnMessage);
m_engine.OnCommand += new CommandEventHandler(OnCommand);
m_engine.OnNoise += new NoiseEventHandler(OnNoise);
Console.WriteLine("\tExecuting the device test..");
m_initialTime = DateTime.Now;
m_engine.ResumeExecution();
m_deviceDone.WaitOne();
break;
}
else
{
DetachFromEngine();
//throw new ApplicationException("Connection failed");
}
}
}
catch(Exception ex)
{
DetachFromEngine();
throw new ApplicationException("Connection failed: " + ex.ToString());
}
}