Choco OS  V.0.16.9.0
Join to the chocolate world
oc_eth_phy.h
Go to the documentation of this file.
1 
27 #ifndef SYSTEM_CORE_INC_DRIVERS_ETH_OC_ETH_PHY_H_
28 #define SYSTEM_CORE_INC_DRIVERS_ETH_OC_ETH_PHY_H_
29 
30 #include <oc_eth.h>
31 
32 #ifdef oC_ETH_LLD_AVAILABLE
33 
39 #define _________________________________________DEFINITIONS_SECTION________________________________________________________________________
40 
41 
42 #undef _________________________________________DEFINITIONS_SECTION________________________________________________________________________
43 
49 #define _________________________________________TYPES_SECTION______________________________________________________________________________
50 
51 //==========================================================================================================================================
57 //==========================================================================================================================================
58 typedef enum
59 {
62 
65 
68 
69 //==========================================================================================================================================
76 //==========================================================================================================================================
77 typedef union
78 {
79 #if defined(LITTLE_ENDIAN)
80  struct
81  {
82  uint32_t Reserved0_7:8;
83  uint32_t DuplexMode:1;
84  uint32_t RestartAutonegotiate:1;
85  uint32_t Isolate:1;
86  uint32_t PowerDown:1;
87  uint32_t AutoNegotiation:1;
88  uint32_t SpeedSelect:1;
89  uint32_t Loopback:1;
90  uint32_t SoftReset:1;
91  uint32_t Reserved16_31:16;
92  };
93 #elif defined(BIG_ENDIAN)
94 # error The structure is not prepared for the BIG_ENDIAN
95 #else
96 # error ENDIANNES not defined!
97 #endif
98  uint32_t Value;
100 
101 //==========================================================================================================================================
108 //==========================================================================================================================================
109 typedef union
110 {
111 #if defined(LITTLE_ENDIAN)
112  struct
113  {
114  uint32_t ExtendedCapabilities:1;
115  uint32_t JabberDetect:1;
116  uint32_t LinkStatus:1;
117  uint32_t AutoNegotiateAbility:1;
118  uint32_t RemoteFault:1;
119  uint32_t AutoNegotiateComplete:1;
120  uint32_t Reserved6_7:2;
121  uint32_t ExtendedStatus:1;
122  uint32_t HalfDuplex100BASET2:1;
123  uint32_t FullDuplex100BASET2:1;
124  uint32_t HalfDuplex10BASET:1;
125  uint32_t FullDuplex10BASET:1;
126  uint32_t HalfDuplex100BASETX:1;
127  uint32_t FullDuplex100BASETX:1;
128  uint32_t T4100BASE:1;
129  uint32_t Reserved16_31:16;
130  };
131 #elif defined(BIG_ENDIAN)
132 # error The structure is not prepared for the BIG_ENDIAN
133 #else
134 # error ENDIANNES not defined!
135 #endif
136  uint32_t Value;
138 
139 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
140 
146 #define _________________________________________PROTOTYPES_SECTION_________________________________________________________________________
147 
148 extern oC_ErrorCode_t oC_ETH_WritePhyRegister ( oC_ETH_PhyAddress_t PhyAddress , oC_ETH_PhyRegister_t Register , uint32_t Value );
149 extern oC_ErrorCode_t oC_ETH_ReadPhyRegister ( oC_ETH_PhyAddress_t PhyAddress , oC_ETH_PhyRegister_t Register , uint32_t * outValue );
150 extern oC_ErrorCode_t oC_ETH_PhyReset ( oC_ETH_PhyAddress_t PhyAddress );
151 extern oC_ErrorCode_t oC_ETH_ReadLinkStatus ( oC_ETH_PhyAddress_t PhyAddress , oC_Net_LinkStatus_t * outLinkStatus );
152 extern oC_ErrorCode_t oC_ETH_SetAutoNegotiation ( oC_ETH_PhyAddress_t PhyAddress , bool Enabled , oC_Time_t Timeout );
153 extern oC_ErrorCode_t oC_ETH_SetPhyLoopback ( oC_ETH_PhyAddress_t PhyAddress , bool Enabled );
154 
155 #undef _________________________________________PROTOTYPES_SECTION_________________________________________________________________________
156 
157 
158 #endif
159 #endif /* SYSTEM_CORE_INC_DRIVERS_ETH_OC_ETH_PHY_H_ */
Maximum value for the register address.
Definition: oc_eth_phy.h:66
oC_ErrorCode_t oC_ETH_SetPhyLoopback(oC_ETH_PhyAddress_t PhyAddress, bool Enabled)
enables/disables PHY loopback mode
Definition: oc_eth_phy.c:237
oC_ErrorCode_t oC_ETH_PhyReset(oC_ETH_PhyAddress_t PhyAddress)
resets PHY
Definition: oc_eth_phy.c:121
stores value of the BSR register
Definition: oc_eth_phy.h:109
oC_ETH_PhyRegister_BasicStatusRegister
Definition: oc_eth_phy.h:64
uint32_t Value
Stores value of the register.
Definition: oc_eth_phy.h:136
oC_ETH_PhyRegister_t
stores PHY register address
Definition: oc_eth_phy.h:58
oC_ETH_PhyRegister_BasicControlRegister
Definition: oc_eth_phy.h:63
oC_ErrorCode_t oC_ETH_SetAutoNegotiation(oC_ETH_PhyAddress_t PhyAddress, bool Enabled, oC_Time_t Timeout)
enables/disables AutoNegotiation
Definition: oc_eth_phy.c:189
Basic control register.
Definition: oc_eth_phy.h:60
uint32_t Value
Stores value of the register.
Definition: oc_eth_phy.h:98
oC_ErrorCode_t oC_ETH_ReadPhyRegister(oC_ETH_PhyAddress_t PhyAddress, oC_ETH_PhyRegister_t Register, uint32_t *outValue)
writes PHY register
Definition: oc_eth_phy.c:97
stores value of the BCR register
Definition: oc_eth_phy.h:77
oC_ETH_PhyAddress_t PhyAddress
Address of the external PHY.
Definition: oc_eth.c:103
oC_Net_LinkStatus_t
stores network interface link status
Definition: oc_net.h:360
oC_ETH_LLD_PHY_Address_t oC_ETH_PhyAddress_t
stores address of a PHY
Definition: oc_eth.h:97
oC_ErrorCode_t oC_ETH_ReadLinkStatus(oC_ETH_PhyAddress_t PhyAddress, oC_Net_LinkStatus_t *outLinkStatus)
reads link status from the PHY
Definition: oc_eth_phy.c:155
The file with interface for ETH driver.
oC_ErrorCode_t oC_ETH_WritePhyRegister(oC_ETH_PhyAddress_t PhyAddress, oC_ETH_PhyRegister_t Register, uint32_t Value)
writes PHY register
Definition: oc_eth_phy.c:70