Skip to content

Commit 3320497

Browse files
author
Mika Leppänen
committed
Removed EMAC get default instance from EMAC tests
Test environment now uses the EMAC defined by add ethernet interface.
1 parent 5d357bc commit 3320497

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
@@ -161,7 +161,7 @@ char *EmacTestNetworkStack::Interface::get_gateway(char *buf, nsapi_size_t bufle
161161

162162
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)
163163
{
164-
if (!emac_if_init()) {
164+
if (!emac_if_init(m_emac)) {
165165
TEST_ASSERT_MESSAGE(0, "emac initialization failed!");
166166
}
167167

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)