Skip to content

Commit

Permalink
#43 updated pyspcm (required small hack to bring contents of new pack…
Browse files Browse the repository at this point in the history
…age py_header into spectrum_gmbh namespace)
  • Loading branch information
crnbaker committed Jan 15, 2024
1 parent 1c808b7 commit deaa2e6
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 115 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ ignore_errors = True
# Prevent third party typing errors
[mypy-spectrum_gmbh.*]
ignore_errors = True
ignore_missing_imports = True

[mypy-matplotlib.*]
ignore_missing_imports = True
Expand Down
5 changes: 5 additions & 0 deletions src/spectrum_gmbh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Files in this module are provided free of charge by Spectrum GMBH with no restrictions on use.
# They have been included here to simplify installation of the spectrumdevice package.
import sys

from .py_header import regs, spcerr
sys.modules[__name__ + ".regs"] = regs
sys.modules[__name__ + ".spcerr"] = spcerr
Empty file.
235 changes: 185 additions & 50 deletions src/spectrum_gmbh/regs.py → src/spectrum_gmbh/py_header/regs.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
#
# **************************************************************************
#
# regs.py (c) Spectrum GmbH
#
# **************************************************************************
#
# Feel free to use this source for own projects and modify it in any kind.
#
# **************************************************************************
def KILO(k): return ( 1000 * (k))

def MEGA(m): return ( 1000 * 1000 * (m))

def KILO(k):
return 1000 * (k)
def GIGA(g): return ( 1000 * 1000 * 1000 * (g))

def KILO_B(k): return ( 1024 * (k))

def MEGA(m):
return 1000 * 1000 * (m)


def GIGA(g):
return 1000 * 1000 * 1000 * (g)


def KILO_B(k):
return 1024 * (k)


def MEGA_B(m):
return 1024 * 1024 * (m)


def GIGA_B(g):
return 1024 * 1024 * 1024 * (g)
def MEGA_B(m): return ( 1024 * 1024 * (m))

def GIGA_B(g): return ( 1024 * 1024 * 1024 * (g))

TYP_PCIDEVICEID = 0x00000000
TYP_EVAL = 0x00000010
Expand Down Expand Up @@ -82,6 +58,7 @@ def GIGA_B(g):
TYP_M4IEXPSERIES = 0x00070000
TYP_M4XEXPSERIES = 0x00080000
TYP_M2PEXPSERIES = 0x00090000
TYP_M5IEXPSERIES = 0x000A0000
TYP_MI2020 = 0x00002020
TYP_MI2021 = 0x00002021
TYP_MI2025 = 0x00002025
Expand Down Expand Up @@ -272,6 +249,12 @@ def GIGA_B(g):
TYP_M3I3221EXP = 0x00063221
TYP_M3I3240EXP = 0x00063240
TYP_M3I3242EXP = 0x00063242
TYP_M5I33XX_X16 = 0x000A3300
TYP_M5I3321_X16 = 0x000A3321
TYP_M5I3330_X16 = 0x000A3330
TYP_M5I3337_X16 = 0x000A3337
TYP_M5I3350_X16 = 0x000A3350
TYP_M5I3357_X16 = 0x000A3357
TYP_MI4020 = 0x00004020
TYP_MI4021 = 0x00004021
TYP_MI4022 = 0x00004022
Expand Down Expand Up @@ -709,6 +692,7 @@ def GIGA_B(g):
SPCM_FEAT_EXTFW_SEGSTAT = 0x00000001
SPCM_FEAT_EXTFW_SEGAVERAGE = 0x00000002
SPCM_FEAT_EXTFW_BOXCAR = 0x00000004
SPCM_FEAT_EXTFW_PULSEGEN = 0x00000008
ERRORTEXTLEN = 200
SPC_LASTERRORTEXT = 999996
SPC_LASTERRORVALUE = 999997
Expand Down Expand Up @@ -804,7 +788,7 @@ def GIGA_B(g):
M2STAT_EXTRA_OVERRUN = 0x00004000
M2STAT_EXTRA_ERROR = 0x00008000
M2STAT_TSCNT_OVERRUN = 0x00010000
M2STAT_INTERNALMASK = 0xFF000000
M2STAT_INTERNALMASK = 0xff000000
M2STAT_INTERNAL_SYSLOCK = 0x02000000
SPC_DATA_AVAIL_USER_LEN = 200
SPC_DATA_AVAIL_USER_POS = 201
Expand Down Expand Up @@ -1522,6 +1506,7 @@ def GIGA_B(g):
SPC_TMASK_EXT1 = 0x00000004
SPC_TMASK_EXT2 = 0x00000008
SPC_TMASK_EXT3 = 0x00000010
SPC_TMASK_EXT4 = 0x00000020
SPC_TMASK_XIO0 = 0x00000100
SPC_TMASK_XIO1 = 0x00000200
SPC_TMASK_XIO2 = 0x00000400
Expand Down Expand Up @@ -1631,10 +1616,15 @@ def GIGA_B(g):
SPC_TRIG_EXT3_MODE = 40513
SPC_TRIG_EXT3_AVAILMODES = 40514
SPC_TRIG_EXT3_AVAILMODESOR = 40515
SPC_TRIG_EXT4_AVAILMODES = 40516
SPC_TRIG_EXT4_AVAILMODESOR = 40517
SPC_TRIG_EXT4_AVAILMODESAND = 40518
SPC_TRIG_EXT4_MODE = 40519
SPC_TRIG_EXT0_READFEATURES = 40520
SPC_TRIG_EXT1_READFEATURES = 40521
SPC_TRIG_EXT2_READFEATURES = 40522
SPC_TRIG_EXT3_READFEATURES = 40523
SPC_TRIG_EXT4_READFEATURES = 40524
SPCM_TRFEAT_TERM = 0x00000001
SPCM_TRFEAT_HIGHIMP = 0x00000002
SPCM_TRFEAT_DCCOUPLING = 0x00000004
Expand Down Expand Up @@ -1867,6 +1857,22 @@ def GIGA_B(g):
SPC_AVAILTHRESHOLD_MIN = 42420
SPC_AVAILTHRESHOLD_MAX = 42421
SPC_AVAILTHRESHOLD_STEP = 42422
SPC_AVAILAVRGMODES = 42429
SPC_AVRGMODE_CH0 = 42430
SPC_AVRGMODE_CH1 = 42431
SPC_AVRGMODE_CH2 = 42432
SPC_AVRGMODE_CH3 = 42433
AVRGMODE_NORMAL = 0x0
AVRGMODE_TDA_HIGH = 0x1
AVRGMODE_TDA_LOW = 0x2
SPC_TDA_THRESHOLD_CH0 = 42440
SPC_TDA_THRESHOLD_CH1 = 42441
SPC_TDA_THRESHOLD_CH2 = 42442
SPC_TDA_THRESHOLD_CH3 = 42443
SPC_TDA_REPLACEMENT_CH0 = 42450
SPC_TDA_REPLACEMENT_CH1 = 42451
SPC_TDA_REPLACEMENT_CH2 = 42452
SPC_TDA_REPLACEMENT_CH3 = 42453
SPC_CLOCK_AVAILTHRESHOLD_MIN = 42423
SPC_CLOCK_AVAILTHRESHOLD_MAX = 42424
SPC_CLOCK_AVAILTHRESHOLD_STEP = 42425
Expand Down Expand Up @@ -2041,6 +2047,7 @@ def GIGA_B(g):
SPCM_XMODE_SYNCARMSTATE = 0x00010000
SPCM_XMODE_OPTDIGIN2BIT = 0x00020000
SPCM_XMODE_OPTDIGIN4BIT = 0x00040000
SPCM_XMODE_PULSEGEN = 0x00080000
SPCM_XMODE_MODEMASK = 0x000FFFFF
SPCM_XMODE_DIGOUTSRC_CH0 = 0x01000000
SPCM_XMODE_DIGOUTSRC_CH1 = 0x02000000
Expand Down Expand Up @@ -2068,25 +2075,26 @@ def GIGA_B(g):
SPC_DIGMODE6 = 47256
SPC_DIGMODE7 = 47257
SPCM_DIGMODE_OFF = 0x00000000
SPCM_DIGMODE_X0 = 0x21084000
SPCM_DIGMODE_X1 = 0x294A5000
SPCM_DIGMODE_X2 = 0x318C6000
SPCM_DIGMODE_X3 = 0x39CE7000
SPCM_DIGMODE_X4 = 0x84210001
SPCM_DIGMODE_X5 = 0x8C631002
SPCM_DIGMODE_X6 = 0x94A52004
SPCM_DIGMODE_X7 = 0x9CE73008
SPCM_DIGMODE_X8 = 0xA5294010
SPCM_DIGMODE_X9 = 0xAD6B5020
SPCM_DIGMODE_X10 = 0xB5AD6040
SPCM_DIGMODE_X11 = 0xBDEF7080
SPCM_DIGMODE_X12 = 0xC6318100
SPCM_DIGMODE_X13 = 0xCE739200
SPCM_DIGMODE_X14 = 0xD6B5A400
SPCM_DIGMODE_X15 = 0xDEF7B800
SPCM_DIGMODE_X16 = 0xE739C000
SPCM_DIGMODE_X17 = 0xEF7BD000
SPCM_DIGMODE_X18 = 0xF7BDE000
SPCM_DIGMODE_X19 = 0xFFFFF000
SPCM_DIGMODE_X5 = 0x8c631002
SPCM_DIGMODE_X6 = 0x94a52004
SPCM_DIGMODE_X7 = 0x9ce73008
SPCM_DIGMODE_X8 = 0xa5294010
SPCM_DIGMODE_X9 = 0xad6b5020
SPCM_DIGMODE_X10 = 0xb5ad6040
SPCM_DIGMODE_X11 = 0xbdef7080
SPCM_DIGMODE_X12 = 0xc6318100
SPCM_DIGMODE_X13 = 0xce739200
SPCM_DIGMODE_X14 = 0xd6b5a400
SPCM_DIGMODE_X15 = 0xdef7b800
SPCM_DIGMODE_X16 = 0xe739c000
SPCM_DIGMODE_X17 = 0xef7bd000
SPCM_DIGMODE_X18 = 0xf7bde000
SPCM_DIGMODE_X19 = 0xfffff000
DIGMODEMASK_BIT15 = 0xF8000000
DIGMODEMASK_BIT14 = 0x07C00000
DIGMODEMASK_BIT13 = 0x003E0000
Expand Down Expand Up @@ -2211,6 +2219,7 @@ def GIGA_B(g):
ADJ_CALSRC_GND = -1
ADJ_CALSRC_GNDOFFS = -2
ADJ_CALSRC_AC = 10
ADJ_CALSRC_ADC = 11
SPC_ADJ_CALIBVALUE0 = 50060
SPC_ADJ_CALIBVALUE1 = 50061
SPC_ADJ_CALIBVALUE2 = 50062
Expand Down Expand Up @@ -2781,10 +2790,40 @@ def GIGA_B(g):
SPC_MON_TC_MODB_5 = 500075
SPC_MON_TF_MODA_5 = 500076
SPC_MON_TF_MODB_5 = 500077
SPC_MON_V_MOD_0 = 500078
SPC_MON_V_MOD_1 = 500079
SPC_MON_V_MOD_2 = 500080
SPC_MON_V_MOD_3 = 500081
SPC_MON_V_MOD_4 = 500082
SPC_MON_V_MOD_5 = 500083
SPC_MON_V_MOD_6 = 500084
SPC_MON_V_MOD_7 = 500085
SPC_MON_V_MOD_8 = 500086
SPC_MON_V_MOD_9 = 500087
SPC_MON_V_MOD_10 = 500088
SPC_MON_TK_MODULE_2 = 500089
SPC_MON_TC_MODULE_2 = 500090
SPC_MON_TF_MODULE_2 = 500091
SPC_MON_RPM_FAN0 = 500092
SPC_MON_RPM_FAN1 = 500093
SPC_MON_V_MEMVTTA = 500094
SPC_MON_V_MEMVTTB = 500095
SPC_MON_V_VCCAUX = 500096
SPC_MON_V_MEMAUXA = 500097
SPC_MON_V_MEMAUXB = 500098
SPC_MON_TK_BASE_0 = 500099
SPC_MON_TC_BASE_0 = 500100
SPC_MON_TF_BASE_0 = 500101
SPC_MON_TK_BASE_1 = 500102
SPC_MON_TC_BASE_1 = 500103
SPC_MON_TF_BASE_1 = 500104
SPC_MON_I_CORE = 500105
SPC_MON_V_CORE_REMOTE = 500106
SPC_AVAILMONITORS = 510000
SPCM_MON_T_BASE_CTRL = 0x0000000000000001
SPCM_MON_T_MODULE_0 = 0x0000000000000002
SPCM_MON_T_MODULE_1 = 0x0000000000000004
SPCM_MON_T_MODULE_2 = 0x0000000000000008
SPCM_MON_V_PCIE_BUS = 0x0000000000000010
SPCM_MON_V_CONNECTOR = 0x0000000000000020
SPCM_MON_CARD_PWRSOURCE = 0x0000000000000040
Expand Down Expand Up @@ -2829,10 +2868,33 @@ def GIGA_B(g):
SPCM_MON_I_MODA_3 = 0x0000080000000000
SPCM_MON_I_MODB_0 = 0x0000100000000000
SPCM_MON_I_MODB_1 = 0x0000200000000000
SPCM_MON_I_MODB_2 = 0x0000300000000000
SPCM_MON_I_MODB_3 = 0x0000400000000000
SPCM_MON_T_MODA_5 = 0x0000800000000000
SPCM_MON_T_MODB_5 = 0x0001000000000000
SPCM_MON_I_MODB_2 = 0x0000400000000000
SPCM_MON_I_MODB_3 = 0x0000800000000000
SPCM_MON_T_MODA_5 = 0x0001000000000000
SPCM_MON_T_MODB_5 = 0x0002000000000000
SPCM_MON_V_MEMVTTA = 0x0004000000000000
SPCM_MON_V_MEMVTTB = 0x0008000000000000
SPCM_MON_V_MEMAUXA = 0x0010000000000000
SPCM_MON_V_MEMAUXB = 0x0020000000000000
SPCM_MON_V_VCCAUX = 0x0040000000000000
SPCM_MON_T_BASE_0 = 0x0080000000000000
SPCM_MON_T_BASE_1 = 0x0100000000000000
SPCM_MON_RPM_FAN0 = 0x0200000000000000
SPCM_MON_RPM_FAN1 = 0x0400000000000000
SPCM_MON_I_CORE = 0x0800000000000000
SPCM_MON_V_CORE_REMOTE = 0x1000000000000000
SPC_AVAILMONITORS1 = 510001
SPCM_MON_V_MOD_0 = 0x0000000000000001
SPCM_MON_V_MOD_1 = 0x0000000000000002
SPCM_MON_V_MOD_2 = 0x0000000000000004
SPCM_MON_V_MOD_3 = 0x0000000000000008
SPCM_MON_V_MOD_4 = 0x0000000000000010
SPCM_MON_V_MOD_5 = 0x0000000000000020
SPCM_MON_V_MOD_6 = 0x0000000000000040
SPCM_MON_V_MOD_7 = 0x0000000000000080
SPCM_MON_V_MOD_8 = 0x0000000000000100
SPCM_MON_V_MOD_9 = 0x0000000000000200
SPCM_MON_V_MOD_10 = 0x0000000000000400
SPC_X0_READFEATURES = 600000
SPC_X1_READFEATURES = 600001
SPC_X2_READFEATURES = 600002
Expand Down Expand Up @@ -2920,6 +2982,79 @@ def GIGA_B(g):
SPCM_X17_AVAILMODES = 600317
SPCM_X18_AVAILMODES = 600318
SPCM_X19_AVAILMODES = 600319
SPC_XIO_PULSEGEN0_MODE = 601000
SPC_XIO_PULSEGEN1_MODE = 601100
SPC_XIO_PULSEGEN2_MODE = 601200
SPC_XIO_PULSEGEN3_MODE = 601300
SPCM_PULSEGEN_MODE_GATED = 1
SPCM_PULSEGEN_MODE_TRIGGERED = 2
SPCM_PULSEGEN_MODE_SINGLESHOT = 3
SPC_XIO_PULSEGEN0_LEN = 601001
SPC_XIO_PULSEGEN1_LEN = 601101
SPC_XIO_PULSEGEN2_LEN = 601201
SPC_XIO_PULSEGEN3_LEN = 601301
SPC_XIO_PULSEGEN0_HIGH = 601002
SPC_XIO_PULSEGEN1_HIGH = 601102
SPC_XIO_PULSEGEN2_HIGH = 601202
SPC_XIO_PULSEGEN3_HIGH = 601302
SPC_XIO_PULSEGEN0_OFFSET = 601003
SPC_XIO_PULSEGEN1_OFFSET = 601103
SPC_XIO_PULSEGEN2_OFFSET = 601203
SPC_XIO_PULSEGEN3_OFFSET = 601303
SPC_XIO_PULSEGEN0_LOOPS = 601004
SPC_XIO_PULSEGEN1_LOOPS = 601104
SPC_XIO_PULSEGEN2_LOOPS = 601204
SPC_XIO_PULSEGEN3_LOOPS = 601304
SPC_XIO_PULSEGEN0_MUX1_SRC = 601005
SPC_XIO_PULSEGEN1_MUX1_SRC = 601105
SPC_XIO_PULSEGEN2_MUX1_SRC = 601205
SPC_XIO_PULSEGEN3_MUX1_SRC = 601305
SPCM_PULSEGEN_MUX1_SRC_UNUSED = 0
SPCM_PULSEGEN_MUX1_SRC_RUN = 1
SPCM_PULSEGEN_MUX1_SRC_ARM = 2
SPC_XIO_PULSEGEN0_MUX2_SRC = 601006
SPC_XIO_PULSEGEN1_MUX2_SRC = 601106
SPC_XIO_PULSEGEN2_MUX2_SRC = 601206
SPC_XIO_PULSEGEN3_MUX2_SRC = 601306
SPCM_PULSEGEN_MUX2_SRC_UNUSED = 0
SPCM_PULSEGEN_MUX2_SRC_SOFTWARE = 1
SPCM_PULSEGEN_MUX2_SRC_CARDTRIGGER = 2
SPCM_PULSEGEN_MUX2_SRC_PULSEGEN0 = 3
SPCM_PULSEGEN_MUX2_SRC_PULSEGEN1 = 4
SPCM_PULSEGEN_MUX2_SRC_PULSEGEN2 = 5
SPCM_PULSEGEN_MUX2_SRC_PULSEGEN3 = 6
SPCM_PULSEGEN_MUX2_SRC_XIO0 = 7
SPCM_PULSEGEN_MUX2_SRC_XIO1 = 8
SPCM_PULSEGEN_MUX2_SRC_XIO2 = 9
SPCM_PULSEGEN_MUX2_SRC_XIO3 = 10
SPC_XIO_PULSEGEN0_CONFIG = 601007
SPC_XIO_PULSEGEN1_CONFIG = 601107
SPC_XIO_PULSEGEN2_CONFIG = 601207
SPC_XIO_PULSEGEN3_CONFIG = 601307
SPCM_PULSEGEN_CONFIG_MUX1_INVERT = 0x1
SPCM_PULSEGEN_CONFIG_MUX2_INVERT = 0x2
SPCM_PULSEGEN_CONFIG_INVERT = 0x4
SPCM_PULSEGEN_CONFIG_HIGH = 0x8
SPC_XIO_PULSEGEN_ENABLE = 601500
SPCM_PULSEGEN_ENABLE0 = 0x01
SPCM_PULSEGEN_ENABLE1 = 0x02
SPCM_PULSEGEN_ENABLE2 = 0x04
SPCM_PULSEGEN_ENABLE3 = 0x08
SPC_XIO_PULSEGEN_COMMAND = 601501
SPCM_PULSEGEN_CMD_FORCE = 0x1
SPC_XIO_PULSEGEN_CLOCK = 602000
SPC_XIO_PULSEGEN_AVAILLEN_MIN = 602001
SPC_XIO_PULSEGEN_AVAILLEN_MAX = 602002
SPC_XIO_PULSEGEN_AVAILLEN_STEP = 602003
SPC_XIO_PULSEGEN_AVAILHIGH_MIN = 602004
SPC_XIO_PULSEGEN_AVAILHIGH_MAX = 602005
SPC_XIO_PULSEGEN_AVAILHIGH_STEP = 602006
SPC_XIO_PULSEGEN_AVAILOFFSET_MIN = 602007
SPC_XIO_PULSEGEN_AVAILOFFSET_MAX = 602008
SPC_XIO_PULSEGEN_AVAILOFFSET_STEP = 602009
SPC_XIO_PULSEGEN_AVAILLOOPS_MIN = 602010
SPC_XIO_PULSEGEN_AVAILLOOPS_MAX = 602011
SPC_XIO_PULSEGEN_AVAILLOOPS_STEP = 602012
SPC_REG0x00 = 900000
SPC_REG0x02 = 900010
SPC_REG0x04 = 900020
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
#
# **************************************************************************
#
# spcerr.py (c) Spectrum GmbH
#
# **************************************************************************
#
# Feel free to use this source for own projects and modify it in any kind.
#
# **************************************************************************


SPCM_ERROR_ORIGIN_MASK = 0x80000000
SPCM_ERROR_ORIGIN_LOCAL = 0x00000000
SPCM_ERROR_ORIGIN_REMOTE = 0x80000000
Expand Down Expand Up @@ -41,6 +29,7 @@
ERR_RESTRICTEDACCESS = 0x0045
ERR_INVALIDPARAM = 0x0046
ERR_TEMPERATURE = 0x0047
ERR_FAN = 0x0048
ERR_REG = 0x0100
ERR_VALUE = 0x0101
ERR_FEATURE = 0x0102
Expand Down Expand Up @@ -75,6 +64,7 @@
ERR_STARHUBENABLE = 0x014B
ERR_PATPWSMALLEDGE = 0x014C
ERR_XMODESETUP = 0x014D
ERR_AVRG_TDA = 0x014E
ERR_NOPCI = 0x0200
ERR_PCIVERSION = 0x0201
ERR_PCINOBOARDS = 0x0202
Expand Down
Loading

0 comments on commit deaa2e6

Please sign in to comment.