mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-16 03:15:56 +00:00
This is a zero-copy networking implementation of Ethernet driver. Limitations: - one shot PHY setup, no support for PHY disconnect/reconnect - no support for devices with DCache enabled due to missing non-cacheable RAM regions in Zephyr. Tested on Atmel SMART SAM E70 Xplained board Origin: Original Jira: ZEP-1492 Change-Id: Ib944f91193efbd12c1142b0bcf1f635388bf1b87 Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
61 lines
1.2 KiB
C
61 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2016 Piotr Mienkowski
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/** @file
|
|
* @brief Atmel SAM MCU family Ethernet PHY (GMAC) driver.
|
|
*/
|
|
|
|
#ifndef _PHY_SAM_GMAC_H_
|
|
#define _PHY_SAM_GMAC_H_
|
|
|
|
#include <stdint.h>
|
|
#include <soc.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define PHY_DUPLEX_FULL GMAC_NCFGR_FD
|
|
#define PHY_DUPLEX_HALF 0
|
|
#define PHY_SPEED_100M GMAC_NCFGR_SPD
|
|
#define PHY_SPEED_10M 0
|
|
|
|
struct phy_sam_gmac_dev {
|
|
Gmac *regs;
|
|
uint8_t address;
|
|
};
|
|
|
|
/**
|
|
* @brief Initialize Ethernet PHY device.
|
|
*
|
|
* @param phy PHY instance
|
|
* @return 0 on success or a negative error value on failure
|
|
*/
|
|
int phy_sam_gmac_init(const struct phy_sam_gmac_dev *phy);
|
|
|
|
/**
|
|
* @brief Auto-negotiate and configure link parameters.
|
|
*
|
|
* @param phy PHY instance
|
|
* @param status link parameters common to remote and local PHY
|
|
* @return 0 on success or a negative error value on failure
|
|
*/
|
|
int phy_sam_gmac_auto_negotiate(const struct phy_sam_gmac_dev *phy,
|
|
uint32_t *status);
|
|
|
|
/**
|
|
* @brief Get PHY ID value.
|
|
*
|
|
* @param phy PHY instance
|
|
* @return PHY ID value or 0xFFFFFFFF on failure
|
|
*/
|
|
uint32_t phy_sam_gmac_id_get(const struct phy_sam_gmac_dev *phy);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _PHY_SAM_GMAC_H_ */
|