Documentation
¶
Index ¶
- Constants
- func EncodePinControl(req PinParentDeviceCtl) ([]byte, error)
- func GetClockQualityLevel(cq uint32) string
- func GetClockQualityLevels(cqs []uint32) string
- func GetDpllStatusHR(reply *DoDeviceGetReply, timestamp time.Time) ([]byte, error)
- func GetDpllType(tp uint32) string
- func GetFrequencyMonitor(s uint32) string
- func GetLockStatus(ls uint32) string
- func GetLockStatusError(le uint32) string
- func GetMode(md uint32) string
- func GetPhaseOffsetMonitor(po uint32) string
- func GetPinCapabilities(c uint32) string
- func GetPinDirection(d uint32) string
- func GetPinInfoHR(reply *PinInfo, timestamp time.Time) ([]byte, error)
- func GetPinOperstate(s uint32) string
- func GetPinState(s uint32) string
- func GetPinType(tp uint32) string
- func LogPinConfirmation(pin *PinInfo)
- func LogPinTable(reason string, clockID uint64, deviceID uint32, lockStatus uint32)
- func LogPins(title string, pins []*PinInfo)
- func ParsePinDirection(d string) uint32
- func ParsePinState(s string) uint32
- func ParsePinType(tp string) uint32
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) DoDeviceGet(req DoDeviceGetRequest) (*DoDeviceGetReply, error)
- func (c *Conn) DoDeviceIDGet(req DoDeviceIDGetRequest) (*DoDeviceIDGetReply, error)
- func (c *Conn) DoPinGet(req DoPinGetRequest) (*PinInfo, error)
- func (c *Conn) DumpDeviceGet() ([]*DoDeviceGetReply, error)
- func (c *Conn) DumpPinGet() ([]*PinInfo, error)
- func (c *Conn) GetGenetlinkConn() *genetlink.Conn
- func (c *Conn) GetGenetlinkFamily() genetlink.Family
- func (c *Conn) GetMcastGroupID(mcGroup string) (id uint32, found bool)
- func (c *Conn) PinPhaseAdjust(req PinPhaseAdjustRequest) error
- func (c *Conn) SendCommand(command uint8, data []byte) error
- type DoDeviceGetReply
- type DoDeviceGetRequest
- type DoDeviceIDGetReply
- type DoDeviceIDGetRequest
- type DoPinGetRequest
- type DpllStatusHR
- type FrequencyRange
- type PinControl
- type PinInfo
- type PinInfoHR
- type PinParentDevice
- type PinParentDeviceCtl
- type PinParentDeviceHR
- type PinParentPin
- type PinParentPinHR
- type PinPhaseAdjustRequest
- type ReferenceSync
Constants ¶
const ( // PinOperstateActive indicates the pin is qualified and actively used by the DPLL. PinOperstateActive = 1 // PinOperstateStandby indicates the pin is qualified but not actively used by the DPLL. PinOperstateStandby = 2 // PinOperstateNoSignal indicates the pin does not have a valid signal. PinOperstateNoSignal = 3 // PinOperstateQualFailed indicates the pin signal failed qualification // (e.g. frequency or phase monitor). PinOperstateQualFailed = 4 )
Defines possible operational states of a pin with respect to its parent DPLL device. Unlike pin state (administrative intent), operstate reflects actual hardware status.
const ( DpllAttributes = iota DpllID DpllModuleName DpllAttPadding DpllClockID DpllMode DpllModeSupported DpllLockStatus DpllTemp DpllType DpllLockStatusError DpllClockQualityLevel DpllPhaseOffsetMonitor DpllPhaseOffsetAverageFactor // DpllFrequencyMonitor is the netlink attribute ID for the frequency-monitor // feature flag on a DPLL device (uses the feature-state enum). DpllFrequencyMonitor )
DpllAttributes provides the dpll_a attribute-set
const ( // attribute-set dpll_a_pin DpllPinTypes = iota DpllPinID DpllPinParentID DpllPinModuleName DpllPinPadding DpllPinClockID DpllPinBoardLabel DpllPinPanelLabel DpllPinPackageLabel DpllPinType DpllPinDirection DpllPinFrequency DpllPinFrequencySupported DpllPinFrequencyMin DpllPinFrequencyMax DpllPinPrio DpllPinState DpllPinCapabilities DpllPinParentDevice DpllPinParentPin DpllPinPhaseAdjustMin DpllPinPhaseAdjustMax DpllPinPhaseAdjust DpllPinPhaseOffset // DpllPinFractionalFrequencyOffset is the netlink attribute ID for the FFO // (Fractional Frequency Offset) of a pin in PPM (parts per million). // At the top-level pin scope this represents the RX vs TX symbol rate offset // on the media associated with the pin. // Inside the pin-parent-device nest it represents the frequency offset between // the pin and its parent DPLL device. // This is a lower-precision version of DpllPinFractionalFrequencyOffsetPPT. DpllPinFractionalFrequencyOffset DpllPinEsyncFrequency DpllPinEsyncFrequencySupported DpllPinEsyncPulse DpllPinReferenceSync DpllPinPhaseAdjustGran // DpllPinFractionalFrequencyOffsetPPT is the netlink attribute ID for the FFO // (Fractional Frequency Offset) of a pin in PPT (parts per trillion, 10^-12). // At the top-level pin scope this represents the RX vs TX symbol rate offset // on the media associated with the pin. // Inside the pin-parent-device nest it represents the frequency offset between // the pin and its parent DPLL device. // This is a higher-precision version of DpllPinFractionalFrequencyOffset. DpllPinFractionalFrequencyOffsetPPT // DpllPinMeasuredFrequency is the netlink attribute ID for the measured // frequency of an input pin in millihertz. Divide by // DpllPinMeasuredFrequencyDivider to obtain Hz with mHz fractional precision. DpllPinMeasuredFrequency // DpllPinOperstate is the netlink attribute ID for the operational state of a // pin with respect to its parent DPLL device (pin-operstate enum). DpllPinOperstate )
DpllPinTypes defines the attribute-set for dpll_a_pin
const ( DpllCmds = iota DpllCmdDeviceIDGet DpllCmdDeviceGet DpllCmdDeviceSet DpllCmdDeviceCreateNtf DpllCmdDeviceDeleteNtf DpllCmdDeviceChangeNtf DpllCmdPinIDGet DpllCmdPinGet DpllCmdPinSet DpllCmdPinCreateNtf DpllCmdPinDeleteNtf DpllCmdPinChangeNtf )
DpllCmds defines DPLL subsystem commands encoding
const ( DpllLockStatusAttribute = iota DpllLockStatusUnlocked DpllLockStatusLocked DpllLockStatusLockedHoldoverAcquired DpllLockStatusHoldover )
DpllLockStatusAttribute defines DPLL lock status encoding
const ( LockStatusErrorTypes = iota LockStatusErrorNone LockStatusErrorUndefined // LockStatusErrorMediaDown indicates dpll device lock status was changed because of associated // media got down. // This may happen for example if dpll device was previously // locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT. LockStatusErrorMediaDown // LockStatusFFOTooHigh indicates the FFO (Fractional Frequency Offset) between the RX and TX // symbol rate on the media got too high. // This may happen for example if dpll device was previously // locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT. LockStatusFFOTooHigh )
LockStatusErrorTypes defines device lock error types
const ( PhaseOffsetMonitorAttribute = iota PhaseOffsetMonitorEnabled PhaseOffsetMonitorDisabled )
PhaseOffsetMonitor defines phase offset monitor enable / disable states.
const ( ClockQualityLevel = iota ClockQualityLevelITUOpt1PRC ClockQualityLevelITUOpt1SSUA ClockQualityLevelITUOpt1SSUB ClockQualityLevelITUOpt1EEC1 ClockQualityLevelITUOpt1PRTC ClockQualityLevelITUOpt1EPRTC ClockQualityLevelITUOpt1EEEC ClockQualityLevelItuOpt1EPRC )
ClockQualityLevel defines possible clock quality levels when on holdover
const ( DpllTypeAttribute = iota // DpllTypePPS indicates dpll produces Pulse-Per-Second signal DpllTypePPS // DpllTypeEEC indicates dpll drives the Ethernet Equipment Clock DpllTypeEEC )
DpllTypeAttribute defines DPLL types
const ( PinStateConnected = 1 PinStateDisconnected = 2 PinStateSelectable = 3 )
Defines possible pin states
const ( PinTypeMUX = 1 PinTypeEXT = 2 PinTypeSYNCE = 3 PinTypeINT = 4 PinTypeGNSS = 5 )
Defines possible pin types
const ( PinDirectionInput = 1 PinDirectionOutput = 2 )
Defines pin directions
const ( PinCapNone = 0 PinCapDir = (1 << 0) PinCapPrio = (1 << 1) PinCapState = (1 << 2) )
Defines pin capabilities
const DpllMCGRPMonitor = "monitor"
DpllMCGRPMonitor defines DPLL subsystem multicast group name
const DpllPhaseOffsetDivider = 1000
DpllPhaseOffsetDivider phase offset divider allows userspace to calculate a value of measured signal phase difference between a pin and dpll device as a fractional value with three digit decimal precision. Value of (DPLL_A_PHASE_OFFSET / DPLL_PHASE_OFFSET_DIVIDER) is an integer part of a measured phase offset value. Value of (DPLL_A_PHASE_OFFSET % DPLL_PHASE_OFFSET_DIVIDER) is a fractional part of a measured phase offset value.
const DpllPinMeasuredFrequencyDivider = 1000
DpllPinMeasuredFrequencyDivider allows userspace to calculate a value of measured input frequency as a fractional value with three digit decimal precision (millihertz). Value of (DPLL_A_PIN_MEASURED_FREQUENCY / DpllPinMeasuredFrequencyDivider) is an integer part of a measured frequency value. Value of (DPLL_A_PIN_MEASURED_FREQUENCY % DpllPinMeasuredFrequencyDivider) is a fractional part of a measured frequency value.
const DpllTemperatureDivider = 1000
DpllTemperatureDivider allows userspace to calculate the temperature as float with three digit decimal precision. Value of (DPLL_A_TEMP / DPLL_TEMP_DIVIDER) is integer part of temperature value. Value of (DPLL_A_TEMP % DPLL_TEMP_DIVIDER) is fractional part of temperature value.
Variables ¶
This section is empty.
Functions ¶
func EncodePinControl ¶
func EncodePinControl(req PinParentDeviceCtl) ([]byte, error)
func GetClockQualityLevel ¶
GetClockQualityLevel returns clock quality level as a string
func GetClockQualityLevels ¶
GetClockQualityLevels returns clock quality levels as a string
func GetDpllStatusHR ¶
func GetDpllStatusHR(reply *DoDeviceGetReply, timestamp time.Time) ([]byte, error)
GetDpllStatusHR returns human-readable DPLL status
func GetFrequencyMonitor ¶
GetFrequencyMonitor returns the frequency-monitor feature state as a human-readable string. Uses the feature-state enum (same as phase-offset-monitor): "enabled", "disabled", or "unknown".
func GetLockStatus ¶
GetLockStatus returns DPLL lock status as a string
func GetLockStatusError ¶
GetLockStatusError returns lock status error as a string
func GetPhaseOffsetMonitor ¶
GetPhaseOffsetMonitor returns phase offset monitor as a string
func GetPinCapabilities ¶
GetPinCapabilities returns DPLL pin capabilities as a csv
func GetPinDirection ¶
GetPinDirection returns DPLL pin direction as a string
func GetPinInfoHR ¶
GetPinInfoHR returns human-readable pin status
func GetPinOperstate ¶
GetPinOperstate returns the pin operational state as a human-readable string. Returns "active", "standby", "no-signal", "qual-failed", or "" for unknown values.
func LogPinConfirmation ¶
func LogPinConfirmation(pin *PinInfo)
LogPinConfirmation logs the current configuration of a single pin via LogPins. Unlike LogPinTable, this applies no filtering by direction, clock ID, device, or lock state — it's meant to show the full post-write state of exactly the pin that was just set (including output pins, which LogPinTable always skips), immediately after a pin-set command, for confirmation purposes.
func LogPinTable ¶
LogPinTable logs a compact table of the input pins relevant to the DPLL device (deviceID) on the given clockID that just reported a lock-state change (reason is a free-form description used in the log line, e.g. "eth0 eec->LOCKED").
This is a best-effort diagnostic: the actual netlink dial/dump happens in a background goroutine so callers on latency-sensitive paths (e.g. nlUpdateState, processing notifications inline) are never blocked or stalled by it.
func LogPins ¶
LogPins logs the given pins as a compact table, one row per parent device of each pin. Unlike LogPinTable, this applies no filtering by direction, clock ID, device, or lock state — every parent device of every pin passed in is shown, including output pins.
This is the shared rendering primitive behind LogPinTable and LogPinConfirmation, exported so other packages that already hold a []*PinInfo (their own DumpPinGet result, a single pin from DoPinGet, or a test fixture) can log a consistent table without duplicating table-building code or going through LogPinTable's dial/dump/notification-filtering path.
func ParsePinDirection ¶
ParsePinDirection parses a human-readable pin direction into its numeric code. Supported: input, output.
func ParsePinState ¶
ParsePinState parses a human-readable pin state into its numeric code. Supported: connected, disconnected, selectable.
func ParsePinType ¶
ParsePinType parses a human-readable pin type into its numeric code. Supported: mux, ext, synce-eth-port, int-oscillator, gnss.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
A Conn is a connection to netlink family "dpll".
func Dial ¶
Dial opens a Conn for netlink family "dpll". Any options are passed directly to the underlying netlink package.
func (*Conn) DoDeviceGet ¶
func (c *Conn) DoDeviceGet(req DoDeviceGetRequest) (*DoDeviceGetReply, error)
DoDeviceGet wraps the "device-get" operation: Get list of DPLL devices (dump) or attributes of a single dpll device
func (*Conn) DoDeviceIDGet ¶
func (c *Conn) DoDeviceIDGet(req DoDeviceIDGetRequest) (*DoDeviceIDGetReply, error)
DoDeviceIDGet wraps the "device-id-get" operation: Get id of dpll device that matches given attributes
func (*Conn) DoPinGet ¶
func (c *Conn) DoPinGet(req DoPinGetRequest) (*PinInfo, error)
DoPinGet wraps the "pin-get" operation:
func (*Conn) DumpDeviceGet ¶
func (c *Conn) DumpDeviceGet() ([]*DoDeviceGetReply, error)
func (*Conn) DumpPinGet ¶
func (*Conn) GetGenetlinkConn ¶
GetGenetlinkConn exposes genetlink connection
func (*Conn) GetGenetlinkFamily ¶
GetGenetlinkFamily exposes genetlink family
func (*Conn) GetMcastGroupID ¶
GetMcastGroupID finds the requested multicast group in the family and returns its ID
func (*Conn) PinPhaseAdjust ¶
func (c *Conn) PinPhaseAdjust(req PinPhaseAdjustRequest) error
PinPhaseAdjust wraps the "pin-set" operation: Set PhaseAdjust of a target pin
type DoDeviceGetReply ¶
type DoDeviceGetReply struct {
ID uint32
ModuleName string
Mode uint32
ModeSupported []uint32
LockStatus uint32
Temp int32
ClockID uint64
Type uint32
LockStatusError uint32
ClockQualityLevel []uint32
PhaseOffsetMonitor uint32
PhaseOffsetAverageFactor uint32
FrequencyMonitor uint32
}
DoDeviceGetReply is used with the DoDeviceGet method.
func ParseDeviceReplies ¶
func ParseDeviceReplies(msgs []genetlink.Message) ([]*DoDeviceGetReply, error)
type DoDeviceGetRequest ¶
DoDeviceGetRequest is used with the DoDeviceGet method.
type DoDeviceIDGetReply ¶
type DoDeviceIDGetReply struct {
ID uint32
}
DoDeviceIDGetReply is used with the DoDeviceIDGet method.
type DoDeviceIDGetRequest ¶
type DoDeviceIDGetRequest struct {
// TODO: field "ModuleName", type "string"
ClockID uint64
Type uint8
}
DoDeviceIDGetRequest is used with the DoDeviceIDGet method.
type DoPinGetRequest ¶
type DoPinGetRequest struct {
ID uint32
}
DoPinGetRequest is used with the DoPinGet method.
type DpllStatusHR ¶
type DpllStatusHR struct {
Timestamp time.Time `json:"timestamp"`
ID uint32 `json:"id"`
ModuleName string `json:"moduleName"`
Mode string `json:"mode"`
ModeSupported string `json:"modeSupported"`
LockStatus string `json:"lockStatus"`
ClockID string `json:"clockId"`
Type string `json:"type"`
Temp float64 `json:"temp,omitempty"`
LockStatusError string `json:"lockStatusError,omitempty"`
ClockQualityLevel string `json:"clockQualityLevel,omitempty"`
PhaseOffsetMonitor string `json:"phaseOffsetMonitor,omitempty"`
PhaseOffsetAverageFactor uint32 `json:"phaseOffsetAverageFactor,omitempty"`
FrequencyMonitor string `json:"frequencyMonitor,omitempty"`
}
DpllStatusHR represents human-readable DPLL status
type FrequencyRange ¶
type FrequencyRange struct {
FrequencyMin uint64 `json:"frequencyMin"`
FrequencyMax uint64 `json:"frequencyMax"`
}
FrequencyRange contains nested netlink attributes.
type PinControl ¶
func (PinControl) String ¶
func (p PinControl) String() string
String returns a concise debug representation aligned with PinParentDeviceHR field semantics (direction/state as names when known).
type PinInfo ¶
type PinInfo struct {
ID uint32
ParentID uint32
ModuleName string
ClockID uint64
BoardLabel string
PanelLabel string
PackageLabel string
Type uint32
Direction uint32
Frequency uint64
FrequencySupported []FrequencyRange
FrequencyMin uint64
FrequencyMax uint64
Prio uint32
State uint32
Capabilities uint32
ParentDevice []PinParentDevice
ParentPin []PinParentPin
PhaseAdjustMin int32
PhaseAdjustMax int32
PhaseAdjust int32
PhaseOffset int64
FractionalFrequencyOffset int
FractionalFrequencyOffsetPPT int64
EsyncFrequency int64
EsyncFrequencySupported []FrequencyRange
EsyncPulse uint32
ReferenceSync []ReferenceSync
PhaseAdjustGran uint32
MeasuredFrequency uint64
Operstate uint32
}
PinInfo is used with the DoPinSet /DoPinGet / DumpPinGet / monitor methods.
type PinInfoHR ¶
type PinInfoHR struct {
Timestamp time.Time `json:"timestamp"`
ID uint32 `json:"id"`
ModuleName string `json:"moduleName,omitempty"`
ClockID string `json:"clockId"`
BoardLabel string `json:"boardLabel,omitempty"`
PanelLabel string `json:"panelLabel,omitempty"`
PackageLabel string `json:"packageLabel,omitempty"`
Type string `json:"type,omitempty"`
Frequency uint64 `json:"frequency,omitempty"`
FrequencySupported []FrequencyRange `json:"frequencySupported,omitempty"`
Capabilities string `json:"capabilities,omitempty"`
ParentDevice []PinParentDeviceHR `json:"pinParentDevice,omitempty"`
ParentPin []PinParentPinHR `json:"pinParentPin,omitempty"`
PhaseAdjustMin int32 `json:"phaseAdjustMin,omitempty"`
PhaseAdjustMax int32 `json:"phaseAdjustMax,omitempty"`
PhaseAdjust int32 `json:"phaseAdjust"`
FractionalFrequencyOffset int `json:"fractionalFrequencyOffset,omitempty"`
EsyncFrequency int64 `json:"esyncFrequency,omitempty"`
EsyncFrequencySupported []FrequencyRange `json:"esyncFrequencySupported,omitempty"`
EsyncPulse int64 `json:"esyncPulse,omitempty"`
ReferenceSync []ReferenceSync `json:"referenceSync,omitempty"`
PhaseAdjustGran uint32 `json:"phaseAdjustGran,omitempty"`
FractionalFrequencyOffsetPPT int64 `json:"fractionalFrequencyOffsetPPT,omitempty"`
MeasuredFrequencyHz float64 `json:"measuredFrequencyHz,omitempty"`
Operstate string `json:"operstate,omitempty"`
}
PinInfoHR is used with the DoPinGet method.
type PinParentDevice ¶
type PinParentDevice struct {
ParentID uint32
Direction uint32
Prio *uint32
State uint32
PhaseOffset int64
Operstate uint32
FractionalFrequencyOffset int
FractionalFrequencyOffsetPPT int64
}
PinParentDevice contains nested netlink attributes.
type PinParentDeviceCtl ¶
type PinParentDeviceCtl struct {
ID uint32
Frequency *uint64
PhaseAdjust *int32
EsyncFrequency *uint64
PinParentCtl []PinControl
}
func (PinParentDeviceCtl) String ¶
func (p PinParentDeviceCtl) String() string
String returns a concise debug representation of the pin parent device control request.
type PinParentDeviceHR ¶
type PinParentDeviceHR struct {
ParentID uint32 `json:"parentID"`
Direction string `json:"direction"`
Prio *uint32 `json:"prio,omitempty"`
State string `json:"state"`
PhaseOffsetPs float64 `json:"phaseOffsetPs"`
Operstate string `json:"operstate,omitempty"`
FractionalFrequencyOffset int `json:"fractionalFrequencyOffset,omitempty"`
FractionalFrequencyOffsetPPT int64 `json:"fractionalFrequencyOffsetPPT,omitempty"`
}
PinParentDeviceHR contains nested netlink attributes.
type PinParentPin ¶
PinParentPin contains nested netlink attributes.
type PinParentPinHR ¶
PinParentPin contains nested netlink attributes.
type PinPhaseAdjustRequest ¶
PinPhaseAdjustRequest is used with PinPhaseAdjust method.
type ReferenceSync ¶
ReferenceSync represents a reference-sync pin pair.