![]() |
axiethernet
Vitis Drivers API Documentation
|
The top level c file for the AVB driver.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00a mbr 09/19/08 First release 1.01a mbr 06/24/09 PTP frame format updates for IEEE802.1 AS draft 5-0 2_02a mbr 09/16/09 Updates for programmable PTP timers 2_04a kag 07/23/10 PTP frame format updates for IEEE802.1 AS draft 6-7 3_01a kag 08/29/11 Added new APIs to update the RX Filter Control Reg. Fix for CR:572539. Updated bit map for Rx Filter control reg.
Functions | |
XStatus | XAvb_CfgInitialize (XAvb *InstancePtr, XAvb_Config *ConfigPtr, u32 EffectiveAddress) |
A function to initialise variables in the data structure records. More... | |
void | XAvb_Reset (XAvb *InstancePtr) |
This function resets all of the AVB device driver functions to the start-up (reset) defaults. More... | |
void | XAvb_Start (XAvb *InstancePtr) |
This function will start the PTP drivers running. More... | |
void | XAvb_Stop (XAvb *InstancePtr) |
This function will stop the PTP drivers from running. More... | |
void | XAvb_PtpTimerInterruptHandler (XAvb *InstancePtr) |
The Interrupt subroutine for the "interruptPtpTimer" signal. More... | |
void | XAvb_PtpRxInterruptHandler (XAvb *InstancePtr) |
The Interrupt subroutine for the "interrupt_ptp_rx" signal. More... | |
void | XAvb_SetupRxFilterControlPcp (XAvb *InstancePtr, u32 VlanPriority, u8 SrClass) |
A function to set the VLAN PCP field for either SR A or B traffic in the RX Filtering Control Register - such that AV traffic is correctly filtered by the RX Splitter. More... | |
void | XAvb_SetupRxFilterControlVid (XAvb *InstancePtr, u32 VlanVid, u8 SrClass) |
A function to set the VLAN VID field for either SR A or B traffic in the RX Filtering Control Register - such that AV traffic is correctly filtered by the RX Splitter. More... | |
void | XAvb_SetupRxFilterControlMatchMode (XAvb *InstancePtr, u32 VlanMatchMode) |
A function to set the VLAN Match Mode field for the RX Filtering Control Register - such that AV traffic is correctly filtered by the RX Splitter. More... | |
XStatus XAvb_CfgInitialize | ( | XAvb * | InstancePtr, |
XAvb_Config * | ConfigPtr, | ||
u32 | EffectiveAddress | ||
) |
A function to initialise variables in the data structure records.
InstancePtr | is a pointer to the XAvb instance to be worked on |
ConfigPtr | is the Configuration Pointer |
EffectiveAddress | is the base address of the Configuration Pointer |
The component is not yet ready to use
Clear instance memory
Lookup the device configuration in the temporary CROM table. Use this configuration info down below when initializing this component.
Populate Base Address field using the base address value in the configuration structure.
Indicate the component is now ready to use.
Set the callback handler to a stub
References XAvb_Config::BaseAddress, XAvb::Config, XAvb::GMDiscHandler, and XAvb::IsReady.
Referenced by main().
void XAvb_PtpRxInterruptHandler | ( | XAvb * | InstancePtr | ) |
The Interrupt subroutine for the "interrupt_ptp_rx" signal.
This interrupt fires whenever a PTP frame has been received. The main function is to identify, decode, and act on the type of PTP frame received.
InstancePtr | is a pointer to the XAvb instance to be worked on |
RxPtpHardPointer indicates the bin location of the last frame to be received and written into the Rx PTP buffer in hardware. This read will also clear the interrupt.
If PTP functions are marked as not running, then take no further action
RxPtpSoftPointer indicates the bin location of the last frame to be processed in software.
decode the rx'd frames until RxPtpHardPointer = RxPtpSoftPointer
Set the base address of the current PTP frame in the Buffer
Perform very basic sanity checking of the frame : is it a PTP?
Determine which PTP frame was received.
Now act on the received frame
Send a send PDelayResp frame after receiving a PDelayReq Frame
Send a send PDelayRespFollowUp frame after a PDelayResp Frame
PTP is not running so just consume the packets so they are not left in the queue and cause problems when we actually start
RxPtpSoftPointer indicates the bin location of the last frame to be processed in software.
decode the rx'd frames until RxPtpHardPointer = RxPtpSoftPointer
References XAvb_Config::BaseAddress, XAvb::Config, XAvb::PtpCounters, XAvb::PtpIsRunning, XAvb_Counters::RxPtpHardPointer, XAvb_Counters::RxPtpSoftPointer, XAvb_DecodeRxAnnounceFrame(), XAvb_DecodeRxFollowUp(), XAvb_DecodeRxPDelayResp(), XAvb_DecodeRxPDelayRespFollowUp(), XAvb_DecodeRxSignaling(), XAvb_DecodeRxSync(), XAvb_IsRxFramePTP(), XAVB_PTP_RX_CONTROL_OFFSET, XAvb_ReadPtpBuffer, XAvb_ReadReg, XAvb_SendPDelayResp(), and XAvb_SendPDelayRespFollowUp().
void XAvb_PtpTimerInterruptHandler | ( | XAvb * | InstancePtr | ) |
The Interrupt subroutine for the "interruptPtpTimer" signal.
This interrupt fires regularly on a 1/128 second period (based on the RTC).
InstancePtr | is a pointer to the XAvb instance to be worked on |
Clear Interrupt
If PTP functions are marked as not running, then take no further action
If the Link Partner is not AS capable, then take no further action
If a Master, then initiate Sync Frames and Announce frames at the correct intervals
Master will initiate a Sync Frame when the SyncIntervalDuration expires (SyncIntervalDuration is used to count/time the duration)
Following a Sync Frame, a Follow Up frame should always be sent
Master will initiate an Announce Frame when the AnnounceIntervalDuration expires (CounterAnnounceInterval is used to count/time the duration)
If a Slave, monitor Announce/Sync Packet reception from the Master
Timeout for Announce Packet reception: XAVB_ANNOUNCE_RECEIPT_TIMEOUT The AnnounceIntervalDuration is stored with the GrandMaster BMCA data as it is captured from the last Announce frame that was received.
No Announce received from GM for timeout interval: we become the master
Timeout for Sync Packet reception: XAVB_SYNC_RECEIPT_TIMEOUT * The SyncIntervalDuration is stored with the Received Sync data as it is captured from the last Sync frame that was received.
No Syncs received from GM for timeout interval: we become the master
Both Master and Slave will initiate a link delay measurement when the LinkDelayIntervalDuration expires (LinkDelayIntervalDuration is used to count/time the duration)
Check to see if we've received PDelayResp and PDelayRespFollowUp messages since the last PDelayReq was sent
the peer is no longer ASCapable
avoid potential overflow
end of 'if (InstancePtr->PtpIsRunning == 1)'
References XAvb_BmcData::AnnounceIntervalDuration, XAvb_SignallingFrameData::AnnounceIntervalDuration, XAvb_Config::BaseAddress, XAvb::Config, XAvb_Counters::CounterAnnounceInterval, XAvb_Counters::CounterLinkDelayInterval, XAvb_Counters::CounterSyncInterval, XAvb::CurrentBmc, XAvb_BmcData::IAmTheRtcMaster, XAvb::latestMDSyncReceive, XAvb_SignallingFrameData::LinkDelayIntervalDuration, XAvb_StateMachineData::lostResponses, XAvb::PeerASCapable, XAvb::PtpCounters, XAvb::PtpIsRunning, XAvb_StateMachineData::rcvdPDelayResp, XAvb_StateMachineData::rcvdPDelayRespFollowUp, XAvb::SignallingFrameData, XAvb::StateMachineData, XAvb_SignallingFrameData::SyncIntervalDuration, XAvb_MDSyncReceive::SyncIntervalDuration, XAVB_ALLOWED_LOST_RESPONSES, XAVB_ANNOUNCE_RECEIPT_TIMEOUT, XAvb_BecomeRtcMaster(), XAvb_ChangePeerASCapability(), XAvb_MasterSendAnnounce(), XAvb_MasterSendFollowUp(), XAvb_MasterSendSync(), XAVB_RTC_CLEAR_INT_OFFSET, XAvb_SendPDelayReq(), XAVB_SYNC_RECEIPT_TIMEOUT, and XAvb_WriteReg.
void XAvb_Reset | ( | XAvb * | InstancePtr | ) |
This function resets all of the AVB device driver functions to the start-up (reset) defaults.
InstancePtr | is a pointer to the Xavb instance to be worked on. |
Assert bad arguments and conditions
Perform a Software Reset of the AVB Core. This will reset both the transmitter and receiver paths. The RTC counter is not reset here.
Set IEEE specification default values in the device's data structure
Update logMeanMessageInterval in the pre-loaded TX SYNC message buffer
Update logMeanMessageInterval in the pre-loaded TX FOLLOW_UP message buffer
Update logMeanMessageInterval in the pre-loaded TX PDELAYREQ message buffer
Update logMeanMessageInterval in the pre-loaded TX ANNOUNCE message buffer
Initialise other driver variables in the device's data structure
References XAvb_SignallingFrameData::AnnounceIntervalDuration, XAvb_Config::BaseAddress, XAvb::Config, XAvb_Counters::CounterAnnounceInterval, XAvb_Counters::CounterLinkDelayInterval, XAvb_Counters::CounterSyncEvents, XAvb_Counters::CounterSyncInterval, XAvb::IsReady, XAvb::latestMDSyncReceive, XAvb_PtpStruct::LinkDelay, XAvb_SignallingFrameData::LinkDelayIntervalDuration, XAvb_StateMachineData::lostResponses, XAvb::PtpCounters, XAvb::PtpIsRunning, XAvb::PtpRecords, XAvb_StateMachineData::rcvdPDelayResp, XAvb_StateMachineData::rcvdPDelayRespFollowUp, XAvb_Counters::RxPtpHardPointer, XAvb_Counters::RxPtpSoftPointer, XAvb::SignallingFrameData, XAvb::StateMachineData, XAvb_SignallingFrameData::SyncIntervalDuration, XAvb_MDSyncReceive::SyncIntervalDuration, XAvb_BecomeRtcMaster(), XAvb_ChangePeerASCapability(), XAvb_ConvertLogMeanToDuration(), XAVB_SW_RESET_OFFSET, XAvb_UpdateLogMeanMessageInterval(), and XAvb_WriteReg.
Referenced by main(), and XAvb_Stop().
void XAvb_SetupRxFilterControlMatchMode | ( | XAvb * | InstancePtr, |
u32 | VlanMatchMode | ||
) |
A function to set the VLAN Match Mode field for the RX Filtering Control Register - such that AV traffic is correctly filtered by the RX Splitter.
InstancePtr | is a pointer to the XAvb instance to be worked on |
VlanMatchMode | contains the 1-bit value to be written to the register in the correct bit position as defined in the address map |
References XAvb_Config::BaseAddress, XAvb::Config, XAvb_ReadReg, XAVB_RX_FILTER_CONTROL, and XAvb_WriteReg.
void XAvb_SetupRxFilterControlPcp | ( | XAvb * | InstancePtr, |
u32 | VlanPriority, | ||
u8 | SrClass | ||
) |
A function to set the VLAN PCP field for either SR A or B traffic in the RX Filtering Control Register - such that AV traffic is correctly filtered by the RX Splitter.
InstancePtr | is a pointer to the XAvb instance to be worked on |
VlanPriority | contains the 3-bit value to be written to the register in the correct bit positions as defined in the address map |
SrClass | is '0' if VLAN Priority (PCP) A is to be updated and is '1' if VLAN Priority (PCP) B is to be updated |
References XAvb_Config::BaseAddress, XAvb::Config, XAvb_ReadReg, XAVB_RX_FILTER_CONTROL, and XAvb_WriteReg.
void XAvb_SetupRxFilterControlVid | ( | XAvb * | InstancePtr, |
u32 | VlanVid, | ||
u8 | SrClass | ||
) |
A function to set the VLAN VID field for either SR A or B traffic in the RX Filtering Control Register - such that AV traffic is correctly filtered by the RX Splitter.
InstancePtr | is a pointer to the XAvb instance to be worked on |
VlanVid | contains the 12-bit value to be written to the register in the correct bit positions as defined in the address map |
SrClass | is '0' if VLAN VID A is to be updated and is '1' if VLAN VID B is to be updated |
References XAvb_Config::BaseAddress, XAvb::Config, XAvb_ReadReg, XAVB_RX_FILTER_CONTROL, and XAvb_WriteReg.
void XAvb_Start | ( | XAvb * | InstancePtr | ) |
This function will start the PTP drivers running.
InstancePtr | is a pointer to the Xavb instance to be worked on. |
Assert bad arguments and conditions
Re-run the BMCA algorithm with the current PTP buffer Announce Packet
Set to PTP running in the PTP data structure
Assume that the Peer is not AS capable until it replies to a pDelay_Req frame
References XAvb::IsReady, XAvb::PtpIsRunning, XAvb_ChangePeerASCapability(), and XAvb_DecodeTxAnnounceFrame().
Referenced by main().
void XAvb_Stop | ( | XAvb * | InstancePtr | ) |
This function will stop the PTP drivers from running.
InstancePtr | is a pointer to the Xavb instance to be worked on. |
Assert bad arguments and conditions
References XAvb::IsReady, and XAvb_Reset().