feat: add jtag boundary scan
This commit is contained in:
parent
9eb3acb94c
commit
8699a568d1
|
@ -167,6 +167,26 @@ namespace Common
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [TODO:description]
|
||||
/// </summary>
|
||||
/// <param name="uintArray">[TODO:parameter]</param>
|
||||
/// <returns>[TODO:return]</returns>
|
||||
public static Result<byte[]> UInt32ArrayToBytes(UInt32[] uintArray)
|
||||
{
|
||||
byte[] byteArray = new byte[uintArray.Length * 4];
|
||||
try
|
||||
{
|
||||
Buffer.BlockCopy(uintArray, 0, byteArray, 0, uintArray.Length * 4);
|
||||
return byteArray;
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
return new(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 比特合并成二进制字节
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections;
|
||||
using System.Net;
|
||||
using DotNext;
|
||||
using Newtonsoft.Json;
|
||||
|
@ -368,21 +369,6 @@ public class JtagStatusReg
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [TODO:description]
|
||||
/// </summary>
|
||||
public class JtagBoundaryRegister
|
||||
{
|
||||
/// <summary>
|
||||
/// [TODO:description]
|
||||
/// </summary>
|
||||
public int PortNum { get; set; }
|
||||
/// <summary>
|
||||
/// [TODO:description]
|
||||
/// </summary>
|
||||
public UInt32[] PortStatus { get; set; } = new UInt32[] { };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Jtag控制器
|
||||
/// </summary>
|
||||
|
@ -945,7 +931,7 @@ public class Jtag
|
|||
/// </summary>
|
||||
/// <param name="portNum">[TODO:parameter]</param>
|
||||
/// <returns>[TODO:return]</returns>
|
||||
public async ValueTask<Result<JtagBoundaryRegister>> BoundaryScan(int portNum)
|
||||
public async ValueTask<Result<BitArray>> BoundaryScan(int portNum)
|
||||
{
|
||||
if (portNum <= 0)
|
||||
return new(new ArgumentException("The number of port couldn't be negative", nameof(portNum)));
|
||||
|
@ -979,6 +965,8 @@ public class Jtag
|
|||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
|
||||
|
||||
return new JtagBoundaryRegister() { PortNum = portNum, PortStatus = retData.Value };
|
||||
var byteArray = Common.Number.UInt32ArrayToBytes(retData.Value);
|
||||
if (!byteArray.IsSuccessful) return new(byteArray.Error);
|
||||
return new BitArray(byteArray.Value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue