Modules
The flexPTP project is decomposed into smaller sections, modules that can be grouped based on their purpose. Almost each separate file represents a freestanding module.
Types, constants and definitions
- ptp_defs.h, ptp_defs.c : Fundamental constants and definitions, like IGMP-groups, Ethernet addresses, ports, PTP header and message lengths, autocalculated values.
- ptp_types.h : Fundamental PTP types, PTP message types, PTP message bitfields, PTP value enumerations. The types for the core and BMC-algorithm's state machines are also defined here.
- ptp_servo_types.h : Definition of basic servo types.
- ptp_sync_cycle_data.h : Definition of the PTP synchronization cycle context type.
Settings
- settings_interface.h, settings_interface.c : Interface to control all the aspects of the PTP-engine, like profile settings (transport type, delay mechanism, domain, message period etc.), clock settings.
- profiles.h, profiles.c : Separated definition for reporting current profile. Also global hints for identifying various aspects of a profile are declared and defined here.
- tlv.h, tlv.c : Simple TLV handling functions.
Logging and statistics
Utilities
- timeutils.c, timeutils.h : Storage class definitions for timestamps and operations on time values. Time printing is also defined in here.
- msg_utils.c, msg_utils.h : Functions that deal with actual PTP messages; they extract or insert headers timestamps or any data of other kind.
- format_utils.c, format_utils.h : Format conversion functions between network and host byte order and conversion functions between PTP logarithmic interval designator and time duration value.
- clock_utils.c, clock_utils.h : Clock identity related operations and PPS offset management.
Messaging
Events
Core:
- ptp_core.c, ptp_core.h : Core of the PTP engine, storing and loading configurations.
- bmca.c, bmca.h : Best Master Clock Algorithm function implementation.
- common.c, common.h : Functionality used by both Slave and Master modules.
- slave.c, slave.h : Slave clock functionality, message processing, clock tuning.
- master.c, master.h : Master clock functionality, message processing.
- task_ptp.c, task_ptp.h : The entry point of the whole PTP-implementation. Calling reg_task_ptp() initializes the PTP-engine, invoking unreg_task_ptp() shuts it down