feat: asp serve frontend static files
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -10,6 +10,7 @@ lerna-debug.log*
 | 
			
		||||
node_modules
 | 
			
		||||
.DS_Store
 | 
			
		||||
dist
 | 
			
		||||
**/wwwroot
 | 
			
		||||
dist-ssr
 | 
			
		||||
coverage
 | 
			
		||||
*.local
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								.justfile
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								.justfile
									
									
									
									
									
								
							@@ -1,3 +1,5 @@
 | 
			
		||||
isSelfContained := "false"
 | 
			
		||||
 | 
			
		||||
@_show-dir:
 | 
			
		||||
  echo "Current Working Directory:"
 | 
			
		||||
  pwd
 | 
			
		||||
@@ -12,6 +14,8 @@ clean:
 | 
			
		||||
  rm -rf "dist"
 | 
			
		||||
 | 
			
		||||
update:
 | 
			
		||||
  npm install
 | 
			
		||||
  cd server && dotnet restore
 | 
			
		||||
  git submodule update --init --remote --recursive
 | 
			
		||||
 | 
			
		||||
# 生成Restful API到网页客户端
 | 
			
		||||
@@ -22,16 +26,25 @@ gen-api:
 | 
			
		||||
 | 
			
		||||
# 构建服务器,包含win与linux平台
 | 
			
		||||
[working-directory: "server"]
 | 
			
		||||
build-server: _show-dir
 | 
			
		||||
  dotnet publish --self-contained false -t:PublishAllRids
 | 
			
		||||
build-server self-contained=isSelfContained: _show-dir
 | 
			
		||||
  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/
 | 
			
		||||
 | 
			
		||||
# 运行服务器
 | 
			
		||||
[working-directory: "server"]
 | 
			
		||||
run-server: _show-dir
 | 
			
		||||
  dotnet run
 | 
			
		||||
run-server: (build-server "true")
 | 
			
		||||
  exec ./server/bin/Release/net9.0/linux-x64/publish/server
 | 
			
		||||
 | 
			
		||||
run-web:
 | 
			
		||||
  npm run build
 | 
			
		||||
  npm run preview
 | 
			
		||||
 | 
			
		||||
# 测试服务器
 | 
			
		||||
dev-server: _show-dir
 | 
			
		||||
  cd server && dotnet run
 | 
			
		||||
 | 
			
		||||
# 运行网页客户端
 | 
			
		||||
run-web: 
 | 
			
		||||
dev-web: 
 | 
			
		||||
  npm run dev
 | 
			
		||||
  
 | 
			
		||||
# 运行测试用例测试服务器
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										14
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -24,6 +24,7 @@
 | 
			
		||||
        "@tailwindcss/postcss": "^4.0.12",
 | 
			
		||||
        "@tsconfig/node22": "^22.0.0",
 | 
			
		||||
        "@types/node": "^22.13.4",
 | 
			
		||||
        "@vitejs/plugin-basic-ssl": "^2.0.0",
 | 
			
		||||
        "@vitejs/plugin-vue": "^5.2.1",
 | 
			
		||||
        "@vitejs/plugin-vue-jsx": "^4.1.1",
 | 
			
		||||
        "@vue/tsconfig": "^0.7.0",
 | 
			
		||||
@@ -1636,6 +1637,19 @@
 | 
			
		||||
        "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": {
 | 
			
		||||
      "version": "5.2.3",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.3.tgz",
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@
 | 
			
		||||
    "@tailwindcss/postcss": "^4.0.12",
 | 
			
		||||
    "@tsconfig/node22": "^22.0.0",
 | 
			
		||||
    "@types/node": "^22.13.4",
 | 
			
		||||
    "@vitejs/plugin-basic-ssl": "^2.0.0",
 | 
			
		||||
    "@vitejs/plugin-vue": "^5.2.1",
 | 
			
		||||
    "@vitejs/plugin-vue-jsx": "^4.1.1",
 | 
			
		||||
    "@vue/tsconfig": "^0.7.0",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using Microsoft.AspNetCore.Http.Features;
 | 
			
		||||
using Microsoft.Extensions.FileProviders;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using NLog;
 | 
			
		||||
using NLog.Web;
 | 
			
		||||
@@ -9,7 +10,6 @@ var logger = NLog.LogManager.Setup()
 | 
			
		||||
                      .GetCurrentClassLogger();
 | 
			
		||||
logger.Debug("Init Main...");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
try
 | 
			
		||||
{
 | 
			
		||||
    var builder = WebApplication.CreateBuilder(args);
 | 
			
		||||
@@ -84,15 +84,24 @@ try
 | 
			
		||||
    // Application Settings
 | 
			
		||||
    var app = builder.Build();
 | 
			
		||||
    // Configure the HTTP request pipeline.
 | 
			
		||||
    // app.UseExceptionHandler(new ExceptionHandlerOptions()
 | 
			
		||||
    // {
 | 
			
		||||
    //     AllowStatusCode404Response = true,
 | 
			
		||||
    //     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();
 | 
			
		||||
    if (!app.Environment.IsDevelopment())
 | 
			
		||||
    {
 | 
			
		||||
        // app.UseExceptionHandler("/Home/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();
 | 
			
		||||
 | 
			
		||||
        // 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.UseStaticFiles();
 | 
			
		||||
    app.UseRouting();
 | 
			
		||||
    app.UseCors();
 | 
			
		||||
    app.UseAuthorization();
 | 
			
		||||
@@ -103,15 +112,13 @@ try
 | 
			
		||||
    app.UseSwaggerUi();
 | 
			
		||||
    // }
 | 
			
		||||
 | 
			
		||||
    // Router
 | 
			
		||||
    app.MapControllers();
 | 
			
		||||
 | 
			
		||||
    // Setup Program
 | 
			
		||||
    MsgBus.Init();
 | 
			
		||||
 | 
			
		||||
    // Router
 | 
			
		||||
    // API Get
 | 
			
		||||
    app.MapGet("/", () => Results.Redirect("/swagger"));
 | 
			
		||||
    app.MapControllers();
 | 
			
		||||
 | 
			
		||||
    app.Run("http://localhost:5000");
 | 
			
		||||
    app.Run();
 | 
			
		||||
}
 | 
			
		||||
catch (Exception exception)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -5,18 +5,20 @@
 | 
			
		||||
      "commandName": "Project",
 | 
			
		||||
      "dotnetRunMessages": true,
 | 
			
		||||
      "launchBrowser": true,
 | 
			
		||||
      "applicationUrl": "http://localhost:5188",
 | 
			
		||||
      "applicationUrl": "http://localhost:5000",
 | 
			
		||||
      "environmentVariables": {
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development",
 | 
			
		||||
        "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "https": {
 | 
			
		||||
      "commandName": "Project",
 | 
			
		||||
      "dotnetRunMessages": true,
 | 
			
		||||
      "launchBrowser": true,
 | 
			
		||||
      "applicationUrl": "https://localhost:7070;http://localhost:5188",
 | 
			
		||||
      "applicationUrl": "https://localhost:7278;http://localhost:5000",
 | 
			
		||||
      "environmentVariables": {
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development",
 | 
			
		||||
        "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,21 +1,26 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
			
		||||
  <Import Project="PublishAllRids.targets" />
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>net9.0</TargetFramework>
 | 
			
		||||
    <Nullable>enable</Nullable>
 | 
			
		||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
			
		||||
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
 | 
			
		||||
    <RuntimeIdentifiers>win-x64;linux-x64;</RuntimeIdentifiers>
 | 
			
		||||
    <PublishSingleFile>true</PublishSingleFile>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
			
		||||
  <Import Project="PublishAllRids.xml" />
 | 
			
		||||
  <!-- <Import Project="PublishSPA.xml" /> -->
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>net9.0</TargetFramework>
 | 
			
		||||
    <Nullable>enable</Nullable>
 | 
			
		||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
			
		||||
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
 | 
			
		||||
    <RuntimeIdentifiers>win-x64;linux-x64;</RuntimeIdentifiers>
 | 
			
		||||
    <PublishSingleFile>true</PublishSingleFile>
 | 
			
		||||
    <SpaRoot>../</SpaRoot>
 | 
			
		||||
    <SpaProxyServerUrl>http://localhost:5173</SpaProxyServerUrl>
 | 
			
		||||
    <SpaProxyLaunchCommand>npm run dev</SpaProxyLaunchCommand>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <PackageReference Include="DotNext" Version="5.19.1" />
 | 
			
		||||
    <PackageReference Include="DotNext.Threading" Version="5.19.1" />
 | 
			
		||||
    <PackageReference Include="Honoo.IO.Hashing.Crc" Version="1.3.3" />
 | 
			
		||||
    <PackageReference Include="linq2db.AspNet" Version="5.4.1" />
 | 
			
		||||
    <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="Newtonsoft.Json" Version="13.0.3" />
 | 
			
		||||
    <PackageReference Include="NLog" Version="5.4.0" />
 | 
			
		||||
@@ -23,6 +28,6 @@
 | 
			
		||||
    <PackageReference Include="NSwag.AspNetCore" Version="14.3.0" />
 | 
			
		||||
    <PackageReference Include="pythonnet" Version="3.0.5" />
 | 
			
		||||
    <PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,44 @@ using WebProtocol;
 | 
			
		||||
 | 
			
		||||
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>
 | 
			
		||||
/// UDP API 
 | 
			
		||||
/// </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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
/// Jtag控制器
 | 
			
		||||
/// </summary>
 | 
			
		||||
@@ -730,13 +745,13 @@ public class Jtag
 | 
			
		||||
        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(
 | 
			
		||||
                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);
 | 
			
		||||
 | 
			
		||||
        if (ret.Value)
 | 
			
		||||
@@ -745,6 +760,31 @@ public class Jtag
 | 
			
		||||
            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>
 | 
			
		||||
    /// 读取 JTAG 设备的 ID 代码
 | 
			
		||||
    /// </summary>
 | 
			
		||||
@@ -774,7 +814,7 @@ public class Jtag
 | 
			
		||||
        if (!ret.IsSuccessful) return new(ret.Error);
 | 
			
		||||
        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)
 | 
			
		||||
        {
 | 
			
		||||
            return new(new Exception("Get ID Code Failed"));
 | 
			
		||||
@@ -812,11 +852,9 @@ public class Jtag
 | 
			
		||||
        if (!ret.IsSuccessful) return new(ret.Error);
 | 
			
		||||
        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)
 | 
			
		||||
        {
 | 
			
		||||
            return new(new Exception("Read Status Reg Failed"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return retData.Value;
 | 
			
		||||
    }
 | 
			
		||||
@@ -901,4 +939,46 @@ public class Jtag
 | 
			
		||||
        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 tailwindcss from '@tailwindcss/postcss'
 | 
			
		||||
import autoprefixer from 'autoprefixer'
 | 
			
		||||
import basicSsl from '@vitejs/plugin-basic-ssl'
 | 
			
		||||
 | 
			
		||||
// https://vite.dev/config/
 | 
			
		||||
export default defineConfig({
 | 
			
		||||
@@ -20,6 +21,7 @@ export default defineConfig({
 | 
			
		||||
    }),
 | 
			
		||||
    vueJsx(),
 | 
			
		||||
    vueDevTools(),
 | 
			
		||||
    // basicSsl()
 | 
			
		||||
  ],
 | 
			
		||||
  resolve: {
 | 
			
		||||
    alias: {
 | 
			
		||||
@@ -33,5 +35,9 @@ export default defineConfig({
 | 
			
		||||
        autoprefixer()
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  build: {
 | 
			
		||||
    outDir: 'wwwroot',
 | 
			
		||||
    emptyOutDir: true, // also necessary
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user