diff --git a/.pylintrc b/.pylintrc index 5d18c80a..e9f9d455 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,128 +1,128 @@ [MAIN] -# Analyse import fallback blocks. This can be used to support both Python 2 and +#Analyse import fallback blocks.This can be used to support both Python 2 and # 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. +#only in one or another interpreter, leading to false positives when analysed. analyse-fallback-blocks=no -# Clear in-memory caches upon conclusion of linting. Useful if running pylint -# in a server-like mode. +#Clear in - memory caches upon conclusion of linting.Useful if running pylint +#in a server - like mode. clear-cache-post-run=no -# Load and enable all available extensions. Use --list-extensions to see a list -# all available extensions. -#enable-all-extensions= +#Load and enable all available extensions.Use-- list - extensions to see a list +#all available extensions. +#enable - all - extensions = -# In error mode, messages with a category besides ERROR or FATAL are -# suppressed, and no reports are done by default. Error mode is compatible with -# disabling specific errors. -#errors-only= +#In error mode, messages with a category besides ERROR or FATAL are +#suppressed, and no reports are done by default.Error mode is compatible with +#disabling specific errors. +#errors - only = -# Always return a 0 (non-error) status code, even if lint errors are found. -# This is primarily useful in continuous integration scripts. -#exit-zero= +#Always return a 0(non - error) status code, even if lint errors are found. +#This is primarily useful in continuous integration scripts. +#exit - zero = -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. +#A comma - separated list of package or module names from where C extensions may +#be loaded.Extensions are loading into the active Python interpreter and may +#run arbitrary code. extension-pkg-allow-list= -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. (This is an alternative name to extension-pkg-allow-list -# for backward compatibility.) +#A comma - separated list of package or module names from where C extensions may +#be loaded.Extensions are loading into the active Python interpreter and may +#run arbitrary code.(This is an alternative name to extension - pkg - allow - list +#for backward compatibility.) extension-pkg-whitelist= -# Return non-zero exit code if any of these messages/categories are detected, -# even if score is above --fail-under value. Syntax same as enable. Messages -# specified are enabled, while categories only check already-enabled messages. +#Return non - zero exit code if any of these messages / categories are detected, +#even if score is above-- fail - under value.Syntax same as enable.Messages +#specified are enabled, while categories only check already - enabled messages. fail-on= -# Specify a score threshold under which the program will exit with error. +#Specify a score threshold under which the program will exit with error. fail-under=10 -# Interpret the stdin as a python script, whose filename needs to be passed as -# the module_or_package argument. -#from-stdin= +#Interpret the stdin as a python script, whose filename needs to be passed as +#the module_or_package argument. +#from - stdin = -# Files or directories to be skipped. They should be base names, not paths. +#Files or directories to be skipped.They should be base names, not paths. ignore=CVS -# Add files or directories matching the regular expressions patterns to the -# ignore-list. The regex matches against paths and can be in Posix or Windows -# format. Because '\\' represents the directory delimiter on Windows systems, -# it can't be used as an escape character. +#Add files or directories matching the regular expressions patterns to the +#ignore - list.The regex matches against paths and can be in Posix or Windows +#format.Because '\\' represents the directory delimiter on Windows systems, +#it can't be used as an escape character. ignore-paths= -# Files or directories matching the regular expression patterns are skipped. -# The regex matches against base names, not paths. The default value ignores -# Emacs file locks +#Files or directories matching the regular expression patterns are skipped. +#The regex matches against base names, not paths.The default value ignores +#Emacs file locks ignore-patterns=^\.# -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis). It -# supports qualified module names, as well as Unix pattern matching. +#List of module names for which member attributes should not be checked +#(useful for modules / projects where namespaces are manipulated during runtime +#and thus existing member attributes cannot be deduced by static analysis).It +#supports qualified module names, as well as Unix pattern matching. ignored-modules= -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= +#Python code to execute, usually for sys.path manipulation such as +#pygtk.require(). +#init - hook = -# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the -# number of processors available to use, and will cap the count on Windows to -# avoid hangs. +#Use multiple processes to speed up Pylint.Specifying 0 will auto - detect the +#number of processors available to use, and will cap the count on Windows to +#avoid hangs. jobs=1 -# Control the amount of potential inferred values when inferring a single -# object. This can help the performance when dealing with large functions or -# complex, nested conditions. +#Control the amount of potential inferred values when inferring a single +#object.This can help the performance when dealing with large functions or +#complex, nested conditions. limit-inference-results=100 -# List of plugins (as comma separated values of python module names) to load, -# usually to register additional checkers. +#List of plugins(as comma separated values of python module names) to load, +#usually to register additional checkers. load-plugins= -# Pickle collected data for later comparisons. +#Pickle collected data for later comparisons. persistent=yes -# Minimum Python version to use for version dependent checks. Will default to -# the version used to run pylint. +#Minimum Python version to use for version dependent checks.Will default to +#the version used to run pylint. py-version=3.9 -# Discover python modules and packages in the file system subtree. +#Discover python modules and packages in the file system subtree. recursive=no -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. +#When enabled, pylint would attempt to guess common misconfiguration and emit +#user - friendly hints instead of false - positive error messages. suggestion-mode=yes -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. +#Allow loading of arbitrary C extensions.Extensions are imported into the +#active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no -# In verbose mode, extra non-checker-related info will be displayed. -#verbose= +#In verbose mode, extra non - checker - related info will be displayed. +#verbose = [BASIC] -# Naming style matching correct argument names. +#Naming style matching correct argument names. argument-naming-style=any -# Regular expression matching correct argument names. Overrides argument- -# naming-style. If left empty, argument names will be checked with the set -# naming style. -#argument-rgx= +#Regular expression matching correct argument names.Overrides argument - +#naming - style.If left empty, argument names will be checked with the set +#naming style. +#argument - rgx = -# Naming style matching correct attribute names. +#Naming style matching correct attribute names. attr-naming-style=snake_case -# Regular expression matching correct attribute names. Overrides attr-naming- -# style. If left empty, attribute names will be checked with the set naming -# style. -#attr-rgx= +#Regular expression matching correct attribute names.Overrides attr - naming - +#style.If left empty, attribute names will be checked with the set naming +#style. +#attr - rgx = -# Bad variable names which should always be refused, separated by a comma. +#Bad variable names which should always be refused, separated by a comma. bad-names=foo, bar, baz, @@ -130,54 +130,54 @@ bad-names=foo, tutu, tata -# Bad variable names regexes, separated by a comma. If names match any regex, -# they will always be refused +#Bad variable names regexes, separated by a comma.If names match any regex, +#they will always be refused bad-names-rgxs= -# Naming style matching correct class attribute names. +#Naming style matching correct class attribute names. class-attribute-naming-style=any -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style. If left empty, class attribute names will be checked -# with the set naming style. -#class-attribute-rgx= +#Regular expression matching correct class attribute names.Overrides class - +#attribute - naming - style.If left empty, class attribute names will be checked +#with the set naming style. +#class - attribute - rgx = -# Naming style matching correct class constant names. +#Naming style matching correct class constant names. class-const-naming-style=any -# Regular expression matching correct class constant names. Overrides class- -# const-naming-style. If left empty, class constant names will be checked with -# the set naming style. -#class-const-rgx= +#Regular expression matching correct class constant names.Overrides class - +#const - naming - style.If left empty, class constant names will be checked with +#the set naming style. +#class - const - rgx = -# Naming style matching correct class names. +#Naming style matching correct class names. class-naming-style=any -# Regular expression matching correct class names. Overrides class-naming- -# style. If left empty, class names will be checked with the set naming style. -#class-rgx= +#Regular expression matching correct class names.Overrides class - naming - +#style.If left empty, class names will be checked with the set naming style. +#class - rgx = -# Naming style matching correct constant names. +#Naming style matching correct constant names. const-naming-style=any -# Regular expression matching correct constant names. Overrides const-naming- -# style. If left empty, constant names will be checked with the set naming -# style. -#const-rgx= +#Regular expression matching correct constant names.Overrides const - naming - +#style.If left empty, constant names will be checked with the set naming +#style. +#const - rgx = -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. +#Minimum line length for functions / classes that require docstrings, shorter +#ones are exempt. docstring-min-length=-1 -# Naming style matching correct function names. +#Naming style matching correct function names. function-naming-style=any -# Regular expression matching correct function names. Overrides function- -# naming-style. If left empty, function names will be checked with the set -# naming style. -#function-rgx= +#Regular expression matching correct function names.Overrides function - +#naming - style.If left empty, function names will be checked with the set +#naming style. +#function - rgx = -# Good variable names which should always be accepted, separated by a comma. +#Good variable names which should always be accepted, separated by a comma. good-names=i, j, k, @@ -185,234 +185,234 @@ good-names=i, Run, _ -# Good variable names regexes, separated by a comma. If names match any regex, -# they will always be accepted +#Good variable names regexes, separated by a comma.If names match any regex, +#they will always be accepted good-names-rgxs= -# Include a hint for the correct naming format with invalid-name. +#Include a hint for the correct naming format with invalid - name. include-naming-hint=no -# Naming style matching correct inline iteration names. +#Naming style matching correct inline iteration names. inlinevar-naming-style=any -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style. If left empty, inline iteration names will be checked -# with the set naming style. -#inlinevar-rgx= +#Regular expression matching correct inline iteration names.Overrides +#inlinevar - naming - style.If left empty, inline iteration names will be checked +#with the set naming style. +#inlinevar - rgx = -# Naming style matching correct method names. +#Naming style matching correct method names. method-naming-style=snake_case -# Regular expression matching correct method names. Overrides method-naming- -# style. If left empty, method names will be checked with the set naming style. -#method-rgx= +#Regular expression matching correct method names.Overrides method - naming - +#style.If left empty, method names will be checked with the set naming style. +#method - rgx = -# Naming style matching correct module names. +#Naming style matching correct module names. module-naming-style=snake_case -# Regular expression matching correct module names. Overrides module-naming- -# style. If left empty, module names will be checked with the set naming style. -#module-rgx= +#Regular expression matching correct module names.Overrides module - naming - +#style.If left empty, module names will be checked with the set naming style. +#module - rgx = -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. +#Colon - delimited sets of names that determine each other's naming style when +#the name regexes allow several styles. name-group= -# Regular expression which should only match function or class names that do -# not require a docstring. +#Regular expression which should only match function or class names that do +#not require a docstring. no-docstring-rgx=^_ -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -# These decorators are taken in consideration only for invalid-name. +#List of decorators that produce properties, such as abc.abstractproperty.Add +#to this list to register other decorators that produce valid properties. +#These decorators are taken in consideration only for invalid - name. property-classes=abc.abstractproperty -# Regular expression matching correct type variable names. If left empty, type -# variable names will be checked with the set naming style. -#typevar-rgx= +#Regular expression matching correct type variable names.If left empty, type +#variable names will be checked with the set naming style. +#typevar - rgx = -# Naming style matching correct variable names. +#Naming style matching correct variable names. variable-naming-style=snake_case -# Regular expression matching correct variable names. Overrides variable- -# naming-style. If left empty, variable names will be checked with the set -# naming style. -#variable-rgx= +#Regular expression matching correct variable names.Overrides variable - +#naming - style.If left empty, variable names will be checked with the set +#naming style. +#variable - rgx = [CLASSES] -# Warn about protected attribute access inside special methods +#Warn about protected attribute access inside special methods check-protected-access-in-special-methods=no -# List of method names used to declare (i.e. assign) instance attributes. +#List of method names used to declare(i.e.assign) instance attributes. defining-attr-methods=__init__, __new__, setUp, __post_init__ -# List of member names, which should be excluded from the protected access -# warning. +#List of member names, which should be excluded from the protected access +#warning. exclude-protected=_asdict, _fields, _replace, _source, _make -# List of valid names for the first argument in a class method. +#List of valid names for the first argument in a class method. valid-classmethod-first-arg=cls -# List of valid names for the first argument in a metaclass class method. +#List of valid names for the first argument in a metaclass class method. valid-metaclass-classmethod-first-arg=mcs [DESIGN] -# List of regular expressions of class ancestor names to ignore when counting -# public methods (see R0903) +#List of regular expressions of class ancestor names to ignore when counting +#public methods(see R0903) exclude-too-few-public-methods= -# List of qualified class names to ignore when counting class parents (see -# R0901) +#List of qualified class names to ignore when counting class parents(see +#R0901) ignored-parents= -# Maximum number of arguments for function / method. +#Maximum number of arguments for function / method. max-args=5 -# Maximum number of attributes for a class (see R0902). +#Maximum number of attributes for a class(see R0902). max-attributes=7 -# Maximum number of boolean expressions in an if statement (see R0916). +#Maximum number of boolean expressions in an if statement(see R0916). max-bool-expr=5 -# Maximum number of branch for function / method body. +#Maximum number of branch for function / method body. max-branches=12 -# Maximum number of locals for function / method body. +#Maximum number of locals for function / method body. max-locals=15 -# Maximum number of parents for a class (see R0901). +#Maximum number of parents for a class(see R0901). max-parents=7 -# Maximum number of public methods for a class (see R0904). +#Maximum number of public methods for a class(see R0904). max-public-methods=20 -# Maximum number of return / yield for function / method body. +#Maximum number of return / yield for function / method body. max-returns=6 -# Maximum number of statements in function / method body. +#Maximum number of statements in function / method body. max-statements=50 -# Minimum number of public methods for a class (see R0903). +#Minimum number of public methods for a class(see R0903). min-public-methods=2 [EXCEPTIONS] -# Exceptions that will emit a warning when caught. +#Exceptions that will emit a warning when caught. overgeneral-exceptions=builtins.BaseException,builtins.Exception [FORMAT] -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +#Expected format of line ending, e.g.empty(any line ending), LF or CRLF. expected-line-ending-format= -# Regexp for a line that is allowed to be longer than the limit. +#Regexp for a line that is allowed to be longer than the limit. ignore-long-lines=^\s*(# )??$ -# Number of spaces of indent required inside a hanging or continued line. +#Number of spaces of indent required inside a hanging or continued line. indent-after-paren=4 -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). +#String used as indentation unit.This is usually " "(4 spaces) or "\t"(1 +#tab). indent-string=' ' -# Maximum number of characters on a single line. +#Maximum number of characters on a single line. max-line-length=100 -# Maximum number of lines in a module. +#Maximum number of lines in a module. max-module-lines=1000 -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. +#Allow the body of a class to be on the same line as the declaration if body +#contains single statement. single-line-class-stmt=no -# Allow the body of an if to be on the same line as the test if there is no -# else. +#Allow the body of an if to be on the same line as the test if there is no +#else. single-line-if-stmt=no [IMPORTS] -# List of modules that can be imported at any level, not just the top level -# one. +#List of modules that can be imported at any level, not just the top level +#one. allow-any-import-level= -# Allow explicit reexports by alias from a package __init__. +#Allow explicit reexports by alias from a package __init__. allow-reexport-from-package=no -# Allow wildcard imports from modules that define __all__. +#Allow wildcard imports from modules that define __all__. allow-wildcard-with-all=no -# Deprecated modules which should not be used, separated by a comma. +#Deprecated modules which should not be used, separated by a comma. deprecated-modules= -# Output a graph (.gv or any supported image format) of external dependencies -# to the given file (report RP0402 must not be disabled). +#Output a graph(.gv or any supported image format) of external dependencies +#to the given file(report RP0402 must not be disabled). ext-import-graph= -# Output a graph (.gv or any supported image format) of all (i.e. internal and -# external) dependencies to the given file (report RP0402 must not be -# disabled). +#Output a graph(.gv or any supported image format) of all(i.e.internal and +#external) dependencies to the given file(report RP0402 must not be +#disabled). import-graph= -# Output a graph (.gv or any supported image format) of internal dependencies -# to the given file (report RP0402 must not be disabled). +#Output a graph(.gv or any supported image format) of internal dependencies +#to the given file(report RP0402 must not be disabled). int-import-graph= -# Force import order to recognize a module as part of the standard -# compatibility libraries. +#Force import order to recognize a module as part of the standard +#compatibility libraries. known-standard-library= -# Force import order to recognize a module as part of a third party library. +#Force import order to recognize a module as part of a third party library. known-third-party=enchant -# Couples of modules and preferred modules, separated by a comma. +#Couples of modules and preferred modules, separated by a comma. preferred-modules= [LOGGING] -# The type of string formatting that logging methods do. `old` means using % -# formatting, `new` is for `{}` formatting. +#The type of string formatting that logging methods do. `old` means using % +#formatting, `new` is for `{}` formatting. logging-format-style=old -# Logging modules to check that the string format arguments are in logging -# function parameter format. +#Logging modules to check that the string format arguments are in logging +#function parameter format. logging-modules=logging [MESSAGES CONTROL] -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, -# UNDEFINED. +#Only show warnings with the listed confidence levels.Leave empty to show +#all.Valid levels : HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, +#UNDEFINED. confidence=HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, UNDEFINED -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once). You can also use "--disable=all" to -# disable everything first and then re-enable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use "--disable=all --enable=classes -# --disable=W". +#Disable the message, report, category or checker with the given id(s).You +#can either give multiple identifiers separated by comma(, ) or put this +#option multiple times(only on the command line, not in the configuration +#file where it should appear only once).You can also use "--disable=all" to +#disable everything first and then re - enable specific checks.For example, if +#you want to run only the similarities checker, you can use "--disable=all +#-- enable = similarities ". If you want to run only the classes checker, but have +#no Warning level messages displayed, use "--disable=all --enable=classes +#-- disable = W ". disable=raw-checker-failed, bad-inline-option, locally-disabled, @@ -424,203 +424,202 @@ disable=raw-checker-failed, consider-using-enumerate, consider-using-f-string -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. +#Enable the message, report, category or checker with the given id(s).You can +#either give multiple identifier separated by comma(, ) or put this option +#multiple time(only on the command line, not in the configuration file where +#it should appear only once).See also the "--disable" option for examples. enable=c-extension-no-member [METHOD_ARGS] -# List of qualified names (i.e., library.method) which require a timeout -# parameter e.g. 'requests.api.get,requests.api.post' +#List of qualified names(i.e., library.method) which require a timeout +#parameter e.g.'requests.api.get,requests.api.post' timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request [MISCELLANEOUS] -# List of note tags to take in consideration, separated by a comma. +#List of note tags to take in consideration, separated by a comma. notes=FIXME, XXX, TODO -# Regular expression of note tags to take in consideration. +#Regular expression of note tags to take in consideration. notes-rgx= [REFACTORING] - -# Maximum number of nested blocks for function / method body +#Maximum number of nested blocks for function / method body max-nested-blocks=5 -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. +#Complete name of functions that never returns.When checking for +#inconsistent - return -statements if a never returning function is called then +#it will be considered as an explicit return statement and no message will be +#printed. never-returning-functions=sys.exit,argparse.parse_error [REPORTS] -# Python expression which should return a score less than or equal to 10. You -# have access to the variables 'fatal', 'error', 'warning', 'refactor', -# 'convention', and 'info' which contain the number of messages in each -# category, as well as 'statement' which is the total number of statements -# analyzed. This score is used by the global evaluation report (RP0004). +#Python expression which should return a score less than or equal to 10. You +#have access to the variables 'fatal', 'error', 'warning', 'refactor', +#'convention', and 'info' which contain the number of messages in each +#category, as well as 'statement' which is the total number of statements +#analyzed.This score is used by the global evaluation report(RP0004). evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details. +#Template used to display messages.This is a python new - style format string +#used to format the message information.See doc for all details. msg-template= -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio). You can also give a reporter class, e.g. -# mypackage.mymodule.MyReporterClass. -#output-format= +#Set the output format.Available formats are text, parseable, colorized, json +#and msvs(visual studio).You can also give a reporter class, e.g. +#mypackage.mymodule.MyReporterClass. +#output - format = -# Tells whether to display a full report or only the messages. +#Tells whether to display a full report or only the messages. reports=no -# Activate the evaluation score. +#Activate the evaluation score. score=yes [SIMILARITIES] -# Comments are removed from the similarity computation +#Comments are removed from the similarity computation ignore-comments=yes -# Docstrings are removed from the similarity computation +#Docstrings are removed from the similarity computation ignore-docstrings=yes -# Imports are removed from the similarity computation +#Imports are removed from the similarity computation ignore-imports=yes -# Signatures are removed from the similarity computation +#Signatures are removed from the similarity computation ignore-signatures=yes -# Minimum lines number of a similarity. +#Minimum lines number of a similarity. min-similarity-lines=4 [SPELLING] -# Limits count of emitted suggestions for spelling mistakes. +#Limits count of emitted suggestions for spelling mistakes. max-spelling-suggestions=4 -# Spelling dictionary name. Available dictionaries: none. To make it work, -# install the 'python-enchant' package. +#Spelling dictionary name.Available dictionaries : none.To make it work, +#install the 'python-enchant' package. spelling-dict= -# List of comma separated words that should be considered directives if they -# appear at the beginning of a comment and should not be checked. +#List of comma separated words that should be considered directives if they +#appear at the beginning of a comment and should not be checked. spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: -# List of comma separated words that should not be checked. +#List of comma separated words that should not be checked. spelling-ignore-words= -# A path to a file that contains the private dictionary; one word per line. +#A path to a file that contains the private dictionary; one word per line. spelling-private-dict-file= -# Tells whether to store unknown words to the private dictionary (see the -# --spelling-private-dict-file option) instead of raising a message. +#Tells whether to store unknown words to the private dictionary(see the +#-- spelling - private - dict - file option) instead of raising a message. spelling-store-unknown-words=no [STRING] -# This flag controls whether inconsistent-quotes generates a warning when the -# character used as a quote delimiter is used inconsistently within a module. +#This flag controls whether inconsistent - quotes generates a warning when the +#character used as a quote delimiter is used inconsistently within a module. check-quote-consistency=no -# This flag controls whether the implicit-str-concat should generate a warning -# on implicit string concatenation in sequences defined over several lines. +#This flag controls whether the implicit - str - concat should generate a warning +#on implicit string concatenation in sequences defined over several lines. check-str-concat-over-line-jumps=no [TYPECHECK] -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. +#List of decorators that produce context managers, such as +#contextlib.contextmanager.Add to this list to register other decorators that +#produce valid context managers. contextmanager-decorators=contextlib.contextmanager -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. +#List of members which are set dynamically and missed by pylint inference +#system, and so shouldn't trigger E1101 when accessed. Python regular +#expressions are accepted. generated-members= -# Tells whether to warn about missing members when the owner of the attribute -# is inferred to be None. +#Tells whether to warn about missing members when the owner of the attribute +#is inferred to be None. ignore-none=yes -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. +#This flag controls whether pylint should warn about no - member and similar +#checks whenever an opaque object is returned when inferring.The inference +#can return multiple potential results while evaluating a Python object, but +#some branches might not be evaluated, which results in partial inference.In +#that case, it might be useful to still emit no - member and other checks for +#the rest of the inferred objects. ignore-on-opaque-inference=yes -# List of symbolic message names to ignore for Mixin members. +#List of symbolic message names to ignore for Mixin members. ignored-checks-for-mixins=no-member, not-async-context-manager, not-context-manager, attribute-defined-outside-init -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. +#List of class names for which member attributes should not be checked(useful +#for classes with dynamically set attributes).This supports the use of +#qualified names. ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. +#Show a hint with possible names when a member name was not found.The aspect +#of finding the hint is based on edit distance. missing-member-hint=yes -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. +#The minimum edit distance a name should have in order to be considered a +#similar match for a missing member name. missing-member-hint-distance=1 -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. +#The total number of similar names that should be taken in consideration when +#showing a hint for a missing member. missing-member-max-choices=1 -# Regex pattern to define which classes are considered mixins. +#Regex pattern to define which classes are considered mixins. mixin-class-rgx=.*[Mm]ixin -# List of decorators that change the signature of a decorated function. +#List of decorators that change the signature of a decorated function. signature-mutators= [VARIABLES] -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid defining new builtins when possible. +#List of additional names supposed to be defined in builtins.Remember that +#you should avoid defining new builtins when possible. additional-builtins= -# Tells whether unused global variables should be treated as a violation. +#Tells whether unused global variables should be treated as a violation. allow-global-unused-variables=yes -# List of names allowed to shadow builtins +#List of names allowed to shadow builtins allowed-redefined-builtins= -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. +#List of strings which can identify a callback function by name.A callback +#name must start or end with one of those strings. callbacks=cb_, _cb -# A regular expression matching the name of dummy variables (i.e. expected to -# not be used). +#A regular expression matching the name of dummy variables(i.e.expected to +#not be used). dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ -# Argument names that match this expression will be ignored. +#Argument names that match this expression will be ignored. ignored-argument-names=_.*|^ignored_|^unused_ -# Tells whether we should check for unused import in __init__ files. +#Tells whether we should check for unused import in __init__ files. init-import=no -# List of qualified module names which can have objects that can redefine -# builtins. +#List of qualified module names which can have objects that can redefine +#builtins. redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io diff --git a/projects/cm_mcu/LocalTasks.c b/projects/cm_mcu/LocalTasks.c index e8b2ce07..f9235129 100644 --- a/projects/cm_mcu/LocalTasks.c +++ b/projects/cm_mcu/LocalTasks.c @@ -166,9 +166,9 @@ struct sm_command_t sm_command_ffldaq_f1[] = { {1, 0x00, 0x03, 1, "FF_LOS_ALARM", 0xff, "", PM_STATUS}, {1, 0x00, 0x05, 1, "FF_CDR_LOL_ALARM", 0xff, "", PM_STATUS}, {2, 0x00, 0x22, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 4 Rx-ch registers with increasing addresses - {2, 0x00, 0x24, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x00, 0x26, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x00, 0x28, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x24, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x26, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x28, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, }; uint16_t ffldaq_f1_values[NSUPPLIES_FFLDAQ_F1 * NCOMMANDS_FFLDAQ_F1]; @@ -200,21 +200,21 @@ struct sm_command_t sm_command_fflit_f1[] = { {1, 0x00, 0x16, 2, "FF_TEMPERATURE", 0xff, "C", PM_STATUS}, {2, 0x00, 0x07, 1, "FF_LOS_ALARM", 0xffff, "", PM_STATUS}, {2, 0x00, 0x14, 1, "FF_CDR_LOL_ALARM", 0xffff, "", PM_STATUS}, - // there are no registers to read optical power for 14Gbps ECUO. - // registers below are a placeholder with a reading equal to zero - // the reason we need them because n_commands is fixed - {1, 0x00, 0x00, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, + // there are no registers to read optical power for 14Gbps ECUO. + // registers below are a placeholder with a reading equal to zero + // the reason we need them because n_commands is fixed + {1, 0x00, 0x00, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, }; // register maps for OT-DTC Fireflies 12-ch part -- 25Gbps ECUO (no connected devices to test as of 08.04.22) @@ -225,17 +225,17 @@ struct sm_command_t sm_command_fflot_f1[] = { {2, 0x00, 0x07, 1, "FF_LOS_ALARM", 0xffff, "", PM_STATUS}, {2, 0x00, 0x14, 1, "FF_CDR_LOL_ALARM", 0xffff, "", PM_STATUS}, {2, 0x01, 0xe4, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 12 Rx-ch registers with decreasing addresses - {2, 0x01, 0xe2, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xe0, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xde, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xdc, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xda, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd8, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd6, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd4, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd2, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd0, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xce, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xe2, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xe0, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xde, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xdc, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xda, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd8, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd6, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd4, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd2, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd0, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xce, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, }; @@ -316,9 +316,9 @@ struct sm_command_t sm_command_ffldaq_f2[] = { {1, 0x00, 0x03, 1, "FF_LOS_ALARM", 0xff, "", PM_STATUS}, {1, 0x00, 0x05, 1, "FF_CDR_LOL_ALARM", 0xff, "", PM_STATUS}, {2, 0x00, 0x22, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 4 Rx-ch registers with increasing addresses - {2, 0x00, 0x24, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x00, 0x26, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x00, 0x28, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x24, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x26, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x28, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, }; uint16_t ffldaq_f2_values[NSUPPLIES_FFLDAQ_F2 * NCOMMANDS_FFLDAQ_F2]; @@ -349,21 +349,21 @@ struct sm_command_t sm_command_fflit_f2[] = { {1, 0x00, 0x16, 2, "FF_TEMPERATURE", 0xff, "C", PM_STATUS}, {2, 0x00, 0x07, 1, "FF_LOS_ALARM", 0xffff, "", PM_STATUS}, {2, 0x00, 0x14, 1, "FF_CDR_LOL_ALARM", 0xffff, "", PM_STATUS}, - // there are no registers to read optical power for 14Gbps ECUO. - // registers below are a placeholder with a reading equal to zero - // the reason we need them because n_commands is fixed - {1, 0x00, 0x00, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, - {1, 0x00, 0x00, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, + // there are no registers to read optical power for 14Gbps ECUO. + // registers below are a placeholder with a reading equal to zero + // the reason we need them because n_commands is fixed + {1, 0x00, 0x00, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, + {1, 0x00, 0x00, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, }; // register maps for OT-DTC Fireflies 12-ch part -- 25Gbps ECUO (no connected devices to test as of 08.04.22) // **commands below have not been tested yet** @@ -373,17 +373,17 @@ struct sm_command_t sm_command_fflot_f2[] = { {2, 0x00, 0x07, 1, "FF_LOS_ALARM", 0xffff, "", PM_STATUS}, {2, 0x00, 0x14, 1, "FF_CDR_LOL_ALARM", 0xffff, "", PM_STATUS}, {2, 0x01, 0xe4, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 12 Rx-ch registers with decreasing addresses - {2, 0x01, 0xe2, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xe0, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xde, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xdc, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xda, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd8, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd6, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd4, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd2, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd0, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xce, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xe2, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xe0, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xde, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xdc, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xda, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd8, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd6, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd4, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd2, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd0, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xce, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, }; #ifdef REV1 @@ -717,42 +717,42 @@ uint16_t getFFtemp(const uint8_t i) uint16_t getFFoptpow(const uint8_t i) { - uint16_t avg_val; - uint16_t sum_val; + uint16_t avg_val = 0; + uint16_t sum_val = 0; configASSERT(i < NFIREFLIES); if (i < NFIREFLIES_IT_F1) { - for (int i1 = 4; i1 < ffl12_f1_args.n_commands; ++i1) { - int dev = i - ff_moni2c_arg[0].int_idx + ff_moni2c_arg[0].dev_int_idx; - int index = dev * (ffl12_f1_args.n_commands * ffl12_f1_args.n_pages) + i1; - sum_val += ffl12_f1_args.sm_values[index]; - } - avg_val = sum_val/(ffl12_f1_args.n_commands-4); + for (int i1 = 4; i1 < ffl12_f1_args.n_commands; ++i1) { + int dev = i - ff_moni2c_arg[0].int_idx + ff_moni2c_arg[0].dev_int_idx; + int index = dev * (ffl12_f1_args.n_commands * ffl12_f1_args.n_pages) + i1; + sum_val += ffl12_f1_args.sm_values[index]; + } + avg_val = sum_val / (ffl12_f1_args.n_commands - 4); } else if (NFIREFLIES_IT_F1 <= i && i < NFIREFLIES_IT_F1 + NFIREFLIES_DAQ_F1) { - for (int i1 = 4; i1 < ffldaq_f1_args.n_commands; ++i1) { - int dev = i - ff_moni2c_arg[1].int_idx + ff_moni2c_arg[1].dev_int_idx; - int index = (dev) * (ffldaq_f1_args.n_commands * ffldaq_f1_args.n_pages) + i1; - sum_val += ffldaq_f1_args.sm_values[index]; - } - avg_val = sum_val/(ffldaq_f1_args.n_commands-4); + for (int i1 = 4; i1 < ffldaq_f1_args.n_commands; ++i1) { + int dev = i - ff_moni2c_arg[1].int_idx + ff_moni2c_arg[1].dev_int_idx; + int index = (dev) * (ffldaq_f1_args.n_commands * ffldaq_f1_args.n_pages) + i1; + sum_val += ffldaq_f1_args.sm_values[index]; + } + avg_val = sum_val / (ffldaq_f1_args.n_commands - 4); } else if (NFIREFLIES_F1 <= i && i < NFIREFLIES_F1 + NFIREFLIES_IT_F2) { - for (int i1 = 4; i1 < ffl12_f2_args.n_commands; ++i1) { - int dev = i - ff_moni2c_arg[2].int_idx + ff_moni2c_arg[2].dev_int_idx; - int index = (dev) * (ffl12_f2_args.n_commands * ffl12_f2_args.n_pages) + i1; - sum_val += ffl12_f2_args.sm_values[index]; - } - avg_val = sum_val/(ffl12_f2_args.n_commands-4); + for (int i1 = 4; i1 < ffl12_f2_args.n_commands; ++i1) { + int dev = i - ff_moni2c_arg[2].int_idx + ff_moni2c_arg[2].dev_int_idx; + int index = (dev) * (ffl12_f2_args.n_commands * ffl12_f2_args.n_pages) + i1; + sum_val += ffl12_f2_args.sm_values[index]; + } + avg_val = sum_val / (ffl12_f2_args.n_commands - 4); } else { - for (int i1 = 4; i1 < ffldaq_f2_args.n_commands; ++i1) { - int dev = i - ff_moni2c_arg[3].int_idx + ff_moni2c_arg[3].dev_int_idx; - int index = (dev) * (ffldaq_f2_args.n_commands * ffldaq_f2_args.n_pages) + i1; - sum_val += ffldaq_f2_args.sm_values[index]; - } - avg_val = sum_val/(ffldaq_f2_args.n_commands-4); + for (int i1 = 4; i1 < ffldaq_f2_args.n_commands; ++i1) { + int dev = i - ff_moni2c_arg[3].int_idx + ff_moni2c_arg[3].dev_int_idx; + int index = (dev) * (ffldaq_f2_args.n_commands * ffldaq_f2_args.n_pages) + i1; + sum_val += ffldaq_f2_args.sm_values[index]; + } + avg_val = sum_val / (ffldaq_f2_args.n_commands - 4); } return avg_val; } diff --git a/projects/cm_mcu/MonitorI2CTask.h b/projects/cm_mcu/MonitorI2CTask.h index f6ecbe6c..2a3fb023 100644 --- a/projects/cm_mcu/MonitorI2CTask.h +++ b/projects/cm_mcu/MonitorI2CTask.h @@ -61,9 +61,9 @@ struct MonitorI2CTaskArgs_t { #define NSUPPLIES_FFL12_F1 (8) #else // REV1 #define NSUPPLIES_FFL12_F1 (6) -#endif // REV 2 +#endif // REV 2 #define NCOMMANDS_FFL12_F1 16 // number of commands -#define NPAGES_FFL12_F1 1 // number of pages on the 12-channel firefly ports +#define NPAGES_FFL12_F1 1 // number of pages on the 12-channel firefly ports #ifndef REV2 #define NSUPPLIES_FFLDAQ_F2 (10) @@ -77,9 +77,9 @@ struct MonitorI2CTaskArgs_t { #define NSUPPLIES_FFL12_F2 (4) #else // REV1 #define NSUPPLIES_FFL12_F2 (6) -#endif // REV 2 +#endif // REV 2 #define NCOMMANDS_FFL12_F2 16 // number of commands -#define NPAGES_FFL12_F2 1 // number of pages on the 12-channel firefly ports +#define NPAGES_FFL12_F2 1 // number of pages on the 12-channel firefly ports extern struct dev_moni2c_addr_t ffl12_f1_moni2c_addrs[NFIREFLIES_IT_F1]; extern struct dev_moni2c_addr_t ffldaq_f1_moni2c_addrs[NFIREFLIES_DAQ_F1]; diff --git a/projects/cm_mcu/commands/SensorControl.c b/projects/cm_mcu/commands/SensorControl.c index 0563a47f..bcae7b5e 100644 --- a/projects/cm_mcu/commands/SensorControl.c +++ b/projects/cm_mcu/commands/SensorControl.c @@ -876,83 +876,79 @@ BaseType_t ff_temp(int argc, char **argv, char *m) BaseType_t ff_optpow(int argc, char **argv, char *m) { - // argument handling - int copied = 0; - - static int whichff = 0; - static int n = 0; - static int i1 = 4; - - if (whichff == 0) { - // check for stale data - TickType_t now = pdTICKS_TO_S(xTaskGetTickCount()); - - if (isFFStale()) { - TickType_t last = pdTICKS_TO_S(getFFupdateTick(isFFStale())); - int mins = (now - last) / 60; - copied += snprintf(m + copied, SCRATCH_SIZE - copied, - "%s: stale data, last update %d minutes ago\r\n", argv[0], mins); - } - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "FF Optical Power:\r\n"); - } - - - for (; n < NFIREFLY_ARG; ++n) { - struct MonitorI2CTaskArgs_t *ff_arg = ff_moni2c_arg[n].arg; - for (; whichff < ff_moni2c_arg[n].int_idx + ff_moni2c_arg[n].num_dev; ++whichff) { - - int dev = whichff - ff_moni2c_arg[n].int_idx + ff_moni2c_arg[n].dev_int_idx; - - if (strstr(ff_moni2c_addrs[whichff].name, "Tx") != NULL) - continue; - if (isEnabledFF(ff_moni2c_arg[n].int_idx + dev)) { - i1 = 4; - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "%17s: \r\n", ff_moni2c_addrs[whichff].name); - for (; i1 < ff_arg->n_commands; ++i1) { - int index = dev * (ff_arg->n_commands * ff_arg->n_pages) + i1; - uint8_t val = ff_arg->sm_values[index]; - if ((SCRATCH_SIZE - copied) < 20) { - return pdTRUE; - } - - if ((i1-4)%6 == 0) - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); - else if ((i1-4)%6 == 1) - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); - else if ((i1-4)%6 == 2) - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); - else if ((i1-4)%6 == 3) - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); - else if ((i1-4)%6 == 4) - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); - else - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \r\n", i1 - 3, val); - - } - - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "\r\n"); - - } - else // dummy value - copied += snprintf(m + copied, SCRATCH_SIZE - copied, "%17s: %2s \r\n", ff_moni2c_addrs[whichff].name, "--"); - - - if ((SCRATCH_SIZE - copied) < 20) { - ++whichff; - return pdTRUE; - } - } - } - - if (whichff % 2 == 1) { - m[copied++] = '\r'; - m[copied++] = '\n'; - m[copied] = '\0'; - } - whichff = 0; - n = 0; - i1 = 4; - return pdFALSE; + // argument handling + int copied = 0; + + static int whichff = 0; + static int n = 0; + static int i1 = 4; + + if (whichff == 0) { + // check for stale data + TickType_t now = pdTICKS_TO_S(xTaskGetTickCount()); + + if (isFFStale()) { + TickType_t last = pdTICKS_TO_S(getFFupdateTick(isFFStale())); + int mins = (now - last) / 60; + copied += snprintf(m + copied, SCRATCH_SIZE - copied, + "%s: stale data, last update %d minutes ago\r\n", argv[0], mins); + } + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "FF Optical Power:\r\n"); + } + + for (; n < NFIREFLY_ARG; ++n) { + struct MonitorI2CTaskArgs_t *ff_arg = ff_moni2c_arg[n].arg; + for (; whichff < ff_moni2c_arg[n].int_idx + ff_moni2c_arg[n].num_dev; ++whichff) { + + int dev = whichff - ff_moni2c_arg[n].int_idx + ff_moni2c_arg[n].dev_int_idx; + + if (strstr(ff_moni2c_addrs[whichff].name, "Tx") != NULL) + continue; + if (isEnabledFF(ff_moni2c_arg[n].int_idx + dev)) { + i1 = 4; + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "%17s: \r\n", ff_moni2c_addrs[whichff].name); + for (; i1 < ff_arg->n_commands; ++i1) { + int index = dev * (ff_arg->n_commands * ff_arg->n_pages) + i1; + uint8_t val = ff_arg->sm_values[index]; + if ((SCRATCH_SIZE - copied) < 20) { + return pdTRUE; + } + + if ((i1 - 4) % 6 == 0) + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); + else if ((i1 - 4) % 6 == 1) + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); + else if ((i1 - 4) % 6 == 2) + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); + else if ((i1 - 4) % 6 == 3) + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); + else if ((i1 - 4) % 6 == 4) + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \t", i1 - 3, val); + else + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "CH%2d: %2d \r\n", i1 - 3, val); + } + + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "\r\n"); + } + else // dummy value + copied += snprintf(m + copied, SCRATCH_SIZE - copied, "%17s: %2s \r\n", ff_moni2c_addrs[whichff].name, "--"); + + if ((SCRATCH_SIZE - copied) < 20) { + ++whichff; + return pdTRUE; + } + } + } + + if (whichff % 2 == 1) { + m[copied++] = '\r'; + m[copied++] = '\n'; + m[copied] = '\0'; + } + whichff = 0; + n = 0; + i1 = 4; + return pdFALSE; } // this command takes up to two arguments diff --git a/sm_cm_config/.pylintrc b/sm_cm_config/.pylintrc index 5d18c80a..e9f9d455 100644 --- a/sm_cm_config/.pylintrc +++ b/sm_cm_config/.pylintrc @@ -1,128 +1,128 @@ [MAIN] -# Analyse import fallback blocks. This can be used to support both Python 2 and +#Analyse import fallback blocks.This can be used to support both Python 2 and # 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. +#only in one or another interpreter, leading to false positives when analysed. analyse-fallback-blocks=no -# Clear in-memory caches upon conclusion of linting. Useful if running pylint -# in a server-like mode. +#Clear in - memory caches upon conclusion of linting.Useful if running pylint +#in a server - like mode. clear-cache-post-run=no -# Load and enable all available extensions. Use --list-extensions to see a list -# all available extensions. -#enable-all-extensions= +#Load and enable all available extensions.Use-- list - extensions to see a list +#all available extensions. +#enable - all - extensions = -# In error mode, messages with a category besides ERROR or FATAL are -# suppressed, and no reports are done by default. Error mode is compatible with -# disabling specific errors. -#errors-only= +#In error mode, messages with a category besides ERROR or FATAL are +#suppressed, and no reports are done by default.Error mode is compatible with +#disabling specific errors. +#errors - only = -# Always return a 0 (non-error) status code, even if lint errors are found. -# This is primarily useful in continuous integration scripts. -#exit-zero= +#Always return a 0(non - error) status code, even if lint errors are found. +#This is primarily useful in continuous integration scripts. +#exit - zero = -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. +#A comma - separated list of package or module names from where C extensions may +#be loaded.Extensions are loading into the active Python interpreter and may +#run arbitrary code. extension-pkg-allow-list= -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. (This is an alternative name to extension-pkg-allow-list -# for backward compatibility.) +#A comma - separated list of package or module names from where C extensions may +#be loaded.Extensions are loading into the active Python interpreter and may +#run arbitrary code.(This is an alternative name to extension - pkg - allow - list +#for backward compatibility.) extension-pkg-whitelist= -# Return non-zero exit code if any of these messages/categories are detected, -# even if score is above --fail-under value. Syntax same as enable. Messages -# specified are enabled, while categories only check already-enabled messages. +#Return non - zero exit code if any of these messages / categories are detected, +#even if score is above-- fail - under value.Syntax same as enable.Messages +#specified are enabled, while categories only check already - enabled messages. fail-on= -# Specify a score threshold under which the program will exit with error. +#Specify a score threshold under which the program will exit with error. fail-under=10 -# Interpret the stdin as a python script, whose filename needs to be passed as -# the module_or_package argument. -#from-stdin= +#Interpret the stdin as a python script, whose filename needs to be passed as +#the module_or_package argument. +#from - stdin = -# Files or directories to be skipped. They should be base names, not paths. +#Files or directories to be skipped.They should be base names, not paths. ignore=CVS -# Add files or directories matching the regular expressions patterns to the -# ignore-list. The regex matches against paths and can be in Posix or Windows -# format. Because '\\' represents the directory delimiter on Windows systems, -# it can't be used as an escape character. +#Add files or directories matching the regular expressions patterns to the +#ignore - list.The regex matches against paths and can be in Posix or Windows +#format.Because '\\' represents the directory delimiter on Windows systems, +#it can't be used as an escape character. ignore-paths= -# Files or directories matching the regular expression patterns are skipped. -# The regex matches against base names, not paths. The default value ignores -# Emacs file locks +#Files or directories matching the regular expression patterns are skipped. +#The regex matches against base names, not paths.The default value ignores +#Emacs file locks ignore-patterns=^\.# -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis). It -# supports qualified module names, as well as Unix pattern matching. +#List of module names for which member attributes should not be checked +#(useful for modules / projects where namespaces are manipulated during runtime +#and thus existing member attributes cannot be deduced by static analysis).It +#supports qualified module names, as well as Unix pattern matching. ignored-modules= -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= +#Python code to execute, usually for sys.path manipulation such as +#pygtk.require(). +#init - hook = -# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the -# number of processors available to use, and will cap the count on Windows to -# avoid hangs. +#Use multiple processes to speed up Pylint.Specifying 0 will auto - detect the +#number of processors available to use, and will cap the count on Windows to +#avoid hangs. jobs=1 -# Control the amount of potential inferred values when inferring a single -# object. This can help the performance when dealing with large functions or -# complex, nested conditions. +#Control the amount of potential inferred values when inferring a single +#object.This can help the performance when dealing with large functions or +#complex, nested conditions. limit-inference-results=100 -# List of plugins (as comma separated values of python module names) to load, -# usually to register additional checkers. +#List of plugins(as comma separated values of python module names) to load, +#usually to register additional checkers. load-plugins= -# Pickle collected data for later comparisons. +#Pickle collected data for later comparisons. persistent=yes -# Minimum Python version to use for version dependent checks. Will default to -# the version used to run pylint. +#Minimum Python version to use for version dependent checks.Will default to +#the version used to run pylint. py-version=3.9 -# Discover python modules and packages in the file system subtree. +#Discover python modules and packages in the file system subtree. recursive=no -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. +#When enabled, pylint would attempt to guess common misconfiguration and emit +#user - friendly hints instead of false - positive error messages. suggestion-mode=yes -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. +#Allow loading of arbitrary C extensions.Extensions are imported into the +#active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no -# In verbose mode, extra non-checker-related info will be displayed. -#verbose= +#In verbose mode, extra non - checker - related info will be displayed. +#verbose = [BASIC] -# Naming style matching correct argument names. +#Naming style matching correct argument names. argument-naming-style=any -# Regular expression matching correct argument names. Overrides argument- -# naming-style. If left empty, argument names will be checked with the set -# naming style. -#argument-rgx= +#Regular expression matching correct argument names.Overrides argument - +#naming - style.If left empty, argument names will be checked with the set +#naming style. +#argument - rgx = -# Naming style matching correct attribute names. +#Naming style matching correct attribute names. attr-naming-style=snake_case -# Regular expression matching correct attribute names. Overrides attr-naming- -# style. If left empty, attribute names will be checked with the set naming -# style. -#attr-rgx= +#Regular expression matching correct attribute names.Overrides attr - naming - +#style.If left empty, attribute names will be checked with the set naming +#style. +#attr - rgx = -# Bad variable names which should always be refused, separated by a comma. +#Bad variable names which should always be refused, separated by a comma. bad-names=foo, bar, baz, @@ -130,54 +130,54 @@ bad-names=foo, tutu, tata -# Bad variable names regexes, separated by a comma. If names match any regex, -# they will always be refused +#Bad variable names regexes, separated by a comma.If names match any regex, +#they will always be refused bad-names-rgxs= -# Naming style matching correct class attribute names. +#Naming style matching correct class attribute names. class-attribute-naming-style=any -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style. If left empty, class attribute names will be checked -# with the set naming style. -#class-attribute-rgx= +#Regular expression matching correct class attribute names.Overrides class - +#attribute - naming - style.If left empty, class attribute names will be checked +#with the set naming style. +#class - attribute - rgx = -# Naming style matching correct class constant names. +#Naming style matching correct class constant names. class-const-naming-style=any -# Regular expression matching correct class constant names. Overrides class- -# const-naming-style. If left empty, class constant names will be checked with -# the set naming style. -#class-const-rgx= +#Regular expression matching correct class constant names.Overrides class - +#const - naming - style.If left empty, class constant names will be checked with +#the set naming style. +#class - const - rgx = -# Naming style matching correct class names. +#Naming style matching correct class names. class-naming-style=any -# Regular expression matching correct class names. Overrides class-naming- -# style. If left empty, class names will be checked with the set naming style. -#class-rgx= +#Regular expression matching correct class names.Overrides class - naming - +#style.If left empty, class names will be checked with the set naming style. +#class - rgx = -# Naming style matching correct constant names. +#Naming style matching correct constant names. const-naming-style=any -# Regular expression matching correct constant names. Overrides const-naming- -# style. If left empty, constant names will be checked with the set naming -# style. -#const-rgx= +#Regular expression matching correct constant names.Overrides const - naming - +#style.If left empty, constant names will be checked with the set naming +#style. +#const - rgx = -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. +#Minimum line length for functions / classes that require docstrings, shorter +#ones are exempt. docstring-min-length=-1 -# Naming style matching correct function names. +#Naming style matching correct function names. function-naming-style=any -# Regular expression matching correct function names. Overrides function- -# naming-style. If left empty, function names will be checked with the set -# naming style. -#function-rgx= +#Regular expression matching correct function names.Overrides function - +#naming - style.If left empty, function names will be checked with the set +#naming style. +#function - rgx = -# Good variable names which should always be accepted, separated by a comma. +#Good variable names which should always be accepted, separated by a comma. good-names=i, j, k, @@ -185,234 +185,234 @@ good-names=i, Run, _ -# Good variable names regexes, separated by a comma. If names match any regex, -# they will always be accepted +#Good variable names regexes, separated by a comma.If names match any regex, +#they will always be accepted good-names-rgxs= -# Include a hint for the correct naming format with invalid-name. +#Include a hint for the correct naming format with invalid - name. include-naming-hint=no -# Naming style matching correct inline iteration names. +#Naming style matching correct inline iteration names. inlinevar-naming-style=any -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style. If left empty, inline iteration names will be checked -# with the set naming style. -#inlinevar-rgx= +#Regular expression matching correct inline iteration names.Overrides +#inlinevar - naming - style.If left empty, inline iteration names will be checked +#with the set naming style. +#inlinevar - rgx = -# Naming style matching correct method names. +#Naming style matching correct method names. method-naming-style=snake_case -# Regular expression matching correct method names. Overrides method-naming- -# style. If left empty, method names will be checked with the set naming style. -#method-rgx= +#Regular expression matching correct method names.Overrides method - naming - +#style.If left empty, method names will be checked with the set naming style. +#method - rgx = -# Naming style matching correct module names. +#Naming style matching correct module names. module-naming-style=snake_case -# Regular expression matching correct module names. Overrides module-naming- -# style. If left empty, module names will be checked with the set naming style. -#module-rgx= +#Regular expression matching correct module names.Overrides module - naming - +#style.If left empty, module names will be checked with the set naming style. +#module - rgx = -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. +#Colon - delimited sets of names that determine each other's naming style when +#the name regexes allow several styles. name-group= -# Regular expression which should only match function or class names that do -# not require a docstring. +#Regular expression which should only match function or class names that do +#not require a docstring. no-docstring-rgx=^_ -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -# These decorators are taken in consideration only for invalid-name. +#List of decorators that produce properties, such as abc.abstractproperty.Add +#to this list to register other decorators that produce valid properties. +#These decorators are taken in consideration only for invalid - name. property-classes=abc.abstractproperty -# Regular expression matching correct type variable names. If left empty, type -# variable names will be checked with the set naming style. -#typevar-rgx= +#Regular expression matching correct type variable names.If left empty, type +#variable names will be checked with the set naming style. +#typevar - rgx = -# Naming style matching correct variable names. +#Naming style matching correct variable names. variable-naming-style=snake_case -# Regular expression matching correct variable names. Overrides variable- -# naming-style. If left empty, variable names will be checked with the set -# naming style. -#variable-rgx= +#Regular expression matching correct variable names.Overrides variable - +#naming - style.If left empty, variable names will be checked with the set +#naming style. +#variable - rgx = [CLASSES] -# Warn about protected attribute access inside special methods +#Warn about protected attribute access inside special methods check-protected-access-in-special-methods=no -# List of method names used to declare (i.e. assign) instance attributes. +#List of method names used to declare(i.e.assign) instance attributes. defining-attr-methods=__init__, __new__, setUp, __post_init__ -# List of member names, which should be excluded from the protected access -# warning. +#List of member names, which should be excluded from the protected access +#warning. exclude-protected=_asdict, _fields, _replace, _source, _make -# List of valid names for the first argument in a class method. +#List of valid names for the first argument in a class method. valid-classmethod-first-arg=cls -# List of valid names for the first argument in a metaclass class method. +#List of valid names for the first argument in a metaclass class method. valid-metaclass-classmethod-first-arg=mcs [DESIGN] -# List of regular expressions of class ancestor names to ignore when counting -# public methods (see R0903) +#List of regular expressions of class ancestor names to ignore when counting +#public methods(see R0903) exclude-too-few-public-methods= -# List of qualified class names to ignore when counting class parents (see -# R0901) +#List of qualified class names to ignore when counting class parents(see +#R0901) ignored-parents= -# Maximum number of arguments for function / method. +#Maximum number of arguments for function / method. max-args=5 -# Maximum number of attributes for a class (see R0902). +#Maximum number of attributes for a class(see R0902). max-attributes=7 -# Maximum number of boolean expressions in an if statement (see R0916). +#Maximum number of boolean expressions in an if statement(see R0916). max-bool-expr=5 -# Maximum number of branch for function / method body. +#Maximum number of branch for function / method body. max-branches=12 -# Maximum number of locals for function / method body. +#Maximum number of locals for function / method body. max-locals=15 -# Maximum number of parents for a class (see R0901). +#Maximum number of parents for a class(see R0901). max-parents=7 -# Maximum number of public methods for a class (see R0904). +#Maximum number of public methods for a class(see R0904). max-public-methods=20 -# Maximum number of return / yield for function / method body. +#Maximum number of return / yield for function / method body. max-returns=6 -# Maximum number of statements in function / method body. +#Maximum number of statements in function / method body. max-statements=50 -# Minimum number of public methods for a class (see R0903). +#Minimum number of public methods for a class(see R0903). min-public-methods=2 [EXCEPTIONS] -# Exceptions that will emit a warning when caught. +#Exceptions that will emit a warning when caught. overgeneral-exceptions=builtins.BaseException,builtins.Exception [FORMAT] -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +#Expected format of line ending, e.g.empty(any line ending), LF or CRLF. expected-line-ending-format= -# Regexp for a line that is allowed to be longer than the limit. +#Regexp for a line that is allowed to be longer than the limit. ignore-long-lines=^\s*(# )??$ -# Number of spaces of indent required inside a hanging or continued line. +#Number of spaces of indent required inside a hanging or continued line. indent-after-paren=4 -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). +#String used as indentation unit.This is usually " "(4 spaces) or "\t"(1 +#tab). indent-string=' ' -# Maximum number of characters on a single line. +#Maximum number of characters on a single line. max-line-length=100 -# Maximum number of lines in a module. +#Maximum number of lines in a module. max-module-lines=1000 -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. +#Allow the body of a class to be on the same line as the declaration if body +#contains single statement. single-line-class-stmt=no -# Allow the body of an if to be on the same line as the test if there is no -# else. +#Allow the body of an if to be on the same line as the test if there is no +#else. single-line-if-stmt=no [IMPORTS] -# List of modules that can be imported at any level, not just the top level -# one. +#List of modules that can be imported at any level, not just the top level +#one. allow-any-import-level= -# Allow explicit reexports by alias from a package __init__. +#Allow explicit reexports by alias from a package __init__. allow-reexport-from-package=no -# Allow wildcard imports from modules that define __all__. +#Allow wildcard imports from modules that define __all__. allow-wildcard-with-all=no -# Deprecated modules which should not be used, separated by a comma. +#Deprecated modules which should not be used, separated by a comma. deprecated-modules= -# Output a graph (.gv or any supported image format) of external dependencies -# to the given file (report RP0402 must not be disabled). +#Output a graph(.gv or any supported image format) of external dependencies +#to the given file(report RP0402 must not be disabled). ext-import-graph= -# Output a graph (.gv or any supported image format) of all (i.e. internal and -# external) dependencies to the given file (report RP0402 must not be -# disabled). +#Output a graph(.gv or any supported image format) of all(i.e.internal and +#external) dependencies to the given file(report RP0402 must not be +#disabled). import-graph= -# Output a graph (.gv or any supported image format) of internal dependencies -# to the given file (report RP0402 must not be disabled). +#Output a graph(.gv or any supported image format) of internal dependencies +#to the given file(report RP0402 must not be disabled). int-import-graph= -# Force import order to recognize a module as part of the standard -# compatibility libraries. +#Force import order to recognize a module as part of the standard +#compatibility libraries. known-standard-library= -# Force import order to recognize a module as part of a third party library. +#Force import order to recognize a module as part of a third party library. known-third-party=enchant -# Couples of modules and preferred modules, separated by a comma. +#Couples of modules and preferred modules, separated by a comma. preferred-modules= [LOGGING] -# The type of string formatting that logging methods do. `old` means using % -# formatting, `new` is for `{}` formatting. +#The type of string formatting that logging methods do. `old` means using % +#formatting, `new` is for `{}` formatting. logging-format-style=old -# Logging modules to check that the string format arguments are in logging -# function parameter format. +#Logging modules to check that the string format arguments are in logging +#function parameter format. logging-modules=logging [MESSAGES CONTROL] -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, -# UNDEFINED. +#Only show warnings with the listed confidence levels.Leave empty to show +#all.Valid levels : HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, +#UNDEFINED. confidence=HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, UNDEFINED -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once). You can also use "--disable=all" to -# disable everything first and then re-enable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use "--disable=all --enable=classes -# --disable=W". +#Disable the message, report, category or checker with the given id(s).You +#can either give multiple identifiers separated by comma(, ) or put this +#option multiple times(only on the command line, not in the configuration +#file where it should appear only once).You can also use "--disable=all" to +#disable everything first and then re - enable specific checks.For example, if +#you want to run only the similarities checker, you can use "--disable=all +#-- enable = similarities ". If you want to run only the classes checker, but have +#no Warning level messages displayed, use "--disable=all --enable=classes +#-- disable = W ". disable=raw-checker-failed, bad-inline-option, locally-disabled, @@ -424,203 +424,202 @@ disable=raw-checker-failed, consider-using-enumerate, consider-using-f-string -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. +#Enable the message, report, category or checker with the given id(s).You can +#either give multiple identifier separated by comma(, ) or put this option +#multiple time(only on the command line, not in the configuration file where +#it should appear only once).See also the "--disable" option for examples. enable=c-extension-no-member [METHOD_ARGS] -# List of qualified names (i.e., library.method) which require a timeout -# parameter e.g. 'requests.api.get,requests.api.post' +#List of qualified names(i.e., library.method) which require a timeout +#parameter e.g.'requests.api.get,requests.api.post' timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request [MISCELLANEOUS] -# List of note tags to take in consideration, separated by a comma. +#List of note tags to take in consideration, separated by a comma. notes=FIXME, XXX, TODO -# Regular expression of note tags to take in consideration. +#Regular expression of note tags to take in consideration. notes-rgx= [REFACTORING] - -# Maximum number of nested blocks for function / method body +#Maximum number of nested blocks for function / method body max-nested-blocks=5 -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. +#Complete name of functions that never returns.When checking for +#inconsistent - return -statements if a never returning function is called then +#it will be considered as an explicit return statement and no message will be +#printed. never-returning-functions=sys.exit,argparse.parse_error [REPORTS] -# Python expression which should return a score less than or equal to 10. You -# have access to the variables 'fatal', 'error', 'warning', 'refactor', -# 'convention', and 'info' which contain the number of messages in each -# category, as well as 'statement' which is the total number of statements -# analyzed. This score is used by the global evaluation report (RP0004). +#Python expression which should return a score less than or equal to 10. You +#have access to the variables 'fatal', 'error', 'warning', 'refactor', +#'convention', and 'info' which contain the number of messages in each +#category, as well as 'statement' which is the total number of statements +#analyzed.This score is used by the global evaluation report(RP0004). evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details. +#Template used to display messages.This is a python new - style format string +#used to format the message information.See doc for all details. msg-template= -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio). You can also give a reporter class, e.g. -# mypackage.mymodule.MyReporterClass. -#output-format= +#Set the output format.Available formats are text, parseable, colorized, json +#and msvs(visual studio).You can also give a reporter class, e.g. +#mypackage.mymodule.MyReporterClass. +#output - format = -# Tells whether to display a full report or only the messages. +#Tells whether to display a full report or only the messages. reports=no -# Activate the evaluation score. +#Activate the evaluation score. score=yes [SIMILARITIES] -# Comments are removed from the similarity computation +#Comments are removed from the similarity computation ignore-comments=yes -# Docstrings are removed from the similarity computation +#Docstrings are removed from the similarity computation ignore-docstrings=yes -# Imports are removed from the similarity computation +#Imports are removed from the similarity computation ignore-imports=yes -# Signatures are removed from the similarity computation +#Signatures are removed from the similarity computation ignore-signatures=yes -# Minimum lines number of a similarity. +#Minimum lines number of a similarity. min-similarity-lines=4 [SPELLING] -# Limits count of emitted suggestions for spelling mistakes. +#Limits count of emitted suggestions for spelling mistakes. max-spelling-suggestions=4 -# Spelling dictionary name. Available dictionaries: none. To make it work, -# install the 'python-enchant' package. +#Spelling dictionary name.Available dictionaries : none.To make it work, +#install the 'python-enchant' package. spelling-dict= -# List of comma separated words that should be considered directives if they -# appear at the beginning of a comment and should not be checked. +#List of comma separated words that should be considered directives if they +#appear at the beginning of a comment and should not be checked. spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: -# List of comma separated words that should not be checked. +#List of comma separated words that should not be checked. spelling-ignore-words= -# A path to a file that contains the private dictionary; one word per line. +#A path to a file that contains the private dictionary; one word per line. spelling-private-dict-file= -# Tells whether to store unknown words to the private dictionary (see the -# --spelling-private-dict-file option) instead of raising a message. +#Tells whether to store unknown words to the private dictionary(see the +#-- spelling - private - dict - file option) instead of raising a message. spelling-store-unknown-words=no [STRING] -# This flag controls whether inconsistent-quotes generates a warning when the -# character used as a quote delimiter is used inconsistently within a module. +#This flag controls whether inconsistent - quotes generates a warning when the +#character used as a quote delimiter is used inconsistently within a module. check-quote-consistency=no -# This flag controls whether the implicit-str-concat should generate a warning -# on implicit string concatenation in sequences defined over several lines. +#This flag controls whether the implicit - str - concat should generate a warning +#on implicit string concatenation in sequences defined over several lines. check-str-concat-over-line-jumps=no [TYPECHECK] -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. +#List of decorators that produce context managers, such as +#contextlib.contextmanager.Add to this list to register other decorators that +#produce valid context managers. contextmanager-decorators=contextlib.contextmanager -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. +#List of members which are set dynamically and missed by pylint inference +#system, and so shouldn't trigger E1101 when accessed. Python regular +#expressions are accepted. generated-members= -# Tells whether to warn about missing members when the owner of the attribute -# is inferred to be None. +#Tells whether to warn about missing members when the owner of the attribute +#is inferred to be None. ignore-none=yes -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. +#This flag controls whether pylint should warn about no - member and similar +#checks whenever an opaque object is returned when inferring.The inference +#can return multiple potential results while evaluating a Python object, but +#some branches might not be evaluated, which results in partial inference.In +#that case, it might be useful to still emit no - member and other checks for +#the rest of the inferred objects. ignore-on-opaque-inference=yes -# List of symbolic message names to ignore for Mixin members. +#List of symbolic message names to ignore for Mixin members. ignored-checks-for-mixins=no-member, not-async-context-manager, not-context-manager, attribute-defined-outside-init -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. +#List of class names for which member attributes should not be checked(useful +#for classes with dynamically set attributes).This supports the use of +#qualified names. ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. +#Show a hint with possible names when a member name was not found.The aspect +#of finding the hint is based on edit distance. missing-member-hint=yes -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. +#The minimum edit distance a name should have in order to be considered a +#similar match for a missing member name. missing-member-hint-distance=1 -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. +#The total number of similar names that should be taken in consideration when +#showing a hint for a missing member. missing-member-max-choices=1 -# Regex pattern to define which classes are considered mixins. +#Regex pattern to define which classes are considered mixins. mixin-class-rgx=.*[Mm]ixin -# List of decorators that change the signature of a decorated function. +#List of decorators that change the signature of a decorated function. signature-mutators= [VARIABLES] -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid defining new builtins when possible. +#List of additional names supposed to be defined in builtins.Remember that +#you should avoid defining new builtins when possible. additional-builtins= -# Tells whether unused global variables should be treated as a violation. +#Tells whether unused global variables should be treated as a violation. allow-global-unused-variables=yes -# List of names allowed to shadow builtins +#List of names allowed to shadow builtins allowed-redefined-builtins= -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. +#List of strings which can identify a callback function by name.A callback +#name must start or end with one of those strings. callbacks=cb_, _cb -# A regular expression matching the name of dummy variables (i.e. expected to -# not be used). +#A regular expression matching the name of dummy variables(i.e.expected to +#not be used). dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ -# Argument names that match this expression will be ignored. +#Argument names that match this expression will be ignored. ignored-argument-names=_.*|^ignored_|^unused_ -# Tells whether we should check for unused import in __init__ files. +#Tells whether we should check for unused import in __init__ files. init-import=no -# List of qualified module names which can have objects that can redefine -# builtins. +#List of qualified module names which can have objects that can redefine +#builtins. redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io diff --git a/sm_cm_config/README.md b/sm_cm_config/README.md index 57714e99..f2bc504a 100644 --- a/sm_cm_config/README.md +++ b/sm_cm_config/README.md @@ -1,2 +1,2 @@ -# sm_cm_config +#sm_cm_config Configuration files for SM and CM firmware diff --git a/sm_cm_config/src/mcu_generate.ipynb b/sm_cm_config/src/mcu_generate.ipynb index def32a6a..e2cdaef6 100644 --- a/sm_cm_config/src/mcu_generate.ipynb +++ b/sm_cm_config/src/mcu_generate.ipynb @@ -1,154 +1,154 @@ { - "cells": [ - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [], - "source": [ - "import yaml\n", - "from pprint import pprint\n", - "import dicttoxml\n", - "# there is also dict2xml available in pypy (python3)\n", - "#\n", - "# THIS IS OBSOLETE -- DO NOT USE -- ONLY FOR HISTORICAL INTEREST" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], - "source": [ - "with open('../data/zynqmon_2.yml') as f:\n", - " data = yaml.load(f, Loader=yaml.FullLoader)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ + "cells" : [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "firefly\n", - "psmon\n", - "adcmon\n", - "uptime\n", - "gitversion\n", - "fpga\n" - ] - } - ], - "source": [ - "config = data['config']\n", - "for c in config:\n", - " print(c['name'])" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [], - "source": [ - "# size = 0\n", - "# for c in config:\n", - "# # generate C call\n", - "# expected_length = len(c['names'])\n", - "# if 'postfixes' in c:\n", - "# expected_length *= len(c['postfixes'])\n", - "# if '32' in c['type']:\n", - "# expected_length *= 2\n", - "# if 'size' in c:\n", - "# expected_length *= c['size']*4 # size in 4 byte words -- extra factor of 4\n", - "# #if ( c['count'] != expected_length ) :\n", - "# # print(f\"// mismatch: {expected_length}, size {c['count']}\")\n", - "# print(f\"// {c['name']}, size {expected_length}\")\n", - "# print(f\"zm_set_{c['mcu_call']}(&zynqmon_data[{size}], {c['start']});\")\n", - "# size += expected_length\n", - "# print(f\"#define ZMON_VALID_ENTRIES {size}\")" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ + "cell_type" : "code", + "execution_count" : 11, + "metadata" : {}, + "outputs" : [], + "source" : [ + "import yaml\n", + "from pprint import pprint\n", + "import dicttoxml\n", + "# there is also dict2xml available in pypy (python3)\n", + "#\n", + "# THIS IS OBSOLETE -- DO NOT USE -- ONLY FOR HISTORICAL INTEREST" + ] + }, + { + "cell_type" : "code", + "execution_count" : 12, + "metadata" : {}, + "outputs" : [], + "source" : [ + "with open('../data/zynqmon_2.yml') as f:\n", + " data = yaml.load(f, Loader=yaml.FullLoader)\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 13, + "metadata" : {}, + "outputs" : [ + { + "name" : "stdout", + "output_type" : "stream", + "text" : [ + "firefly\n", + "psmon\n", + "adcmon\n", + "uptime\n", + "gitversion\n", + "fpga\n" + ] + } + ], + "source" : [ + "config = data['config']\n", + "for c in config:\n", + " print(c['name'])" + ] + }, + { + "cell_type" : "code", + "execution_count" : 14, + "metadata" : {}, + "outputs" : [], + "source" : [ + "# size = 0\n", + "# for c in config:\n", + "# # generate C call\n", + "# expected_length = len(c['names'])\n", + "# if 'postfixes' in c:\n", + "# expected_length *= len(c['postfixes'])\n", + "# if '32' in c['type']:\n", + "# expected_length *= 2\n", + "# if 'size' in c:\n", + "# expected_length *= c['size']*4 # size in 4 byte words -- extra factor of 4\n", + "# #if ( c['count'] != expected_length ) :\n", + "# # print(f\"// mismatch: {expected_length}, size {c['count']}\")\n", + "# print(f\"// {c['name']}, size {expected_length}\")\n", + "# print(f\"zm_set_{c['mcu_call']}(&zynqmon_data[{size}], {c['start']});\")\n", + "# size += expected_length\n", + "# print(f\"#define ZMON_VALID_ENTRIES {size}\")" + ] + }, + { + "cell_type" : "code", + "execution_count" : 15, + "metadata" : {}, + "outputs" : [ + { + "name" : "stdout", + "output_type" : "stream", + "text" : [ + "// firefly, size 20\n", + "zm_set_firefly_temps(&zynqmon_data[0], 0);\n", + "// psmon, size 70\n", + "zm_set_psmon(&zynqmon_data[20], 32);\n", + "// adcmon, size 21\n", + "zm_set_adcmon(&zynqmon_data[90], 128);\n", + "// uptime, size 2\n", + "zm_set_uptime(&zynqmon_data[111], 192);\n", + "// gitversion, size 10.0\n", + "zm_set_gitversion(&zynqmon_data[113], 118);\n", + "// fpga, size 8\n", + "zm_set_fpga(&zynqmon_data[123], 150);\n", + "#define ZMON_VALID_ENTRIES 131\n" + ] + } + ], + "source" : [ + "size = 0\n", + "for c in config:\n", + " # generate C call\n", + " expected_length = len(c['names'])\n", + " if 'postfixes' in c:\n", + " expected_length *= len(c['postfixes'])\n", + " if '32' in c['type']:\n", + " expected_length *= 2\n", + " elif 'char' in c['type']:\n", + " expected_length = expected_length/2.\n", + " if 'size' in c:\n", + " expected_length *= c['size']*4 # size in 4 byte words -- extra factor of 4\n", + " #if ( c['count'] != expected_length ) :\n", + " # print(f\"// mismatch: {expected_length}, size {c['count']}\")\n", + " print(f\"// {c['name']}, size {expected_length}\")\n", + " print(f\"zm_set_{c['mcu_call']}(&zynqmon_data[{size}], {c['start']});\")\n", + " size += int(expected_length)\n", + "print(f\"#define ZMON_VALID_ENTRIES {size}\")" + ] + }, { - "name": "stdout", - "output_type": "stream", - "text": [ - "// firefly, size 20\n", - "zm_set_firefly_temps(&zynqmon_data[0], 0);\n", - "// psmon, size 70\n", - "zm_set_psmon(&zynqmon_data[20], 32);\n", - "// adcmon, size 21\n", - "zm_set_adcmon(&zynqmon_data[90], 128);\n", - "// uptime, size 2\n", - "zm_set_uptime(&zynqmon_data[111], 192);\n", - "// gitversion, size 10.0\n", - "zm_set_gitversion(&zynqmon_data[113], 118);\n", - "// fpga, size 8\n", - "zm_set_fpga(&zynqmon_data[123], 150);\n", - "#define ZMON_VALID_ENTRIES 131\n" - ] + "cell_type" : "code", + "execution_count" : null, + "metadata" : {}, + "outputs" : [], + "source" : [] } - ], - "source": [ - "size = 0\n", - "for c in config:\n", - " # generate C call\n", - " expected_length = len(c['names'])\n", - " if 'postfixes' in c:\n", - " expected_length *= len(c['postfixes'])\n", - " if '32' in c['type']:\n", - " expected_length *= 2\n", - " elif 'char' in c['type']:\n", - " expected_length = expected_length/2.\n", - " if 'size' in c:\n", - " expected_length *= c['size']*4 # size in 4 byte words -- extra factor of 4\n", - " #if ( c['count'] != expected_length ) :\n", - " # print(f\"// mismatch: {expected_length}, size {c['count']}\")\n", - " print(f\"// {c['name']}, size {expected_length}\")\n", - " print(f\"zm_set_{c['mcu_call']}(&zynqmon_data[{size}], {c['start']});\")\n", - " size += int(expected_length)\n", - "print(f\"#define ZMON_VALID_ENTRIES {size}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "interpreter": { - "hash": "d1bcf2015140efba1309a3b878c8a09b28a5da1fac13dcbb304588e5a25844fe" - }, - "kernelspec": { - "display_name": "Python 3.8.12 64-bit ('base': conda)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.17" - }, - "orig_nbformat": 4 - }, - "nbformat": 4, - "nbformat_minor": 2 + ], + "metadata" : { + "interpreter" : { + "hash" : "d1bcf2015140efba1309a3b878c8a09b28a5da1fac13dcbb304588e5a25844fe" + }, + "kernelspec" : { + "display_name" : "Python 3.8.12 64-bit ('base': conda)", + "language" : "python", + "name" : "python3" + }, + "language_info" : { + "codemirror_mode" : { + "name" : "ipython", + "version" : 3 + }, + "file_extension" : ".py", + "mimetype" : "text/x-python", + "name" : "python", + "nbconvert_exporter" : "python", + "pygments_lexer" : "ipython3", + "version" : "3.9.17" + }, + "orig_nbformat" : 4 + }, + "nbformat" : 4, + "nbformat_minor" : 2 } diff --git a/sm_cm_config/src/mcu_generate.py b/sm_cm_config/src/mcu_generate.py index b31e6ce8..cc89dfa8 100644 --- a/sm_cm_config/src/mcu_generate.py +++ b/sm_cm_config/src/mcu_generate.py @@ -9,7 +9,7 @@ help='increase output verbosity') parser.add_argument('-o', '--output', type=str, help='output file name', default="ZynqMon_addresses.c") -# this argument is required +#this argument is required parser.add_argument('input_files', metavar='file', type=str, nargs='+', help='input yaml file names') @@ -18,14 +18,14 @@ if args.output: print('Output file name:', args.output) -# sort the input file names. Default appears to be random (or order in the filesystem) +#sort the input file names.Default appears to be random(or order in the filesystem) args.input_files.sort() if args.verbose: - # pretty-print list of input files +#pretty - print list of input files print('Input file names:', *args.input_files, sep=', ', end='\n') -# open output text file for writing +#open output text file for writing with open(args.output, 'w', encoding="ascii") as fout: print(r"// This file is generated by mcu_generate.py", file=fout) print(r"// Do not edit this file directly", file=fout) @@ -37,7 +37,7 @@ print(r"//", file=fout) print("#include \"Tasks.h\"", file=fout) - # first set the #ifdef for REV1 +#first set the #ifdef for REV1 print(r"#ifdef REV1", file=fout) for idx, fname in enumerate(args.input_files): if args.verbose: @@ -49,7 +49,7 @@ print(f"#elif defined(REV{ver}) // REV{ver}", file=fout) print("void zm_fill_structs(void) \n{", file=fout) - # print the names of the variables +#print the names of the variables if args.verbose: print(f"dump variables for iteration {idx}") config = data['config'] @@ -60,7 +60,7 @@ pairs = [] size = 0 for c in config: - # generate C call +#generate C call expected_length = len(c['names']) if 'postfixes' in c: expected_length *= len(c['postfixes']) @@ -74,7 +74,7 @@ print(f"// mismatch: {expected_length}, size {c['count']}", file=fout) print(f"Mismatch in size for {c['name']}, file {fname}") print(f"Mismatch: expected: {expected_length}, size {c['count']}") - # close and delete the output file before exiting +#close and delete the output file before exiting fout.close() os.remove(args.output) sys.exit(1) @@ -87,8 +87,8 @@ size += int(expected_length) pairs.append((c['start'], c['start'] + int(expected_length)-1)) - # check to ensure that none of the tuples in pairs overlap - # this is a sanity check to ensure that the yaml file is correct +#check to ensure that none of the tuples in pairs overlap +#this is a sanity check to ensure that the yaml file is correct errors=False for a, b in zip(pairs, pairs[1:]): if a[0] <= b[0] and a[1] >= b[0] or a[0] <= b[1] and a[1] >= b[1]: @@ -97,13 +97,13 @@ if errors: print("ERRORS FOUND") sys.exit(1) - # close input yaml file +#close input yaml file f.close() print("}", file=fout) print(f"#define ZMON_VALID_ENTRIES {size}", file=fout) - # close output text file +#close output text file print(r"#else // REV1", file=fout) - # error if no revision is defined +#error if no revision is defined print(r"#error No revision defined", file=fout) print(r"#endif // REV1", file=fout) fout.close() diff --git a/sm_cm_config/src/xml_generate.ipynb b/sm_cm_config/src/xml_generate.ipynb index 45e07884..76c12381 100644 --- a/sm_cm_config/src/xml_generate.ipynb +++ b/sm_cm_config/src/xml_generate.ipynb @@ -1,578 +1,576 @@ { - "cells": [ - { - "cell_type": "code", - "execution_count": 31, - "metadata": {}, - "outputs": [], - "source": [ - "import yaml\n", - "from pprint import pprint\n", - "import xml.etree.ElementTree as ET\n", - "#\n", - "# THIS IS OBSOLETE -- DO NOT USE -- ONLY FOR HISTORICAL INTEREST\n" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": {}, - "outputs": [], - "source": [ - "verbose=False" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": {}, - "outputs": [], - "source": [ - "with open('../data/zynqmon_2.yml') as f:\n", - " y = yaml.load(f, Loader=yaml.FullLoader)\n", - " if (verbose) :\n", - " pprint(y)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": {}, - "outputs": [], - "source": [ - "def makeNode(parent: ET.Element, id: str, c: dict, addr2: int, parent_id: str) -> ET.Element:\n", - " node = ET.SubElement(parent, 'node')\n", - " id = id.replace(' ', '_')\n", - " start = c['start']\n", - " count = c['count']\n", - " node.set('id', id)\n", - " # address is half of the sensor address since these are 32 bit addresses\n", - " addr = int(addr2/2)\n", - " remain = addr2 % 2\n", - " node.set('address', str(hex(addr)))\n", - " # this appears to be on all the nodes\n", - " node.set(\"permission\", \"r\")\n", - " # set parameter based on the type\n", - " if (c['type'] == 'int8'):\n", - " width = 8\n", - " format = \"d\"\n", - " elif (c['type'] == 'int16'):\n", - " width = 16\n", - " format = \"d16\"\n", - " elif (c['type'] == 'fp16'):\n", - " width = 16\n", - " format = \"fp16\"\n", - " elif (c['type'] == 'char'):\n", - " width = 8\n", - " format = \"c\"\n", - " elif (c['type'] == 'uint32_t'):\n", - " width = 32\n", - " format = \"u\"\n", - " else:\n", - " print(\"ERROR: unknown type\", c['type'])\n", - " return None\n", - " if 'size' in c: # if there is a size, it cannot have a mask\n", - " node.set('size', str(hex(c['size'])))\n", - " else: \n", - " mask = (1 << width) - 1\n", - " if (remain == 0):\n", - " node.set('mask', \"0x{0:08X}\".format(mask))\n", - " else:\n", - " node.set('mask', \"0x{0:08X}\".format(mask << 16))\n", - " if 'extra' in c:\n", - " extra = c['extra']\n", - " if not \"Column\" in extra:\n", - " extra = extra + \";Column=\" + id\n", - " if not \"Row\" in extra :\n", - " if parent_id != \"\":\n", - " extra = \"Row=\" + parent_id + \";\" + extra\n", - " else:\n", - " extra = \"Row=\" + id + \";\" + extra\n", - " else:\n", - " extra = \"\"\n", - " node.set('parameters', \"Format=\" + format + \";\" + extra)\n", - " return node\n" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": {}, - "outputs": [], - "source": [ - "# This is the parent (root) tag\n", - "# onto which other tags would be\n", - "# created\n", - "cm = ET.Element('node')\n", - "cm.set('id', 'CM')\n", - "cm.set('address', '0x00000000')\n" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": {}, - "outputs": [], - "source": [ - "config = y['config']\n", - "\n", - "for c in config: # loop over entries in configuration (sensor category)\n", - " i = 0 # counter over the number of sensors within a category\n", - " names = c['names']\n", - " for n in names: # loop over names of sensors within a category\n", - " if 'postfixes' in c:\n", - " pp = node = ET.SubElement(cm, 'node')\n", - " pp.set('id', n)\n", - " start = c['start']\n", - " addr = int((start + i)/2)\n", - " #addr = int((start + i)/2)\n", - " pp.set('address', str(hex(addr)))\n", - " #pp.set(\"mask\", \"0x{0:08X}\".format(0xFFFFFFFF))\n", - " postfixes = c['postfixes']\n", - " j = 0\n", - " for p in postfixes:\n", - " if p == 'RESERVED':\n", - " i += 1\n", - " j += 1\n", - " continue\n", - " if verbose: \n", - " print(\"adding postfix\", p, \"to node\", n)\n", - " node = makeNode(pp, p, c, j, n)\n", - " i += 1\n", - " j += 1\n", - " else:\n", - " start = c['start']\n", - " makeNode(cm, n, c, start+i, \"\")\n", - " i += 1" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "config = y['config']\n", - "\n", - "for c in config: # loop over entries in configuration (sensor category)\n", - " print(\"here\", c['name'])\n", - " if not 'start' in c:\n", - " pprint(c)\n", - " start = c['start']\n", - " count = c['count']\n", - " i = 0 # counter over the number of sensors within a category\n", - " names = c['names']\n", - " if 'prefixes' in c:\n", - " postfixes = c['postfixes']\n", - " else:\n", - " postfixes = ' '\n", - " for p in prefixes:\n", - " for n in names: # loop over sensor names\n", - " node = ET.SubElement(cm, 'node')\n", - " if ( len(p.lstrip()) > 0 ):\n", - " id = p +\"_\" + n.replace(' ', '_')\n", - " else:\n", - " id = n.replace(' ', '_')\n", - " node.set('id', id)\n", - " addr = int((start + i)/2) ## address is half of the sensor address since these are 32 bit addresses\n", - " remain = (start + i) % 2\n", - " node.set('address', str(hex(addr)))\n", - " i += 1 # offset for next sensor\n", - " # this appears to be on all the nodes\n", - " node.set(\"permission\", \"r\")\n", - " # set parameter based on the type\n", - " if ( c['type'] == 'int8' ):\n", - " width=8\n", - " format = \"d\"\n", - " elif ( c['type'] == 'fp16' ):\n", - " width=16\n", - " format = \"fp16\"\n", - " elif ( c['type'] == 'char' ):\n", - " width=8\n", - " format = \"c\"\n", - " elif ( c['type'] == 'uint32_t' ):\n", - " width=32\n", - " format = \"u\"\n", - " else:\n", - " print(\"ERROR: unknown type\", c['type'])\n", - " break\n", - " mask = (1 << width) - 1\n", - " if (remain == 0):\n", - " node.set('mask', \"0x{0:08X}\".format(mask))\n", - " else:\n", - " node.set('mask', \"0x{0:08X}\".format(mask<<16))\n", - " if 'extra' in c:\n", - " extra = c['extra']\n", - " else:\n", - " extra = \"\"\n", - " node.set('parameters', \"format=\" + format + \";\" + extra)\n", - " if 'size' in c:\n", - " print(\"size:\", c['size'], c['name'])\n", - " node.set('size', str(hex(c['size'])))\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": {}, - "outputs": [], - "source": [ - "s_xml = ET.tostring(cm).decode()\n", - "\n", - "tree = ET.ElementTree(cm)\n", - "ET.indent(tree, space='\\t')\n", - "tree.write(\"test2.xml\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": {}, - "outputs": [ + "cells" : [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n" - ] - } - ], - "source": [ - "from bs4 import BeautifulSoup\n", - "\n", - "bs = BeautifulSoup(s_xml, 'xml')\n", - "pretty_xml = bs.prettify()\n", - "with open(\"test.xml\", \"w\") as f:\n", - " print(pretty_xml, file=f)\n", - "print(pretty_xml)" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": {}, - "outputs": [], - "source": [ - "def calcSize(c: dict) -> int:\n", - " if 'size' in c:\n", - " size = c['size']*2 # extra factor of 2 for 16 to 32 bit\n", - " else:\n", - " size = 1\n", - " if '32' in c['type']:\n", - " size = size * 2\n", - " elif 'char' in c['type']:\n", - " size = size // 2\n", - " return size\n" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": {}, - "outputs": [ + "cell_type" : "code", + "execution_count" : 31, + "metadata" : {}, + "outputs" : [], + "source" : [ + "import yaml\n", + "from pprint import pprint\n", + "import xml.etree.ElementTree as ET\n", + "#\n", + "# THIS IS OBSOLETE -- DO NOT USE -- ONLY FOR HISTORICAL INTEREST\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 32, + "metadata" : {}, + "outputs" : [], + "source" : ["verbose=False"] + }, + { + "cell_type" : "code", + "execution_count" : 33, + "metadata" : {}, + "outputs" : [], + "source" : [ + "with open('../data/zynqmon_2.yml') as f:\n", + " y = yaml.load(f, Loader=yaml.FullLoader)\n", + " if (verbose) :\n", + " pprint(y)\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 34, + "metadata" : {}, + "outputs" : [], + "source" : [ + "def makeNode(parent: ET.Element, id: str, c: dict, addr2: int, parent_id: str) -> ET.Element:\n", + " node = ET.SubElement(parent, 'node')\n", + " id = id.replace(' ', '_')\n", + " start = c['start']\n", + " count = c['count']\n", + " node.set('id', id)\n", + " # address is half of the sensor address since these are 32 bit addresses\n", + " addr = int(addr2/2)\n", + " remain = addr2 % 2\n", + " node.set('address', str(hex(addr)))\n", + " # this appears to be on all the nodes\n", + " node.set(\"permission\", \"r\")\n", + " # set parameter based on the type\n", + " if (c['type'] == 'int8'):\n", + " width = 8\n", + " format = \"d\"\n", + " elif (c['type'] == 'int16'):\n", + " width = 16\n", + " format = \"d16\"\n", + " elif (c['type'] == 'fp16'):\n", + " width = 16\n", + " format = \"fp16\"\n", + " elif (c['type'] == 'char'):\n", + " width = 8\n", + " format = \"c\"\n", + " elif (c['type'] == 'uint32_t'):\n", + " width = 32\n", + " format = \"u\"\n", + " else:\n", + " print(\"ERROR: unknown type\", c['type'])\n", + " return None\n", + " if 'size' in c: # if there is a size, it cannot have a mask\n", + " node.set('size', str(hex(c['size'])))\n", + " else: \n", + " mask = (1 << width) - 1\n", + " if (remain == 0):\n", + " node.set('mask', \"0x{0:08X}\".format(mask))\n", + " else:\n", + " node.set('mask', \"0x{0:08X}\".format(mask << 16))\n", + " if 'extra' in c:\n", + " extra = c['extra']\n", + " if not \"Column\" in extra:\n", + " extra = extra + \";Column=\" + id\n", + " if not \"Row\" in extra :\n", + " if parent_id != \"\":\n", + " extra = \"Row=\" + parent_id + \";\" + extra\n", + " else:\n", + " extra = \"Row=\" + id + \";\" + extra\n", + " else:\n", + " extra = \"\"\n", + " node.set('parameters', \"Format=\" + format + \";\" + extra)\n", + " return node\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 35, + "metadata" : {}, + "outputs" : [], + "source" : [ + "# This is the parent (root) tag\n", + "# onto which other tags would be\n", + "# created\n", + "cm = ET.Element('node')\n", + "cm.set('id', 'CM')\n", + "cm.set('address', '0x00000000')\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 36, + "metadata" : {}, + "outputs" : [], + "source" : [ + "config = y['config']\n", + "\n", + "for c in config: # loop over entries in configuration (sensor category)\n", + " i = 0 # counter over the number of sensors within a category\n", + " names = c['names']\n", + " for n in names: # loop over names of sensors within a category\n", + " if 'postfixes' in c:\n", + " pp = node = ET.SubElement(cm, 'node')\n", + " pp.set('id', n)\n", + " start = c['start']\n", + " addr = int((start + i)/2)\n", + " #addr = int((start + i)/2)\n", + " pp.set('address', str(hex(addr)))\n", + " #pp.set(\"mask\", \"0x{0:08X}\".format(0xFFFFFFFF))\n", + " postfixes = c['postfixes']\n", + " j = 0\n", + " for p in postfixes:\n", + " if p == 'RESERVED':\n", + " i += 1\n", + " j += 1\n", + " continue\n", + " if verbose: \n", + " print(\"adding postfix\", p, \"to node\", n)\n", + " node = makeNode(pp, p, c, j, n)\n", + " i += 1\n", + " j += 1\n", + " else:\n", + " start = c['start']\n", + " makeNode(cm, n, c, start+i, \"\")\n", + " i += 1" + ] + }, + { + "cell_type" : "markdown", + "metadata" : {}, + "source" : [ + "config = y['config']\n", + "\n", + "for c in config: # loop over entries in configuration (sensor category)\n", + " print(\"here\", c['name'])\n", + " if not 'start' in c:\n", + " pprint(c)\n", + " start = c['start']\n", + " count = c['count']\n", + " i = 0 # counter over the number of sensors within a category\n", + " names = c['names']\n", + " if 'prefixes' in c:\n", + " postfixes = c['postfixes']\n", + " else:\n", + " postfixes = ' '\n", + " for p in prefixes:\n", + " for n in names: # loop over sensor names\n", + " node = ET.SubElement(cm, 'node')\n", + " if ( len(p.lstrip()) > 0 ):\n", + " id = p +\"_\" + n.replace(' ', '_')\n", + " else:\n", + " id = n.replace(' ', '_')\n", + " node.set('id', id)\n", + " addr = int((start + i)/2) ## address is half of the sensor address since these are 32 bit addresses\n", + " remain = (start + i) % 2\n", + " node.set('address', str(hex(addr)))\n", + " i += 1 # offset for next sensor\n", + " # this appears to be on all the nodes\n", + " node.set(\"permission\", \"r\")\n", + " # set parameter based on the type\n", + " if ( c['type'] == 'int8' ):\n", + " width=8\n", + " format = \"d\"\n", + " elif ( c['type'] == 'fp16' ):\n", + " width=16\n", + " format = \"fp16\"\n", + " elif ( c['type'] == 'char' ):\n", + " width=8\n", + " format = \"c\"\n", + " elif ( c['type'] == 'uint32_t' ):\n", + " width=32\n", + " format = \"u\"\n", + " else:\n", + " print(\"ERROR: unknown type\", c['type'])\n", + " break\n", + " mask = (1 << width) - 1\n", + " if (remain == 0):\n", + " node.set('mask', \"0x{0:08X}\".format(mask))\n", + " else:\n", + " node.set('mask', \"0x{0:08X}\".format(mask<<16))\n", + " if 'extra' in c:\n", + " extra = c['extra']\n", + " else:\n", + " extra = \"\"\n", + " node.set('parameters', \"format=\" + format + \";\" + extra)\n", + " if 'size' in c:\n", + " print(\"size:\", c['size'], c['name'])\n", + " node.set('size', str(hex(c['size'])))\n" + ] + }, + { + "cell_type" : "markdown", + "metadata" : {}, + "source" : [] + }, + { + "cell_type" : "code", + "execution_count" : 37, + "metadata" : {}, + "outputs" : [], + "source" : [ + "s_xml = ET.tostring(cm).decode()\n", + "\n", + "tree = ET.ElementTree(cm)\n", + "ET.indent(tree, space='\\t')\n", + "tree.write(\"test2.xml\")\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 38, + "metadata" : {}, + "outputs" : [ + { + "name" : "stdout", + "output_type" : "stream", + "text" : [ + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n" + ] + } + ], + "source" : [ + "from bs4 import BeautifulSoup\n", + "\n", + "bs = BeautifulSoup(s_xml, 'xml')\n", + "pretty_xml = bs.prettify()\n", + "with open(\"test.xml\", \"w\") as f:\n", + " print(pretty_xml, file=f)\n", + "print(pretty_xml)" + ] + }, + { + "cell_type" : "code", + "execution_count" : 39, + "metadata" : {}, + "outputs" : [], + "source" : [ + "def calcSize(c: dict) -> int:\n", + " if 'size' in c:\n", + " size = c['size']*2 # extra factor of 2 for 16 to 32 bit\n", + " else:\n", + " size = 1\n", + " if '32' in c['type']:\n", + " size = size * 2\n", + " elif 'char' in c['type']:\n", + " size = size // 2\n", + " return size\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 40, + "metadata" : {}, + "outputs" : [ + { + "name" : "stdout", + "output_type" : "stream", + "text" : [ + "[name: firefly start: 0 end: 19 size: 20,\n", + " name: psmon start: 32 end: 115 size: 84,\n", + " name: adcmon start: 128 end: 148 size: 21,\n", + " name: uptime start: 192 end: 193 size: 2,\n", + " name: gitversion start: 118 end: 122 size: 5,\n", + " name: fpga start: 150 end: 157 size: 8,\n", + " name: clocks start: 158 end: 161 size: 4,\n", + " name: clocks start: 172 end: 191 size: 20]\n" + ] + } + ], + "source" : [ + "# check overlaps\n", + "# create an object with a name, and a start end end register\n", + "# do so for every entry\n", + "# then ensure that no two objects overlap\n", + "\n", + "# create a class to hold a name, start, end, and size\n", + "# add a method to check if two objects overlap\n", + "# and a pretty print method\n", + "from itertools import chain\n", + "class reg:\n", + " def __init__(self, name, start, end, size):\n", + " self.name = name\n", + " self.start = start\n", + " self.end = end\n", + " self.size = size\n", + " def __str__(self):\n", + " return \"name: \" + self.name + \" start: \" + str(self.start) + \" end: \" + str(self.end) + \" size: \" + str(self.size)\n", + " def __repr__(self):\n", + " return \"name: \" + self.name + \" start: \" + str(self.start) + \" end: \" + str(self.end) + \" size: \" + str(self.size)\n", + " def overlaps(self, other):\n", + " if (self.start <= other.start and self.end >= other.start):\n", + " return True\n", + " if (self.start <= other.end and self.end >= other.end):\n", + " return True\n", + " if (self.start >= other.start and self.end <= other.end):\n", + " return True\n", + " return False\n", + "\n", + "# create a list of objects\n", + "entries = []\n", + "for c in config: # loop over entries in configuration (sensor category)\n", + " if not 'start' in c:\n", + " pprint(c)\n", + " start = c['start']\n", + " count = c['count']\n", + " i = 0 # counter over the number of sensors within a category\n", + " names = c['names']\n", + " if 'postfixes' in c:\n", + " postfixes = c['postfixes']\n", + " else:\n", + " postfixes = ' '\n", + " size = calcSize(c) \n", + " thislength = len(postfixes) * len(names)*size\n", + " entries.append(reg(c['name'], start, start + thislength - 1, thislength))\n", + "pprint(entries)\n", + "\n", + "# check for overlaps\n", + "for i in range(len(entries)):\n", + " for j in range(i+1, len(entries)):\n", + " if entries[i].overlaps(entries[j]):\n", + " print(f\"{entries[i].name} overlaps with {entries[j].name}\")\n", + "\n" + ] + }, { - "name": "stdout", - "output_type": "stream", - "text": [ - "[name: firefly start: 0 end: 19 size: 20,\n", - " name: psmon start: 32 end: 115 size: 84,\n", - " name: adcmon start: 128 end: 148 size: 21,\n", - " name: uptime start: 192 end: 193 size: 2,\n", - " name: gitversion start: 118 end: 122 size: 5,\n", - " name: fpga start: 150 end: 157 size: 8,\n", - " name: clocks start: 158 end: 161 size: 4,\n", - " name: clocks start: 172 end: 191 size: 20]\n" - ] + "cell_type" : "code", + "execution_count" : null, + "metadata" : {}, + "outputs" : [], + "source" : [] } - ], - "source": [ - "# check overlaps\n", - "# create an object with a name, and a start end end register\n", - "# do so for every entry\n", - "# then ensure that no two objects overlap\n", - "\n", - "# create a class to hold a name, start, end, and size\n", - "# add a method to check if two objects overlap\n", - "# and a pretty print method\n", - "from itertools import chain\n", - "class reg:\n", - " def __init__(self, name, start, end, size):\n", - " self.name = name\n", - " self.start = start\n", - " self.end = end\n", - " self.size = size\n", - " def __str__(self):\n", - " return \"name: \" + self.name + \" start: \" + str(self.start) + \" end: \" + str(self.end) + \" size: \" + str(self.size)\n", - " def __repr__(self):\n", - " return \"name: \" + self.name + \" start: \" + str(self.start) + \" end: \" + str(self.end) + \" size: \" + str(self.size)\n", - " def overlaps(self, other):\n", - " if (self.start <= other.start and self.end >= other.start):\n", - " return True\n", - " if (self.start <= other.end and self.end >= other.end):\n", - " return True\n", - " if (self.start >= other.start and self.end <= other.end):\n", - " return True\n", - " return False\n", - "\n", - "# create a list of objects\n", - "entries = []\n", - "for c in config: # loop over entries in configuration (sensor category)\n", - " if not 'start' in c:\n", - " pprint(c)\n", - " start = c['start']\n", - " count = c['count']\n", - " i = 0 # counter over the number of sensors within a category\n", - " names = c['names']\n", - " if 'postfixes' in c:\n", - " postfixes = c['postfixes']\n", - " else:\n", - " postfixes = ' '\n", - " size = calcSize(c) \n", - " thislength = len(postfixes) * len(names)*size\n", - " entries.append(reg(c['name'], start, start + thislength - 1, thislength))\n", - "pprint(entries)\n", - "\n", - "# check for overlaps\n", - "for i in range(len(entries)):\n", - " for j in range(i+1, len(entries)):\n", - " if entries[i].overlaps(entries[j]):\n", - " print(f\"{entries[i].name} overlaps with {entries[j].name}\")\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "interpreter": { - "hash": "d1bcf2015140efba1309a3b878c8a09b28a5da1fac13dcbb304588e5a25844fe" - }, - "kernelspec": { - "display_name": "Python 3.8.12 ('base')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.17" - }, - "orig_nbformat": 4 - }, - "nbformat": 4, - "nbformat_minor": 2 + ], + "metadata" : { + "interpreter" : { + "hash" : "d1bcf2015140efba1309a3b878c8a09b28a5da1fac13dcbb304588e5a25844fe" + }, + "kernelspec" : { + "display_name" : "Python 3.8.12 ('base')", + "language" : "python", + "name" : "python3" + }, + "language_info" : { + "codemirror_mode" : { + "name" : "ipython", + "version" : 3 + }, + "file_extension" : ".py", + "mimetype" : "text/x-python", + "name" : "python", + "nbconvert_exporter" : "python", + "pygments_lexer" : "ipython3", + "version" : "3.9.17" + }, + "orig_nbformat" : 4 + }, + "nbformat" : 4, + "nbformat_minor" : 2 } diff --git a/sm_cm_config/src/xml_generate.py b/sm_cm_config/src/xml_generate.py index 17833432..4872b8f7 100644 --- a/sm_cm_config/src/xml_generate.py +++ b/sm_cm_config/src/xml_generate.py @@ -8,7 +8,7 @@ parser.add_argument('-v', '--verbose', action='store_true', help='increase output verbosity') parser.add_argument('-d', '--directory', type=str, help='output directory') -# this argument is required +#this argument is required parser.add_argument('input_files', metavar='file', type=str, nargs='+', help='input file names') @@ -23,24 +23,22 @@ if args.verbose: print('Input file names:', args.input_files) - - -# %% +#% % def make_node(parent: ET.Element, myid: str, thedict: dict, addr2: int, parent_id: str) -> ET.Element: """create the node to be inserted into the xml tree""" - # pylint: disable=too-many-branches - # I disable this check because as far as I can tell it's wrong +#pylint : disable = too - many - branches +#I disable this check because as far as I can tell it's wrong thenode = ET.SubElement(parent, 'node') myid = myid.replace(' ', '_') thenode.set('id', myid) - # address is half of the sensor address since these are 32 bit addresses +#address is half of the sensor address since these are 32 bit addresses theaddr = int(addr2/2) remain = addr2 % 2 thenode.set('address', str(hex(theaddr))) - # this appears to be on all the nodes +#this appears to be on all the nodes thenode.set("permission", "r") - # set parameter based on the type +#set parameter based on the type if thedict['type'] == 'int8': width = 8 theformat = "d" @@ -73,7 +71,7 @@ def make_node(parent: ET.Element, myid: str, thedict: dict, addr2: int, if 'extra' in thedict: extra = thedict['extra'] if not "Column" in extra: - # this semicolon asks for no semicolon in extra when postfixes are included +#this semicolon asks for no semicolon in extra when postfixes are included extra = extra + ";Column=" + myid if not "Row" in extra: if parent_id != "": @@ -98,16 +96,15 @@ def calc_size(thedict: dict) -> int: sz = sz // 2 return sz +#% % +#check overlaps +#create an object with a name, and a start end end register +#do so for every entry +#then ensure that no two objects overlap -# %% -# check overlaps -# create an object with a name, and a start end end register -# do so for every entry -# then ensure that no two objects overlap - -# create a class to hold a name, start, end, and size -# add a method to check if two objects overlap -# and a pretty print method +#create a class to hold a name, start, end, and size +#add a method to check if two objects overlap +#and a pretty print method class reg: """create an object with a name, and a start end end register""" def __init__(self, name, sta, end, sz): @@ -143,18 +140,15 @@ def overloads(self): if args.verbose: pprint(y) - - -# %% -# This is the parent (root) tag -# onto which other tags would be -# created +#% % +#This is the parent(root) tag +#onto which other tags would be +#created cm = ET.Element('node') cm.set('id', 'CM') cm.set('address', '0x00000000') - -# %% +#% % config = y['config'] for c in config: # loop over entries in configuration (sensor category) @@ -187,11 +181,9 @@ def overloads(self): ET.indent(tree, space='\t') tree.write("test2.xml") -# %% - - +#% % -# create a list of objects +#create a list of objects entries = [] for c in config: # loop over entries in configuration (sensor category) if not 'start' in c: @@ -209,7 +201,7 @@ def overloads(self): entries.append(reg(c['name'], start, start + thislength - 1, thislength)) pprint(entries) -# check for overlaps and overloads +#check for overlaps and overloads for i in range(len(entries)): for j in range(i+1, len(entries)): if entries[i].overlaps(entries[j]): diff --git a/sm_cm_config/src/yamltest.ipynb b/sm_cm_config/src/yamltest.ipynb index 38bd0b9d..11862e9f 100644 --- a/sm_cm_config/src/yamltest.ipynb +++ b/sm_cm_config/src/yamltest.ipynb @@ -1,194 +1,194 @@ { - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import yaml\n", - "from pprint import pprint\n", - "import dicttoxml\n", - "# there is also dict2xml available in pypy (python3)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ + "cells" : [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'cm_hw_rev': '1A',\n", - " 'config': [{'count': 25,\n", - " 'mcu_call': 'firefly_temps',\n", - " 'name': 'firefly',\n", - " 'names': ['K01 12 Tx GTH',\n", - " 'K01 12 Rx GTH',\n", - " 'K02 12 Tx GTH',\n", - " 'K02 12 Rx GTH',\n", - " 'K03 12 Tx GTH',\n", - " 'K03 12 Rx GTH',\n", - " 'K04 4 XCVR GTY',\n", - " 'K05 4 XCVR GTY',\n", - " 'K06 4 XCVR GTY',\n", - " 'K07 12 Tx GTY',\n", - " 'K07 12 Rx GTY',\n", - " 'V01 4 XCVR GTY',\n", - " 'V02 4 XCVR GTY',\n", - " 'V03 4 XCVR GTY',\n", - " 'V04 4 XCVR GTY',\n", - " 'V05 4 XCVR GTY',\n", - " 'V06 4 XCVR GTY',\n", - " 'V07 4 XCVR GTY',\n", - " 'V08 4 XCVR GTY',\n", - " 'V09 4 XCVR GTY',\n", - " 'V10 4 XCVR GTY',\n", - " 'V11 12 Tx GTY',\n", - " 'V11 12 Rx GTY',\n", - " 'V12 12 Tx GTY',\n", - " 'V12 12 Rx GTY'],\n", - " 'start': 0,\n", - " 'type': 'int8'},\n", - " {'count': 8,\n", - " 'mcu_call': 'psmon',\n", - " 'name': 'psmon',\n", - " 'names': ['TEMP1',\n", - " 'TEMP3',\n", - " 'VIN',\n", - " 'VOUT',\n", - " 'IOUT',\n", - " 'RESERVED',\n", - " 'RESERVED',\n", - " 'RESERVED'],\n", - " 'prefix': None,\n", - " 'start': 32,\n", - " 'type': 'fp16'},\n", - " {'count': 21,\n", - " 'mcu_call': 'adcmon',\n", - " 'name': 'adcmon',\n", - " 'names': ['VCC_12V',\n", - " 'VCC_2V5',\n", - " 'VCC_M3V3',\n", - " 'VCC_3V3',\n", - " 'VCC_1V8',\n", - " 'VCC_M1V8',\n", - " 'V_VCCINT',\n", - " 'K_VCCINT',\n", - " 'V_MGTY1_AVTT',\n", - " 'V_MGTY2_AVTT',\n", - " 'K_MGTH_AVTT',\n", - " 'K_MGTY_AVTT',\n", - " 'V_MGTY1_VCCAUX',\n", - " 'V_MGTY2_VCCAUX',\n", - " 'K_MGTY_VCCAUX',\n", - " 'K_MGTH_VCCAUX',\n", - " 'V_MGTY1_AVCC',\n", - " 'V_MGTY2_AVCC',\n", - " 'K_MGTY_AVCC',\n", - " 'K_MGTH_AVCC',\n", - " 'TM4C_TEMP'],\n", - " 'start': 40,\n", - " 'type': 'fp16'},\n", - " {'count': 2,\n", - " 'mcu_call': 'uptime',\n", - " 'name': 'uptime',\n", - " 'names': ['Uptime'],\n", - " 'start': 192,\n", - " 'type': 'uint32_t'},\n", - " {'count': 20,\n", - " 'mcu_call': 'gitversion',\n", - " 'name': 'gitversion',\n", - " 'names': ['Git_Version'],\n", - " 'start': 194,\n", - " 'type': 'char'},\n", - " {'count': 2,\n", - " 'mcu_call': 'fpga',\n", - " 'name': 'fpga',\n", - " 'names': ['F1_TEMP', 'F2_TEMP'],\n", - " 'start': 128,\n", - " 'type': 'float16'}],\n", - " 'name': 'zynqmon configuration file',\n", - " 'psmon_single_instance': ['TEMP1',\n", - " 'TEMP3',\n", - " 'VIN',\n", - " 'VOUT',\n", - " 'IOUT',\n", - " 'RESERVED',\n", - " 'RESERVED',\n", - " 'RESERVED'],\n", - " 'revision': 1,\n", - " 'sm_fw_rev': '1A',\n", - " 'sm_hw_rev': '1A'}\n" - ] - } - ], - "source": [ - "with open('../data/zynqmon.yml') as f:\n", - " data = yaml.load(f, Loader=yaml.FullLoader)\n", - " pprint(data)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ + "cell_type" : "code", + "execution_count" : 1, + "metadata" : {}, + "outputs" : [], + "source" : [ + "import yaml\n", + "from pprint import pprint\n", + "import dicttoxml\n", + "# there is also dict2xml available in pypy (python3)\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 3, + "metadata" : {}, + "outputs" : [ + { + "name" : "stdout", + "output_type" : "stream", + "text" : [ + "{'cm_hw_rev': '1A',\n", + " 'config': [{'count': 25,\n", + " 'mcu_call': 'firefly_temps',\n", + " 'name': 'firefly',\n", + " 'names': ['K01 12 Tx GTH',\n", + " 'K01 12 Rx GTH',\n", + " 'K02 12 Tx GTH',\n", + " 'K02 12 Rx GTH',\n", + " 'K03 12 Tx GTH',\n", + " 'K03 12 Rx GTH',\n", + " 'K04 4 XCVR GTY',\n", + " 'K05 4 XCVR GTY',\n", + " 'K06 4 XCVR GTY',\n", + " 'K07 12 Tx GTY',\n", + " 'K07 12 Rx GTY',\n", + " 'V01 4 XCVR GTY',\n", + " 'V02 4 XCVR GTY',\n", + " 'V03 4 XCVR GTY',\n", + " 'V04 4 XCVR GTY',\n", + " 'V05 4 XCVR GTY',\n", + " 'V06 4 XCVR GTY',\n", + " 'V07 4 XCVR GTY',\n", + " 'V08 4 XCVR GTY',\n", + " 'V09 4 XCVR GTY',\n", + " 'V10 4 XCVR GTY',\n", + " 'V11 12 Tx GTY',\n", + " 'V11 12 Rx GTY',\n", + " 'V12 12 Tx GTY',\n", + " 'V12 12 Rx GTY'],\n", + " 'start': 0,\n", + " 'type': 'int8'},\n", + " {'count': 8,\n", + " 'mcu_call': 'psmon',\n", + " 'name': 'psmon',\n", + " 'names': ['TEMP1',\n", + " 'TEMP3',\n", + " 'VIN',\n", + " 'VOUT',\n", + " 'IOUT',\n", + " 'RESERVED',\n", + " 'RESERVED',\n", + " 'RESERVED'],\n", + " 'prefix': None,\n", + " 'start': 32,\n", + " 'type': 'fp16'},\n", + " {'count': 21,\n", + " 'mcu_call': 'adcmon',\n", + " 'name': 'adcmon',\n", + " 'names': ['VCC_12V',\n", + " 'VCC_2V5',\n", + " 'VCC_M3V3',\n", + " 'VCC_3V3',\n", + " 'VCC_1V8',\n", + " 'VCC_M1V8',\n", + " 'V_VCCINT',\n", + " 'K_VCCINT',\n", + " 'V_MGTY1_AVTT',\n", + " 'V_MGTY2_AVTT',\n", + " 'K_MGTH_AVTT',\n", + " 'K_MGTY_AVTT',\n", + " 'V_MGTY1_VCCAUX',\n", + " 'V_MGTY2_VCCAUX',\n", + " 'K_MGTY_VCCAUX',\n", + " 'K_MGTH_VCCAUX',\n", + " 'V_MGTY1_AVCC',\n", + " 'V_MGTY2_AVCC',\n", + " 'K_MGTY_AVCC',\n", + " 'K_MGTH_AVCC',\n", + " 'TM4C_TEMP'],\n", + " 'start': 40,\n", + " 'type': 'fp16'},\n", + " {'count': 2,\n", + " 'mcu_call': 'uptime',\n", + " 'name': 'uptime',\n", + " 'names': ['Uptime'],\n", + " 'start': 192,\n", + " 'type': 'uint32_t'},\n", + " {'count': 20,\n", + " 'mcu_call': 'gitversion',\n", + " 'name': 'gitversion',\n", + " 'names': ['Git_Version'],\n", + " 'start': 194,\n", + " 'type': 'char'},\n", + " {'count': 2,\n", + " 'mcu_call': 'fpga',\n", + " 'name': 'fpga',\n", + " 'names': ['F1_TEMP', 'F2_TEMP'],\n", + " 'start': 128,\n", + " 'type': 'float16'}],\n", + " 'name': 'zynqmon configuration file',\n", + " 'psmon_single_instance': ['TEMP1',\n", + " 'TEMP3',\n", + " 'VIN',\n", + " 'VOUT',\n", + " 'IOUT',\n", + " 'RESERVED',\n", + " 'RESERVED',\n", + " 'RESERVED'],\n", + " 'revision': 1,\n", + " 'sm_fw_rev': '1A',\n", + " 'sm_hw_rev': '1A'}\n" + ] + } + ], + "source" : [ + "with open('../data/zynqmon.yml') as f:\n", + " data = yaml.load(f, Loader=yaml.FullLoader)\n", + " pprint(data)\n" + ] + }, + { + "cell_type" : "code", + "execution_count" : 3, + "metadata" : {}, + "outputs" : [ + { + "name" : "stdout", + "output_type" : "stream", + "text" : [ + "b'zynqmon configuration file1A1A1A1firefly025fireflyint8K01 12 Tx GTHK01 12 Rx GTHK02 12 Tx GTHK02 12 Rx GTHK03 12 Tx GTHK03 12 Rx GTHK04 4 XCVR GTYK05 4 XCVR GTYK06 4 XCVR GTYK07 12 Tx GTYK07 12 Rx GTYV01 4 XCVR GTYV02 4 XCVR GTYV03 4 XCVR GTYV04 4 XCVR GTYV05 4 XCVR GTYV06 4 XCVR GTYV07 4 XCVR GTYV08 4 XCVR GTYV09 4 XCVR GTYV10 4 XCVR GTYV11 12 Tx GTYV11 12 Rx GTYV12 12 Tx GTYV12 12 Rx GTYpsmon2020psmonfp16TEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDadcmon4021adcmonfp16VCC_12VVCC_2V5VCC_M3V3VCC_3V3VCC_1V8VCC_M1V8V_VCCINTK_VCCINTV_MGTY1_AVTTV_MGTY2_AVTTK_MGTH_AVTTK_MGTY_AVTTV_MGTY1_VCCAUXV_MGTY2_VCCAUXK_MGTY_VCCAUXK_MGTH_VCCAUXV_MGTY1_AVCCV_MGTY2_AVCCK_MGTY_AVCCK_MGTH_AVCCTM4C_TEMPuptime1922uint16uptimeUptimegitversion19420chargitversionGit_Version'\n", + "b'firefly025fireflyint8K01 12 Tx GTHK01 12 Rx GTHK02 12 Tx GTHK02 12 Rx GTHK03 12 Tx GTHK03 12 Rx GTHK04 4 XCVR GTYK05 4 XCVR GTYK06 4 XCVR GTYK07 12 Tx GTYK07 12 Rx GTYV01 4 XCVR GTYV02 4 XCVR GTYV03 4 XCVR GTYV04 4 XCVR GTYV05 4 XCVR GTYV06 4 XCVR GTYV07 4 XCVR GTYV08 4 XCVR GTYV09 4 XCVR GTYV10 4 XCVR GTYV11 12 Tx GTYV11 12 Rx GTYV12 12 Tx GTYV12 12 Rx GTYpsmon2020psmonfp16TEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDadcmon4021adcmonfp16VCC_12VVCC_2V5VCC_M3V3VCC_3V3VCC_1V8VCC_M1V8V_VCCINTK_VCCINTV_MGTY1_AVTTV_MGTY2_AVTTK_MGTH_AVTTK_MGTY_AVTTV_MGTY1_VCCAUXV_MGTY2_VCCAUXK_MGTY_VCCAUXK_MGTH_VCCAUXV_MGTY1_AVCCV_MGTY2_AVCCK_MGTY_AVCCK_MGTH_AVCCTM4C_TEMPuptime1922uint16uptimeUptimegitversion19420chargitversionGit_Version'\n" + ] + } + ], + "source" : [ + "\n", + "xml = dicttoxml.dicttoxml(data, attr_type=False)\n", + "print(xml)\n", + "\n", + "# dump xml to file\n", + "with open('/tmp/zynqmon.xml', 'wb') as f:\n", + " f.write(xml)\n", + "\n", + "plmem = dicttoxml.dicttoxml(data['config'], attr_type=False)\n", + "print(plmem)" + ] + }, { - "name": "stdout", - "output_type": "stream", - "text": [ - "b'zynqmon configuration file1A1A1A1firefly025fireflyint8K01 12 Tx GTHK01 12 Rx GTHK02 12 Tx GTHK02 12 Rx GTHK03 12 Tx GTHK03 12 Rx GTHK04 4 XCVR GTYK05 4 XCVR GTYK06 4 XCVR GTYK07 12 Tx GTYK07 12 Rx GTYV01 4 XCVR GTYV02 4 XCVR GTYV03 4 XCVR GTYV04 4 XCVR GTYV05 4 XCVR GTYV06 4 XCVR GTYV07 4 XCVR GTYV08 4 XCVR GTYV09 4 XCVR GTYV10 4 XCVR GTYV11 12 Tx GTYV11 12 Rx GTYV12 12 Tx GTYV12 12 Rx GTYpsmon2020psmonfp16TEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDadcmon4021adcmonfp16VCC_12VVCC_2V5VCC_M3V3VCC_3V3VCC_1V8VCC_M1V8V_VCCINTK_VCCINTV_MGTY1_AVTTV_MGTY2_AVTTK_MGTH_AVTTK_MGTY_AVTTV_MGTY1_VCCAUXV_MGTY2_VCCAUXK_MGTY_VCCAUXK_MGTH_VCCAUXV_MGTY1_AVCCV_MGTY2_AVCCK_MGTY_AVCCK_MGTH_AVCCTM4C_TEMPuptime1922uint16uptimeUptimegitversion19420chargitversionGit_Version'\n", - "b'firefly025fireflyint8K01 12 Tx GTHK01 12 Rx GTHK02 12 Tx GTHK02 12 Rx GTHK03 12 Tx GTHK03 12 Rx GTHK04 4 XCVR GTYK05 4 XCVR GTYK06 4 XCVR GTYK07 12 Tx GTYK07 12 Rx GTYV01 4 XCVR GTYV02 4 XCVR GTYV03 4 XCVR GTYV04 4 XCVR GTYV05 4 XCVR GTYV06 4 XCVR GTYV07 4 XCVR GTYV08 4 XCVR GTYV09 4 XCVR GTYV10 4 XCVR GTYV11 12 Tx GTYV11 12 Rx GTYV12 12 Tx GTYV12 12 Rx GTYpsmon2020psmonfp16TEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDTEMP1TEMP3VINVOUTIOUTRESERVEDRESERVEDRESERVEDadcmon4021adcmonfp16VCC_12VVCC_2V5VCC_M3V3VCC_3V3VCC_1V8VCC_M1V8V_VCCINTK_VCCINTV_MGTY1_AVTTV_MGTY2_AVTTK_MGTH_AVTTK_MGTY_AVTTV_MGTY1_VCCAUXV_MGTY2_VCCAUXK_MGTY_VCCAUXK_MGTH_VCCAUXV_MGTY1_AVCCV_MGTY2_AVCCK_MGTY_AVCCK_MGTH_AVCCTM4C_TEMPuptime1922uint16uptimeUptimegitversion19420chargitversionGit_Version'\n" - ] + "cell_type" : "code", + "execution_count" : null, + "metadata" : {}, + "outputs" : [], + "source" : [] } - ], - "source": [ - "\n", - "xml = dicttoxml.dicttoxml(data, attr_type=False)\n", - "print(xml)\n", - "\n", - "# dump xml to file\n", - "with open('/tmp/zynqmon.xml', 'wb') as f:\n", - " f.write(xml)\n", - "\n", - "plmem = dicttoxml.dicttoxml(data['config'], attr_type=False)\n", - "print(plmem)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "interpreter": { - "hash": "d1bcf2015140efba1309a3b878c8a09b28a5da1fac13dcbb304588e5a25844fe" - }, - "kernelspec": { - "display_name": "Python 3.8.12 64-bit ('base': conda)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.12" - }, - "orig_nbformat": 4 - }, - "nbformat": 4, - "nbformat_minor": 2 + ], + "metadata" : { + "interpreter" : { + "hash" : "d1bcf2015140efba1309a3b878c8a09b28a5da1fac13dcbb304588e5a25844fe" + }, + "kernelspec" : { + "display_name" : "Python 3.8.12 64-bit ('base': conda)", + "language" : "python", + "name" : "python3" + }, + "language_info" : { + "codemirror_mode" : { + "name" : "ipython", + "version" : 3 + }, + "file_extension" : ".py", + "mimetype" : "text/x-python", + "name" : "python", + "nbconvert_exporter" : "python", + "pygments_lexer" : "ipython3", + "version" : "3.8.12" + }, + "orig_nbformat" : 4 + }, + "nbformat" : 4, + "nbformat_minor" : 2 }