blob: 3fd61b6f4a8b4215ba8b4c566db5911e57fdb838 [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 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000021#include <stdbool.h>
22#include "config.h"
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000023#include "debug.h"
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000024#include "tuner.h"
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000025
Jens Arnoldc6522182007-02-18 08:46:12 +000026#if CONFIG_TUNER
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000027
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000028static int frequency = 0;
29static bool mono = false;
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000030
Michael Sevakisd89eba12007-06-06 19:39:59 +000031static bool powered = false;
Michael Sevakisd89eba12007-06-06 19:39:59 +000032
Michael Sevakis680afaf2007-07-14 13:41:59 +000033void tuner_init(void)
34{
35}
36
Michael Sevakis7d759f62007-07-14 11:20:31 +000037int tuner_set(int setting, int value)
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000038{
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000039 switch(setting)
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000040 {
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000041 case RADIO_SLEEP:
42 break;
43
44 case RADIO_FREQUENCY:
45 frequency = value;
46 break;
47
Michael Sevakisa2ee6a62007-03-16 14:40:40 +000048 case RADIO_SCAN_FREQUENCY:
49 frequency = value;
50 break;
51
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000052 case RADIO_MUTE:
53 break;
54
55 case RADIO_FORCE_MONO:
56 mono = value?true:false;
57 break;
58
59 default:
Michael Sevakisa2ee6a62007-03-16 14:40:40 +000060 return -1;
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000061 }
Michael Sevakisa2ee6a62007-03-16 14:40:40 +000062
63 return 1;
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000064}
65
Michael Sevakis7d759f62007-07-14 11:20:31 +000066int tuner_get(int setting)
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000067{
Linus Nielsen Feltzingd3fde762005-08-16 06:50:25 +000068 int val = 0;
69
70 switch(setting)
71 {
72 case RADIO_PRESENT:
73 val = 1; /* true */
74 break;
75
76 case RADIO_TUNED:
77 if(frequency == 99500000)
78 val = 1;
79 break;
80
81 case RADIO_STEREO:
82 if(frequency == 99500000)
83 val = mono?0:1;
84 break;
85
86 case RADIO_ALL: /* debug query */
87 break;
88 }
89 return val;
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000090}
91
Michael Sevakis7d759f62007-07-14 11:20:31 +000092bool tuner_power(bool status)
Michael Sevakisd89eba12007-06-06 19:39:59 +000093{
94 bool oldstatus = powered;
95 powered = status;
96 return oldstatus;
97}
Michael Sevakisd89eba12007-06-06 19:39:59 +000098
Linus Nielsen Feltzingafd74212004-07-02 07:43:49 +000099#endif