MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / decodeSectorRecord

Method decodeSectorRecord

arch/fb100/decoder.cc:111–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109 }
110
111 void decodeSectorRecord() override
112 {
113 auto rawbits = readRawBits(FB100_RECORD_SIZE * 16);
114
115 const Bytes bytes = decodeFmMfm(rawbits).slice(0, FB100_RECORD_SIZE);
116 ByteReader br(bytes);
117 br.seek(1);
118 const Bytes id = br.read(FB100_ID_SIZE);
119 uint16_t wantIdCrc = br.read_be16();
120 uint16_t gotIdCrc = checksum(id);
121 const Bytes payload = br.read(FB100_PAYLOAD_SIZE);
122 uint16_t wantPayloadCrc = br.read_be16();
123 uint16_t gotPayloadCrc = checksum(payload);
124
125 if (wantIdCrc != gotIdCrc)
126 return;
127
128 uint8_t abssector = id[2];
129 _sector->logicalCylinder = abssector >> 1;
130 _sector->logicalHead = 0;
131 _sector->logicalSector = abssector & 1;
132 _sector->data.writer().append(id.slice(5, 12)).append(payload);
133
134 _sector->status = (wantPayloadCrc == gotPayloadCrc)
135 ? Sector::OK
136 : Sector::BAD_CHECKSUM;
137 }
138};
139
140std::unique_ptr<Decoder> createFb100Decoder(const DecoderProto& config)

Callers

nothing calls this directly

Calls 7

checksumFunction · 0.85
sliceMethod · 0.80
read_be16Method · 0.80
writerMethod · 0.80
decodeFmMfmFunction · 0.50
seekMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected