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
9e5e9f80
Commit
9e5e9f80
authored
Jul 08, 2020
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup get/set_persistent_mac calls
parent
23486d8a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
6 deletions
+9
-6
board.c
boards/generic/board.c
+1
-1
board.c
boards/sis8300ku/board.c
+1
-1
storage.c
dev/storage.c
+2
-2
storage.h
include/storage.h
+2
-0
cmd_mac.c
shell/cmd_mac.c
+3
-2
No files found.
boards/generic/board.c
View file @
9e5e9f80
...
...
@@ -47,7 +47,7 @@ int wrc_board_early_init()
/*
* Try reading MAC addr stored in flash
*/
if
(
get_persistent_mac
(
0
,
mac_addr
)
==
-
1
)
{
if
(
storage_get_persistent_mac
(
mac_addr
)
==
-
1
)
{
board_dbg
(
"Failed to get MAC address from the flash. Using fallback address.
\n
"
);
mac_addr
[
0
]
=
0x22
;
mac_addr
[
1
]
=
0x33
;
...
...
boards/sis8300ku/board.c
View file @
9e5e9f80
...
...
@@ -61,7 +61,7 @@ int wrc_board_early_init()
// fixme: read MAC address from the MMC
uint8_t
mac
[
6
];
get_persistent_mac
(
0
,
mac
);
storage_get_persistent_mac
(
mac
);
board_dbg
(
"Board MAC Address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
mac
[
0
],
mac
[
1
],
mac
[
2
],
mac
[
3
],
mac
[
4
],
mac
[
5
]);
...
...
dev/storage.c
View file @
9e5e9f80
...
...
@@ -818,7 +818,7 @@ int storage_phtrans(uint32_t *valp, uint8_t write)
/* MAC Address Storage */
int
get_persistent_mac
(
uint8_t
portnum
,
uint8_t
*
mac
)
int
storage_get_persistent_mac
(
uint8_t
*
mac
)
{
int
ret
=
0
;
int
i
;
...
...
@@ -875,7 +875,7 @@ int get_persistent_mac(uint8_t portnum, uint8_t *mac)
return
0
;
}
int
s
et_persistent_mac
(
uint8_t
portnum
,
uint8_t
*
mac
)
int
s
torage_set_persistent_mac
(
uint8_t
*
mac
)
{
int
ret
;
...
...
include/storage.h
View file @
9e5e9f80
...
...
@@ -140,6 +140,8 @@ int storage_save_calibration(void);
int
storage_read_hdl_cfg
(
void
);
int
storage_mount
(
struct
storage_device
*
dev
);
int
storage_get_persistent_mac
(
uint8_t
*
mac
);
int
storage_set_persistent_mac
(
uint8_t
*
mac
);
#endif
shell/cmd_mac.c
View file @
9e5e9f80
...
...
@@ -14,6 +14,7 @@
#include "softpll_ng.h"
#include "shell.h"
#include "storage.h"
#include "dev/onewire.h"
#include "dev/endpoint.h"
...
...
@@ -49,14 +50,14 @@ static int cmd_mac(const char *args[])
}
else
if
(
!
strcasecmp
(
args
[
0
],
"getp"
))
{
/* get persistent MAC */
ep_get_mac_addr
(
mac
);
get_persistent_mac
(
ONEWIRE_PORT
,
mac
);
storage_get_persistent_mac
(
mac
);
}
else
if
(
!
strcasecmp
(
args
[
0
],
"set"
)
&&
args
[
1
])
{
decode_mac
(
args
[
1
],
mac
);
ep_set_mac_addr
(
mac
);
pfilter_init_default
();
}
else
if
(
!
strcasecmp
(
args
[
0
],
"setp"
)
&&
args
[
1
])
{
decode_mac
(
args
[
1
],
mac
);
s
et_persistent_mac
(
ONEWIRE_PORT
,
mac
);
s
torage_set_persistent_mac
(
mac
);
}
else
{
return
-
EINVAL
;
}
...
...
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