36 #include <oc_errors.h> 40 #include <oc_baudrate.h> 43 #if oC_Channel_IsModuleDefined(ETH) && oC_ModulePinFunctions_IsModuleDefined(ETH) && oC_ModulePin_IsModuleDefined(ETH) 44 #define oC_ETH_LLD_AVAILABLE 51 #define _________________________________________DEFINITIONS_SECTION________________________________________________________________________ 53 #define oC_ETH_LLD_ETHERNET_MTU 1500 54 #define oC_ETH_LLD_MAC_ADDRESS_LENGTH 6 56 #undef _________________________________________DEFINITIONS_SECTION________________________________________________________________________ 64 #define _________________________________________TYPES_SECTION______________________________________________________________________________ 65 #define MODULE_NAME ETH 88 oC_ModulePinFunction_DefineType;
98 oC_ModulePin_DefineType;
115 oC_ETH_LLD_FrameSegment_First = (1<<0) ,
116 oC_ETH_LLD_FrameSegment_Last = (1<<1) ,
117 oC_ETH_LLD_FrameSegment_Single = (1<<0) | (1<<1),
118 oC_ETH_LLD_FrameSegment_Middle = 0,
119 oC_ETH_LLD_FrameSegment_NumberOfFrameSegments = 4,
120 } oC_ETH_LLD_FrameSegment_t;
131 oC_ETH_LLD_PHY_CommunicationInterface_None ,
132 oC_ETH_LLD_PHY_CommunicationInterface_MII ,
133 oC_ETH_LLD_PHY_CommunicationInterface_RMII
134 } oC_ETH_LLD_PHY_CommunicationInterface_t;
145 oC_ETH_LLD_AccessProtocol_CSMA_CD ,
146 oC_ETH_LLD_AccessProtocol_CSMA_CA ,
147 oC_ETH_LLD_AccessProtocol_ALOHA ,
148 } oC_ETH_LLD_AccessProtocol_t;
159 oC_ETH_LLD_OperationMode_HalfDuplex ,
160 oC_ETH_LLD_OperationMode_FullDuplex ,
161 } oC_ETH_LLD_OperationMode_t;
172 oC_ETH_LLD_PHY_CommunicationInterface_t CommunicationInterface;
173 oC_BaudRate_t PossibleBaudRates[5];
174 } oC_ETH_LLD_PHY_ChipInfo_t;
181 typedef uint16_t oC_ETH_LLD_PHY_Address_t;
188 typedef uint16_t oC_ETH_LLD_PHY_RegisterAddress_t;
197 bool AutoGeneratePad;
198 bool AutoCalculateCrc;
199 oC_ETH_LLD_PHY_Address_t PhyAddress;
200 oC_BaudRate_t BaudRate;
201 oC_ETH_LLD_OperationMode_t OperationMode;
256 } oC_ETH_LLD_Config_t;
263 typedef uint8_t oC_ETH_LLD_Payload_t[oC_ETH_LLD_ETHERNET_MTU];
270 typedef uint8_t oC_ETH_LLD_MacAddress_t[oC_ETH_LLD_MAC_ADDRESS_LENGTH];
282 uint8_t StartOfFrameDelimiter;
284 oC_ETH_LLD_MacAddress_t DestinationAddress;
285 oC_ETH_LLD_MacAddress_t SourceAddress;
286 uint16_t DataLengthEtherType;
287 oC_ETH_LLD_Payload_t Data;
289 } oC_ETH_LLD_Frame_t;
305 oC_ETH_LLD_InterruptSource_DataReceived = (1<<0) ,
306 oC_ETH_LLD_InterruptSource_ReceiveError = (1<<1) ,
307 oC_ETH_LLD_InterruptSource_TransmitError = (1<<2) ,
308 oC_ETH_LLD_InterruptSource_TransmissionSlotsAvailable = (1<<3) ,
309 oC_ETH_LLD_InterruptSource_FatalBusError = (1<<4) ,
310 oC_ETH_LLD_InterruptSource_ReceiveTimeout = (1<<5) ,
311 oC_ETH_LLD_InterruptSource_ReceiveProcessStopped = (1<<6) ,
312 oC_ETH_LLD_InterruptSource_ReceiveDescriptorError = (1<<7) ,
313 oC_ETH_LLD_InterruptSource_TransmitJabberTimeout = (1<<8) ,
314 oC_ETH_LLD_InterruptSource_TransmitDescriptorError = (1<<9) ,
315 oC_ETH_LLD_InterruptSource_TransmitProcessStopped = (1<<10) ,
316 oC_ETH_LLD_InterruptSource_ReceiveOverflowError = (1<<11) ,
317 oC_ETH_LLD_InterruptSource_TransmitUnderflowError = (1<<12) ,
318 } oC_ETH_LLD_InterruptSource_t;
325 typedef void (*oC_ETH_LLD_InterruptFunction_t)( oC_ETH_LLD_InterruptSource_t Source );
336 oC_Pin_t ConnectedPins[17];
337 uint32_t NumberOfMacAddresses;
340 oC_MemorySize_t DescriptorSize;
342 oC_MemorySize_t Alignment;
343 oC_ETH_LLD_Descriptor_t NextDescriptor;
344 uint32_t SegmentStarted;
346 } oC_ETH_LLD_Result_t;
349 #undef _________________________________________TYPES_SECTION______________________________________________________________________________ 357 #define _________________________________________MACROS_SECTION_____________________________________________________________________________ 360 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________ 368 #define _________________________________________FUNCTIONS_SECTION__________________________________________________________________________ 391 extern oC_ErrorCode_t oC_ETH_LLD_TurnOnDriver(
void );
412 extern oC_ErrorCode_t oC_ETH_LLD_TurnOffDriver(
void );
435 extern oC_ErrorCode_t oC_ETH_LLD_SetInterruptHandler( oC_ETH_LLD_InterruptFunction_t Function );
447 extern bool oC_ETH_LLD_IsAutoPadGenerationSupported(
void );
457 extern bool oC_ETH_LLD_IsAutoCalculateCrcSupported(
void );
472 extern oC_ErrorCode_t oC_ETH_LLD_InitializeMac(
const oC_ETH_LLD_Config_t * Config ,
const oC_ETH_LLD_PHY_ChipInfo_t * ChipInfo , oC_ETH_LLD_Result_t * outResult );
487 extern oC_ErrorCode_t oC_ETH_LLD_ReleaseMac(
const oC_ETH_LLD_Config_t * Config ,
const oC_ETH_LLD_PHY_ChipInfo_t * ChipInfo , oC_ETH_LLD_Result_t * Result );
502 extern oC_ErrorCode_t oC_ETH_LLD_ReadPhyRegister( oC_ETH_LLD_PHY_Address_t PhyAddress , oC_ETH_LLD_PHY_RegisterAddress_t RegisterAddress , uint32_t * outValue );
517 extern oC_ErrorCode_t oC_ETH_LLD_WritePhyRegister( oC_ETH_LLD_PHY_Address_t PhyAddress , oC_ETH_LLD_PHY_RegisterAddress_t RegisterAddress , uint32_t Value );
531 extern oC_ErrorCode_t oC_ETH_LLD_SetMacLoopback(
bool Enabled );
547 extern oC_ErrorCode_t oC_ETH_LLD_InitializeDescriptors( oC_ETH_LLD_Result_t * Result ,
const oC_ETH_LLD_Config_t * Config , oC_ETH_LLD_Descriptor_t Tx , oC_ETH_LLD_Descriptor_t Rx );
561 extern oC_ErrorCode_t oC_ETH_LLD_InitializeDma( oC_ETH_LLD_Result_t * Result ,
const oC_ETH_LLD_Config_t * Config , oC_ETH_LLD_Descriptor_t Tx , oC_ETH_LLD_Descriptor_t Rx );
574 extern oC_ErrorCode_t oC_ETH_LLD_Start(
const oC_ETH_LLD_Config_t * Config );
597 extern oC_ErrorCode_t oC_ETH_LLD_SendFrame( oC_ETH_LLD_Result_t * Result ,
const oC_ETH_LLD_MacAddress_t Source,
const oC_ETH_LLD_MacAddress_t Destination,
const void * Data , uint16_t Size , oC_ETH_LLD_FrameSegment_t FrameSegment , uint16_t EtherType );
617 extern oC_ErrorCode_t oC_ETH_LLD_ReceiveFrame( oC_ETH_LLD_Result_t * Result , oC_ETH_LLD_MacAddress_t outSource, oC_ETH_LLD_MacAddress_t outDestination,
void * Data , uint16_t * Size , oC_ETH_LLD_FrameSegment_t * outFrameSegment , uint16_t * outEtherType );
633 extern oC_ErrorCode_t oC_ETH_LLD_SetMacAddress( oC_ETH_LLD_Result_t * Result , uint32_t MacAddressIndex,
const oC_ETH_LLD_MacAddress_t Address );
649 extern oC_ErrorCode_t oC_ETH_LLD_ReadMacAddress( oC_ETH_LLD_Result_t * Result , uint32_t MacAddressIndex, oC_ETH_LLD_MacAddress_t outAddress );
656 extern bool oC_ETH_LLD_IsTransmitQueueFull( oC_ETH_LLD_Result_t * Result );
663 extern bool oC_ETH_LLD_IsDataReadyToReceive( oC_ETH_LLD_Result_t * Result );
678 extern oC_ErrorCode_t oC_ETH_LLD_PerformDiagnostics( oC_ETH_LLD_Result_t * Result ,
oC_Diag_t * Diag , uint32_t * NumberOfDiags );
680 #undef _________________________________________FUNCTIONS_SECTION__________________________________________________________________________
The file with frequency definitions.
#define oC_ModuleChannel_DefineType
defines module channel type
oC_Channel_t
stores machine channel
The file with interface for the machine module.
Contains interface of the pins module.
The file with interface for Channel module.