Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PyPCC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
PyPCC
Commits
19737ee4
Commit
19737ee4
authored
Sep 22, 2021
by
Paulus Kruger
Browse files
Options
Downloads
Patches
Plain Diff
I2C error counter added
parent
ba5b73c2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/RCU.yaml
+1
-1
1 addition, 1 deletion
config/RCU.yaml
i2cserv/i2c_array.py
+19
-14
19 additions, 14 deletions
i2cserv/i2c_array.py
with
20 additions
and
15 deletions
config/RCU.yaml
+
1
−
1
View file @
19737ee4
...
@@ -9,7 +9,7 @@ drivers:
...
@@ -9,7 +9,7 @@ drivers:
-
name
:
I2C_RCU
-
name
:
I2C_RCU
type
:
i2c_array
#An array of similar devices connected to an I2C switch
type
:
i2c_array
#An array of similar devices connected to an I2C switch
parent
:
I2C1
parent
:
I2C1
parameters
:
[
0
,
31
]
#start,number of RCUs
parameters
:
[
0
,
31
,
5
]
#start,number of RCUs
, error count to disable I2C
status
:
RCU_I2C_STATUS
status
:
RCU_I2C_STATUS
-
name
:
I2C_HBAT
-
name
:
I2C_HBAT
type
:
hba1
#Special driver to manage HBAT1s.
type
:
hba1
#Special driver to manage HBAT1s.
...
...
This diff is collapsed.
Click to expand it.
i2cserv/i2c_array.py
+
19
−
14
View file @
19737ee4
...
@@ -24,8 +24,9 @@ class i2c_array(i2c_dev):
...
@@ -24,8 +24,9 @@ class i2c_array(i2c_dev):
self
.
RCU_Switch1
=
range
(
pars
[
0
],
pars
[
1
]
+
1
);
self
.
RCU_Switch1
=
range
(
pars
[
0
],
pars
[
1
]
+
1
);
self
.
N
=
len
(
self
.
RCU_Switch1
);
self
.
N
=
len
(
self
.
RCU_Switch1
);
self
.
I2Cmask
=
[
0
]
*
self
.
N
self
.
I2Cmask
=
[
0
]
*
self
.
N
self
.
disableI2ConError
=
True
;
self
.
I2Ccut
=
pars
[
2
];
print
(
"
I2Ccut=
"
,
pars
[
2
])
self
.
disableI2ConError
=
pars
[
2
]
>
0
;
# self.devregs,RCU_storeReg=DevRegList(yaml)
# self.devregs,RCU_storeReg=DevRegList(yaml)
# print("Init",config['name'],'len=',len(self.RCU_Switch1),' stored reg=',RCU_storeReg)
# print("Init",config['name'],'len=',len(self.RCU_Switch1),' stored reg=',RCU_storeReg)
# self.previous =np.zeros([self.N,RCU_storeReg],dtype='int')
# self.previous =np.zeros([self.N,RCU_storeReg],dtype='int')
...
@@ -40,7 +41,7 @@ class i2c_array(i2c_dev):
...
@@ -40,7 +41,7 @@ class i2c_array(i2c_dev):
def
SetSwitchMask
(
self
,
mask
):
def
SetSwitchMask
(
self
,
mask
):
m
=
0
;
m
=
0
;
for
RCUi
in
range
(
self
.
N
):
for
RCUi
in
range
(
self
.
N
):
if
(
mask
[
RCUi
])
and
(
self
.
I2Cmask
[
RCUi
]
==
0
):
if
(
mask
[
RCUi
])
and
(
self
.
I2Cmask
[
RCUi
]
<=
self
.
I2Ccut
):
m
|=
1
<<
self
.
RCU_Switch1
[
RCUi
];
m
|=
1
<<
self
.
RCU_Switch1
[
RCUi
];
self
.
conf
[
'
parentcls
'
].
SetChannel
(
m
);
self
.
conf
[
'
parentcls
'
].
SetChannel
(
m
);
...
@@ -63,7 +64,7 @@ class i2c_array(i2c_dev):
...
@@ -63,7 +64,7 @@ class i2c_array(i2c_dev):
for
RCUi
in
range
(
self
.
N
):
for
RCUi
in
range
(
self
.
N
):
for
Vari
in
range
(
Step
):
for
Vari
in
range
(
Step
):
if
not
(
mask
[
RCUi
*
Step
+
Vari
]):
continue
if
not
(
mask
[
RCUi
*
Step
+
Vari
]):
continue
if
not
(
self
.
I2Cmask
[
RCUi
]
==
0
):
if
not
(
self
.
I2Cmask
[
RCUi
]
<=
self
.
I2Ccut
):
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
continue
;
continue
;
i0
=
(
RCUi
*
Step
+
Vari
)
*
Step2
i0
=
(
RCUi
*
Step
+
Vari
)
*
Step2
...
@@ -75,17 +76,19 @@ class i2c_array(i2c_dev):
...
@@ -75,17 +76,19 @@ class i2c_array(i2c_dev):
self
.
RCUi
=
RCUi
;
self
.
RCUi
=
RCUi
;
res
=
self
.
SetVarValue
(
devreg
,
width
,
bitoffset
,
data
[
i0
:
i1
])
res
=
self
.
SetVarValue
(
devreg
,
width
,
bitoffset
,
data
[
i0
:
i1
])
if
not
(
res
):
if
not
(
res
):
if
self
.
disableI2ConError
:
self
.
I2Cmask
[
RCUi
]
=
1
;
if
self
.
disableI2ConError
:
self
.
I2Cmask
[
RCUi
]
+
=
1
;
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
if
self
.
I2Cmask
[
RCUi
]
>
self
.
I2Ccut
:
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
continue
;
continue
;
self
.
I2Cmask
[
RCUi
]
=
0
;
if
getalso
:
if
getalso
:
value2
=
value1
[
i0
:
i1
]
value2
=
value1
[
i0
:
i1
]
res
=
self
.
GetVarValue
(
devreg
,
width
,
bitoffset
,
value2
)
res
=
self
.
GetVarValue
(
devreg
,
width
,
bitoffset
,
value2
)
if
not
(
res
):
if
not
(
res
):
if
self
.
disableI2ConError
:
self
.
I2Cmask
[
RCUi
]
=
1
;
if
self
.
disableI2ConError
:
self
.
I2Cmask
[
RCUi
]
+
=
1
;
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
if
self
.
I2Cmask
[
RCUi
]
>
self
.
I2Ccut
:
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
continue
;
continue
;
value1
[
i0
:
i1
]
=
value2
value1
[
i0
:
i1
]
=
value2
self
.
I2Cmask
[
RCUi
]
=
0
;
return
value1
,
mask
return
value1
,
mask
...
@@ -104,7 +107,7 @@ class i2c_array(i2c_dev):
...
@@ -104,7 +107,7 @@ class i2c_array(i2c_dev):
for
RCUi
in
range
(
self
.
N
):
for
RCUi
in
range
(
self
.
N
):
for
Vari
in
range
(
Step
):
for
Vari
in
range
(
Step
):
if
not
(
mask
[
RCUi
*
Step
+
Vari
]):
continue
if
not
(
mask
[
RCUi
*
Step
+
Vari
]):
continue
if
not
(
self
.
I2Cmask
[
RCUi
]
==
0
):
if
not
(
self
.
I2Cmask
[
RCUi
]
<=
self
.
I2Ccut
):
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
continue
;
continue
;
i0
=
(
RCUi
*
Step
+
Vari
)
*
Step2
i0
=
(
RCUi
*
Step
+
Vari
)
*
Step2
...
@@ -117,9 +120,10 @@ class i2c_array(i2c_dev):
...
@@ -117,9 +120,10 @@ class i2c_array(i2c_dev):
self
.
RCUi
=
RCUi
;
self
.
RCUi
=
RCUi
;
res
=
self
.
GetVarValue
(
devreg
,
width
,
bitoffset
,
value2
)
res
=
self
.
GetVarValue
(
devreg
,
width
,
bitoffset
,
value2
)
if
not
(
res
):
if
not
(
res
):
if
self
.
disableI2ConError
:
self
.
I2Cmask
[
RCUi
]
=
1
;
if
self
.
disableI2ConError
:
self
.
I2Cmask
[
RCUi
]
+
=
1
;
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
if
self
.
I2Cmask
[
RCUi
]
>
self
.
I2Ccut
:
mask
[
RCUi
*
Step
+
Vari
]
=
False
;
continue
;
continue
;
self
.
I2Cmask
[
RCUi
]
=
0
;
value1
[
i0
:
i1
]
=
value2
value1
[
i0
:
i1
]
=
value2
return
value1
,
mask
return
value1
,
mask
...
@@ -141,7 +145,7 @@ class i2c_array(i2c_dev):
...
@@ -141,7 +145,7 @@ class i2c_array(i2c_dev):
if
devreg
.
get
(
'
store
'
):
if
devreg
.
get
(
'
store
'
):
storearray
=
self
.
getstorearray
(
devreg
);
storearray
=
self
.
getstorearray
(
devreg
);
for
RCUi
in
range
(
self
.
N
):
for
RCUi
in
range
(
self
.
N
):
if
(
mask
[
RCUi
])
and
(
self
.
I2Cmask
[
RCUi
]
==
0
):
if
(
mask
[
RCUi
])
and
(
self
.
I2Cmask
[
RCUi
]
<=
self
.
I2Ccut
):
storearray
[
RCUi
]
=
value
[
0
]
storearray
[
RCUi
]
=
value
[
0
]
self
.
RCUi
=
RCUi
;
self
.
RCUi
=
RCUi
;
logging
.
debug
(
str
((
"
Stored values:
"
,
self
.
getstorearray
(
devreg
))))
logging
.
debug
(
str
((
"
Stored values:
"
,
self
.
getstorearray
(
devreg
))))
...
@@ -156,13 +160,14 @@ class i2c_array(i2c_dev):
...
@@ -156,13 +160,14 @@ class i2c_array(i2c_dev):
i2c
=
self
.
conf
[
'
parentcls
'
];
i2c
=
self
.
conf
[
'
parentcls
'
];
for
RCUi
in
range
(
self
.
N
):
for
RCUi
in
range
(
self
.
N
):
if
not
(
mask
[
RCUi
]):
continue
if
not
(
mask
[
RCUi
]):
continue
if
not
(
self
.
I2Cmask
[
RCUi
]
==
0
):
continue
if
not
(
self
.
I2Cmask
[
RCUi
]
<=
self
.
I2Ccut
):
continue
self
.
SetSwitch
(
RCUi
);
self
.
SetSwitch
(
RCUi
);
value2
=
[
value1
[
RCUi
]]
value2
=
[
value1
[
RCUi
]]
self
.
RCUi
=
RCUi
;
self
.
RCUi
=
RCUi
;
res
=
self
.
GetVarValue
(
devreg
,
8
,
0
,
value2
)
res
=
self
.
GetVarValue
(
devreg
,
8
,
0
,
value2
)
if
not
(
res
):
if
not
(
res
):
if
self
.
disableI2ConError
:
self
.
I2Cmask
[
RCUi
]
=
1
;
if
self
.
disableI2ConError
:
self
.
I2Cmask
[
RCUi
]
+=
1
;
self
.
I2Cmask
[
RCUi
]
=
0
;
value1
[
RCUi
]
=
value2
[
0
]
value1
[
RCUi
]
=
value2
[
0
]
if
devreg
.
get
(
'
store
'
):
if
devreg
.
get
(
'
store
'
):
if
mask
[
RCUi
]:
if
mask
[
RCUi
]:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment