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
31
Issues
31
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
306d6a02
Commit
306d6a02
authored
Jan 08, 2015
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename eeprom_* to storage_* as we now have also Flash support
parent
69f8368e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
65 deletions
+62
-65
dev.mk
dev/dev.mk
+1
-1
eeprom.c
dev/eeprom.c
+11
-11
endpoint.c
dev/endpoint.c
+1
-1
rxts_calibrator.c
dev/rxts_calibrator.c
+4
-4
sdb-storage.c
dev/sdb-storage.c
+15
-18
storage.h
include/storage.h
+11
-11
cmd_calib.c
shell/cmd_calib.c
+4
-4
cmd_init.c
shell/cmd_init.c
+4
-4
cmd_sfp.c
shell/cmd_sfp.c
+6
-6
shell.c
shell/shell.c
+2
-2
wrc_main.c
wrc_main.c
+3
-3
No files found.
dev/dev.mk
View file @
306d6a02
...
@@ -13,7 +13,7 @@ obj-$(CONFIG_WR_NODE) += \
...
@@ -13,7 +13,7 @@ obj-$(CONFIG_WR_NODE) += \
obj-$(CONFIG_WR_SWITCH) += dev/timer-wrs.o dev/ad9516.o
obj-$(CONFIG_WR_SWITCH) += dev/timer-wrs.o dev/ad9516.o
obj-$(CONFIG_LEGACY_EEPROM) += dev/eeprom.o
obj-$(CONFIG_LEGACY_EEPROM) += dev/eeprom.o
obj-$(CONFIG_SDB_EEPROM) += dev/sdb-
eeprom
.o
obj-$(CONFIG_SDB_EEPROM) += dev/sdb-
storage
.o
obj-$(CONFIG_W1) += dev/w1.o dev/w1-hw.o dev/w1-shell.o
obj-$(CONFIG_W1) += dev/w1.o dev/w1-hw.o dev/w1-shell.o
obj-$(CONFIG_W1) += dev/w1-temp.o dev/w1-eeprom.o
obj-$(CONFIG_W1) += dev/w1-temp.o dev/w1-eeprom.o
...
...
dev/eeprom.c
View file @
306d6a02
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#include "types.h"
#include "types.h"
#include "i2c.h"
#include "i2c.h"
#include "
eeprom
.h"
#include "
storage
.h"
#include "board.h"
#include "board.h"
#include "syscon.h"
#include "syscon.h"
...
@@ -60,7 +60,7 @@ uint8_t has_eeprom = 0;
...
@@ -60,7 +60,7 @@ uint8_t has_eeprom = 0;
static
int
i2cif
,
i2c_addr
;
/* globals, using the names we always used */
static
int
i2cif
,
i2c_addr
;
/* globals, using the names we always used */
void
eeprom
_init
(
int
chosen_i2cif
,
int
chosen_i2c_addr
)
void
storage
_init
(
int
chosen_i2cif
,
int
chosen_i2c_addr
)
{
{
/* Save these to globals, they are never passed any more */
/* Save these to globals, they are never passed any more */
i2cif
=
chosen_i2cif
;
i2cif
=
chosen_i2cif
;
...
@@ -134,7 +134,7 @@ static int eeprom_write(uint8_t i2cif, uint8_t i2c_addr, uint32_t offset,
...
@@ -134,7 +134,7 @@ static int eeprom_write(uint8_t i2cif, uint8_t i2c_addr, uint32_t offset,
return
size
;
return
size
;
}
}
int32_t
eeprom
_sfpdb_erase
(
void
)
int32_t
storage
_sfpdb_erase
(
void
)
{
{
uint8_t
sfpcount
=
0
;
uint8_t
sfpcount
=
0
;
...
@@ -146,7 +146,7 @@ int32_t eeprom_sfpdb_erase(void)
...
@@ -146,7 +146,7 @@ int32_t eeprom_sfpdb_erase(void)
return
sfpcount
;
return
sfpcount
;
}
}
int
eeprom
_get_sfp
(
struct
s_sfpinfo
*
sfp
,
int
storage
_get_sfp
(
struct
s_sfpinfo
*
sfp
,
uint8_t
add
,
uint8_t
pos
)
uint8_t
add
,
uint8_t
pos
)
{
{
static
uint8_t
sfpcount
=
0
;
static
uint8_t
sfpcount
=
0
;
...
@@ -201,14 +201,14 @@ int eeprom_get_sfp(struct s_sfpinfo * sfp,
...
@@ -201,14 +201,14 @@ int eeprom_get_sfp(struct s_sfpinfo * sfp,
return
sfpcount
;
return
sfpcount
;
}
}
int
eeprom
_match_sfp
(
struct
s_sfpinfo
*
sfp
)
int
storage
_match_sfp
(
struct
s_sfpinfo
*
sfp
)
{
{
uint8_t
sfpcount
=
1
;
uint8_t
sfpcount
=
1
;
int8_t
i
,
temp
;
int8_t
i
,
temp
;
struct
s_sfpinfo
dbsfp
;
struct
s_sfpinfo
dbsfp
;
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
temp
=
eeprom
_get_sfp
(
&
dbsfp
,
0
,
i
);
temp
=
storage
_get_sfp
(
&
dbsfp
,
0
,
i
);
if
(
!
i
)
{
if
(
!
i
)
{
sfpcount
=
temp
;
//only in first round valid sfpcount is returned from eeprom_get_sfp
sfpcount
=
temp
;
//only in first round valid sfpcount is returned from eeprom_get_sfp
if
(
sfpcount
==
0
||
sfpcount
==
0xFF
)
if
(
sfpcount
==
0
||
sfpcount
==
0xFF
)
...
@@ -227,7 +227,7 @@ int eeprom_match_sfp(struct s_sfpinfo * sfp)
...
@@ -227,7 +227,7 @@ int eeprom_match_sfp(struct s_sfpinfo * sfp)
return
0
;
return
0
;
}
}
int
eeprom
_phtrans
(
uint32_t
*
val
,
int
storage
_phtrans
(
uint32_t
*
val
,
uint8_t
write
)
uint8_t
write
)
{
{
int8_t
ret
;
int8_t
ret
;
...
@@ -254,7 +254,7 @@ int eeprom_phtrans(uint32_t * val,
...
@@ -254,7 +254,7 @@ int eeprom_phtrans(uint32_t * val,
}
}
}
}
int
eeprom
_init_erase
(
void
)
int
storage
_init_erase
(
void
)
{
{
uint16_t
used
=
0
;
uint16_t
used
=
0
;
...
@@ -268,7 +268,7 @@ int eeprom_init_erase(void)
...
@@ -268,7 +268,7 @@ int eeprom_init_erase(void)
/*
/*
* Appends a new shell command at the end of boot script
* Appends a new shell command at the end of boot script
*/
*/
int
eeprom
_init_add
(
const
char
*
args
[])
int
storage
_init_add
(
const
char
*
args
[])
{
{
uint8_t
i
=
1
;
uint8_t
i
=
1
;
uint8_t
separator
=
' '
;
uint8_t
separator
=
' '
;
...
@@ -311,7 +311,7 @@ int eeprom_init_add(const char *args[])
...
@@ -311,7 +311,7 @@ int eeprom_init_add(const char *args[])
return
0
;
return
0
;
}
}
int
eeprom
_init_show
(
void
)
int
storage
_init_show
(
void
)
{
{
uint16_t
used
,
i
;
uint16_t
used
,
i
;
uint8_t
byte
;
uint8_t
byte
;
...
@@ -335,7 +335,7 @@ int eeprom_init_show(void)
...
@@ -335,7 +335,7 @@ int eeprom_init_show(void)
return
0
;
return
0
;
}
}
int
eeprom
_init_readcmd
(
uint8_t
*
buf
,
uint8_t
bufsize
,
uint8_t
next
)
int
storage
_init_readcmd
(
uint8_t
*
buf
,
uint8_t
bufsize
,
uint8_t
next
)
{
{
static
uint16_t
ptr
;
static
uint16_t
ptr
;
static
uint16_t
used
=
0
;
static
uint16_t
used
=
0
;
...
...
dev/endpoint.c
View file @
306d6a02
...
@@ -14,7 +14,7 @@ LGPL 2.1
...
@@ -14,7 +14,7 @@ LGPL 2.1
#include "board.h"
#include "board.h"
#include "syscon.h"
#include "syscon.h"
#include <endpoint.h>
#include <endpoint.h>
#include "
eeprom
.h"
#include "
storage
.h"
#include <hw/endpoint_regs.h>
#include <hw/endpoint_regs.h>
#include <hw/endpoint_mdio.h>
#include <hw/endpoint_mdio.h>
...
...
dev/rxts_calibrator.c
View file @
306d6a02
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#include "endpoint.h"
#include "endpoint.h"
#include "softpll_ng.h"
#include "softpll_ng.h"
#include "wrc_ptp.h"
#include "wrc_ptp.h"
#include "
eeprom
.h"
#include "
storage
.h"
#include "ptpd_netif.h"
#include "ptpd_netif.h"
/* New calibrator for the transition phase value. A major pain in the ass for
/* New calibrator for the transition phase value. A major pain in the ass for
...
@@ -213,7 +213,7 @@ static int calib_t24p_master(uint32_t *value)
...
@@ -213,7 +213,7 @@ static int calib_t24p_master(uint32_t *value)
{
{
int
rv
;
int
rv
;
rv
=
eeprom
_phtrans
(
value
,
0
);
rv
=
storage
_phtrans
(
value
,
0
);
if
(
rv
<
0
)
{
if
(
rv
<
0
)
{
pp_printf
(
"Error %d while reading EEPROM
\n
"
,
rv
);
pp_printf
(
"Error %d while reading EEPROM
\n
"
,
rv
);
return
rv
;
return
rv
;
...
@@ -241,9 +241,9 @@ static int calib_t24p_slave(uint32_t *value)
...
@@ -241,9 +241,9 @@ static int calib_t24p_slave(uint32_t *value)
* Let's see if we have a matching value in EEPROM:
* Let's see if we have a matching value in EEPROM:
* accept a 200ps difference, otherwise rewrite eeprom
* accept a 200ps difference, otherwise rewrite eeprom
*/
*/
rv
=
eeprom
_phtrans
(
&
prev
,
0
/* rd */
);
rv
=
storage
_phtrans
(
&
prev
,
0
/* rd */
);
if
(
rv
<
0
||
(
prev
<
*
value
-
200
)
||
(
prev
>
*
value
+
200
))
{
if
(
rv
<
0
||
(
prev
<
*
value
-
200
)
||
(
prev
>
*
value
+
200
))
{
rv
=
eeprom
_phtrans
(
value
,
1
);
rv
=
storage
_phtrans
(
value
,
1
);
pp_printf
(
"Wrote new t24p value: %d ps (%s)
\n
"
,
*
value
,
pp_printf
(
"Wrote new t24p value: %d ps (%s)
\n
"
,
*
value
,
rv
<
0
?
"Failed"
:
"Success"
);
rv
<
0
?
"Failed"
:
"Success"
);
}
}
...
...
dev/sdb-
eeprom
.c
→
dev/sdb-
storage
.c
View file @
306d6a02
...
@@ -10,13 +10,10 @@
...
@@ -10,13 +10,10 @@
//#include <string.h>
//#include <string.h>
#include <wrc.h>
#include <wrc.h>
#include <w1.h>
#include <w1.h>
#include <
eeprom
.h>
#include <
storage
.h>
#include "types.h"
#include "types.h"
#include "i2c.h"
#include "i2c.h"
//#include "eeprom.h"
//#include "board.h"
//#include "syscon.h"
#include <sdb.h>
#include <sdb.h>
#define SDBFS_BIG_ENDIAN
#define SDBFS_BIG_ENDIAN
...
@@ -163,7 +160,7 @@ static int sdb_i2c_erase(struct sdbfs *fs, int offset, int count)
...
@@ -163,7 +160,7 @@ static int sdb_i2c_erase(struct sdbfs *fs, int offset, int count)
/*
/*
* A trivial dumper, just to show what's up in there
* A trivial dumper, just to show what's up in there
*/
*/
static
void
eeprom
_sdb_list
(
struct
sdbfs
*
fs
)
static
void
storage
_sdb_list
(
struct
sdbfs
*
fs
)
{
{
struct
sdb_device
*
d
;
struct
sdb_device
*
d
;
int
new
=
1
;
int
new
=
1
;
...
@@ -192,7 +189,7 @@ uint8_t has_eeprom = 0; /* modified at init time */
...
@@ -192,7 +189,7 @@ uint8_t has_eeprom = 0; /* modified at init time */
*
*
* This is called by wrc_main, after initializing both w1 and i2c
* This is called by wrc_main, after initializing both w1 and i2c
*/
*/
void
eeprom
_init
(
int
chosen_i2cif
,
int
chosen_i2c_addr
)
void
storage
_init
(
int
chosen_i2cif
,
int
chosen_i2c_addr
)
{
{
uint32_t
magic
=
0
;
uint32_t
magic
=
0
;
static
unsigned
entry_points_eeprom
[]
=
{
0
,
64
,
128
,
256
,
512
,
1024
};
static
unsigned
entry_points_eeprom
[]
=
{
0
,
64
,
128
,
256
,
512
,
1024
};
...
@@ -283,7 +280,7 @@ found_exit:
...
@@ -283,7 +280,7 @@ found_exit:
/* found: register the filesystem */
/* found: register the filesystem */
has_eeprom
=
1
;
has_eeprom
=
1
;
sdbfs_dev_create
(
&
wrc_sdb
);
sdbfs_dev_create
(
&
wrc_sdb
);
eeprom
_sdb_list
(
&
wrc_sdb
);
storage
_sdb_list
(
&
wrc_sdb
);
return
;
return
;
}
}
...
@@ -366,7 +363,7 @@ int set_persistent_mac(uint8_t portnum, uint8_t * mac)
...
@@ -366,7 +363,7 @@ int set_persistent_mac(uint8_t portnum, uint8_t * mac)
/* Erase SFB database in the memory */
/* Erase SFB database in the memory */
int32_t
eeprom
_sfpdb_erase
(
void
)
int32_t
storage
_sfpdb_erase
(
void
)
{
{
int
ret
;
int
ret
;
...
@@ -381,7 +378,7 @@ int32_t eeprom_sfpdb_erase(void)
...
@@ -381,7 +378,7 @@ int32_t eeprom_sfpdb_erase(void)
/* Dummy check if sfp information is correct by verifying it doesn't have
/* Dummy check if sfp information is correct by verifying it doesn't have
* 0xff bytes */
* 0xff bytes */
static
int
eeprom_
sfp_valid
(
struct
s_sfpinfo
*
sfp
)
static
int
sfp_valid
(
struct
s_sfpinfo
*
sfp
)
{
{
int
i
;
int
i
;
...
@@ -392,7 +389,7 @@ static int eeprom_sfp_valid(struct s_sfpinfo *sfp)
...
@@ -392,7 +389,7 @@ static int eeprom_sfp_valid(struct s_sfpinfo *sfp)
return
1
;
return
1
;
}
}
int
eeprom
_get_sfp
(
struct
s_sfpinfo
*
sfp
,
int
storage
_get_sfp
(
struct
s_sfpinfo
*
sfp
,
uint8_t
add
,
uint8_t
pos
)
uint8_t
add
,
uint8_t
pos
)
{
{
static
uint8_t
sfpcount
=
0
;
static
uint8_t
sfpcount
=
0
;
...
@@ -413,7 +410,7 @@ int eeprom_get_sfp(struct s_sfpinfo * sfp,
...
@@ -413,7 +410,7 @@ int eeprom_get_sfp(struct s_sfpinfo * sfp,
while
(
sdbfs_fread
(
&
wrc_sdb
,
sizeof
(
sfpcount
)
+
while
(
sdbfs_fread
(
&
wrc_sdb
,
sizeof
(
sfpcount
)
+
sfpcount
*
sizeof
(
tempsfp
),
&
tempsfp
,
sfpcount
*
sizeof
(
tempsfp
),
&
tempsfp
,
sizeof
(
tempsfp
))
==
sizeof
(
tempsfp
))
{
sizeof
(
tempsfp
))
==
sizeof
(
tempsfp
))
{
if
(
!
eeprom_
sfp_valid
(
&
tempsfp
))
if
(
!
sfp_valid
(
&
tempsfp
))
break
;
break
;
sfpcount
++
;
sfpcount
++
;
...
@@ -463,14 +460,14 @@ out:
...
@@ -463,14 +460,14 @@ out:
return
0
;
return
0
;
}
}
int
eeprom
_match_sfp
(
struct
s_sfpinfo
*
sfp
)
int
storage
_match_sfp
(
struct
s_sfpinfo
*
sfp
)
{
{
uint8_t
sfpcount
=
1
;
uint8_t
sfpcount
=
1
;
int8_t
i
,
temp
;
int8_t
i
,
temp
;
struct
s_sfpinfo
dbsfp
;
struct
s_sfpinfo
dbsfp
;
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
temp
=
eeprom
_get_sfp
(
&
dbsfp
,
0
,
i
);
temp
=
storage
_get_sfp
(
&
dbsfp
,
0
,
i
);
if
(
!
i
)
{
if
(
!
i
)
{
// first round: valid sfpcount is returned
// first round: valid sfpcount is returned
sfpcount
=
temp
;
sfpcount
=
temp
;
...
@@ -494,7 +491,7 @@ int eeprom_match_sfp(struct s_sfpinfo * sfp)
...
@@ -494,7 +491,7 @@ int eeprom_match_sfp(struct s_sfpinfo * sfp)
* Phase transition ("calibration" file)
* Phase transition ("calibration" file)
*/
*/
#define VALIDITY_BIT 0x80000000
#define VALIDITY_BIT 0x80000000
int
eeprom
_phtrans
(
uint32_t
*
valp
,
int
storage
_phtrans
(
uint32_t
*
valp
,
uint8_t
write
)
uint8_t
write
)
{
{
int
ret
=
-
1
;
int
ret
=
-
1
;
...
@@ -534,7 +531,7 @@ out:
...
@@ -534,7 +531,7 @@ out:
* ------------------------------------------------
* ------------------------------------------------
*/
*/
int
eeprom
_init_erase
(
void
)
int
storage
_init_erase
(
void
)
{
{
int
ret
;
int
ret
;
...
@@ -550,7 +547,7 @@ int eeprom_init_erase(void)
...
@@ -550,7 +547,7 @@ int eeprom_init_erase(void)
/*
/*
* Appends a new shell command at the end of boot script
* Appends a new shell command at the end of boot script
*/
*/
int
eeprom
_init_add
(
const
char
*
args
[])
int
storage
_init_add
(
const
char
*
args
[])
{
{
int
len
,
i
;
int
len
,
i
;
uint8_t
separator
=
' '
;
uint8_t
separator
=
' '
;
...
@@ -604,7 +601,7 @@ out:
...
@@ -604,7 +601,7 @@ out:
return
ret
;
return
ret
;
}
}
int
eeprom
_init_show
(
void
)
int
storage
_init_show
(
void
)
{
{
int
ret
=
-
1
;
int
ret
=
-
1
;
uint16_t
used
;
uint16_t
used
;
...
@@ -631,7 +628,7 @@ out:
...
@@ -631,7 +628,7 @@ out:
return
ret
;
return
ret
;
}
}
int
eeprom
_init_readcmd
(
uint8_t
*
buf
,
uint8_t
bufsize
,
uint8_t
next
)
int
storage
_init_readcmd
(
uint8_t
*
buf
,
uint8_t
bufsize
,
uint8_t
next
)
{
{
int
i
=
0
,
ret
=
-
1
;
int
i
=
0
,
ret
=
-
1
;
uint16_t
used
;
uint16_t
used
;
...
...
include/
eeprom
.h
→
include/
storage
.h
View file @
306d6a02
#ifndef __
EEPROM
_H
#ifndef __
STORAGE
_H
#define __
EEPROM
_H
#define __
STORAGE
_H
#define SFP_SECTION_PATTERN 0xdeadbeef
#define SFP_SECTION_PATTERN 0xdeadbeef
#define SFPS_MAX 4
#define SFPS_MAX 4
...
@@ -27,19 +27,19 @@ struct s_sfpinfo {
...
@@ -27,19 +27,19 @@ struct s_sfpinfo {
uint8_t
chksum
;
uint8_t
chksum
;
}
__attribute__
((
__packed__
));
}
__attribute__
((
__packed__
));
void
eeprom
_init
(
int
i2cif
,
int
i2c_addr
);
void
storage
_init
(
int
i2cif
,
int
i2c_addr
);
int
eeprom
_sfpdb_erase
(
void
);
int
storage
_sfpdb_erase
(
void
);
int
eeprom
_match_sfp
(
struct
s_sfpinfo
*
sfp
);
int
storage
_match_sfp
(
struct
s_sfpinfo
*
sfp
);
int
eeprom
_get_sfp
(
struct
s_sfpinfo
*
sfp
,
int
storage
_get_sfp
(
struct
s_sfpinfo
*
sfp
,
uint8_t
add
,
uint8_t
pos
);
uint8_t
add
,
uint8_t
pos
);
int
eeprom
_phtrans
(
uint32_t
*
val
,
int
storage
_phtrans
(
uint32_t
*
val
,
uint8_t
write
);
uint8_t
write
);
int
eeprom
_init_erase
(
void
);
int
storage
_init_erase
(
void
);
int
eeprom
_init_add
(
const
char
*
args
[]);
int
storage
_init_add
(
const
char
*
args
[]);
int
eeprom
_init_show
(
void
);
int
storage
_init_show
(
void
);
int
eeprom
_init_readcmd
(
uint8_t
*
buf
,
uint8_t
bufsize
,
uint8_t
next
);
int
storage
_init_readcmd
(
uint8_t
*
buf
,
uint8_t
bufsize
,
uint8_t
next
);
#endif
#endif
shell/cmd_calib.c
View file @
306d6a02
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include <string.h>
#include <string.h>
#include <wrc.h>
#include <wrc.h>
#include "shell.h"
#include "shell.h"
#include "
eeprom
.h"
#include "
storage
.h"
#include "syscon.h"
#include "syscon.h"
#include "rxts_calibrator.h"
#include "rxts_calibrator.h"
...
@@ -27,9 +27,9 @@ static int cmd_calibration(const char *args[])
...
@@ -27,9 +27,9 @@ static int cmd_calibration(const char *args[])
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"force"
))
{
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"force"
))
{
if
(
measure_t24p
(
&
trans
)
<
0
)
if
(
measure_t24p
(
&
trans
)
<
0
)
return
-
1
;
return
-
1
;
return
eeprom
_phtrans
(
&
trans
,
1
);
return
storage
_phtrans
(
&
trans
,
1
);
}
else
if
(
!
args
[
0
])
{
}
else
if
(
!
args
[
0
])
{
if
(
eeprom
_phtrans
(
&
trans
,
0
)
>
0
)
{
if
(
storage
_phtrans
(
&
trans
,
0
)
>
0
)
{
mprintf
(
"Found phase transition in EEPROM: %dps
\n
"
,
mprintf
(
"Found phase transition in EEPROM: %dps
\n
"
,
trans
);
trans
);
cal_phase_transition
=
trans
;
cal_phase_transition
=
trans
;
...
@@ -39,7 +39,7 @@ static int cmd_calibration(const char *args[])
...
@@ -39,7 +39,7 @@ static int cmd_calibration(const char *args[])
if
(
measure_t24p
(
&
trans
)
<
0
)
if
(
measure_t24p
(
&
trans
)
<
0
)
return
-
1
;
return
-
1
;
cal_phase_transition
=
trans
;
cal_phase_transition
=
trans
;
return
eeprom
_phtrans
(
&
trans
,
1
);
return
storage
_phtrans
(
&
trans
,
1
);
}
}
}
}
...
...
shell/cmd_init.c
View file @
306d6a02
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include <string.h>
#include <string.h>
#include <wrc.h>
#include <wrc.h>
#include "shell.h"
#include "shell.h"
#include "
eeprom
.h"
#include "
storage
.h"
#include "syscon.h"
#include "syscon.h"
#include "i2c.h"
#include "i2c.h"
...
@@ -22,15 +22,15 @@ static int cmd_init(const char *args[])
...
@@ -22,15 +22,15 @@ static int cmd_init(const char *args[])
}
}
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"erase"
))
{
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"erase"
))
{
if
(
eeprom
_init_erase
()
<
0
)
if
(
storage
_init_erase
()
<
0
)
mprintf
(
"Could not erase init script
\n
"
);
mprintf
(
"Could not erase init script
\n
"
);
}
else
if
(
args
[
1
]
&&
!
strcasecmp
(
args
[
0
],
"add"
))
{
}
else
if
(
args
[
1
]
&&
!
strcasecmp
(
args
[
0
],
"add"
))
{
if
(
eeprom
_init_add
(
args
)
<
0
)
if
(
storage
_init_add
(
args
)
<
0
)
mprintf
(
"Could not add the command
\n
"
);
mprintf
(
"Could not add the command
\n
"
);
else
else
mprintf
(
"OK.
\n
"
);
mprintf
(
"OK.
\n
"
);
}
else
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"show"
))
{
}
else
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"show"
))
{
eeprom
_init_show
();
storage
_init_show
();
}
else
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"boot"
))
{
}
else
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"boot"
))
{
shell_boot_script
();
shell_boot_script
();
}
}
...
...
shell/cmd_sfp.c
View file @
306d6a02
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#include <wrc.h>
#include <wrc.h>
#include "shell.h"
#include "shell.h"
#include "
eeprom
.h"
#include "
storage
.h"
#include "syscon.h"
#include "syscon.h"
#include "sfp.h"
#include "sfp.h"
...
@@ -51,7 +51,7 @@ static int cmd_sfp(const char *args[])
...
@@ -51,7 +51,7 @@ static int cmd_sfp(const char *args[])
// return 0;
// return 0;
// }
// }
else
if
(
!
strcasecmp
(
args
[
0
],
"erase"
))
{
else
if
(
!
strcasecmp
(
args
[
0
],
"erase"
))
{
if
(
eeprom
_sfpdb_erase
()
==
if
(
storage
_sfpdb_erase
()
==
EE_RET_I2CERR
)
EE_RET_I2CERR
)
mprintf
(
"Could not erase DB
\n
"
);
mprintf
(
"Could not erase DB
\n
"
);
}
else
if
(
args
[
4
]
&&
!
strcasecmp
(
args
[
0
],
"add"
))
{
}
else
if
(
args
[
4
]
&&
!
strcasecmp
(
args
[
0
],
"add"
))
{
...
@@ -66,7 +66,7 @@ static int cmd_sfp(const char *args[])
...
@@ -66,7 +66,7 @@ static int cmd_sfp(const char *args[])
sfp
.
dTx
=
atoi
(
args
[
2
]);
sfp
.
dTx
=
atoi
(
args
[
2
]);
sfp
.
dRx
=
atoi
(
args
[
3
]);
sfp
.
dRx
=
atoi
(
args
[
3
]);
sfp
.
alpha
=
atoi
(
args
[
4
]);
sfp
.
alpha
=
atoi
(
args
[
4
]);
temp
=
eeprom
_get_sfp
(
&
sfp
,
1
,
0
);
temp
=
storage
_get_sfp
(
&
sfp
,
1
,
0
);
if
(
temp
==
EE_RET_DBFULL
)
if
(
temp
==
EE_RET_DBFULL
)
mprintf
(
"SFP DB is full
\n
"
);
mprintf
(
"SFP DB is full
\n
"
);
else
if
(
temp
==
EE_RET_I2CERR
)
else
if
(
temp
==
EE_RET_I2CERR
)
...
@@ -75,9 +75,9 @@ static int cmd_sfp(const char *args[])
...
@@ -75,9 +75,9 @@ static int cmd_sfp(const char *args[])
mprintf
(
"%d SFPs in DB
\n
"
,
temp
);
mprintf
(
"%d SFPs in DB
\n
"
,
temp
);
}
else
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"show"
))
{
}
else
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"show"
))
{
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
for
(
i
=
0
;
i
<
sfpcount
;
++
i
)
{
temp
=
eeprom
_get_sfp
(
&
sfp
,
0
,
i
);
temp
=
storage
_get_sfp
(
&
sfp
,
0
,
i
);
if
(
!
i
)
{
if
(
!
i
)
{
sfpcount
=
temp
;
//only in first round valid sfpcount is returned from
eeprom
_get_sfp
sfpcount
=
temp
;
//only in first round valid sfpcount is returned from
storage
_get_sfp
if
(
sfpcount
==
0
||
sfpcount
==
0xFF
)
{
if
(
sfpcount
==
0
||
sfpcount
==
0xFF
)
{
mprintf
(
"SFP database empty...
\n
"
);
mprintf
(
"SFP database empty...
\n
"
);
return
0
;
return
0
;
...
@@ -98,7 +98,7 @@ static int cmd_sfp(const char *args[])
...
@@ -98,7 +98,7 @@ static int cmd_sfp(const char *args[])
return
0
;
return
0
;
}
}
strncpy
(
sfp
.
pn
,
pn
,
SFP_PN_LEN
);
strncpy
(
sfp
.
pn
,
pn
,
SFP_PN_LEN
);
if
(
eeprom
_match_sfp
(
&
sfp
)
>
0
)
{
if
(
storage
_match_sfp
(
&
sfp
)
>
0
)
{
mprintf
(
"SFP matched, dTx=%d, dRx=%d, alpha=%d
\n
"
,
mprintf
(
"SFP matched, dTx=%d, dRx=%d, alpha=%d
\n
"
,
sfp
.
dTx
,
sfp
.
dRx
,
sfp
.
alpha
);
sfp
.
dTx
,
sfp
.
dRx
,
sfp
.
alpha
);
sfp_deltaTx
=
sfp
.
dTx
;
sfp_deltaTx
=
sfp
.
dTx
;
...
...
shell/shell.c
View file @
306d6a02
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
#include "uart.h"
#include "uart.h"
#include "syscon.h"
#include "syscon.h"
#include "shell.h"
#include "shell.h"
#include "
eeprom
.h"
#include "
storage
.h"
#define SH_MAX_LINE_LEN 80
#define SH_MAX_LINE_LEN 80
#define SH_MAX_ARGS 8
#define SH_MAX_ARGS 8
...
@@ -256,7 +256,7 @@ int shell_boot_script(void)
...
@@ -256,7 +256,7 @@ int shell_boot_script(void)
return
-
1
;
return
-
1
;
while
(
1
)
{
while
(
1
)
{
cmd_len
=
eeprom
_init_readcmd
((
uint8_t
*
)
cmd_buf
,
cmd_len
=
storage
_init_readcmd
((
uint8_t
*
)
cmd_buf
,
SH_MAX_LINE_LEN
,
next
);
SH_MAX_LINE_LEN
,
next
);
if
(
cmd_len
<=
0
)
{
if
(
cmd_len
<=
0
)
{
if
(
next
==
0
)
if
(
next
==
0
)
...
...
wrc_main.c
View file @
306d6a02
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#include "pps_gen.h"
#include "pps_gen.h"
#include "ptpd_netif.h"
#include "ptpd_netif.h"
#include "i2c.h"
#include "i2c.h"
#include "
eeprom
.h"
#include "
storage
.h"
#include "softpll_ng.h"
#include "softpll_ng.h"
#include "onewire.h"
#include "onewire.h"
#include "pps_gen.h"
#include "pps_gen.h"
...
@@ -62,8 +62,8 @@ static void wrc_initialize()
...
@@ -62,8 +62,8 @@ static void wrc_initialize()
flash_init
();
flash_init
();
/*initialize I2C bus*/
/*initialize I2C bus*/
mi2c_init
(
WRPC_FMC_I2C
);
mi2c_init
(
WRPC_FMC_I2C
);
/*
check if EEPROM is onboard
*/
/*
init storage (Flash / W1 EEPROM / I2C EEPROM
*/
eeprom
_init
(
WRPC_FMC_I2C
,
FMC_EEPROM_ADR
);
storage
_init
(
WRPC_FMC_I2C
,
FMC_EEPROM_ADR
);
mac_addr
[
0
]
=
0x08
;
//
mac_addr
[
0
]
=
0x08
;
//
mac_addr
[
1
]
=
0x00
;
// CERN OUI
mac_addr
[
1
]
=
0x00
;
// CERN OUI
...
...
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