コード例 #1
0
ファイル: tea5757.c プロジェクト: MarginC/kame
u_long
tea5757_set_freq(struct tea5757_t *tea, u_long stereo, u_long lock, u_long freq)
{
	u_long data = 0ul;

	if (freq < MIN_FM_FREQ)
		freq = MIN_FM_FREQ;
	if (freq > MAX_FM_FREQ)
		freq = MAX_FM_FREQ;

	data = tea5757_encode_freq(freq) | stereo | lock | TEA5757_SEARCH_END;
	tea5757_hardware_write(tea, data);

	return freq;
}
コード例 #2
0
u_int32_t
tea5757_set_freq(struct tea5757_t *tea, u_int32_t stereo, u_int32_t lock, u_int32_t freq)
{
	u_int32_t data = 0ul;

	if (freq < MIN_FM_FREQ)
		freq = MIN_FM_FREQ;
	if (freq > MAX_FM_FREQ)
		freq = MAX_FM_FREQ;

	data |= tea5757_encode_freq(freq, tea->flags & TEA5757_TEA5759);
	data |= stereo | lock | TEA5757_SEARCH_END;
	tea5757_hardware_write(tea, data);

	return freq;
}
コード例 #3
0
/*
 * Hardware search
 */
void
tea5757_search(struct tea5757_t *tea, u_int32_t stereo, u_int32_t lock, int dir)
{
	u_int32_t reg;
	u_int co = 0;

	reg = stereo | lock | TEA5757_SEARCH_START;
	reg |= dir ? TEA5757_SEARCH_UP : TEA5757_SEARCH_DOWN;
	tea5757_hardware_write(tea, reg);

	DELAY(TEA5757_ACQUISITION_DELAY);

	do {
		DELAY(TEA5757_WAIT_DELAY);
		reg = tea->read(tea->iot, tea->ioh, tea->offset);
	} while ((reg & TEA5757_FREQ) == 0 && ++co < 200);
}