Data Structures | |
struct | ptcpPortDelayVal_t |
Structure containing the port delay values of the local and remote. More... | |
struct | ptcpSyncInfo_t |
Structure containing current sync info. More... | |
struct | PNIO_TimeStamp |
struct | LatchVars |
struct | ptcp_iDelayResp_struct_t |
struct | currentPtcpStatus_t |
struct | deviceDelays_t |
struct | devicePortOffsets_t |
struct | debugDelay_t |
struct | debugSync_t |
struct | syncAnalysis_t |
Functions | |
void | PN_PTCP_isrHandler (void *arg) |
Profinet PTCP ISR handler. More... | |
void | PN_PTCP_registerSyncStatusCall (PN_Handle pnHandle, ptcpCallBack_t callBack) |
Registers the callback function for getting notifications about change in sync state. More... | |
void | PN_PTCP_registerDelayUpdateCall (PN_Handle pnHandle, ptcpCallBack_t callBack) |
Registers the callback function for getting notifications about new cable delay measurement. More... | |
void | PN_PTCP_registerSyncMonitorCall (PN_Handle pnHandle, ptcpSyncCallBack_t callBack) |
Registers the callback function for custom sync timeout monitor typedef void (ptcpSyncCallBack_t)(void arg1); arg1: pnHandle. More... | |
void | PN_PTCP_getDelayValues (PN_Handle pnHandle, ptcpPortDelayVal_t *portDelays, uint8_t portNum) |
Returns the current cable delay related values. More... | |
void | PN_PTCP_getLocalDelayValues (PN_Handle pnHandle, uint8_t portNum, uint32_t *outRxDelay, uint32_t *outTxDelay) |
Get the local port delay values. More... | |
void | PN_PTCP_getRemoteDelayValues (PN_Handle pnHandle, uint8_t portNum, uint32_t *outRxDelay, uint32_t *outTxDelay) |
Get the remote port delay values. More... | |
void | PN_PTCP_getSyncInfo (PN_Handle pnHandle, ptcpSyncInfo_t *syncInfo) |
Returns current sync status and other sync related info. More... | |
void | PN_PTCP_getSyncMasterAddress (PN_Handle pnHandle, uint8_t *addr) |
Get the sync Master address (MAC) More... | |
void | PN_PTCP_setPllWindow (PN_Handle pnHandle, uint32_t pllWindowSize) |
Sets the PLL window for sync handling. More... | |
void | PN_PTCP_setSyncTimeoutFactor (PN_Handle pnHandle, uint32_t syncTimeoutFactor) |
Sets the Sync timeout factor. More... | |
void | PN_PTCP_setTakeoverTimeoutFactor (PN_Handle pnHandle, uint32_t takeoverTimeoutFactor) |
Sets the takeover timeout factor. More... | |
void | PN_PTCP_setSyncUUID (PN_Handle pnHandle, uint8_t *subdomainUUID) |
Sets the sync UUID for the device. Application is also notified about the current sync status. . More... | |
void | PN_PTCP_configureSyncFwd (PRUICSS_HwAttrs const *pruicssHwAttrs, ptcpPortStatus_t state) |
Controls(enable/disable) the sync forwarding; by default it is enabled. More... | |
void | PN_PTCP_configureDelayMeasurement (PN_Handle pnHandle, uint8_t portNum, ptcpPortStatus_t state) |
Controls(enable/disable) the delay measurement process on a particular port. By default, delay measurement is enabled on both the ports. More... | |
void | PN_PTCP_configureDelayResp (PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNum, ptcpPortStatus_t state) |
void | PN_PTCP_start (PN_Handle pnHandle) |
Triggers the start of ptcp protocol Should be called from stack after initialization It only controls ARM side tasks of PTCP, not PRU. More... | |
void | PN_PTCP_ClockChange (PN_Handle pnHandle, uint32_t cycleTime) |
Handles the clock (IEP CMP0) change scenario. More... | |
void | PN_PTCP_reset (PN_Handle pnHandle) |
reset relevant data on start or sync timeout More... | |
void | PN_PTCP_init (PN_Handle pnHandle) |
Initializes the PTCP data structure and memory for PTCP pre-formatted packets. More... | |
void | PN_PTCP_delayMeasurement (PN_Handle pnHandle) |
void | PN_PTCP_resetDelayValues (PN_Handle pnHandle) |
void | PN_PTCP_smaDelayMeasurement (PN_Handle pnHandle) |
int32_t | PN_PTCP_lineDelayCalc (PN_Handle pnHandle, ptcp_iDelayResp_struct_t *ptcp_iDelayResp_parsed) |
int32_t | PN_PTCP_parseInDelayResp (ptcp_iDelayResp_struct_t *ptcp_iDelayResp_parsed, uint8_t *ptcp_iDelayResp_packet, uint8_t *ptcp_iDelayFupResp_packet, int32_t w_FUP) |
int32_t | PN_PTCP_cableDelayCalc (PN_Handle pnHandle, ptcp_iDelayResp_struct_t *ptcp_iDelayResp_parsed, uint8_t port) |
uint32_t | PN_PTCP_rotUint (uint32_t *input) |
uint16_t | PN_PTCP_rotUshort (uint16_t *input) |
int32_t | PN_PTCP_setupIsr (PN_Handle pnHandle) |
int32_t | PN_PTCP_enableIsr (PN_Handle pnHandle) |
void | PN_PTCP_syncHandling (PN_Handle pnHandle) |
void | PN_PTCP_syncIepAdjustment (PN_Handle pnHandle, int32_t ecapPeriod, uint32_t compensation) |
int32_t | PN_PTCP_parseSyncFields (PN_Handle pnHandle, volatile ptcpSyncInfo_t *ptcp_sync_parsed, uint8_t *sync_sblock) |
void | PN_PTCP_syncPreprocess (PN_Handle pnHandle, uint8_t ctrlByte) |
void | PN_PTCP_portDelaySmaCalc (PN_Handle pnHandle, uint8_t portNum) |
void | PN_PTCP_processDelayResponse (PN_Handle pnHandle, uint8_t portNum) |
void | PN_PTCP_resetDelayTimings (PN_Handle pnHandle, uint8_t portNum) |
int32_t | PN_PTCP_adjCtrDiff (PN_Handle pnHandle, int32_t ctrDiff) |
int32_t | PN_PTCP_absVal (int32_t num) |
void | PN_PTCP_syncTimeoutMonitor (PN_Handle pnHandle) |
void | PN_PTCP_taskSleep (uint32_t mSec) |
void | PN_PTCP_configureSync0Pin (PN_Handle pnHandle) |
int32_t | PN_PTCP_modFunc (int32_t num, uint32_t mod) |
void | PN_PTCP_triggerMeasurement (PN_Handle pnHandle) |
Typedefs | |
typedef void(* | ptcpCallBack_t) (uint32_t arg, uint32_t arg2) |
typedef void(* | ptcpSyncCallBack_t) (void *arg1) |
Enumerations | |
enum | ptcpPortStatus_t { disable = 0, enable = 1 } |
Enum for enable/disable states. More... | |
enum | syncState_t { OUT_OF_SYNC = 0, IN_SYNC, TAKEOVER_TIMEOUT, SYNC_TIMEOUT, SYNC_RESET } |
Enum for the various sync states. More... | |
Macros | |
#define | PRU_IEP_COUNT_REG 0x0C |
#define | PRU_IEP_CMP_CFG_REG 0x40 |
#define | PRU_IEP_CMP1_REG 0x4C |
#define | PRU_IEP_SYNC_PWIDTH_REG 0x110 |
#define | PRU_IEP_CAP_CFG_REG 0x10 |
#define | PTCP_ENABLE_FILTER |
#define | ISR_PTCP_NUM 24 |
#define | ISR_PTCP_NUM_ARM 124+32 |
#define | NUM_DELAYS_SMA 7 |
#define | NUM_DELAYS_BURST 5 |
#define | PTCP_NUM_PORTS 2 |
#define | MAX_SEQID 61435 |
#define | PTCP_DELAY_REQ_LEN 60 |
#define | MAX_CTR_VAL 512 |
#define | INTER_DEL_REQ_GAP 200000000 |
#define | INTER_DEL_REQ_GAP_MS 205 |
#define | INTER_DEL_REQ_BURST_GAP_MS 8205 |
#define | SYNC_INTERVAL 30000000 |
#define | PORT_RX_DELAY 220 |
#define | PORT_TX_DELAY 64 |
#define | DEBUG_DELAY_N_ITER 200 |
#define | DEBUG_SYNC_N_ITER 40000 |
#define | SYNC_FILTER_SIZE 8 |
#define | SYNC_ANALYSIS_N_ITER 100 |
#define | SYNC_ANALYSIS_N_RESETS 40 |
#define | LATCH0_EVENT 12/* Latch Event number */ |
#define | SYNC_SINGLE_ITER_SIZE 200 |
#define PRU_IEP_COUNT_REG 0x0C |
#define PRU_IEP_CMP_CFG_REG 0x40 |
#define PRU_IEP_CMP1_REG 0x4C |
#define PRU_IEP_SYNC_PWIDTH_REG 0x110 |
#define PRU_IEP_CAP_CFG_REG 0x10 |
#define PTCP_ENABLE_FILTER |
#define ISR_PTCP_NUM 24 |
#define ISR_PTCP_NUM_ARM 124+32 |
#define NUM_DELAYS_SMA 7 |
#define NUM_DELAYS_BURST 5 |
#define PTCP_NUM_PORTS 2 |
#define MAX_SEQID 61435 |
#define PTCP_DELAY_REQ_LEN 60 |
#define MAX_CTR_VAL 512 |
#define INTER_DEL_REQ_GAP 200000000 |
#define INTER_DEL_REQ_GAP_MS 205 |
#define INTER_DEL_REQ_BURST_GAP_MS 8205 |
#define SYNC_INTERVAL 30000000 |
#define PORT_RX_DELAY 220 |
#define PORT_TX_DELAY 64 |
#define DEBUG_DELAY_N_ITER 200 |
#define DEBUG_SYNC_N_ITER 40000 |
#define SYNC_FILTER_SIZE 8 |
#define SYNC_ANALYSIS_N_ITER 100 |
#define SYNC_ANALYSIS_N_RESETS 40 |
#define LATCH0_EVENT 12/* Latch Event number */ |
#define SYNC_SINGLE_ITER_SIZE 200 |
typedef void(* ptcpCallBack_t) (uint32_t arg, uint32_t arg2) |
typedef void(* ptcpSyncCallBack_t) (void *arg1) |
enum ptcpPortStatus_t |
enum syncState_t |
void PN_PTCP_isrHandler | ( | void * | arg | ) |
Profinet PTCP ISR handler.
[in] | arg |
void PN_PTCP_registerSyncStatusCall | ( | PN_Handle | pnHandle, |
ptcpCallBack_t | callBack | ||
) |
Registers the callback function for getting notifications about change in sync state.
pnHandle | Profinet Handle | |
[in] | callBack | Function pointer for callback function typedef void (*ptcpCallBack_t) (uint32_t arg1, uint32_t arg2); arg1: syncState_t, arg2: NULL |
void PN_PTCP_registerDelayUpdateCall | ( | PN_Handle | pnHandle, |
ptcpCallBack_t | callBack | ||
) |
Registers the callback function for getting notifications about new cable delay measurement.
pnHandle | Profinet Handle | |
[in] | callBack | Function pointer for callback function typedef void (*ptcpCallBack_t) (uint32_t arg1, uint32_t arg2); arg1: portNum (1 or 2), arg2: new cable delay |
void PN_PTCP_registerSyncMonitorCall | ( | PN_Handle | pnHandle, |
ptcpSyncCallBack_t | callBack | ||
) |
Registers the callback function for custom sync timeout monitor typedef void (ptcpSyncCallBack_t)(void arg1);
arg1: pnHandle.
pnHandle | Profinet Handle | |
[in] | callBack | Function pointer for callback function |
void PN_PTCP_getDelayValues | ( | PN_Handle | pnHandle, |
ptcpPortDelayVal_t * | portDelays, | ||
uint8_t | portNum | ||
) |
Returns the current cable delay related values.
pnHandle | Profinet Handle | |
[in] | portDelays | Reference to structure for ptcp delay values |
[in] | portNum | Port no. (1 or 2) for which delay values are requested |
void PN_PTCP_getLocalDelayValues | ( | PN_Handle | pnHandle, |
uint8_t | portNum, | ||
uint32_t * | outRxDelay, | ||
uint32_t * | outTxDelay | ||
) |
Get the local port delay values.
pnHandle | Profinet Handle | |
[in] | portNum | Port no. (1 or 2) for which delay values are requested |
[in] | outRxDelay | Pointer to Rx port delay variable |
[in] | outTxDelay | Pointer to Tx port delay variable |
void PN_PTCP_getRemoteDelayValues | ( | PN_Handle | pnHandle, |
uint8_t | portNum, | ||
uint32_t * | outRxDelay, | ||
uint32_t * | outTxDelay | ||
) |
Get the remote port delay values.
pnHandle | Profinet HAndle | |
[in] | portNum | Port no.(1 or 2) for which delay values are requested |
[in] | outRxDelay | Pointer to Rx port delay variable |
[in] | outTxDelay | Pointer to Tx port delay variable |
void PN_PTCP_getSyncInfo | ( | PN_Handle | pnHandle, |
ptcpSyncInfo_t * | syncInfo | ||
) |
Returns current sync status and other sync related info.
pnHandle | Profinet Handle | |
[in] | syncInfo | Reference to structure for ptcp sync info |
void PN_PTCP_getSyncMasterAddress | ( | PN_Handle | pnHandle, |
uint8_t * | addr | ||
) |
Get the sync Master address (MAC)
pnHandle | Profinet Handle | |
[in] | addr | Reference to MAC memory field (6 bytes) |
void PN_PTCP_setPllWindow | ( | PN_Handle | pnHandle, |
uint32_t | pllWindowSize | ||
) |
Sets the PLL window for sync handling.
pnHandle | Profinet Handle | |
[in] | pllWindowSize | Defines the PLL window size in ns. If PLL window is not set by application, 1000 ns will be taken as default. If deviation from master is within PLL window, device will be considered to be in sync state. Otherwise, out of sync. |
void PN_PTCP_setSyncTimeoutFactor | ( | PN_Handle | pnHandle, |
uint32_t | syncTimeoutFactor | ||
) |
Sets the Sync timeout factor.
pnHandle | Profinet Handle | |
[in] | syncTimeoutFactor | Sync timeout factor in terms of sync intervals. If it is not set by application, 6 will be taken as default. If no. of consecutive sync packet missed is equal to syncTimeoutFactor, notify application. |
void PN_PTCP_setTakeoverTimeoutFactor | ( | PN_Handle | pnHandle, |
uint32_t | takeoverTimeoutFactor | ||
) |
Sets the takeover timeout factor.
pnHandle | Profinet Handle | |
[in] | takeoverTimeoutFactor | Defines the takeover timeout factor in terms of sync intervals. If it is not set by application, 3 will be taken as default If no. of consecutive sync packet missed is equal to takeoverTimeoutFactor, notify application |
void PN_PTCP_setSyncUUID | ( | PN_Handle | pnHandle, |
uint8_t * | subdomainUUID | ||
) |
Sets the sync UUID for the device.
Application is also notified about the current sync status.
.
pnHandle | Profinet Handle | |
[in] | subdomainUUID | Reference to the array containing subdomainUUID |
void PN_PTCP_configureSyncFwd | ( | PRUICSS_HwAttrs const * | pruicssHwAttrs, |
ptcpPortStatus_t | state | ||
) |
Controls(enable/disable) the sync forwarding; by default it is enabled.
pruicssHwAttrs | PRUICSS HW Attributes for base addresses | |
[in] | state | disable /enable |
void PN_PTCP_configureDelayMeasurement | ( | PN_Handle | pnHandle, |
uint8_t | portNum, | ||
ptcpPortStatus_t | state | ||
) |
Controls(enable/disable) the delay measurement process on a particular port.
By default, delay measurement is enabled on both the ports.
pnHandle | Profinet Handle | |
[in] | portNum | Port no. (1 or 2) which needs to be configured. |
[in] | state | disable / enable |
void PN_PTCP_configureDelayResp | ( | PRUICSS_HwAttrs const * | pruicssHwAttrs, |
uint8_t | portNum, | ||
ptcpPortStatus_t | state | ||
) |
Configures whether delay response should be sent on a particular port or not, in response for delay request
pruicssHwAttrs | PRUICSS HW Attributes for base addresses |
portNum | port no. (1 or 2)which needs to be configured |
state | : disable / enable |
void PN_PTCP_start | ( | PN_Handle | pnHandle | ) |
Triggers the start of ptcp protocol Should be called from stack after initialization It only controls ARM side tasks of PTCP, not PRU.
pnHandle | Profinet Handle |
void PN_PTCP_ClockChange | ( | PN_Handle | pnHandle, |
uint32_t | cycleTime | ||
) |
Handles the clock (IEP CMP0) change scenario.
[in] | pnHandle | Profinet Handle |
cycleTime | new cycle time with which IEP CMP0 is programmed |
void PN_PTCP_reset | ( | PN_Handle | pnHandle | ) |
reset relevant data on start or sync timeout
[in] | pnHandle | Profinet Handle |
void PN_PTCP_init | ( | PN_Handle | pnHandle | ) |
Initializes the PTCP data structure and memory for PTCP pre-formatted packets.
[in] | pnHandle | Profinet Handle |
void PN_PTCP_delayMeasurement | ( | PN_Handle | pnHandle | ) |
void PN_PTCP_resetDelayValues | ( | PN_Handle | pnHandle | ) |
void PN_PTCP_smaDelayMeasurement | ( | PN_Handle | pnHandle | ) |
int32_t PN_PTCP_lineDelayCalc | ( | PN_Handle | pnHandle, |
ptcp_iDelayResp_struct_t * | ptcp_iDelayResp_parsed | ||
) |
int32_t PN_PTCP_parseInDelayResp | ( | ptcp_iDelayResp_struct_t * | ptcp_iDelayResp_parsed, |
uint8_t * | ptcp_iDelayResp_packet, | ||
uint8_t * | ptcp_iDelayFupResp_packet, | ||
int32_t | w_FUP | ||
) |
int32_t PN_PTCP_cableDelayCalc | ( | PN_Handle | pnHandle, |
ptcp_iDelayResp_struct_t * | ptcp_iDelayResp_parsed, | ||
uint8_t | port | ||
) |
uint32_t PN_PTCP_rotUint | ( | uint32_t * | input | ) |
uint16_t PN_PTCP_rotUshort | ( | uint16_t * | input | ) |
int32_t PN_PTCP_setupIsr | ( | PN_Handle | pnHandle | ) |
int32_t PN_PTCP_enableIsr | ( | PN_Handle | pnHandle | ) |
void PN_PTCP_syncHandling | ( | PN_Handle | pnHandle | ) |
void PN_PTCP_syncIepAdjustment | ( | PN_Handle | pnHandle, |
int32_t | ecapPeriod, | ||
uint32_t | compensation | ||
) |
int32_t PN_PTCP_parseSyncFields | ( | PN_Handle | pnHandle, |
volatile ptcpSyncInfo_t * | ptcp_sync_parsed, | ||
uint8_t * | sync_sblock | ||
) |
void PN_PTCP_syncPreprocess | ( | PN_Handle | pnHandle, |
uint8_t | ctrlByte | ||
) |
void PN_PTCP_portDelaySmaCalc | ( | PN_Handle | pnHandle, |
uint8_t | portNum | ||
) |
void PN_PTCP_processDelayResponse | ( | PN_Handle | pnHandle, |
uint8_t | portNum | ||
) |
void PN_PTCP_resetDelayTimings | ( | PN_Handle | pnHandle, |
uint8_t | portNum | ||
) |
int32_t PN_PTCP_adjCtrDiff | ( | PN_Handle | pnHandle, |
int32_t | ctrDiff | ||
) |
int32_t PN_PTCP_absVal | ( | int32_t | num | ) |
void PN_PTCP_syncTimeoutMonitor | ( | PN_Handle | pnHandle | ) |
void PN_PTCP_taskSleep | ( | uint32_t | mSec | ) |
void PN_PTCP_configureSync0Pin | ( | PN_Handle | pnHandle | ) |
int32_t PN_PTCP_modFunc | ( | int32_t | num, |
uint32_t | mod | ||
) |
void PN_PTCP_triggerMeasurement | ( | PN_Handle | pnHandle | ) |