示例#1
0
static int rt_setfreq(struct rtrack *rt, unsigned long freq)
{
	int i;

	mutex_lock(&rt->lock);			/* Stop other ops interfering */

	rt->curfreq = freq;

	/* now uses VIDEO_TUNER_LOW for fine tuning */

	freq += 171200;			/* Add 10.7 MHz IF 		*/
	freq /= 800;			/* Convert to 50 kHz units	*/

	send_0_byte(rt);		/*  0: LSB of frequency		*/

	for (i = 0; i < 13; i++)	/*   : frequency bits (1-13)	*/
		if (freq & (1 << i))
			send_1_byte(rt);
		else
			send_0_byte(rt);

	send_0_byte(rt);		/* 14: test bit - always 0    */
	send_0_byte(rt);		/* 15: test bit - always 0    */

	send_0_byte(rt);		/* 16: band data 0 - always 0 */
	send_0_byte(rt);		/* 17: band data 1 - always 0 */
	send_0_byte(rt);		/* 18: band data 2 - always 0 */
	send_0_byte(rt);		/* 19: time base - always 0   */

	send_0_byte(rt);		/* 20: spacing (0 = 25 kHz)   */
	send_1_byte(rt);		/* 21: spacing (1 = 25 kHz)   */
	send_0_byte(rt);		/* 22: spacing (0 = 25 kHz)   */
	send_1_byte(rt);		/* 23: AM/FM (FM = 1, always) */

	if (rt->curvol == 0 || rt->muted)
		outb(0xd0, rt->io);	/* volume steady + sigstr */
	else
		outb(0xd8, rt->io);	/* volume steady + sigstr + on */

	mutex_unlock(&rt->lock);

	return 0;
}
static int rt_setfreq(struct rtrack *rt, unsigned long freq)
{
	int i;

	mutex_lock(&rt->lock);			

	rt->curfreq = freq;

	

	freq += 171200;			
	freq /= 800;			

	send_0_byte(rt);		

	for (i = 0; i < 13; i++)	
		if (freq & (1 << i))
			send_1_byte(rt);
		else
			send_0_byte(rt);

	send_0_byte(rt);		
	send_0_byte(rt);		

	send_0_byte(rt);		
	send_0_byte(rt);		
	send_0_byte(rt);		
	send_0_byte(rt);		

	send_0_byte(rt);		
	send_1_byte(rt);		
	send_0_byte(rt);		
	send_1_byte(rt);		

	if (rt->curvol == 0 || rt->muted)
		outb(0xd0, rt->io);	
	else
		outb(0xd8, rt->io);	

	mutex_unlock(&rt->lock);

	return 0;
}
示例#3
0
static int rt_setfreq(struct rt_device *dev, unsigned long freq)
{
	int i;

	/* adapted from radio-aztech.c */

	/* now uses VIDEO_TUNER_LOW for fine tuning */

	freq += 171200;			/* Add 10.7 MHz IF 		*/
	freq /= 800;			/* Convert to 50 kHz units	*/

	mutex_lock(&lock);			/* Stop other ops interfering */

	send_0_byte (io, dev);		/*  0: LSB of frequency		*/

	for (i = 0; i < 13; i++)	/*   : frequency bits (1-13)	*/
		if (freq & (1 << i))
			send_1_byte (io, dev);
		else
			send_0_byte (io, dev);

	send_0_byte (io, dev);		/* 14: test bit - always 0    */
	send_0_byte (io, dev);		/* 15: test bit - always 0    */

	send_0_byte (io, dev);		/* 16: band data 0 - always 0 */
	send_0_byte (io, dev);		/* 17: band data 1 - always 0 */
	send_0_byte (io, dev);		/* 18: band data 2 - always 0 */
	send_0_byte (io, dev);		/* 19: time base - always 0   */

	send_0_byte (io, dev);		/* 20: spacing (0 = 25 kHz)   */
	send_1_byte (io, dev);		/* 21: spacing (1 = 25 kHz)   */
	send_0_byte (io, dev);		/* 22: spacing (0 = 25 kHz)   */
	send_1_byte (io, dev);		/* 23: AM/FM (FM = 1, always) */

	if ((dev->curvol == 0) || (dev->muted))
		outb (0xd0, io);	/* volume steady + sigstr */
	else
		outb (0xd8, io);	/* volume steady + sigstr + on */

	mutex_unlock(&lock);

	return 0;
}
static int aztech_s_frequency(struct radio_isa_card *isa, u32 freq)
{
	struct aztech *az = container_of(isa, struct aztech, isa);
	int  i;

	freq += 171200;			
	freq /= 800;			

	send_0_byte(az);		

	for (i = 0; i < 13; i++)	
		if (freq & (1 << i))
			send_1_byte(az);
		else
			send_0_byte(az);

	send_0_byte(az);		
	send_0_byte(az);		
	send_0_byte(az);		
	if (isa->stereo)		
		send_1_byte(az);
	else
		send_0_byte(az);

	send_1_byte(az);		
	send_0_byte(az);		
	send_0_byte(az);		
	send_1_byte(az);		
	send_0_byte(az);		
	send_1_byte(az);		

	

	udelay(radio_wait_time);
	outb_p(128 + 64 + az->curvol, az->isa.io);

	return 0;
}
static int aztech_s_frequency(struct radio_isa_card *isa, u32 freq)
{
	struct aztech *az = container_of(isa, struct aztech, isa);
	int  i;

	freq += 171200;			/* Add 10.7 MHz IF		*/
	freq /= 800;			/* Convert to 50 kHz units	*/

	send_0_byte(az);		/*  0: LSB of frequency       */

	for (i = 0; i < 13; i++)	/*   : frequency bits (1-13)  */
		if (freq & (1 << i))
			send_1_byte(az);
		else
			send_0_byte(az);

	send_0_byte(az);		/* 14: test bit - always 0    */
	send_0_byte(az);		/* 15: test bit - always 0    */
	send_0_byte(az);		/* 16: band data 0 - always 0 */
	if (isa->stereo)		/* 17: stereo (1 to enable)   */
		send_1_byte(az);
	else
		send_0_byte(az);

	send_1_byte(az);		/* 18: band data 1 - unknown  */
	send_0_byte(az);		/* 19: time base - always 0   */
	send_0_byte(az);		/* 20: spacing (0 = 25 kHz)   */
	send_1_byte(az);		/* 21: spacing (1 = 25 kHz)   */
	send_0_byte(az);		/* 22: spacing (0 = 25 kHz)   */
	send_1_byte(az);		/* 23: AM/FM (FM = 1, always) */

	/* latch frequency */

	udelay(radio_wait_time);
	outb_p(128 + 64 + az->curvol, az->isa.io);

	return 0;
}