Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software for White Rabbit PTP Core
Manage
Activity
Members
Labels
Plan
Issues
39
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Software for White Rabbit PTP Core
Commits
15d4441d
Commit
15d4441d
authored
13 years ago
by
Grzegorz Daniluk
Browse files
Options
Downloads
Patches
Plain Diff
MAC generation based on DS18B20
parent
3a6291c1
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wrc_main.c
+19
-11
19 additions, 11 deletions
wrc_main.c
with
19 additions
and
11 deletions
wrc_main.c
+
19
−
11
View file @
15d4441d
...
...
@@ -10,6 +10,7 @@
#include
"pps_gen.h"
#include
"ptpd.h"
#include
"ptpd_netif.h"
#include
"onewire.h"
...
...
@@ -150,8 +151,7 @@ void rx_test()
void
wrc_initialize
()
{
int
ret
;
uint32_t
dna_lo
,
dna_hi
;
uint8_t
mac_addr
[
6
];
uint8_t
mac_addr
[
6
],
ds18_id
[
8
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
uart_init
();
...
...
@@ -159,15 +159,23 @@ void wrc_initialize()
__DATE__
" "
__TIME__
")
\n
"
);
mprintf
(
"wr_core: starting up (press G to launch the GUI and D for extra debug messages)....
\n
"
);
dna_read
(
&
dna_lo
,
&
dna_hi
);
mac_addr
[
0
]
=
0
;
mac_addr
[
1
]
=
0x50
;
mac_addr
[
2
]
=
(
dna_lo
>>
24
)
&
0xff
;
mac_addr
[
3
]
=
(
dna_lo
>>
16
)
&
0xff
;
mac_addr
[
4
]
=
(
dna_lo
>>
8
)
&
0xff
;
mac_addr
[
5
]
=
(
dna_lo
>>
0
)
&
0xff
;
//Generate MAC address
ow_init
();
if
(
ds18x_read_serial
(
ds18_id
)
==
0
)
mprintf
(
"Found DS18xx sensor: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
ds18_id
[
7
],
ds18_id
[
6
],
ds18_id
[
5
],
ds18_id
[
4
],
ds18_id
[
3
],
ds18_id
[
2
],
ds18_id
[
1
],
ds18_id
[
0
]);
else
mprintf
(
"DS18B20 not found
\n
"
);
mac_addr
[
0
]
=
0x08
;
//
mac_addr
[
1
]
=
0x00
;
// CERN OUI
mac_addr
[
2
]
=
0x30
;
//
mac_addr
[
3
]
=
ds18_id
[
3
];
// www.maxim-ic.com
mac_addr
[
4
]
=
ds18_id
[
2
];
// APPLICATION NOTE 186
mac_addr
[
5
]
=
ds18_id
[
1
];
// Creating Global Identifiers Using 1-Wire® Devices
mprintf
(
"wr_core: local MAC address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
mac_addr
[
0
],
mac_addr
[
1
],
mac_addr
[
2
],
mac_addr
[
3
],
mac_addr
[
4
],
mac_addr
[
5
]);
ep_init
(
mac_addr
);
ep_enable
(
1
,
1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment