2 * Copyright (c) 2013-2016 ARM Limited. All rights reserved.
\r
4 * SPDX-License-Identifier: Apache-2.0
\r
6 * Licensed under the Apache License, Version 2.0 (the License); you may
\r
7 * not use this file except in compliance with the License.
\r
8 * You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software
\r
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
\r
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
15 * See the License for the specific language governing permissions and
\r
16 * limitations under the License.
\r
18 * $Date: 7. Mar 2014
\r
21 * Project: Ethernet PHY (Physical Transceiver) Driver definitions
\r
26 * changed parameter "mode" in function ARM_ETH_PHY_SetMode
\r
27 * Changed prefix ARM_DRV -> ARM_DRIVER
\r
28 * Changed return values of some functions to int32_t
\r
30 * Namespace prefix ARM_ added
\r
35 #ifndef __DRIVER_ETH_PHY_H
\r
36 #define __DRIVER_ETH_PHY_H
\r
38 #include "Driver_ETH.h"
\r
40 #define ARM_ETH_PHY_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2,00) /* API version */
\r
43 #define _ARM_Driver_ETH_PHY_(n) Driver_ETH_PHY##n
\r
44 #define ARM_Driver_ETH_PHY_(n) _ARM_Driver_ETH_PHY_(n)
\r
47 /****** Ethernet PHY Mode *****/
\r
48 #define ARM_ETH_PHY_SPEED_Pos 0
\r
49 #define ARM_ETH_PHY_SPEED_Msk (3UL << ARM_ETH_PHY_SPEED_Pos)
\r
50 #define ARM_ETH_PHY_SPEED_10M (ARM_ETH_SPEED_10M << ARM_ETH_PHY_SPEED_Pos) ///< 10 Mbps link speed
\r
51 #define ARM_ETH_PHY_SPEED_100M (ARM_ETH_SPEED_100M << ARM_ETH_PHY_SPEED_Pos) ///< 100 Mbps link speed
\r
52 #define ARM_ETH_PHY_SPEED_1G (ARM_ETH_SPEED_1G << ARM_ETH_PHY_SPEED_Pos) ///< 1 Gpbs link speed
\r
53 #define ARM_ETH_PHY_DUPLEX_Pos 2
\r
54 #define ARM_ETH_PHY_DUPLEX_Msk (1UL << ARM_ETH_PHY_DUPLEX_Pos)
\r
55 #define ARM_ETH_PHY_DUPLEX_HALF (ARM_ETH_DUPLEX_HALF << ARM_ETH_PHY_DUPLEX_Pos) ///< Half duplex link
\r
56 #define ARM_ETH_PHY_DUPLEX_FULL (ARM_ETH_DUPLEX_FULL << ARM_ETH_PHY_DUPLEX_Pos) ///< Full duplex link
\r
57 #define ARM_ETH_PHY_AUTO_NEGOTIATE (1UL << 3) ///< Auto Negotiation mode
\r
58 #define ARM_ETH_PHY_LOOPBACK (1UL << 4) ///< Loop-back test mode
\r
59 #define ARM_ETH_PHY_ISOLATE (1UL << 5) ///< Isolate PHY from MII/RMII interface
\r
62 // Function documentation
\r
64 \fn ARM_DRIVER_VERSION ARM_ETH_PHY_GetVersion (void)
\r
65 \brief Get driver version.
\r
66 \return \ref ARM_DRIVER_VERSION
\r
69 \fn int32_t ARM_ETH_PHY_Initialize (ARM_ETH_PHY_Read_t fn_read,
\r
70 ARM_ETH_PHY_Write_t fn_write)
\r
71 \brief Initialize Ethernet PHY Device.
\r
72 \param[in] fn_read Pointer to \ref ARM_ETH_MAC_PHY_Read
\r
73 \param[in] fn_write Pointer to \ref ARM_ETH_MAC_PHY_Write
\r
74 \return \ref execution_status
\r
77 \fn int32_t ARM_ETH_PHY_Uninitialize (void)
\r
78 \brief De-initialize Ethernet PHY Device.
\r
79 \return \ref execution_status
\r
82 \fn int32_t ARM_ETH_PHY_PowerControl (ARM_POWER_STATE state)
\r
83 \brief Control Ethernet PHY Device Power.
\r
84 \param[in] state Power state
\r
85 \return \ref execution_status
\r
88 \fn int32_t ARM_ETH_PHY_SetInterface (uint32_t interface)
\r
89 \brief Set Ethernet Media Interface.
\r
90 \param[in] interface Media Interface type
\r
91 \return \ref execution_status
\r
94 \fn int32_t ARM_ETH_PHY_SetMode (uint32_t mode)
\r
95 \brief Set Ethernet PHY Device Operation mode.
\r
96 \param[in] mode Operation Mode
\r
97 \return \ref execution_status
\r
100 \fn ARM_ETH_LINK_STATE ARM_ETH_PHY_GetLinkState (void)
\r
101 \brief Get Ethernet PHY Device Link state.
\r
102 \return current link status \ref ARM_ETH_LINK_STATE
\r
105 \fn ARM_ETH_LINK_INFO ARM_ETH_PHY_GetLinkInfo (void)
\r
106 \brief Get Ethernet PHY Device Link information.
\r
107 \return current link parameters \ref ARM_ETH_LINK_INFO
\r
111 typedef int32_t (*ARM_ETH_PHY_Read_t) (uint8_t phy_addr, uint8_t reg_addr, uint16_t *data); ///< Pointer to \ref ARM_ETH_MAC_PHY_Read : Read Ethernet PHY Register.
\r
112 typedef int32_t (*ARM_ETH_PHY_Write_t) (uint8_t phy_addr, uint8_t reg_addr, uint16_t data); ///< Pointer to \ref ARM_ETH_MAC_PHY_Write : Write Ethernet PHY Register.
\r
116 \brief Access structure of the Ethernet PHY Driver
\r
118 typedef struct _ARM_DRIVER_ETH_PHY {
\r
119 ARM_DRIVER_VERSION (*GetVersion) (void); ///< Pointer to \ref ARM_ETH_PHY_GetVersion : Get driver version.
\r
120 int32_t (*Initialize) (ARM_ETH_PHY_Read_t fn_read,
\r
121 ARM_ETH_PHY_Write_t fn_write); ///< Pointer to \ref ARM_ETH_PHY_Initialize : Initialize PHY Device.
\r
122 int32_t (*Uninitialize) (void); ///< Pointer to \ref ARM_ETH_PHY_Uninitialize : De-initialize PHY Device.
\r
123 int32_t (*PowerControl) (ARM_POWER_STATE state); ///< Pointer to \ref ARM_ETH_PHY_PowerControl : Control PHY Device Power.
\r
124 int32_t (*SetInterface) (uint32_t interface); ///< Pointer to \ref ARM_ETH_PHY_SetInterface : Set Ethernet Media Interface.
\r
125 int32_t (*SetMode) (uint32_t mode); ///< Pointer to \ref ARM_ETH_PHY_SetMode : Set Ethernet PHY Device Operation mode.
\r
126 ARM_ETH_LINK_STATE (*GetLinkState) (void); ///< Pointer to \ref ARM_ETH_PHY_GetLinkState : Get Ethernet PHY Device Link state.
\r
127 ARM_ETH_LINK_INFO (*GetLinkInfo) (void); ///< Pointer to \ref ARM_ETH_PHY_GetLinkInfo : Get Ethernet PHY Device Link information.
\r
128 } const ARM_DRIVER_ETH_PHY;
\r
130 #endif /* __DRIVER_ETH_PHY_H */
\r