LCOV - code coverage report
Current view: top level - zephyr/drivers/ethernet - eth_adin2111.h Coverage Total Hit
Test: new.info Lines: 90.0 % 10 9
Test Date: 2025-09-05 20:47:19

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2023 PHOENIX CONTACT Electronics GmbH
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : #ifndef ZEPHYR_INCLUDE_DRIVERS_ETH_ADIN2111_H__
       8              : #define ZEPHYR_INCLUDE_DRIVERS_ETH_ADIN2111_H__
       9              : 
      10              : #include <stdint.h>
      11              : #include <zephyr/kernel.h>
      12              : #include <zephyr/device.h>
      13              : 
      14              : #ifdef __cplusplus
      15              : extern "C" {
      16              : #endif
      17              : 
      18              : /**
      19              :  * @brief Locks device access
      20              :  *
      21              :  * @param[in] dev ADIN2111 device.
      22              :  * @param timeout Waiting period to lock the device,
      23              :  *                or one of the special values K_NO_WAIT and
      24              :  *                K_FOREVER.
      25              :  *
      26              :  * @retval 0 Device locked.
      27              :  * @retval -EBUSY Returned without waiting.
      28              :  * @retval -EAGAIN Waiting period timed out.
      29              :  */
      30            1 : int eth_adin2111_lock(const struct device *dev, k_timeout_t timeout);
      31              : 
      32              : /**
      33              :  * @brief Unlocks device access
      34              :  *
      35              :  * @param[in] dev ADIN2111 device.
      36              :  *
      37              :  * @retval 0 Device unlocked.
      38              :  * @retval -EPERM The current thread does not own the device lock.
      39              :  * @retval -EINVAL The device is not locked.
      40              :  */
      41            1 : int eth_adin2111_unlock(const struct device *dev);
      42              : 
      43              : /**
      44              :  * @brief Writes host MAC interface register over SPI
      45              :  *
      46              :  * @note Shall not be called from ISR.
      47              :  *
      48              :  * @param[in] dev ADIN2111 device.
      49              :  * @param reg Register address.
      50              :  * @param val Value to write.
      51              :  *
      52              :  * @retval 0 Successful write.
      53              :  * @retval <0 Error, a negative errno code.
      54              :  */
      55            1 : int eth_adin2111_reg_write(const struct device *dev, const uint16_t reg, uint32_t val);
      56              : 
      57              : /**
      58              :  * @brief Reads host MAC interface register over SPI
      59              :  *
      60              :  * @note Shall not be called from ISR.
      61              :  *
      62              :  * @param[in] dev ADIN2111 device.
      63              :  * @param reg Register address.
      64              :  * @param[out] val Read value output.
      65              :  *
      66              :  * @retval 0 Successful write.
      67              :  * @retval <0 Error, a negative errno code.
      68              :  */
      69            1 : int eth_adin2111_reg_read(const struct device *dev, const uint16_t reg, uint32_t *val);
      70              : 
      71              : /**
      72              :  * @brief Update host MAC interface register over SPI
      73              :  *
      74              :  * @note Shall not be called from ISR.
      75              :  *
      76              :  * @param[in] dev ADIN2111 device.
      77              :  * @param reg Register address.
      78              :  * @param mask Bitmask for bits that may be modified.
      79              :  * @param data Data to apply in the masked range.
      80              :  *
      81              :  * @retval 0 Successful write.
      82              :  * @retval <0 Error, a negative errno code.
      83              :  */
      84            1 : int eth_adin2111_reg_update(const struct device *dev, const uint16_t reg,
      85              :                             uint32_t mask, uint32_t data);
      86              : 
      87              : /**
      88              :  * @brief Reset both the MAC and PHY.
      89              :  *
      90              :  * @param[in] dev ADIN2111 device.
      91              :  * @param delay Delay in milliseconds.
      92              :  *
      93              :  * @note The caller is responsible for device lock.
      94              :  *       Shall not be called from ISR.
      95              :  *
      96              :  * @retval 0 Successful write.
      97              :  * @retval <0 Error, a negative errno code.
      98              :  */
      99            1 : int eth_adin2111_sw_reset(const struct device *dev, uint16_t delay);
     100              : 
     101              : /**
     102              :  * @brief Reset the MAC device. Note that PHY 1 must be out of software power-down for the MAC
     103              :  *        subsystem reset to take effect.
     104              :  *
     105              :  * @note The caller is responsible for device lock.
     106              :  *       Shall not be called from ISR.
     107              :  *
     108              :  * @param[in] dev ADIN2111 device.
     109              :  *
     110              :  * @retval 0 Successful write.
     111              :  * @retval <0 Error, a negative errno code.
     112              :  */
     113            1 : int eth_adin2111_mac_reset(const struct device *dev);
     114              : 
     115              : /**
     116              :  * @brief Enable/disable the forwarding (to host) of broadcast frames. Frames who's DA
     117              :  *        doesn't match are dropped.
     118              :  *
     119              :  * @note The caller is responsible for device lock.
     120              :  *       Shall not be called from ISR.
     121              :  *
     122              :  * @param[in] dev ADIN2111 device.
     123              :  * @param enable Set to 0 to disable and to nonzero to enable.
     124              :  *
     125              :  * @retval 0 Successful write.
     126              :  * @retval <0 Error, a negative errno code.
     127              :  */
     128            1 : int eth_adin2111_broadcast_filter(const struct device *dev, bool enable);
     129              : 
     130              : /**
     131              :  * @brief Get the port-related net_if reference.
     132              :  *
     133              :  * @param[in] dev ADIN2111 device.
     134              :  * @param port_idx Port index.
     135              :  *
     136              :  * @retval a struct net_if pointer, or NULL on error.
     137              :  */
     138            1 : struct net_if *eth_adin2111_get_iface(const struct device *dev, const uint16_t port_idx);
     139              : 
     140              : #ifdef __cplusplus
     141              : }
     142              : #endif
     143              : 
     144              : #endif /* ZEPHYR_INCLUDE_DRIVERS_ETH_ADIN2111_H__ */
        

Generated by: LCOV version 2.0-1