feat: asp serve frontend static files
This commit is contained in:
parent
020674a277
commit
257d63e63d
|
@ -10,6 +10,7 @@ lerna-debug.log*
|
||||||
node_modules
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
dist
|
||||||
|
**/wwwroot
|
||||||
dist-ssr
|
dist-ssr
|
||||||
coverage
|
coverage
|
||||||
*.local
|
*.local
|
||||||
|
|
27
.justfile
27
.justfile
|
@ -1,3 +1,5 @@
|
||||||
|
isSelfContained := "false"
|
||||||
|
|
||||||
@_show-dir:
|
@_show-dir:
|
||||||
echo "Current Working Directory:"
|
echo "Current Working Directory:"
|
||||||
pwd
|
pwd
|
||||||
|
@ -12,6 +14,8 @@ clean:
|
||||||
rm -rf "dist"
|
rm -rf "dist"
|
||||||
|
|
||||||
update:
|
update:
|
||||||
|
npm install
|
||||||
|
cd server && dotnet restore
|
||||||
git submodule update --init --remote --recursive
|
git submodule update --init --remote --recursive
|
||||||
|
|
||||||
# 生成Restful API到网页客户端
|
# 生成Restful API到网页客户端
|
||||||
|
@ -22,16 +26,25 @@ gen-api:
|
||||||
|
|
||||||
# 构建服务器,包含win与linux平台
|
# 构建服务器,包含win与linux平台
|
||||||
[working-directory: "server"]
|
[working-directory: "server"]
|
||||||
build-server: _show-dir
|
build-server self-contained=isSelfContained: _show-dir
|
||||||
dotnet publish --self-contained false -t:PublishAllRids
|
dotnet publish --self-contained {{self-contained}} -t:PublishAllRids
|
||||||
|
npm run build
|
||||||
|
rsync -avz --delete ../wwwroot/ ./bin/Release/net9.0/linux-x64/publish/wwwroot/
|
||||||
|
rsync -avz --delete ../wwwroot/ ./bin/Release/net9.0/win-x64/publish/wwwroot/
|
||||||
|
|
||||||
# 运行服务器
|
run-server: (build-server "true")
|
||||||
[working-directory: "server"]
|
exec ./server/bin/Release/net9.0/linux-x64/publish/server
|
||||||
run-server: _show-dir
|
|
||||||
dotnet run
|
run-web:
|
||||||
|
npm run build
|
||||||
|
npm run preview
|
||||||
|
|
||||||
|
# 测试服务器
|
||||||
|
dev-server: _show-dir
|
||||||
|
cd server && dotnet run
|
||||||
|
|
||||||
# 运行网页客户端
|
# 运行网页客户端
|
||||||
run-web:
|
dev-web:
|
||||||
npm run dev
|
npm run dev
|
||||||
|
|
||||||
# 运行测试用例测试服务器
|
# 运行测试用例测试服务器
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"@tailwindcss/postcss": "^4.0.12",
|
"@tailwindcss/postcss": "^4.0.12",
|
||||||
"@tsconfig/node22": "^22.0.0",
|
"@tsconfig/node22": "^22.0.0",
|
||||||
"@types/node": "^22.13.4",
|
"@types/node": "^22.13.4",
|
||||||
|
"@vitejs/plugin-basic-ssl": "^2.0.0",
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
||||||
"@vue/tsconfig": "^0.7.0",
|
"@vue/tsconfig": "^0.7.0",
|
||||||
|
@ -1636,6 +1637,19 @@
|
||||||
"undici-types": "~6.21.0"
|
"undici-types": "~6.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@vitejs/plugin-basic-ssl": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-gc9Tjg8bUxBVSTzeWT3Njc0Cl3PakHFKdNfABnZWiUgbxqmHDEn7uECv3fHVylxoYgNzAcmU7ZrILz+BwSo3sA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"vite": "^6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@vitejs/plugin-vue": {
|
"node_modules/@vitejs/plugin-vue": {
|
||||||
"version": "5.2.3",
|
"version": "5.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.3.tgz",
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
"@tailwindcss/postcss": "^4.0.12",
|
"@tailwindcss/postcss": "^4.0.12",
|
||||||
"@tsconfig/node22": "^22.0.0",
|
"@tsconfig/node22": "^22.0.0",
|
||||||
"@types/node": "^22.13.4",
|
"@types/node": "^22.13.4",
|
||||||
|
"@vitejs/plugin-basic-ssl": "^2.0.0",
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
||||||
"@vue/tsconfig": "^0.7.0",
|
"@vue/tsconfig": "^0.7.0",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Web;
|
using NLog.Web;
|
||||||
|
@ -9,7 +10,6 @@ var logger = NLog.LogManager.Setup()
|
||||||
.GetCurrentClassLogger();
|
.GetCurrentClassLogger();
|
||||||
logger.Debug("Init Main...");
|
logger.Debug("Init Main...");
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
@ -84,15 +84,24 @@ try
|
||||||
// Application Settings
|
// Application Settings
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
// app.UseExceptionHandler(new ExceptionHandlerOptions()
|
if (!app.Environment.IsDevelopment())
|
||||||
// {
|
{
|
||||||
// AllowStatusCode404Response = true,
|
// app.UseExceptionHandler("/Home/Error");
|
||||||
// ExceptionHandlingPath = "/error"
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||||
// });
|
app.UseHsts();
|
||||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
||||||
app.UseHsts();
|
// Serve static files
|
||||||
|
logger.Info($"Use Static Files : {Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")}");
|
||||||
|
app.UseDefaultFiles();
|
||||||
|
app.UseStaticFiles(); // Serves files from wwwroot by default
|
||||||
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
{
|
||||||
|
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "assets")),
|
||||||
|
RequestPath = "/assets"
|
||||||
|
});
|
||||||
|
app.MapFallbackToFile("index.html");
|
||||||
|
}
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
@ -103,15 +112,13 @@ try
|
||||||
app.UseSwaggerUi();
|
app.UseSwaggerUi();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// Router
|
||||||
|
app.MapControllers();
|
||||||
|
|
||||||
// Setup Program
|
// Setup Program
|
||||||
MsgBus.Init();
|
MsgBus.Init();
|
||||||
|
|
||||||
// Router
|
app.Run();
|
||||||
// API Get
|
|
||||||
app.MapGet("/", () => Results.Redirect("/swagger"));
|
|
||||||
app.MapControllers();
|
|
||||||
|
|
||||||
app.Run("http://localhost:5000");
|
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,18 +5,20 @@
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"applicationUrl": "http://localhost:5188",
|
"applicationUrl": "http://localhost:5000",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"https": {
|
"https": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"applicationUrl": "https://localhost:7070;http://localhost:5188",
|
"applicationUrl": "https://localhost:7278;http://localhost:5000",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<Import Project="PublishAllRids.targets" />
|
<Import Project="PublishAllRids.xml" />
|
||||||
|
<!-- <Import Project="PublishSPA.xml" /> -->
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
@ -8,6 +9,9 @@
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<RuntimeIdentifiers>win-x64;linux-x64;</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x64;linux-x64;</RuntimeIdentifiers>
|
||||||
<PublishSingleFile>true</PublishSingleFile>
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<SpaRoot>../</SpaRoot>
|
||||||
|
<SpaProxyServerUrl>http://localhost:5173</SpaProxyServerUrl>
|
||||||
|
<SpaProxyLaunchCommand>npm run dev</SpaProxyLaunchCommand>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -16,6 +20,7 @@
|
||||||
<PackageReference Include="Honoo.IO.Hashing.Crc" Version="1.3.3" />
|
<PackageReference Include="Honoo.IO.Hashing.Crc" Version="1.3.3" />
|
||||||
<PackageReference Include="linq2db.AspNet" Version="5.4.1" />
|
<PackageReference Include="linq2db.AspNet" Version="5.4.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.4" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="9.0.4" />
|
||||||
<PackageReference Include="Microsoft.OpenApi" Version="1.6.23" />
|
<PackageReference Include="Microsoft.OpenApi" Version="1.6.23" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="NLog" Version="5.4.0" />
|
<PackageReference Include="NLog" Version="5.4.0" />
|
||||||
|
|
|
@ -8,6 +8,44 @@ using WebProtocol;
|
||||||
|
|
||||||
namespace server.Controllers;
|
namespace server.Controllers;
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// [TODO:description]
|
||||||
|
// /// </summary>
|
||||||
|
// public class HomeController : ControllerBase
|
||||||
|
// {
|
||||||
|
// private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
//
|
||||||
|
// string INDEX_HTML_PATH = Path.Combine(Environment.CurrentDirectory, "index.html");
|
||||||
|
//
|
||||||
|
// /// <summary>
|
||||||
|
// /// [TODO:description]
|
||||||
|
// /// </summary>
|
||||||
|
// /// <returns>[TODO:return]</returns>
|
||||||
|
// [HttpGet("/")]
|
||||||
|
// public IResult Index()
|
||||||
|
// {
|
||||||
|
// return TypedResults.Content("Hello", "text/html");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
// // public IResult Error()
|
||||||
|
// // {
|
||||||
|
// // return TypedResults.Ok();
|
||||||
|
// // }
|
||||||
|
//
|
||||||
|
// /// <summary>
|
||||||
|
// /// [TODO:description]
|
||||||
|
// /// </summary>
|
||||||
|
// /// <returns>[TODO:return]</returns>
|
||||||
|
// [HttpGet("/hello")]
|
||||||
|
// [HttpPost("/hello")]
|
||||||
|
// public IActionResult Hello()
|
||||||
|
// {
|
||||||
|
// string randomString = Guid.NewGuid().ToString();
|
||||||
|
// return this.Ok($"Hello World! GUID: {randomString}");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// UDP API
|
/// UDP API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -346,6 +384,32 @@ public class JtagController : ControllerBase
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// [TODO:description]
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="address">[TODO:parameter]</param>
|
||||||
|
/// <param name="port">[TODO:parameter]</param>
|
||||||
|
/// <param name="portNum">[TODO:parameter]</param>
|
||||||
|
/// <returns>[TODO:return]</returns>
|
||||||
|
[HttpPost("BoundaryScan")]
|
||||||
|
[EnableCors("Users")]
|
||||||
|
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(typeof(string), StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
||||||
|
public async ValueTask<IResult> BoundaryScan(string address, int port, int portNum)
|
||||||
|
{
|
||||||
|
var jtagCtrl = new JtagClient.Jtag(address, port);
|
||||||
|
var ret = await jtagCtrl.BoundaryScan(portNum);
|
||||||
|
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>
|
/// <summary>
|
||||||
|
|
|
@ -368,6 +368,21 @@ 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>
|
/// <summary>
|
||||||
/// Jtag控制器
|
/// Jtag控制器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -730,13 +745,13 @@ public class Jtag
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async ValueTask<Result<UInt32>> LoadDRCareOutput(UInt32 bytesLen)
|
async ValueTask<Result<UInt32>> LoadDRCareOutput(UInt32 UInt32Num)
|
||||||
{
|
{
|
||||||
if (bytesLen > Math.Pow(2, 28)) return new(new Exception("Length is over 2^(28 - 3)"));
|
if (UInt32Num > Math.Pow(2, 23)) return new(new Exception("Length is over 2^(28 - 5)"));
|
||||||
|
|
||||||
var ret = await WriteFIFO(
|
var ret = await WriteFIFO(
|
||||||
JtagAddr.WRITE_CMD,
|
JtagAddr.WRITE_CMD,
|
||||||
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_LOAD_DR_CAREO, JtagCmd.LEN_CMD_JTAG, 8 * bytesLen, 28).Value,
|
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_LOAD_DR_CAREO, JtagCmd.LEN_CMD_JTAG, 32 * UInt32Num, 28).Value,
|
||||||
0x01_00_00_00, JtagState.CMD_EXEC_FINISH);
|
0x01_00_00_00, JtagState.CMD_EXEC_FINISH);
|
||||||
|
|
||||||
if (ret.Value)
|
if (ret.Value)
|
||||||
|
@ -745,6 +760,31 @@ public class Jtag
|
||||||
return new(new Exception("LoadDRCareo Failed!"));
|
return new(new Exception("LoadDRCareo Failed!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async ValueTask<Result<UInt32[]>> LoadDRCareOutputArray(UInt32 UInt32Num)
|
||||||
|
{
|
||||||
|
if (UInt32Num > Math.Pow(2, 23)) return new(new Exception("Length is over 2^(28 - 5)"));
|
||||||
|
|
||||||
|
var ret = await WriteFIFO(
|
||||||
|
JtagAddr.WRITE_CMD,
|
||||||
|
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_LOAD_DR_CAREO, JtagCmd.LEN_CMD_JTAG, 32 * UInt32Num, 28).Value,
|
||||||
|
0x01_00_00_00, JtagState.CMD_EXEC_FINISH);
|
||||||
|
|
||||||
|
if (ret.Value)
|
||||||
|
{
|
||||||
|
var array = new UInt32[UInt32Num];
|
||||||
|
for (int i = 0; i < UInt32Num; i++)
|
||||||
|
{
|
||||||
|
var retData = await ReadFIFO(JtagAddr.READ_DATA);
|
||||||
|
if (!retData.IsSuccessful)
|
||||||
|
return new(new Exception("Read FIFO failed when Load DR"));
|
||||||
|
array[i] = retData.Value;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return new(new Exception("LoadDRCareo Failed!"));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取 JTAG 设备的 ID 代码
|
/// 读取 JTAG 设备的 ID 代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -774,7 +814,7 @@ public class Jtag
|
||||||
if (!ret.IsSuccessful) return new(ret.Error);
|
if (!ret.IsSuccessful) return new(ret.Error);
|
||||||
else if (!ret.Value) return new(new Exception("Jtag Clear Write Registers Failed"));
|
else if (!ret.Value) return new(new Exception("Jtag Clear Write Registers Failed"));
|
||||||
|
|
||||||
var retData = await LoadDRCareOutput(4);
|
var retData = await LoadDRCareOutput(1);
|
||||||
if (!retData.IsSuccessful)
|
if (!retData.IsSuccessful)
|
||||||
{
|
{
|
||||||
return new(new Exception("Get ID Code Failed"));
|
return new(new Exception("Get ID Code Failed"));
|
||||||
|
@ -812,11 +852,9 @@ public class Jtag
|
||||||
if (!ret.IsSuccessful) return new(ret.Error);
|
if (!ret.IsSuccessful) return new(ret.Error);
|
||||||
else if (!ret.Value) return new(new Exception("Jtag Clear Write Registers Failed"));
|
else if (!ret.Value) return new(new Exception("Jtag Clear Write Registers Failed"));
|
||||||
|
|
||||||
var retData = await LoadDRCareOutput(4);
|
var retData = await LoadDRCareOutput(1);
|
||||||
if (!retData.IsSuccessful)
|
if (!retData.IsSuccessful)
|
||||||
{
|
|
||||||
return new(new Exception("Read Status Reg Failed"));
|
return new(new Exception("Read Status Reg Failed"));
|
||||||
}
|
|
||||||
|
|
||||||
return retData.Value;
|
return retData.Value;
|
||||||
}
|
}
|
||||||
|
@ -901,4 +939,46 @@ public class Jtag
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// [TODO:description]
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="portNum">[TODO:parameter]</param>
|
||||||
|
/// <returns>[TODO:return]</returns>
|
||||||
|
public async ValueTask<Result<JtagBoundaryRegister>> BoundaryScan(int portNum)
|
||||||
|
{
|
||||||
|
if (portNum <= 0)
|
||||||
|
return new(new ArgumentException("The number of port couldn't be negative", nameof(portNum)));
|
||||||
|
|
||||||
|
// Clear Data
|
||||||
|
await MsgBus.UDPServer.ClearUDPData(this.address);
|
||||||
|
|
||||||
|
logger.Trace($"Clear up udp server {this.address} receive data");
|
||||||
|
|
||||||
|
Result<bool> ret;
|
||||||
|
|
||||||
|
ret = await CloseTest();
|
||||||
|
if (!ret.IsSuccessful) return new(ret.Error);
|
||||||
|
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
|
||||||
|
|
||||||
|
ret = await RunTest();
|
||||||
|
if (!ret.IsSuccessful) return new(ret.Error);
|
||||||
|
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
|
||||||
|
|
||||||
|
logger.Trace("Jtag initialize");
|
||||||
|
|
||||||
|
ret = await ExecRDCmd(JtagCmd.JTAG_DR_SAMPLE);
|
||||||
|
if (!ret.IsSuccessful) return new(ret.Error);
|
||||||
|
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_JRST Failed"));
|
||||||
|
|
||||||
|
var retData = await LoadDRCareOutputArray(((uint)(portNum % 32 == 0 ? portNum / 32 : portNum / 32 + 1)));
|
||||||
|
if (!retData.IsSuccessful)
|
||||||
|
return new(new Exception("Read Status Reg Failed"));
|
||||||
|
|
||||||
|
ret = await CloseTest();
|
||||||
|
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 };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
import tailwindcss from '@tailwindcss/postcss'
|
import tailwindcss from '@tailwindcss/postcss'
|
||||||
import autoprefixer from 'autoprefixer'
|
import autoprefixer from 'autoprefixer'
|
||||||
|
import basicSsl from '@vitejs/plugin-basic-ssl'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
@ -20,6 +21,7 @@ export default defineConfig({
|
||||||
}),
|
}),
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
vueDevTools(),
|
vueDevTools(),
|
||||||
|
// basicSsl()
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
@ -33,5 +35,9 @@ export default defineConfig({
|
||||||
autoprefixer()
|
autoprefixer()
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
outDir: 'wwwroot',
|
||||||
|
emptyOutDir: true, // also necessary
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue