skyeye-sdk-js 1.4.9 → 1.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/RequestFactory.d.ts +2 -0
- package/dist/src/RequestFactory.js +25 -0
- package/dist/src/SkyEyeClient.d.ts +2 -0
- package/dist/src/SkyEyeClient.js +22 -0
- package/dist/src/SkyEyeClientFactory.js +10 -2
- package/dist/test.js +20 -6
- package/package.json +1 -1
- package/src/RequestFactory.ts +26 -0
- package/src/SkyEyeClient.ts +17 -0
- package/src/SkyEyeClientFactory.ts +11 -2
- package/test.ts +21 -6
|
@@ -14,6 +14,8 @@ export declare class RequestFactory {
|
|
|
14
14
|
getCpuList(): JSONRequest;
|
|
15
15
|
getMemoryValue(cpuName: string, baseAddr: string, length: string, addressWidth?: number): JSONRequest;
|
|
16
16
|
setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string, addressWidth?: number): JSONRequest;
|
|
17
|
+
getBitValue(cpuName: string, baseAddr: string, bitIndex: number, addressWidth?: number): JSONRequest;
|
|
18
|
+
setBitValue(cpuName: string, baseAddr: string, bitIndex: number, value: number, addressWidth?: number): JSONRequest;
|
|
17
19
|
enableDeviceWork(deviceName: string): JSONRequest;
|
|
18
20
|
disableDeviceWork(deviceName: string): JSONRequest;
|
|
19
21
|
changeDir(path: string): JSONRequest;
|
|
@@ -91,6 +91,31 @@ class RequestFactory {
|
|
|
91
91
|
request.setRequest(baseRequest.toJSONString());
|
|
92
92
|
return request;
|
|
93
93
|
}
|
|
94
|
+
getBitValue(cpuName, baseAddr, bitIndex, addressWidth) {
|
|
95
|
+
const baseRequest = new BaseRequest_1.BaseRequest("SE_get_bit_value");
|
|
96
|
+
const args = {};
|
|
97
|
+
args.cpuname = cpuName;
|
|
98
|
+
args.baseaddr = "0x" + baseAddr;
|
|
99
|
+
args.bitindex = bitIndex;
|
|
100
|
+
args.address_width = addressWidth;
|
|
101
|
+
baseRequest.setArgs(args);
|
|
102
|
+
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
103
|
+
request.setRequest(baseRequest.toJSONString());
|
|
104
|
+
return request;
|
|
105
|
+
}
|
|
106
|
+
setBitValue(cpuName, baseAddr, bitIndex, value, addressWidth) {
|
|
107
|
+
const baseRequest = new BaseRequest_1.BaseRequest("SE_set_bit_value");
|
|
108
|
+
const args = {};
|
|
109
|
+
args.cpuname = cpuName;
|
|
110
|
+
args.baseaddr = "0x" + baseAddr;
|
|
111
|
+
args.bitindex = bitIndex;
|
|
112
|
+
args.value = value;
|
|
113
|
+
args.address_width = addressWidth;
|
|
114
|
+
baseRequest.setArgs(args);
|
|
115
|
+
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
116
|
+
request.setRequest(baseRequest.toJSONString());
|
|
117
|
+
return request;
|
|
118
|
+
}
|
|
94
119
|
enableDeviceWork(deviceName) {
|
|
95
120
|
const baseRequest = new BaseRequest_1.BaseRequest("SE_enable_device_work");
|
|
96
121
|
const args = {};
|
|
@@ -56,6 +56,8 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
|
56
56
|
getAddressingSpaceDefault(baseAddr: string, length: string): Promise<any>;
|
|
57
57
|
setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string, addressWidth?: number): Promise<any>;
|
|
58
58
|
setMemoryValueDefault(baseAddr: string, value: string, length: string, addressWidth?: number): Promise<any>;
|
|
59
|
+
setBitValue(cpuName: string, baseAddr: string, bitIndex: number, value: number, addressWidth?: number): Promise<any>;
|
|
60
|
+
getBitValue(cpuName: string, baseAddr: string, bitIndex: number, addressWidth?: number): Promise<any>;
|
|
59
61
|
getCpuRegisters(cpuName: string): Promise<GetCpuRegisterInfoResponse>;
|
|
60
62
|
getCpuRegistersDefault(): Promise<GetCpuRegisterInfoResponse>;
|
|
61
63
|
setCpuRegisterValueDefault(register: Register, value: string): Promise<any>;
|
package/dist/src/SkyEyeClient.js
CHANGED
|
@@ -631,6 +631,28 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
631
631
|
}
|
|
632
632
|
});
|
|
633
633
|
}
|
|
634
|
+
setBitValue(cpuName, baseAddr, bitIndex, value, addressWidth) {
|
|
635
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
636
|
+
try {
|
|
637
|
+
return yield this.call(RequestFactory_1.RequestFactory.getInstance().setBitValue(cpuName, baseAddr, bitIndex, value, addressWidth));
|
|
638
|
+
}
|
|
639
|
+
catch (error) {
|
|
640
|
+
console.error("Error during getAddressingSpaceDefault:", error);
|
|
641
|
+
throw error;
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
getBitValue(cpuName, baseAddr, bitIndex, addressWidth) {
|
|
646
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
647
|
+
try {
|
|
648
|
+
return yield this.call(RequestFactory_1.RequestFactory.getInstance().getBitValue(cpuName, baseAddr, bitIndex, addressWidth));
|
|
649
|
+
}
|
|
650
|
+
catch (error) {
|
|
651
|
+
console.error("Error during getAddressingSpaceDefault:", error);
|
|
652
|
+
throw error;
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
}
|
|
634
656
|
getCpuRegisters(cpuName) {
|
|
635
657
|
return __awaiter(this, void 0, void 0, function* () {
|
|
636
658
|
const response = new GetCpuRegisterInfoResponse_1.GetCpuRegisterInfoResponse();
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SkyEyeClientFactory = void 0;
|
|
13
13
|
const SkyEyeClient_1 = require("./SkyEyeClient");
|
|
14
|
+
const GetRunningStateResponse_1 = require("./response/GetRunningStateResponse");
|
|
14
15
|
class SkyEyeClientFactory {
|
|
15
16
|
constructor() { }
|
|
16
17
|
static get instance() {
|
|
@@ -31,11 +32,15 @@ class SkyEyeClientFactory {
|
|
|
31
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
const client = this.createClient(ip, port);
|
|
33
34
|
const startTime = Date.now();
|
|
35
|
+
let isTimeout = true;
|
|
34
36
|
while (Date.now() - startTime < time * 1000) {
|
|
35
37
|
try {
|
|
36
|
-
const response = client.getCurrentRunningState();
|
|
38
|
+
const response = yield client.getCurrentRunningState();
|
|
37
39
|
console.log("response:", response);
|
|
38
|
-
|
|
40
|
+
if (response.getState() !== GetRunningStateResponse_1.StateState.QUITED) {
|
|
41
|
+
isTimeout = false;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
catch (error) {
|
|
41
46
|
try {
|
|
@@ -46,6 +51,9 @@ class SkyEyeClientFactory {
|
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
}
|
|
54
|
+
if (isTimeout) {
|
|
55
|
+
throw new Error('连接超时');
|
|
56
|
+
}
|
|
49
57
|
return client;
|
|
50
58
|
});
|
|
51
59
|
}
|
package/dist/test.js
CHANGED
|
@@ -50,15 +50,29 @@ function test() {
|
|
|
50
50
|
// const fileName = "FMQL45T900_SylixOS.skyeye";
|
|
51
51
|
// const skyeyeDir = "D:/install/SkyEye/opt/skyeye/bin/skyeye.exe"
|
|
52
52
|
// const port = "50066"
|
|
53
|
-
const pathSkyEye = "
|
|
54
|
-
const fileName = "
|
|
55
|
-
const skyeyeDir = "
|
|
53
|
+
const pathSkyEye = "G:/SkyEye/demo/c6713_demo";
|
|
54
|
+
const fileName = "G:/SkyEye/demo/c6713_demo/c6713_demo.skyeye";
|
|
55
|
+
const skyeyeDir = "G:/SkyEye/opt/skyeye/bin/skyeye.exe";
|
|
56
56
|
const port = "50053";
|
|
57
57
|
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port);
|
|
58
58
|
const t = yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir);
|
|
59
|
-
client.runCommand();
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
yield client.runCommand();
|
|
60
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
let response = yield client.stopCommand();
|
|
62
|
+
console.log("response:", response);
|
|
63
|
+
response = yield client.getMemoryValue('c67x_core_0', '16120', '1', 8);
|
|
64
|
+
console.log("response:", response);
|
|
65
|
+
response = yield client.getBitValue('c67x_core_0', '16120', 1, 8);
|
|
66
|
+
console.log("response:", response);
|
|
67
|
+
response = yield client.setBitValue('c67x_core_0', '16120', 1, 0, 8);
|
|
68
|
+
console.log("response:", response);
|
|
69
|
+
response = yield client.getMemoryValue('c67x_core_0', '16120', '1', 8);
|
|
70
|
+
console.log("response:", response);
|
|
71
|
+
response = yield client.getBitValue('c67x_core_0', '16120', 1, 8);
|
|
72
|
+
console.log("response:", response);
|
|
73
|
+
}), 2000);
|
|
74
|
+
// response = client.setBitValue('c67x_core_0', '0x1000','1', 8)
|
|
75
|
+
// console.log("response:", response)
|
|
62
76
|
// const responseCpuList = await client.getCpuList()
|
|
63
77
|
// console.log("responseCpuList:", responseCpuList)
|
|
64
78
|
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', 50056);
|
package/package.json
CHANGED
package/src/RequestFactory.ts
CHANGED
|
@@ -107,6 +107,32 @@ export class RequestFactory {
|
|
|
107
107
|
return request;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
public getBitValue(cpuName: string, baseAddr: string, bitIndex: number, addressWidth?: number) {
|
|
111
|
+
const baseRequest = new BaseRequest("SE_get_bit_value");
|
|
112
|
+
const args: { [key: string]: any } = {};
|
|
113
|
+
args.cpuname = cpuName;
|
|
114
|
+
args.baseaddr = "0x" + baseAddr;
|
|
115
|
+
args.bitindex = bitIndex;
|
|
116
|
+
args.address_width = addressWidth;
|
|
117
|
+
baseRequest.setArgs(args)
|
|
118
|
+
const request = new JSONRequest()
|
|
119
|
+
request.setRequest(baseRequest.toJSONString());
|
|
120
|
+
return request;
|
|
121
|
+
}
|
|
122
|
+
public setBitValue(cpuName: string, baseAddr: string, bitIndex: number, value: number, addressWidth?: number) {
|
|
123
|
+
const baseRequest = new BaseRequest("SE_set_bit_value");
|
|
124
|
+
const args: { [key: string]: any } = {};
|
|
125
|
+
args.cpuname = cpuName;
|
|
126
|
+
args.baseaddr = "0x" + baseAddr;
|
|
127
|
+
args.bitindex = bitIndex;
|
|
128
|
+
args.value = value;
|
|
129
|
+
args.address_width = addressWidth;
|
|
130
|
+
baseRequest.setArgs(args)
|
|
131
|
+
const request = new JSONRequest()
|
|
132
|
+
request.setRequest(baseRequest.toJSONString());
|
|
133
|
+
return request;
|
|
134
|
+
}
|
|
135
|
+
|
|
110
136
|
|
|
111
137
|
|
|
112
138
|
public enableDeviceWork(deviceName: string) {
|
package/src/SkyEyeClient.ts
CHANGED
|
@@ -554,6 +554,23 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
+
public async setBitValue(cpuName: string, baseAddr: string, bitIndex: number, value: number, addressWidth?: number) {
|
|
558
|
+
try {
|
|
559
|
+
return await this.call(RequestFactory.getInstance().setBitValue(cpuName, baseAddr, bitIndex , value, addressWidth));
|
|
560
|
+
} catch (error) {
|
|
561
|
+
console.error("Error during getAddressingSpaceDefault:", error);
|
|
562
|
+
throw error;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
public async getBitValue(cpuName: string, baseAddr: string, bitIndex: number, addressWidth?: number) {
|
|
567
|
+
try {
|
|
568
|
+
return await this.call(RequestFactory.getInstance().getBitValue(cpuName, baseAddr, bitIndex, addressWidth));
|
|
569
|
+
} catch (error) {
|
|
570
|
+
console.error("Error during getAddressingSpaceDefault:", error);
|
|
571
|
+
throw error;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
557
574
|
|
|
558
575
|
|
|
559
576
|
public async getCpuRegisters(cpuName: string) {
|
|
@@ -2,6 +2,7 @@ import { SkyEyeClient } from "./SkyEyeClient";
|
|
|
2
2
|
import { RequestFactory } from "./RequestFactory";
|
|
3
3
|
import { JSONResponse } from "./proto/skyeye_rpc_pb";
|
|
4
4
|
import { time } from "console";
|
|
5
|
+
import { StateState } from "./response/GetRunningStateResponse";
|
|
5
6
|
|
|
6
7
|
class SkyEyeClientFactory {
|
|
7
8
|
private static _instance: SkyEyeClientFactory;
|
|
@@ -26,11 +27,16 @@ class SkyEyeClientFactory {
|
|
|
26
27
|
public async createConnectedClientTime(ip: string, port: string, time: number): Promise<SkyEyeClient> {
|
|
27
28
|
const client = this.createClient(ip, port);
|
|
28
29
|
const startTime: number = Date.now();
|
|
30
|
+
let isTimeout = true
|
|
29
31
|
while (Date.now() - startTime < time * 1000) {
|
|
30
32
|
try {
|
|
31
|
-
const response = client.getCurrentRunningState();
|
|
33
|
+
const response = await client.getCurrentRunningState();
|
|
32
34
|
console.log("response:", response);
|
|
33
|
-
|
|
35
|
+
if (response.getState() !== StateState.QUITED) {
|
|
36
|
+
isTimeout = false
|
|
37
|
+
break
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
} catch (error) {
|
|
35
41
|
try {
|
|
36
42
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
@@ -39,6 +45,9 @@ class SkyEyeClientFactory {
|
|
|
39
45
|
}
|
|
40
46
|
}
|
|
41
47
|
}
|
|
48
|
+
if (isTimeout) {
|
|
49
|
+
throw new Error('连接超时')
|
|
50
|
+
}
|
|
42
51
|
return client;
|
|
43
52
|
}
|
|
44
53
|
}
|
package/test.ts
CHANGED
|
@@ -57,15 +57,30 @@ async function test() {
|
|
|
57
57
|
// const skyeyeDir = "D:/install/SkyEye/opt/skyeye/bin/skyeye.exe"
|
|
58
58
|
// const port = "50066"
|
|
59
59
|
|
|
60
|
-
const pathSkyEye = "
|
|
61
|
-
const fileName = "
|
|
62
|
-
const skyeyeDir = "
|
|
60
|
+
const pathSkyEye = "G:/SkyEye/demo/c6713_demo";
|
|
61
|
+
const fileName = "G:/SkyEye/demo/c6713_demo/c6713_demo.skyeye";
|
|
62
|
+
const skyeyeDir = "G:/SkyEye/opt/skyeye/bin/skyeye.exe"
|
|
63
63
|
const port = "50053"
|
|
64
64
|
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port);
|
|
65
65
|
const t = await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
|
|
66
|
-
client.runCommand()
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
await client.runCommand()
|
|
67
|
+
setTimeout(async () => {
|
|
68
|
+
let response = await client.stopCommand()
|
|
69
|
+
console.log("response:", response)
|
|
70
|
+
response = await client.getMemoryValue('c67x_core_0', '16120','1', 8)
|
|
71
|
+
console.log("response:", response)
|
|
72
|
+
response = await client.getBitValue('c67x_core_0', '16120',1, 8)
|
|
73
|
+
console.log("response:", response)
|
|
74
|
+
response = await client.setBitValue('c67x_core_0', '16120',1, 0, 8)
|
|
75
|
+
console.log("response:", response)
|
|
76
|
+
response = await client.getMemoryValue('c67x_core_0', '16120','1', 8)
|
|
77
|
+
console.log("response:", response)
|
|
78
|
+
response = await client.getBitValue('c67x_core_0', '16120',1, 8)
|
|
79
|
+
console.log("response:", response)
|
|
80
|
+
},2000)
|
|
81
|
+
|
|
82
|
+
// response = client.setBitValue('c67x_core_0', '0x1000','1', 8)
|
|
83
|
+
// console.log("response:", response)
|
|
69
84
|
|
|
70
85
|
// const responseCpuList = await client.getCpuList()
|
|
71
86
|
// console.log("responseCpuList:", responseCpuList)
|