Skip to content

Commit 9cce4d2

Browse files
authored
Merge pull request #5745 from kjbracey-arm/k64f_init_order
K64F Ethernet: avoid using NULL thread during init
2 parents dd5bd73 + 9daf450 commit 9cce4d2

File tree

1 file changed

+6
-1
lines changed
  • features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale

1 file changed

+6
-1
lines changed

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ static void k64f_tx_reclaim(struct k64f_enetdata *k64f_enet)
140140
*/
141141
void enet_mac_rx_isr()
142142
{
143-
osThreadFlagsSet(k64f_enetdata.thread, FLAG_RX);
143+
if (k64f_enetdata.thread) {
144+
osThreadFlagsSet(k64f_enetdata.thread, FLAG_RX);
145+
}
144146
}
145147

146148
void enet_mac_tx_isr()
@@ -756,6 +758,9 @@ err_t eth_arch_enetif_init(struct netif *netif)
756758
/* Worker thread */
757759
k64f_enetdata.thread = sys_thread_new("k64f_emac_thread", emac_thread, netif->state, THREAD_STACKSIZE, THREAD_PRIORITY)->id;
758760

761+
/* Trigger thread to deal with any RX packets that arrived before thread was started */
762+
enet_mac_rx_isr();
763+
759764
return ERR_OK;
760765
}
761766

0 commit comments

Comments
 (0)