Choco OS  V.0.16.9.0
Join to the chocolate world
oc_eth.c File Reference

The file with source for ETH driver interface. More...

#include <oc_eth.h>
#include <oc_eth_lld.h>
#include <oc_compiler.h>
#include <oc_module.h>
#include <oc_intman.h>
#include <oc_null.h>
#include <oc_gpio.h>
#include <oc_stdio.h>
#include <oc_string.h>
#include <oc_eth_phy.h>
#include <oc_debug.h>
#include <oc_mutex.h>
#include <oc_ktime.h>
#include <oc_math.h>
#include <oc_driver.h>

Go to the source code of this file.

Data Structures

struct  Context_t
 stores ETH context More...
 

Functions

static bool IsContextCorrect (oC_ETH_Context_t Context)
 Checks if the context of the ETH driver is correct.
 
static oC_ErrorCode_t CreateContext (const oC_ETH_Config_t *Config, oC_ETH_Context_t *outContext)
 creates context of the driver
 
static oC_ErrorCode_t DeleteContext (oC_ETH_Context_t *outContext)
 deletes context of the driver
 
static oC_ErrorCode_t InitializePhy (const oC_ETH_Config_t *Config, oC_ETH_Context_t Context)
 initializes PHY to work
 
static oC_ErrorCode_t ReleasePhy (const oC_ETH_Config_t *Config, oC_ETH_Context_t Context)
 releases PHY when it is not needed anymore
 
static oC_Net_LinkStatus_t GetLinkStatus (oC_ETH_Context_t Context)
 returns current link status
 
static oC_ErrorCode_t AllocateDescriptors (oC_ETH_Context_t Context)
 allocates Rx/Tx descriptors
 
static oC_ErrorCode_t ReleaseDescriptors (oC_ETH_Context_t Context)
 releases Rx/Tx descriptors
 
static void InterruptHandler (oC_ETH_LLD_InterruptSource_t Source)
 handler for interrupts
 
static oC_ErrorCode_t SendFrame (oC_ETH_Context_t Context, const oC_Net_MacAddress_t Source, const oC_Net_MacAddress_t Destination, const void *Data, uint16_t Size, oC_ETH_LLD_FrameSegment_t FrameSegment, oC_Net_FrameType_t FrameType, oC_Time_t Timeout)
 sends frame
 
static oC_ErrorCode_t ReceiveFrame (oC_ETH_Context_t Context, oC_Net_MacAddress_t outSource, oC_Net_MacAddress_t outDestination, void *Data, uint16_t *Size, oC_ETH_LLD_FrameSegment_t *outFrameSegment, oC_Net_FrameType_t *outFrameType, oC_Time_t Timeout)
 receives frame
 
static oC_ErrorCode_t PerformPhyRegisterAccessTest (oC_Diag_t *Diag, void *Context)
 performs PHY registers access test
 
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...
 

Variables

static const oC_Allocator_t Allocator
 
static oC_Event_t DataReadyToRead = NULL
 
static oC_Event_t ModuleReadyToSend = NULL
 
static const oC_Diag_SupportedDiagData_t SupportedDiagsArray []
 

Detailed Description


File based on driver.c Ver 1.1.0

Author
Patryk Kubiak - (Created on: 2016-07-28 - 21:37:41)

Definition in file oc_eth.c.

Variable Documentation

const oC_Allocator_t Allocator
static
Initial value:
= {
.Name = "eth module"
}

The 'Allocator' for this driver. It should be used for all ETH driver kernel allocations.

Definition at line 152 of file oc_eth.c.

oC_Event_t DataReadyToRead = NULL
static

Event active when data is ready to read

Definition at line 160 of file oc_eth.c.

oC_Event_t ModuleReadyToSend = NULL
static

Event active when module is ready to send

Definition at line 166 of file oc_eth.c.

const oC_Diag_SupportedDiagData_t SupportedDiagsArray[]
static
Initial value:
= {
{ .Name = "PHY register access test" , .PerformFunction = PerformPhyRegisterAccessTest } ,
}
static oC_ErrorCode_t PerformPhyRegisterAccessTest(oC_Diag_t *Diag, void *Context)
performs PHY registers access test
Definition: oc_eth.c:1036

Array with list of supported diagnostics

Definition at line 172 of file oc_eth.c.