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_cfgPN * | PN_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 void(* pnCallBack_t) (void *arg, uint8_t arg2) |
Callback function for processing Profinet IRQs.
arg | |
arg2 |
none |
void PN_cpmIsrHandler | ( | void * | arg | ) |
Profinet CPM ISR handler.
[in] | arg |
void PN_ppmIsrHandler | ( | void * | arg | ) |
Profinet PPM ISR handler.
[in] | arg |
void PN_dhtIsrHandler | ( | void * | arg | ) |
Profinet DHT ISR handler.
[in] | arg |
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
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_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.
[in] | pruicssHwAttrs | PRUICSS HW attrs |
dht | Data hold timeout value (lost count * reduction ration)* | |
pos | position of CPM descriptor Valid Range 0-7 |
0 | on success |
<0 | if failure |
int32_t PN_cfgRtcMem | ( | PN_Handle | pnHandle, |
uint8_t | ar, | ||
uint16_t | size | ||
) |
Configures the driver memory.
pnHandle | Profinet Handle |
ar | number of allowed number of ARs (symmetrical PPM/CPM) valid values only: 1, 2, 4, 8 |
size | RTC payload size (see below) |
negative | value on error, zero on success |
configuration function for static PPM buffer allocation currently only supports symmetric PPM config with same max size e.g.
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.
int32_t PN_deCfgRtcMem | ( | PN_Handle | pnHandle | ) |
De-configures the driver memory.
[in] | pnHandle | PROFINET Handle |
negative | value on error, zero on success |
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.
[out] | pPkt | pointer to packet object to be initialized |
[in] | type | CPM or PPM |
0 | on success |
<0 | if failure |
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.
index | in the list on success |
<0 | if failure |
int32_t PN_freePkt | ( | t_rtcPacket * | pPkt | ) |
Free a packet object for re-use Utility API for stack. Doesn't update anything in driver.
[out] | pPkt | Pointer to previously allocated t_rtcPacket |
0 | on success |
<0 | if failure |
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
[in] | pnHandle | Profinet Handle |
ppmPkt | pointer to PPM packet to be inserted in list | |
legMode | TRUE(1): enables legacy mode support (same packet sent as RTC1 with RR=128 during startup) |
0 | on success |
<0 | if failure |
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
[in] | pnHandle | Profinet Handle |
pmPkt | pointer to RTC packet to be deleted from list |
0 | on success |
<0 | if failure |
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!
[in] | pnHandle | Profinet Handle |
cpmPkt | pointer to CPM packet to be inserted in list |
0 | on success |
<0 | if failure |
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)
Updates the t_ppmDesc FrameIndex and FrameReference pointers in the PPM ACTIVE_LIST
pnHandle | Profinet Handle | |
[in] | ppmPkt | current packet data object pointer |
0 | on success |
<0 | if failure |
t_cfgPN* PN_getConfig | ( | void | ) |
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
[in] | pnHandle | Profinet Handle |
0 | on Success |
<0 | if Failure |
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 | ||
) |
t_cpmDesc |