2 * Copyright (c) 2013-2016 ARM Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #include "Driver_ETH_PHY.h"
21 #define ARM_ETH_PHY_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */
24 static const ARM_DRIVER_VERSION DriverVersion = {
25 ARM_ETH_PHY_API_VERSION,
26 ARM_ETH_PHY_DRV_VERSION
33 ARM_DRIVER_VERSION ARM_ETH_PHY_GetVersion(void)
37 int32_t ARM_ETH_PHY_Initialize(ARM_ETH_PHY_Read_t fn_read, ARM_ETH_PHY_Write_t fn_write)
41 int32_t ARM_ETH_PHY_Uninitialize(void)
45 int32_t ARM_ETH_PHY_PowerControl(ARM_POWER_STATE state)
59 return ARM_DRIVER_ERROR_UNSUPPORTED;
63 int32_t ARM_ETH_PHY_SetInterface(uint32_t interface)
67 case ARM_ETH_INTERFACE_MII:
69 case ARM_ETH_INTERFACE_RMII:
72 return ARM_DRIVER_ERROR_UNSUPPORTED;
76 int32_t ARM_ETH_PHY_SetMode(uint32_t mode)
78 switch (mode & ARM_ETH_PHY_SPEED_Msk)
80 case ARM_ETH_PHY_SPEED_10M:
82 case ARM_ETH_PHY_SPEED_100M:
85 return ARM_DRIVER_ERROR_UNSUPPORTED;
88 switch (mode & ARM_ETH_PHY_DUPLEX_Msk)
90 case ARM_ETH_PHY_DUPLEX_HALF:
92 case ARM_ETH_PHY_DUPLEX_FULL:
96 if (mode & ARM_ETH_PHY_AUTO_NEGOTIATE)
100 if (mode & ARM_ETH_PHY_LOOPBACK)
104 if (mode & ARM_ETH_PHY_ISOLATE)
109 ARM_ETH_LINK_STATE ARM_ETH_PHY_GetLinkState(void)
113 ARM_ETH_LINK_INFO ARM_ETH_PHY_GetLinkInfo(void)
117 ARM_DRIVER_ETH_PHY ARM_Driver_ETH_PHY_(ETH_PHY_NUM) =
119 ARM_ETH_PHY_GetVersion,
120 ARM_ETH_PHY_Initialize,
121 ARM_ETH_PHY_Uninitialize,
122 ARM_ETH_PHY_PowerControl,
123 ARM_ETH_PHY_SetInterface,
125 ARM_ETH_PHY_GetLinkState,
126 ARM_ETH_PHY_GetLinkInfo,