ptp_scheduler module

PTP (Precision Time Protocol) Peripheral ICL (Instrument Control Layer) with Scheduling. Abstracts the FPGA registers into a more user-friendly interface for reading the time and setting transmit/receive start/stop times, and provides utility functions for format conversion.

class ptp_scheduler.PtpScheduler(*args: Any, **kwargs: Any)[source]

Bases: Ptp

ICL for PTP with Scheduling

reset() None[source]
property rx_start_time: ska_low_cbf_fpga.IclField.<class 'str'>

Read the scheduled reception start time

property rx_stop_time: ska_low_cbf_fpga.IclField.<class 'str'>

Read the scheduled reception stop time

property time: ska_low_cbf_fpga.IclField.<class 'str'>

Get current time

property tx_start_time: ska_low_cbf_fpga.IclField.<class 'str'>

Read the scheduled transmission start time

property tx_stop_time: ska_low_cbf_fpga.IclField.<class 'str'>

Read the scheduled transmission stop time

property unix_timestamp: ska_low_cbf_fpga.IclField.<class 'float'>

Get current time (UNIX ts)

ptp_scheduler.TIMESTAMP_BITS = 80

48 bits (integer) seconds, 32 bits of nanoseconds

ptp_scheduler.combine_ptp_registers(upper: ska_low_cbf_fpga.IclField, lower: ska_low_cbf_fpga.IclField, sub: ska_low_cbf_fpga.IclField) int[source]

Combine 3x PTP registers into an 80 bit PTP timestamp

Parameters:
  • upper – Upper (most significant) seconds register

  • lower – Lower seconds register

  • sub – Sub-seconds (nanoseconds) register

ptp_scheduler.datetime_from_str(time_str: str) datetime[source]

Convert user-supplied string to datetime object

Parameters:

time_str – “%Y-%m-%d %H:%M:%S[.%f]” (microseconds is optional)

ptp_scheduler.ptp_ts_from_float(ts: float) int[source]

Convert a UNIX timestamp to PTP 80 bit value

Parameters:

ts – UNIX timestamp

Returns:

80 bit PTP value (48 bits of seconds and 32 bits of nanoseconds)

ptp_scheduler.split_datetime(t: ~datetime.datetime) -> (<class 'int'>, <class 'int'>, <class 'int'>)[source]

Split a datetime into 3 register values

Parameters:

t – target time to be decoded

Returns:

seconds upper 32 bits, seconds lower 32 bits, sub seconds (nanoseconds)

ptp_scheduler.time_str_from_registers(upper: ska_low_cbf_fpga.IclField, lower: ska_low_cbf_fpga.IclField, sub: ska_low_cbf_fpga.IclField) str[source]

Combine 3 PTP time registers and render as string

Parameters:
  • upper – Upper (most significant) seconds register

  • lower – Lower seconds register

  • sub – Sub-seconds (nanoseconds) register

ptp_scheduler.unix_ts_from_ptp(ptp_timestamp: int) Decimal[source]

Get UNIX timestamp from 80 bit PTP value