Skip to content

Commit

Permalink
Testing flash chip ID code.
Browse files Browse the repository at this point in the history
  • Loading branch information
LegacyNsfw committed Feb 9, 2019
1 parent a5d7b03 commit 5467092
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions Apps/PcmLibrary/Vehicle.TestKernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -314,4 +347,4 @@ private async Task InvestigateDataCorruption(CancellationToken cancellationToken
}
}
}
}
}

0 comments on commit 5467092

Please sign in to comment.