📄 ixtimesyncacccodelet.h
字号:
* @brief define default value for target time interval. With default * tick rate, default interval is approximately 1 second. */#define IX_TIMESYNCACC_CODELET_TARGET_TIME_HIT_INTERVAL (1000)/** * @def IX_TIMESYNCACC_CODELET_MAX_TS_CHANNELS * * @brief maximum number of time sync channels */#define IX_TIMESYNCACC_CODELET_MAX_TS_CHANNELS (3)/** * @def IX_TIMESYNCACC_CODELET_MAX_CONFIGURATIONS * * @brief maximum number of supported configurations */#define IX_TIMESYNCACC_CODELET_MAX_CONFIGURATIONS (3)/** * @def IX_TIMESYNCACC_CODELET_PTP_MESSAGE_LEN * * @brief PTP message length in byte */#define IX_TIMESYNCACC_CODELET_PTP_MESSAGE_LEN (132) /** * @def IX_TIMESYNCACC_CODELET_UDP_PAYLOAD_LEN * * @brief UDP payload size in byte (offset: byte 38 and 39) */#define IX_TIMESYNCACC_CODELET_UDP_PAYLOAD_LEN (IX_TIMESYNCACC_CODELET_PTP_MESSAGE_LEN) /** * @def IX_TIMESYNCACC_CODELET_UDP_HEADER_LEN * * @brief UDP header size in byte */#define IX_TIMESYNCACC_CODELET_UDP_HEADER_LEN (32)/** * @def IX_TIMESYNCACC_CODELET_UDP_CHECKSUM_LEN * * @brief UDP checksum length in byte */#define IX_TIMESYNCACC_CODELET_UDP_CHECKSUM_LEN (2)/** * @def IX_TIMESYNCACC_CODELET_UDP_FRAME_LEN * * @brief UDP frame size in byte */#define IX_TIMESYNCACC_CODELET_UDP_FRAME_LEN \ (IX_TIMESYNCACC_CODELET_UDP_PAYLOAD_LEN + IX_TIMESYNCACC_CODELET_UDP_HEADER_LEN + IX_TIMESYNCACC_CODELET_UDP_CHECKSUM_LEN)/** * @def IX_TIMESYNCACC_CODELET_IP_DATAGRAM * * @brief frame type field of UDP header (offset: byte 12 and 13) for PTP message. * It is set to IP_DATAGRAM. */#define IX_TIMESYNCACC_CODELET_IP_DATAGRAM (0x0800)/** * @def IX_TIMESYNCACC_CODELET_IP_HEADER_LEN * * @brief IP_HEADER_LEN field of UDP header (offset: byte 14) for PTP message */#define IX_TIMESYNCACC_CODELET_IP_HEADER_LEN (69)/** * @def IX_TIMESYNCACC_CODELET_IP_DATAGRAM_LEN * * @brief IP_DATAGRAM_LEN field of UDP header (offset: byte 16 and 17) for PTP message */#define IX_TIMESYNCACC_CODELET_IP_DATAGRAM_LEN (152)/** * @def IX_TIMESYNCACC_CODELET_TIME_TO_LIVE * * @brief TIME_TO_LIVE field of UDP header (offset: byte 22) for PTP message */#define IX_TIMESYNCACC_CODELET_TIME_TO_LIVE (1) /** * @def IX_TIMESYNCACC_CODELET_UDP_PROTOCOL * * @brief UDP PROTOCOL field of UDP header (offset: byte 23) for PTP message */#define IX_TIMESYNCACC_CODELET_UDP_PROTOCOL (17)/** * @def IX_TIMESYNCACC_CODELET_PTP_EVENT_PORT * * @brief Destination port number field of UDP header (offset: byte 36 and 37) for PTP message. * Event port (319) is used to communicates Sync and Delay_Req messages. */#define IX_TIMESYNCACC_CODELET_PTP_EVENT_PORT (319)/** * @def IX_TIMESYNCACC_CODELET_PTP_MESSAGE_TYPE * * @brief PTP_MESSAGE_TYPE field for PTP message (offset: byte 62) */#define IX_TIMESYNCACC_CODELET_PTP_MESSAGE_TYPE (1)/** * @def IX_TIMESYNCACC_CODELET_INVALID_PARAM * * @brief value for invalid parameter */#define IX_TIMESYNCACC_CODELET_INVALID_PARAM (0xFFFFFFFF)/** * @def IX_TIMESYNCACC_CODELET_PTP_MSG_XMIT_INTERVAL * * @brief time interval for PTP message transmission (2 seconds) */#define IX_TIMESYNCACC_CODELET_PTP_MSG_XMIT_INTERVAL (2000)/** * @def IX_TIMESYNCACC_CODELET_LSB_VALUE(x) * * @brief Get LSB value of x */#define IX_TIMESYNCACC_CODELET_LSB_VALUE(x) ((x) & 0x000000FF)/** * @def IX_TIMESYNCACC_CODELET_MSB_VALUE(x) * * @brief Get MSB value of x (where x is a USHORT type) */#define IX_TIMESYNCACC_CODELET_MSB_VALUE(x) ((x) >> 8)/********************************************************************* * typedef definitions *********************************************************************//** * @typedef IxTimeSyncAccCodeletUninitFuncPtr * * @brief Definition of void function pointer with one input parameter. * The data type of input parameter is IxNpeDlNpeId. */typedef void (*IxTimeSyncAccCodeletUninitFuncPtr) (IxNpeDlNpeId);/** * @struct IxTimeSyncAccCodeletUninitFuncMap * * @brief This struct is used to store each supporting module's * unload function's pointer, function parameter, and the * state whether the module is initialized. */typedef struct{ IxOsalVoidFnPtr funcPtr; /*!< function pointer */ IxNpeDlNpeId funcParameter; /*!< function's input parameter */ BOOL initialized; /*!< initialization state: TRUE - initialized, FALSE - not initialized */ } IxTimeSyncAccCodeletUninitFuncMap;/** * @struct IxTimeSyncAccCodeletTSChannelConfig * * @brief This struct is used to store all three Time Sync channels' * operating mode: master or slave. */typedef struct { IxTimeSyncAcc1588PTPPortMode tsChannelMode[IX_TIMESYNCACC_CODELET_MAX_TS_CHANNELS]; /*!< channel operating mode */} IxTimeSyncAccCodeletTSChannelConfig;/********************************************************************* * enum definition *********************************************************************//** * @enum IxTimeSyncAccCodeletModuleId * * @brief Module ID list. These modules are required to be initialized * or setup for PTP message transmission from each NPE. */typedef enum { IX_TIMESYNCACC_CODELET_MBUF_ALLOC, /*!< mBuf Memory Allocation */ IX_TIMESYNCACC_CODELET_Q_MGR, /*!< Q Mgr */ IX_TIMESYNCACC_CODELET_DISPATCHER, /*!< Q Mgr Dispatcher */ IX_TIMESYNCACC_CODELET_NPE_MH, /*!< NPE Message Handler */ IX_TIMESYNCACC_CODELET_NPE_DL, /*!< NPE Downloader */ IX_TIMESYNCACC_CODELET_NPE_A, /*!< NPE A */ IX_TIMESYNCACC_CODELET_NPE_B, /*!< NPE B */ IX_TIMESYNCACC_CODELET_NPE_C, /*!< NPE C */ IX_TIMESYNCACC_CODELET_ETH_ACC, /*!< Ethernet Access Component */ IX_TIMESYNCACC_CODELET_ETH_PORTS, /*!< Ethernet Port */ IX_TIMESYNCACC_CODELET_TX_PTP /*!< PTP Message Transmission Setup */ } IxTimeSyncAccCodeletModuleId;/********************************************************************* * Function Prototype *********************************************************************//** * @fn ixTimeSyncAccCodeletMain (UINT32 configIndex) * * @brief ixTimeSyncAccCodeletMain is the main function for * timeSyncAcc codelet. * * This function will perform the followings: * * - configure all Time Sync Channels to operate in the mode * specified in the user selected configuration. * * - set tick rate to get system time to start ticking * * - setup target time to hit every one second (in interrupt mode) * * - setup and enable all NPEs and all ethernet components. * * - spawn a thread to transmit Sync message from master port * and Delay_Req message from slave port every 2 seconds. * * @param * configIndex UINT32 [in] - choice of configuration * - 0 -> NPE A - Slave, NPE B - Slave, NPE C - Master (default) * - 1 -> NPE A - Slave, NPE B - Master, NPE C - Slave * - 2 -> NPE A - Master, NPE B - Slave, NPE C - Slave * * @return IX_STATUS * @li IX_SUCCESS - start codelet successfully * @li IX_FAIL - fail */PUBLIC IX_STATUS ixTimeSyncAccCodeletMain (UINT32 configIndex);/** * @fn ixTimeSyncAccCodeletUninit () * * @brief This function will unload all initialized modules, free all * resources, and nicely terminates timeSyncAcc codelet execution. * * @return void */PUBLIC void ixTimeSyncAccCodeletUninit (void);/** @} */#endif /* end of #ifdef __ixp46X */#endif /* end of IXTIMESYNCACCCODELET_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -