fix: 修复jtag未认证的问题

This commit is contained in:
2025-07-20 09:09:50 +08:00
parent 1fa944f3c7
commit 9c7bde206b
2 changed files with 30 additions and 18 deletions

View File

@@ -27,7 +27,6 @@ export const useEquipments = defineStore("equipments", () => {
1000,
new Error("JtagClient Mutex Timeout!"),
);
const jtagClient = AuthManager.createAuthenticatedJtagClient();
// Matrix Key
const matrixKeyStates = reactive(new Array<boolean>(16).fill(false));
@@ -36,7 +35,6 @@ export const useEquipments = defineStore("equipments", () => {
1000,
new Error("Matrixkeyclient Mutex Timeout!"),
);
const matrixKeypadClient = AuthManager.createAuthenticatedMatrixKeyClient();
// Power
const powerClientMutex = withTimeout(
@@ -44,7 +42,6 @@ export const useEquipments = defineStore("equipments", () => {
1000,
new Error("Matrixkeyclient Mutex Timeout!"),
);
const powerClient = AuthManager.createAuthenticatedPowerClient();
// Enable Setting
const enableJtagBoundaryScan = ref(false);
@@ -105,6 +102,7 @@ export const useEquipments = defineStore("equipments", () => {
async function jtagBoundaryScan() {
const release = await jtagClientMutex.acquire();
try {
const jtagClient = AuthManager.createAuthenticatedJtagClient();
const portStates = await jtagClient.boundaryScanLogicalPorts(
boardAddr.value,
boardPort.value,
@@ -125,6 +123,7 @@ export const useEquipments = defineStore("equipments", () => {
async function jtagUploadBitstream(bitstream: File): Promise<boolean> {
try {
const jtagClient = AuthManager.createAuthenticatedJtagClient();
const resp = await jtagClient.uploadBitstream(
boardAddr.value,
toFileParameterOrUndefined(bitstream),
@@ -140,6 +139,7 @@ export const useEquipments = defineStore("equipments", () => {
async function jtagDownloadBitstream(): Promise<boolean> {
const release = await jtagClientMutex.acquire();
try {
const jtagClient = AuthManager.createAuthenticatedJtagClient();
const resp = await jtagClient.downloadBitstream(
boardAddr.value,
boardPort.value,
@@ -157,6 +157,7 @@ export const useEquipments = defineStore("equipments", () => {
async function jtagGetIDCode(isQuiet: boolean = false): Promise<number> {
const release = await jtagClientMutex.acquire();
try {
const jtagClient = AuthManager.createAuthenticatedJtagClient();
const resp = await jtagClient.getDeviceIDCode(
boardAddr.value,
boardPort.value,
@@ -173,6 +174,7 @@ export const useEquipments = defineStore("equipments", () => {
async function jtagSetSpeed(speed: number): Promise<boolean> {
const release = await jtagClientMutex.acquire();
try {
const jtagClient = AuthManager.createAuthenticatedJtagClient();
const resp = await jtagClient.setSpeed(
boardAddr.value,
boardPort.value,
@@ -191,6 +193,7 @@ export const useEquipments = defineStore("equipments", () => {
const release = await matrixKeypadClientMutex.acquire();
console.log("set Key !!!!!!!!!!!!");
try {
const matrixKeypadClient = AuthManager.createAuthenticatedMatrixKeyClient();
const resp = await matrixKeypadClient.setMatrixKeyStatus(
boardAddr.value,
boardPort.value,
@@ -209,6 +212,7 @@ export const useEquipments = defineStore("equipments", () => {
const release = await matrixKeypadClientMutex.acquire();
try {
if (enable) {
const matrixKeypadClient = AuthManager.createAuthenticatedMatrixKeyClient();
const resp = await matrixKeypadClient.enabelMatrixKey(
boardAddr.value,
boardPort.value,
@@ -216,6 +220,7 @@ export const useEquipments = defineStore("equipments", () => {
enableMatrixKey.value = resp;
return resp;
} else {
const matrixKeypadClient = AuthManager.createAuthenticatedMatrixKeyClient();
const resp = await matrixKeypadClient.disableMatrixKey(
boardAddr.value,
boardPort.value,
@@ -235,6 +240,7 @@ export const useEquipments = defineStore("equipments", () => {
async function powerSetOnOff(enable: boolean) {
const release = await powerClientMutex.acquire();
try {
const powerClient = AuthManager.createAuthenticatedPowerClient();
const resp = await powerClient.setPowerOnOff(
boardAddr.value,
boardPort.value,
@@ -262,7 +268,6 @@ export const useEquipments = defineStore("equipments", () => {
jtagBitstream,
jtagBoundaryScanFreq,
jtagClientMutex,
jtagClient,
jtagUploadBitstream,
jtagDownloadBitstream,
jtagGetIDCode,
@@ -272,13 +277,11 @@ export const useEquipments = defineStore("equipments", () => {
enableMatrixKey,
matrixKeyStates,
matrixKeypadClientMutex,
matrixKeypadClient,
matrixKeypadEnable,
matrixKeypadSetKeyStates,
// Power
enablePower,
powerClient,
powerClientMutex,
powerSetOnOff,
};