Permalink
Browse files

Testing flash chip ID code.

  • Loading branch information...
LegacyNsfw committed Feb 9, 2019
1 parent a5d7b03 commit 546709294fee1335125f0c234fedd682222cebef
Showing with 37 additions and 4 deletions.
  1. +37 −4 Apps/PcmLibrary/Vehicle.TestKernel.cs
@@ -47,15 +47,15 @@ public MemoryRange(UInt32 address, UInt32 size, BlockType type)
/// that are under development.
/// </summary>
public partial class Vehicle
{
{
/// <summary>
/// For testing prototype kernels.
/// </summary>
public async Task<bool> ExitKernel(bool kernelRunning, bool recoveryMode, CancellationToken cancellationToken, Stream unused)
{
try
{
this.device.ClearMessageQueue();
this.device.ClearMessageQueue();

Response<byte[]> response = await LoadKernelFromFile("test-kernel.bin");
if (response.Status != ResponseStatus.Success)
@@ -112,7 +112,8 @@ public async Task<bool> ExitKernel(bool kernelRunning, bool recoveryMode, Cancel
//await this.InvestigateDataCorruption(cancellationToken);
//await this.InvestigateKernelVersionQueryTiming();
//await this.InvestigateCrc(cancellationToken);
await this.InvestigateDataRelayCorruption(cancellationToken);
//await this.InvestigateDataRelayCorruption(cancellationToken);
await this.InvestigateFlashChipId();
return true;
}
catch (Exception exception)
@@ -265,6 +266,38 @@ private async Task InvestigateKernelVersionQueryTiming()
this.logger.AddDebugMessage("Success rate: " + successRate.ToString());
}


/// <summary>
/// This was used to test the delays in the kernel prior to sending a response.
/// </summary>
/// <returns></returns>
private async Task InvestigateFlashChipId()
{
await this.device.SetTimeout(TimeoutScenario.ReadProperty);

int successRate = 0;
for (int attempts = 0; attempts < 1; attempts++)
{
Message vq = this.protocol.CreateFlashMemoryTypeQuery();
await this.device.SendMessage(vq);
Message responseMessage = await this.device.ReceiveMessage();
if (responseMessage != null)
{
Response<UInt32> resp = this.protocol.ParseFlashMemoryType(responseMessage);
if (resp.Status == ResponseStatus.Success)
{
this.logger.AddUserMessage("Flash chip ID: " + resp.Value.ToString("X8"));
this.logger.AddDebugMessage("Got Kernel Version");
successRate++;
}
}

await Task.Delay(0);
continue;
}
}


/// <summary>
/// AllPro was getting data corruption when payloads got close to 2kb.
/// Still not sure what's up with that.
@@ -314,4 +347,4 @@ private async Task InvestigateDataCorruption(CancellationToken cancellationToken
}
}
}
}
}

0 comments on commit 5467092

Please sign in to comment.