From db50beb71ad5b535a797c5b3411b3914e7580d7d Mon Sep 17 00:00:00 2001 From: Epagris Date: Wed, 19 Jun 2024 16:55:51 +0200 Subject: [PATCH] - EthIntf: checking line status on enabling an interface added - IODef: llTrigLinkChg added --- eth_interface.c | 5 ++++- eth_interface.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/eth_interface.c b/eth_interface.c index 33e48f0..c3b84b3 100644 --- a/eth_interface.c +++ b/eth_interface.c @@ -212,7 +212,10 @@ bool ethinf_get_link_state(EthInterface *intf) { void ethinf_up(EthInterface *intf) { intf->up = true; - // TODO: check PHY link state + // trigger a link change interrupt to query link state + if (intf->ioDef->llTrigLinkChg != NULL) { + intf->ioDef->llTrigLinkChg(intf->ioDef); + } } void ethinf_down(EthInterface *intf) { diff --git a/eth_interface.h b/eth_interface.h index dec04d0..cf07233 100644 --- a/eth_interface.h +++ b/eth_interface.h @@ -22,6 +22,7 @@ typedef struct EthIODef_ { int (*llTxTrigger)(struct EthIODef_ *io, MsgQueue *mq); ///< Function pointer to low-level transmit function trigger int (*llTxDone)(struct EthIODef_ *io, const RawPckt *rawPckt); ///< Transmission done (interrupt) callback int (*llLinkChg)(struct EthIODef_ *io, int linkState, uint16_t speed, bool duplex); ///< Link change interrupt + int (*llTrigLinkChg)(struct EthIODef_ *io); ///< Trigger a link change interrupt callback int (*llRxStore)(struct EthIODef_ *io, const RawPckt *rawPckt); ///< Receive done callback int (*llError)(struct EthIODef_ *io, int error); ///< Low-level error interrupt int (*llRxRead)(struct EthIODef_ *io); ///< Read received packets