@@ -397,9 +397,10 @@ void eth_init_0(eth_t *self, int eth_id, const phy_operations_t *phy_ops, int ph
397397 enet_config .txAccelerConfig = kENET_TxAccelIpCheckEnabled | kENET_TxAccelProtoCheckEnabled ;
398398 // Set interrupt
399399 enet_config .interrupt |= ENET_TX_INTERRUPT | ENET_RX_INTERRUPT ;
400+ enet_config .callback = eth_irq_handler ;
401+ enet_config .userData = (void * )self ;
400402
401403 ENET_Init (ENET , & g_handle , & enet_config , & buffConfig [0 ], hw_addr , source_clock );
402- ENET_SetCallback (& g_handle , eth_irq_handler , (void * )self );
403404 NVIC_SetPriority (ENET_IRQn , IRQ_PRI_PENDSV );
404405 ENET_EnableInterrupts (ENET , ENET_RX_INTERRUPT );
405406 ENET_ClearInterruptStatus (ENET , ENET_TX_INTERRUPT | ENET_RX_INTERRUPT | ENET_ERR_INTERRUPT );
@@ -461,9 +462,10 @@ void eth_init_1(eth_t *self, int eth_id, const phy_operations_t *phy_ops, int ph
461462 enet_config .txAccelerConfig = kENET_TxAccelIpCheckEnabled | kENET_TxAccelProtoCheckEnabled ;
462463 // Set interrupt
463464 enet_config .interrupt = ENET_TX_INTERRUPT | ENET_RX_INTERRUPT ;
465+ enet_config .callback = eth_irq_handler ;
466+ enet_config .userData = (void * )self ;
464467
465468 ENET_Init (ENET_1 , & g_handle_1 , & enet_config , & buffConfig_1 [0 ], hw_addr_1 , source_clock );
466- ENET_SetCallback (& g_handle_1 , eth_irq_handler , (void * )self );
467469 ENET_ClearInterruptStatus (ENET_1 , ENET_TX_INTERRUPT | ENET_RX_INTERRUPT | ENET_ERR_INTERRUPT );
468470 ENET_EnableInterrupts (ENET_1 , ENET_RX_INTERRUPT );
469471 ENET_ActiveRead (ENET_1 );
0 commit comments