Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
contiki-ng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
NATAF Emmanuel
contiki-ng
Commits
eeb25b96
Commit
eeb25b96
authored
13 years ago
by
Adam Dunkels
Browse files
Options
Downloads
Patches
Plain Diff
If no MAC is defined, create one from the node ID
parent
3fa14d3c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
platform/z1/contiki-z1-main.c
+28
-13
28 additions, 13 deletions
platform/z1/contiki-z1-main.c
with
28 additions
and
13 deletions
platform/z1/contiki-z1-main.c
+
28
−
13
View file @
eeb25b96
...
@@ -214,7 +214,6 @@ main(int argc, char **argv)
...
@@ -214,7 +214,6 @@ main(int argc, char **argv)
slip_arch_init
(
BAUD2UBR
(
115200
));
slip_arch_init
(
BAUD2UBR
(
115200
));
#endif
/* WITH_UIP */
#endif
/* WITH_UIP */
xmem_init
();
xmem_init
();
rtimer_init
();
rtimer_init
();
...
@@ -225,31 +224,47 @@ main(int argc, char **argv)
...
@@ -225,31 +224,47 @@ main(int argc, char **argv)
/* Restore node id if such has been stored in external mem */
/* Restore node id if such has been stored in external mem */
node_id_restore
();
node_id_restore
();
/* If no MAC address was burned, we use the node ID. */
if
(
node_mac
[
0
]
|
node_mac
[
1
]
|
node_mac
[
2
]
|
node_mac
[
3
]
|
node_mac
[
4
]
|
node_mac
[
5
]
|
node_mac
[
6
]
|
node_mac
[
7
])
{
node_mac
[
0
]
=
0xc1
;
/* Hardcoded for Z1 */
node_mac
[
1
]
=
0x0c
;
/* Hardcoded for Revision C */
node_mac
[
2
]
=
0x00
;
/* Hardcoded to arbitrary even number so that
the 802.15.4 MAC address is compatible with
an Ethernet MAC address - byte 0 (byte 2 in
the DS ID) */
node_mac
[
3
]
=
0x00
;
/* Hardcoded */
node_mac
[
4
]
=
0x00
;
/* Hardcoded */
node_mac
[
5
]
=
0x00
;
/* Hardcoded */
node_mac
[
6
]
=
node_id
>>
8
;
node_mac
[
7
]
=
node_id
&
0xff
;
}
/* Overwrite node MAC if desired at compile time */
/* Overwrite node MAC if desired at compile time */
#ifdef MACID
#ifdef MACID
#warning "***** CHANGING DEFAULT MAC *****"
#warning "***** CHANGING DEFAULT MAC *****"
node_mac
[
0
]
=
0xC1
;
// Hardcoded for Z1
node_mac
[
0
]
=
0xc1
;
/* Hardcoded for Z1 */
node_mac
[
1
]
=
0x0C
;
// Hardcoded for Revision C
node_mac
[
1
]
=
0x0c
;
/* Hardcoded for Revision C */
node_mac
[
2
]
=
0x00
;
// Hardcoded to arbitrary even number so that the 802.15.4 MAC address
node_mac
[
2
]
=
0x00
;
/* Hardcoded to arbitrary even number so that
// is compatible with an Ethernet MAC address - byte 0 (byte 2 in the DS ID)
the 802.15.4 MAC address is compatible with
node_mac
[
3
]
=
0x00
;
// Hardcoded
an Ethernet MAC address - byte 0 (byte 2 in
node_mac
[
4
]
=
0x00
;
// Hardcoded
the DS ID) */
node_mac
[
5
]
=
0x00
;
// Hardcoded
node_mac
[
3
]
=
0x00
;
/* Hardcoded */
node_mac
[
4
]
=
0x00
;
/* Hardcoded */
node_mac
[
5
]
=
0x00
;
/* Hardcoded */
node_mac
[
6
]
=
MACID
>>
8
;
node_mac
[
6
]
=
MACID
>>
8
;
node_mac
[
7
]
=
MACID
&
0xff
;
node_mac
[
7
]
=
MACID
&
0xff
;
#endif
#endif
/* for setting "hardcoded" IEEE 802.15.4 MAC addresses */
#ifdef IEEE_802154_MAC_ADDRESS
#ifdef IEEE_802154_MAC_ADDRESS
/* for setting "hardcoded" IEEE 802.15.4 MAC addresses */
{
{
uint8_t
ieee
[]
=
IEEE_802154_MAC_ADDRESS
;
uint8_t
ieee
[]
=
IEEE_802154_MAC_ADDRESS
;
memcpy
(
node_mac
,
ieee
,
sizeof
(
uip_lladdr
.
addr
));
memcpy
(
node_mac
,
ieee
,
sizeof
(
uip_lladdr
.
addr
));
node_mac
[
7
]
=
node_id
&
0xff
;
node_mac
[
7
]
=
node_id
&
0xff
;
}
}
#endif
#endif
/* IEEE_802154_MAC_ADDRESS */
/*
/*
* Initialize Contiki and our processes.
* Initialize Contiki and our processes.
*/
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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