feat: frontend add set jtag frequency
This commit is contained in:
@@ -367,7 +367,6 @@ public class JtagController : ControllerBase
|
||||
[HttpPost("BoundaryScanLogicalPorts")]
|
||||
[EnableCors("Users")]
|
||||
[ProducesResponseType(typeof(Dictionary<string, bool>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
||||
public async ValueTask<IResult> BoundaryScanLogicalPorts(string address, int port)
|
||||
{
|
||||
@@ -382,6 +381,31 @@ public class JtagController : ControllerBase
|
||||
|
||||
return TypedResults.Ok(ret.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [TODO:description]
|
||||
/// </summary>
|
||||
/// <param name="address">[TODO:parameter]</param>
|
||||
/// <param name="port">[TODO:parameter]</param>
|
||||
/// <param name="speed">[TODO:parameter]</param>
|
||||
/// <returns>[TODO:return]</returns>
|
||||
[HttpPost("SetSpeed")]
|
||||
[EnableCors("Users")]
|
||||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
||||
public async ValueTask<IResult> SetSpeed(string address, int port, UInt32 speed)
|
||||
{
|
||||
var jtagCtrl = new JtagClient.Jtag(address, port);
|
||||
var ret = await jtagCtrl.SetSpeed(speed);
|
||||
if (!ret.IsSuccessful)
|
||||
{
|
||||
if (ret.Error is ArgumentException)
|
||||
return TypedResults.BadRequest(ret.Error);
|
||||
else return TypedResults.InternalServerError(ret.Error);
|
||||
}
|
||||
|
||||
return TypedResults.Ok(ret.Value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -28,6 +28,10 @@ public static class JtagAddr
|
||||
/// Jtag Write Command
|
||||
/// </summary>
|
||||
public const UInt32 WRITE_CMD = 0x10_00_00_03;
|
||||
/// <summary>
|
||||
/// Jtag Speed Control
|
||||
/// </summary>
|
||||
public const UInt32 SPEED_CTRL = 0x10_00_00_04;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -833,10 +837,26 @@ public class Jtag
|
||||
if (cellList.IsNull) return new(new Exception("Get boundary logical ports failed"));
|
||||
|
||||
var portStatus = new Dictionary<string, bool>();
|
||||
foreach (var cell in cellList.Value) {
|
||||
foreach (var cell in cellList.Value)
|
||||
{
|
||||
portStatus.Add(cell.PortID ?? "UnknownPortID", bitArray.Value[cell.CellNumber]);
|
||||
}
|
||||
|
||||
return portStatus;
|
||||
}
|
||||
|
||||
public async ValueTask<Result<bool>> SetSpeed(UInt32 speed)
|
||||
{
|
||||
// Clear Data
|
||||
await MsgBus.UDPServer.ClearUDPData(this.address);
|
||||
|
||||
logger.Trace($"Clear up udp server {this.address} receive data");
|
||||
|
||||
var ret = await WriteFIFO(
|
||||
JtagAddr.SPEED_CTRL, (speed << 16) | speed,
|
||||
JtagState.CMD_EXEC_FINISH, JtagState.CMD_EXEC_FINISH);
|
||||
|
||||
if (!ret.IsSuccessful) return new (ret.Error);
|
||||
return ret.Value;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user