Driver of the Ethernet communication.
More...
|
oC_ErrorCode_t | oC_ETH_TurnOn (void) |
| turns on the module More...
|
|
oC_ErrorCode_t | oC_ETH_TurnOff (void) |
| Turns off the ETH driver. More...
|
|
bool | oC_ETH_IsTurnedOn (void) |
| checks if the driver is turned on More...
|
|
oC_ErrorCode_t | oC_ETH_Configure (const oC_ETH_Config_t *Config, oC_ETH_Context_t *outContext) |
| configures ETH pins to work More...
|
|
oC_ErrorCode_t | oC_ETH_Unconfigure (const oC_ETH_Config_t *Config, oC_ETH_Context_t *outContext) |
| Unconfigures the driver. More...
|
|
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 More...
|
|
oC_ErrorCode_t | oC_ETH_ReceiveFrame (oC_ETH_Context_t Context, oC_Net_Frame_t *outFrame, oC_Time_t Timeout) |
| receives frame via ETH More...
|
|
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 More...
|
|
oC_ErrorCode_t | oC_ETH_PerformDiagnostics (oC_ETH_Context_t Context, oC_Diag_t *Diags, uint32_t *NumberOfDiags) |
| performs diagnostics More...
|
|
oC_ErrorCode_t | oC_ETH_ReadNetInfo (oC_ETH_Context_t Context, oC_Net_Info_t *outInfo) |
| returns informations about the interface More...
|
|
bool | oC_ETH_IsContextCorrect (oC_ETH_Context_t Context) |
| checks if the context is correct for ETH driver More...
|
|
#define oC_ETH_CHIP_NAME_MAX_LENGTH |
The definition stores maximum length of the chip name
Definition at line 64 of file oc_eth.h.
The type is for storing name of the chip. It is just to make it shorter and easier to manipulate.
Definition at line 88 of file oc_eth.h.
This is the structure with dynamic allocated data for the ETH. It stores a HANDLE for a driver and it can be used to identify the driver context. You should get this pointer from the oC_ETH_Configure function, but note, that not all drivers use it. In many cases it is just not needed, and it just will store NULL then. You should keep this pointer as long as it is necessary for you, and when it will not be anymore, you should call oC_ETH_Unconfigure function to destroy it.
Definition at line 140 of file oc_eth.h.
The type is for storing address of an external PHY.
Definition at line 97 of file oc_eth.h.
The function is for configuration of the driver. Look at the oC_ETH_Config_t structure description and fields list to get more info.
- Parameters
-
Config | Pointer to the configuration structure |
outContext | Destination for the driver context structure |
- Returns
- code of error or
oC_ErrorCode_None
if success
Standard possible error codes:
Code of error | Description |
oC_ErrorCode_ModuleNotStartedYet | Module is turned off. Please call oC_ETH_TurnOn function |
oC_ErrorCode_WrongConfigAddress | Config pointer stores address that is not correct |
oC_ErrorCode_ChipNotDefined | Config structure does not contain PHY chip info pointer, or it is not correct |
oC_ErrorCode_OutputAddressNotInRAM | outContext does not store address in the machine RAM section |
oC_ErrorCode_ChipNameNotDefined | Name of the chip is not defined in the #oC_ETH_ChipInfo_t |
Definition at line 309 of file oc_eth.c.
The function is for checking if the context is correct context for the ETH driver. The ETH driver must not be enabled to use it.
- Parameters
-
Context | Context of the ETH driver to check |
- Returns
- true if the Context is correct
Definition at line 764 of file oc_eth.c.
bool oC_ETH_IsTurnedOn |
( |
void |
| ) |
|
- Returns
- true if driver is turned on
Definition at line 282 of file oc_eth.c.
The function performs Ethernet driver diagnostics
- Parameters
-
Context | Context of the driver received from the oC_ETH_Configure function |
Diags | Pointer to the array for Diagnostics informations (you can fill Diags->PrintFunction if you want to print message during diagnostics). It also can be set to NULL if you want to only know number of supported diags |
NumberOfDiags | On input it is size of the Diags array, on output it is number of supported diags |
- Returns
- code of error or
oC_ErrorCode_None
if success
List of standard error codes, that can be returned by the function:
Code of error | Description |
oC_ErrorCode_ModuleNotStartedYet | Module is turned off. Please call oC_ETH_TurnOn function |
oC_ErrorCode_ContextNotCorrect | Context is not correct (address is not correct or not valid anymore) |
oC_ErrorCode_OutputAddressNotInRAM | Diags does not point to NULL nor RAM |
oC_ErrorCode_OutputAddressNotInRAM | NumberOfDiags does not point to RAM |
oC_ErrorCode_WrongAddress | Diags->PrintFunction is not NULL nor correct address |
Definition at line 644 of file oc_eth.c.
The function reads informations about the given network interface, that is associated with the driver and returns it by using a memory address stored in the outInfo
variable.
- Parameters
-
Context | Context of the driver received from the oC_ETH_Configure function |
outInfo | Destination for the network interface informations |
- Returns
- code of error or
oC_ErrorCode_None
if success
List of standard error codes, that can be returned by the function:
Code of error | Description |
oC_ErrorCode_ModuleNotStartedYet | Module is turned off. Please call oC_ETH_TurnOn function |
oC_ErrorCode_ContextNotCorrect | Context is not correct (address is not correct or not valid anymore) |
oC_ErrorCode_OutputAddressNotInRAM | outInfo points to the address that is not stored in the RAM section |
Definition at line 709 of file oc_eth.c.
The function is for receiving a frame by using Ethernet interface.
- Warning
outFrame
has to have filled field Allocator
. The function will allocate memory required for the frame and it should be released when it is not needed anymore
- Parameters
-
Context | Context of the driver received from the oC_ETH_Configure function |
outFrame | Destination for received frame |
Timeout | Maximum time for operation |
- Returns
- code of error or
oC_ErrorCode_None
if success
List of standard error codes, that can be returned by the function:
Code of error | Description |
oC_ErrorCode_ModuleNotStartedYet | Module is turned off. Please call oC_ETH_TurnOn function |
oC_ErrorCode_ContextNotCorrect | Context is not correct (address is not correct or not valid anymore) |
oC_ErrorCode_OutputAddressNotInRAM | outFrame or outFrame->Packet is not in RAM |
oC_ErrorCode_TimeNotCorrect | Timeout is smaller than 0 |
oC_ErrorCode_Timeout | Timeout has expired |
oC_ErrorCode_SizeNotCorrect | outFrame->Size is not correct |
Definition at line 482 of file oc_eth.c.
The function is for sending a frame by using Ethernet interface.
- Parameters
-
Context | Context of the driver received from the oC_ETH_Configure function |
Frame | Frame to send |
Timeout | Maximum time for operation |
- Returns
- code of error or
oC_ErrorCode_None
if success
List of standard error codes, that can be returned by the function:
Code of error | Description |
oC_ErrorCode_ModuleNotStartedYet | Module is turned off. Please call oC_ETH_TurnOn function |
oC_ErrorCode_ContextNotCorrect | Context is not correct (address is not correct or not valid anymore) |
oC_ErrorCode_WrongAddress | Frame or Frame->Packet points to the wrong address |
oC_ErrorCode_SizeNotCorrect | Frame->Size is 0 (no data to send) |
oC_ErrorCode_TimeNotCorrect | Timeout is smaller than 0 |
oC_ErrorCode_Timeout | Timeout has expired |
Definition at line 408 of file oc_eth.c.
The function is for enabling/disabling loopback mode at the given layer
- Parameters
-
Context | Context of the driver received from the oC_ETH_Configure function |
Layer | Layer of the network OSI model |
Enabled | true if loopback should be enabled |
- Returns
- code of error or
oC_ErrorCode_None
if success
List of standard error codes, that can be returned by the function:
Code of error | Description |
oC_ErrorCode_ModuleNotStartedYet | Module is turned off. Please call oC_ETH_TurnOn function |
oC_ErrorCode_ContextNotCorrect | Context is not correct (address is not correct or not valid anymore) |
oC_ErrorCode_WrongLayer | Layer points to not supported layer |
Definition at line 583 of file oc_eth.c.
oC_ErrorCode_t oC_ETH_TurnOff |
( |
void |
| ) |
|
The function for turning off the ETH driver. If the driver not started yet, it will return oC_ErrorCode_ModuleNotStartedYet
error code. It also turns off the LLD.
- Returns
- code of error
Definition at line 250 of file oc_eth.c.
oC_ErrorCode_t oC_ETH_TurnOn |
( |
void |
| ) |
|
The function is for turning on the ETH module. If the module is already turned on, it will return oC_ErrorCode_ModuleIsTurnedOn
error. It also turns on the LLD layer.
- Returns
- code of error
Definition at line 200 of file oc_eth.c.
The function is for reverting configuration from the oC_ETH_Configure function.
- Parameters
-
Config | Pointer to the configuration |
outContext | Destination for the context structure |
- Returns
- code of error
Definition at line 361 of file oc_eth.c.