Added memory manager set to add_ethernet_interface() of test stack

This allows that EMAC memory manager can be used to allocate EMAC driver
memory already after the add_ethernet_interface() call.
pull/6847/head
Mika Leppänen 2018-05-17 11:53:15 +03:00 committed by Kevin Bracey
parent 31b8f73de7
commit e481c5ef75
3 changed files with 5 additions and 3 deletions

View File

@ -114,6 +114,9 @@ nsapi_error_t EmacTestNetworkStack::add_ethernet_interface(EMAC &emac, bool defa
m_interface->m_emac = &emac;
EmacTestMemoryManager *memory_manager = &EmacTestMemoryManager::get_instance();
emac.set_memory_manager(*memory_manager);
*interface_out = m_interface;
return NSAPI_ERROR_OK;

View File

@ -115,8 +115,6 @@ EmacTestMemoryManager *emac_m_mngr_get(void)
bool emac_if_init(void)
{
static EMAC *emac = &EMAC::get_default_instance();
static EmacTestMemoryManager *memory_manager = &EmacTestMemoryManager::get_instance();
emac->set_memory_manager(*memory_manager);
emac->set_link_input_cb(emac_if_link_input_cb);
emac->set_link_state_cb(emac_if_link_state_change_cb);

View File

@ -124,7 +124,8 @@ public:
/** Register a network interface with the IP stack
*
* Connects EMAC layer with the IP stack and initializes all the required infrastructure.
* This function should be called only once for each available interface.
* This function should be called only once for each available interface. EMAC memory
* manager is available to EMAC after this function call.
*
* @param emac EMAC HAL implementation for this network interface
* @param default_if true if the interface should be treated as the default one