blob: 279e1b8d23440a1693fff1f1ec69ab9e1846cc28 [file] [log] [blame]
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000019#include <stdbool.h>
20#include "config.h"
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000021#include "debug.h"
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000022#include "tuner.h"
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000023
Jens Arnoldc6522182007-02-18 08:46:12 +000024#if CONFIG_TUNER
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000025
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000026static int frequency = 0;
27static bool mono = false;
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000028
Michael Sevakisd89eba12007-06-06 19:39:59 +000029static bool powered = false;
Michael Sevakisd89eba12007-06-06 19:39:59 +000030
Michael Sevakis680afaf2007-07-14 13:41:59 +000031void tuner_init(void)
32{
33}
34
Michael Sevakis7d759f62007-07-14 11:20:31 +000035int tuner_set(int setting, int value)
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000036{
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000037 switch(setting)
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000038 {
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000039 case RADIO_SLEEP:
40 break;
41
42 case RADIO_FREQUENCY:
43 frequency = value;
44 break;
45
Michael Sevakisa2ee6a62007-03-16 14:40:40 +000046 case RADIO_SCAN_FREQUENCY:
47 frequency = value;
48 break;
49
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000050 case RADIO_MUTE:
51 break;
52
53 case RADIO_FORCE_MONO:
54 mono = value?true:false;
55 break;
56
57 default:
Michael Sevakisa2ee6a62007-03-16 14:40:40 +000058 return -1;
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000059 }
Michael Sevakisa2ee6a62007-03-16 14:40:40 +000060
61 return 1;
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000062}
63
Michael Sevakis7d759f62007-07-14 11:20:31 +000064int tuner_get(int setting)
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000065{
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000066 int val = 0;
67
68 switch(setting)
69 {
70 case RADIO_PRESENT:
71 val = 1; /* true */
72 break;
73
74 case RADIO_TUNED:
75 if(frequency == 99500000)
76 val = 1;
77 break;
78
79 case RADIO_STEREO:
80 if(frequency == 99500000)
81 val = mono?0:1;
82 break;
83
84 case RADIO_ALL: /* debug query */
85 break;
86 }
87 return val;
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000088}
89
Michael Sevakis7d759f62007-07-14 11:20:31 +000090bool tuner_power(bool status)
Michael Sevakisd89eba12007-06-06 19:39:59 +000091{
92 bool oldstatus = powered;
93 powered = status;
94 return oldstatus;
95}
Michael Sevakisd89eba12007-06-06 19:39:59 +000096
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000097#endif