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
28
Issues
28
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
cfe9208d
Commit
cfe9208d
authored
Mar 08, 2012
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eeprom driver: bugfixes, cleanup
parent
1d453f44
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
eeprom.c
dev/eeprom.c
+8
-7
eeprom.h
include/eeprom.h
+1
-1
No files found.
dev/eeprom.c
View file @
cfe9208d
...
...
@@ -92,7 +92,7 @@ int eeprom_write(uint8_t i2cif, uint8_t i2c_addr, uint32_t offset, uint8_t *buf,
}
uint16
_t
eeprom_sfp_section
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
size_t
size
,
uint16_t
*
section_sz
)
int32
_t
eeprom_sfp_section
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
size_t
size
,
uint16_t
*
section_sz
)
{
uint8_t
c
,
match
;
uint16_t
i
;
...
...
@@ -101,7 +101,7 @@ uint16_t eeprom_sfp_section(uint8_t i2cif, uint8_t i2c_addr, size_t size, uint16
match
=
0x00
;
*
section_sz
=
0x0000
;
mi2c_start
(
i2cif
);
if
(
mi2c_put_byte
(
i2cif
,
i2c_addr
<<
1
)
<
0
)
if
(
mi2c_put_byte
(
i2cif
,
i2c_addr
<<
1
)
!=
0
)
{
mi2c_stop
(
i2cif
);
return
-
1
;
...
...
@@ -181,13 +181,14 @@ int8_t access_eeprom(char *sfp_pn, int32_t *alpha, int32_t *deltaTx, int32_t *de
{
uint16_t
i
;
uint8_t
j
;
uint16_t
sfp_adr
,
sfp_sz
;
uint16_t
sfp_sz
;
int32_t
sfp_adr
;
struct
s_sfpinfo
sfpinfo
[
SFPINFO_MAX
];
mi2c_init
(
WRPC_FMC_I2C
);
sfp_adr
=
eeprom_sfp_section
(
WRPC_FMC_I2C
,
FMC_EEPROM_ADR
,
64
*
1024
,
&
sfp_sz
);
if
(
sfp_
sz
==
-
1
)
if
(
sfp_
adr
==
-
1
)
{
mprintf
(
"FMC EEPROM not found
\n
"
);
return
-
1
;
...
...
@@ -195,14 +196,14 @@ int8_t access_eeprom(char *sfp_pn, int32_t *alpha, int32_t *deltaTx, int32_t *de
else
if
(
sfp_sz
>
SFPINFO_MAX
)
{
//Ooops, there are too many of them, print warning
mprintf
(
"!
!! Warning !!! not enough space for all SFP entries (%d SFPs in the EEPROM
)
\n
"
,
sfp_sz
);
mprintf
(
"!
Warning ! too many SFP entries (%d
)
\n
"
,
sfp_sz
);
sfp_sz
=
SFPINFO_MAX
;
}
mprintf
(
"EEPROM: found SFP section at %d size %d
\n
"
,
(
uint32_t
)
sfp_adr
,
(
uint32_t
)
sfp_sz
);
if
(
eeprom_get_sfpinfo
(
WRPC_FMC_I2C
,
FMC_EEPROM_ADR
,
sfp_adr
,
sfpinfo
,
sfp_sz
))
{
mprintf
(
"
eeprom_get_sfpinfo
ERROR
\n
"
);
mprintf
(
"
EEPROM
ERROR
\n
"
);
return
-
1
;
}
...
...
@@ -219,7 +220,7 @@ int8_t access_eeprom(char *sfp_pn, int32_t *alpha, int32_t *deltaTx, int32_t *de
mprintf
(
"match SFP%d: pn="
,
i
+
1
);
for
(
j
=
0
;
j
<
16
;
++
j
)
mprintf
(
"%c"
,
sfpinfo
[
i
].
pn
[
j
]);
mprintf
(
" alpha=%x deltaTx=%x deltaRx=%x
\n
"
,
sfpinfo
[
i
].
alpha
,
sfpinfo
[
i
].
deltaTx
,
sfpinfo
[
i
].
deltaRx
);
//
mprintf(" alpha=%x deltaTx=%x deltaRx=%x\n", sfpinfo[i].alpha, sfpinfo[i].deltaTx, sfpinfo[i].deltaRx);
*
alpha
=
sfpinfo
[
i
].
alpha
;
*
deltaTx
=
sfpinfo
[
i
].
deltaTx
;
...
...
include/eeprom.h
View file @
cfe9208d
...
...
@@ -16,7 +16,7 @@ int eeprom_read(uint8_t i2cif, uint8_t i2c_addr, uint32_t offset, uint8_t *buf,
int
eeprom_write
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
uint32_t
offset
,
uint8_t
*
buf
,
size_t
size
);
uint16
_t
eeprom_sfp_section
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
size_t
size
,
uint16_t
*
section_sz
);
int32
_t
eeprom_sfp_section
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
size_t
size
,
uint16_t
*
section_sz
);
int8_t
eeprom_get_sfpinfo
(
uint8_t
i2cif
,
uint8_t
i2c_addr
,
uint32_t
offset
,
struct
s_sfpinfo
*
sfpinfo
,
uint16_t
section_sz
);
int8_t
access_eeprom
(
char
*
sfp_pn
,
int32_t
*
alpha
,
int32_t
*
deltaTx
,
int32_t
*
deltaRx
);
...
...
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