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... | |
enum buffLocks |
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.
pkt | pointer to packet object |
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
pnHandle | Profinet Handle |
pkt | pointer to packet object |
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.
pnHandle | Profinet Handle |
pkt | pointer to packet object |
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
pnHandle | Profinet Handle |
pkt | pointer to packet object |
0 | buffers swapped |
1 | buffers swapped and overrun detected This indicates the validLast flag was already set, and the stack has missed to consume a CPM packet |
-1 | error - wrong packet type |
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)
[in] | pnHandle | Profinet Handle |
pkt | pointer to packet object |
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.
[in] | pruicssHwAttrs | PRUICSS HW Attributes for base addresses |
[in] | pos | CPM descriptor position Valid Range 0-7 |
[in] | buff | Indicates 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 |
0 | on success |
<0 | if failure |