AM64x MCU+ SDK  08.02.00

Introduction

Functions

uint8_t * PN_getPpmBuff (t_rtcPacket *pkt)
 Return a pointer to buffer indicated by NEXT
This will be the next available free buffer(in the triple buffer scheme). Stack can now fill this buffer and once done call PN_relPpmBuff to indicate the PRU on new data. More...
 
uint8_t * PN_relPpmBuff (PN_Handle pnHandle, t_rtcPacket *pkt)
 Swap NEXT with LAST and return new NEXT address
. More...
 
int32_t PN_checkLastPPM (PN_Handle pnHandle, t_rtcPacket *pkt)
 Update proc pointer in paket object and udpate descriptor if there is a new last buffer. More...
 
int32_t PN_nextCpmRdy (PN_Handle pnHandle, t_rtcPacket *pkt)
 Swap CPM NEXT with LAST and set validLast flag. More...
 
uint8_t * PN_getLastCpm (PN_Handle pnHandle, t_rtcPacket *pkt)
 Swap CPM LAST with PROC if validLast is true, clear validLast flag. More...
 
int32_t PN_cpmBuffLock (PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t pos, buffLocks buff)
 Locks CPM Buffer indicating that ARM is consuming the particular buffer. PRU cannot write to this buffer. More...
 

Enumerations

enum  buffLocks { BUFF1 = 0, BUFF2, BUFF3, NOBUFF }
 Enumerates the Buffer indexes of Triple buffers. Buffer lock needs to be aligned with firmware. More...
 

Enumeration Type Documentation

◆ buffLocks

enum buffLocks

Enumerates the Buffer indexes of Triple buffers. Buffer lock needs to be aligned with firmware.

Enumerator
BUFF1 

Buffer Index 0

BUFF2 

Buffer Index 1

BUFF3 

Buffer Index 2

NOBUFF 

No Buffer

Function Documentation

◆ PN_getPpmBuff()

uint8_t* PN_getPpmBuff ( t_rtcPacket pkt)

Return a pointer to buffer indicated by NEXT
This will be the next available free buffer(in the triple buffer scheme). Stack can now fill this buffer and once done call PN_relPpmBuff to indicate the PRU on new data.

Parameters
pktpointer to packet object
Returns
pointer to NEXT packet buffer address

◆ PN_relPpmBuff()

uint8_t* PN_relPpmBuff ( PN_Handle  pnHandle,
t_rtcPacket pkt 
)

Swap NEXT with LAST and return new NEXT address
.

This API is called when stack has completed updating data to the buffer received from PN_getPpmBuff. This indicates the PRU about data update and updates the ACTIVE_LIST directly. Stack can now start filling data in the NEXT buffer returned

Parameters
pnHandleProfinet Handle
pktpointer to packet object
Returns
pointer to NEXT packet buffer address

◆ PN_checkLastPPM()

int32_t PN_checkLastPPM ( PN_Handle  pnHandle,
t_rtcPacket pkt 
)

Update proc pointer in paket object and udpate descriptor if there is a new last buffer.

Called from the PN_ppmIsrHandler. The PRU firmware checks if there is a new buffer available to send by checking the validLast flag in t_rtcPacket . If available swaps the proc buffer(which is currently being send by the PRU), with the last buffer(the buffer which holds the latest data produced by the stack). This ensures that the PRU sends out latest available valid data at any point of time.

Parameters
pnHandleProfinet Handle
pktpointer to packet object
Returns
1: new buffer activated
0: no buffer update <0: Not a PPM packet

◆ PN_nextCpmRdy()

int32_t PN_nextCpmRdy ( PN_Handle  pnHandle,
t_rtcPacket pkt 
)

Swap CPM NEXT with LAST and set validLast flag.

Called from PN_cpmIsrHandler , when a new CPM frame has arrived and sets the validLast flag in t_rtcPacket . When the stack is ready to receive an updated CPM packet, it calls PN_getLastCpm and this LAST packet is consumed by the stack

Parameters
pnHandleProfinet Handle
pktpointer to packet object
Return values
0buffers swapped
1buffers swapped and overrun detected
This indicates the validLast flag was already set, and the stack has missed to consume a CPM packet
-1error - wrong packet type

◆ PN_getLastCpm()

uint8_t* PN_getLastCpm ( PN_Handle  pnHandle,
t_rtcPacket pkt 
)

Swap CPM LAST with PROC if validLast is true, clear validLast flag.

When the stack is ready to consume a new CPM packet, this API is called. This swaps the LAST buffer(which has the latest updated/consumed data by the PRU firmware) and the PROC buffer(which is being currently consumed by the stack). This also locks the new PROC buffer indicating that the Stack is consuming this buffer(PRU won't write to this buffer)

Parameters
[in]pnHandleProfinet Handle
pktpointer to packet object
Returns
buffer PROC buffer address

◆ PN_cpmBuffLock()

int32_t PN_cpmBuffLock ( PRUICSS_HwAttrs const *  pruicssHwAttrs,
uint8_t  pos,
buffLocks  buff 
)

Locks CPM Buffer indicating that ARM is consuming the particular buffer. PRU cannot write to this buffer.

Parameters
[in]pruicssHwAttrsPRUICSS HW Attributes for base addresses
[in]posCPM descriptor position Valid Range 0-7
[in]buffIndicates the index of Buffer Valid values for "buff" are BUFF1 - Indicating the first buffer BUFF2 - Indicating the second buffer BUFF3 - Indicating the third buffer NOBUFF - Indicates No buffer selected
Return values
0on success
<0if failure