AM64x MCU+ SDK  08.00.00
iPNLegacy.h File Reference

Go to the source code of this file.

Macros

#define INTERFACE_MAC   0
 
#define PORT1_MAC   1
 
#define PORT2_MAC   2
 

Functions

void PN_setHandle (PN_Handle pnHandle)
 Stores the local copy of handle to support legacy APIs. More...
 
PN_Handle PN_getPnHandle ()
 Returns the ICSS EMAC LLD handle. This is used to maintain the old APIs that doesn't use the Handle based scheme. More...
 
uint8_t PN_EmacSocMACAddrGet (PN_Handle pnHandle, uint8_t instance, uint8_t *macId)
 Returns the MAC Addr for ports. User can implement this as required. More...
 
int32_t setStaticFilterTable (const uint8_t *macAddr, uint8_t ctrl, uint8_t portNumber, uint8_t table)
 Legacy API. Calls PN_setStaticFilterTable. More...
 
int32_t setRtc3PortStatus (uint8_t portNumber, uint8_t status)
 Legacy API, calls PN_setRtc3PortStatus. More...
 
uint8_t * getLastCpm (t_rtcPacket *pkt)
 Legacy API. Calls PN_getLastCpm. More...
 
int32_t setRedGuard (uint16_t validLowerFrameId, uint16_t validUpperFrameId)
 Legacy API. Calls PN_setRedGuard. More...
 
int32_t setMaxLineRxDelay (uint8_t portNumber, int32_t maxLineRxDelayValue)
 Legacy API. Calls PN_setMaxLineRxDelay. More...
 
int32_t setMaxBridgeDelay (int32_t maxBridgeDelayValue)
 Legacy API. Calls PN_setMaxBridgeDelay. More...
 
int32_t setYellowPeriod (int32_t yellowPeriodTime)
 Legacy API. Calls PN_setYellowPeriod. More...
 
int32_t mapPhaseToProfile (int32_t portNumber, int32_t phaseNumber, int32_t profileNumberRx, int32_t profileNumberTx)
 Legacy API. Calls PN_mapPhaseToProfile. More...
 
int32_t setProfile (int32_t portNumber, int32_t profileNumber, int32_t rxSoGValue, int32_t txSoGValue)
 Legacy API. Calls PN_setProfile In a profile the start of green time in a cycle for Receive (Rx) and Transmit (Tx) is set for a port. More...
 
int32_t setDcpFilterStationName (const uint8_t *dcpNameOfStation, uint8_t lengthOfStationName)
 Legacy API. Calls PN_setDcpFilterStationName. More...
 
int32_t TxPacketOS (const uint8_t *srcAddress, int32_t portNumber, int32_t queuePriority, int32_t lengthOfPacket)
 Legacy API. Calls PN_OS_txPacket. More...
 
int32_t PN_RxPktInfo (int32_t *portNumber, int32_t *queueNumber)
 
int32_t PN_RxPktGet (uint32_t destAddress, int32_t queueNumber, int32_t *port, int32_t *more)
 
uint8_t PN_findMAC (uint8_t *macId)
 Legacy API calls findMAC. More...
 
int32_t setCpmDHT (uint16_t dht, uint8_t pos)
 Legacy API. Calls PN_setCpmDHT. More...
 
int32_t setBaseClock (uint16_t factor)
 Legacy API, calls PN_setBaseClock. More...
 
int32_t clearList (uint8_t list)
 
int32_t iRtcEnableIsr ()
 Enables the PN interrupts. Legacy API. Calls PN_RTC_enableISR. More...
 
int32_t delPmList (t_rtcPacket *pmPkt)
 Legacy API. Calls PN_delPmList. More...
 
int32_t insPpmList (t_rtcPacket *ppmPkt, uint8_t legMode)
 Legacy API. Calls PN_insPpmList. More...
 
int32_t insCpmList (t_rtcPacket *cpmPkt)
 Legacy API. Calls PN_insCpmList. More...
 
void configureSync0Pin ()
 
void ptcpConfigureSyncFwd (ptcpPortStatus_t state)
 Legacy API, calls PN_PTCP_configureSyncFwd. More...
 
void PN_EmacRegisterProtocolCallback (void *callBackPtr, void *userArg)
 Legacy API, Used to register RX Callback. More...
 
void PN_EmacRegisterPort0ISRCallback (ICSS_EMAC_CallBack callBack, void *userArg)
 Legacy API, Used to register Link ISR Callback. More...
 
void PN_EmacRegisterPort1ISRCallback (ICSS_EMAC_CallBack callBack, void *userArg)
 Legacy API, Used to register Link ISR Callback. More...
 
void PN_purgeTable (uint8_t portNum)
 Legacy API, Used to purgeTable. More...
 
int32_t setMrpPortState (uint8_t portNumber, uint8_t pState)
 Legacy API, Used to call PN_MRP_setPortState. More...
 
int32_t getMrpPortState (uint8_t portNumber, uint8_t *pState)
 Legacy API, Used to call PN_MRP_getPortState. More...
 
int32_t cfgRtcMem (uint8_t ar, uint16_t size)
 Legacy API. Calls PN_cfgRtcMem. More...
 
int32_t allocPkt (t_rtcPacket **pPkt, uint8_t type)
 Legacy API, Used to call PN_allocPkt. More...
 
void ptcpGetSyncInfo (ptcpSyncInfo_t *syncInfo)
 Legacy API, Used to call PN_PTCP_getSyncInfo. More...
 
void ptcpRegisterDelayUpdateCall (ptcpCallBack_t callBack)
 Legacy API, Used to call PN_PTCP_registerDelayUpdateCall. More...
 
void ptcpRegisterSyncStatusCall (ptcpCallBack_t callBack)
 Legacy API, Used to call PN_PTCP_registerSyncStatusCall. More...
 
void ptcpSetPllWindow (uint32_t pllWindowSize)
 Legacy API, Used to call PN_PTCP_setPllWindow. More...
 
void ptcpSetSyncTimeoutFactor (uint32_t syncTimeoutFactor)
 Legacy API, Used to call PN_PTCP_registerSyncStatusCall. More...
 
void ptcpSetSyncUUID (uint8_t *subdomainUUID)
 Legacy API, Used to call PN_PTCP_setSyncUUID. More...
 
void registerCpmCall (pnCallBack_t callBack)
 Legacy API, Used to call PN_registerCpmCall. More...
 
void registerStatCall (pnCallBack_t callBack)
 Legacy API, Used to call PN_registerStatCall. More...
 
uint8_t * relPpmBuff (t_rtcPacket *pkt)
 Legacy API, Used to call PN_relPpmBuff. More...
 
int32_t rtcDisableISR ()
 Legacy API, Used to call PN_RTC_disableISR. More...
 

Macro Definition Documentation

◆ INTERFACE_MAC

#define INTERFACE_MAC   0

Interface macid index

◆ PORT1_MAC

#define PORT1_MAC   1

Port1 macid index

◆ PORT2_MAC

#define PORT2_MAC   2

Port2 macid index

Function Documentation

◆ PN_setHandle()

void PN_setHandle ( PN_Handle  pnHandle)

Stores the local copy of handle to support legacy APIs.

Parameters
pnHandleProfinet Handle

◆ PN_getPnHandle()

PN_Handle PN_getPnHandle ( )

Returns the ICSS EMAC LLD handle. This is used to maintain the old APIs that doesn't use the Handle based scheme.

Return values
returnsProfinet Handle

◆ PN_EmacSocMACAddrGet()

uint8_t PN_EmacSocMACAddrGet ( PN_Handle  pnHandle,
uint8_t  instance,
uint8_t *  macId 
)

Returns the MAC Addr for ports. User can implement this as required.

Parameters
pnHandleProfinet Handle
instancePort ID - INTERFACE_MAC, PORT1_MAC, PORT2_MAC
[out]macIdstores the MACID in the pointer
Return values
E_FAILon failure, S_PASS on success

◆ setStaticFilterTable()

int32_t setStaticFilterTable ( const uint8_t *  macAddr,
uint8_t  ctrl,
uint8_t  portNumber,
uint8_t  table 
)

Legacy API. Calls PN_setStaticFilterTable.

Parameters
[in]macAddrMAC Address for which the reception or forward has to be enabled or disabled
Following are the valid ranges of multicast addresses:
(01-0E-CF-00-00-00 TO 01-0E-CF-00-05-FF)
(01-15-4E-00-00-00 TO 01-15-4E-00-00-1F)
(01-80-C2-00-00-00 TO 01-80-C2-00-00-1F)
[in]ctrlA MAC address can be configured using one of four valid configuration for reception and foward
For example, if MAC address is called with NO_RCV_NO_FWD then it's reception and forwarding will be disabled
NO_RCV_NO_FWD
RCV_NO_FWD
NO_RCV_FWD
RCV_FWD
[in]portNumberPort on which reception and forwarding is configured for a MAC address PORT1 (1)
PORT2 (2)
[in]tableThere are two sets of table one for BLOCKING state and second one for FORWARDING state
BLOCKING
FORWARDING
Return values
0on success

◆ setRtc3PortStatus()

int32_t setRtc3PortStatus ( uint8_t  portNumber,
uint8_t  status 
)

Legacy API, calls PN_setRtc3PortStatus.

If the status of a port is set to UP or RUN then firmware internally enables Phase Management on that port.

Parameters
[in]portNumberPort whose status has to be configured
PORT1 (1)
PORT2 (2)
[in]statusThere are three valid values of the RTClass3 port status
OFF
UP
RUN
Return values
0on success

◆ getLastCpm()

uint8_t* getLastCpm ( t_rtcPacket pkt)

Legacy API. Calls PN_getLastCpm.

Parameters
pktpointer to packet object
Returns
buffer PROC buffer address

◆ setRedGuard()

int32_t setRedGuard ( uint16_t  validLowerFrameId,
uint16_t  validUpperFrameId 
)

Legacy API. Calls PN_setRedGuard.

Received RTC3 frames are dropped if their FID doesn't fall in the range set by the Red Guard.

Parameters
[in]validLowerFrameIdLower value of RTC3 FID for the Red Guard
Valid range is 0x0100 to 0x0FFF
[in]validUpperFrameId
Valid range is 0x0100 to 0x0FFF and equal or greater then validLowerFrameId
Return values
0on success

◆ setMaxLineRxDelay()

int32_t setMaxLineRxDelay ( uint8_t  portNumber,
int32_t  maxLineRxDelayValue 
)

Legacy API. Calls PN_setMaxLineRxDelay.

This value is provided by the PLC when it establishes connection with the device.

Parameters
[in]portNumberPort for which receive line delay is configured
PORT1 (1)
PORT2 (2)
[in]maxLineRxDelayValueLine delay as seen by the PLC at a port. This value is computed by the PLC/Engineering tool.
Return values
0on success

◆ setMaxBridgeDelay()

int32_t setMaxBridgeDelay ( int32_t  maxBridgeDelayValue)

Legacy API. Calls PN_setMaxBridgeDelay.

Parameters
[in]maxBridgeDelayValue
Valid value for our device is 2900ns
This value is defined in the GSD
Return values
0on success

◆ setYellowPeriod()

int32_t setYellowPeriod ( int32_t  yellowPeriodTime)

Legacy API. Calls PN_setYellowPeriod.

Parameters
[in]yellowPeriodTimeLength of the yellow period
Valid value is 125 us as our device does not support fragmentation
Return values
0on success

◆ mapPhaseToProfile()

int32_t mapPhaseToProfile ( int32_t  portNumber,
int32_t  phaseNumber,
int32_t  profileNumberRx,
int32_t  profileNumberTx 
)

Legacy API. Calls PN_mapPhaseToProfile.

A phase can be mapped to different profiles for Receive (Rx) and Transmit (Tx) on a port.

Parameters
[in]portNumberPort on which phase to profile mapping has to be done
PORT1 (1)
PORT2 (2)
[in]phaseNumberIRT Phase Number
Valid values are from 1 to 16
[in]profileNumberRxProfile number mapped for Receive
Valid values are from 1 to 5
[in]profileNumberTxProfile number mapped for Transmit
Valid values are from 1 to 5
Return values
0on success

◆ setProfile()

int32_t setProfile ( int32_t  portNumber,
int32_t  profileNumber,
int32_t  rxSoGValue,
int32_t  txSoGValue 
)

Legacy API. Calls PN_setProfile In a profile the start of green time in a cycle for Receive (Rx) and Transmit (Tx) is set for a port.

Parameters
[in]portNumberPort for which a profile is configured
PORT1 (1)
PORT2 (2)
[in]profileNumberFive profiles can be defined for a port
Valid values are from 1 to 5
[in]rxSoGValueStart of Green value for receive at the port
Valid value can range from 0 to the max of cycle time
[in]txSoGValueStart of Green value for transmit at the port
Valid value can range from 0 to the max of cycle time
Return values
0on success

◆ setDcpFilterStationName()

int32_t setDcpFilterStationName ( const uint8_t *  dcpNameOfStation,
uint8_t  lengthOfStationName 
)

Legacy API. Calls PN_setDcpFilterStationName.

Parameters
[in]dcpNameOfStationPointer to the array which contains the station name
[in]lengthOfStationNameLength of the station name. Valid values are from 0 to 240. If the length is configured as zero then all DCP Ident request are passed to host.
Return values
0on success

◆ TxPacketOS()

int32_t TxPacketOS ( const uint8_t *  srcAddress,
int32_t  portNumber,
int32_t  queuePriority,
int32_t  lengthOfPacket 
)

Legacy API. Calls PN_OS_txPacket.

this is using a critical section to protect re-entry of TX function the protection scheme is borrowed from NDK and we use their code too... this requires to adhere to NDK priority scheme

Parameters
srcAddresspointer to TX packet
portNumberoutput port number
queuePriorityoutput queue priority
lengthOfPacketTX packet length (without CRC)

◆ PN_RxPktInfo()

int32_t PN_RxPktInfo ( int32_t *  portNumber,
int32_t *  queueNumber 
)
 Legacy API. Calls ICSS_EmacRxPktInfo
Parameters
[out]portNumberReturn pointer of port number where frame was received
[out]queueNumberReturn pointer of host queue where the received frame is queued
Return values
none

◆ PN_RxPktGet()

int32_t PN_RxPktGet ( uint32_t  destAddress,
int32_t  queueNumber,
int32_t *  port,
int32_t *  more 
)
Legacy API. Calls ICSS_EmacRxPktGet
Parameters
[in]destAddressBase address of data buffer where received frame has to be stored
[in]queueNumberReceive queue from which frame has to be copied
[in]portReturns port number on which frame was received
[out]moreReturns more which is set to 1 if there are more frames in the queue
Return values
Lengthof the frame received in number of bytes or -1 on Failure

◆ PN_findMAC()

uint8_t PN_findMAC ( uint8_t *  macId)

Legacy API calls findMAC.

Parameters
macIdMAC ID which is to be found
Return values
portNumberwhere the MAC ID exists, 0 means not found 1 means port 0 and 2 means port 1

◆ setCpmDHT()

int32_t setCpmDHT ( uint16_t  dht,
uint8_t  pos 
)

Legacy API. Calls PN_setCpmDHT.

Parameters
dhtData hold timeout value (lost count * reduction ration)*
posposition of CPM descriptor Valid Range 0-7
Return values
0on success
<0if failure

◆ setBaseClock()

int32_t setBaseClock ( uint16_t  factor)

Legacy API, calls PN_setBaseClock.

Parameters
factorClock send factor: min value 3, max value 128
Return values
Slotnumber (>=0)
<0if failure

◆ clearList()

int32_t clearList ( uint8_t  list)

◆ iRtcEnableIsr()

int32_t iRtcEnableIsr ( )

Enables the PN interrupts. Legacy API. Calls PN_RTC_enableISR.

Return values
0on Success

◆ delPmList()

int32_t delPmList ( t_rtcPacket pmPkt)

Legacy API. Calls PN_delPmList.

Parameters
pmPktpointer to RTC packet to be deleted from list
Return values
negativevalue on error, zero on success
  • stop sending the CPM/PPM packet (clears active bit) and clear buffer usage
  • clears the ARgroup relation
  • remove packet from shadow descriptor list and toggle lists

◆ insPpmList()

int32_t insPpmList ( t_rtcPacket ppmPkt,
uint8_t  legMode 
)

Legacy API. Calls PN_insPpmList.

Parameters
ppmPktpointer to PPM packet to be inserted in list
legModeTRUE(1): enables legacy mode support (same packet sent as RTC1 with RR=128 during startup)
Return values
negativevalue on error, zero on success

this now manages single RED packet and index list processing in general it will call toggleList() in case of a good setup

◆ insCpmList()

int32_t insCpmList ( t_rtcPacket cpmPkt)

Legacy API. Calls PN_insCpmList.

Parameters
cpmPktpointer to CPM packet to be inserted in list
Return values
negativevalue on error, zero on success

processes list toggling no index list setup for CPM so far

currently we do not distinguish between green and red packets also there are no checks on receive at correct time or phase so that fields are currently not set!

◆ configureSync0Pin()

void configureSync0Pin ( )

◆ ptcpConfigureSyncFwd()

void ptcpConfigureSyncFwd ( ptcpPortStatus_t  state)

Legacy API, calls PN_PTCP_configureSyncFwd.

Parameters
[in]statedisable /enable

◆ PN_EmacRegisterProtocolCallback()

void PN_EmacRegisterProtocolCallback ( void *  callBackPtr,
void *  userArg 
)

Legacy API, Used to register RX Callback.

Parameters
[in]callBackPtrFunction pointer for RX Callback
[in]userArgUser params for callBackPtr

◆ PN_EmacRegisterPort0ISRCallback()

void PN_EmacRegisterPort0ISRCallback ( ICSS_EMAC_CallBack  callBack,
void *  userArg 
)

Legacy API, Used to register Link ISR Callback.

Parameters
[in]callBackFunction pointer for Link ISR Callback
[in]userArgUser params for callBack

◆ PN_EmacRegisterPort1ISRCallback()

void PN_EmacRegisterPort1ISRCallback ( ICSS_EMAC_CallBack  callBack,
void *  userArg 
)

Legacy API, Used to register Link ISR Callback.

Parameters
[in]callBackFunction pointer for Link ISR Callback
[in]userArgUser params for callBack

◆ PN_purgeTable()

void PN_purgeTable ( uint8_t  portNum)

Legacy API, Used to purgeTable.

Parameters
[in]portNumPort number to purge learning table

◆ setMrpPortState()

int32_t setMrpPortState ( uint8_t  portNumber,
uint8_t  pState 
)

Legacy API, Used to call PN_MRP_setPortState.

Parameters
[in]portNumberPort number to purge learning table
[in]pStateSet MRP state

◆ getMrpPortState()

int32_t getMrpPortState ( uint8_t  portNumber,
uint8_t *  pState 
)

Legacy API, Used to call PN_MRP_getPortState.

Parameters
[in]portNumberPort number to purge learning table
[out]pStateReturn MRP state

◆ cfgRtcMem()

int32_t cfgRtcMem ( uint8_t  ar,
uint16_t  size 
)

Legacy API. Calls PN_cfgRtcMem.

Parameters
arnumber of allowed number of ARs (symmetrical PPM/CPM) valid values only: 1, 2, 4, 8
sizeRTC payload size (see below)
Return values
negativevalue on error, zero on success

configuration function for static PPM buffer allocation currently only supports symmetric PPM config with same max size e.g.

  • 2 * 1440 bytes payload
  • 4 * 720 bytes
  • 8 * 360 bytes (lower size is ok...)

PPM buffers will be allocated in buffer blocks 0/1 evenly distributed Start addresses are only valid for PRU1/Port 1 TX... Port 2 PPM needs to be adapted with correct offset at creation of PPM descriptor as the port is not known yet.

◆ allocPkt()

int32_t allocPkt ( t_rtcPacket **  pPkt,
uint8_t  type 
)

Legacy API, Used to call PN_allocPkt.

Parameters
[out]pPkta packet object pointer
typeCPM or PPM
Return values
indexin the list on success
<0if failure

◆ ptcpGetSyncInfo()

void ptcpGetSyncInfo ( ptcpSyncInfo_t syncInfo)

Legacy API, Used to call PN_PTCP_getSyncInfo.

◆ ptcpRegisterDelayUpdateCall()

void ptcpRegisterDelayUpdateCall ( ptcpCallBack_t  callBack)

Legacy API, Used to call PN_PTCP_registerDelayUpdateCall.

◆ ptcpRegisterSyncStatusCall()

void ptcpRegisterSyncStatusCall ( ptcpCallBack_t  callBack)

Legacy API, Used to call PN_PTCP_registerSyncStatusCall.

◆ ptcpSetPllWindow()

void ptcpSetPllWindow ( uint32_t  pllWindowSize)

Legacy API, Used to call PN_PTCP_setPllWindow.

◆ ptcpSetSyncTimeoutFactor()

void ptcpSetSyncTimeoutFactor ( uint32_t  syncTimeoutFactor)

Legacy API, Used to call PN_PTCP_registerSyncStatusCall.

◆ ptcpSetSyncUUID()

void ptcpSetSyncUUID ( uint8_t *  subdomainUUID)

Legacy API, Used to call PN_PTCP_setSyncUUID.

◆ registerCpmCall()

void registerCpmCall ( pnCallBack_t  callBack)

Legacy API, Used to call PN_registerCpmCall.

◆ registerStatCall()

void registerStatCall ( pnCallBack_t  callBack)

Legacy API, Used to call PN_registerStatCall.

◆ relPpmBuff()

uint8_t* relPpmBuff ( t_rtcPacket pkt)

Legacy API, Used to call PN_relPpmBuff.

◆ rtcDisableISR()

int32_t rtcDisableISR ( )

Legacy API, Used to call PN_RTC_disableISR.