1 /* SPDX-License-Identifier: GPL-2.0+ */
5 * Supports both Wake-on-LAN packet types:
6 * - EtherType 0x0842 packets
7 * - UDP packets on ports 0, 7 and 9.
9 * Copyright 2018 Lothar Felten, lothar.felten@gmail.com
12 #if defined(CONFIG_CMD_WOL)
19 /**********************************************************************/
21 #define WOL_SYNC_BYTE 0xFF
22 #define WOL_SYNC_COUNT 6
23 #define WOL_MAC_REPETITIONS 16
24 #define WOL_DEFAULT_TIMEOUT 5000
25 #define WOL_PASSWORD_4B 4
26 #define WOL_PASSWORD_6B 6
32 u8 wol_sync[WOL_SYNC_COUNT]; /* sync bytes */
33 u8 wol_dest[WOL_MAC_REPETITIONS * ARP_HLEN]; /* 16x MAC */
34 u8 wol_passwd[0]; /* optional */
38 * Initialize wol (beginning of netloop)
43 * Check incoming Wake-on-LAN packet for:
45 * - sixteen copies of the target MAC address
47 * Optionally store the four or six byte password in the environment
48 * variable "wolpassword"
50 * @param ip IP header in the packet
51 * @param len Packet length
53 void wol_receive(struct ip_udp_hdr *ip, unsigned int len);
56 * Set the timeout for the reception of a Wake-on-LAN packet
58 * @param timeout in milliseconds
60 void wol_set_timeout(ulong timeout);
62 /**********************************************************************/
64 #endif /* __WOL_H__ */