MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sff_8472_calibration

Function sff_8472_calibration

dpdk/lib/ethdev/sff_8472.c:183–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183static void sff_8472_calibration(const uint8_t *data, struct sff_diags *sd)
184{
185 unsigned long i;
186 uint16_t rx_reading;
187
188 /* Calibration should occur for all values (threshold and current) */
189 for (i = 0; i < RTE_DIM(sd->bias_cur); ++i) {
190 /*
191 * Apply calibration formula 1 (Temp., Voltage, Bias, Tx Power)
192 */
193 sd->bias_cur[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_TXI_SLP);
194 sd->tx_power[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_TXPWR_SLP);
195 sd->sfp_voltage[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_V_SLP);
196 sd->sfp_temp[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_T_SLP);
197
198 sd->bias_cur[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_TXI_OFF);
199 sd->tx_power[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_TXPWR_OFF);
200 sd->sfp_voltage[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_V_OFF);
201 sd->sfp_temp[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_T_OFF);
202
203 /*
204 * Apply calibration formula 2 (Rx Power only)
205 */
206 rx_reading = sd->rx_power[i];
207 sd->rx_power[i] = A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR0);
208 sd->rx_power[i] += rx_reading *
209 A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR1);
210 sd->rx_power[i] += rx_reading *
211 A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR2);
212 sd->rx_power[i] += rx_reading *
213 A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR3);
214 }
215}
216
217static void sff_8472_parse_eeprom(const uint8_t *data, struct sff_diags *sd)
218{

Callers 1

sff_8472_parse_eepromFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected