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

Function ti_adc_input_setup

freebsd/arm/ti/ti_adc.c:209–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209static void
210ti_adc_input_setup(struct ti_adc_softc *sc, int32_t ain)
211{
212 struct ti_adc_input *input;
213 uint32_t reg, val;
214
215 TI_ADC_LOCK_ASSERT(sc);
216
217 input = &ti_adc_inputs[ain];
218 reg = input->stepconfig;
219 val = ADC_READ4(sc, reg);
220
221 /* Set single ended operation. */
222 val &= ~ADC_STEP_DIFF_CNTRL;
223
224 /* Set the negative voltage reference. */
225 val &= ~ADC_STEP_RFM_MSK;
226
227 /* Set the positive voltage reference. */
228 val &= ~ADC_STEP_RFP_MSK;
229
230 /* Set the samples average. */
231 val &= ~ADC_STEP_AVG_MSK;
232 val |= input->samples << ADC_STEP_AVG_SHIFT;
233
234 /* Select the desired input. */
235 val &= ~ADC_STEP_INP_MSK;
236 val |= ain << ADC_STEP_INP_SHIFT;
237
238 /* Set the ADC to one-shot mode. */
239 val &= ~ADC_STEP_MODE_MSK;
240
241 ADC_WRITE4(sc, reg, val);
242}
243
244static void
245ti_adc_reset(struct ti_adc_softc *sc)

Callers 2

ti_adc_samples_avg_procFunction · 0.85
ti_adc_inputs_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected