Skip to content

Commit fd2c6ba

Browse files
Mika Leppänenkjbracey
authored andcommitted
Removed EMAC get default instance from EMAC tests
Test environment now uses the EMAC defined by add ethernet interface.
1 parent fc0ce8c commit fd2c6ba

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

TESTS/network/emac/emac_TestNetworkStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ char *EmacTestNetworkStack::Interface::get_gateway(char *buf, nsapi_size_t bufle
163163

164164
nsapi_error_t EmacTestNetworkStack::Interface::bringup(bool dhcp, const char *ip, const char *netmask, const char *gw, const nsapi_ip_stack_t stack, bool blocking)
165165
{
166-
if (!emac_if_init()) {
166+
if (!emac_if_init(m_emac)) {
167167
TEST_ASSERT_MESSAGE(0, "emac initialization failed!");
168168
}
169169

TESTS/network/emac/emac_initialize.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define EMAC_INITIALIZE_H
2020

2121
unsigned char *emac_if_get_hw_addr(void);
22-
bool emac_if_init(void);
22+
bool emac_if_init(EMAC *emac);
2323
EMAC *emac_if_get(void);
2424
EmacTestMemoryManager *emac_m_mngr_get(void);
2525

TESTS/network/emac/emac_test_initialize.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
using namespace utest::v1;
4949

5050
static unsigned char eth_mac_addr[ETH_MAC_ADDR_LEN];
51+
EMAC *emac_handle = NULL;
5152

5253
void test_emac_initialize()
5354
{
@@ -104,17 +105,17 @@ unsigned char *emac_if_get_hw_addr(void)
104105

105106
EMAC *emac_if_get(void)
106107
{
107-
return &EMAC::get_default_instance();
108+
return emac_handle;
108109
}
109110

110111
EmacTestMemoryManager *emac_m_mngr_get(void)
111112
{
112113
return &EmacTestMemoryManager::get_instance();
113114
}
114115

115-
bool emac_if_init(void)
116+
bool emac_if_init(EMAC *emac)
116117
{
117-
static EMAC *emac = &EMAC::get_default_instance();
118+
emac_handle = emac;
118119

119120
emac->set_link_input_cb(emac_if_link_input_cb);
120121
emac->set_link_state_cb(emac_if_link_state_change_cb);

0 commit comments

Comments
 (0)