-
Notifications
You must be signed in to change notification settings - Fork 4
/
api-types.ts
83 lines (72 loc) · 2.06 KB
/
api-types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Peripheral Inspector API
export interface IPeripheralInspectorAPI {
registerSVDFile: (expression: RegExp | string, path: string) => void;
getSVDFile: (device: string) => string | undefined;
getSVDFileFromCortexDebug: (device: string) => Promise<string | undefined>;
registerPeripheralsProvider: (fileExtension: string, provider: IPeripheralsProvider) => void;
}
export interface IPeripheralsProvider {
getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise<PeripheralOptions[]>;
}
export interface IGetPeripheralsArguments {
gapThreshold: number;
}
export interface PeripheralOptions {
name: string;
baseAddress: number;
totalLength: number;
description: string;
groupName?: string;
accessType?: AccessType;
size?: number;
resetValue?: number;
registers?: PeripheralRegisterOptions[];
clusters?: ClusterOptions[];
}
export interface PeripheralRegisterOptions {
name: string;
description?: string;
addressOffset: number;
accessType?: AccessType;
size?: number;
resetValue?: number;
fields?: FieldOptions[];
}
export interface ClusterOptions {
name: string;
description?: string;
addressOffset: number;
accessType?: AccessType;
size?: number;
resetValue?: number;
registers?: PeripheralRegisterOptions[];
clusters?: ClusterOptions[];
}
export interface FieldOptions {
name: string;
description: string;
offset: number;
width: number;
enumeration?: EnumerationMap;
derivedFrom?: string; // Set this if unresolved
accessType?: AccessType;
}
export interface IGetPeripheralsArguments {
gapThreshold: number;
}
export interface IPeripheralsProvider {
getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise<PeripheralOptions[]>;
}
export enum AccessType {
ReadOnly = 1,
ReadWrite = 2,
WriteOnly = 3
}
export interface EnumerationMap {
[value: number]: IEnumeratedValue;
}
export interface IEnumeratedValue {
name: string;
description: string;
value: number;
}