Documentation
¶
Overview ¶
Package pn generates the CCSDS pseudo-randomizer sequence shared by the TM and TC synchronization and channel coding layers.
CCSDS 131.0-B (TM) and CCSDS 231.0-B (TC) specify the same randomizer: an 8-bit linear feedback shift register realising
h(x) = x^8 + x^7 + x^5 + x^3 + 1
preset to all ones. pkg/tmsc and pkg/tcsc both need it, and both used to carry their own byte-for-byte copy. One copy means one place for the taps to be wrong — and they were wrong in both until the sequence was pinned to the digits CCSDS publishes.
pkg/ocsc deliberately does not use this. The optical randomizer of CCSDS 142.0-B works on blocks that are not a whole number of octets, so it needs a bit-addressable implementation of its own.
Index ¶
Constants ¶
const Period = 255
Period is the length in octets after which the sequence repeats.
The register is 8 bits with a maximal-length polynomial, so the bit sequence has period 2^8-1 = 255. Since 255 and 8 share no factor, the octet sequence only realigns after 255 octets.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OIDSequence ¶
type OIDSequence struct {
// contains filtered or unexported fields
}
OIDSequence generates the Pseudo Noise sequence that fills the data field of Only Idle Data transfer frames. CCSDS 132.0-B-3 §4.1.4.6.2 (TM, annex D) and CCSDS 732.1-B-3 §4.1.4.1.10 (USLP, annex H) mandate the same generator: a 32-cell Fibonacci-form linear feedback shift register realising
D^0 + D^1 + D^2 + D^22 + D^32
seeded to all ones at device start-up and never restarted between frames. Both standards publish the same opening octets, FF FF FF FF 6D B6 D8 61 45 1F, which is the only way to tell correct taps from a plausible-looking permutation of them — the same trap the 8-bit randomizer above fell into.
This is not the randomizer of Sequence and Apply: that one is an 8-bit register applied by the channel coding layer to every frame, while this one is a 32-bit register whose output *is* the payload of an idle frame.
Unlike the randomizer this sequence is not tiled: its period is 2^32-1 octets, so it is generated as a stream. A value is safe for concurrent use.
func NewOIDSequence ¶
func NewOIDSequence() *OIDSequence
NewOIDSequence returns a generator in the 'all ones' start-up state. Keep one per channel for the life of the device; restarting it makes every idle frame carry the same octets, which is the insufficient randomization the standards warn against.
func (*OIDSequence) Fill ¶
func (s *OIDSequence) Fill(buf []byte)
Fill writes the next len(buf) octets of the sequence into buf, most significant bit first, advancing the generator.