@mchp-mcc/scf-pic8-osc-v1 4.3.2 → 4.3.4
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/Changelog.md +18 -0
- package/Readme.md +18 -0
- package/lib/generated_module/src/index.js +0 -5
- package/output/autoCreator.js +1657 -0
- package/output/autoCreator.js.map +1 -0
- package/output/autoProcessor.js +1659 -0
- package/output/autoProcessor.js.map +1 -0
- package/output/clock.c.ftl +38 -7
- package/output/clock.h.ftl +5 -5
- package/output/creator.js +6283 -1566
- package/output/creator.js.map +1 -1
- package/output/processor.js +5394 -5863
- package/output/processor.js.map +1 -1
- package/package.json +88 -22
- package/src/ClockCalculator.test.ts +0 -117
- package/src/ClockCalculator.ts +0 -81
- package/src/CreatorFunctions.ts +0 -12
- package/src/DerivedData.test.tsx +0 -927
- package/src/DerivedData.ts +0 -304
- package/src/PinsLogic.test.ts +0 -917
- package/src/PinsLogic.ts +0 -297
- package/src/StringConstants.ts +0 -13
- package/src/moduleConfig.json +0 -580
- package/src/pinsdata.json +0 -90
package/src/PinsLogic.test.ts
DELETED
|
@@ -1,917 +0,0 @@
|
|
|
1
|
-
import { behaviour, direction, pin_row } from "@microchip/pin-standard";
|
|
2
|
-
import { getModel } from "../generated_module/src/App/AppModel";
|
|
3
|
-
import { mockState } from "../generated_module/tests/AppModel.test";
|
|
4
|
-
import { mockAssignedModule } from "../generated_module/tests/processor.test";
|
|
5
|
-
import { getDerivedData } from "./DerivedData";
|
|
6
|
-
import { getRowData } from "./PinsLogic";
|
|
7
|
-
|
|
8
|
-
describe("PinsLogic --> Test Cases ", () => {
|
|
9
|
-
describe("getRowData() test case 1 : For CLKOUT pin", () => {
|
|
10
|
-
describe("Test when CLKOUT is enabled", () => {
|
|
11
|
-
const mockModule = mockAssignedModule(mockState());
|
|
12
|
-
const model = getModel(mockModule, getDerivedData);
|
|
13
|
-
if (model) {
|
|
14
|
-
model.getImportValue = (int_name: string): any => {
|
|
15
|
-
const intfdata = {
|
|
16
|
-
config_request: {
|
|
17
|
-
CLKOUTEN: {
|
|
18
|
-
setting: "CLKOUTEN",
|
|
19
|
-
name: "clkoutenConfig2",
|
|
20
|
-
description: "Clock out Enable bit",
|
|
21
|
-
type: "ComboBox",
|
|
22
|
-
group: "CONFIG2",
|
|
23
|
-
tabs: ["main"],
|
|
24
|
-
displayOptionSetting: "description",
|
|
25
|
-
category: "hardware",
|
|
26
|
-
sdlHelp: {
|
|
27
|
-
tooltip: "Click for more Information",
|
|
28
|
-
url:
|
|
29
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
30
|
-
},
|
|
31
|
-
defaultValue: {
|
|
32
|
-
value: "CLKOUT function is enabled",
|
|
33
|
-
options: [
|
|
34
|
-
"CLKOUT function is enabled",
|
|
35
|
-
"CLKOUT function is disabled",
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
return intfdata[int_name];
|
|
42
|
-
};
|
|
43
|
-
model.getAssignedImport = (int_name: string): any => {
|
|
44
|
-
const intfdata = {
|
|
45
|
-
config_request: {
|
|
46
|
-
handle: {
|
|
47
|
-
providerId: "module1",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
return intfdata[int_name];
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const rowData: pin_row = {
|
|
56
|
-
name: "clockout",
|
|
57
|
-
module: "OSC",
|
|
58
|
-
function: "CLKOUT",
|
|
59
|
-
direction: direction.output,
|
|
60
|
-
filter: {
|
|
61
|
-
module: "CLOCK CONTROL",
|
|
62
|
-
aliasReEx: "CLKOUT",
|
|
63
|
-
},
|
|
64
|
-
behaviour: behaviour.EXCLUSIVE_LOCK,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
it("Test for CLKOUT pin data", () => {
|
|
68
|
-
const expectedActions = [
|
|
69
|
-
{
|
|
70
|
-
actiontype: "SETACTION",
|
|
71
|
-
state: {
|
|
72
|
-
L: {
|
|
73
|
-
type: "[FORM] SUBMIT",
|
|
74
|
-
payload: {
|
|
75
|
-
tabId: "main",
|
|
76
|
-
path: "CONFIG2.clkoutenConfig2",
|
|
77
|
-
value: "CLKOUT function is enabled",
|
|
78
|
-
},
|
|
79
|
-
meta: {
|
|
80
|
-
to: "module1",
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
validFor: "CLKOUT",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
actiontype: "SETACTION",
|
|
88
|
-
state: {
|
|
89
|
-
UL: {
|
|
90
|
-
type: "[FORM] SUBMIT",
|
|
91
|
-
payload: {
|
|
92
|
-
tabId: "main",
|
|
93
|
-
path: "CONFIG2.clkoutenConfig2",
|
|
94
|
-
value: "CLKOUT function is disabled",
|
|
95
|
-
},
|
|
96
|
-
meta: {
|
|
97
|
-
to: "module1",
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
validFor: ".*",
|
|
102
|
-
},
|
|
103
|
-
];
|
|
104
|
-
if (model) {
|
|
105
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
106
|
-
expect(getRowData(model, rowData)?.actions).toEqual(expectedActions);
|
|
107
|
-
} else {
|
|
108
|
-
throw "Model not configured for testcase";
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it("Test for undefined interface (config_request)", () => {
|
|
113
|
-
if (model) {
|
|
114
|
-
model.getImportValue = (int_name: string): any => {
|
|
115
|
-
return undefined;
|
|
116
|
-
};
|
|
117
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData); // check if the same data is returned
|
|
118
|
-
expect(getRowData(model, rowData)?.actions).toEqual([]);
|
|
119
|
-
} else {
|
|
120
|
-
throw "Model not configured for testcase";
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
describe("Test when CLKOUT is disabled", () => {
|
|
126
|
-
const mockModule = mockAssignedModule(mockState());
|
|
127
|
-
const model = getModel(mockModule, getDerivedData);
|
|
128
|
-
if (model) {
|
|
129
|
-
model.getImportValue = (int_name: string): any => {
|
|
130
|
-
const intfdata = {
|
|
131
|
-
config_request: {
|
|
132
|
-
CLKOUTEN: {
|
|
133
|
-
setting: "CLKOUTEN",
|
|
134
|
-
name: "clkoutenConfig2",
|
|
135
|
-
description: "Clock out Enable bit",
|
|
136
|
-
type: "ComboBox",
|
|
137
|
-
group: "CONFIG2",
|
|
138
|
-
tabs: ["main"],
|
|
139
|
-
displayOptionSetting: "description",
|
|
140
|
-
category: "hardware",
|
|
141
|
-
sdlHelp: {
|
|
142
|
-
tooltip: "Click for more Information",
|
|
143
|
-
url:
|
|
144
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
145
|
-
},
|
|
146
|
-
defaultValue: {
|
|
147
|
-
value: "CLKOUT function is disabled",
|
|
148
|
-
options: [
|
|
149
|
-
"CLKOUT function is enabled",
|
|
150
|
-
"CLKOUT function is disabled",
|
|
151
|
-
],
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
return intfdata[int_name];
|
|
157
|
-
};
|
|
158
|
-
model.getAssignedImport = (int_name: string): any => {
|
|
159
|
-
const intfdata = {
|
|
160
|
-
config_request: {
|
|
161
|
-
handle: {
|
|
162
|
-
providerId: "module1",
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
return intfdata[int_name];
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const rowData: pin_row = {
|
|
171
|
-
name: "clockout",
|
|
172
|
-
module: "OSC",
|
|
173
|
-
function: "CLKOUT",
|
|
174
|
-
direction: direction.output,
|
|
175
|
-
filter: {
|
|
176
|
-
module: "CLOCK CONTROL",
|
|
177
|
-
aliasReEx: "CLKOUT",
|
|
178
|
-
},
|
|
179
|
-
behaviour: behaviour.EXCLUSIVE_LOCK,
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
it("Test for CLKOUT pin data", () => {
|
|
183
|
-
const expectedActions = [
|
|
184
|
-
{
|
|
185
|
-
actiontype: "SETACTION",
|
|
186
|
-
state: {
|
|
187
|
-
L: {
|
|
188
|
-
type: "[FORM] SUBMIT",
|
|
189
|
-
payload: {
|
|
190
|
-
tabId: "main",
|
|
191
|
-
path: "CONFIG2.clkoutenConfig2",
|
|
192
|
-
value: "CLKOUT function is enabled",
|
|
193
|
-
},
|
|
194
|
-
meta: {
|
|
195
|
-
to: "module1",
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
validFor: "CLKOUT",
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
actiontype: "SETACTION",
|
|
203
|
-
state: {
|
|
204
|
-
UL: {
|
|
205
|
-
type: "[FORM] SUBMIT",
|
|
206
|
-
payload: {
|
|
207
|
-
tabId: "main",
|
|
208
|
-
path: "CONFIG2.clkoutenConfig2",
|
|
209
|
-
value: "CLKOUT function is disabled",
|
|
210
|
-
},
|
|
211
|
-
meta: {
|
|
212
|
-
to: "module1",
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
validFor: ".*",
|
|
217
|
-
},
|
|
218
|
-
];
|
|
219
|
-
if (model) {
|
|
220
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
221
|
-
expect(getRowData(model, rowData)?.actions).toEqual(expectedActions);
|
|
222
|
-
} else {
|
|
223
|
-
throw "Model not configured for testcase";
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
it("Test for undefined interface (config_request)", () => {
|
|
228
|
-
if (model) {
|
|
229
|
-
model.getImportValue = (int_name: string): any => {
|
|
230
|
-
return undefined;
|
|
231
|
-
};
|
|
232
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData); // check if the same data is returned
|
|
233
|
-
expect(getRowData(model, rowData)?.actions).toEqual([]);
|
|
234
|
-
} else {
|
|
235
|
-
throw "Model not configured for testcase";
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
describe("getRowData() test case 2 : For CLKIN pin", () => {
|
|
242
|
-
describe("Test for FEXTOSC -- external clock", () => {
|
|
243
|
-
const mockModule = mockAssignedModule(mockState());
|
|
244
|
-
const model = getModel(mockModule, getDerivedData);
|
|
245
|
-
if (model) {
|
|
246
|
-
model.getImportValue = (int_name: string): any => {
|
|
247
|
-
const intfdata = {
|
|
248
|
-
config_request: {
|
|
249
|
-
FEXTOSC: {
|
|
250
|
-
setting: "FEXTOSC",
|
|
251
|
-
name: "fextoscConfig1",
|
|
252
|
-
description: "External Oscillator Selection",
|
|
253
|
-
type: "ComboBox",
|
|
254
|
-
group: "CONFIG1",
|
|
255
|
-
tabs: ["main"],
|
|
256
|
-
displayOptionSetting: "description",
|
|
257
|
-
category: "hardware",
|
|
258
|
-
sdlHelp: {
|
|
259
|
-
tooltip: "Click for more Information",
|
|
260
|
-
url:
|
|
261
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
262
|
-
},
|
|
263
|
-
defaultValue: {
|
|
264
|
-
value: "EC (external clock) above 8 MHz",
|
|
265
|
-
options: [
|
|
266
|
-
"LP (crystal oscillator) optimized for 32.768 kHz",
|
|
267
|
-
"XT (crystal oscillator) above 100 kHz, below 8 MHz",
|
|
268
|
-
"HS (crystal oscillator) above 8 MHz",
|
|
269
|
-
"Reserved (DO NOT USE)",
|
|
270
|
-
"Oscillator not enabled",
|
|
271
|
-
"EC (external clock) below 100 kHz",
|
|
272
|
-
"EC (external clock) for 500 kHz to 8 MHz",
|
|
273
|
-
"EC (external clock) above 8 MHz",
|
|
274
|
-
],
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
};
|
|
279
|
-
return intfdata[int_name];
|
|
280
|
-
};
|
|
281
|
-
model.getComponentValue = (comp_name: string): any => {
|
|
282
|
-
const compValue = {
|
|
283
|
-
noscOsccon1: "EXTOSC",
|
|
284
|
-
};
|
|
285
|
-
return compValue[comp_name];
|
|
286
|
-
};
|
|
287
|
-
model.getComponent = (comp_name: string): any => {
|
|
288
|
-
const compdata = {
|
|
289
|
-
mclrUnusedKey: {
|
|
290
|
-
component: {
|
|
291
|
-
name: "mclrUnusedKey",
|
|
292
|
-
description: "Name",
|
|
293
|
-
type: "string",
|
|
294
|
-
defaultValue: "key",
|
|
295
|
-
group: "software",
|
|
296
|
-
tabs: ["main"],
|
|
297
|
-
category: "software",
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
};
|
|
301
|
-
return compdata[comp_name];
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
const rowData: pin_row = {
|
|
305
|
-
name: "clockin",
|
|
306
|
-
module: "OSC",
|
|
307
|
-
function: "CLKIN",
|
|
308
|
-
direction: direction.input,
|
|
309
|
-
filter: {
|
|
310
|
-
module: "CLOCK CONTROL",
|
|
311
|
-
aliasReEx: "CLKIN",
|
|
312
|
-
},
|
|
313
|
-
behaviour: behaviour.EXCLUSIVE_LOCK,
|
|
314
|
-
};
|
|
315
|
-
it("Test for CLKIN pin data", () => {
|
|
316
|
-
const expectedActions = [
|
|
317
|
-
{
|
|
318
|
-
validFor: ".*",
|
|
319
|
-
state: {
|
|
320
|
-
L: {
|
|
321
|
-
type: "[FORM] SUBMIT",
|
|
322
|
-
payload: {
|
|
323
|
-
tabId: "main",
|
|
324
|
-
path: "software.mclrUnusedKey",
|
|
325
|
-
value: "",
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
actiontype: "SETACTION",
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
validFor: ".*",
|
|
333
|
-
state: {
|
|
334
|
-
UL: {
|
|
335
|
-
type: "[FORM] SUBMIT",
|
|
336
|
-
payload: {
|
|
337
|
-
tabId: "main",
|
|
338
|
-
path: "software.mclrUnusedKey",
|
|
339
|
-
value: "",
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
actiontype: "SETACTION",
|
|
344
|
-
},
|
|
345
|
-
];
|
|
346
|
-
if (model) {
|
|
347
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
348
|
-
expect(getRowData(model, rowData)?.actions).toEqual(expectedActions);
|
|
349
|
-
} else {
|
|
350
|
-
throw "Model not configured for testcase";
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
it("Test for undefined interface (config_request)", () => {
|
|
355
|
-
if (model) {
|
|
356
|
-
model.getImportValue = (int_name: string): any => {
|
|
357
|
-
return undefined;
|
|
358
|
-
};
|
|
359
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData); // check if the same data is returned
|
|
360
|
-
expect(getRowData(model, rowData)?.actions).toEqual([]);
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
it("Test for getComponent() as undefined", () => {
|
|
365
|
-
if (model) {
|
|
366
|
-
model.getComponent = (comp_name: string): any => {
|
|
367
|
-
return undefined;
|
|
368
|
-
};
|
|
369
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
370
|
-
expect(getRowData(model, rowData)?.actions).toEqual([]);
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
it("Test for getComponent() as undefined", () => {
|
|
375
|
-
if (model) {
|
|
376
|
-
model.getComponentValue = (comp_name: string): any => {
|
|
377
|
-
const compValue = {
|
|
378
|
-
noscOsccon1: "LFINTOSC",
|
|
379
|
-
};
|
|
380
|
-
return compValue[comp_name];
|
|
381
|
-
};
|
|
382
|
-
expect(getRowData(model, rowData)).toBeUndefined();
|
|
383
|
-
} else {
|
|
384
|
-
throw "Model not configured for testcase";
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
describe("Test for FEXTOSC -- crystal oscillator", () => {
|
|
390
|
-
const mockModule = mockAssignedModule(mockState());
|
|
391
|
-
const model = getModel(mockModule, getDerivedData);
|
|
392
|
-
if (model) {
|
|
393
|
-
model.getImportValue = (int_name: string): any => {
|
|
394
|
-
const intfdata = {
|
|
395
|
-
config_request: {
|
|
396
|
-
FEXTOSC: {
|
|
397
|
-
setting: "FEXTOSC",
|
|
398
|
-
name: "fextoscConfig1",
|
|
399
|
-
description: "External Oscillator Selection",
|
|
400
|
-
type: "ComboBox",
|
|
401
|
-
group: "CONFIG1",
|
|
402
|
-
tabs: ["main"],
|
|
403
|
-
displayOptionSetting: "description",
|
|
404
|
-
category: "hardware",
|
|
405
|
-
sdlHelp: {
|
|
406
|
-
tooltip: "Click for more Information",
|
|
407
|
-
url:
|
|
408
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
409
|
-
},
|
|
410
|
-
defaultValue: {
|
|
411
|
-
value: "HS (crystal oscillator) above 8 MHz",
|
|
412
|
-
options: [
|
|
413
|
-
"LP (crystal oscillator) optimized for 32.768 kHz",
|
|
414
|
-
"XT (crystal oscillator) above 100 kHz, below 8 MHz",
|
|
415
|
-
"HS (crystal oscillator) above 8 MHz",
|
|
416
|
-
"Reserved (DO NOT USE)",
|
|
417
|
-
"Oscillator not enabled",
|
|
418
|
-
"EC (external clock) below 100 kHz",
|
|
419
|
-
"EC (external clock) for 500 kHz to 8 MHz",
|
|
420
|
-
"EC (external clock) above 8 MHz",
|
|
421
|
-
],
|
|
422
|
-
},
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
};
|
|
426
|
-
return intfdata[int_name];
|
|
427
|
-
};
|
|
428
|
-
model.getComponent = (comp_name: string): any => {
|
|
429
|
-
const compdata = {
|
|
430
|
-
mclrUnusedKey: {
|
|
431
|
-
component: {
|
|
432
|
-
name: "mclrUnusedKey",
|
|
433
|
-
description: "Name",
|
|
434
|
-
type: "string",
|
|
435
|
-
defaultValue: "key",
|
|
436
|
-
group: "software",
|
|
437
|
-
tabs: ["main"],
|
|
438
|
-
category: "software",
|
|
439
|
-
},
|
|
440
|
-
},
|
|
441
|
-
};
|
|
442
|
-
return compdata[comp_name];
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
it("Test for CLKIN pin data", () => {
|
|
446
|
-
const rowData: pin_row = {
|
|
447
|
-
name: "clockin",
|
|
448
|
-
module: "OSC",
|
|
449
|
-
function: "CLKIN",
|
|
450
|
-
direction: direction.input,
|
|
451
|
-
filter: {
|
|
452
|
-
module: "CLOCK CONTROL",
|
|
453
|
-
aliasReEx: "CLKIN",
|
|
454
|
-
},
|
|
455
|
-
behaviour: behaviour.EXCLUSIVE_LOCK,
|
|
456
|
-
};
|
|
457
|
-
if (model) {
|
|
458
|
-
expect(getRowData(model, rowData)).toBeUndefined();
|
|
459
|
-
} else {
|
|
460
|
-
throw "Model not configured for testcase";
|
|
461
|
-
}
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
it("Test for CLKOUT pin data", () => {
|
|
465
|
-
const rowData: pin_row = {
|
|
466
|
-
name: "clockout",
|
|
467
|
-
module: "OSC",
|
|
468
|
-
function: "CLKOUT",
|
|
469
|
-
direction: direction.output,
|
|
470
|
-
filter: {
|
|
471
|
-
module: "CLOCK CONTROL",
|
|
472
|
-
aliasReEx: "CLKOUT",
|
|
473
|
-
},
|
|
474
|
-
behaviour: behaviour.EXCLUSIVE_LOCK,
|
|
475
|
-
};
|
|
476
|
-
if (model) {
|
|
477
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
478
|
-
expect(getRowData(model, rowData)?.actions).toEqual([]);
|
|
479
|
-
} else {
|
|
480
|
-
throw "Model not configured for testcase";
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
describe("Test for FEXTOSC -- Oscillator not enabled", () => {
|
|
486
|
-
const mockModule = mockAssignedModule(mockState());
|
|
487
|
-
const model = getModel(mockModule, getDerivedData);
|
|
488
|
-
if (model) {
|
|
489
|
-
model.getImportValue = (int_name: string): any => {
|
|
490
|
-
const intfdata = {
|
|
491
|
-
config_request: {
|
|
492
|
-
FEXTOSC: {
|
|
493
|
-
setting: "FEXTOSC",
|
|
494
|
-
name: "fextoscConfig1",
|
|
495
|
-
description: "External Oscillator Selection",
|
|
496
|
-
type: "ComboBox",
|
|
497
|
-
group: "CONFIG1",
|
|
498
|
-
tabs: ["main"],
|
|
499
|
-
displayOptionSetting: "description",
|
|
500
|
-
category: "hardware",
|
|
501
|
-
sdlHelp: {
|
|
502
|
-
tooltip: "Click for more Information",
|
|
503
|
-
url:
|
|
504
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
505
|
-
},
|
|
506
|
-
defaultValue: {
|
|
507
|
-
value: "Oscillator not enabled",
|
|
508
|
-
options: [
|
|
509
|
-
"LP (crystal oscillator) optimized for 32.768 kHz",
|
|
510
|
-
"XT (crystal oscillator) above 100 kHz, below 8 MHz",
|
|
511
|
-
"HS (crystal oscillator) above 8 MHz",
|
|
512
|
-
"Reserved (DO NOT USE)",
|
|
513
|
-
"Oscillator not enabled",
|
|
514
|
-
"EC (external clock) below 100 kHz",
|
|
515
|
-
"EC (external clock) for 500 kHz to 8 MHz",
|
|
516
|
-
"EC (external clock) above 8 MHz",
|
|
517
|
-
],
|
|
518
|
-
},
|
|
519
|
-
},
|
|
520
|
-
},
|
|
521
|
-
};
|
|
522
|
-
return intfdata[int_name];
|
|
523
|
-
};
|
|
524
|
-
model.getComponent = (comp_name: string): any => {
|
|
525
|
-
const compdata = {
|
|
526
|
-
mclrUnusedKey: {
|
|
527
|
-
component: {
|
|
528
|
-
name: "mclrUnusedKey",
|
|
529
|
-
description: "Name",
|
|
530
|
-
type: "string",
|
|
531
|
-
defaultValue: "key",
|
|
532
|
-
group: "software",
|
|
533
|
-
tabs: ["main"],
|
|
534
|
-
category: "software",
|
|
535
|
-
},
|
|
536
|
-
},
|
|
537
|
-
};
|
|
538
|
-
return compdata[comp_name];
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
it("Test for CLKIN pin data", () => {
|
|
543
|
-
const rowData: pin_row = {
|
|
544
|
-
name: "clockin",
|
|
545
|
-
module: "OSC",
|
|
546
|
-
function: "CLKIN",
|
|
547
|
-
direction: direction.input,
|
|
548
|
-
filter: {
|
|
549
|
-
module: "CLOCK CONTROL",
|
|
550
|
-
aliasReEx: "CLKIN",
|
|
551
|
-
},
|
|
552
|
-
behaviour: behaviour.EXCLUSIVE_LOCK,
|
|
553
|
-
};
|
|
554
|
-
if (model) {
|
|
555
|
-
expect(getRowData(model, rowData)).toBeUndefined();
|
|
556
|
-
} else {
|
|
557
|
-
throw "Model not configured for testcase";
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
});
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
describe("getRowData() test case 3 : For RESET pin - LVP Disabled", () => {
|
|
564
|
-
const mockModule = mockAssignedModule(mockState());
|
|
565
|
-
const model = getModel(mockModule, getDerivedData);
|
|
566
|
-
if (model) {
|
|
567
|
-
(model.getImportValue = (int_name: string): any => {
|
|
568
|
-
const intfdata = {
|
|
569
|
-
config_request: {
|
|
570
|
-
MCLRE: {
|
|
571
|
-
setting: "MCLRE",
|
|
572
|
-
name: "mclreConfig3",
|
|
573
|
-
description: "MCLR Enable bit",
|
|
574
|
-
type: "ComboBox",
|
|
575
|
-
group: "CONFIG3",
|
|
576
|
-
tabs: ["main"],
|
|
577
|
-
displayOptionSetting: "description",
|
|
578
|
-
category: "software",
|
|
579
|
-
sdlHelp: {
|
|
580
|
-
tooltip: "Click for more Information",
|
|
581
|
-
url:
|
|
582
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
583
|
-
},
|
|
584
|
-
defaultValue: {
|
|
585
|
-
value:
|
|
586
|
-
"If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR ",
|
|
587
|
-
options: [
|
|
588
|
-
"If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR ",
|
|
589
|
-
"If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR",
|
|
590
|
-
],
|
|
591
|
-
},
|
|
592
|
-
},
|
|
593
|
-
LVP: {
|
|
594
|
-
setting: "LVP",
|
|
595
|
-
name: "lvpConfig4",
|
|
596
|
-
description: "Low Voltage Programming Enable bit",
|
|
597
|
-
type: "ComboBox",
|
|
598
|
-
group: "CONFIG4",
|
|
599
|
-
tabs: ["main"],
|
|
600
|
-
displayOptionSetting: "description",
|
|
601
|
-
category: "software",
|
|
602
|
-
sdlHelp: {
|
|
603
|
-
tooltip: "Click for more Information",
|
|
604
|
-
url:
|
|
605
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
606
|
-
},
|
|
607
|
-
defaultValue: {
|
|
608
|
-
value: "HV on MCLR/VPP must be used for programming",
|
|
609
|
-
options: [
|
|
610
|
-
"Low voltage programming enabled. MCLR/VPP pin function is MCLR. MCLRE configuration bit is ignored",
|
|
611
|
-
"HV on MCLR/VPP must be used for programming",
|
|
612
|
-
],
|
|
613
|
-
},
|
|
614
|
-
},
|
|
615
|
-
},
|
|
616
|
-
};
|
|
617
|
-
return intfdata[int_name];
|
|
618
|
-
}),
|
|
619
|
-
(model.getAssignedImport = (int_name: string): any => {
|
|
620
|
-
const intfdata = {
|
|
621
|
-
config_request: {
|
|
622
|
-
handle: {
|
|
623
|
-
providerId: "module1",
|
|
624
|
-
},
|
|
625
|
-
},
|
|
626
|
-
};
|
|
627
|
-
return intfdata[int_name];
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
const rowData: pin_row = {
|
|
631
|
-
name: "reset",
|
|
632
|
-
module: "RESET",
|
|
633
|
-
function: "MCLR",
|
|
634
|
-
direction: direction.input,
|
|
635
|
-
filter: {
|
|
636
|
-
module: "RESET",
|
|
637
|
-
aliasReEx: "MCLR",
|
|
638
|
-
},
|
|
639
|
-
behaviour: behaviour.EXCLUSIVE_LOCK,
|
|
640
|
-
};
|
|
641
|
-
it("Test for RESET pin data", () => {
|
|
642
|
-
const expectedActions = [
|
|
643
|
-
{
|
|
644
|
-
validFor: "MCLR",
|
|
645
|
-
state: {
|
|
646
|
-
L: {
|
|
647
|
-
type: "[FORM] SUBMIT",
|
|
648
|
-
payload: {
|
|
649
|
-
tabId: "main",
|
|
650
|
-
path: "CONFIG3.mclreConfig3",
|
|
651
|
-
value:
|
|
652
|
-
"If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR ",
|
|
653
|
-
},
|
|
654
|
-
meta: {
|
|
655
|
-
to: "module1",
|
|
656
|
-
},
|
|
657
|
-
},
|
|
658
|
-
},
|
|
659
|
-
actiontype: "SETACTION",
|
|
660
|
-
},
|
|
661
|
-
{
|
|
662
|
-
validFor: ".*",
|
|
663
|
-
state: {
|
|
664
|
-
UL: {
|
|
665
|
-
type: "[FORM] SUBMIT",
|
|
666
|
-
payload: {
|
|
667
|
-
tabId: "main",
|
|
668
|
-
path: "CONFIG3.mclreConfig3",
|
|
669
|
-
value:
|
|
670
|
-
"If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR",
|
|
671
|
-
},
|
|
672
|
-
meta: {
|
|
673
|
-
to: "module1",
|
|
674
|
-
},
|
|
675
|
-
},
|
|
676
|
-
},
|
|
677
|
-
actiontype: "SETACTION",
|
|
678
|
-
},
|
|
679
|
-
];
|
|
680
|
-
if (model) {
|
|
681
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
682
|
-
expect(getRowData(model, rowData)?.actions).toEqual(expectedActions);
|
|
683
|
-
} else {
|
|
684
|
-
throw "Model not configured for testcase";
|
|
685
|
-
}
|
|
686
|
-
});
|
|
687
|
-
|
|
688
|
-
it("Test for undefined interface (config_request)", () => {
|
|
689
|
-
if (model) {
|
|
690
|
-
model.getImportValue = (int_name: string): any => {
|
|
691
|
-
return undefined;
|
|
692
|
-
};
|
|
693
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData); // check if the same data is returned
|
|
694
|
-
expect(getRowData(model, rowData)?.actions).toEqual([]);
|
|
695
|
-
} else {
|
|
696
|
-
throw "Model not configured for testcase";
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
it("Test for undefined getAssignedImport()", () => {
|
|
701
|
-
if (model) {
|
|
702
|
-
model.getAssignedImport = (int_name: string): any => {
|
|
703
|
-
return undefined;
|
|
704
|
-
};
|
|
705
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData); // check if the same data is returned
|
|
706
|
-
expect(getRowData(model, rowData)?.actions).toEqual([]);
|
|
707
|
-
} else {
|
|
708
|
-
throw "Model not configured for testcase";
|
|
709
|
-
}
|
|
710
|
-
});
|
|
711
|
-
});
|
|
712
|
-
|
|
713
|
-
describe("getRowData() test case 4 : For RESET pin - LVP Enabled", () => {
|
|
714
|
-
const mockModule = mockAssignedModule(mockState());
|
|
715
|
-
const model = getModel(mockModule, getDerivedData);
|
|
716
|
-
if (model) {
|
|
717
|
-
(model.getImportValue = (int_name: string): any => {
|
|
718
|
-
const intfdata = {
|
|
719
|
-
config_request: {
|
|
720
|
-
MCLRE: {
|
|
721
|
-
setting: "MCLRE",
|
|
722
|
-
name: "mclreConfig3",
|
|
723
|
-
description: "Master Clear Enable bit",
|
|
724
|
-
type: "ComboBox",
|
|
725
|
-
group: "CONFIG3",
|
|
726
|
-
tabs: ["main"],
|
|
727
|
-
displayOptionSetting: "description",
|
|
728
|
-
category: "software",
|
|
729
|
-
sdlHelp: {
|
|
730
|
-
tooltip: "Click for more Information",
|
|
731
|
-
url:
|
|
732
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
733
|
-
},
|
|
734
|
-
defaultValue: {
|
|
735
|
-
value:
|
|
736
|
-
"If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR ",
|
|
737
|
-
options: [
|
|
738
|
-
"If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR ",
|
|
739
|
-
"If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR",
|
|
740
|
-
],
|
|
741
|
-
},
|
|
742
|
-
},
|
|
743
|
-
LVP: {
|
|
744
|
-
setting: "LVP",
|
|
745
|
-
name: "lvpConfig4",
|
|
746
|
-
description: "Low Voltage Programming Enable bit",
|
|
747
|
-
type: "ComboBox",
|
|
748
|
-
group: "CONFIG4",
|
|
749
|
-
tabs: ["main"],
|
|
750
|
-
displayOptionSetting: "description",
|
|
751
|
-
category: "software",
|
|
752
|
-
sdlHelp: {
|
|
753
|
-
tooltip: "Click for more Information",
|
|
754
|
-
url:
|
|
755
|
-
"v2/keyword-lookup?keyword=atmel;device:${deviceName};register:${registerName}&redirect=true",
|
|
756
|
-
},
|
|
757
|
-
defaultValue: {
|
|
758
|
-
value:
|
|
759
|
-
"Low voltage programming enabled. MCLR/VPP pin function is MCLR. MCLRE configuration bit is ignored",
|
|
760
|
-
options: [
|
|
761
|
-
"Low voltage programming enabled. MCLR/VPP pin function is MCLR. MCLRE configuration bit is ignored",
|
|
762
|
-
"HV on MCLR/VPP must be used for programming",
|
|
763
|
-
],
|
|
764
|
-
},
|
|
765
|
-
},
|
|
766
|
-
},
|
|
767
|
-
};
|
|
768
|
-
return intfdata[int_name];
|
|
769
|
-
}),
|
|
770
|
-
(model.getComponent = (comp_name: string): any => {
|
|
771
|
-
const compdata = {
|
|
772
|
-
mclrUnusedKey: {
|
|
773
|
-
component: {
|
|
774
|
-
name: "mclrUnusedKey",
|
|
775
|
-
description: "Name",
|
|
776
|
-
type: "string",
|
|
777
|
-
defaultValue: "key",
|
|
778
|
-
group: "software",
|
|
779
|
-
tabs: ["main"],
|
|
780
|
-
category: "software",
|
|
781
|
-
},
|
|
782
|
-
},
|
|
783
|
-
};
|
|
784
|
-
return compdata[comp_name];
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
|
-
const rowData: pin_row = {
|
|
788
|
-
name: "reset",
|
|
789
|
-
module: "RESET",
|
|
790
|
-
function: "MCLR",
|
|
791
|
-
direction: direction.input,
|
|
792
|
-
filter: {
|
|
793
|
-
module: "RESET",
|
|
794
|
-
aliasReEx: "MCLR",
|
|
795
|
-
},
|
|
796
|
-
behaviour: behaviour.EXCLUSIVE_LOCK,
|
|
797
|
-
};
|
|
798
|
-
it("Test for RESET pin data", () => {
|
|
799
|
-
const expectedActions = [
|
|
800
|
-
{
|
|
801
|
-
validFor: ".*",
|
|
802
|
-
state: {
|
|
803
|
-
L: {
|
|
804
|
-
type: "[FORM] SUBMIT",
|
|
805
|
-
payload: {
|
|
806
|
-
tabId: "main",
|
|
807
|
-
path: "software.mclrUnusedKey",
|
|
808
|
-
value: "",
|
|
809
|
-
},
|
|
810
|
-
},
|
|
811
|
-
},
|
|
812
|
-
actiontype: "SETACTION",
|
|
813
|
-
},
|
|
814
|
-
{
|
|
815
|
-
validFor: ".*",
|
|
816
|
-
state: {
|
|
817
|
-
UL: {
|
|
818
|
-
type: "[FORM] SUBMIT",
|
|
819
|
-
payload: {
|
|
820
|
-
tabId: "main",
|
|
821
|
-
path: "software.mclrUnusedKey",
|
|
822
|
-
value: "",
|
|
823
|
-
},
|
|
824
|
-
},
|
|
825
|
-
},
|
|
826
|
-
actiontype: "SETACTION",
|
|
827
|
-
},
|
|
828
|
-
];
|
|
829
|
-
if (model) {
|
|
830
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
831
|
-
expect(getRowData(model, rowData)?.actions).toEqual(expectedActions);
|
|
832
|
-
} else {
|
|
833
|
-
throw "Model not configured for testcase";
|
|
834
|
-
}
|
|
835
|
-
});
|
|
836
|
-
|
|
837
|
-
it("Test for RESET pin data - getComponent() as undefined", () => {
|
|
838
|
-
if (model) {
|
|
839
|
-
model.getComponent = (comp_name: string): any => {
|
|
840
|
-
return undefined;
|
|
841
|
-
};
|
|
842
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
843
|
-
expect(getRowData(model, rowData)?.actions).toEqual([]);
|
|
844
|
-
} else {
|
|
845
|
-
throw "Model not configured for testcase";
|
|
846
|
-
}
|
|
847
|
-
});
|
|
848
|
-
});
|
|
849
|
-
|
|
850
|
-
describe("getRowData() test case 5 : For SOSCI pin", () => {
|
|
851
|
-
const mockModule = mockAssignedModule(mockState());
|
|
852
|
-
const model = getModel(mockModule, getDerivedData);
|
|
853
|
-
if (model) {
|
|
854
|
-
model.getComponentValue = (comp_name: string): any => {
|
|
855
|
-
const compValue = {
|
|
856
|
-
noscOsccon1: "SOSC",
|
|
857
|
-
};
|
|
858
|
-
return compValue[comp_name];
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
const rowData: pin_row = {
|
|
862
|
-
name: "sosci",
|
|
863
|
-
module: "OSC",
|
|
864
|
-
function: "SOSCI",
|
|
865
|
-
direction: direction.input,
|
|
866
|
-
filter: {
|
|
867
|
-
module: "CLOCK CONTROL",
|
|
868
|
-
aliasReEx: "SOSCI",
|
|
869
|
-
},
|
|
870
|
-
behaviour: behaviour.ALWAYS_LOCKED,
|
|
871
|
-
};
|
|
872
|
-
|
|
873
|
-
it("Test for SOSCI pin data", () => {
|
|
874
|
-
const expectedActions = [];
|
|
875
|
-
if (model) {
|
|
876
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
877
|
-
expect(getRowData(model, rowData)?.actions).toEqual(expectedActions);
|
|
878
|
-
} else {
|
|
879
|
-
throw "Model not configured for testcase";
|
|
880
|
-
}
|
|
881
|
-
});
|
|
882
|
-
});
|
|
883
|
-
|
|
884
|
-
describe("getRowData() test case 6 : For SOSCO pin", () => {
|
|
885
|
-
const mockModule = mockAssignedModule(mockState());
|
|
886
|
-
const model = getModel(mockModule, getDerivedData);
|
|
887
|
-
if (model) {
|
|
888
|
-
model.getComponentValue = (comp_name: string): any => {
|
|
889
|
-
const compValue = {
|
|
890
|
-
noscOsccon1: "SOSC",
|
|
891
|
-
};
|
|
892
|
-
return compValue[comp_name];
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
const rowData: pin_row = {
|
|
896
|
-
name: "sosco",
|
|
897
|
-
module: "OSC",
|
|
898
|
-
function: "SOSCO",
|
|
899
|
-
direction: direction.input,
|
|
900
|
-
filter: {
|
|
901
|
-
module: "CLOCK CONTROL",
|
|
902
|
-
aliasReEx: "SOSCO",
|
|
903
|
-
},
|
|
904
|
-
behaviour: behaviour.LOCK_UNLOCK,
|
|
905
|
-
};
|
|
906
|
-
|
|
907
|
-
it("Test for SOSCO pin data", () => {
|
|
908
|
-
const expectedActions = [];
|
|
909
|
-
if (model) {
|
|
910
|
-
expect(getRowData(model, rowData)).toMatchObject(rowData);
|
|
911
|
-
expect(getRowData(model, rowData)?.actions).toEqual(expectedActions);
|
|
912
|
-
} else {
|
|
913
|
-
throw "Model not configured for testcase";
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
});
|
|
917
|
-
});
|