Skip to content

Commit 5d357bc

Browse files
author
Mika Leppänen
committed
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.
1 parent 38e28dc commit 5d357bc

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

TESTS/network/emac/emac_TestNetworkStack.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ nsapi_error_t EmacTestNetworkStack::add_ethernet_interface(EMAC &emac, bool defa
114114

115115
m_interface->m_emac = &emac;
116116

117+
EmacTestMemoryManager *memory_manager = &EmacTestMemoryManager::get_instance();
118+
emac.set_memory_manager(*memory_manager);
119+
117120
*interface_out = m_interface;
118121

119122
return NSAPI_ERROR_OK;

TESTS/network/emac/emac_test_initialize.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ EmacTestMemoryManager *emac_m_mngr_get(void)
115115
bool emac_if_init(void)
116116
{
117117
static EMAC *emac = &EMAC::get_default_instance();
118-
static EmacTestMemoryManager *memory_manager = &EmacTestMemoryManager::get_instance();
119-
emac->set_memory_manager(*memory_manager);
120118

121119
emac->set_link_input_cb(emac_if_link_input_cb);
122120
emac->set_link_state_cb(emac_if_link_state_change_cb);

features/netsocket/OnboardNetworkStack.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ class OnboardNetworkStack : public NetworkStack {
124124
/** Register a network interface with the IP stack
125125
*
126126
* Connects EMAC layer with the IP stack and initializes all the required infrastructure.
127-
* This function should be called only once for each available interface.
127+
* This function should be called only once for each available interface. EMAC memory
128+
* manager is available to EMAC after this function call.
128129
*
129130
* @param emac EMAC HAL implementation for this network interface
130131
* @param default_if true if the interface should be treated as the default one

0 commit comments

Comments
 (0)