-
Notifications
You must be signed in to change notification settings - Fork 1
/
Cerebus400.lua
1543 lines (1395 loc) · 87 KB
/
Cerebus400.lua
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
-- Wireshark dissector for UDP packets exchanged between
-- Neural Signal Processors and controlling PCs
--
-- Copyright 2017 Jonas Zimmermann, 2022 Hyrum Sessions
-- info("Loading cb protocol ...")
-- Definition of a few helpers
-- implementation of a simple stack (Lifted from http://lua-users.org/wiki/SimpleStack)
-- and extended
local Stack = {}
-- Create a Table with stack functions
function Stack:Create(default_element)
-- stack table
local t = {}
-- entry table
t._et = {}
t._default_element = default_element
-- push a value on to the stack
function t:push(...)
if ... then
local targs = {...}
-- add values
for _,v in ipairs(targs) do
table.insert(self._et, v)
end
end
end
-- pop a value from the stack
function t:pop(num)
-- get num values from stack
local num = num or 1
-- return table
local entries = {}
-- get values into entries
for i = 1, num do
-- get last entry
if #self._et ~= 0 then
table.insert(entries, self._et[#self._et])
-- remove last value
table.remove(self._et)
else
break
end
end
-- if we get fewer entries than requested, also include default (if not nil)
if #entries < num and self._default_element ~= nil then
table.insert(entries, self._default_element)
end
-- return unpacked entries
return unpack(entries)
end
-- get entries
function t:getn()
return #self._et
end
-- list values
function t:list()
for i,v in pairs(self._et) do
print(i, v)
end
end
-- get last entry without removing
function t:last()
return #self._et > 0 and self._et[#self._et] or self._default_element
end
return t
end
-- define Constants, lifted from cbhwlib.h
local cbConst = {}
cbConst.cbMAXHOOPS = 4
cbConst.cbMAXSITES = 4
cbConst.cbMAXSITEPLOTS = ((cbConst.cbMAXSITES - 1) * cbConst.cbMAXSITES / 2)
cbConst.cbNUM_FE_CHANS = 256 -- #Front end channels
cbConst.cbNUM_ANAIN_CHANS = 16 -- #Analog Input channels
cbConst.cbNUM_ANALOG_CHANS = (cbConst.cbNUM_FE_CHANS + cbConst.cbNUM_ANAIN_CHANS) -- Total Analog Inputs
cbConst.cbNUM_ANAOUT_CHANS = 4 -- #Analog Output channels
cbConst.cbNUM_AUDOUT_CHANS = 2 -- #Audio Output channels
cbConst.cbNUM_ANALOGOUT_CHANS = (cbConst.cbNUM_ANAOUT_CHANS + cbConst.cbNUM_AUDOUT_CHANS) -- Total Analog Output
cbConst.cbNUM_DIGIN_CHANS = 1 -- #Digital Input channels
cbConst.cbNUM_SERIAL_CHANS = 1 -- #Serial Input channels
cbConst.cbNUM_DIGOUT_CHANS = 4 -- #Digital Output channels
-- Total of all channels = 156
cbConst.cbMAXCHANS = (cbConst.cbNUM_ANALOG_CHANS +
cbConst.cbNUM_ANALOGOUT_CHANS + cbConst.cbNUM_DIGIN_CHANS +
cbConst.cbNUM_SERIAL_CHANS + cbConst.cbNUM_DIGOUT_CHANS)
cbConst.cbFIRST_FE_CHAN = 0 -- 0 First Front end channel
cbConst.cbFIRST_ANAIN_CHAN = cbConst.cbNUM_FE_CHANS -- 256 First Analog Input channel
cbConst.cbFIRST_ANAOUT_CHAN = (cbConst.cbFIRST_ANAIN_CHAN + cbConst.cbNUM_ANAIN_CHANS) -- 288 First Analog Output channel
cbConst.cbFIRST_AUDOUT_CHAN = (cbConst.cbFIRST_ANAOUT_CHAN + cbConst.cbNUM_ANAOUT_CHANS) -- 296 First Audio Output channel
cbConst.cbFIRST_DIGIN_CHAN = (cbConst.cbFIRST_AUDOUT_CHAN + cbConst.cbNUM_AUDOUT_CHANS) -- 300 First Digital Input channel
cbConst.cbFIRST_SERIAL_CHAN = (cbConst.cbFIRST_DIGIN_CHAN + cbConst.cbNUM_DIGIN_CHANS) -- 302 First Serial Input channel
cbConst.cbFIRST_DIGOUT_CHAN = (cbConst.cbFIRST_SERIAL_CHAN + cbConst.cbNUM_SERIAL_CHANS) -- 304 First Digital Output channel
cbConst.cbLEN_STR_UNIT = 8
cbConst.cbLEN_STR_LABEL = 16
cbConst.cbLEN_STR_FILT_LABEL = 16
cbConst.cbLEN_STR_IDENT = 64
cbConst.cbMAXUNITS = 5
cbConst.cbMAXNTRODES = (cbConst.cbNUM_ANALOG_CHANS / 2)
cbConst.cbPKT_SPKCACHELINECNT = cbConst.cbNUM_ANALOG_CHANS
cbConst.cbMAX_PNTS = 128
-- base of our rudimentary class system
local klass = {}
function klass:new (o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
local AField = klass:new{
n='name',
d=nil,
ftype='afield',
}
local PktField = AField:new{
ftype='pktfield',
t='UINT8',
lf=nil,
lfactor=1,
len=nil,
format='NONE',
valuestring=nil,
mask=nil,
_data_width={
UINT8=1,
INT8=1,
BYTES=1,
UINT16=2,
INT16=2,
UINT32=4,
UINT64=8,
INT32=4,
FLOAT=4,
DOUBLE=8,
STRING=1,
},
_data_rng_getter={
UINT8='le_uint',
INT8='le_int',
UINT16='le_uint',
INT16='le_int',
UINT32='le_uint',
INT32='le_int',
FLOAT='le_float',
DOUBLE='le_float',
}
}
function PktField:dataWidth()
local dw = self._data_width[self.t]
return dw
end
function PktField:rangeGetter()
return self._data_rng_getter[self.t]
end
local FlagField = AField:new{
mask=0x00,
valuestring=nil,
ftype='flagfield',
}
-- All Packets derive from CbPkt, which defines the packet header
local CbPkt = klass:new{
name='HEADER',
fields={
PktField:new{t='UINT64', n='time', d='Timestamp in tics', format='HEX'},
PktField:new{t='UINT16', n='chid', format='HEX_DEC'},
PktField:new{t='UINT8', n='type', format='HEX'},
PktField:new{t='UINT16', n='dlen', d='Packet Data Length (in quadlets)'},
PktField:new{t='UINT8', n='instrument', format='HEX'},
PktField:new{t='UINT16', n='reserved', format='HEX'}
},
dfields={},
pkttypes= setmetatable({}, {__mode="v"}),
conf_type_map = {[1]=setmetatable({}, {__mode="v"}),
[2]=setmetatable({}, {__mode="v"})
},
_conf_pkg_ch=0x8000
}
function CbPkt:new(name, addfields)
local newobj = klass:new()
newobj.fields = {}
for i, f in ipairs(self.fields) do
newobj.fields[i] = f:new()
end
newobj.name = name
newobj.dfields = {}
addfields = addfields or {}
local types = addfields._types
addfields._types = nil
for _, f in pairs(addfields) do
table.insert(newobj.fields, f)
end
for i, f in ipairs(newobj.fields) do
newobj.fields[f.n] = f
end
newobj.fields['type'].valuestring = types
self.pkttypes[name] = newobj
setmetatable(newobj, self)
self.__index = self
if newobj._kind == 1 or newobj._kind == 2 then
for k,_ in pairs(newobj.fields['type'].valuestring) do
self.conf_type_map[newobj._kind][k] = newobj
end
end
return newobj
end
function CbPkt:match(chid, type)
-- this matches all config packets, i.e. ones where chid==0x8000
if chid == self._conf_pkg_ch and type ~= nil and self.conf_type_map[1][type] ~= nil then
return self.conf_type_map[1][type]
end
if bit32.band(chid, self._conf_pkg_ch) == self._conf_pkg_ch and
bit32.band(chid, bit32.bnot(self._conf_pkg_ch)) > 0 and
type ~= nil and
self.conf_type_map[2][type] ~= nil then
return self.conf_type_map[2][type]
end
if chid == 0x000 and self.pkttypes.cbPKT_GROUP ~= nil then
return self.pkttypes.cbPKT_GROUP
end
if chid > 0x0000 and chid < cbConst.cbPKT_SPKCACHELINECNT and self.pkttypes.nevPKT_GENERIC ~= nil then
return self.pkttypes.nevPKT_GENERIC
end
if (cbConst.cbFIRST_DIGIN_CHAN < chid) and (chid <= cbConst.cbFIRST_DIGIN_CHAN+cbConst.cbNUM_DIGIN_CHANS) and self.pkttypes.nevPKT_DIGIN ~= nil then
return self.pkttypes.nevPKT_DIGIN
end
return self.pkttypes['cbPKT_GENERIC']
end
function CbPkt:iterate(b_len)
local i=0
local n=#self.fields
local buf_pos=0
-- store how many bytes we expect in total. That's composed of 8 header bytes and the reported 'dlen'
local dlen
return function()
i = i + 1
if i <= n then
local f = self.fields[i]
if f.ftype=='afield' or f.ftype=='flagfield' then
return i, buf_pos, 0, f, 1
end
-- if dlen hasn't been read yet, test if it is available, read it from field; add header size
if dlen == nil and self.dfields['dlen'] ~= nil and self.dfields['dlen']() ~= nil then
dlen = 16 + self.dfields['dlen']()() * 4
end
local width = f:dataWidth()
local field_w = width
local mult = 1
if f.len ~= nil then
mult = f.len
elseif f.lf ~= nil and self.dfields[f.lf] ~= nil then
mult = f.lfactor * self.dfields[f.lf]()()
end
width = width * mult
local old_buf_pos = buf_pos
buf_pos = buf_pos + width
if f.t=='BYTES' or f.t=='STRING' then
field_w = width
mult = 1
end
-- if we'd exceed buffer length (as passed through b_len) or dlen, stop by returning nil
if (b_len ~= nil and buf_pos > b_len) or (dlen ~= nil and buf_pos > dlen) then return nil end
return i, old_buf_pos, field_w, f, mult
end
end
end
function CbPkt:makeInfoString()
return self.name
end
-- Subclass for config packets. They all share that
-- chid == 0x8000 and 'type' corresponds to a packet type, which we store in the 'type' field's valuestring
local CbPktConfig = CbPkt:new('cb_cfg')
CbPktConfig._kind = 1
-- Subclass for preview stream packets. They all share that
-- (chid & 0x8000) == 0x8000 and (chid&0x0FFF) > 0 and 'type' corresponds to a packet type, which we store in the 'type' field's valuestring
local CbPktPrevStreamBase = CbPkt:new('cb_prev')
CbPktPrevStreamBase._kind = 2
-- Packet definitions start here
-- Generic packets
local CbPktGeneric = CbPkt:new('cbPKT_GENERIC',
{
PktField:new{t='BYTES', n='data', lf='dlen', lfactor=4},
}
)
-- Config packets (chid == 0x8000)
-- System heartbeat
local CbPktSysHeartbeat = CbPktConfig:new('cbPKT_SYSHEARTBEAT', {
_types={
[0x00] = "System Heartbeat cbPKTTYPE_SYSHEARTBEAT",
}
})
-- System protocol monitor
local CbPktSysProtocolMonitor = CbPktConfig:new('cbPKT_SYSPROTOCOLMONITOR',
{
PktField:new{t='UINT32', n='sentpkts', d='Packets sent since last cbPKT_SYSPROTOCOLMONITOR (or 0 if timestamp=0)'},
_types={
[0x01] = "System Protocol Monitor Packet",
}
}
)
-- System condition report packet
local CbPktSysInfo = CbPktConfig:new('cbPKT_SYSINFO',
{
PktField:new{t='UINT32', n='sysfreq', d='System clock frequency in Hz', format='DEC'},
PktField:new{t='UINT32', n='spikelen', d='The length of the spike events', format='DEC'},
PktField:new{t='UINT32', n='spikepre', d='Spike pre-trigger samples', format='DEC'},
PktField:new{t='UINT32', n='resetque', d='The channel for the reset to que on', format='DEC'},
PktField:new{t='UINT32', n='runlevel', d='System runlevel', format='DEC_HEX'},
PktField:new{t='UINT32', n='runflags', d='Run Flags', format='HEX'},
_types={
[0x10] = "System Condition Report cbPKTTYPE_SYSREP",
[0x11] = "System Spike Length Report cbPKTTYPE_SYSREPSPKLEN",
[0x12] = "System Runlevel Report cbPKTTYPE_SYSREPRUNLEV",
[0x90] = "System set Req cbPKTTYPE_SYSSET",
[0x91] = "System set Spike Length cbPKTTYPE_SYSSETSPKLEN",
[0x92] = "System set Runlevel cbPKTTYPE_SYSSETRUNLEV",
}
}
)
-- System condition report packet
local CbPktSSModelSet = CbPktConfig:new('cbPKT_SS_MODELSET',
{
PktField:new{t='UINT32', n='chan', d='Channel being configured (zero-based)', format='DEC'},
PktField:new{t='UINT32', n='unit_number', d='unit number (0 = noise)', format='DEC'},
PktField:new{t='UINT32', n='valid', valuestring={[0]="invalid", [1]="valid"}, format='DEC'},
PktField:new{t='UINT32', n='inverted', valuestring={[0]="not inverted", [1]="inverted"}, format='DEC'},
PktField:new{t='INT32', n='num_samples', d='non-zero value means that the block stats are valid', format='DEC'},
PktField:new{t='FLOAT', n='mu', len=2},
PktField:new{t='FLOAT', n='Sigma_x', len=4},
PktField:new{t='FLOAT', n='determinant_Sigma_x'},
PktField:new{t='FLOAT', n='Sigma_x_inv', len=4},
PktField:new{t='FLOAT', n='log_determinant_Sigma_x'},
PktField:new{t='FLOAT', n='subcluster_spread_factor_numerator'},
PktField:new{t='FLOAT', n='subcluster_spread_factor_denominator'},
PktField:new{t='FLOAT', n='mu_e'},
PktField:new{t='FLOAT', n='sigma_e_squared'},
_types={
[0x51] = "SS Model response cbPKTTYPE_SS_MODELREP",
[0xD1] = "SS Model request cbPKTTYPE_SS_MODELSET",
}
}
)
-- NTrode Information Packets
local CbPktNTrodeInfo = CbPktConfig:new('cbPKT_NTRODEINFO',
{
PktField:new{t='UINT32', n='ntrode', d='nTrode being configured (1-based)', format='DEC'},
PktField:new{t='STRING', n='label', d='nTrode label', len=cbConst.cbLEN_STR_LABEL},
AField:new{n='placeholder', d='→ Other fields of this packet have not been implemented yet. ←'},
-- typedef struct {
-- INT16 nOverride;
-- INT16 afOrigin[3];
-- INT16 afShape[3][3];
-- INT16 aPhi;
-- UINT32 bValid; // is this unit in use at this time?
-- // BOOL implemented as UINT32 - for structure alignment at paragraph boundary
-- } cbMANUALUNITMAPPING;
-- cbMANUALUNITMAPPING ellipses[cbMAXSITEPLOTS][cbMAXUNITS]; // unit mapping
-- UINT16 nSite; // number channels in this NTrode ( 0 <= nSite <= cbMAXSITES)
-- UINT16 fs; // NTrode feature space cbNTRODEINFO_FS_*
-- UINT16 nChan[cbMAXSITES]; // group of channels in this NTrode
_types={
[0x27] = "NTrode info response cbPKTTYPE_REPNTRODEINFO",
[0xA7] = "NTrode info request cbPKTTYPE_SETNTRODEINFO",
}
}
)
-- Channel Information Packets
local CbPktChanInfo = CbPktConfig:new('cbPKT_CHANINFO',
{
PktField:new{t='UINT32', n='chan', d='channel being configured', format='DEC'},
PktField:new{t='UINT32', n='proc', d='address of the processor', format='DEC'},
PktField:new{t='UINT32', n='bank', d='address of the bank', format='DEC'},
PktField:new{t='UINT32', n='term', d='terminal number', format='DEC_HEX'},
PktField:new{t='UINT32', n='chancaps', d='channel capabilities', format='HEX'},
FlagField:new{t='BOOLEAN', n='chancaps.exists', format=32, mask=0x00000001, d='cbCHAN_EXISTS id is allocated', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='chancaps.connected', format=32, mask=0x00000002, d='cbCHAN_CONNECTED connected and mapped and ready to use', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='chancaps.isolated', format=32, mask=0x00000004, d='cbCHAN_ISOLATED electrically isolated', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='chancaps.ainp', format=32, mask=0x00000100, d='cbCHAN_AINP analog input capabilities', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='chancaps.aout', format=32, mask=0x00000200, d='cbCHAN_AOUT analog output capabilities', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='chancaps.dinp', format=32, mask=0x00000400, d='cbCHAN_DINP digital input capabilities', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='chancaps.dout', format=32, mask=0x00000800, d='cbCHAN_DOUT digital output capabilities', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='chancaps.gyro', format=32, mask=0x00001000, d='cbCHAN_GYRO gyroscope/accelerometer/magnetometer/temperature capabilities', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='doutcaps', d='digital output capabilities', format='HEX'},
FlagField:new{t='BOOLEAN', n='doutcaps.serialmask', format=32, mask=0x000000FF, d='cbDOUT_SERIALMASK Port operates as an RS232 Serial Connection', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.baud2400', format=32, mask=0x00000001, d='cbDOUT_BAUD2400 Serial Port operates at 2400 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.baud9600', format=32, mask=0x00000002, d='cbDOUT_BAUD9600 Serial Port operates at 9600 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.baud19200', format=32, mask=0x00000004, d='cbDOUT_BAUD19200 Serial Port operates at 19200 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.baud38400', format=32, mask=0x00000008, d='cbDOUT_BAUD38400 Serial Port operates at 38400 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.baud57600', format=32, mask=0x00000010, d='cbDOUT_BAUD57600 Serial Port operates at 57600 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.baud115200', format=32, mask=0x00000020, d='cbDOUT_BAUD115200 Serial Port operates at 115200 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.1bit', format=32, mask=0x00000100, d='cbDOUT_1BIT Port has a single output bit (eg single BNC output)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.8bit', format=32, mask=0x00000200, d='cbDOUT_8BIT Port has 8 output bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.16bit', format=32, mask=0x00000400, d='cbDOUT_16BIT Port has 16 output bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.32bit', format=32, mask=0x00000800, d='cbDOUT_32BIT Port has 32 output bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.value', format=32, mask=0x00010000, d='cbDOUT_VALUE Port can be manually configured', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.track', format=32, mask=0x00020000, d='cbDOUT_TRACK Port should track the most recently selected channel', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.frequency', format=32, mask=0x00040000, d='cbDOUT_FREQUENCY Port can output a frequency', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.triggered', format=32, mask=0x00080000, d='cbDOUT_TRIGGERED Port can be triggered', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.monitor_unit0', format=32, mask=0x01000000, d='cbDOUT_MONITOR_UNIT0 Can monitor unit 0 = UNCLASSIFIED', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.monitor_unit1', format=32, mask=0x02000000, d='cbDOUT_MONITOR_UNIT1 Can monitor unit 1', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.monitor_unit2', format=32, mask=0x04000000, d='cbDOUT_MONITOR_UNIT2 Can monitor unit 2', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.monitor_unit3', format=32, mask=0x08000000, d='cbDOUT_MONITOR_UNIT3 Can monitor unit 3', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.monitor_unit4', format=32, mask=0x10000000, d='cbDOUT_MONITOR_UNIT4 Can monitor unit 4', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.monitor_unit5', format=32, mask=0x20000000, d='cbDOUT_MONITOR_UNIT5 Can monitor unit 5', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutcaps.monitor_unit_all', format=32, mask=0x3F000000, d='cbDOUT_MONITOR_UNIT_ALL Can monitor ALL units', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='dinpcaps', d='digital input capablities', format='HEX'},
FlagField:new{t='BOOLEAN', n='dinpcaps.serialmask', format=32, mask=0x000000FF, d='cbDINP_SERIALMASK Bit mask used to detect RS232 Serial Baud Rates', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.baud2400', format=32, mask=0x00000001, d='cbDINP_BAUD2400 RS232 Serial Port operates at 2400 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.baud9600', format=32, mask=0x00000002, d='cbDINP_BAUD9600 RS232 Serial Port operates at 9600 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.baud19200', format=32, mask=0x00000004, d='cbDINP_BAUD19200 RS232 Serial Port operates at 19200 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.baud38400', format=32, mask=0x00000008, d='cbDINP_BAUD38400 RS232 Serial Port operates at 38400 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.baud57600', format=32, mask=0x00000010, d='cbDINP_BAUD57600 RS232 Serial Port operates at 57600 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.baud115200', format=32, mask=0x00000020, d='cbDINP_BAUD115200 RS232 Serial Port operates at 115200 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.1bit', format=32, mask=0x00000100, d='cbDINP_1BIT Port has a single input bit (eg single BNC input)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.8bit', format=32, mask=0x00000200, d='cbDINP_8BIT Port has 8 input bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.16bit', format=32, mask=0x00000400, d='cbDINP_16BIT Port has 16 input bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.32bit', format=32, mask=0x00000800, d='cbDINP_32BIT Port has 32 input bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.anybit', format=32, mask=0x00001000, d='cbDINP_ANYBIT Capture the port value when any bit changes.', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.wrdstrb', format=32, mask=0x00002000, d='cbDINP_WRDSTRB Capture the port when a word-write line is strobed', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.pktchar', format=32, mask=0x00004000, d='cbDINP_PKTCHAR Capture packets using an End of Packet Character', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.pktstrb', format=32, mask=0x00008000, d='cbDINP_PKTSTRB Capture packets using an End of Packet Logic Input', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.monitor', format=32, mask=0x00010000, d='cbDINP_MONITOR Port controls other ports or system events', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.redge', format=32, mask=0x00020000, d='cbDINP_REDGE Capture the port value when any bit changes lo-2-hi (rising edge)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.fedge', format=32, mask=0x00040000, d='cbDINP_FEDGE Capture the port value when any bit changes hi-2-lo (falling edge)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.strbany', format=32, mask=0x00080000, d='cbDINP_STRBANY Capture packets using 8-bit strobe/8-bit any Input', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.strbris', format=32, mask=0x00100000, d='cbDINP_STRBRIS Capture packets using 8-bit strobe/8-bit rising edge Input', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpcaps.strbfal', format=32, mask=0x00200000, d='cbDINP_STRBFAL Capture packets using 8-bit strobe/8-bit falling edge Input', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='aoutcaps', d='analog output capablities', format='HEX'},
FlagField:new{t='BOOLEAN', n='aoutcaps.audio', format=32, mask=0x00000001, d='cbAOUT_AUDIO Channel is physically optimized for audio output', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.scale', format=32, mask=0x00000002, d='cbAOUT_SCALE Output a static value', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.track', format=32, mask=0x00000004, d='cbAOUT_TRACK Output a static value', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.static', format=32, mask=0x00000008, d='cbAOUT_STATIC Output a static value', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.monitorraw', format=32, mask=0x00000010, d='cbAOUT_MONITORRAW Monitor an analog signal line - RAW data', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.monitorlnc', format=32, mask=0x00000020, d='cbAOUT_MONITORLNC Monitor an analog signal line - Line Noise Cancelation', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.monitorsmp', format=32, mask=0x00000040, d='cbAOUT_MONITORSMP Monitor an analog signal line - Continuous', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.monitorspk', format=32, mask=0x00000080, d='cbAOUT_MONITORSPK Monitor an analog signal line - spike', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.stimulate', format=32, mask=0x00000100, d='cbAOUT_STIMULATE Stimulation waveform functions are available.', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.waveform', format=32, mask=0x00000200, d='cbAOUT_WAVEFORM Custom Waveform', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutcaps.extension', format=32, mask=0x00000400, d='cbAOUT_EXTENSION Output Waveform from Extension', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='ainpcaps', d='analog input capablities', format='HEX'},
FlagField:new{t='BOOLEAN', n='ainpcaps.rawpreview', format=32, mask=0x00000001, d='cbAINP_RAWPREVIEW Generate scrolling preview data for the raw channel', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.lnc', format=32, mask=0x00000002, d='cbAINP_LNC Line Noise Cancellation', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.lncpreview', format=32, mask=0x00000004, d='cbAINP_LNCPREVIEW Retrieve the LNC correction waveform', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.smpstream', format=32, mask=0x00000010, d='cbAINP_SMPSTREAM stream the analog input stream directly to disk', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.smpfilter', format=32, mask=0x00000020, d='cbAINP_SMPFILTER Digitally filter the analog input stream', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.rawstream', format=32, mask=0x00000040, d='cbAINP_RAWSTREAM Raw data stream available', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.spkstream', format=32, mask=0x00000100, d='cbAINP_SPKSTREAM Spike Stream is available', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.spkfilter', format=32, mask=0x00000200, d='cbAINP_SPKFILTER Selectable Filters', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.spkpreview', format=32, mask=0x00000400, d='cbAINP_SPKPREVIEW Generate scrolling preview of the spike channel', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.spkproc', format=32, mask=0x00000800, d='cbAINP_SPKPROC Channel is able to do online spike processing', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpcaps.offset_correct_cap', format=32, mask=0x00001000, d='cbAINP_OFFSET_CORRECT_CAP Offset correction mode (0-disabled 1-enabled)', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='spkcaps', d='spike capablities', format='HEX'},
FlagField:new{t='BOOLEAN', n='spkcaps.extract', format=32, mask=0x00000001, d='cbAINPSPK_EXTRACT time-stamp and packet to first superthreshold peak', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.rejart', format=32, mask=0x00000002, d='cbAINPSPK_REJART Reject around clipped signals on multiple channels', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.rejclip', format=32, mask=0x00000004, d='cbAINPSPK_REJCLIP Reject clipped signals on the channel', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.alignpk', format=32, mask=0x00000008, d='cbAINPSPK_ALIGNPK', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.rejampl', format=32, mask=0x00000010, d='cbAINPSPK_REJAMPL Reject based on amplitude', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.thrlevel', format=32, mask=0x00000100, d='cbAINPSPK_THRLEVEL Analog level threshold detection', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.threnergy', format=32, mask=0x00000200, d='cbAINPSPK_THRENERGY Energy threshold detection', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.thrauto', format=32, mask=0x00000400, d='cbAINPSPK_THRAUTO Auto threshold detection', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.spreadsort', format=32, mask=0x00001000, d='cbAINPSPK_SPREADSORT Enable auto spread sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.corrsort', format=32, mask=0x00002000, d='cbAINPSPK_CORRSORT Enable auto histogram correlation sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.peakmajsort', format=32, mask=0x00004000, d='cbAINPSPK_PEAKMAJSORT Enable auto histogram peak major sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.peakfishsort', format=32, mask=0x00008000, d='cbAINPSPK_PEAKFISHSORT Enable auto histogram peak fisher sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.hoopsort', format=32, mask=0x00010000, d='cbAINPSPK_HOOPSORT Enable manual hoop sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.pcamansort', format=32, mask=0x00020000, d='cbAINPSPK_PCAMANSORT Enable manual PCA sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.pcakmeansort', format=32, mask=0x00040000, d='cbAINPSPK_PCAKMEANSORT Enable k-means PCA sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.pcaemsort', format=32, mask=0x00080000, d='cbAINPSPK_PCAEMSORT Enable EM-clustering PCA sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkcaps.pcadbsort', format=32, mask=0x00100000, d='cbAINPSPK_PCADBSORT Enable DBSCAN PCA sorting', valuestring={'yes', 'no'}},
AField:new{n='physcalin', d='physical channel scaling information (in)'},
PktField:new{t='INT16', n='physcalin.digmin', d='digital value that cooresponds with the anamin value'},
PktField:new{t='INT16', n='physcalin.digmax', d='digital value that cooresponds with the anamax value'},
PktField:new{t='INT32', n='physcalin.anamin', d='minimum analog value present in the signal'},
PktField:new{t='INT32', n='physcalin.anamax', d='maximum analog value present in the signal'},
PktField:new{t='INT32', n='physcalin.anagain', d='gain applied to the default analog values to get the analog values'},
PktField:new{t='STRING', n='physcalin.anaunit', d='nTrode label', len=cbConst.cbLEN_STR_UNIT},
AField:new{n='phyfiltin', d='physical channel filter definition (in)'},
PktField:new{t='STRING', n='phyfiltin.label', d='filter label', len=cbConst.cbLEN_STR_FILT_LABEL},
PktField:new{t='UINT32', n='phyfiltin.hpfreq', d='high-pass corner frequency in milliHertz'},
PktField:new{t='UINT32', n='phyfiltin.hporder', d='high-pass filter order'},
PktField:new{t='UINT32', n='phyfiltin.hptype', d='high-pass filter type', format='HEX'},
PktField:new{t='UINT32', n='phyfiltin.lpfreq', d='low-pass frequency in milliHertz'},
PktField:new{t='UINT32', n='phyfiltin.lporder', d='low-pass filter order'},
PktField:new{t='UINT32', n='phyfiltin.lptype', d='low-pass filter type', format='HEX'},
AField:new{n='physcalout', d='physical channel scaling information (out)'},
PktField:new{t='INT16', n='physcalout.digmin', d='digital value that cooresponds with the anamin value'},
PktField:new{t='INT16', n='physcalout.digmax', d='digital value that cooresponds with the anamax value'},
PktField:new{t='INT32', n='physcalout.anamin', d='minimum analog value present in the signal'},
PktField:new{t='INT32', n='physcalout.anamax', d='maximum analog value present in the signal'},
PktField:new{t='INT32', n='physcalout.anagain', d='gain applied to the default analog values to get the analog values'},
PktField:new{t='STRING', n='physcalin.anaunit', d='nTrode label', len=cbConst.cbLEN_STR_UNIT},
AField:new{n='phyfiltout', d='physical channel filter definition (out)'},
PktField:new{t='STRING', n='phyfiltout.label', d='filter label', len=cbConst.cbLEN_STR_FILT_LABEL},
PktField:new{t='UINT32', n='phyfiltout.hpfreq', d='high-pass corner frequency in milliHertz'},
PktField:new{t='UINT32', n='phyfiltout.hporder', d='high-pass filter order'},
PktField:new{t='UINT32', n='phyfiltout.hptype', d='high-pass filter type', format='HEX'},
PktField:new{t='UINT32', n='phyfiltout.lpfreq', d='low-pass frequency in milliHertz'},
PktField:new{t='UINT32', n='phyfiltout.lporder', d='low-pass filter order'},
PktField:new{t='UINT32', n='phyfiltout.lptype', d='low-pass filter type', format='HEX'},
PktField:new{t='STRING', n='label', d='label', len=cbConst.cbLEN_STR_LABEL},
PktField:new{t='UINT32', n='userflags', format='HEX'},
PktField:new{t='INT32', n='position', len=4},
AField:new{n='scalin', d='scaling information (in)'},
PktField:new{t='INT16', n='scalin.digmin', d='digital value that cooresponds with the anamin value'},
PktField:new{t='INT16', n='scalin.digmax', d='digital value that cooresponds with the anamax value'},
PktField:new{t='INT32', n='scalin.anamin', d='minimum analog value present in the signal'},
PktField:new{t='INT32', n='scalin.anamax', d='maximum analog value present in the signal'},
PktField:new{t='INT32', n='scalin.anagain', d='gain applied to the default analog values to get the analog values'},
PktField:new{t='STRING', n='scalin.anaunit', d='nTrode label', len=cbConst.cbLEN_STR_UNIT},
AField:new{n='scalout', d='scaling information (out)'},
PktField:new{t='INT16', n='scalout.digmin', d='digital value that cooresponds with the anamin value'},
PktField:new{t='INT16', n='scalout.digmax', d='digital value that cooresponds with the anamax value'},
PktField:new{t='INT32', n='scalout.anamin', d='minimum analog value present in the signal'},
PktField:new{t='INT32', n='scalout.anamax', d='maximum analog value present in the signal'},
PktField:new{t='INT32', n='scalout.anagain', d='gain applied to the default analog values to get the analog values'},
PktField:new{t='STRING', n='scalout.anaunit', d='nTrode label', len=cbConst.cbLEN_STR_UNIT},
PktField:new{t='UINT32', n='doutopts', d='digital output options', format='HEX'},
FlagField:new{t='BOOLEAN', n='doutopts.serialmask', format=32, mask=0x000000FF, d='cbDOUT_SERIALMASK Port operates as an RS232 Serial Connection', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.baud2400', format=32, mask=0x00000001, d='cbDOUT_BAUD2400 Serial Port operates at 2400 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.baud9600', format=32, mask=0x00000002, d='cbDOUT_BAUD9600 Serial Port operates at 9600 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.baud19200', format=32, mask=0x00000004, d='cbDOUT_BAUD19200 Serial Port operates at 19200 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.baud38400', format=32, mask=0x00000008, d='cbDOUT_BAUD38400 Serial Port operates at 38400 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.baud57600', format=32, mask=0x00000010, d='cbDOUT_BAUD57600 Serial Port operates at 57600 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.baud115200', format=32, mask=0x00000020, d='cbDOUT_BAUD115200 Serial Port operates at 115200 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.1bit', format=32, mask=0x00000100, d='cbDOUT_1BIT Port has a single output bit (eg single BNC output)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.8bit', format=32, mask=0x00000200, d='cbDOUT_8BIT Port has 8 output bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.16bit', format=32, mask=0x00000400, d='cbDOUT_16BIT Port has 16 output bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.32bit', format=32, mask=0x00000800, d='cbDOUT_32BIT Port has 32 output bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.value', format=32, mask=0x00010000, d='cbDOUT_VALUE Port can be manually configured', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.track', format=32, mask=0x00020000, d='cbDOUT_TRACK Port should track the most recently selected channel', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.frequency', format=32, mask=0x00040000, d='cbDOUT_FREQUENCY Port can output a frequency', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.triggered', format=32, mask=0x00080000, d='cbDOUT_TRIGGERED Port can be triggered', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.monitor_unit0', format=32, mask=0x01000000, d='cbDOUT_MONITOR_UNIT0 Can monitor unit 0 = UNCLASSIFIED', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.monitor_unit1', format=32, mask=0x02000000, d='cbDOUT_MONITOR_UNIT1 Can monitor unit 1', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.monitor_unit2', format=32, mask=0x04000000, d='cbDOUT_MONITOR_UNIT2 Can monitor unit 2', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.monitor_unit3', format=32, mask=0x08000000, d='cbDOUT_MONITOR_UNIT3 Can monitor unit 3', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.monitor_unit4', format=32, mask=0x10000000, d='cbDOUT_MONITOR_UNIT4 Can monitor unit 4', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.monitor_unit5', format=32, mask=0x20000000, d='cbDOUT_MONITOR_UNIT5 Can monitor unit 5', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='doutopts.monitor_unit_all', format=32, mask=0x3F000000, d='cbDOUT_MONITOR_UNIT_ALL Can monitor ALL units', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='dinpopts', d='digital input options', format='HEX'},
FlagField:new{t='BOOLEAN', n='dinpopts.serialmask', format=32, mask=0x000000FF, d='cbDINP_SERIALMASK Bit mask used to detect RS232 Serial Baud Rates', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.baud2400', format=32, mask=0x00000001, d='cbDINP_BAUD2400 RS232 Serial Port operates at 2400 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.baud9600', format=32, mask=0x00000002, d='cbDINP_BAUD9600 RS232 Serial Port operates at 9600 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.baud19200', format=32, mask=0x00000004, d='cbDINP_BAUD19200 RS232 Serial Port operates at 19200 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.baud38400', format=32, mask=0x00000008, d='cbDINP_BAUD38400 RS232 Serial Port operates at 38400 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.baud57600', format=32, mask=0x00000010, d='cbDINP_BAUD57600 RS232 Serial Port operates at 57600 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.baud115200', format=32, mask=0x00000020, d='cbDINP_BAUD115200 RS232 Serial Port operates at 115200 (n-8-1)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.1bit', format=32, mask=0x00000100, d='cbDINP_1BIT Port has a single input bit (eg single BNC input)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.8bit', format=32, mask=0x00000200, d='cbDINP_8BIT Port has 8 input bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.16bit', format=32, mask=0x00000400, d='cbDINP_16BIT Port has 16 input bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.32bit', format=32, mask=0x00000800, d='cbDINP_32BIT Port has 32 input bits', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.anybit', format=32, mask=0x00001000, d='cbDINP_ANYBIT Capture the port value when any bit changes.', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.wrdstrb', format=32, mask=0x00002000, d='cbDINP_WRDSTRB Capture the port when a word-write line is strobed', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.pktchar', format=32, mask=0x00004000, d='cbDINP_PKTCHAR Capture packets using an End of Packet Character', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.pktstrb', format=32, mask=0x00008000, d='cbDINP_PKTSTRB Capture packets using an End of Packet Logic Input', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.monitor', format=32, mask=0x00010000, d='cbDINP_MONITOR Port controls other ports or system events', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.redge', format=32, mask=0x00020000, d='cbDINP_REDGE Capture the port value when any bit changes lo-2-hi (rising edge)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.fedge', format=32, mask=0x00040000, d='cbDINP_FEDGE Capture the port value when any bit changes hi-2-lo (falling edge)', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.strbany', format=32, mask=0x00080000, d='cbDINP_STRBANY Capture packets using 8-bit strobe/8-bit any Input', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.strbris', format=32, mask=0x00100000, d='cbDINP_STRBRIS Capture packets using 8-bit strobe/8-bit rising edge Input', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='dinpopts.strbfal', format=32, mask=0x00200000, d='cbDINP_STRBFAL Capture packets using 8-bit strobe/8-bit falling edge Input', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='aoutopts', d='analog output options', format='HEX'},
FlagField:new{t='BOOLEAN', n='aoutopts.audio', format=32, mask=0x00000001, d='cbAOUT_AUDIO Channel is physically optimized for audio output', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.scale', format=32, mask=0x00000002, d='cbAOUT_SCALE Output a static value', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.track', format=32, mask=0x00000004, d='cbAOUT_TRACK Output a static value', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.static', format=32, mask=0x00000008, d='cbAOUT_STATIC Output a static value', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.monitorraw', format=32, mask=0x00000010, d='cbAOUT_MONITORRAW Monitor an analog signal line - RAW data', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.monitorlnc', format=32, mask=0x00000020, d='cbAOUT_MONITORLNC Monitor an analog signal line - Line Noise Cancelation', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.monitorsmp', format=32, mask=0x00000040, d='cbAOUT_MONITORSMP Monitor an analog signal line - Continuous', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.monitorspk', format=32, mask=0x00000080, d='cbAOUT_MONITORSPK Monitor an analog signal line - spike', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.stimulate', format=32, mask=0x00000100, d='cbAOUT_STIMULATE Stimulation waveform functions are available.', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.waveform', format=32, mask=0x00000200, d='cbAOUT_WAVEFORM Custom Waveform', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='aoutopts.extension', format=32, mask=0x00000400, d='cbAOUT_EXTENSION Output Waveform from Extension', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='eopchar', format='HEX'},
PktField:new{t='UINT16', n='moninst', format='HEX'},
PktField:new{t='UINT16', n='monchan', format='HEX'},
PktField:new{t='INT32', n='outvalue'},
PktField:new{t='UINT8', n='trigtype'},
-- Not sure when the next 2 lines were added to protocol. 4.0 or 4.11.
-- If this breaks 4.0 then delete the next 2 lines.
PktField:new{t='UINT16', n='reserved'},
PktField:new{t='UINT8', n='triginst'},
PktField:new{t='UINT16', n='trigchan'},
PktField:new{t='UINT16', n='trigval'},
PktField:new{t='UINT32', n='ainpopts', d='analog input options', format='HEX'},
FlagField:new{t='BOOLEAN', n='ainpopts.rawpreview', format=32, mask=0x00000001, d='cbAINP_RAWPREVIEW Generate scrolling preview data for the raw channel', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.lnc', format=32, mask=0x00000002, d='cbAINP_LNC Line Noise Cancellation', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.lncpreview', format=32, mask=0x00000004, d='cbAINP_LNCPREVIEW Retrieve the LNC correction waveform', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.smpstream', format=32, mask=0x00000010, d='cbAINP_SMPSTREAM stream the analog input stream directly to disk', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.smpfilter', format=32, mask=0x00000020, d='cbAINP_SMPFILTER Digitally filter the analog input stream', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.rawstream', format=32, mask=0x00000040, d='cbAINP_RAWSTREAM Raw data stream available', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.spkstream', format=32, mask=0x00000100, d='cbAINP_SPKSTREAM Spike Stream is available', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.spkfilter', format=32, mask=0x00000200, d='cbAINP_SPKFILTER Selectable Filters', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.spkpreview', format=32, mask=0x00000400, d='cbAINP_SPKPREVIEW Generate scrolling preview of the spike channel', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.spkproc', format=32, mask=0x00000800, d='cbAINP_SPKPROC Channel is able to do online spike processing', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='ainpopts.offset_cor', format=32, mask=0x00001000, d='cbAINP_OFFSET_CORRECT_CAP Offset correction mode (0-disabled 1-enabled)', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='lncrate'},
PktField:new{t='UINT32', n='smpfilter'},
PktField:new{t='UINT32', n='smpgroup'},
PktField:new{t='INT32', n='smpdispmin'},
PktField:new{t='INT32', n='smpdispmax'},
PktField:new{t='UINT32', n='spkfilter'},
PktField:new{t='INT32', n='spkdispmax'},
PktField:new{t='INT32', n='lncdispmax'},
PktField:new{t='UINT32', n='spkopts', d='spike options', format='HEX'},
FlagField:new{t='BOOLEAN', n='spkopts.extract', format=32, mask=0x00000001, d='cbAINPSPK_EXTRACT time-stamp and packet to first superthreshold peak', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.rejart', format=32, mask=0x00000002, d='cbAINPSPK_REJART Reject around clipped signals on multiple channels', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.rejclip', format=32, mask=0x00000004, d='cbAINPSPK_REJCLIP Reject clipped signals on the channel', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.alignpk', format=32, mask=0x00000008, d='cbAINPSPK_ALIGNPK', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.rejampl', format=32, mask=0x00000010, d='cbAINPSPK_REJAMPL Reject based on amplitude', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.thrlevel', format=32, mask=0x00000100, d='cbAINPSPK_THRLEVEL Analog level threshold detection', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.threnergy', format=32, mask=0x00000200, d='cbAINPSPK_THRENERGY Energy threshold detection', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.thrauto', format=32, mask=0x00000400, d='cbAINPSPK_THRAUTO Auto threshold detection', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.spreadsort', format=32, mask=0x00001000, d='cbAINPSPK_SPREADSORT Enable auto spread sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.corrsort', format=32, mask=0x00002000, d='cbAINPSPK_CORRSORT Enable auto histogram correlation sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.peakmajsort', format=32, mask=0x00004000, d='cbAINPSPK_PEAKMAJSORT Enable auto histogram peak major sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.peakfishsort', format=32, mask=0x00008000, d='cbAINPSPK_PEAKFISHSORT Enable auto histogram peak fisher sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.hoopsort', format=32, mask=0x00010000, d='cbAINPSPK_HOOPSORT Enable manual hoop sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.pcamansort', format=32, mask=0x00020000, d='cbAINPSPK_PCAMANSORT Enable manual PCA sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.pcakmeansort', format=32, mask=0x00040000, d='cbAINPSPK_PCAKMEANSORT Enable k-means PCA sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.pcaemsort', format=32, mask=0x00080000, d='cbAINPSPK_PCAEMSORT Enable EM-clustering PCA sorting', valuestring={'yes', 'no'}},
FlagField:new{t='BOOLEAN', n='spkopts.pcadbsort', format=32, mask=0x00100000, d='cbAINPSPK_PCADBSORT Enable DBSCAN PCA sorting', valuestring={'yes', 'no'}},
PktField:new{t='INT32', n='spkthrlevel'},
PktField:new{t='INT32', n='spkthrlimit'},
PktField:new{t='UINT32', n='spkgroup'},
PktField:new{t='INT16', n='amplrejpos'},
PktField:new{t='INT16', n='amplrejneg'},
PktField:new{t='UINT32', n='refelecchan'},
AField:new{n='placeholder', d='→ Other fields [unitmapping, spkhoops] of this packet have not been implemented yet. ←'},
_types={
[0x40] = "cbPKTTYPE_CHANREP",
[0x41] = "cbPKTTYPE_CHANREPLABEL",
[0x42] = "cbPKTTYPE_CHANREPSCALE",
[0x43] = "cbPKTTYPE_CHANREPDOUT",
[0x44] = "cbPKTTYPE_CHANREPDINP",
[0x45] = "cbPKTTYPE_CHANREPAOUT",
[0x46] = "cbPKTTYPE_CHANREPDISP",
[0x47] = "cbPKTTYPE_CHANREPAINP",
[0x48] = "cbPKTTYPE_CHANREPSMP",
[0x49] = "cbPKTTYPE_CHANREPSPK",
[0x4A] = "cbPKTTYPE_CHANREPSPKTHR",
[0x4B] = "cbPKTTYPE_CHANREPSPKHPS",
[0x4C] = "cbPKTTYPE_CHANREPUNITOVERRIDES",
[0x4D] = "cbPKTTYPE_CHANREPNTRODEGROUP",
[0x4E] = "cbPKTTYPE_CHANREPREJECTAMPLITUDE",
[0x4F] = "cbPKTTYPE_CHANREPAUTOTHRESHOLD",
[0xC0] = "cbPKTTYPE_CHANSET",
[0xC1] = "cbPKTTYPE_CHANSETLABEL",
[0xC2] = "cbPKTTYPE_CHANSETSCALE",
[0xC3] = "cbPKTTYPE_CHANSETDOUT",
[0xC4] = "cbPKTTYPE_CHANSETDINP",
[0xC5] = "cbPKTTYPE_CHANSETAOUT",
[0xC6] = "cbPKTTYPE_CHANSETDISP",
[0xC7] = "cbPKTTYPE_CHANSETAINP",
[0xC8] = "cbPKTTYPE_CHANSETSMP",
[0xC9] = "cbPKTTYPE_CHANSETSPK",
[0xCA] = "cbPKTTYPE_CHANSETSPKTHR",
[0xCB] = "cbPKTTYPE_CHANSETSPKHPS",
[0xCC] = "cbPKTTYPE_CHANSETUNITOVERRIDES",
[0xCD] = "cbPKTTYPE_CHANSETNTRODEGROUP",
[0xCE] = "cbPKTTYPE_CHANSETREJECTAMPLITUDE",
[0xCF] = "cbPKTTYPE_CHANSETAUTOTHRESHOLD",
}
}
)
-- File Config Information Packets
local CbPktFileCfg = CbPktConfig:new('cbPKT_FILECFG',
{
PktField:new{t='UINT32', n='options', d='File Config Option', format='HEX', valuestring={
[0x00]="Launch File dialog, set file info, start or stop recording cbFILECFG_OPT_NONE",
[0x01]="Keep-alive message cbFILECFG_OPT_KEEPALIVE",
[0x02]="Recording is in progress cbFILECFG_OPT_REC",
[0x03]="Recording stopped cbFILECFG_OPT_STOP",
[0x04]="NeuroMotive recording status cbFILECFG_OPT_NMREC",
[0x05]="Close file application cbFILECFG_OPT_CLOSE",
[0x06]="Recording datetime cbFILECFG_OPT_SYNCH",
[0x07]="Launch File dialog, do not set or do anything cbFILECFG_OPT_OPEN",
}},
-- FlagField:new{t='BOOLEAN', n='options.keepalive', format=32, mask=0x00000001, d='Keep-alive message cbFILECFG_OPT_KEEPALIVE', valuestring={'yes', 'no'}},
-- FlagField:new{t='BOOLEAN', n='options.rec', format=32, mask=0x00000002, d='Recording is in progress cbFILECFG_OPT_REC', valuestring={'yes', 'no'}},
-- FlagField:new{t='BOOLEAN', n='options.stop', format=32, mask=0x00000002, d='Recording is in progress cbFILECFG_OPT_REC', valuestring={'yes', 'no'}},
PktField:new{t='UINT32', n='duration', format='DEC'},
PktField:new{t='UINT32', n='recording', d='If cbFILECFG_OPT_NONE this option starts/stops recording remotely', format='HEX'},
PktField:new{t='UINT32', n='extctrl', d='If cbFILECFG_OPT_REC this is split number (0 for non-TOC). If cbFILECFG_OPT_STOP this is error code.', format='DEC_HEX'},
PktField:new{t='STRING', n='username', len=256},
PktField:new{t='STRING', n='filename', len=256},
PktField:new{t='STRING', n='comment', len=256, d='Comment or Datetime'},
_types={
[0x61] = "File Config response cbPKTTYPE_REPFILECFG",
[0xE1] = "File Config request cbPKTTYPE_SETFILECFG",
}
}
)
-- Config All packet
local CbPktConfigAll = CbPktConfig:new('cbPKT_CONFIGALL', {_types={
[0x08] = "Config All Report cbPKTTYPE_REPCONFIGALL",
[0x88] = "Config All Request cbPKTTYPE_REQCONFIGALL",
}})
-- Options for noise boundary packets
local CbPktSSNoiseBoundary = CbPktConfig:new('cbPKT_SS_NOISE_BOUNDARY',
{
PktField:new{t='UINT32', n='chan', d='channel being configured', format='DEC'},
PktField:new{t='FLOAT', n='afc', len=3, d='Center of ellipsoid'},
PktField:new{t='FLOAT', n='afS', len=9, d='Ellipsoid axes'},
_types={
[0x54] = "Noise boundary Report cbPKTTYPE_SS_NOISE_BOUNDARYREP",
[0xD4] = "Noise boundary Request cbPKTTYPE_SS_NOISE_BOUNDARYSET",
}
}
)
-- SS Statistics packets
local CbPktSSStatistics = CbPktConfig:new('cbPKT_SS_STATISTICS',
{
PktField:new{t='UINT32', n='nUpdateSpikes', d='update rate in spike counts', format='DEC'},
PktField:new{t='UINT32', n='nAutoalg', d='Sorting Algorithm', format='HEX', valuestring={
[0x00]="No sorting cbAUTOALG_NONE",
[0x01]="Auto spread cbAUTOALG_SPREAD",
[0x02]="Auto Hist Correlation cbAUTOALG_HIST_CORR_MAJ",
[0x03]="Auto Hist Peak Maj cbAUTOALG_HIST_PEAK_COUNT_MAJ",
[0x04]="Auto Hist Peak Fish cbAUTOALG_HIST_PEAK_COUNT_FISH",
[0x05]="Manual PCA cbAUTOALG_PCA",
[0x06]="Manual Hoops cbAUTOALG_HOOPS",
[0x07]="K-means PCA cbAUTOALG_PCA_KMEANS",
[0x08]="EM-clustering PCA cbAUTOALG_PCA_EM",
[0x09]="DBSCAN PCA cbAUTOALG_PCA_DBSCAN",
}},
PktField:new{t='UINT32', n='nMode', d='command to change sorting parameters', format='HEX', valuestring={
[0x00]="Change the settings and leave sorting the same cbAUTOALG_MODE_SETTING",
[0x01]="Change settings and apply this sorting to all channels cbAUTOALG_MODE_APPLY",
}},
PktField:new{t='FLOAT', n='fMinClusterPairSpreadFactor'},
PktField:new{t='FLOAT', n='fMaxSubclusterSpreadFactor'},
PktField:new{t='FLOAT', n='fMinClusterHistCorrMajMeasure'},
PktField:new{t='FLOAT', n='fMaxClusterPairHistCorrMajMeasure'},
PktField:new{t='FLOAT', n='fClusterHistValleyPercentage'},
PktField:new{t='FLOAT', n='fClusterHistClosePeakPercentage'},
PktField:new{t='FLOAT', n='fClusterHistMinPeakPercentage'},
PktField:new{t='UINT32', n='nWaveBasisSize', d='number of wave to collect to calculate the basis', format='DEC'},
PktField:new{t='UINT32', n='nWaveSampleSize', d='number of samples sorted with the same basis before re-calculating the basis', format='DEC'},
_types={
[0x55] = "SS Statistics Report cbPKTTYPE_SS_STATISTICSREP",
[0xD5] = "SS Statistics Request cbPKTTYPE_SS_STATISTICSSET",
}
}
)
-- SS Status packets
local CbPktSSStatus = CbPktConfig:new('cbPKT_SS_STATUS',
{
AField:new{n='cntlUnitStats'},
PktField:new{t='UINT32', n='cntlUnitStats.nMode', d='nMode', format='HEX', valuestring={
[0x00]="do not adapt at all",
[0x01]="always adapt",
[0x02]="adapt if timer not timed out",
}},
PktField:new{t='FLOAT', n='cntlUnitStats.fTimeOutMinutes', d='how many minutes until time out'},
PktField:new{t='FLOAT', n='cntlUnitStats.fElapsedMinutes', d='amount of time that has elapsed'},
AField:new{n='cntlNumUnits'},
PktField:new{t='UINT32', n='cntlNumUnits.nMode', d='nMode', format='HEX', valuestring={
[0x00]="do not adapt at all",
[0x01]="always adapt",
[0x02]="adapt if timer not timed out",
}},
PktField:new{t='FLOAT', n='cntlNumUnits.fTimeOutMinutes', d='how many minutes until time out'},
PktField:new{t='FLOAT', n='cntlNumUnits.fElapsedMinutes', d='amount of time that has elapsed'},
_types={
[0x57] = "SS Status Report cbPKTTYPE_SS_STATUSREP",
[0xD7] = "SS Status Request cbPKTTYPE_SS_STATUSSET",
}
}
)
-- SS Recalc packets
local CbPktSSRecalc = CbPktConfig:new('cbPKT_SS_RECALC',
{
PktField:new{t='UINT32', n='chan',format='DEC', d="Channel (1-based). If 0, perform for all"},
PktField:new{t='UINT32', n='mode', d='mode', format='HEX', valuestring={
[0]="PC ->NSP start recalculation cbPCA_RECALC_START",
[1]="NSP->PC finished recalculation cbPCA_RECALC_STOPPED",
[2]="NSP->PC waveform collection started cbPCA_COLLECTION_STARTED",
[3]="Change the basis of feature space cbBASIS_CHANGE",
[4]="cbUNDO_BASIS_CHANGE",
[5]="cbREDO_BASIS_CHANGE",
[6]="cbINVALIDATE_BASIS",
}},
_types={
[0x59] = "SS Recalc Report cbPKTTYPE_SS_RECALCREP",
[0xD9] = "SS Recalc Request cbPKTTYPE_SS_RECALCSET",
}
}
)
-- Feature Space Basis Packets
local CbPktFSBasis = CbPktConfig:new('cbPKT_FS_BASIS',
{
PktField:new{t='UINT32', n='chan',format='DEC', d="Channel (1-based)"},
PktField:new{t='UINT32', n='mode', d='mode', format='HEX', valuestring={
[0]="PC ->NSP start recalculation cbPCA_RECALC_START",
[1]="NSP->PC finished recalculation cbPCA_RECALC_STOPPED",
[2]="NSP->PC waveform collection started cbPCA_COLLECTION_STARTED",
[3]="Change the basis of feature space cbBASIS_CHANGE",
[4]="cbUNDO_BASIS_CHANGE",
[5]="cbREDO_BASIS_CHANGE",
[6]="cbINVALIDATE_BASIS",
}},
PktField:new{t='UINT32', n='fs',format='DEC', d="Feature space: cbAUTOALG_PCA"},
PktField:new{t='FLOAT', n='basis', d='Room for all possible points collected'},
AField:new{n='notImpl', d="→ Variable number of points not imlpemented ←"},
_types={
[0x5B] = "FS Basis Report cbPKTTYPE_FS_BASISREP",
[0xDB] = "FS Basis Request cbPKTTYPE_FS_BASISSET",
}
}
)
-- Sample Group Information packets
local CbPktGroupInfo = CbPktConfig:new('cbPKT_GROUPINFO',
{
PktField:new{t='UINT32', n='proc',format='DEC'},
PktField:new{t='UINT32', n='group',format='DEC'},
PktField:new{t='STRING', n='label', len=cbConst.cbLEN_STR_LABEL},
PktField:new{t='UINT32', n='period', d='Sampling Period', format='DEC'},
PktField:new{t='UINT32', n='length', format='DEC'},
PktField:new{t='UINT32', n='list', lf='length', d='channelList'},
_types={
[0x30] = "Sample Group Report cbPKTTYPE_GROUPREP",
[0xB0] = "Sample Group Request cbPKTTYPE_GROUPSET",
}
}
)
-- Processor Information packets
local CbPktProcInfo = CbPktConfig:new('cbPKT_PROCINFO',
{
PktField:new{t='UINT32', n='proc',format='DEC'},
PktField:new{t='UINT32', n='idcode', format='DEC_HEX', d='Manufacturer ID'},
PktField:new{t='STRING', n='ident', len=cbConst.cbLEN_STR_IDENT},
PktField:new{t='UINT32', n='chanbase',format='DEC'},
PktField:new{t='UINT32', n='chancount',format='DEC'},
PktField:new{t='UINT32', n='bankcount',format='DEC'},
PktField:new{t='UINT32', n='groupcount',format='DEC'},
PktField:new{t='UINT32', n='filtcount',format='DEC'},
PktField:new{t='UINT32', n='sortcount',format='DEC'},
PktField:new{t='UINT32', n='unitcount',format='DEC'},
PktField:new{t='UINT32', n='hoopcount',format='DEC'},
PktField:new{t='UINT32', n='sortmethod',format='DEC', valuestring={[0]='manual', [1]='auto'}},
PktField:new{t='UINT32', n='version',format='DEC'},
_types={
[0x21] = "Proc Report cbPKTTYPE_PROCREP",
}})
-- Bank Information packets
local CbPktBankInfo = CbPktConfig:new('cbPKT_BANKINFO',
{
PktField:new{t='UINT32', n='proc',format='DEC'},
PktField:new{t='UINT32', n='bank',format='DEC'},
PktField:new{t='UINT32', n='idcode', format='DEC_HEX', d='Manufacturer ID'},
PktField:new{t='STRING', n='ident', len=cbConst.cbLEN_STR_IDENT},
PktField:new{t='STRING', n='label', len=cbConst.cbLEN_STR_LABEL},
PktField:new{t='UINT32', n='chanbase',format='DEC'},
PktField:new{t='UINT32', n='chancount',format='DEC'},
_types={
[0x22] = "Bank Report cbPKTTYPE_BANKREP",
}
}
)
-- Filter (FILT) Information packets
local CbPktFiltInfo = CbPktConfig:new('cbPKT_FILTINFO',
{
PktField:new{t='UINT32', n='proc',format='DEC'},
PktField:new{t='UINT32', n='filt',format='DEC'},
PktField:new{t='STRING', n='label', len=cbConst.cbLEN_STR_FILT_LABEL},
AField:new{n='hp', d='High-pass filter'},
PktField:new{t='UINT32', n='hp.hpfreq', d='Corner freq in mHz', format='DEC'},
PktField:new{t='UINT32', n='hp.hporder', d='Filter order', format='DEC'},
PktField:new{t='UINT32', n='hp.hptype', d='Filter type', format='HEX'},
FlagField:new{t='BOOLEAN', n='hp.hptype.physical', format=32, mask=0x00000001, d='Physical cbFILTTYPE_PHYSICAL', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='hp.hptype.digital', format=32, mask=0x00000002, d='Digital cbFILTTYPE_DIGITAL', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='hp.hptype.adaptive', format=32, mask=0x00000004, d='Adaptive cbFILTTYPE_ADAPTIVE', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='hp.hptype.nonlinear', format=32, mask=0x00000008, d='Nonlinear cbFILTTYPE_NONLINEAR', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='hp.hptype.butter', format=32, mask=0x00000100, d='Butterworth cbFILTTYPE_BUTTERWORTH', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='hp.hptype.cheb', format=32, mask=0x00000200, d='Chebychev cbFILTTYPE_CHEBYCHEV', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='hp.hptype.bessel', format=32, mask=0x00000400, d='Bessel cbFILTTYPE_BESSEL', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='hp.hptype.elliptical', format=32, mask=0x00000800, d='Elliptical cbFILTTYPE_ELLIPTICAL', valuestring={'yes','no'}},
AField:new{n='lp', d='Low-pass filter'},
PktField:new{t='UINT32', n='lp.lpfreq', d='Corner freq in mHz', format='DEC'},
PktField:new{t='UINT32', n='lp.lporder', d='Filter order', format='DEC'},
PktField:new{t='UINT32', n='lp.lptype', d='Filter type', format='HEX'},
FlagField:new{t='BOOLEAN', n='lp.lptype.physical', format=32, mask=0x00000001, d='Physical cbFILTTYPE_PHYSICAL', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='lp.lptype.digital', format=32, mask=0x00000002, d='Digital cbFILTTYPE_DIGITAL', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='lp.lptype.adaptive', format=32, mask=0x00000004, d='Adaptive cbFILTTYPE_ADAPTIVE', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='lp.lptype.nonlinear', format=32, mask=0x00000008, d='Nonlinear cbFILTTYPE_NONLINEAR', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='lp.lptype.butter', format=32, mask=0x00000100, d='Butterworth cbFILTTYPE_BUTTERWORTH', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='lp.lptype.cheb', format=32, mask=0x00000200, d='Chebychev cbFILTTYPE_CHEBYCHEV', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='lp.lptype.bessel', format=32, mask=0x00000400, d='Bessel cbFILTTYPE_BESSEL', valuestring={'yes','no'}},
FlagField:new{t='BOOLEAN', n='lp.lptype.elliptical', format=32, mask=0x00000800, d='Elliptical cbFILTTYPE_ELLIPTICAL', valuestring={'yes','no'}},
PktField:new{t='DOUBLE', n='sos1a1'},
PktField:new{t='DOUBLE', n='sos1a2'},
PktField:new{t='DOUBLE', n='sos1b1'},
PktField:new{t='DOUBLE', n='sos1b2'},
PktField:new{t='DOUBLE', n='sos2a1'},
PktField:new{t='DOUBLE', n='sos2a2'},
PktField:new{t='DOUBLE', n='sos2b1'},
PktField:new{t='DOUBLE', n='sos2b2'},
PktField:new{t='DOUBLE', n='sos1a1'},
_types={
[0x23] = "Filter Report cbPKTTYPE_FILTREP",
[0xA3] = "Filter Request cbPKTTYPE_FILTSET",