Merge pull request #5745 from kjbracey-arm/k64f_init_order

K64F Ethernet: avoid using NULL thread during init
pull/5621/head
Martin Kojtal 2017-12-22 13:26:26 +00:00 committed by GitHub
commit 9cce4d2b06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -140,7 +140,9 @@ static void k64f_tx_reclaim(struct k64f_enetdata *k64f_enet)
*/
void enet_mac_rx_isr()
{
osThreadFlagsSet(k64f_enetdata.thread, FLAG_RX);
if (k64f_enetdata.thread) {
osThreadFlagsSet(k64f_enetdata.thread, FLAG_RX);
}
}
void enet_mac_tx_isr()
@ -756,6 +758,9 @@ err_t eth_arch_enetif_init(struct netif *netif)
/* Worker thread */
k64f_enetdata.thread = sys_thread_new("k64f_emac_thread", emac_thread, netif->state, THREAD_STACKSIZE, THREAD_PRIORITY)->id;
/* Trigger thread to deal with any RX packets that arrived before thread was started */
enet_mac_rx_isr();
return ERR_OK;
}