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

Function ti_adc_setup

freebsd/arm/ti/ti_adc.c:181–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181static int
182ti_adc_setup(struct ti_adc_softc *sc)
183{
184 int ain, i;
185 uint32_t enabled;
186
187 TI_ADC_LOCK_ASSERT(sc);
188
189 /* Check for enabled inputs. */
190 enabled = sc->sc_tsc_enabled;
191 for (i = 0; i < sc->sc_adc_nchannels; i++) {
192 ain = sc->sc_adc_channels[i];
193 if (ti_adc_inputs[ain].enable)
194 enabled |= (1U << (ain + 1));
195 }
196
197 /* Set the ADC global status. */
198 if (enabled != 0) {
199 ti_adc_enable(sc);
200 /* Update the enabled steps. */
201 if (enabled != ADC_READ4(sc, ADC_STEPENABLE))
202 ADC_WRITE4(sc, ADC_STEPENABLE, enabled);
203 } else
204 ti_adc_disable(sc);
205
206 return (0);
207}
208
209static void
210ti_adc_input_setup(struct ti_adc_softc *sc, int32_t ain)

Callers 5

ti_adc_clockdiv_procFunction · 0.85
ti_adc_enable_procFunction · 0.85
ti_adc_intrFunction · 0.85
ti_adc_attachFunction · 0.85
ti_adc_detachFunction · 0.85

Calls 2

ti_adc_enableFunction · 0.85
ti_adc_disableFunction · 0.85

Tested by

no test coverage detected