Beispiel #1
0
int
rtii_find(bus_space_tag_t iot, bus_space_handle_t ioh, int flags)
{
	struct rtii_softc sc;
	u_int32_t freq;

	sc.tea.iot = iot;
	sc.tea.ioh = ioh;
	sc.tea.offset = 0;
	sc.tea.flags = flags;
	sc.tea.init = rtii_init;
	sc.tea.rset = rtii_rset;
	sc.tea.write_bit = rtii_write_bit;
	sc.tea.read = rtii_hw_read;
	sc.lock = TEA5757_S030;
	sc.stereo = TEA5757_STEREO;

	/*
	 * Let's try to write and read a frequency.
	 * If the written and read frequencies are
	 * the same then success.
	 */
	sc.freq = MIN_FM_FREQ;
	tea5757_set_freq(&sc.tea, sc.stereo, sc.lock, sc.freq);
	rtii_set_mute(&sc);
	freq = rtii_hw_read(iot, ioh, sc.tea.offset);
	if (tea5757_decode_freq(freq, sc.tea.flags & TEA5757_TEA5759)
			== sc.freq)
		return 1;

	return 0;
}
Beispiel #2
0
void
rtii_attach(struct device *parent, struct device *self, void *aux)
{
	struct rtii_softc *sc = (void *) self;
	struct isa_attach_args *ia = aux;
	struct cfdata *cf = sc->dev.dv_cfdata;

	sc->tea.iot = ia->ia_iot;
	sc->mute = 0;
	sc->vol = 0;
	sc->freq = MIN_FM_FREQ;
	sc->stereo = TEA5757_STEREO;
	sc->lock = TEA5757_S030;

	/* remap I/O */
	if (bus_space_map(sc->tea.iot, ia->ia_iobase, ia->ia_iosize,
			  0, &sc->tea.ioh)) {
		printf(": bus_space_map() failed\n");
		return;
	}

	sc->tea.offset = 0;
	sc->tea.flags = cf->cf_flags;

	sc->tea.init = rtii_init;
	sc->tea.rset = rtii_rset;
	sc->tea.write_bit = rtii_write_bit;
	sc->tea.read = rtii_hw_read;

	printf(": AIMS Lab Radiotrack II\n");
	tea5757_set_freq(&sc->tea, sc->stereo, sc->lock, sc->freq);
	rtii_set_mute(sc);

	radio_attach_mi(&rtii_hw_if, sc, &sc->dev);
}
Beispiel #3
0
int
sf2r_find(bus_space_tag_t iot, bus_space_handle_t ioh)
{
	struct sf2r_softc sc;
	u_int32_t freq;

	sc.tea.iot = iot;
	sc.tea.ioh = ioh;
	sc.tea.offset = 0;
	sc.tea.init = sf2r_init;
	sc.tea.rset = sf2r_rset;
	sc.tea.write_bit = sf2r_write_bit;
	sc.tea.read = sf2r_read_register;
	sc.lock = TEA5757_S030;
	sc.stereo = TEA5757_STEREO;

	if ((bus_space_read_1(iot, ioh, 0) & 0x70) == 0x30) {
		/*
		 * Let's try to write and read a frequency.
		 * If the written and read frequencies are
		 * the same then success.
		 */
		sc.freq = MIN_FM_FREQ;
		tea5757_set_freq(&sc.tea, sc.stereo, sc.lock, sc.freq);
		sf2r_set_mute(&sc);
		freq = sf2r_read_register(iot, ioh, sc.tea.offset);
		if (tea5757_decode_freq(freq, 0) == sc.freq)
			return 1;
	}

	return 0;
}
Beispiel #4
0
void
sf2r_attach(struct device *parent, struct device *self, void *aux)
{
	struct sf2r_softc *sc = (void *) self;
	struct isa_attach_args *ia = aux;

	sc->tea.iot = ia->ia_iot;
	sc->tea.flags = 0;
	sc->mute = 0;
	sc->vol = 0;
	sc->freq = MIN_FM_FREQ;
	sc->stereo = TEA5757_STEREO;
	sc->lock = TEA5757_S030;

	/* remap I/O */
	if (bus_space_map(sc->tea.iot, ia->ia_io[0].ir_addr,
	    ia->ia_io[0].ir_size, 0, &sc->tea.ioh))
		panic("sf2rattach: bus_space_map() failed");

	sc->tea.offset = 0;

	sc->tea.init = sf2r_init;
	sc->tea.rset = sf2r_rset;
	sc->tea.write_bit = sf2r_write_bit;
	sc->tea.read = sf2r_read_register;

	printf(": SoundForte RadioLink SF16-FMR2\n");
	tea5757_set_freq(&sc->tea, sc->stereo, sc->lock, sc->freq);
	sf2r_set_mute(sc);

	radio_attach_mi(&sf2r_hw_if, sc, &sc->sc_dev);
}
Beispiel #5
0
static void
gtp_set_mute(struct gtp_softc *sc)
{
	if (sc->mute || !sc->vol)
		bus_space_write_2(sc->tea.iot, sc->tea.ioh, 0, GEMTEK_PCI_MUTE);
	else
		sc->freq = tea5757_set_freq(&sc->tea,
		    sc->lock, sc->stereo, sc->freq);
}
Beispiel #6
0
int
rtii_set_info(void *v, struct radio_info *ri)
{
	struct rtii_softc *sc = v;

	sc->mute = ri->mute ? 1 : 0;
	sc->vol = ri->volume ? 255 : 0;
	sc->stereo = ri->stereo ? TEA5757_STEREO: TEA5757_MONO;
	sc->lock = tea5757_encode_lock(ri->lock);
	ri->freq = sc->freq = tea5757_set_freq(&sc->tea,
			sc->lock, sc->stereo, ri->freq);
	rtii_set_mute(sc);

	return (0);
}
int
fmsradio_set_info(void *v, struct radio_info *ri)
{
	struct fms_softc *sc = v;
	struct fmsradio_if *radio = (struct fmsradio_if *)sc->radio;

	radio->mute = ri->mute ? 1 : 0;
	radio->vol = ri->volume ? 255 : 0;
	radio->stereo = ri->stereo ? TEA5757_STEREO: TEA5757_MONO;
	radio->lock = tea5757_encode_lock(ri->lock);
	ri->freq = radio->freq = tea5757_set_freq(&radio->tea,
		radio->lock, radio->stereo, ri->freq);
	fmsradio_set_mute(sc);

	return (0);
}
/* SF64-PCR specific routines */
int
sf64pcr_probe(struct fms_softc *sc)
{
	struct fmsradio_if *radio = (struct fmsradio_if *)sc->radio;
	u_int32_t freq;

	radio->tea.init = sf64pcr_init;
	radio->tea.rset = sf64pcr_rset;
	radio->tea.write_bit = sf64pcr_write_bit;
	radio->tea.read = sf64pcr_hw_read;

	tea5757_set_freq(&radio->tea, radio->stereo,
	    radio->lock, radio->freq);
	freq = tea5757_decode_freq(sf64pcr_hw_read(radio->tea.iot,
	    radio->tea.ioh, radio->tea.offset),
	    radio->tea.flags & TEA5757_TEA5759);
	if (freq != radio->freq)
		return TUNER_UNKNOWN;

	return TUNER_SF64PCR;
}