@@ -296,19 +296,27 @@ bool STM32_EMAC::low_level_init_successful()
296
296
EthHandle.Init .RxMode = ETH_RXINTERRUPT_MODE;
297
297
EthHandle.Init .ChecksumMode = ETH_CHECKSUM_BY_SOFTWARE;
298
298
EthHandle.Init .MediaInterface = ETH_MEDIA_INTERFACE_RMII;
299
- HAL_ETH_Init (&EthHandle);
299
+ if (HAL_ETH_Init (&EthHandle) != HAL_OK) {
300
+ return false ;
301
+ }
300
302
301
303
/* Initialize Tx Descriptors list: Chain Mode */
302
- HAL_ETH_DMATxDescListInit (&EthHandle, DMATxDscrTab, &Tx_Buff[0 ][0 ], ETH_TXBUFNB);
304
+ if (HAL_ETH_DMATxDescListInit (&EthHandle, DMATxDscrTab, &Tx_Buff[0 ][0 ], ETH_TXBUFNB) != HAL_OK) {
305
+ return false ;
306
+ }
303
307
304
308
/* Initialize Rx Descriptors list: Chain Mode */
305
- HAL_ETH_DMARxDescListInit (&EthHandle, DMARxDscrTab, &Rx_Buff[0 ][0 ], ETH_RXBUFNB);
309
+ if (HAL_ETH_DMARxDescListInit (&EthHandle, DMARxDscrTab, &Rx_Buff[0 ][0 ], ETH_RXBUFNB) != HAL_OK) {
310
+ return false ;
311
+ }
306
312
307
313
/* Configure MAC */
308
314
_eth_config_mac (&EthHandle);
309
315
310
316
/* Enable MAC and DMA transmission and reception */
311
- HAL_ETH_Start (&EthHandle);
317
+ if (HAL_ETH_Start (&EthHandle) != HAL_OK) {
318
+ return false ;
319
+ }
312
320
313
321
return true ;
314
322
}
@@ -370,7 +378,7 @@ bool STM32_EMAC::low_level_init_successful()
370
378
bool STM32_EMAC::link_out (emac_mem_buf_t *buf)
371
379
#ifndef ETH_IP_VERSION_V2
372
380
{
373
- bool success;
381
+ bool success = true ;
374
382
emac_mem_buf_t *q;
375
383
uint8_t *buffer = reinterpret_cast <uint8_t *>(EthHandle.TxDesc ->Buffer1Addr );
376
384
__IO ETH_DMADescTypeDef *DmaTxDesc;
@@ -424,9 +432,10 @@ bool STM32_EMAC::link_out(emac_mem_buf_t *buf)
424
432
}
425
433
426
434
/* Prepare transmit descriptors to give to DMA */
427
- HAL_ETH_TransmitFrame (&EthHandle, framelength);
435
+ if ( HAL_ETH_TransmitFrame (&EthHandle, framelength) != HAL_OK) {
428
436
429
- success = true ;
437
+ success = false ;
438
+ }
430
439
431
440
error:
432
441
0 commit comments