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
306e93c2
Commit
306e93c2
authored
Nov 19, 2020
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read spec7 mac addr from UID
parent
0872c38c
Pipeline
#660
passed with stage
in 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
board.c
boards/spec7/board.c
+10
-11
board.h
boards/spec7/board.h
+3
-1
No files found.
boards/spec7/board.c
View file @
306e93c2
...
@@ -224,6 +224,7 @@ int spec7_init()
...
@@ -224,6 +224,7 @@ int spec7_init()
struct
i2c_bus
dev_i2c_eeprom
;
struct
i2c_bus
dev_i2c_eeprom
;
struct
i2c_eeprom_device
wrc_eeprom_dev
;
struct
i2c_eeprom_device
wrc_eeprom_dev
;
struct
i2c_eeprom_device
wrc_uid_dev
;
int
wrc_board_early_init
()
int
wrc_board_early_init
()
{
{
...
@@ -236,7 +237,7 @@ int wrc_board_early_init()
...
@@ -236,7 +237,7 @@ int wrc_board_early_init()
&
pin_eeprom_sda
);
&
pin_eeprom_sda
);
bb_i2c_init
(
&
dev_i2c_eeprom
);
bb_i2c_init
(
&
dev_i2c_eeprom
);
i2c_eeprom_create
(
&
wrc_eeprom_dev
,
&
dev_i2c_eeprom
,
0x50
,
2
);
i2c_eeprom_create
(
&
wrc_eeprom_dev
,
&
dev_i2c_eeprom
,
EEPROM_ADR
,
2
);
storage_i2ceeprom_create
(
&
wrc_storage_dev
,
&
wrc_eeprom_dev
);
storage_i2ceeprom_create
(
&
wrc_storage_dev
,
&
wrc_eeprom_dev
);
/*
/*
...
@@ -244,6 +245,9 @@ int wrc_board_early_init()
...
@@ -244,6 +245,9 @@ int wrc_board_early_init()
*/
*/
storage_mount
(
&
wrc_storage_dev
);
storage_mount
(
&
wrc_storage_dev
);
/* create and initialize UID eeprom I2C bus */
i2c_eeprom_create
(
&
wrc_uid_dev
,
&
dev_i2c_eeprom
,
UID_EEPROM_ADR
,
1
);
return
0
;
return
0
;
}
}
...
@@ -251,17 +255,12 @@ int wrc_board_init()
...
@@ -251,17 +255,12 @@ int wrc_board_init()
{
{
uint8_t
mac_addr
[
6
];
uint8_t
mac_addr
[
6
];
/*
/*
*
Try reading MAC addr stored in flash
*
Read MAC addr from Unique-ID, IC D12, 24AA025E48
*/
*/
if
(
storage_get_persistent_mac
(
0
,
mac_addr
)
==
-
1
)
{
board_dbg
(
"Failed to get MAC address from the flash. Using fallback address.
\n
"
);
i2c_eeprom_read
(
&
wrc_uid_dev
,
UID_OFFSET
,
mac_addr
,
sizeof
(
mac_addr
));
mac_addr
[
0
]
=
0x22
;
board_dbg
(
"MAC addr: %x:%x:%x:%x:%x:%x
\n
"
,
mac_addr
[
0
],
mac_addr
[
1
],
mac_addr
[
2
],
mac_addr
[
3
],
mac_addr
[
4
],
mac_addr
[
5
]);
mac_addr
[
1
]
=
0x33
;
mac_addr
[
2
]
=
0x44
;
/* fallback MAC if get_persistent_mac fails */
mac_addr
[
3
]
=
0x55
;
mac_addr
[
4
]
=
0x66
;
mac_addr
[
5
]
=
0x77
;
}
ep_set_mac_addr
(
&
wrc_endpoint_dev
,
mac_addr
);
ep_set_mac_addr
(
&
wrc_endpoint_dev
,
mac_addr
);
ep_pfilter_init_default
(
&
wrc_endpoint_dev
);
ep_pfilter_init_default
(
&
wrc_endpoint_dev
);
...
...
boards/spec7/board.h
View file @
306e93c2
...
@@ -80,7 +80,9 @@
...
@@ -80,7 +80,9 @@
#define SDB_ADDRESS 0x30000
#define SDB_ADDRESS 0x30000
#define FMC_EEPROM_ADR 0x50
#define EEPROM_ADR 0x50
#define UID_EEPROM_ADR 0x51
#define UID_OFFSET 0xfa
#define SDBFS_REC 5
#define SDBFS_REC 5
...
...
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