Lines Matching defs:sc
40 #define HREAD4(sc, reg) \
41 (bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg)))
42 #define HWRITE4(sc, reg, val) \
43 bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
82 struct stftemp_softc *sc = (struct stftemp_softc *)self;
90 sc->sc_iot = faa->fa_iot;
91 if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr,
92 faa->fa_reg[0].size, 0, &sc->sc_ioh)) {
106 HWRITE4(sc, TEMP, TEMP_PD);
110 HWRITE4(sc, TEMP, 0);
114 HWRITE4(sc, TEMP, TEMP_RSTN);
118 HWRITE4(sc, TEMP, TEMP_RSTN | TEMP_RUN);
121 strlcpy(sc->sc_sensordev.xname, sc->sc_dev.dv_xname,
122 sizeof(sc->sc_sensordev.xname));
123 sc->sc_sensor.type = SENSOR_TEMP;
124 sc->sc_sensor.flags = SENSOR_FINVALID;
125 sensor_attach(&sc->sc_sensordev, &sc->sc_sensor);
126 sensordev_install(&sc->sc_sensordev);
127 sensor_task_register(sc, stftemp_refresh_sensors, 5);
129 sc->sc_ts.ts_node = faa->fa_node;
130 sc->sc_ts.ts_cookie = sc;
131 sc->sc_ts.ts_get_temperature = stftemp_get_temperature;
132 thermal_sensor_register(&sc->sc_ts);
136 stftemp_get_temp(struct stftemp_softc *sc)
140 value = HREAD4(sc, TEMP);
149 struct stftemp_softc *sc = arg;
151 sc->sc_sensor.value = 273150000 + 1000 * stftemp_get_temp(sc);
152 sc->sc_sensor.flags &= ~SENSOR_FINVALID;