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

Function tsadc_init_tsensor

freebsd/arm64/rockchip/rk_tsadc.c:401–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401static void
402tsadc_init_tsensor(struct tsadc_softc *sc, struct tsensor *sensor)
403{
404 uint32_t val;
405
406 /* Shutdown mode */
407 val = RD4(sc, TSADC_INT_EN);
408 if (sc->shutdown_mode != 0) {
409 /* Signal shutdown of GPIO pin */
410 val &= ~TSADC_INT_EN_2CRU_EN_SRC(sensor->channel);
411 val |= TSADC_INT_EN_2GPIO_EN_SRC(sensor->channel);
412 } else {
413 val |= TSADC_INT_EN_2CRU_EN_SRC(sensor->channel);
414 val &= ~TSADC_INT_EN_2GPIO_EN_SRC(sensor->channel);
415 }
416 WR4(sc, TSADC_INT_EN, val);
417
418 /* Shutdown temperature */
419 val = tsadc_raw_to_temp(sc, sc->shutdown_temp);
420 WR4(sc, TSADC_COMP_SHUT(sensor->channel), val);
421 val = RD4(sc, TSADC_AUTO_CON);
422 val |= TSADC_AUTO_SRC_EN(sensor->channel);
423 WR4(sc, TSADC_AUTO_CON, val);
424
425 /* Alarm temperature */
426 val = tsadc_temp_to_raw(sc, sc->alarm_temp);
427 WR4(sc, TSADC_COMP_INT(sensor->channel), val);
428 val = RD4(sc, TSADC_INT_EN);
429 val |= TSADC_COMP_INT_SRC_EN(sensor->channel);
430 WR4(sc, TSADC_INT_EN, val);
431}
432
433static void
434tsadc_init(struct tsadc_softc *sc)

Callers 1

tsadc_attachFunction · 0.85

Calls 4

tsadc_raw_to_tempFunction · 0.85
tsadc_temp_to_rawFunction · 0.85
RD4Function · 0.50
WR4Function · 0.50

Tested by

no test coverage detected