最近看MAC控制器手册时,文档上提到休眠模式下MAC能够被 Magic packet唤醒功能。手册中内容如下:
Magic packet detection wakes(唤醒) a node that is put in power-down mode(下电模式) by the node management agent.
Magic packet detection is supported only if the MAC is configured in sleep mode.
1、Sleep mode
To put the MAC in Sleep mode, set ENETn_ECR[SLEEP].
At the same time ENETn_ECR[MAGICEN] should also be set to enable magic packet detection.
In addition, if ENET is enabled, write 1 to ENETn_ECR[SLEEP] before entering into low power mode.
When the MAC is in Sleep mode:
• The transmit logic is disabled.
• The FIFO receive/transmit functions are disabled.
• The receive logic is kept in Normal mode, but it ignores all traffic from the line except magic packets.
They are detected so that a remote agent can wake the node.
2、Magic packet detection
The core is designed to detect magic packets (see Magic packets) with the destination address set to:
• Any multicast address
• The broadcast address
• The unicast address programmed in PADDR1/2
When a magic packet is detected, EIR[WAKEUP] is set and none of the statistic registers are incremented.
3、Wakeup
When a magic packet is detected, indicated by ENETn_EIR[WAKEUP],ENETn_ECR[SLEEP] should be cleared to resume normal operation of the MAC.
Clearing the SLEEP bit automatically masks ENETn_ECR[MAGICEN], disabling magic packet detection.
4、Magic packets
A magic packet is a unicast, multicast, or broadcast packet, which carries a defined sequence in the payload section.
Magic packets are received and inspected only under specific conditions as described in Magic packet detection.
The defined sequence to decode a magic packet is formed with a synchronization stream which consists of
six consecutive 0xFF bytes(6个连续的0XFF字节), and is followed by sequence of sixteen consecutive unicast MAC addresses of the node to be awakened.
This sequence can be located anywhere in the magic packet payload.
The magic packet is formed with a standard Ethernet header, optional padding, and CRC.