AM64x MCU+ SDK  08.02.00

Introduction

Data Structures

struct  t_ppmDesc
 
struct  t_ppmBlock
 
struct  t_cpmBlock
 
struct  t_rtcPacket
 real-time packet structure More...
 
struct  t_descList
 
struct  t_cfgPN
 

Functions

void PN_cpmIsrHandler (void *arg)
 Profinet CPM ISR handler. More...
 
void PN_ppmIsrHandler (void *arg)
 Profinet PPM ISR handler. More...
 
void PN_dhtIsrHandler (void *arg)
 Profinet DHT ISR handler. More...
 
struct __attribute__ ((packed)) cpmDesc
 
int32_t PN_togglePpmList (PN_Handle pnHandle, t_rtcPacket *pktID, uint8_t ppmMrpPortShift)
 
int32_t PN_writePpmDesc (PN_Handle pnHandle, t_rtcPacket *pPkt, uint8_t pos)
 
int32_t PN_writeCpmDesc (PN_Handle pnHandle, t_rtcPacket *pPkt, uint8_t pos)
 
int32_t PN_readPpmDesc (PN_Handle pnHandle, t_ppmDesc *pDesc, uint8_t pos, uint8_t act)
 
int32_t PN_readCpmDesc (PN_Handle pnHandle, t_cpmDesc *pDesc, uint8_t pos)
 
int32_t PN_setIndexInt (PN_Handle pnHandle, t_listIndex *index)
 
int8_t PN_getLastCpmBuffIndex (PN_Handle pnHandle, uint8_t pos)
 
int32_t PN_getIndexInt (t_listIndex *index)
 
int32_t PN_emptyList (t_descList *pList)
 
int32_t PN_writeSortedList (PN_Handle pnHandle, t_rtcPacket *pPkts)
 
int8_t PN_getDhtStatusEvent (PN_Handle pnHandle, t_rtcPacket **pktID)
 
int8_t PN_getListToggleStatusEvent (PN_Handle pnHandle, t_rtcPacket **pktID)
 
int8_t PN_getShadowIndex (PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t lType)
 
int32_t PN_getPmStatus (PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t dir, uint8_t numPm)
 
int32_t PN_setPPMARlink (PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t ARgroup, uint8_t PpmNum)
 
int32_t PN_setCPMARlink (PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t ARgroup, uint8_t CpmNum)
 
int32_t PN_setCpmDHT (PRUICSS_HwAttrs const *pruicssHwAttrs, uint16_t dht, uint8_t pos)
 Sets the Data hold timer timeout value for a given descriptor. More...
 
int32_t PN_cfgRtcMem (PN_Handle pnHandle, uint8_t ar, uint16_t size)
 Configures the driver memory. More...
 
int32_t PN_deCfgRtcMem (PN_Handle pnHandle)
 De-configures the driver memory. More...
 
int32_t PN_initPacket (t_rtcPacket *pPkt, uint8_t type)
 Initialize packet according to type Utility API for stack. Doesn't update anything in driver. More...
 
int32_t PN_allocPkt (PN_Handle pnHandle, t_rtcPacket **pPkt, uint8_t type)
 Allocate a packet object from internal array Initializes pPkt with PN_initPacket Find the next freeslot in t_ppmBlock t_cpmBlock, update the pBuffer address. More...
 
int32_t PN_freePkt (t_rtcPacket *pPkt)
 Free a packet object for re-use Utility API for stack. Doesn't update anything in driver. More...
 
int32_t PN_insPpmList (PN_Handle pnHandle, t_rtcPacket *ppmPkt, uint8_t legMode)
 Inserts PPM descriptor data into the lists. More...
 
int32_t PN_delPmList (PN_Handle pnHandle, t_rtcPacket *pmPkt)
 Deletes a descriptor from PPM or CPM list. More...
 
int32_t PN_insCpmList (PN_Handle pnHandle, t_rtcPacket *cpmPkt)
 Insert a packet into descriptor list and lock this buffer, indicating that ARM is consuming this buffer
. More...
 
int32_t PN_setCpmState (PN_Handle pnHandle, t_rtcPacket *pPkt, uint8_t val)
 
int32_t PN_setPpmState (PRUICSS_HwAttrs const *pruicssHwAttrs, t_rtcPacket *pPkt)
 
int32_t PN_chgPpmBuffer (PN_Handle pnHandle, t_rtcPacket *ppmPkt)
 Update PPM descriptor to new buffer address (based on ARM buffer address) More...
 
t_cfgPNPN_getConfig (void)
 
int32_t PN_initRtcDrv (PN_Handle pnHandle)
 Initializes RTC driver. More...
 
int32_t PN_getList (t_descList **pList, uint8_t dir)
 
int32_t PN_clearList (PN_Handle pnHandle, uint8_t list)
 
int32_t PN_resetARlink (PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t ARgroup, uint8_t pmNum, uint8_t dir)
 

Typedefs

typedef void(* pnCallBack_t) (void *arg, uint8_t arg2)
 Callback function for processing Profinet IRQs. More...
 

Typedef Documentation

◆ pnCallBack_t

typedef void(* pnCallBack_t) (void *arg, uint8_t arg2)

Callback function for processing Profinet IRQs.

Parameters
arg
arg2
Return values
none

Function Documentation

◆ PN_cpmIsrHandler()

void PN_cpmIsrHandler ( void *  arg)

Profinet CPM ISR handler.

Parameters
[in]arg

◆ PN_ppmIsrHandler()

void PN_ppmIsrHandler ( void *  arg)

Profinet PPM ISR handler.

Parameters
[in]arg

◆ PN_dhtIsrHandler()

void PN_dhtIsrHandler ( void *  arg)

Profinet DHT ISR handler.

Parameters
[in]arg

◆ __attribute__()

struct __attribute__ ( (packed)  )

< 16 bit offset into start address pointer for triple buffer CPM (fixed address). Points into cpm triple buffer start addresses

< 11 bits of frame length including VLAN and FCS, set by host only. PRU may verify incoming frame on length which needs to be flexible in terms of stripped VLAN tag. Bit12.15 need to be zero

< 16 bit absolute address pointing to Profinet data of current index buffer. This pointer masks VLAN tag offset. Points to first byte after FID.

< Current index of data source which is PRU on CPM
Two bits used for pointing to index 1,2,3. Bit 2-7 needs to be 0.
00 = buffer 0
01 = buffer 1
10 = buffer 2

< Bit 0: 1 = VLAN tag present
PORT: Bit 1: 0 = Port 1, 1: Port 2
RCV_PERIOD: Bit 2: 0 = red, 1 = green (error detection on host. optional for AM335x)
Bit 3..7: reserved 

< FrameID as provided by engineering. Set by host

< TODO

< TODO

< Reduction Ratio for red period is in (RR-1) where RR is 1,2,4,8,16.
Reduction Ration for green period is (RR-1) where RR is 1,2 ,4 …512. 

< used for DHT update: Phase starts from 1 .. RR

◆ PN_togglePpmList()

int32_t PN_togglePpmList ( PN_Handle  pnHandle,
t_rtcPacket pktID,
uint8_t  ppmMrpPortShift 
)

◆ PN_writePpmDesc()

int32_t PN_writePpmDesc ( PN_Handle  pnHandle,
t_rtcPacket pPkt,
uint8_t  pos 
)

◆ PN_writeCpmDesc()

int32_t PN_writeCpmDesc ( PN_Handle  pnHandle,
t_rtcPacket pPkt,
uint8_t  pos 
)

◆ PN_readPpmDesc()

int32_t PN_readPpmDesc ( PN_Handle  pnHandle,
t_ppmDesc pDesc,
uint8_t  pos,
uint8_t  act 
)

◆ PN_readCpmDesc()

int32_t PN_readCpmDesc ( PN_Handle  pnHandle,
t_cpmDesc pDesc,
uint8_t  pos 
)

◆ PN_setIndexInt()

int32_t PN_setIndexInt ( PN_Handle  pnHandle,
t_listIndex index 
)

◆ PN_getLastCpmBuffIndex()

int8_t PN_getLastCpmBuffIndex ( PN_Handle  pnHandle,
uint8_t  pos 
)

◆ PN_getIndexInt()

int32_t PN_getIndexInt ( t_listIndex index)

◆ PN_emptyList()

int32_t PN_emptyList ( t_descList pList)

◆ PN_writeSortedList()

int32_t PN_writeSortedList ( PN_Handle  pnHandle,
t_rtcPacket pPkts 
)

◆ PN_getDhtStatusEvent()

int8_t PN_getDhtStatusEvent ( PN_Handle  pnHandle,
t_rtcPacket **  pktID 
)

◆ PN_getListToggleStatusEvent()

int8_t PN_getListToggleStatusEvent ( PN_Handle  pnHandle,
t_rtcPacket **  pktID 
)

◆ PN_getShadowIndex()

int8_t PN_getShadowIndex ( PRUICSS_HwAttrs const *  pruicssHwAttrs,
uint8_t  lType 
)

◆ PN_getPmStatus()

int32_t PN_getPmStatus ( PRUICSS_HwAttrs const *  pruicssHwAttrs,
uint8_t  dir,
uint8_t  numPm 
)

◆ PN_setPPMARlink()

int32_t PN_setPPMARlink ( PRUICSS_HwAttrs const *  pruicssHwAttrs,
uint8_t  ARgroup,
uint8_t  PpmNum 
)

◆ PN_setCPMARlink()

int32_t PN_setCPMARlink ( PRUICSS_HwAttrs const *  pruicssHwAttrs,
uint8_t  ARgroup,
uint8_t  CpmNum 
)

◆ PN_setCpmDHT()

int32_t PN_setCpmDHT ( PRUICSS_HwAttrs const *  pruicssHwAttrs,
uint16_t  dht,
uint8_t  pos 
)

Sets the Data hold timer timeout value for a given descriptor.

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

◆ PN_cfgRtcMem()

int32_t PN_cfgRtcMem ( PN_Handle  pnHandle,
uint8_t  ar,
uint16_t  size 
)

Configures the driver memory.

Parameters
pnHandleProfinet Handle
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.

◆ PN_deCfgRtcMem()

int32_t PN_deCfgRtcMem ( PN_Handle  pnHandle)

De-configures the driver memory.

Parameters
[in]pnHandlePROFINET Handle
Return values
negativevalue on error, zero on success

◆ PN_initPacket()

int32_t PN_initPacket ( t_rtcPacket pPkt,
uint8_t  type 
)

Initialize packet according to type Utility API for stack. Doesn't update anything in driver.

Parameters
[out]pPktpointer to packet object to be initialized
[in]typeCPM or PPM
Return values
0on success
<0if failure

◆ PN_allocPkt()

int32_t PN_allocPkt ( PN_Handle  pnHandle,
t_rtcPacket **  pPkt,
uint8_t  type 
)

Allocate a packet object from internal array Initializes pPkt with PN_initPacket Find the next freeslot in t_ppmBlock t_cpmBlock, update the pBuffer address.

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

◆ PN_freePkt()

int32_t PN_freePkt ( t_rtcPacket pPkt)

Free a packet object for re-use Utility API for stack. Doesn't update anything in driver.

Parameters
[out]pPktPointer to previously allocated t_rtcPacket
Return values
0on success
<0if failure

◆ PN_insPpmList()

int32_t PN_insPpmList ( PN_Handle  pnHandle,
t_rtcPacket ppmPkt,
uint8_t  legMode 
)

Inserts PPM descriptor data into the lists.

This now manages single RED packet and index list processing in general
It will call PN_togglePpmList() in case of a good setup

Parameters
[in]pnHandleProfinet Handle
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
0on success
<0if failure

◆ PN_delPmList()

int32_t PN_delPmList ( PN_Handle  pnHandle,
t_rtcPacket pmPkt 
)

Deletes a descriptor from PPM or CPM list.

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

Parameters
[in]pnHandleProfinet Handle
pmPktpointer to RTC packet to be deleted from list
Return values
0on success
<0if failure

◆ PN_insCpmList()

int32_t PN_insCpmList ( PN_Handle  pnHandle,
t_rtcPacket cpmPkt 
)

Insert a packet into descriptor list and lock this buffer, indicating that ARM is consuming this buffer
.

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!

Parameters
[in]pnHandleProfinet Handle
cpmPktpointer to CPM packet to be inserted in list
Return values
0on success
<0if failure

◆ PN_setCpmState()

int32_t PN_setCpmState ( PN_Handle  pnHandle,
t_rtcPacket pPkt,
uint8_t  val 
)

◆ PN_setPpmState()

int32_t PN_setPpmState ( PRUICSS_HwAttrs const *  pruicssHwAttrs,
t_rtcPacket pPkt 
)

◆ PN_chgPpmBuffer()

int32_t PN_chgPpmBuffer ( PN_Handle  pnHandle,
t_rtcPacket ppmPkt 
)

Update PPM descriptor to new buffer address (based on ARM buffer address)

Updates the t_ppmDesc FrameIndex and FrameReference pointers in the PPM ACTIVE_LIST

Parameters
pnHandleProfinet Handle
[in]ppmPktcurrent packet data object pointer
Return values
0on success
<0if failure

◆ PN_getConfig()

t_cfgPN* PN_getConfig ( void  )

◆ PN_initRtcDrv()

int32_t PN_initRtcDrv ( PN_Handle  pnHandle)

Initializes RTC driver.

Initializes the lists, clears the data
Sets the base clock in IEP
Initializes the Interrupts

Parameters
[in]pnHandleProfinet Handle
Return values
0on Success
<0if Failure

◆ PN_getList()

int32_t PN_getList ( t_descList **  pList,
uint8_t  dir 
)

◆ PN_clearList()

int32_t PN_clearList ( PN_Handle  pnHandle,
uint8_t  list 
)

◆ PN_resetARlink()

int32_t PN_resetARlink ( PRUICSS_HwAttrs const *  pruicssHwAttrs,
uint8_t  ARgroup,
uint8_t  pmNum,
uint8_t  dir 
)

Variable Documentation

◆ t_cpmDesc

t_cpmDesc