Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
4ed88edb
Commit
4ed88edb
authored
Oct 10, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eeprom: don't pass redundant parameters to eeprom_get_sfp
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
ca42df73
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
11 deletions
+8
-11
eeprom.c
dev/eeprom.c
+2
-3
sdb-eeprom.c
dev/sdb-eeprom.c
+2
-3
eeprom.h
include/eeprom.h
+2
-2
cmd_sfp.c
shell/cmd_sfp.c
+2
-3
No files found.
dev/eeprom.c
View file @
4ed88edb
...
...
@@ -146,7 +146,7 @@ int32_t eeprom_sfpdb_erase(void)
return
sfpcount
;
}
int
32_t
eeprom_get_sfp
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
struct
s_sfpinfo
*
sfp
,
int
eeprom_get_sfp
(
struct
s_sfpinfo
*
sfp
,
uint8_t
add
,
uint8_t
pos
)
{
static
uint8_t
sfpcount
=
0
;
...
...
@@ -208,8 +208,7 @@ int eeprom_match_sfp(struct s_sfpinfo * sfp)
struct
s_sfpinfo
dbsfp
;
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
temp
=
eeprom_get_sfp
(
WRPC_FMC_I2C
,
FMC_EEPROM_ADR
,
&
dbsfp
,
0
,
i
);
temp
=
eeprom_get_sfp
(
&
dbsfp
,
0
,
i
);
if
(
!
i
)
{
sfpcount
=
temp
;
//only in first round valid sfpcount is returned from eeprom_get_sfp
if
(
sfpcount
==
0
||
sfpcount
==
0xFF
)
...
...
dev/sdb-eeprom.c
View file @
4ed88edb
...
...
@@ -287,7 +287,7 @@ int32_t eeprom_sfpdb_erase(void)
return
ret
==
1
?
0
:
-
1
;
}
int
32_t
eeprom_get_sfp
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
struct
s_sfpinfo
*
sfp
,
int
eeprom_get_sfp
(
struct
s_sfpinfo
*
sfp
,
uint8_t
add
,
uint8_t
pos
)
{
static
uint8_t
sfpcount
=
0
;
...
...
@@ -357,8 +357,7 @@ int eeprom_match_sfp(struct s_sfpinfo * sfp)
struct
s_sfpinfo
dbsfp
;
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
temp
=
eeprom_get_sfp
(
i2c_params
.
ifnum
,
i2c_params
.
addr
,
&
dbsfp
,
0
,
i
);
temp
=
eeprom_get_sfp
(
&
dbsfp
,
0
,
i
);
if
(
!
i
)
{
// first round: valid sfpcount is returned
sfpcount
=
temp
;
...
...
include/eeprom.h
View file @
4ed88edb
...
...
@@ -31,6 +31,8 @@ void eeprom_init(int i2cif, int i2c_addr);
int
eeprom_sfpdb_erase
(
void
);
int
eeprom_match_sfp
(
struct
s_sfpinfo
*
sfp
);
int
eeprom_get_sfp
(
struct
s_sfpinfo
*
sfp
,
uint8_t
add
,
uint8_t
pos
);
int8_t
eeprom_phtrans
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
uint32_t
*
val
,
uint8_t
write
);
...
...
@@ -41,7 +43,5 @@ int32_t eeprom_init_show(uint8_t i2cif, uint8_t i2c_addr);
int8_t
eeprom_init_readcmd
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
uint8_t
*
buf
,
uint8_t
bufsize
,
uint8_t
next
);
int32_t
eeprom_get_sfp
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
struct
s_sfpinfo
*
sfp
,
uint8_t
add
,
uint8_t
pos
);
#endif
shell/cmd_sfp.c
View file @
4ed88edb
...
...
@@ -66,7 +66,7 @@ static int cmd_sfp(const char *args[])
sfp
.
dTx
=
atoi
(
args
[
2
]);
sfp
.
dRx
=
atoi
(
args
[
3
]);
sfp
.
alpha
=
atoi
(
args
[
4
]);
temp
=
eeprom_get_sfp
(
WRPC_FMC_I2C
,
FMC_EEPROM_ADR
,
&
sfp
,
1
,
0
);
temp
=
eeprom_get_sfp
(
&
sfp
,
1
,
0
);
if
(
temp
==
EE_RET_DBFULL
)
mprintf
(
"SFP DB is full
\n
"
);
else
if
(
temp
==
EE_RET_I2CERR
)
...
...
@@ -75,8 +75,7 @@ static int cmd_sfp(const char *args[])
mprintf
(
"%d SFPs in DB
\n
"
,
temp
);
}
else
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"show"
))
{
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
temp
=
eeprom_get_sfp
(
WRPC_FMC_I2C
,
FMC_EEPROM_ADR
,
&
sfp
,
0
,
i
);
temp
=
eeprom_get_sfp
(
&
sfp
,
0
,
i
);
if
(
!
i
)
{
sfpcount
=
temp
;
//only in first round valid sfpcount is returned from eeprom_get_sfp
if
(
sfpcount
==
0
||
sfpcount
==
0xFF
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment