Extend EMAC multicast APIs

pull/6847/head
Kevin Bracey 2018-01-11 16:41:16 +02:00
parent 5472a9703f
commit a0d374ef00
5 changed files with 70 additions and 6 deletions

View File

@ -155,7 +155,20 @@ public:
*
* @param address A multicast group hardware address
*/
virtual void add_multicast_group(uint8_t *address) = 0;
virtual void add_multicast_group(const uint8_t *address) = 0;
/** Remove device from a multicast group
*
* @param address A multicast group hardware address
*/
virtual void remove_multicast_group(const uint8_t *address) = 0;
/** Request reception of all multicast packets
*
* @param all True to receive all multicasts
* False to receive only multicasts addressed to specified groups
*/
virtual void set_all_multicast(bool all) = 0;
/** Sets memory manager that is used to handle memory buffers
*

View File

@ -569,9 +569,24 @@ void K64F_EMAC::set_link_state_cb(emac_link_state_change_cb_t state_cb)
emac_link_state_cb = state_cb;
}
void K64F_EMAC::add_multicast_group(uint8_t *addr)
void K64F_EMAC::add_multicast_group(const uint8_t *addr)
{
ENET_AddMulticastGroup(ENET, addr);
ENET_AddMulticastGroup(ENET, const_cast<uint8_t *>(addr));
}
void K64F_EMAC::remove_multicast_group(const uint8_t *addr)
{
// ENET HAL doesn't reference count - ENET_LeaveMulticastGroup just maps
// address to filter bit, and clears that bit, even if shared by other
// addresses. So don't attempt anything for now.
}
void K64F_EMAC::set_all_multicast(bool all)
{
if (all) {
ENET->GAUR = 0xFFFFFFFFu;
ENET->GALR = 0xFFFFFFFFu;
}
}
void K64F_EMAC::power_down()

View File

@ -115,7 +115,20 @@ public:
*
* @param address A multicast group hardware address
*/
virtual void add_multicast_group(uint8_t *address);
virtual void add_multicast_group(const uint8_t *address);
/** Remove device from a multicast group
*
* @param address A multicast group hardware address
*/
virtual void remove_multicast_group(const uint8_t *address);
/** Request reception of all multicast packets
*
* @param all True to receive all multicasts
* False to receive only multicasts addressed to specified groups
*/
virtual void set_all_multicast(bool all);
/** Sets memory manager that is used to handle memory buffers
*

View File

@ -519,7 +519,17 @@ void STM32_EMAC::set_link_state_cb(emac_link_state_change_cb_t state_cb)
emac_link_state_cb = state_cb;
}
void STM32_EMAC::add_multicast_group(uint8_t *addr)
void STM32_EMAC::add_multicast_group(const uint8_t *addr)
{
/* No-op at this stage */
}
void STM32_EMAC::remove_multicast_group(const uint8_t *addr)
{
/* No-op at this stage */
}
void STM32_EMAC::set_all_multicast(bool all)
{
/* No-op at this stage */
}

View File

@ -126,7 +126,20 @@ public:
*
* @param address A multicast group hardware address
*/
virtual void add_multicast_group(uint8_t *address);
virtual void add_multicast_group(const uint8_t *address);
/** Remove device from a multicast group
*
* @param address A multicast group hardware address
*/
virtual void remove_multicast_group(const uint8_t *address);
/** Request reception of all multicast packets
*
* @param all True to receive all multicasts
* False to receive only multicasts addressed to specified groups
*/
virtual void set_all_multicast(bool all);
/** Sets memory manager that is used to handle memory buffers
*