Choco OS  V.0.16.9.0
Join to the chocolate world
oc_eth.h
Go to the documentation of this file.
1 
31 #ifndef _OC_ETH_H
32 #define _OC_ETH_H
33 #define DRIVER_HEADER
34 #define DRIVER_NAME ETH
35 
36 #include <oc_driver.h>
37 #include <oc_stdlib.h>
38 #include <oc_ioctl.h>
39 #include <oc_eth_lld.h>
40 #include <oc_event.h>
41 #include <oc_diag.h>
42 
43 #ifdef oC_ETH_LLD_AVAILABLE
44 
50 #define _________________________________________DEFINITIONS_SECTION_______________________________________________________________________
51 
56 //==========================================================================================================================================
63 //==========================================================================================================================================
64 #define oC_ETH_CHIP_NAME_MAX_LENGTH ( IFNAMSIZ / 2 )
65 
67 #undef _________________________________________DEFINITIONS_SECTION_______________________________________________________________________
68 
69 
75 #define _________________________________________TYPES_SECTION______________________________________________________________________________
76 
81 //==========================================================================================================================================
87 //==========================================================================================================================================
89 
90 //==========================================================================================================================================
96 //==========================================================================================================================================
97 typedef oC_ETH_LLD_PHY_Address_t oC_ETH_PhyAddress_t;
98 
99 //==========================================================================================================================================
105 //==========================================================================================================================================
106 typedef struct
107 {
109  oC_ETH_LLD_PHY_ChipInfo_t LLD;
111 
112 //==========================================================================================================================================
121 //==========================================================================================================================================
122 typedef struct
123 {
125  oC_ETH_LLD_Config_t LLD;
129 
130 //==========================================================================================================================================
139 //==========================================================================================================================================
140 typedef struct Context_t * oC_ETH_Context_t;
141 
143 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
144 
150 #define _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________
151 
152 extern oC_ErrorCode_t oC_ETH_TurnOn ( void );
153 extern oC_ErrorCode_t oC_ETH_TurnOff ( void );
154 extern bool oC_ETH_IsTurnedOn ( void );
155 extern oC_ErrorCode_t oC_ETH_Configure ( const oC_ETH_Config_t * Config , oC_ETH_Context_t * outContext );
156 extern oC_ErrorCode_t oC_ETH_Unconfigure ( const oC_ETH_Config_t * Config , oC_ETH_Context_t * outContext );
157 
158 extern oC_ErrorCode_t oC_ETH_SendFrame ( oC_ETH_Context_t Context , const oC_Net_Frame_t * Frame , oC_Time_t Timeout );
159 extern oC_ErrorCode_t oC_ETH_ReceiveFrame ( oC_ETH_Context_t Context , oC_Net_Frame_t * outFrame , oC_Time_t Timeout );
160 extern oC_ErrorCode_t oC_ETH_SetWakeOnLanEvent ( oC_ETH_Context_t Context , oC_Event_t WolEvent );
161 extern oC_ErrorCode_t oC_ETH_Flush ( oC_ETH_Context_t Context );
162 extern oC_ErrorCode_t oC_ETH_SetLoopback ( oC_ETH_Context_t Context , oC_Net_Layer_t Layer , bool Enabled );
163 extern oC_ErrorCode_t oC_ETH_PerformDiagnostics( oC_ETH_Context_t Context , oC_Diag_t * Diags , uint32_t * NumberOfDiags );
164 extern oC_ErrorCode_t oC_ETH_ReadNetInfo ( oC_ETH_Context_t Context , oC_Net_Info_t * outInfo );
165 extern bool oC_ETH_IsContextCorrect ( oC_ETH_Context_t Context );
166 
167 #undef _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________
168 
169 #endif /* oC_ETH_LLD_AVAILABLE */
170 #endif /* _OC_ETH_H */
#define oC_ETH_CHIP_NAME_MAX_LENGTH
maximum length for the chip name
Definition: oc_eth.h:64
oC_ETH_PhyAddress_t PhyAddress
Address of the external PHY.
Definition: oc_eth.h:126
oC_ErrorCode_t oC_ETH_PerformDiagnostics(oC_ETH_Context_t Context, oC_Diag_t *Diags, uint32_t *NumberOfDiags)
performs diagnostics
Definition: oc_eth.c:644
ETH driver configuration structure.
Definition: oc_eth.h:122
oC_ErrorCode_t oC_ETH_SendFrame(oC_ETH_Context_t Context, const oC_Net_Frame_t *Frame, oC_Time_t Timeout)
sends frame via ETH
Definition: oc_eth.c:408
struct Context_t * oC_ETH_Context_t
The ETH context structure.
Definition: oc_eth.h:140
oC_ErrorCode_t oC_ETH_TurnOn(void)
turns on the module
Definition: oc_eth.c:200
oC_ErrorCode_t oC_ETH_SetLoopback(oC_ETH_Context_t Context, oC_Net_Layer_t Layer, bool Enabled)
enables or disables loopback-mode at the given layer
Definition: oc_eth.c:583
The file with LLD interface for the ETH driver.
stores network interface informations
Definition: oc_net.h:508
Informations about the selected chip.
Definition: oc_eth.h:106
oC_ErrorCode_t oC_ETH_Configure(const oC_ETH_Config_t *Config, oC_ETH_Context_t *outContext)
configures ETH pins to work
Definition: oc_eth.c:309
oC_ETH_LLD_Config_t LLD
Configuration from the LLD layer (More you can find in the #oC_ETH_LLD_Config_t type description) ...
Definition: oc_eth.h:125
uint8_t oC_Net_MacAddress_t[MAC_ADDRESS_LENGTH]
stores MAC address
Definition: oc_net.h:106
char oC_ETH_ChipName_t[oC_ETH_CHIP_NAME_MAX_LENGTH]
stores name of the chip
Definition: oc_eth.h:88
oC_Net_MacAddress_t MacAddress
MAC address of the interface.
Definition: oc_eth.h:127
The file with interface for driver creating.
oC_ETH_LLD_PHY_ChipInfo_t LLD
Informations about the chip required by the LLD layer.
Definition: oc_eth.h:109
const oC_ETH_PhyChipInfo_t * PhyChipInfo
Pointer to the PHY chip definition (you can find it in the oc_eth_chips.h file)
Definition: oc_eth.h:124
oC_ErrorCode_t oC_ETH_TurnOff(void)
Turns off the ETH driver.
Definition: oc_eth.c:250
The file with interface for event module.
oC_ETH_ChipName_t Name
Name of the PHY chip.
Definition: oc_eth.h:108
stores informations about the frame to send
Definition: oc_net.h:314
oC_ErrorCode_t oC_ETH_ReadNetInfo(oC_ETH_Context_t Context, oC_Net_Info_t *outInfo)
returns informations about the interface
Definition: oc_eth.c:709
oC_ErrorCode_t oC_ETH_Unconfigure(const oC_ETH_Config_t *Config, oC_ETH_Context_t *outContext)
Unconfigures the driver.
Definition: oc_eth.c:361
The file with interface for IOCTL.
stores ETH context
Definition: oc_eth.c:97
oC_ErrorCode_t oC_ETH_ReceiveFrame(oC_ETH_Context_t Context, oC_Net_Frame_t *outFrame, oC_Time_t Timeout)
receives frame via ETH
Definition: oc_eth.c:482
oC_ETH_LLD_PHY_Address_t oC_ETH_PhyAddress_t
stores address of a PHY
Definition: oc_eth.h:97
bool oC_ETH_IsContextCorrect(oC_ETH_Context_t Context)
checks if the context is correct for ETH driver
Definition: oc_eth.c:764
bool oC_ETH_IsTurnedOn(void)
checks if the driver is turned on
Definition: oc_eth.c:282
oC_Net_Layer_t
stores layer of the OSI model
Definition: oc_net.h:333