ptp

package
v0.0.0-...-3ad4eec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ExternalTimestampEnable      = ExternalTimestampFlag(1 << 0)
	ExternalTimestampRisingEdge  = ExternalTimestampFlag(1 << 1)
	ExternalTimestampFallingEdge = ExternalTimestampFlag(1 << 2)
	ExternalTimestampStrict      = ExternalTimestampFlag(1 << 3)
	ExternalTimestampBothEdges   = ExternalTimestampRisingEdge | ExternalTimestampFallingEdge
)
View Source
const (
	PinFunctionNone              = PinFunction(0)
	PinFunctionExternalTimestamp = PinFunction(1)
	PinFunctionPerOut            = PinFunction(2)
	PinFunctionPhySync           = PinFunction(3)
)
View Source
const MaxSamples = 25

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock struct {
	// contains filtered or unexported fields
}

func Open

func Open(index int) (*Clock, error)

func (*Clock) AdjustTime

func (c *Clock) AdjustTime(t unix.Timex) error

AdjustTime gradually adjusts the system clock. The amount of time by which the clock is to be adjusted is specified in the structure passes as argument. If the adjustment parameter is positive, then the system clock is sped up by some small percentage (i.e., by adding a small amount of time to the clock value in each second) until the adjustment has been completed. If the adjustment parameter is negative, then the clock is slowed down in a similar fashion. Internally, this function calls into the clock_adjtime(3) syscall. Refer the manpage for more information.

func (*Clock) Close

func (c *Clock) Close()

func (*Clock) ConfigurePeriodicOutput

func (c *Clock) ConfigurePeriodicOutput(channel uint32, config PeriodicOutputConfig) error

func (*Clock) GetAlarms

func (c *Clock) GetAlarms() int

GetAlarms returns the number of programmable alarms.

func (*Clock) GetCrossTimestampingSupport

func (c *Clock) GetCrossTimestampingSupport() bool

func (*Clock) GetExternalTimestampChannels

func (c *Clock) GetExternalTimestampChannels() int

GetExternalTimestampChannels return the number of external time stamp channels.

func (*Clock) GetMaxFrequencyAdjustment

func (c *Clock) GetMaxFrequencyAdjustment() int

GetMaxAdj returns the maximum frequency adjustment in parts per billon.

func (*Clock) GetName

func (c *Clock) GetName() string

GetName returns the name of this clock.

func (*Clock) GetPin

func (c *Clock) GetPin(index int) (*Pin, error)

func (*Clock) GetPins

func (c *Clock) GetPins() int

GetPins returns the number of available input/output pins.

func (*Clock) GetPpsCallbackSupport

func (c *Clock) GetPpsCallbackSupport() bool

GetPpsCallbackSupport returns whether the clock supports a PPS callback.

func (*Clock) GetProgrammablePeriodicSignals

func (c *Clock) GetProgrammablePeriodicSignals() int

GetProgrammablePeriodicSignals return the number of programmable periodic signals.

func (*Clock) GetSystemOffset

func (c *Clock) GetSystemOffset(samples int) ([]SystemOffsetMeasurement, error)

func (*Clock) GetSystemOffsetExtended

func (c *Clock) GetSystemOffsetExtended(samples int) ([]SystemOffsetMeasurementExtended, error)

func (*Clock) GetSystemOffsetPrecise

func (c *Clock) GetSystemOffsetPrecise(samples int) (SystemOffsetMeasurementPrecise, error)

func (*Clock) GetTime

func (c *Clock) GetTime() (time.Time, error)

GetTime returns the current time of the clock.

func (*Clock) OnExternalTimestampEvent

func (c *Clock) OnExternalTimestampEvent(cb ExternalTimestampEventCallback)

OnExternalTimestampEvent sets the callback function for external time stamp events that are configure through RequestExternalTimestamp().

func (*Clock) RequestExternalTimestamp

func (c *Clock) RequestExternalTimestamp(channel int, flags ExternalTimestampFlag) error

func (*Clock) SetPPSEnabled

func (c *Clock) SetPPSEnabled(enabled bool) error

func (*Clock) SetTime

func (c *Clock) SetTime(t time.Time) error

SetTime sets the current time of the clock.

type ExternalTimestampEventCallback

type ExternalTimestampEventCallback func(channel int, timestamp time.Time)

type ExternalTimestampFlag

type ExternalTimestampFlag int

type PeriodicOutputConfig

type PeriodicOutputConfig struct {
	// The period in which the output is supposed to fire.
	Period time.Duration

	// Configures the periodic output channel with a fixed absolute start time.
	// AbsoluteStartTime and PhaseOffset are mutually exclusive.
	AbsoluteStartTime *time.Time

	// Configures the periodic output channel with a phase offset.
	// The signal should start toggling at an unspecified integer multiple of the given period, plus the value given in the phase parameter.
	// The start time should be "as soon as possible".
	// AbsoluteStartTime and PhaseOffset are mutually exclusive.
	PhaseOffset *time.Duration

	// Optional, determines the 'on' time of the signal. Must be lower than the period.
	DutyCycle *time.Duration

	// Only run once
	OneShot bool
}

type Pin

type Pin struct {
	// contains filtered or unexported fields
}

func (*Pin) GetChannel

func (p *Pin) GetChannel() uint32

func (*Pin) GetFunction

func (p *Pin) GetFunction() PinFunction

func (*Pin) GetName

func (p *Pin) GetName() string

func (*Pin) SetFunction

func (p *Pin) SetFunction(function PinFunction, channel uint32) error

type PinFunction

type PinFunction uint32

type SystemOffsetMeasurement

type SystemOffsetMeasurement struct {
	System time.Time
	Phc    time.Time
}

type SystemOffsetMeasurementExtended

type SystemOffsetMeasurementExtended struct {
	System1 time.Time
	Phc     time.Time
	System2 time.Time
}

type SystemOffsetMeasurementPrecise

type SystemOffsetMeasurementPrecise struct {
	Device             time.Time
	SystemRealTime     time.Time
	SystemMonotonicRaw time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL