README.enetaddr (382bee57f19b4454e2015bc19a010bc2d0ab9337) README.enetaddr (fd1e959e91d2b0b2e853d09dd9167dfff18a616c)
1---------------------------------
2 Ethernet Address (MAC) Handling
3---------------------------------
4
5There are a variety of places in U-Boot where the MAC address is used, parsed,
6and stored. This document covers proper usage of each location and the moving
7of data between them.
8

--- 84 unchanged lines hidden (view full) ---

93to determine address validity.
94uchar enetaddr[6];
95if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
96 /* "ethaddr" is not set in the environment */
97 ... try and setup "ethaddr" in the env ...
98}
99/* enetaddr is now set to the value stored in the ethaddr env var */
100
1---------------------------------
2 Ethernet Address (MAC) Handling
3---------------------------------
4
5There are a variety of places in U-Boot where the MAC address is used, parsed,
6and stored. This document covers proper usage of each location and the moving
7of data between them.
8

--- 84 unchanged lines hidden (view full) ---

93to determine address validity.
94uchar enetaddr[6];
95if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
96 /* "ethaddr" is not set in the environment */
97 ... try and setup "ethaddr" in the env ...
98}
99/* enetaddr is now set to the value stored in the ethaddr env var */
100
101 * int eth_setenv_enetaddr(char *name, const uchar *enetaddr);
101 * int eth_env_set_enetaddr(char *name, const uchar *enetaddr);
102
103Store the MAC address into the named environment variable. The return value is
104the same as the env_set() function.
105uchar enetaddr[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
102
103Store the MAC address into the named environment variable. The return value is
104the same as the env_set() function.
105uchar enetaddr[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
106eth_setenv_enetaddr("ethaddr", enetaddr);
106eth_env_set_enetaddr("ethaddr", enetaddr);
107/* the "ethaddr" env var should now be set to "00:11:22:33:44:55" */
108
109 * the %pM format modifier
110
111The %pM format modifier can be used with any standard printf function to format
112the binary 6 byte array representation of a MAC address.
113uchar enetaddr[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
114printf("The MAC is %pM\n", enetaddr);
115
116char buf[20];
117sprintf(buf, "%pM", enetaddr);
118/* the buf variable is now set to "00:11:22:33:44:55" */
107/* the "ethaddr" env var should now be set to "00:11:22:33:44:55" */
108
109 * the %pM format modifier
110
111The %pM format modifier can be used with any standard printf function to format
112the binary 6 byte array representation of a MAC address.
113uchar enetaddr[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
114printf("The MAC is %pM\n", enetaddr);
115
116char buf[20];
117sprintf(buf, "%pM", enetaddr);
118/* the buf variable is now set to "00:11:22:33:44:55" */