@@ -88,7 +88,7 @@ void EMACPhy::emac_phy_rx(emac_mem_buf_t *mem)
88
88
}
89
89
}
90
90
91
- if (ptr) {
91
+ if (ptr && phy. phy_rx_cb ) {
92
92
phy.phy_rx_cb (ptr, total_len, 0xff , 0 , device_id);
93
93
}
94
94
ns_dyn_mem_free (tmpbuf);
@@ -125,6 +125,18 @@ int8_t EMACPhy::phy_register()
125
125
{
126
126
if (device_id < 0 ) {
127
127
128
+ phy.PHY_MAC = mac_addr;
129
+ phy.address_write = emac_phy_address_write;
130
+ phy.driver_description = const_cast <char *>(" ETH" );
131
+ phy.link_type = PHY_LINK_ETHERNET_TYPE;
132
+ phy.phy_MTU = 0 ;
133
+ phy.phy_header_length = 0 ;
134
+ phy.phy_tail_length = 0 ;
135
+ phy.state_control = emac_phy_interface_state_control;
136
+ phy.tx = emac_phy_tx;
137
+ phy.phy_rx_cb = NULL ;
138
+ phy.phy_tx_done_cb = NULL ;
139
+
128
140
emac.set_memory_manager (memory_manager);
129
141
emac.set_link_input_cb (callback (this , &EMACPhy::emac_phy_rx));
130
142
@@ -141,17 +153,6 @@ int8_t EMACPhy::phy_register()
141
153
142
154
emac.set_all_multicast (true );
143
155
144
- phy.PHY_MAC = mac_addr;
145
- phy.address_write = emac_phy_address_write;
146
- phy.driver_description = const_cast <char *>(" ETH" );
147
- phy.link_type = PHY_LINK_ETHERNET_TYPE;
148
- phy.phy_MTU = 0 ;
149
- phy.phy_header_length = 0 ;
150
- phy.phy_tail_length = 0 ;
151
- phy.state_control = emac_phy_interface_state_control;
152
- phy.tx = emac_phy_tx;
153
- phy.phy_rx_cb = NULL ;
154
- phy.phy_tx_done_cb = NULL ;
155
156
device_id = arm_net_phy_register (&phy);
156
157
// driver_readiness_status_callback = driver_status_cb;
157
158
0 commit comments