-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathchanges.log
More file actions
1268 lines (1242 loc) · 54.4 KB
/
Copy pathchanges.log
File metadata and controls
1268 lines (1242 loc) · 54.4 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/adsApp/src/adsAsynPortDriver.cpp b/adsApp/src/adsAsynPortDriver.cpp
index fe08d40..f9d41dd 100644
--- a/adsApp/src/adsAsynPortDriver.cpp
+++ b/adsApp/src/adsAsynPortDriver.cpp
@@ -11,6 +11,7 @@
* Created January 25, 2018
* Edited December 6, 2019
*/
+
#define USE_TYPED_RSET // Shut up about rset already!
#include "adsAsynPortDriver.h"
@@ -35,17 +36,13 @@
#include <dbAccess.h>
#include <alarm.h>
-#include <fstream> // for std::ifstream
-#include <algorithm> // for std::transform
-#include <unordered_map> // for drvInfo record-info cache
-
static const char *driverName="adsAsynPortDriver";
static adsAsynPortDriver *adsAsynPortObj;
static long oldTimeStamp=0;
static struct timeval oldTime={0};
static int allowCallbackEpicsState=0;
static initHookState currentEpicsState=initHookAtIocBuild;
-static struct timeval s_iocStartTime; /* captured at initHookAtIocBuild */
+static struct timeval s_iocStartTime; /* BENCH: captured at initHookAtIocBuild */
/** Callback hook for EPICS state.
@@ -68,9 +65,9 @@ static void getEpicsState(initHookState state)
switch(state) {
break;
- case initHookAtIocBuild:
- gettimeofday(&s_iocStartTime, NULL);
- break;
+ case initHookAtIocBuild: /* BENCH */
+ gettimeofday(&s_iocStartTime, NULL); /* BENCH */
+ break; /* BENCH */
case initHookAfterInitDevSup:
gettimeofday(&start, NULL);
break;
@@ -79,6 +76,11 @@ static void getEpicsState(initHookState state)
timersub(&now, &start, &diff);
printf("Database initialization took %ld.%06ld seconds.\n", diff.tv_sec, diff.tv_usec);
break;
+ case initHookAfterIocRunning: /* BENCH */
+ gettimeofday(&now, NULL); /* BENCH */
+ timersub(&now, &s_iocStartTime, &diff); /* BENCH */
+ printf("IOC fully running — total startup time %ld.%06ld seconds.\n", diff.tv_sec, diff.tv_usec); /* BENCH */
+ break; /* BENCH */
case initHookAfterScanInit:
allowCallbackEpicsState=1;
@@ -91,12 +93,6 @@ static void getEpicsState(initHookState state)
adsAsynPortObj->bulkOK = 1;
printf("Begin polling PLC!\n");
break;
- case initHookAfterIocRunning:
- gettimeofday(&now, NULL);
- timersub(&now, &s_iocStartTime, &diff);
- printf("IOC fully running — total startup time %ld.%06ld seconds.\n",
- diff.tv_sec, diff.tv_usec);
- break;
default:
break;
}
@@ -232,368 +228,6 @@ void dataCallbackThread(void *drvPvt)
pPvt->dataCallbackThread();
}
-/**
- * adsAsynPortDriver constructor — with JSON symbol dictionary loading
- *
- * Performance goals:
- * - Load symbol dict at construction time (before IOC records load)
- * - drvUserCreate() does dictionary lookup only — zero ADS RTTs
- * - SUMUP handle resolution in connect() — one RTT for all symbols
- * - SYM_UPLOAD blob walk retained as fallback for symbols not in dict
- *
- * Static JSON path — to be replaced by constructor argument in Phase 2.
- * Place ads_symbol_dict.json in the IOC boot directory or adjust path below.
- */
-
-#define ADS_SYMBOL_DICT_PATH "ads_symbol_dict.json"
-
-/* ─────────────────────────────────────────────────────────────────────────
- * Minimal JSON parser — no external dependencies
- * Parses the flat structure produced by db_to_ads_symbol_dict.py:
- * {
- * "PV:NAME": {
- * "symbol": "GVL.varName",
- * "datatype": "LREAL",
- * "size": 8,
- * "name": "PV:NAME"
- * }, ...
- * }
- * ───────────────────────────────────────────────────────────────────────── */
-
-/**
- * Parse a quoted JSON string value following a colon.
- * e.g. "symbol": "GVL.varName" → returns "GVL.varName"
- */
-static std::string jsonStringVal(const std::string &line)
-{
- size_t first = line.find('"', line.find(':'));
- if (first == std::string::npos) return "";
- size_t second = line.find('"', first + 1);
- if (second == std::string::npos) return "";
- return line.substr(first + 1, second - first - 1);
-}
-
-/**
- * Parse a numeric JSON value following a colon.
- * e.g. "size": 8 → returns 8
- */
-static uint32_t jsonUintVal(const std::string &line)
-{
- size_t colon = line.find(':');
- if (colon == std::string::npos) return 0;
- return (uint32_t)std::stoul(line.substr(colon + 1));
-}
-
-/**
- * Map PLC datatype string from JSON to ADS ADST_* type code.
- */
-static uint32_t datatypeToAdst(const std::string &dt)
-{
- if (dt == "BOOL") return ADST_BIT;
- if (dt == "BYTE" ||
- dt == "USINT") return ADST_UINT8;
- if (dt == "SINT") return ADST_INT8;
- if (dt == "WORD" ||
- dt == "UINT") return ADST_UINT16;
- if (dt == "INT") return ADST_INT16;
- if (dt == "DWORD" ||
- dt == "UDINT") return ADST_UINT32;
- if (dt == "DINT") return ADST_INT32;
- if (dt == "LWORD" ||
- dt == "ULINT") return ADST_UINT64;
- if (dt == "LINT") return ADST_INT64;
- if (dt == "REAL") return ADST_REAL32;
- if (dt == "LREAL") return ADST_REAL64;
- if (dt.substr(0,6) == "STRING" ||
- dt.substr(0,4) == "CHAR") return ADST_STRING; /* CHAR[N] waveform strings */
- /* arrays and structs — treat as void/raw */
- return ADST_VOID;
-}
-
-/**
- * loadSymbolDict()
- *
- * Reads ads_symbol_dict.json and populates symbolDict_.
- * Called from constructor before IOC records load.
- * Non-fatal: on failure the driver falls back to SYM_UPLOAD + INFOBYNAMEEX.
- *
- * Performance: pure file I/O + string parsing, zero ADS RTTs.
- */
-
-asynStatus adsAsynPortDriver::loadSymbolDict(const char *jsonPath)
-{
- static const char *functionName = "loadSymbolDict";
-
- std::ifstream f(jsonPath);
- if (!f.is_open()) {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s::%s: cannot open '%s'\n",
- driverName, functionName, jsonPath);
- return asynError;
- }
-
- asynPrint(pasynUserSelf, ASYN_TRACE_FLOW,
- "%s::%s: opened '%s' — parsing\n",
- driverName, functionName, jsonPath);
-
- symbolDict_.clear();
- AdsSymbolDictEntry entry = {};
- bool inEntry = false;
- size_t loaded = 0;
- size_t skipped = 0;
-
- std::string line;
- while (std::getline(f, line)) {
-
- /* trim leading whitespace */
- size_t start = line.find_first_not_of(" \t\r\n");
- if (start == std::string::npos) continue;
- line = line.substr(start);
-
- /* ── detect start of a top-level PV entry ───────────────────── */
- /* matches: "some:pv:name": { (with or without space) */
- if (!inEntry && line.front() == '"') {
- /* find the closing quote of the key */
- size_t closeQuote = line.find('"', 1);
- if (closeQuote != std::string::npos) {
- /* remainder after the closing quote should be `: {` */
- std::string rest = line.substr(closeQuote + 1);
- /* trim spaces in rest */
- size_t r = rest.find_first_not_of(" \t");
- if (r != std::string::npos) rest = rest.substr(r);
- if (rest.size() >= 2 && rest[0] == ':') {
- rest = rest.substr(1);
- r = rest.find_first_not_of(" \t");
- if (r != std::string::npos) rest = rest.substr(r);
- if (!rest.empty() && rest[0] == '{') {
- entry = {};
- inEntry = true;
- continue;
- }
- }
- }
- }
-
- if (!inEntry) continue;
-
- /* ── parse fields inside entry ───────────────────────────────── */
- if (line.find("\"symbol\"") != std::string::npos) {
- entry.symbol = jsonStringVal(line);
- entry.symbolLower = entry.symbol;
- std::transform(entry.symbolLower.begin(),
- entry.symbolLower.end(),
- entry.symbolLower.begin(),
- [](unsigned char c){ return std::tolower(c); });
- continue;
- }
- if (line.find("\"datatype\"") != std::string::npos) {
- entry.datatype = jsonStringVal(line);
- entry.adst = datatypeToAdst(entry.datatype);
- continue;
- }
- if (line.find("\"size\"") != std::string::npos) {
- entry.size = jsonUintVal(line);
- continue;
- }
- if (line.find("\"name\"") != std::string::npos) {
- entry.pvName = jsonStringVal(line);
- continue;
- }
-
- /* ── detect end of entry — bare } or }, ─────────────────────── */
- if (line == "}" || line == "},") {
- if (!entry.symbolLower.empty() && entry.size > 0) {
- symbolDict_[entry.symbolLower] = entry;
- ++loaded;
- } else {
- asynPrint(pasynUserSelf, ASYN_TRACE_WARNING,
- "%s::%s: skipping incomplete entry "
- "symbol='%s' size=%u\n",
- driverName, functionName,
- entry.symbol.c_str(), entry.size);
- ++skipped;
- }
- inEntry = false;
- entry = {};
- }
- }
-
- asynPrint(pasynUserSelf, ASYN_TRACE_FLOW,
- "%s::%s: loaded %zu symbols from '%s' (%zu skipped)\n",
- driverName, functionName, loaded, jsonPath, skipped);
-
- if (loaded == 0) {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s::%s: no symbols loaded from '%s' — "
- "check JSON format\n",
- driverName, functionName, jsonPath);
- return asynError;
- }
-
- return asynSuccess;
-}
-
-/* ─────────────────────────────────────────────────────────────────────────
- * SUMUP handle resolution
- *
- * Issues a single ADS SUMUP write+read to resolve handles for every symbol
- * in symbolDict_ in one RTT.
- *
- * ADS SUMUP protocol:
- * Group : ADSIGRP_SUMUP_READWRITE (0xF081)
- * Offset : number of sub-requests (N)
- * Write : N × (iGroup=0xF003, iOffs=nameLen, readLen=4)
- * followed by N × name strings (no null terminator needed)
- * Read : N × (result_code uint32 + handle uint32) = N×8 bytes
- * ───────────────────────────────────────────────────────────────────────── */
-asynStatus adsAsynPortDriver::resolveSymbolHandles()
-{
- static const char *functionName = "resolveSymbolHandles";
- if (symbolDict_.empty()) return asynSuccess;
-
- /* collect entries in stable order */
- std::vector<AdsSymbolDictEntry*> entries;
- entries.reserve(symbolDict_.size());
- for (auto &kv : symbolDict_)
- entries.push_back(&kv.second);
-
- const size_t N = entries.size();
- const size_t CHUNK_SIZE = 500;
- const size_t nChunks = (N + CHUNK_SIZE - 1) / CHUNK_SIZE;
-
- size_t totalResolved = 0;
-
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s::%s: resolving %zu handles in %zu chunk(s) of max %zu\n",
- driverName, functionName, N, nChunks, CHUNK_SIZE);
-
- for (size_t chunk = 0; chunk < nChunks; ++chunk) {
-
- const size_t chunkStart = chunk * CHUNK_SIZE;
- const size_t chunkEnd = std::min(chunkStart + CHUNK_SIZE, N);
- const size_t chunkN = chunkEnd - chunkStart;
-
- /* ── build write buffer ─────────────────────────────────────── */
- /* Header: chunkN × 16 bytes */
- /* iGroup (4) = ADSIGRP_SYM_HNDBYNAME (0xF003) */
- /* iOffs (4) = 0 */
- /* readLen (4) = 4 (sizeof handle returned) */
- /* writeLen (4) = symbol name length in bytes */
- /* Data: concatenated symbol name bytes (no null terminator) */
- size_t namesTotal = 0;
- for (size_t i = chunkStart; i < chunkEnd; ++i)
- namesTotal += entries[i]->symbol.size();
-
- const size_t headerBytes = chunkN * 16;
- const size_t writeBytes = headerBytes + namesTotal;
-
- /* ── read buffer layout ─────────────────────────────────────── */
- /* Confirmed empirically (60 bytes for N=5): */
- /* [N × (result(4) + retLen(4))] then [N × handle(4)] */
- /* = N*8 + N*4 = N*12 */
- const size_t readBytes = chunkN * 12;
-
- std::vector<uint8_t> writeBuf(writeBytes, 0);
- std::vector<uint8_t> readBuf (readBytes, 0);
-
- uint8_t *hdr = writeBuf.data();
- uint8_t *name = writeBuf.data() + headerBytes;
-
- for (size_t i = chunkStart; i < chunkEnd; ++i) {
- uint32_t iGroup = ADSIGRP_SYM_HNDBYNAME;
- uint32_t iOffs = 0;
- uint32_t readLen = 4;
- uint32_t writeLen = (uint32_t)entries[i]->symbol.size();
- memcpy(hdr, &iGroup, 4); hdr += 4;
- memcpy(hdr, &iOffs, 4); hdr += 4;
- memcpy(hdr, &readLen, 4); hdr += 4;
- memcpy(hdr, &writeLen, 4); hdr += 4;
- memcpy(name, entries[i]->symbol.data(), entries[i]->symbol.size());
- name += entries[i]->symbol.size();
- }
-
- /* ── ADS SUMUP READWRITE call ───────────────────────────────── */
- AmsAddr remote;
- remote.netId = remoteNetId_;
- remote.port = amsportDefault_;
- uint32_t bytesRead = 0;
-
- adsLock();
- long rc = AdsSyncReadWriteReqEx2(
- adsPort_,
- &remote,
- ADSIGRP_SUMUP_READWRITE, /* 0xF082 */
- (uint32_t)chunkN, /* iOffset = number of sub-requests */
- (uint32_t)readBytes,
- readBuf.data(),
- (uint32_t)writeBytes,
- writeBuf.data(),
- &bytesRead);
- adsUnlock();
-
- asynPrint(pasynUserSelf, ASYN_TRACE_FLOW,
- "%s::%s: chunk %zu/%zu rc=0x%lx "
- "bytesRead=%u expected=%zu\n",
- driverName, functionName,
- chunk + 1, nChunks, rc, bytesRead, readBytes);
-
- if (rc != 0) {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s::%s: chunk %zu/%zu SUMUP failed rc=0x%lx — "
- "aborting handle resolution\n",
- driverName, functionName,
- chunk + 1, nChunks, rc);
- return asynError;
- }
-
- /* ── extract handles ────────────────────────────────────────── */
- /* Layout: [N × (result(4) + retLen(4))] then [N × handle(4)] */
- /* result/retLen pairs are consecutive, handles follow after */
- const uint8_t *statusBlock = readBuf.data();
- const uint32_t *handleBlock = reinterpret_cast<const uint32_t*>(
- readBuf.data() + chunkN * 8);
-
- for (size_t i = 0; i < chunkN; ++i) {
- uint32_t result, retLen;
- memcpy(&result, statusBlock + i * 8 + 0, 4);
- memcpy(&retLen, statusBlock + i * 8 + 4, 4);
- uint32_t handle = handleBlock[i];
-
- asynPrint(pasynUserSelf, ASYN_TRACE_FLOW,
- "%s::%s: sub-req[%zu] '%s' "
- "result=0x%x retLen=%u handle=0x%x\n",
- driverName, functionName,
- chunkStart + i,
- entries[chunkStart + i]->symbol.c_str(),
- result, retLen, handle);
-
- if (result == 0 && handle != 0) {
- entries[chunkStart + i]->handle = handle;
- entries[chunkStart + i]->resolved = true;
- ++totalResolved;
- } else {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s::%s: handle resolution failed for '%s' "
- "result=0x%x retLen=%u handle=0x%x — aborting\n",
- driverName, functionName,
- entries[chunkStart + i]->symbol.c_str(),
- result, retLen, handle);
- return asynError;
- }
- }
-
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s::%s: chunk %zu/%zu done — %zu/%zu resolved\n",
- driverName, functionName,
- chunk + 1, nChunks, totalResolved, N);
- }
-
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s::%s: all %zu handles resolved successfully\n",
- driverName, functionName, totalResolved);
-
- return asynSuccess;
-}
/** Constructor for the adsAsynPortDriver class.
* \param[in] portName Asyn port name.
@@ -631,8 +265,8 @@ adsAsynPortDriver::adsAsynPortDriver(const char *portName,
ADSTIMESOURCE defaultTimeSource)
:asynPortDriver(portName,
1, /* maxAddr */
- asynInt32Mask | asynFloat64Mask | asynInt64Mask | asynInt8ArrayMask | asynInt16ArrayMask | asynInt32ArrayMask | asynInt64ArrayMask | asynFloat32ArrayMask | asynFloat64ArrayMask | asynDrvUserMask | asynOctetMask, /* Interface mask */
- asynInt32Mask | asynFloat64Mask | asynInt64Mask | asynInt8ArrayMask | asynInt16ArrayMask | asynInt32ArrayMask | asynInt64ArrayMask | asynFloat32ArrayMask | asynFloat64ArrayMask | asynDrvUserMask | asynOctetMask, /* Interrupt mask */
+ asynInt32Mask | asynFloat64Mask | asynInt64Mask | asynInt8ArrayMask | asynInt16ArrayMask | asynInt32ArrayMask | asynInt64ArrayMask | asynFloat32ArrayMask | asynFloat64ArrayMask | asynDrvUserMask | asynOctetMask, /* Interface mask */
+ asynInt32Mask | asynFloat64Mask | asynInt64Mask | asynInt8ArrayMask | asynInt16ArrayMask | asynInt32ArrayMask | asynInt64ArrayMask | asynFloat32ArrayMask | asynFloat64ArrayMask | asynDrvUserMask | asynOctetMask, /* Interrupt mask */
ASYN_CANBLOCK, /* asynFlags. This driver does not block and it is not multi-device, so flag is 0 */
autoConnect, /* Autoconnect */
priority, /* Default priority */
@@ -661,10 +295,6 @@ adsAsynPortDriver::adsAsynPortDriver(const char *portName,
oneAmsConnectionOKold_=0;
adsUnlock();
- // ── Symbol dictionary path ────────────────────────────────────────────
- symbolDictPath_ = strdup("ads_symbol_dict.json");
- // ────────────
-
//Octet interface
octetAsciiBuffer_.bufferSize = ADS_CMD_BUFFER_SIZE;
octetAsciiBuffer_.bytesUsed=0;
@@ -778,58 +408,29 @@ adsAsynPortDriver::adsAsynPortDriver(const char *portName,
printf("%s:%s: epicsThreadCreate failure\n", driverName, functionName);
return;
}
-
- // ── Load symbol dictionary (pure file I/O, no ADS needed) ────────────
- if (symbolDictPath_) {
- if (loadSymbolDict(symbolDictPath_) != asynSuccess) {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s:%s: failed to load symbol dictionary '%s' — aborting\n",
- driverName, functionName, symbolDictPath_);
- exit(-1);
- }
- asynPrint(pasynUserSelf, ASYN_TRACE_FLOW,
- "%s:%s: symbol dictionary loaded with %zu entries\n",
- driverName, functionName, symbolDict_.size());
- }
- // ─────────────────────────────────────────────────────────────────────
-
-
//try to connect, and hang until we succeed!
for (;;) {
if (connect(pasynUserSelf) != asynSuccess) {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s:%s: connect failed for port %s.\n",
- driverName, functionName, portName);
- epicsThreadSleep(1.0);
- continue;
+ asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
+ "%s:%s: connect failed for port %s.\n",
+ driverName, functionName, portName);
+ epicsThreadSleep(1.0);
+ continue;
}
long error = 0;
uint16_t adsState = 0;
if (adsReadStateLock(amsport,&adsState,true,&error) != asynSuccess) {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s:%s: adsReadStateLock failed for port %s.\n",
- driverName, functionName, portName);
- disconnect(pasynUserSelf);
- continue;
+ asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
+ "%s:%s: adsReadStateLock failed for port %s.\n",
+ driverName, functionName, portName);
+ disconnect(pasynUserSelf);
+ continue;
}
if (adsState == ADSSTATE_RUN) {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s:%s: connection established for port %s.\n",
- driverName, functionName, portName);
-
- // ── Resolve symbol handles — PLC confirmed RUN ────────────
- if (!symbolDict_.empty()) {
- if (resolveSymbolHandles() != asynSuccess) {
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s:%s: SUMUP handle resolution failed — "
- "drvUserCreate will fall back to per-record ADS calls\n",
- driverName, functionName);
- exit(-1);
- }
- }
- // ─────────────────────────────────────────────────────────
-
- return;
+ asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
+ "%s:%s: connection established for port %s.\n",
+ driverName, functionName, portName);
+ return;
}
}
}
@@ -917,10 +518,10 @@ void adsAsynPortDriver::cyclicThread()
invalidateParamsLock(port->amsPort);
port->refreshNeeded=true;
setAlarmPortLock(port->amsPort,COMM_ALARM,INVALID_ALARM);
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
- "%s:%s: connection lost for port %s — exiting for clean restart.\n",
- driverName, functionName, portName);
- exit(-1);
+ asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
+ "%s:%s: connection failed for port %s.\n",
+ driverName, functionName, portName);
+ exit(-1);
}
if(!port->connectedOld && port->connected){
adsReadVersion(port);
@@ -949,7 +550,7 @@ void adsAsynPortDriver::cyclicThread()
if(!oneAmsConnectionOK){
notConnectedCounter_++;
if (notConnectedCounter_ < 100 || notConnectedCounter_ % 100 == 0) {
- asynPrint(pasynUserSelf,ASYN_TRACE_FLOW, "%s:%s: Not connected counter: %d.\n",driverName,functionName,notConnectedCounter_);
+ asynPrint(pasynUserSelf,ASYN_TRACE_FLOW, "%s:%s: Not connected counter: %d.\n",driverName,functionName,notConnectedCounter_);
}
}
if(oneAmsConnectionOK){
@@ -962,7 +563,7 @@ void adsAsynPortDriver::cyclicThread()
}
connectedAds_=0;
if((notConnectedCounter_&2)==2){
- asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "cyclicThread: forcing disconnect.\n");
+ asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "cyclicThread: forcing disconnect.\n");
disconnectLock(pasynUserSelf);
}
}
@@ -1031,14 +632,10 @@ void adsAsynPortDriver::bulkReadThread()
nTimeStamp = now.tv_sec + SEC_TO_UNIX_EPOCH;
nTimeStamp = (nTimeStamp * 1000000 + now.tv_usec) * 10;
}
- /* Always advance srd past the two timestamp data slots.
- * SUMUP_READ writes iSize response bytes for every slot regardless
- * of whether that slot's status is success or failure. Skipping
- * advancement on failure (original code) shifts srd for every
- * subsequent param, producing zeros or garbage across the whole
- * poll cycle whenever the timestamp handles are transiently bad. */
- srd += bulk[i].sum[0].iSize;
- srd += bulk[i].sum[1].iSize;
+ if (!stat[0])
+ srd += sizeof(uint32_t);
+ if (!stat[1])
+ srd += sizeof(uint32_t);
stat += 2;
for (uint32_t j = 2; j < cnt; j++) {
adsParamInfo *paramInfo=getAdsParamInfo(bulk[i].paramID[j]);
@@ -1063,7 +660,7 @@ void adsAsynPortDriver::bulkReadThread()
adsUnlock();
gettimeofday(&now, NULL);
bulk_elapsed_us = (now.tv_sec - start.tv_sec) * 1000000 +
- (now.tv_usec - start.tv_usec);
+ (now.tv_usec - start.tv_usec);
#ifdef MCB_DEBUG
printf("ELAPSED: %g\n", bulk_elapsed_us / 1000000.0);
#endif
@@ -1423,9 +1020,25 @@ asynStatus adsAsynPortDriver::drvUserCreate(asynUser *pasynUser,const char *drvI
}
if(pAdsParamArray_[index]->dataSource==ADS_DATASOURCE_AMS_STATE){ //Local variable (not in PLC) like AMS port state.
+
return asynPortDriver::drvUserCreate(pasynUser,drvInfo,pptypeName,psize);
}
+ if(!connectedAds_){
+ //try to connect without error handling
+ connect(pasynUser);
+ }
+
+ if(connectedAds_){
+ struct timeval _tb0, _tb1; gettimeofday(&_tb0, NULL); /* BENCH */
+ status =adsReadParam(pAdsParamArray_[index]);
+ gettimeofday(&_tb1, NULL); /* BENCH */
+ long _tb_us = (_tb1.tv_sec-_tb0.tv_sec)*1000000L+(_tb1.tv_usec-_tb0.tv_usec); /* BENCH */
+ asynPrint(pasynUser, ASYN_TRACE_ERROR, "%s:%s: [BENCH-DUP %4ld us] drvInfo='%s'\n", driverName, functionName, _tb_us, drvInfo); /* BENCH */
+ if(status!=asynSuccess){
+ return asynError;
+ }
+ }
return asynPortDriver::drvUserCreate(pasynUser,drvInfo,pptypeName,psize);
}
@@ -1434,8 +1047,7 @@ asynStatus adsAsynPortDriver::drvUserCreate(asynUser *pasynUser,const char *drvI
if (vcnt % 1000 == 0)
printf("%d...\n", vcnt);
- struct timeval t0, t1;
- gettimeofday(&t0, NULL);
+ struct timeval t0, t1; gettimeofday(&t0, NULL); /* BENCH */
//Ensure space left in param table
if(adsParamArrayCount_>=(paramTableSize_-1)){
@@ -1510,56 +1122,9 @@ asynStatus adsAsynPortDriver::drvUserCreate(asynUser *pasynUser,const char *drvI
return asynError;
}
}
-
- /**
- * Per-record benchmark + dict vs resolved diagnostic.
- *
- * Prints one line per new param showing:
- * [N us] wall-clock cost of this entire drvUserCreate call
- * [DICT] what the symbol dict had, or MISS if not found
- * [RESOLVED] what updateParamInfoWithPLCInfo() placed in paramInfo
- *
- * Used to benchmark new implementation against original.
- * Remove once benchmarking is complete.
- */
- gettimeofday(&t1, NULL);
- long elapsed_us = (t1.tv_sec - t0.tv_sec) * 1000000L + (t1.tv_usec - t0.tv_usec);
-
- if(connectedAds_ && paramInfo->dataSource == ADS_DATASOURCE_PLC
- && !paramInfo->isAdrCommand) {
- std::string dictKey(paramInfo->plcAdrStr);
- std::transform(dictKey.begin(), dictKey.end(), dictKey.begin(),
- [](unsigned char c){ return std::tolower(c); });
- auto dictIt = symbolDict_.find(dictKey);
- if(dictIt != symbolDict_.end()) {
- const AdsSymbolDictEntry &e = dictIt->second;
- asynPrint(pasynUser, ASYN_TRACE_WARNING,
- "%s:%s: [%4ld us] drvInfo='%s' plcAdrStr='%s'\n"
- " [DICT] symbol='%s' handle=0x%08x size=%-5u adst=%-2u resolved=%d\n"
- " [RESOLVED] handle=0x%08x size=%-5u adst=%-2u plcDataIsArray=%d\n",
- driverName, functionName, elapsed_us,
- drvInfo, paramInfo->plcAdrStr,
- e.symbol.c_str(), e.handle, e.size, e.adst, (int)e.resolved,
- paramInfo->hSymbolicHandle, paramInfo->plcSize,
- paramInfo->plcDataType, (int)paramInfo->plcDataIsArray);
- } else {
- asynPrint(pasynUser, ASYN_TRACE_WARNING,
- "%s:%s: [%4ld us] drvInfo='%s' plcAdrStr='%s'\n"
- " [DICT] MISS (not in dict — used ADS fallback)\n"
- " [RESOLVED] handle=0x%08x size=%-5u adst=%-2u plcDataIsArray=%d\n",
- driverName, functionName, elapsed_us,
- drvInfo, paramInfo->plcAdrStr,
- paramInfo->hSymbolicHandle, paramInfo->plcSize,
- paramInfo->plcDataType, (int)paramInfo->plcDataIsArray);
- }
- } else {
- asynPrint(pasynUser, ASYN_TRACE_FLOW,
- "%s:%s: [%4ld us] drvInfo='%s' (non-PLC or ADR param)\n",
- driverName, functionName, elapsed_us, drvInfo);
- }
- asynPrint(pasynUser, ASYN_TRACE_INFO,
- "%s:%s: Parameter created: \"%s\" (index %d) [%4ld us].\n",
- driverName, functionName, drvInfo, index, elapsed_us); /* BENCH */
+ gettimeofday(&t1, NULL); /* BENCH */
+ long elapsed_us = (t1.tv_sec-t0.tv_sec)*1000000L+(t1.tv_usec-t0.tv_usec); /* BENCH */
+ asynPrint(pasynUser, ASYN_TRACE_INFO, "%s:%s: Parameter created: \"%s\" (index %d) [BENCH %4ld us].\n", driverName, functionName, drvInfo, index, elapsed_us); /* BENCH */
return asynPortDriver::drvUserCreate(pasynUser,drvInfo,pptypeName,psize); //Assigns pasynUser->reason;
}
@@ -1583,70 +1148,9 @@ asynStatus adsAsynPortDriver::updateParamInfoWithPLCInfo(adsParamInfo *paramInfo
return asynSuccess;
}
- /**
- * Dict fast-path — RTT ① elimination
- *
- * parsePlcInfofromDrvInfo() has already filled paramInfo->plcAdrStr with
- * the bare symbol path (e.g. "MAIN.fbSlitX.stMotionStatus.bError").
- * symbolDict_ is keyed on the lower-cased symbol path and was populated at
- * construction by loadSymbolDict() + resolveSymbolHandles().
- *
- * If this symbol is in the dict AND its handle was resolved by the SUMUP
- * batch call, we inject plcDataType, plcSize, and hSymbolicHandle directly
- * into paramInfo — skipping BOTH:
- * RTT ① adsGetSymInfoByName() (ADSIGRP_SYM_INFOBYNAMEEX, 0xF009)
- * RTT ② adsGetSymHandleByName() (ADSIGRP_SYM_HNDBYNAME, 0xF003)
- *
- * The injected plcDataType and plcSize values are consumed by the array-
- * detection, buffer-allocation, callback-setup, and first-read code below —
- * all of which remain unchanged regardless of which path populated them.
- *
- * Non-dict symbols (e.g. TwinCAT_AppInfo.db, ~24 records) fall through to
- * the original per-record ADS calls below.
- */
- bool fromDict = false;
- if (!paramInfo->isAdrCommand && !symbolDict_.empty()) {
- std::string key(paramInfo->plcAdrStr);
- std::transform(key.begin(), key.end(), key.begin(),
- [](unsigned char c){ return std::tolower(c); });
- auto it = symbolDict_.find(key);
- if (it != symbolDict_.end() && it->second.resolved
- && it->second.size > 0 /* guard: JSON size must be non-zero */
- && it->second.adst != ADST_VOID) { /* guard: datatype must be mappable */
- const AdsSymbolDictEntry &e = it->second;
- paramInfo->plcDataType = e.adst;
- paramInfo->plcSize = e.size;
- paramInfo->hSymbolicHandle = e.handle;
- paramInfo->bSymbolicHandleValid = true;
- /* plcAbsAdrValid is intentionally left false — this param uses the
- * symbolic-handle path (ADSIGRP_SYM_VALBYHND), not the abs-address
- * path. adsReadParam() / adsWriteParam() / adsAddDataCallback() all
- * check bSymbolicHandleValid before plcAbsAdrValid, so this is safe. */
- fromDict = true;
- asynPrint(pasynUserSelf, ASYN_TRACE_WARNING,
- "%s:%s: dict hit '%s' handle=0x%x size=%u adst=%u\n",
- driverName, functionName,
- paramInfo->plcAdrStr,
- paramInfo->hSymbolicHandle,
- paramInfo->plcSize,
- paramInfo->plcDataType);
- } else if (it != symbolDict_.end()) {
- /* Entry found but unusable — log and fall back to ADS RTT */
- asynPrint(pasynUserSelf, ASYN_TRACE_WARNING,
- "%s:%s: dict entry for '%s' unusable "
- "(resolved=%d size=%u adst=%u) — falling back to ADS\n",
- driverName, functionName,
- paramInfo->plcAdrStr,
- (int)it->second.resolved,
- it->second.size,
- it->second.adst);
- }
- }
-
// Read symbolic information if needed (to get paramInfo->plcSize)
- // Skipped for dict symbols — plcDataType and plcSize already injected above.
- if(!paramInfo->isAdrCommand && !fromDict){
- status=adsGetSymInfoByName(paramInfo); // RTT ① — non-dict symbols only
+ if(!paramInfo->isAdrCommand){
+ status=adsGetSymInfoByName(paramInfo);
if(status!=asynSuccess){
return asynError;
}
@@ -1694,23 +1198,11 @@ asynStatus adsAsynPortDriver::updateParamInfoWithPLCInfo(adsParamInfo *paramInfo
}
}
- /**
- * Handle acquisition — RTT ② elimination
- *
- * For dict symbols hSymbolicHandle + bSymbolicHandleValid were already set
- * in the dict fast-path above. adsReleaseSymbolicHandle() would attempt to
- * release the batch-resolved handle via ADSIGRP_SYM_RELEASEHND — which we
- * must NOT do here because resolveSymbolHandles() owns the lifetime of these
- * handles for the duration of the IOC session.
- *
- * For non-dict symbols the original release-then-acquire sequence runs
- * unchanged.
- */
- if (!paramInfo->isAdrCommand && !fromDict) {
- adsReleaseSymbolicHandle(paramInfo,true); // try to delete — non-dict only
- status=adsGetSymHandleByName(paramInfo); // RTT ② — non-dict symbols only
+ if (!paramInfo->isAdrCommand) {
+ adsReleaseSymbolicHandle(paramInfo,true); //try to delete
+ status=adsGetSymHandleByName(paramInfo);
if(status!=asynSuccess){
- return asynError;
+ return asynError;
}
}
@@ -1723,13 +1215,25 @@ asynStatus adsAsynPortDriver::updateParamInfoWithPLCInfo(adsParamInfo *paramInfo
return asynError;
}
} else { /* Otherwise, put it in a bulk read! */
- status=adsAddToBulkRead(paramInfo);
+ status=adsAddToBulkRead(paramInfo);
if(status!=asynSuccess){
return asynError;
}
}
}
+ // Make first read
+ long errorCode=0;
+ status = adsReadParam(paramInfo,&errorCode,0);
+ if(status!=asynSuccess){
+ // Try read again
+ asynStatus stat=adsReadParam(paramInfo,&errorCode,0);
+ if(stat!=asynSuccess){
+ paramInfo->refreshNeeded=true;
+ return asynError;
+ }
+ }
+
paramInfo->refreshNeeded=false;
return asynSuccess;
}
@@ -1745,19 +1249,19 @@ void adsAsynPortDriver::poll_info(char *name)
for (i = 0; bulk[i].cnt && i < MAXBULK; i++) {
printf("Bulk Read #%d:\n", i);
if (!name) {
- printf(" 0: MAIN.fbSystemTime.timeLoDW (G=0x%x, O=0x%x, S=%d)\n",
- bulk[i].sum[0].iGroup, bulk[i].sum[0].iOffset, bulk[i].sum[0].iSize);
- printf(" 1: MAIN.fbSystemTime.timeHiDW (G=0x%x, O=0x%x, S=%d)\n",
- bulk[i].sum[1].iGroup, bulk[i].sum[1].iOffset, bulk[i].sum[1].iSize);
+ printf(" 0: MAIN.fbSystemTime.timeLoDW (G=0x%x, O=0x%x, S=%d)\n",
+ bulk[i].sum[0].iGroup, bulk[i].sum[0].iOffset, bulk[i].sum[0].iSize);
+ printf(" 1: MAIN.fbSystemTime.timeHiDW (G=0x%x, O=0x%x, S=%d)\n",
+ bulk[i].sum[1].iGroup, bulk[i].sum[1].iOffset, bulk[i].sum[1].iSize);
}
for (int j = 2; j < bulk[i].cnt; j++) {
adsParamInfo *paramInfo=getAdsParamInfo(bulk[i].paramID[j]);
- if (!paramInfo)
- continue;
- if (!name || strstr(paramInfo->plcAdrStr, name))
- printf(" %3d: %s (G=0x%x, O=0x%x, S=%d, TS=%d.%09d)\n", j, paramInfo->plcAdrStr,
- bulk[i].sum[j].iGroup, bulk[i].sum[j].iOffset, bulk[i].sum[j].iSize,
- paramInfo->epicsTimestamp.secPastEpoch, paramInfo->epicsTimestamp.nsec);
+ if (!paramInfo)
+ continue;
+ if (!name || strstr(paramInfo->plcAdrStr, name))
+ printf(" %3d: %s (G=0x%x, O=0x%x, S=%d, TS=%d.%09d)\n", j, paramInfo->plcAdrStr,
+ bulk[i].sum[j].iGroup, bulk[i].sum[j].iOffset, bulk[i].sum[j].iSize,
+ paramInfo->epicsTimestamp.secPastEpoch, paramInfo->epicsTimestamp.nsec);
}
}
}
@@ -1864,157 +1368,112 @@ int adsAsynPortDriver::adsFindBulkTimeStamp(uint16_t amsPort)
* \param[in/out] paramInfo Parameter information structure.
* \return asynSuccess or asynError.
*/
-/* ── drvInfo record-info cache ───────────────────────────────────────────────
- *
- * getRecordInfoFromDrvInfo() historically walked the entire EPICS database
- * for every drvUserCreate() call — O(N²) in the number of records. For a
- * 500-record IOC this was ~1.6 s of pure CPU; for a 10k-record IOC it would
- * be >100 s.
- *
- * The cache below is built once (O(N)) on the first call and consulted in
- * O(1) on every subsequent call. The map key is "portName\0drvInfo" so that
- * multiple driver instances sharing the same IOC do not collide.
- * ─────────────────────────────────────────────────────────────────────────── */
-struct RecordInfoCache {
- std::string recordType;
- std::string recordName;
- std::string inp;
- std::string out;
- std::string dtyp;
- asynParamType asynType = asynParamNotDefined;
-};
-
-/* key: portName + '\0' + drvInfo → first matching record's info */
-static std::unordered_map<std::string, RecordInfoCache> s_drvInfoCache;
-static bool s_drvInfoCacheBuilt = false;
-
-static void buildDrvInfoCache()
-{
- if (s_drvInfoCacheBuilt) return;
- s_drvInfoCacheBuilt = true;
-
- if (!pdbbase) return; /* DB not loaded yet — should not happen but guard anyway */
-
- DBENTRY *pdb = dbAllocEntry(pdbbase);
- long st = dbFirstRecordType(pdb);
- while (!st) {
- /* capture as std::string immediately — raw ptr invalidated by dbNext* */
- std::string rtype = dbGetRecordTypeName(pdb);
- long sr = dbFirstRecord(pdb);
- while (!sr) {
- if (!dbIsAlias(pdb)) {
- std::string rname = dbGetRecordName(pdb);
-
- /* extract DTYP — must be done before tryLink repositions cursor */
- std::string dtyp_str;
- asynParamType atype = asynParamNotDefined;
- if (!dbFindField(pdb, "DTYP")) {
- const char *dtypVal = dbGetString(pdb);
- if (dtypVal) {
- dtyp_str = dtypVal;
- /* dtypStringToAsynType takes char* (may modify) — pass writable copy */
- char dtypBuf[256] = {};
- strncpy(dtypBuf, dtypVal, sizeof(dtypBuf)-1);
- atype = dtypStringToAsynType(dtypBuf);
- }
- }
-
- /* parse "@asyn(port,adr,tmo)drvInfo" from INP or OUT field.
- * Returns (port, drvInfo) strings, or ("","") if not an asyn link.
- * The link string itself is also returned as the third element so
- * we never need to re-query the DBENTRY after this call. */
- auto tryLink = [&](const char *field)
- -> std::pair<std::pair<std::string,std::string>, std::string>
- {
- typedef std::pair<std::pair<std::string,std::string>,std::string> R;
- if (dbFindField(pdb, field))
- return R(std::make_pair(std::string(),std::string()), std::string());
- const char *val = dbGetString(pdb);
- if (!val)
- return R(std::make_pair(std::string(),std::string()), std::string());
- std::string linkStr(val);
- char port[256]={}, drvI[1024]={};
- int adr=0, tmo=0;
- if (sscanf(val, "@asyn(%255[^,],%d,%d)%1023s", port, &adr, &tmo, drvI) == 4)
- return R(std::make_pair(std::string(port),std::string(drvI)), linkStr);
- return R(std::make_pair(std::string(),std::string()), std::string());
- };
-
- /* INP link */
- std::pair<std::pair<std::string,std::string>,std::string> inpRes = tryLink("INP");
- const std::string &inpPort = inpRes.first.first;
- const std::string &inpDrv = inpRes.first.second;
- const std::string &inpStr = inpRes.second;
-
- /* OUT link */
- std::pair<std::pair<std::string,std::string>,std::string> outRes = tryLink("OUT");
- const std::string &outPort = outRes.first.first;
- const std::string &outDrv = outRes.first.second;
- const std::string &outStr = outRes.second;
-
- /* store INP entry — link string already captured, no re-query */
- if (!inpPort.empty()) {
- std::string key = inpPort + '\0' + inpDrv;
- if (!s_drvInfoCache.count(key)) {
- RecordInfoCache e;
- e.recordType = rtype;
- e.recordName = rname;
- e.dtyp = dtyp_str;
- e.asynType = atype;
- e.inp = inpStr;
- s_drvInfoCache[key] = std::move(e);
- }
- }
-
- /* store OUT entry — link string already captured, no re-query */
- if (!outPort.empty()) {
- std::string key = outPort + '\0' + outDrv;
- if (!s_drvInfoCache.count(key)) {
- RecordInfoCache e;
- e.recordType = rtype;
- e.recordName = rname;
- e.dtyp = dtyp_str;
- e.asynType = atype;
- e.out = outStr;
- s_drvInfoCache[key] = std::move(e);
- }
- }
- }
- sr = dbNextRecord(pdb);
- }
- st = dbNextRecordType(pdb);
- }
- dbFreeEntry(pdb);
-}
-
asynStatus adsAsynPortDriver::getRecordInfoFromDrvInfo(const char *drvInfo,adsParamInfo *paramInfo)
{
const char* functionName = "getRecordInfoFromDrvInfo";
asynPrint(pasynUserSelf,ASYN_TRACE_FLOW, "%s:%s: drvInfo: %s\n", driverName, functionName,drvInfo);
- paramInfo->amsPort = amsportDefault_;
+ bool isInput=false;
+ bool isOutput=false;
+ paramInfo->amsPort=amsportDefault_;
+ DBENTRY *pdbentry;
+ pdbentry = dbAllocEntry(pdbbase);
+ long status = dbFirstRecordType(pdbentry);
+ bool recordFound=false;
+ if(status) {
+ dbFreeEntry(pdbentry);
+ return asynError;
+ }
+ while(!status) {
+ paramInfo->recordType=strdup(dbGetRecordTypeName(pdbentry));
+ status = dbFirstRecord(pdbentry);
+ while(!status) {
+ paramInfo->recordName=strdup(dbGetRecordName(pdbentry));
+ if(!dbIsAlias(pdbentry)){
+ status=dbFindField(pdbentry,"INP");
+ if(!status){