@@ -297,7 +297,7 @@ static bool eth_is_ptp_pkt(struct net_if *iface, struct net_pkt *pkt)
297297
298298 return true;
299299}
300- #if defined( CONFIG_ETH_STM32_HAL_API_V2 )
300+
301301void HAL_ETH_TxPtpCallback (uint32_t * buff , ETH_TimeStampTypeDef * timestamp )
302302{
303303 struct eth_stm32_tx_context * ctx = (struct eth_stm32_tx_context * )buff ;
@@ -307,7 +307,6 @@ void HAL_ETH_TxPtpCallback(uint32_t *buff, ETH_TimeStampTypeDef *timestamp)
307307
308308 net_if_add_tx_timestamp (ctx -> pkt );
309309}
310- #endif /* CONFIG_ETH_STM32_HAL_API_V2 */
311310#endif /* CONFIG_PTP_CLOCK_STM32_HAL */
312311
313312static int eth_tx (const struct device * dev , struct net_pkt * pkt )
@@ -359,11 +358,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt)
359358 net_pkt_is_tx_timestamping (pkt );
360359 if (timestamped_frame ) {
361360 /* Enable transmit timestamp */
362- #if defined(CONFIG_ETH_STM32_HAL_API_V2 )
363361 HAL_ETH_PTP_InsertTxTimestamp (heth );
364- #else
365- dma_tx_desc -> Status |= ETH_DMATXDESC_TTSE ;
366- #endif /* CONFIG_ETH_STM32_HAL_API_V2 */
367362 }
368363#endif /* CONFIG_PTP_CLOCK_STM32_HAL */
369364
@@ -484,35 +479,6 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt)
484479 }
485480#endif /* CONFIG_ETH_STM32_HAL_API_V2 */
486481
487- #if defined(CONFIG_PTP_CLOCK_STM32_HAL ) && !defined(CONFIG_ETH_STM32_HAL_API_V2 )
488- if (timestamped_frame ) {
489- /* Retrieve transmission timestamp from last DMA TX descriptor */
490- __IO ETH_DMADescTypeDef * last_dma_tx_desc = dma_tx_desc ;
491-
492- while (!(last_dma_tx_desc -> Status & ETH_DMATXDESC_LS ) &&
493- last_dma_tx_desc -> Buffer2NextDescAddr ) {
494- last_dma_tx_desc =
495- (ETH_DMADescTypeDef * )last_dma_tx_desc -> Buffer2NextDescAddr ;
496- }
497-
498- while (IS_ETH_DMATXDESC_OWN (last_dma_tx_desc ) != (uint32_t )RESET ) {
499- /* Wait for transmission */
500- k_yield ();
501- }
502-
503- if (last_dma_tx_desc -> Status & ETH_DMATXDESC_LS &&
504- last_dma_tx_desc -> Status & ETH_DMATXDESC_TTSS ) {
505- pkt -> timestamp .second = last_dma_tx_desc -> TimeStampHigh ;
506- pkt -> timestamp .nanosecond = last_dma_tx_desc -> TimeStampLow ;
507- } else {
508- /* Invalid value */
509- pkt -> timestamp .second = UINT64_MAX ;
510- pkt -> timestamp .nanosecond = UINT32_MAX ;
511- }
512- net_if_add_tx_timestamp (pkt );
513- }
514- #endif /* CONFIG_PTP_CLOCK_STM32_HAL && !CONFIG_ETH_STM32_HAL_API_V2 */
515-
516482 res = 0 ;
517483error :
518484
@@ -552,9 +518,7 @@ static struct net_pkt *eth_rx(const struct device *dev)
552518#endif /* CONFIG_ETH_STM32_HAL_API_V2 */
553519#if defined(CONFIG_PTP_CLOCK_STM32_HAL )
554520 struct net_ptp_time timestamp ;
555- #if defined(CONFIG_ETH_STM32_HAL_API_V2 )
556521 ETH_TimeStampTypeDef ts_registers ;
557- #endif /* CONFIG_ETH_STM32_HAL_API_V2 */
558522 /* Default to invalid value. */
559523 timestamp .second = UINT64_MAX ;
560524 timestamp .nanosecond = UINT32_MAX ;
@@ -591,22 +555,10 @@ static struct net_pkt *eth_rx(const struct device *dev)
591555#endif /* CONFIG_ETH_STM32_HAL_API_V2 */
592556
593557#if defined(CONFIG_PTP_CLOCK_STM32_HAL )
594- #if defined(CONFIG_ETH_STM32_HAL_API_V2 )
595-
596558 if (HAL_ETH_PTP_GetRxTimestamp (heth , & ts_registers ) == HAL_OK ) {
597559 timestamp .second = ts_registers .TimeStampHigh ;
598560 timestamp .nanosecond = ts_registers .TimeStampLow ;
599561 }
600- #else
601- __IO ETH_DMADescTypeDef * last_dma_rx_desc ;
602-
603- last_dma_rx_desc = heth -> RxFrameInfos .LSRxDesc ;
604- if (last_dma_rx_desc -> TimeStampHigh != UINT32_MAX ||
605- last_dma_rx_desc -> TimeStampLow != UINT32_MAX ) {
606- timestamp .second = last_dma_rx_desc -> TimeStampHigh ;
607- timestamp .nanosecond = last_dma_rx_desc -> TimeStampLow ;
608- }
609- #endif /* CONFIG_ETH_STM32_HAL_API_V2 */
610562#endif /* CONFIG_PTP_CLOCK_STM32_HAL */
611563
612564 pkt = net_pkt_rx_alloc_with_buffer (get_iface (dev_data ),
0 commit comments