[r3531]: branches / Gxsm-2x3-transition-sig / plug-ins / hard / MK3-A810_spmcontrol / python_scripts / mk3_spmcontol_class.py  Maximize  Restore  History

Download this file

1406 lines (1210 with data), 58.0 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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
#!/usr/bin/env python
## * Python User Control for
## * Configuration and SPM Approach Control tool for the FB_spm DSP program/GXSM2 Mk3-Pro/A810 based
## * for the Signal Ranger STD/SP2 DSP board
## *
## * Copyright (C) 2010-13 Percy Zahl
## *
## * Author: Percy Zahl <zahl@users.sf.net>
## * WWW Home: http://sranger.sf.net
## *
## * This program is free software; you can redistribute it and/or modify
## * it under the terms of the GNU General Public License as published by
## * the Free Software Foundation; either version 2 of the License, or
## * (at your option) any later version.
## *
## * This program is distributed in the hope that it will be useful,
## * but WITHOUT ANY WARRANTY; without even the implied warranty of
## * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## * GNU General Public License for more details.
## *
## * You should have received a copy of the GNU General Public License
## * along with this program; if not, write to the Free Software
## * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
version = "2.1.0"
import os # use os because python IO is bugy
import time
import fcntl
#import GtkExtra
import struct
import array
import math
import re
from numpy import *
NUM_MONITOR_SIGNALS = 20
#################################################################################################
## insert/include/update dsp_signals.py file here -- may insert code her directly for portability
## update:
## sed -f dspsig2py.sed ../dsp_signals.h > dsp_signals.py
## put converted C structures here -----
##
#/* SRanger and Gxsm - Gnome X Scanning Microscopy Project
#* universal STM/AFM/SARLS/SPALEED/... controlling and
#* data analysis software
#*
#* DSP tools for Linux
#*
#* Copyright (C) 2014 Percy Zahl
#*
#* Authors: Percy Zahl <zahl@users.sf.net>
#* WWW Home:
#* DSP part: http:##sranger.sf.net
#* Gxsm part: http:##gxsm.sf.net
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation; either version 2 of the License", or
#* (at your option) any later version.
#*
#* This program is distributed in the hope that it will be useful",
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not", write to the Free Software
#* Foundation", Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#*/
#/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
#/* SRanger and Gxsm - Gnome X Scanning Microscopy Project
#* universal STM/AFM/SARLS/SPALEED/... controlling and
#* data analysis software
#*
#* DSP tools for Linux
#*
#* Copyright (C) 2014 Percy Zahl
#*
#* Authors: Percy Zahl <zahl@users.sf.net>
#* WWW Home:
#* DSP part: http:##sranger.sf.net
#* Gxsm part: http:##gxsm.sf.net
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation; either version 2 of the License", or
#* (at your option) any later version.
#*
#* This program is distributed in the hope that it will be useful",
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not", write to the Free Software
#* Foundation", Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#*/
#/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
#/**
# * CAUTION: DO NOT CHANGE FORMAT CONVENTIONS -- MUST MATCH SED SCRIPT TO CONVERT INTO PYTHON
#**/
#/**
# * Signal Input management ID's for safe DSP based signal pointer adjustment methods.
# * And special command ID's for FLASH store/restore/erase (no defaults", only fixed power up fallback):
#**/
DSP_SIGNAL_NULL_POINTER_REQUEST_ID = 0xfe01
DSP_SIGNAL_TABLE_STORE_TO_FLASH_ID = 0xf001
DSP_SIGNAL_TABLE_RESTORE_FROM_FLASH_ID = 0xf002
DSP_SIGNAL_TABLE_ERASE_FLASH_ID = 0xf0ee
DSP_SIGNAL_TABLE_SEEKRW_FLASH_ID = 0xf0e0
DSP_SIGNAL_TABLE_READ_FLASH_ID = 0xf0e1
DSP_SIGNAL_TABLE_WRITE_FLASH_ID = 0xf0e2
DSP_SIGNAL_TABLE_TEST0_FLASH_ID = 0xf0e7
DSP_SIGNAL_TABLE_TEST1_FLASH_ID = 0xf0e8
#/**
# * Signal Input ID's for safe DSP based signal pointer adjustment methods
#**/
DSP_SIGNAL_MONITOR_INPUT_BASE_ID = 0x0000
DSP_SIGNAL_BASE_BLOCK_A_ID = 0x1000
DSP_SIGNAL_Z_SERVO_INPUT_ID = (DSP_SIGNAL_BASE_BLOCK_A_ID+1)
DSP_SIGNAL_M_SERVO_INPUT_ID = (DSP_SIGNAL_Z_SERVO_INPUT_ID+1)
DSP_SIGNAL_MIXER0_INPUT_ID = (DSP_SIGNAL_M_SERVO_INPUT_ID+1)
DSP_SIGNAL_MIXER1_INPUT_ID = (DSP_SIGNAL_MIXER0_INPUT_ID+1)
DSP_SIGNAL_MIXER2_INPUT_ID = (DSP_SIGNAL_MIXER1_INPUT_ID+1)
DSP_SIGNAL_MIXER3_INPUT_ID = (DSP_SIGNAL_MIXER2_INPUT_ID+1)
DSP_SIGNAL_DIFF_IN0_ID = (DSP_SIGNAL_MIXER3_INPUT_ID+1)
DSP_SIGNAL_DIFF_IN1_ID = (DSP_SIGNAL_DIFF_IN0_ID+1)
DSP_SIGNAL_DIFF_IN2_ID = (DSP_SIGNAL_DIFF_IN1_ID+1)
DSP_SIGNAL_DIFF_IN3_ID = (DSP_SIGNAL_DIFF_IN2_ID+1)
DSP_SIGNAL_BASE_BLOCK_B_ID = 0x2000
DSP_SIGNAL_LOCKIN_A_INPUT_ID = (DSP_SIGNAL_BASE_BLOCK_B_ID+1)
DSP_SIGNAL_LOCKIN_B_INPUT_ID = (DSP_SIGNAL_LOCKIN_A_INPUT_ID+1)
DSP_SIGNAL_VECPROBE0_INPUT_ID = (DSP_SIGNAL_LOCKIN_B_INPUT_ID+1)
DSP_SIGNAL_VECPROBE1_INPUT_ID = (DSP_SIGNAL_VECPROBE0_INPUT_ID+1)
DSP_SIGNAL_VECPROBE2_INPUT_ID = (DSP_SIGNAL_VECPROBE1_INPUT_ID+1)
DSP_SIGNAL_VECPROBE3_INPUT_ID = (DSP_SIGNAL_VECPROBE2_INPUT_ID+1)
DSP_SIGNAL_VECPROBE0_CONTROL_ID = (DSP_SIGNAL_VECPROBE3_INPUT_ID+1)
DSP_SIGNAL_VECPROBE1_CONTROL_ID = (DSP_SIGNAL_VECPROBE0_CONTROL_ID+1)
DSP_SIGNAL_VECPROBE2_CONTROL_ID = (DSP_SIGNAL_VECPROBE1_CONTROL_ID+1)
DSP_SIGNAL_VECPROBE3_CONTROL_ID = (DSP_SIGNAL_VECPROBE2_CONTROL_ID+1)
DSP_SIGNAL_BASE_BLOCK_C_ID = 0x3000
DSP_SIGNAL_OUTMIX_CH0_INPUT_ID = (DSP_SIGNAL_BASE_BLOCK_C_ID+1)
DSP_SIGNAL_OUTMIX_CH0_ADD_A_INPUT_ID = (DSP_SIGNAL_OUTMIX_CH0_INPUT_ID+1)
DSP_SIGNAL_OUTMIX_CH0_SUB_B_INPUT_ID = (DSP_SIGNAL_OUTMIX_CH0_ADD_A_INPUT_ID+1)
DSP_SIGNAL_OUTMIX_CH0_SMAC_A_INPUT_ID = (DSP_SIGNAL_OUTMIX_CH0_SUB_B_INPUT_ID+1)
DSP_SIGNAL_OUTMIX_CH0_SMAC_B_INPUT_ID = (DSP_SIGNAL_OUTMIX_CH0_SMAC_A_INPUT_ID+1)
DSP_SIGNAL_OUTMIX_CH1_INPUT_ID = (DSP_SIGNAL_OUTMIX_CH0_SMAC_B_INPUT_ID+1)
DSP_SIGNAL_OUTMIX_CH1_ADD_A_INPUT_ID = (DSP_SIGNAL_O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AL_ADJUST_NEGID_ERROR = -2
DSP_SIGNAL_ADJUST_INVALIDID_ERROR = -3
DSP_SIGNAL_ADJUST_INVALID_SIGNAL_ERROR = -5
DSP_SIGNAL_ADJUST_INVALID_SIGNAL_INPUT_ERROR = -6
DSP_SIGNAL_TABLE_STORE_TO_FLASH_WRITE_ERROR = -2
DSP_SIGNAL_TABLE_RESTORE_FROM_FLASH_READ_ERROR = -3
DSP_SIGNAL_TABLE_RESTORE_FROM_FLASH_FLASH_BLOCKID_ERROR = -10
DSP_SIGNAL_TABLE_RESTORE_FROM_FLASH_VERSION_MISMATCH_ERROR = -11
DSP_SIGNAL_TABLE_RESTORE_FROM_FLASH_SIGNAL_LIST_VERSION_MISMATCH = -12
DSP_SIGNAL_TABLE_RESTORE_FROM_FLASH_INPUT_LIST_VERSION_MISMATCH = -13
DSP_SIGNAL_TABLE_RESTORE_FROM_FLASH_FLASH_DATE_WARNING = -20
#/**
#* Signal pointers and description table for RT signal handling", stored in ext. DRAM on DSP in stripped version
#**/
DSP32Qs15dot16TOV = (10.0/(32767.*(1<<16)))
DSP32Qs15dot16TO_Volt = (10.0/(32767.*(1<<16)))
DSP32Qs15dot0TO_Volt = (10.0/32767.)
DSP32Qs23dot8TO_Volt = (10.0/(32767.*(1<<8)))
def CPN(N):
return ((1<<(N))-1.)
NUM_SIGNALS = 73
FB_SPM_FLASHBLOCK_XIDENTIFICATION_A = 0x10aa
FB_SPM_FLASHBLOCK_XIDENTIFICATION_B = 0x0001
FB_SPM_SIGNAL_LIST_VERSION = 0x0001
FB_SPM_SIGNAL_INPUT_VERSION = 0x0001
MAX_INPUT_NUMBER_LIMIT = 0x100 ## just a safey limit for FLASH storage
SIGNAL_LOOKUP = [
[0, 99, "analog.in[0]", "In 0", "V", DSP32Qs15dot16TO_Volt, "Analog_IN"], ## DSP_SIG IN[0..7]; // ADC IN0-7 MUST BE FIRST IN THIS LIST!!!
[0, 99, "analog.in[1]", "In 1", "V", DSP32Qs15dot16TO_Volt, "Analog_IN"], ## DSP_SIG IN[0..7]; // ADC IN0-7 ..
[0, 99, "analog.in[2]", "In 2", "V", DSP32Qs15dot16TO_Volt, "Analog_IN"], ## DSP_SIG IN[0..7]; // ADC IN0-7
[0, 99, "analog.in[3]", "In 3", "V", DSP32Qs15dot16TO_Volt, "Analog_IN"], ## DSP_SIG IN[0..7]; // ADC IN0-7
[0, 99, "analog.in[4]", "In 4", "V", DSP32Qs15dot16TO_Volt, "Analog_IN"], ## DSP_SIG IN[0..7]; // ADC IN0-7
[0, 99, "analog.in[5]", "In 5", "V", DSP32Qs15dot16TO_Volt, "Analog_IN"], ## DSP_SIG IN[0..7]; // ADC IN0-7
[0, 99, "analog.in[6]", "In 6", "V", DSP32Qs15dot16TO_Volt, "Analog_IN"], ## DSP_SIG IN[0..7]; // ADC IN0-7
[0, 99, "analog.in[7]", "In 7", "V", DSP32Qs15dot16TO_Volt, "Analog_IN"], ## DSP_SIG IN[0..7]; // ADC IN0-7 MUST BE at pos 8 IN THIS LIST!!!
[0, 99, "analog.counter[0]", "Counter 0", "CNT", 1, "Counter"], ## DSP_SIG Counter[0,1]; // Counter 0,1
[0, 99, "analog.counter[1]", "Counter 1", "CNT", 1, "Counter"], ## DSP_SIG Counter[0,1]; // Counter 0,1
[0, 99, "probe.LockIn_0A", "LockIn A-0", "*V", DSP32Qs15dot16TO_Volt, "LockIn"], ## DSP_SIG LockInA[0]; // LockIn A 0/1st/2nd
[0, 99, "probe.LockIn_1stA", "LockIn A-1st", "*dV", DSP32Qs15dot16TO_Volt, "LockIn"], ## DSP_SIG LockInA[1]; // LockIn A 0/1st/2nd
[0, 99, "probe.LockIn_2ndA", "LockIn A-2nd", "*ddV", DSP32Qs15dot16TO_Volt, "LockIn"], ## DSP_SIG LockInA[2]; // LockIn A 0/1st/2nd
[0, 99, "probe.LockIn_0B", "LockIn B-0", "*V", DSP32Qs15dot16TO_Volt, "LockIn"], ## DSP_SIG LockInB[0]; // LockIn B 0/1st/2nd
[0, 99, "probe.LockIn_1stB", "LockIn B-1st", "*dV", DSP32Qs15dot16TO_Volt, "LockIn"], ## DSP_SIG LockInB[1]; // LockIn B 0/1st/2nd
[0, 99, "probe.LockIn_2ndB", "LockIn B-2nd", "*ddV", DSP32Qs15dot16TO_Volt, "LockIn"], ## DSP_SIG LockInB[2]; // LockIn B 0/1st/2nd
[0, 99, "probe.LockIn_ref", "LockIn Ref", "V", DSP32Qs15dot16TO_Volt, "LockIn"], ## DSP_SIG LockInMod; // LockIn Modulation (Int. Reference Out)
[0, 99, "probe.PRB_ACPhaseA32","LockIn Phase A","deg", 360./(128.*CPN(19)),"LockIn"], ## DSP_SIG LockInPRB_ACPhaseA;
[0, 99, "InputFiltered", "PLL Res Out", "V", 10e3/CPN(22), "PAC"], ## Resonator Output Signal .... DSP_SIG PAC[0..9] follow
[0, 99, "SineOut0", "PLL Exci Signal", "V", 10e3/CPN(22), "PAC"], ## Excitation Signal
[0, 99, "phase", "PLL Res Ph", "deg", 180./(CPN(22)*math.pi), "PAC"], ## Resonator Phase (no LP filter)
[0, 99, "PI_Phase_Out", "PLL Exci Frq", "Hz", (150000./(CPN(29)*2.*math.pi)), "PAC"], ## Excitation Freq. (no LP filter)
[0, 99, "amp_estimation", "PLL Res Amp", "V", 10e3/CPN(22), "PAC"], ## Resonator Amp. (no LP filter)
[0, 99, "volumeSine", "PLL Exci Amp", "V", 10e3/CPN(22), "PAC"], ## Excitation Amp. (no LP filter)
[0, 99, "Filter64Out[0]", "PLL Exci Frq LP", "Hz", (150000./(CPN(29)*2.*math.pi)), "PAC"], ## Excitation Freq. (with LP filter), ... [0..3]
[0, 99, "Filter64Out[1]", "PLL Res Ph LP", "deg", (180./(CPN(29)*math.pi)), "PAC"], ## Resonator Phase (with LP filter), ... [0..3]
[0, 99, "Filter64Out[2]", "PLL Res Amp LP", "V", (10e3/(CPN(29))), "PAC"], ## Resonator Ampl. (with LP filter), ... [0..3]
[0, 99, "Filter64Out[3]", "PLL Exci Amp LP", "V", (10e3/(CPN(29))), "PAC"], ## Excitation Ampl. (with LP filter), ... [0..3]
[0, 99, "feedback_mixer.FB_IN_processed[0]", "MIX 0", "V", DSP32Qs23dot8TO_Volt, "Mixer"], ## DSP_SIG MIX[0..3]; // Mixer processed input taps
[0, 99, "feedback_mixer.FB_IN_processed[1]", "MIX 1", "V", DSP32Qs23dot8TO_Volt, "Mixer"], ## DSP_SIG MIX[0..3]; // Mixer processed input taps
[0, 99, "feedback_mixer.FB_IN_processed[2]", "MIX 2", "V", DSP32Qs23dot8TO_Volt, "Mixer"], ## DSP_SIG MIX[0..3]; // Mixer processed input taps
[0, 99, "feedback_mixer.FB_IN_processed[3]", "MIX 3", "V", DSP32Qs23dot8TO_Volt, "Mixer"], ## DSP_SIG MIX[0..3]; // Mixer processed input taps
[0, 99, "feedback_mixer.delta", "MIX out delta", "V", DSP32Qs23dot8TO_Volt, "Mixer"], ## DSP_SIG MIX_delta;
[0, 99, "feedback_mixer.q_factor15","MIX0 qfac15 LP", "Q", (1/(CPN(15))), "Mixer"], ## DSP_SIG MIX_0 q LP fg; f in Hz via: (-log (qf15 / 32767.) / (2.*math.pi/75000.))
[0, 99, "analog.avg_signal","signal AVG-256", "V", DSP32Qs15dot0TO_Volt/256., "RMS"], ## DSP_SIG MIX_0 AVG;
[0, 99, "analog.rms_signal","signal RMS-256", "mV^2", (DSP32Qs15dot0TO_Volt/256.)*(DSP32Qs15dot0TO_Volt/256.), "RMS"], ## DSP_SIG MIX_0 RMS;
[0, 99, "z_servo.control", "Z Servo", "V", DSP32Qs15dot16TO_Volt, "Z_Servo"], ## DSP_SIG Z_servo;
[0, 99, "z_servo.neg_control","Z Servo Neg", "V", DSP32Qs15dot16TO_Volt, "Z_Servo"], ## DSP_SIG Z_servo;
[0, 99, "z_servo.watch", "Z Servo Watch", "B", 1, "Z_Servo"], ## DSP_SIG Z_servo watch activity;
[0, 99, "m_servo.control", "M Servo", "V", DSP32Qs15dot16TO_Volt, "M_Servo"], ## DSP_SIG M_servo;
[0, 99, "m_servo.neg_control","M Servo Neg", "V", DSP32Qs15dot16TO_Volt, "M_Servo"], ## DSP_SIG M_servo;
[0, 99, "m_servo.watch", "M Servo Watch", "B", 1, "M_Servo"], ## DSP_SIG M_servo watch activity;
[0, 99, "probe.Upos", "VP Bias", "V", DSP32Qs15dot16TO_Volt, "VP"], ## DSP_SIG VP Bias
[0, 99, "probe.Zpos", "VP Z pos", "V", DSP32Qs15dot16TO_Volt, "VP"], ## DSP_SIG Z_position; // temp Z offset via probing
[0, 99, "scan.xyz_vec[i_X]", "X Scan", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG vec_XY_scan[0];
[0, 99, "scan.xyz_vec[i_Y]", "Y Scan", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG vec_XY_scan[1];
[0, 99, "scan.xyz_vec[i_Z]", "Z Scan Off Slope", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG vec_XY_scan[2];
[0, 99, "scan.xy_r_vec[i_X]", "X Scan Rot", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG vec_XY_scan[0];
[0, 99, "scan.xy_r_vec[i_Y]", "Y Scan Rot", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG vec_XY_scan[1];
[0, 99, "scan.z_offset_xyslope", "Z Offset from XY Slope", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG scan.z_offset_xyslope
[0, 99, "scan.xyz_gain", "XYZ Scan Gain", "X", 1, "Scan"], ## DSP_SIG XYZ_gain, bitcoded -/8/8/8 (0..255)x -- 10x all: 0x000a0a0a
[0, 99, "move.xyz_vec[i_X]", "X Offset", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG vec_XYZ_move[0];
[0, 99, "move.xyz_vec[i_Y]", "Y Offset", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG vec_XYZ_move[1];
[0, 99, "move.xyz_vec[i_Z]", "Z Offset", "V", DSP32Qs15dot16TO_Volt, "Scan"], ## DSP_SIG vec_XYZ_move[2];
[0, 99, "move.xyz_gain", "XYZ Offset Gains", "X", 1, "Scan"], ## DSP_SIG XYZ_gain, bitcoded -/8/8/8 (0..255)x -- not yet used, fixed set to 10x (0x000a0a0a)
[0, 99, "analog.wave[0]", "Wave X", "V", DSP32Qs15dot0TO_Volt, "Coarse"], ## DSP_SIG Wave X (coarse wave form out "X");
[0, 99, "analog.wave[1]", "Wave Y", "V", DSP32Qs15dot0TO_Volt, "Coarse"], ## DSP_SIG Wave Y (coarse wave form out "Y");
[0, 99, "autoapp.count_axis[0]", "Count Axis 0", "1", 1, "Coarse"], ## DSP_SIG Count Axis [0]
[0, 99, "autoapp.count_axis[1]", "Count Axis 1", "1", 1, "Coarse"], ## DSP_SIG Count Axis [1]
[0, 99, "autoapp.count_axis[2]", "Count Axis 2", "1", 1, "Coarse"], ## DSP_SIG Count Axis [2]
[0, 99, "analog.bias", "Bias", "V", DSP32Qs15dot16TO_Volt, "Control"], ## DSP_SIG control_Bias;
[0, 99, "analog.bias_adjust", "Bias Adjust", "V", DSP32Qs15dot16TO_Volt, "Control"], ## DSP_SIG adjusted_Bias;
[0, 99, "analog.motor", "Motor", "V", DSP32Qs15dot16TO_Volt, "Control"], ## DSP_SIG control_Motor;
[0, 99, "analog.noise", "Noise", "1", 1, "Control"], ## DSP_SIG value_NOISE;
[0, 99, "analog.vnull", "Null-Signal", "0", 1, "Control"], ## DSP_SIG value_NULL;
[0, 99, "probe.AC_amp", "AC Ampl", "V", DSP32Qs15dot0TO_Volt, "Control"], ## DSP_SIG Ac Ampl;
[0, 99, "probe.noise_amp", "Noise Ampl", "V", DSP32Qs15dot0TO_Volt, "Control"], ## DSP_SIG Noise Ampl;
[0, 99, "state.DSP_time", "TIME TICKS", "s", 1./150000., "DSP"], ## DSP TIME -- DSP clock
[0, 99, "feedback_mixer.iir_signal[0]", "IIR32 0", "V", DSP32Qs15dot16TO_Volt, "DBGX_Mixer"], ## DSP_SIG IIR_MIX[0..3]; // Mixer processed input taps, 32bit accu
[0, 99, "feedback_mixer.iir_signal[1]", "IIR32 1", "V", DSP32Qs15dot16TO_Volt, "DBGX_Mixer"], ## DSP_SIG IIR_MIX[0..3]; // Mixer processed input taps, 32bit accu
[0, 99, "feedback_mixer.iir_signal[2]", "IIR32 2", "V", DSP32Qs15dot16TO_Volt, "DBGX_Mixer"], ## DSP_SIG IIR_MIX[0..3]; // Mixer processed input taps, 32bit accu
[0, 99, "feedback_mixer.iir_signal[3]", "IIR32 3", "V", DSP32Qs15dot16TO_Volt, "DBGX_Mixer"], ## DSP_SIG IIR_MIX[0..3]; // Mixer processed input taps, 32bit accu
[-1, 0, "no signal", "END OF SIGNALS", "NA", 0] ## END MARKING
]
#/* END DSP_SIGNALS */
##
## END INSERT file dsp_signals.py
###############################################################
## MODUL CONFIGURATIONS ##
DSP_MODULE_INPUT_ID_CATEGORIZED = {
## "MODULE": [[ MODULE_SIGNAL_INPUT_ID, name, actual hooked signal address ],..]
"Z_Servo":
[[DSP_SIGNAL_Z_SERVO_INPUT_ID, "Z_SERVO", 0, 0, "gold" ]],
"M_Servo":
[[DSP_SIGNAL_M_SERVO_INPUT_ID, "M_SERVO", 0, 0, "gold" ]],
"Mixer":
[[DSP_SIGNAL_MIXER0_INPUT_ID, "MIXER0", 0, 0, "gold" ],
[DSP_SIGNAL_MIXER1_INPUT_ID, "MIXER1", 0, 0, "gold" ],
[DSP_SIGNAL_MIXER2_INPUT_ID, "MIXER2", 0, 0, "gold" ],
[DSP_SIGNAL_MIXER3_INPUT_ID, "MIXER3", 0, 0, "gold" ]],
"Analog_IN":
[[DSP_SIGNAL_DIFF_IN0_ID, "DIFF_IN0", 0, 0, "gold" ],
[DSP_SIGNAL_DIFF_IN1_ID, "DIFF_IN1", 0, 0, "gold" ],
[DSP_SIGNAL_DIFF_IN2_ID, "DIFF_IN2", 0, 0, "gold" ],
[DSP_SIGNAL_DIFF_IN3_ID, "DIFF_IN3", 0, 0, "gold" ]],
"LockIn":
[[DSP_SIGNAL_LOCKIN_A_INPUT_ID, "LOCKIN_A", 0, 0, "gold" ],
[DSP_SIGNAL_LOCKIN_B_INPUT_ID, "LOCKIN_B", 0, 0, "gold" ]],
"VP":
[[DSP_SIGNAL_VECPROBE0_INPUT_ID, "VECPROBE0", 0, 0, "gold" ],
[DSP_SIGNAL_VECPROBE1_INPUT_ID, "VECPROBE1", 0, 0, "gold" ],
[DSP_SIGNAL_VECPROBE2_INPUT_ID, "VECPROBE2", 0, 0, "gold" ],
[DSP_SIGNAL_VECPROBE3_INPUT_ID, "VECPROBE3", 0, 0, "gold" ],
[DSP_SIGNAL_VECPROBE0_CONTROL_ID, "VECPROBE0_C", 0, 0, "cyan" ],
[DSP_SIGNAL_VECPROBE1_CONTROL_ID, "VECPROBE1_C", 0, 0, "cyan" ],
[DSP_SIGNAL_VECPROBE2_CONTROL_ID, "VECPROBE2_C", 0, 0, "cyan" ],
[DSP_SIGNAL_VECPROBE3_CONTROL_ID, "VECPROBE3_C", 0, 0, "cyan" ]],
"Analog_OUT":
[[DSP_SIGNAL_OUTMIX_CH0_INPUT_ID, "OUTMIX_CH0", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH0_ADD_A_INPUT_ID, "OUTMIX_CH0_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH0_SUB_B_INPUT_ID, "OUTMIX_CH0_SUB_B", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH0_SMAC_A_INPUT_ID, "OUTMIX_CH0_SMAC_A", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH0_SMAC_B_INPUT_ID, "OUTMIX_CH0_SMAC_B", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH1_INPUT_ID, "OUTMIX_CH1", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH1_ADD_A_INPUT_ID, "OUTMIX_CH1_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH1_SUB_B_INPUT_ID, "OUTMIX_CH1_SUB_B", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH1_SMAC_A_INPUT_ID, "OUTMIX_CH1_SMAC_A", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH1_SMAC_B_INPUT_ID, "OUTMIX_CH1_SMAC_B", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH2_INPUT_ID, "OUTMIX_CH2", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH2_ADD_A_INPUT_ID, "OUTMIX_CH2_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH2_SUB_B_INPUT_ID, "OUTMIX_CH2_SUB_B", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH2_SMAC_A_INPUT_ID, "OUTMIX_CH2_SMAC_A", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH2_SMAC_B_INPUT_ID, "OUTMIX_CH2_SMAC_B", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH3_INPUT_ID, "OUTMIX_CH3", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH3_ADD_A_INPUT_ID, "OUTMIX_CH3_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH3_SUB_B_INPUT_ID, "OUTMIX_CH3_SUB_B", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH3_SMAC_A_INPUT_ID, "OUTMIX_CH3_SMAC_A", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH3_SMAC_B_INPUT_ID, "OUTMIX_CH3_SMAC_B", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH4_INPUT_ID, "OUTMIX_CH4", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH4_ADD_A_INPUT_ID, "OUTMIX_CH4_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH4_SUB_B_INPUT_ID, "OUTMIX_CH4_SUB_B", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH4_SMAC_A_INPUT_ID, "OUTMIX_CH4_SMAC_A", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH4_SMAC_B_INPUT_ID, "OUTMIX_CH4_SMAC_B", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH5_INPUT_ID, "OUTMIX_CH5", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH5_ADD_A_INPUT_ID, "OUTMIX_CH5_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH5_SUB_B_INPUT_ID, "OUTMIX_CH5_SUB_B", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH5_SMAC_A_INPUT_ID, "OUTMIX_CH5_SMAC_A", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH5_SMAC_B_INPUT_ID, "OUTMIX_CH5_SMAC_B", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH6_INPUT_ID, "OUTMIX_CH6", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH6_ADD_A_INPUT_ID, "OUTMIX_CH6_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH6_SUB_B_INPUT_ID, "OUTMIX_CH6_SUB_B", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH6_SMAC_A_INPUT_ID, "OUTMIX_CH6_SMAC_A", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH6_SMAC_B_INPUT_ID, "OUTMIX_CH6_SMAC_B", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH7_INPUT_ID, "OUTMIX_CH7", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH7_ADD_A_INPUT_ID, "OUTMIX_CH7_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH7_SUB_B_INPUT_ID, "OUTMIX_CH7_SUB_B", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH7_SMAC_A_INPUT_ID, "OUTMIX_CH7_SMAC_A", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH7_SMAC_B_INPUT_ID, "OUTMIX_CH7_SMAC_B", 0, 1, "gold" ],
[DSP_SIGNAL_OUTMIX_CH8_INPUT_ID, "OUTMIX_CH8", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH8_ADD_A_INPUT_ID, "OUTMIX_CH8_ADD_A", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH9_INPUT_ID, "OUTMIX_CH9", 0, 0, "gold" ],
[DSP_SIGNAL_OUTMIX_CH9_ADD_A_INPUT_ID, "OUTMIX_CH9_ADD_A", 0, 0, "gold" ]],
"RMS":
[[DSP_SIGNAL_ANALOG_AVG_INPUT_ID, "ANALOG_AVG_INPUT", 0, 0, "gold" ]],
"Scope":
[[DSP_SIGNAL_SCOPE_SIGNAL1_INPUT_ID, "SCOPE_SIGNAL1_INPUT", 0, 0, "gold" ],
[DSP_SIGNAL_SCOPE_SIGNAL2_INPUT_ID, "SCOPE_SIGNAL2_INPUT", 0, 0, "gold" ]],
"PAC":[[0xF000, "PLL_INPUT", 0, 0, "purple"]],
"DSP":[],
"Counter":[],
"Scan":[],
"Coarse":[],
"Control":[],
"DBGX_Mixer":[]
}
################################################################################
## python mapping (manual) for FB_spmcontrol/dataexchange.h defined
## C structures "XXX" and struct elements "YYY":
################################################################################
## i_XXX -- magic index of sub structure to locate structur base address
## fmt_XXX -- data format mapping of structure elements incl. endianess definition "<" here
## ii_XXX_YYY -- structure XXX element YYY index after unpacking
################################################################################
# magic table index
i_magic = 0
fmt_magic = "<LLLLLLLLLLLLLLLLLLLLLLLLLLLL"
i_magic_version = 1
i_magic_year = 2
i_magic_date = 3
i_magic_sid = 4
i_statemachine = 5
fmt_statemachine = "<LLLLLLLLLLLLL"
fmt_statemachine_w = "<L"
fmt_statemachine_w2 = "<LL"
[
ii_statemachine_set_mode,
ii_statemachine_clr_mode,
ii_statemachine_mode,
ii_statemachine_last_mode,
ii_statemachine_BLK_count,
ii_statemachine_BLK_Ncount,
ii_statemachine_DSP_time,
ii_statemachine_DSP_tens,
ii_statemachine_DataProcessTime,
ii_statemachine_IdleTime,
ii_statemachine_DataProcessTime_Peak,
ii_statemachine_IdleTime_Peak,
ii_statemachine_DataProcessMode
] = range (0,13)
i_AIC_in = 6
fmt_AIC_in = "<hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
i_AIC_out = 7
fmt_AIC_out = "<hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
i_z_servo = 12
i_m_servo = 13
fmt_servo = "<lllLlllll"
# 0123456789
[
ii_servo_cp,
ii_servo_ci,
ii_servo_setpoint,
ii_servo_input_p,
ii_servo_delta,
ii_servo_i_sum,
ii_servo_control,
ii_servo_neg_control,
ii_servo_watch
] = range (0,9)
i_analog = 9
fmt_analog = "<llLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLllllllllllllllllLLLLllll"
[
ii_analog_bias,
ii_analog_motor,
ii_analog_out00p,
ii_analog_out00ap,
ii_analog_out00bp,
ii_analog_out00afp,
ii_analog_out00bfp,
ii_analog_out01p,
ii_analog_out01ap,
ii_analog_out01bp,
ii_analog_out01afp,
ii_analog_out01bfp,
ii_analog_out02p,
ii_analog_out02ap,
ii_analog_out02bp,
ii_analog_out02afp,
ii_analog_out02bfp,
ii_analog_out03p,
ii_analog_out03ap,
ii_analog_out03bp,
ii_analog_out03afp,
ii_analog_out03bfp,
ii_analog_out04p,
ii_analog_out04ap,
ii_analog_out04bp,
ii_analog_out04afp,
ii_analog_out04bfp,
ii_analog_out05p,
ii_analog_out05ap,
ii_analog_out05bp,
ii_analog_out05afp,
ii_analog_out05bfp,
ii_analog_out06p,
ii_analog_out06ap,
ii_analog_out06bp,
ii_analog_out06afp,
ii_analog_out06bfp,
ii_analog_out07p,
ii_analog_out07ap,
ii_analog_out07bp,
ii_analog_out07afp,
ii_analog_out07bfp,
ii_analog_out08p,
ii_analog_out08ap,
ii_analog_out08bp,
ii_analog_out08afp,
ii_analog_out08bfp,
ii_analog_out09p,
ii_analog_out09ap,
ii_analog_out09bp,
ii_analog_out09afp,
ii_analog_out09bfp,
ii_analog_avg_input,
ii_analog_avg_signal,
ii_analog_rms_signal,
ii_analog_bias_adjust,
ii_analog_noise,
ii_analog_vnull,
ii_analog_wave0,
ii_analog_wave1,
ii_analog_in0,
ii_analog_in1,
ii_analog_in2,
ii_analog_in3,
ii_analog_in4,
ii_analog_in5,
ii_analog_in6,
ii_analog_in7,
ii_analog_diff_in_p0,
ii_analog_diff_in_p1,
ii_analog_diff_in_p2,
ii_analog_diff_in_p3,
ii_analog_counter0,
ii_analog_counter1,
ii_analog_gatetime0,
ii_analog_gatetime1
] = range (0,76)
num_monitor_signals = 20
i_signal_monitor = 10
#######################miAAppppppppppppppppppppssssssssssssssssssssp
fmt_signal_monitor = "<llLLLLLLLLLLLLLLLLLLLLLLlllllllllllllllllllll"
ii_signal_monitor_p_first = 4
ii_signal_monitor_first = 4 + num_monitor_signals
i_scan = 14
fmt_scan = "<llllllllllllllllllllllllllllllllllllllllllll"
# ss rot npab srcs nxy fs n fm dxny Zo fmz XYZ
# fmt = "<hh hhhh hhhh llll hh ll l lll hh hh ll lll ll hhhh hh" [38]
# fmt = "<hhhhhhhhhhllllhhllllllhhhhlllllllhhhhhh"
[
ii_scan_start,
ii_scan_stop,
ii_scan_rotmXX,
ii_scan_rotmXY,
ii_scan_rotmYX,
ii_scan_rotmYY,
ii_scan_nx_pre,
ii_scan_dnx_probe,
ii_scan_raster_a,
ii_scan_raster_b,
ii_scan_srcs_xp,
ii_scan_srcs_xm,
ii_scan_srcs_2nd_xp,
ii_scan_srcs_2nd_xm,
ii_scan_nx,
ii_scan_ny,
ii_scan_fs_dx,
ii_scan_fs_dy,
ii_scan_num_steps_move_xy,
ii_scan_fm_dx,
ii_scan_fm_dy,
ii_scan_fm_dzxy,
ii_scan_dnx,
ii_scan_dny,
ii_scan_Zoff_2nd_xp,
ii_scan_Zoff_2nd_xm,
ii_scan_fm_dz0_xy_vecX,
ii_scan_fm_dz0_xy_vecY,
ii_scan_z_slope_max,
ii_scan_fast_return,
ii_scan_xyz_vecX,
ii_scan_xyz_vecY,
ii_scan_xyz_vecZ,
ii_scan_xy_r_vecX,
ii_scan_xy_r_vecY,
ii_z_offset_xyslope,
ii_scan_cfs_dx,
ii_scan_cfs_dy,
ii_scan_iix,
ii_scan_iiy,
ii_scan_ix,
ii_scan_iy,
ii_scan_ifr,
ii_scan_sstate,
ii_scan_pflg
] = range (0,45)
i_move = 15
fmt_move = "<llllllllllll"
# fmt = "<hhhhlllllllh"
[
ii_move_start,
ii_move_nRegel,
ii_move_xy_new_vecX,
ii_move_xy_new_vecY,
ii_move_f_d_xyz_vecX,
ii_move_f_d_xyz_vecY,
ii_move_f_d_xyz_vecZ,
ii_move_num_steps,
ii_move_xyz_vecX,
ii_move_xyz_vecY,
ii_move_xyz_vecZ,
ii_move_pflg
] = range (0,12)
i_probe = 16
fmt_probe = "<llllllllllllllllllllllllll"
ii_probe_LIM_up = 2
ii_probe_LIM_dn = 3
ii_probe_ACamp = 4
ii_probe_ACfrq = 5
ii_probe_ACphaseA = 6
ii_probe_ACphaseB = 7
ii_probe_ACnAve = 8
ii_probe_src_lookup = 9 #..12
ii_probe_prb_lookup = 13 #..16
#17..20
#21..24
ii_probe_ACix = 25
ii_probe_time = 26
i_probe_vector_head = 0
fmt_probe_vector = "llLLLLLLllllllll"
[
ii_probe_n,
ii_probe_dnx,
ii_probe_srcs,
ii_probe_options,
ii_probe_ptr_fb,
ii_probe_repetitions,
ii_probe_i,
ii_probe_j,
ii_probe_ptr_next,
ii_probe_ptr_final,
ii_probe_f_du,
ii_probe_f_dx,
ii_probe_f_dy,
ii_probe_f_dz,
ii_probe_f_dx0,
ii_probe_f_dy0,
ii_probe_f_dphi
] = range (0,17)
i_autoapp = 17
fmt_autoapp = "<llllllllllLLllllllllllllll"
[
ii_autoapp_start,
ii_autoapp_stop,
ii_autoapp_mover_mode,
ii_autoapp_wave_outX,
ii_autoapp_wave_outY,
ii_autoapp_piezo_steps,
ii_autoapp_n_wait,
ii_autoapp_u_piezo_max,
ii_autoapp_u_piezo_amp,
ii_autoapp_piezo_speed,
ii_autoapp_n_wait_fin,
ii_autoapp_fin_cnt,
ii_autoapp_mv_count,
ii_autoapp_mv_dir,
ii_autoapp_mv_step_count,
ii_autoapp_u_piezo,
ii_autoapp_step_next,
ii_autoapp_tip_mode,
ii_autoapp_delay_cnt,
ii_autoapp_ci_mult,
ii_autoapp_cp,
ii_autoapp_ci,
ii_autoapp_count_axis0,
ii_autoapp_count_axis1,
ii_autoapp_count_axis2,
ii_autoapp_pflg
] = range (0,26)
i_pulse = 21
fmt_pulse = "<lllllHHHHllll"
# fmt = "<hhhhlllllllh"
[
ii_pulse_start,
ii_pulse_stop,
ii_pulse_duration,
ii_pulse_period,
ii_pulse_number,
ii_pulse_on_bcode,
ii_pulse_off_bcode,
ii_pulse_reset_bcode,
ii_pulse_dummy,
ii_pulse_io_address,
ii_pulse_i_per,
ii_pulse_i_rep,
ii_pulse_pflg
] = range (0,13)
i_generic_io = 22
fmt_generic_io = "<llHHHhLLLLLLLLl"
# fmt = "<hhhhlllllllh"
[
ii_generic_io_start,
ii_generic_io_stop,
ii_generic_io_gpio_direction_bits,
ii_generic_io_gpio_data_in,
ii_generic_io_gpio_data_out,
ii_generic_io_dummy,
ii_generic_io_gatetime_l_0,
ii_generic_io_gatetime_h_0,
ii_generic_io_gatetime_1,
ii_generic_io_count_0,
ii_generic_io_count_1,
ii_generic_io_peak_count_0,
ii_generic_io_peak_count_1,
ii_generic_io_peakholdtime,
ii_generic_io_pflg
] = range (0,15)
i_datafifo = 18
fmt_datalong4 = "<LLLL"
fmt_datalong128 = "<LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL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LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
i_probedatafifo = 19
i_feedback_mixer = 11
fmt_feedback_mixer = "<llllllllllllllllllllllllLLllllllllllllllLLLLllllllll"
[
ii_feedback_mixer_level0,
ii_feedback_mixer_level1,
ii_feedback_mixer_level2,
ii_feedback_mixer_level3,
ii_feedback_mixer_gain0,
ii_feedback_mixer_gain1,
ii_feedback_mixer_gain2,
ii_feedback_mixer_gain3,
ii_feedback_mixer_mode0,
ii_feedback_mixer_mode1,
ii_feedback_mixer_mode2,
ii_feedback_mixer_mode3,
ii_feedback_mixer_setpoint0,
ii_feedback_mixer_setpoint1,
ii_feedback_mixer_setpoint2,
ii_feedback_mixer_setpoint3,
ii_feedback_mixer_iir_ca_q15_0,
ii_feedback_mixer_iir_ca_q15_1,
ii_feedback_mixer_iir_ca_q15_2,
ii_feedback_mixer_iir_ca_q15_3,
ii_feedback_mixer_cb_Ic,
ii_feedback_mixer_I_cross,
ii_feedback_mixer_I_offset,
ii_feedback_mixet_dum_align,
ii_feedback_mixer_f_refLO,
ii_feedback_mixer_f_refHI,
ii_feedback_mixer_exec,
ii_feedback_mixer_x,
ii_feedback_mixer_lnx,
ii_feedback_mixer_y,
ii_feedback_mixer_iir_signal0,
ii_feedback_mixer_iir_signal1,
ii_feedback_mixer_iir_signal2,
ii_feedback_mixer_iir_signal3,
ii_feedback_mixer_q_factor15,
ii_feedback_mixer_delta,
ii_feedback_mixer_setpoint_log0,
ii_feedback_mixer_setpoint_log1,
ii_feedback_mixer_setpoint_log2,
ii_feedback_mixer_setpoint_log3,
ii_feedback_mixer_input_p0,
ii_feedback_mixer_input_p1,
ii_feedback_mixer_input_p2,
ii_feedback_mixer_input_p3,
ii_feedback_mixer_FB_IN_processed0,
ii_feedback_mixer_FB_IN_processed1,
ii_feedback_mixer_FB_IN_processed2,
ii_feedback_mixer_FB_IN_processed3,
ii_feedback_mixer_FB_IN_is_analog0,
ii_feedback_mixer_FB_IN_is_analog1,
ii_feedback_mixer_FB_IN_is_analog2,
ii_feedback_mixer_FB_IN_is_analog3
] = range (0,52)
i_IO_pulse = 19 #19 CR pulse
fmt_IO_pulse = "<HHHHHHHHHHHH"
i_CR_generic_io = 22
fmt_CR_generic_io = "<llhhhhLLLLLLLLl"
fmt_CR_generic_io_write_a5 = "<hhhLLLLL" #+5
# fmt = "<hhhhHHHHLLLLLh"
i_hr_mask = 24
fmt_hr_mask = "<llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll"
## PLL header short map, recorder only
i_recorder = 25
fmt_recorder = "<lllLLLLL"
[
ii_recorder_starmt,
ii_recorder_stop,
ii_recorder_pflg,
ii_pSignal1,
ii_pSignal2,
ii_Signal1,
ii_Signal2,
ii_blcklen
] = range(0, 8)
##/** PLL Data Magics */
i_pll_vars_lookup = 25
fmt_pll_vars_lookup = "<lllLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
[
##// Task Control
ii_PLL_start,
ii_PLL_stop,
ii_PLL_pflg,
##// Pointers for the acsiquition
ii_PLL_pSignal1,
ii_PLL_pSignal2,
ii_PLL_Signal1,
ii_PLL_Signal2,
##// Block length
ii_PLL_blcklen,
##// Sine variables
ii_PLL_deltaReT,
ii_PLL_deltaImT,
ii_PLL_volumeSine,
##// Phase/Amp detector time constant
ii_PLL_Tau_PAC,
##// Phase corrector variables
ii_PLL_PI_Phase_Out,
ii_PLL_pcoef_Phase,
ii_PLL_icoef_Phase,
ii_PLL_errorPI_Phase,
ii_PLL_memI_Phase,
ii_PLL_setpoint_Phase,
ii_PLL_ctrlmode_Phase,
ii_PLL_corrmin_Phase,
ii_PLL_corrmax_Phase,
##// Min/Max for the output signals
ii_PLL_ClipMin,
ii_PLL_ClipMax,
##// Amp corrector variables
ii_PLL_ctrlmode_Amp,
ii_PLL_corrmin_Amp,
ii_PLL_corrmax_Amp,
ii_PLL_setpoint_Amp,
ii_PLL_pcoef_Amp,
ii_PLL_icoef_Amp,
ii_PLL_errorPI_Amp,
ii_PLL_memI_Amp,
##// LP filter selections
ii_PLL_Select_Phase,
ii_PLL_Select_Amp,
##
ii_PLL_InputFiltered, #; // Resonator Output Signal
ii_PLL_SineOut0, #; // Excitation Signal
ii_PLL_phase, #; // Resonator Phase (no LP filter)
ii_PLL_PI_Phase_OutMonitor, #; // Excitation Freq. (no LP filter)
ii_PLL_amp_estimation, #; // Resonator Amp. (no LP filter)
ii_PLL_volumeSineMonitor, #; // Excitation Amp. (no LP filter) (same as volumeSine)
# ii_PLL_Filter64Out, # // int[4] : can be read in one shot
ii_PLL_ExciFreqLP, # (with LP filter)
ii_PLL_ResPhaseLP, # (with LP filter)
ii_PLL_ResAmpLP, # (with LP filter)
ii_PLL_ExciAmpLP # (with LP filter)
] = range (0,43)
fmt_Filter64Out = "<llll"
ii_PLL_Filter64Out = ii_PLL_ExciFreqLP # // int[4] : can be read in one shot
iii_PLL_F64_ExciFreqLP = 0
iii_PLL_F64_ResPhaseLP = 1
iii_PLL_F64_ResAmpLP = 2
iii_PLL_F64_ExciAmpLP = 3
i_signal_lookup = 26
# MK3Pro/SMPControl Magic is: 0x3202EE01
FB_SPM_MAGIC_ADR_MK3 = 0x10F13F00
FB_SPM_MAGIC_REF_MK3 = 0x3202EE01
def dum_null ():
return 0
class SPMcontrol():
def __init__(self, start_dev_id=0):
self.sr_dev_index = start_dev_id
self.sr_dev_base = "/dev/sranger_mk2_"
self.sr_dev_path = "/dev/sranger_mk2_0"
## must be NUM_SIGNALS x L:
self.fmt_signal_lookup = "<"
for i in range (0,NUM_SIGNALS):
self.fmt_signal_lookup = self.fmt_signal_lookup+"L"
# auto locate Mk3-Pro with SPMControl (for Gxsm) firmware
self.spm_control_found = 0
# open SRanger, read magic offsets (look at FB_spm_dataexchange.h -> SPM_MAGIC_DATA_LOCATIONS)
for i in range(self.sr_dev_index, 8-self.sr_dev_index):
self.sr_dev_path = self.sr_dev_base+"%d" %i
print "looking for MK3-Pro/FB_SPMCONTROL/A810 at " + self.sr_dev_path
try:
with open (self.sr_dev_path):
sr = open (self.sr_dev_path, "rw")
# open SRanger (MK3-Pro) check for SPM_control software, read magic
os.lseek (sr.fileno(), FB_SPM_MAGIC_ADR_MK3, 1)
self.magic = struct.unpack (fmt_magic, os.read (sr.fileno(), struct.calcsize (fmt_magic)))
sr.close ()
print ("FB_SPM_Control Magic ID (blind read): %08X" %self.magic[0])
if self.magic[0] == FB_SPM_MAGIC_REF_MK3:
self.spm_control_found = 1
print "Identified MK3-Pro/FB_SPMCONTROL/A810 at " + self.sr_dev_path
sr = open (self.sr_dev_path, "rw")
os.lseek (sr.fileno(), self.magic[i_recorder], 0)
self.RECORDER_VARS = struct.unpack (fmt_recorder, os.read (sr.fileno(), struct.calcsize (fmt_recorder)))
os.lseek (sr.fileno(), self.magic[i_pll_vars_lookup], 0)
self.PLL_VARS = struct.unpack (fmt_pll_vars_lookup, os.read (sr.fileno(), struct.calcsize (fmt_pll_vars_lookup)))
sr.close ()
break
except IOError:
print 'Oh dear. No such device.'
print "continue seeking for MK3-Pro with FB_SPMCONTROL ..."
if self.spm_control_found:
print
print ("*** SR-MK3Pro-A810 FB-SPMCONTROL Magic Information ***")
print ("Magic: %08X" %self.magic[0])
print ("Version: %08X" %self.magic[1])
print ("Year: %08X" %self.magic[2])
print ("MM/DD: %08X" %self.magic[3])
print ("SoftID: %08X" %self.magic[4])
print ("Statema %08X" %self.magic[5])
print ("DataFIFO %08X" %self.magic[i_datafifo])
print ("PrbFIFO %08X" %self.magic[i_probedatafifo])
print
else:
print
print "*** Sorry, no valid SPM-CONTROL found running on any plugged in MK2/3 ***"
self.sr_dev_path = "none"
def status (self):
return self.spm_control_found
def get_spm_code_version_info (self):
return "V%04X-Y%04x%04X"%(self.magic[1], self.magic[2], self.magic[3])
def read_configurations (self):
if self.spm_control_found:
self.read_signal_lookup()
self.read_actual_module_configuration ()
self.get_status ()
else:
print "Sorry, no SPM-CONTROL DSP hooked up."
def read_signal_lookup (self, update_pass=0):
if update_pass == 0:
print ("*** SR-MK3Pro-A810 FB-SPMCONTROL Reading Signal Lookup List ***")
sr = open (self.sr_dev_path, "rw")
os.lseek (sr.fileno(), self.magic[i_signal_lookup], 0)
self.SIGNAL_LOOKUP_LIST = struct.unpack (self.fmt_signal_lookup, os.read (sr.fileno(), struct.calcsize (self.fmt_signal_lookup)))
sr.close ()
# print SIGNAL_LOOKUP_LIST
i=0
j=0
self.SIGNAL_LOOKUP = SIGNAL_LOOKUP # make copy for self
for sigptr in self.SIGNAL_LOOKUP_LIST:
if sigptr > 0:
self.SIGNAL_LOOKUP[i][0]=i
self.SIGNAL_LOOKUP[i][1]=sigptr
if update_pass:
if re.search ("feedback_mixer.FB_IN_processed\[[0-3]\]", self.SIGNAL_LOOKUP[i][2]):
# print "checking for MIXER[%d"%j+"] input type on " + self.SIGNAL_LOOKUP[i][2]
[signal, data] = self.query_module_signal_input(0, DSP_SIGNAL_MIXER0_INPUT_ID+j)
j=j+1
# print signal
if re.search("analog.in*", signal[2]):
self.SIGNAL_LOOKUP[i][5]=DSP32Qs23dot8TO_Volt
# print "Analog Signal.: Qs23.8 ** Ufactor adjust: DSP32Qs23dot8TO_Volt"
else:
self.SIGNAL_LOOKUP[i][5]=DSP32Qs15dot16TO_Volt
# print "non analog input: Qs15.16 ** Ufactor adjust: DSP32Qs15dot16TO_Volt"
# print "=====> Sig%03d: "%i+"[%08X]"%sigptr, self.SIGNAL_LOOKUP[i]
else:
print "Sig%03d: "%i+"[%08X]"%sigptr, self.SIGNAL_LOOKUP[i]
i=i+1
return 1
def get_module_configuration_list(self):
return DSP_MODULE_INPUT_ID_CATEGORIZED
def read_actual_module_configuration (self):
print "CURRENT FB_SPMCONTROL MODULE SIGNAL INPUT CONFIGURATION:"
for mod in DSP_MODULE_INPUT_ID_CATEGORIZED.keys():
for mod_inp in DSP_MODULE_INPUT_ID_CATEGORIZED[mod]:
[signal, data] = self.query_module_signal_input(mod_inp[0], mod_inp[3])
mod_inp[2] = signal [0];
if mod_inp[2] >= 0:
print signal[3]," ==> ",mod_inp[1]," (", mod_inp, signal, data, ")"
else:
if mod_inp[2] == 0 and mod_inp[3] == 1:
print "DISABLED [p=0] ==> ", mod_inp[1],mod_inp[3]," (", mod_inp, signal, data, ")"
else:
if data[3] == 0 and data[0] == -1:
print "ERROR (can not associate signal adress): [p=0] ==> (", mod_inp, signal, data, ")"
##### basic support
def magic(self, i):
return self.magic[i]
def sr_path(self):
return self.sr_dev_path
def readf(self, srfileno, magic_id, fmt, mode=0):
os.lseek (srfileno, self.magic[magic_id], mode)
return struct.unpack (fmt, os.read (srfileno, struct.calcsize (fmt)))
def read(self, magic_id, fmt, mode=0):
sr = open( self.sr_dev_path, "rb")
data = self.readf( sr.fileno(), magic_id, fmt, mode)
sr.close ()
return data
## packed data example: struct.pack ("<llLL", _input_id, _signal[0],0,0)
def write(self, magic_id, packeddata, mode=0):
sr = open (self.sr_dev_path, "wb")
os.lseek (sr.fileno(), self.magic[magic_id], mode)
os.write (sr.fileno(), packeddata)
sr.close ()
def write_o(self, magic_id, offset, packeddata, mode=0):
sr = open (self.sr_dev_path, "wb")
os.lseek (sr.fileno(), self.magic[magic_id]+offset, mode)
os.write (sr.fileno(), packeddata)
sr.close ()
def write_parameter(self, address, packeddata, mode=0):
sr = open (self.sr_dev_path, "wb")
os.lseek (sr.fileno(), address, mode)
os.write (sr.fileno(), packeddata)
sr.close ()
def get_status(self):
sr = open (self.sr_dev_path)
self.analog = self.readf( sr.fileno(), i_analog, fmt_analog)
self.SPM_STATEMACHINE = self.readf( sr.fileno(), i_statemachine, fmt_statemachine)
self.SPM_SCAN = self.readf( sr.fileno(), i_scan, fmt_scan)
self.SPM_MOVE = self.readf( sr.fileno(), i_move, fmt_move)
self.PROBE = self.readf( sr.fileno(), i_probe, fmt_probe)
self.AIC_in_buffer = self.readf( sr.fileno(), i_AIC_in, fmt_AIC_in)
self.AIC_out_buffer = self.readf( sr.fileno(), i_AIC_out, fmt_AIC_out)
self.Z_SERVO = self.readf( sr.fileno(), i_z_servo, fmt_servo)
self.M_SERVO = self.readf( sr.fileno(), i_m_servo, fmt_servo)
self.MIXER_FB = self.readf( sr.fileno(), i_feedback_mixer, fmt_feedback_mixer)
self.SIGNAL_MONITOR = self.readf( sr.fileno(), i_signal_monitor, fmt_signal_monitor)
self.AUTOAPP_WATCH = self.readf( sr.fileno(), i_autoapp, fmt_autoapp)
self.CR_COUNTER = self.readf( sr.fileno(), i_CR_generic_io, fmt_CR_generic_io)
self.counts0 = self.CR_COUNTER[ii_generic_io_count_0];
self.counts1 = self.CR_COUNTER[ii_generic_io_count_1];
self.counts0h = self.CR_COUNTER[ii_generic_io_peak_count_0];
self.counts1h = self.CR_COUNTER[ii_generic_io_peak_count_1];
sr.close ()
return 1
def read_signal_monitor_only(self):
self.SIGNAL_MONITOR = self.read(i_signal_monitor, fmt_signal_monitor)
def get_ADDA(self):
return [self.AIC_in_buffer, self.AIC_out_buffer]
##### SIGNAL SUPPORT
def get_signal_lookup_list (self):
return self.SIGNAL_LOOKUP
def get_signal (self, id):
return self.SIGNAL_LOOKUP[i]
def lookup_signal_by_ptr (self, sigptr, nullok=0):
if sigptr == 0 and nullok:
return [0,0,"DISABLED","DISABLED","0",0]
for signal in self.SIGNAL_LOOKUP:
if signal[1] == sigptr:
return signal
return [-1,0,"n/a","N/A","0",0]
def lookup_signal_by_name (self, signame):
for signal in self.SIGNAL_LOOKUP:
if signal[3] == signame:
return signal
return [-1,0,"n/a","N/A","0",0]
# for sanity never direct change/write DSP pointers, but go via signal input pointer change request via signal lookup and signal id
def change_signal_input(self, _signal, _input_id):
fmt = "<llLL"
sr = open (self.sr_dev_path, "wb")
os.lseek (sr.fileno(), self.magic[i_signal_monitor], 0)
os.write (sr.fileno(), struct.pack (fmt, _input_id, _signal[0],0,0))
sr.close ()
print "Signal Input ID (mindex) %d"%_input_id+" change request to signal id %d\n ==> "%_signal[0]+str(_signal)
# check on updates (units mixer)
return 1
# MONITOR SIGNALS
def get_monitor_data (self, tap):
return self.SIGNAL_MONITOR[ii_signal_monitor_first+tap]
def get_monitor_pointer (self, tap):
return self.SIGNAL_MONITOR[ii_signal_monitor_p_first+tap]
def get_monitor_signal (self, tap):
sigptr = self.SIGNAL_MONITOR[ii_signal_monitor_p_first+tap]
if sigptr == 0:
return [0,0.,[-1,0,"n/a","N/A","0",0]]
value = self.SIGNAL_MONITOR[ii_signal_monitor_first+tap]
signal = self.lookup_signal_by_ptr (sigptr)
return [value, value*signal[5], signal]
# for sanity never direct change/write DSP pointers, but go via signal input pointer change request via signal lookup and signal id
def change_signal_input(self, dum, _signal, _input_id):
self.write (i_signal_monitor, struct.pack ("<llLL", _input_id, _signal[0],0,0))
print "Signal Input ID (mindex) %d"%_input_id+" change request to signal id %d\n ==> "%_signal[0]+str(_signal)
return 1
# _signal_id == DSP_SIGNAL_TABLE_STORE_TO_FLASH_ID, DSP_SIGNAL_TABLE_RESTORE_FROM_FLASH_ID, DSP_SIGNAL_TABLE_ERASE_FLASH_ID, ...
def manage_signal_configuration(self, _button, _signal_id, data=dum_null):
fmt = "<llLL" ## [ mindex, signal_id, act_address_input_set, act_address_signal [][] ]
print "SIGNAL MONITOR: MANAGE SIGNAL CONFIGURATION REQUEST mi=0x%08X si=0x%08X data vector=[ "%(int (data()), _signal_id), fmt, int (data ()), _signal_id, 0,0, " ]"
self.write (i_signal_monitor, struct.pack (fmt, int (data ()), _signal_id, 0,0))
time.sleep(0.2)
d = self.read(i_signal_monitor, fmt)
print "Return = [ %x, %x, %x, %x ]"%(d[0], d[1], d[2], d[3])
def flash_dump(self, _button, nb8=16):
fmt = "<llLL" ## [ mindex, signal_id, act_address_input_set, act_address_signal [][] ]
print "SPM Flash Buffer Dump:"
self.write (i_signal_monitor, struct.pack (fmt, 0, DSP_SIGNAL_TABLE_SEEKRW_FLASH_ID, 0,0))
time.sleep(0.1)
ret = "GXSM SIGNAL FLASH CONFIG HEADER:\n"
for i in range(0, nb8):
s = "[0x%04x] = "%(i*8)
for k in range(0,8):
self.write (i_signal_monitor, struct.pack (fmt, 0, DSP_SIGNAL_TABLE_READ_FLASH_ID, 0,0))
d = self.read(i_signal_monitor, fmt)
s = s + " 0x%04X"%d[1]
print s
ret = ret + s + "\n"
return ret
def disable_signal_input(self, dum, dumdum, _input_id): # _input_id == 0 reverts to power up defaults!!
fmt = "<llLL"
self.write (i_signal_monitor, struct.pack (fmt, _input_id, DSP_SIGNAL_NULL_POINTER_REQUEST_ID,0,0))
print "Signal Input Disabled (mindex) %d set to NULL-POINTER."%_input_id
time.sleep(0.01)
print "Return:"
print self.read (i_signal_monitor, fmt)
print "Verify:"
[s,d] = self.query_module_signal_input (_input_id, 1)
print s,d
return 1
def query_module_signal_input(self, _input_id, nullok=0):
fmt = "<llLL"
self.write (i_signal_monitor, struct.pack (fmt, _input_id, -1,0,0))
# print "Query Signal Input ID (mindex) %d:"%_input_id
time.sleep(0.01)
data = self.read(i_signal_monitor, fmt)
# print data
signal = self.lookup_signal_by_ptr (data[3], nullok)
# print signal
return signal, data
def adjust_statemachine_flag(self, mask, flag):
if flag:
self.write_o (i_statemachine, 0, struct.pack (fmt_statemachine_w, mask))
else:
self.write_o (i_statemachine, 4, struct.pack (fmt_statemachine_w, mask))
###define SRANGER_MK23_SEEK_ATOMIC 1 // Bit indicates ATOMIC mode to be used
###define SRANGER_MK23_SEEK_DATA_SPACE 0 // DATA_SPACE, NON ATOMIC -- MK2: ONLY VIA USER PROVIDED NON ATOMIC KFUNC!!!!
###define SRANGER_MK23_SEEK_PROG_SPACE 2 // default mode
###define SRANGER_MK23_SEEK_IO_SPACE 4 // default mode
def set_recorder(self, n):
sr = open (self.sr_dev_path, "wb")
os.lseek (sr.fileno(), self.RECORDER_VARS[ii_blcklen], 1)
os.write (sr.fileno(), struct.pack ("<l", n-1))
sr.close ()
def check_recorder_ready(self):
sr = open (self.sr_dev_path, "rb")
os.lseek (sr.fileno(), self.RECORDER_VARS[ii_blcklen], 1)
fmt = "<ll"
[blck, dum] = struct.unpack (fmt, os.read (sr.fileno(), struct.calcsize (fmt)))
sr.close ()
return blck
## void read_pll_array32 (gint64 address, int n, gint32 *arr){
## gint64 nleft = n * sizeof (gint32);
## int i_block_start = 0;
## #define BL 32768
## for (gint64 a = address; nleft > 0; a += BL/2){
## lseek (dsp, a, SRANGER_MK23_SEEK_DATA_SPACE);
## sr_read (dsp, &arr[i_block_start], (size_t)(nleft > BL ? BL : nleft));
## i_block_start += BL/4;
## nleft -= BL;
## }
## ...
## }
## still some issue with block size >= 32768
def read_recorder(self, n):
aoff = 0
num_left = n<<2 # n x sizeof (gint32)
# BL = 32768
BL = 32768/2
while num_left > 0:
if num_left > BL:
num=BL
else:
num=n<<2
sr = open (self.sr_dev_path, "rb")
os.lseek (sr.fileno(), self.RECORDER_VARS[ii_Signal1]+aoff, 0) # non atomic reads for big data!
if aoff > 0:
xarray = append (xarray, fromfile(sr, dtype([('f1', '<i4')]), num>>2))
else:
xarray = fromfile(sr, dtype([('f1', '<i4')]), num>>2)
sr.close ()
sr = open (self.sr_dev_path, "rb")
os.lseek (sr.fileno(), self.RECORDER_VARS[ii_Signal2]+aoff, 0)
if aoff > 0:
yarray = append(yarray, fromfile(sr, dtype([('f1', '<i4')]), num>>2))
else:
yarray = fromfile(sr, dtype([('f1', '<i4')]), num>>2)
sr.close ()
aoff = aoff+BL/2
num_left = num_left-num
return [xarray.astype(float), yarray.astype(float)]
def adjust_PLL_sine (self, volumeSine, FSineHz):
# reconfigure sine generator
vol = round (CPN(22)*volumeSine/10.)
sr = open (self.sr_dev_path, "wb")
os.lseek (sr.fileno(), self.PLL_VARS[ii_PLL_volumeSine], 1)
os.write (sr.fileno(), struct.pack ("<l", vol))
theta = 2.*math.pi*FSineHz/150000.
re = round (CPN(31) * math.cos (theta))
im = round (CPN(31) * math.sin (theta))
os.lseek (sr.fileno(), self.PLL_VARS[ii_PLL_deltaReT], 1)
os.write (sr.fileno(), struct.pack ("<l", re))
os.lseek (sr.fileno(), self.PLL_VARS[ii_PLL_deltaImT], 1)
os.write (sr.fileno(), struct.pack ("<l", im))
phase = round (CPN(29)*theta)
os.lseek (sr.fileno(), self.PLL_VARS[ii_PLL_PI_Phase_Out], 1)
os.write (sr.fileno(), struct.pack ("<l", phase))
# Exec change Freq
os.lseek (sr.fileno(), self.magic[i_pll_vars_lookup], 1)
os.write (sr.fileno(), struct.pack ("<ll", 1,0)) # => exec ChangeFreqHL () on DSP after adjused Re/Im.
sr.close ()
def set_PLL_phase_step (self, phase_step):
# setup a step and exectute step response measurement
sr = open (self.sr_dev_path, "wb")
d_re = int (round (CPN(29) * phase_step * math.pi / 180.))
os.lseek (sr.fileno(), self.PLL_VARS[ii_PLL_deltaReT], 1)
os.write (sr.fileno(), struct.pack ("<l", d_re))
# Exec change TestPIRest
os.lseek (sr.fileno(), self.magic[i_pll_vars_lookup], 3)
os.write (sr.fileno(), struct.pack ("<ll", 1,0)) # => exec 3 => TestPhasePIResp_HL
sr.close ()
def set_PLL_amplitude_step (self, amp_step):
# setup a step and exectute step response measurement
sr = open (self.sr_dev_path, "wb")
d_re = int (round (CPN(29) * amp_step / 10.))
os.lseek (sr.fileno(), self.PLL_VARS[ii_PLL_deltaReT], 1)
os.write (sr.fileno(), struct.pack ("<l", d_re))
# Exec change TestPIRest
os.lseek (sr.fileno(), self.magic[i_pll_vars_lookup], 4)
os.write (sr.fileno(), struct.pack ("<ll", 1,0)) # => exec 4 => TestAmpPIResp_HL
sr.close ()
def read_PLL_Filter64Out (self):
sr = open (self.sr_dev_path, "rb")
os.lseek (sr.fileno(), self.PLL_VARS[ii_PLL_Filter64Out], 1)
Filter64Out = struct.unpack (fmt_Filter64Out, os.read (sr.fileno(), struct.calcsize (fmt_Filter64Out)))
sr.close ()
return Filter64Out
# END

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks