diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/config.h | 5 | ||||
-rw-r--r-- | firmware/export/hwcompat.h | 7 | ||||
-rw-r--r-- | firmware/export/lv24020lp.h | 51 | ||||
-rw-r--r-- | firmware/export/power.h | 4 | ||||
-rw-r--r-- | firmware/export/s1a0903x01.h | 40 | ||||
-rw-r--r-- | firmware/export/tea5767.h | 50 | ||||
-rw-r--r-- | firmware/export/tuner.h | 173 |
7 files changed, 247 insertions, 83 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h index 86e27d0031..056b9857bc 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -245,6 +245,11 @@ #define CONFIG_REMOTE_DEFAULT_ICON_WIDTH 6 #endif +#if (CONFIG_TUNER & (CONFIG_TUNER - 1)) != 0 +/* Multiple possible tuners */ +#define CONFIG_TUNER_MULTI +#endif + /* Enable the directory cache and tagcache in RAM if we have * plenty of RAM. Both features can be enabled independently. */ #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ diff --git a/firmware/export/hwcompat.h b/firmware/export/hwcompat.h index bffb76e3ef..bebca68a6c 100644 --- a/firmware/export/hwcompat.h +++ b/firmware/export/hwcompat.h @@ -46,4 +46,11 @@ bool is_new_player(void); #endif +#ifdef CONFIG_TUNER_MULTI +static inline int tuner_detect_type(void) +{ + return (HW_MASK & TUNER_MODEL) ? TEA5767 : S1A0903X01; +} +#endif + #endif /* HWCOMPAT_H */ diff --git a/firmware/export/lv24020lp.h b/firmware/export/lv24020lp.h new file mode 100644 index 0000000000..0fc39b18df --- /dev/null +++ b/firmware/export/lv24020lp.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * Tuner header for the Sanyo LV24020LP + * + * Copyright (C) 2007 Michael Sevakis + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _LV24020LP_H_ +#define _LV24020LP_H_ + +/* Define additional tuner messages here */ +#define HAVE_RADIO_REGION + +#define LV24020LP_CTRL_STAT (RADIO_GET_CHIP_FIRST+0) +#define LV24020LP_REG_STAT (RADIO_GET_CHIP_FIRST+1) +#define LV24020LP_MSS_FM (RADIO_GET_CHIP_FIRST+2) +#define LV24020LP_MSS_IF (RADIO_GET_CHIP_FIRST+3) +#define LV24020LP_MSS_SD (RADIO_GET_CHIP_FIRST+4) +#define LV24020LP_IF_SET (RADIO_GET_CHIP_FIRST+5) +#define LV24020LP_SD_SET (RADIO_GET_CHIP_FIRST+6) + +struct lv24020lp_region_data +{ + unsigned char deemphasis; +} __attribute__((packed)); + +const unsigned char lv24020lp_region_data[TUNER_NUM_REGIONS]; + +int lv24020lp_set(int setting, int value); +int lv24020lp_get(int setting); +void lv24020lp_power(bool status); + +#ifndef CONFIG_TUNER_MULTI +#define tuner_set lv24020lp_set +#define tuner_get lv24020lp_get +#endif + +#endif /* _LV24020LP_H_ */ diff --git a/firmware/export/power.h b/firmware/export/power.h index cafd6f87c8..8ecff6c51e 100644 --- a/firmware/export/power.h +++ b/firmware/export/power.h @@ -48,8 +48,8 @@ bool spdif_powered(void); #endif #if CONFIG_TUNER -extern bool radio_power(bool status); -extern bool radio_powered(void); +extern bool tuner_power(bool status); +extern bool tuner_powered(void); #endif #endif diff --git a/firmware/export/s1a0903x01.h b/firmware/export/s1a0903x01.h new file mode 100644 index 0000000000..bf497628b7 --- /dev/null +++ b/firmware/export/s1a0903x01.h @@ -0,0 +1,40 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * Tuner header for the Samsung S1A0903X01 + * + * Copyright (C) 2007 Michael Sevakis + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _S1A0903X01_H_ +#define _S1A0903X01_H_ + +/* Define additional tuner messages here */ +#define HAVE_RADIO_MUTE_TIMEOUT + +#if 0 +#define S1A0903X01_IF_MEASUREMENT (RADIO_SET_CHIP_FIRST+0) +#define S1A0903X01_SENSITIVITY (RADIO_SET_CHIP_FIRST+1) +#endif + +int s1a0903x01_set(int setting, int value); +int s1a0903x01_get(int setting); + +#ifndef CONFIG_TUNER_MULTI +#define tuner_set s1a0903x01_get +#define tuner_get s1a0903x01_set +#endif + +#endif /* _S1A0903X01_H_ */ diff --git a/firmware/export/tea5767.h b/firmware/export/tea5767.h new file mode 100644 index 0000000000..dfa6149f20 --- /dev/null +++ b/firmware/export/tea5767.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * Tuner header for the Philips TEA5767 + * + * Copyright (C) 2007 Michael Sevakis + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _TEA5767_H_ +#define _TEA5767_H_ + +#define HAVE_RADIO_REGION +#define HAVE_RADIO_MUTE_TIMEOUT + +struct tea5767_region_data +{ + unsigned char deemphasis; /* 0: 50us, 1: 75us */ + unsigned char band; /* 0: europe, 1: japan (BL in TEA spec)*/ +} __attribute__((packed)); + +const struct tea5767_region_data tea5767_region_data[TUNER_NUM_REGIONS]; + +struct tea5767_dbg_info +{ + unsigned char read_regs[5]; + unsigned char write_regs[5]; +}; + +int tea5767_set(int setting, int value); +int tea5767_get(int setting); +void tea5767_dbg_info(struct tea5767_dbg_info *info); + +#ifndef CONFIG_TUNER_MULTI +#define tuner_set tea5767_set +#define tuner_get tea5767_get +#endif + +#endif /* _TEA5767_H_ */ diff --git a/firmware/export/tuner.h b/firmware/export/tuner.h index 9f6d29f697..cf18102744 100644 --- a/firmware/export/tuner.h +++ b/firmware/export/tuner.h @@ -22,101 +22,112 @@ #include "hwcompat.h" -/* settings to the tuner layer */ -#define RADIO_ALL -1 /* debug */ -#define RADIO_SLEEP 0 -#define RADIO_FREQUENCY 1 -#define RADIO_MUTE 2 -#define RADIO_IF_MEASUREMENT 3 -#define RADIO_SENSITIVITY 4 -#define RADIO_FORCE_MONO 5 -#define RADIO_SCAN_FREQUENCY 6 -#if (CONFIG_TUNER & TEA5767) -#define RADIO_SET_DEEMPHASIS 7 -#define RADIO_SET_BAND 8 -#endif -#if (CONFIG_TUNER & LV24020LP) -#define RADIO_REGION 9 /* to be used for all tuners */ -#define RADIO_REG_STAT 100 -#define RADIO_MSS_FM 101 -#define RADIO_MSS_IF 102 -#define RADIO_MSS_SD 103 -#define RADIO_IF_SET 104 -#define RADIO_SD_SET 105 -#endif -/* readback from the tuner layer */ -#define RADIO_PRESENT 0 -#define RADIO_TUNED 1 -#define RADIO_STEREO 2 +/** Settings to the tuner layer **/ +enum +{ + RADIO_ALL = -1, /* debug */ + RADIO_SLEEP, + RADIO_FREQUENCY, + RADIO_MUTE, + RADIO_FORCE_MONO, + RADIO_SCAN_FREQUENCY, + + /* Put new general-purpose settings above this line */ + __RADIO_SET_STANDARD_LAST +}; + +/** Readback from the tuner layer **/ +enum +{ + RADIO_PRESENT = 0, + RADIO_TUNED, + RADIO_STEREO, + + /* Put new general-purpose readback values above this line */ + __RADIO_GET_STANDARD_LAST +}; + +/** Tuner regions **/ + +/* Basic region information */ +enum +{ + REGION_EUROPE = 0, + REGION_US_CANADA, + REGION_JAPAN, + REGION_KOREA, + + /* Add new regions above this line */ + TUNER_NUM_REGIONS +}; -#define REGION_EUROPE 0 -#define REGION_US_CANADA 1 -#define REGION_JAPAN 2 -#define REGION_KOREA 3 +struct fm_region_data +{ + int freq_min; + int freq_max; + int freq_step; +}; + +extern const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS]; #if CONFIG_TUNER #ifdef SIMULATOR -int radio_set(int setting, int value); -int radio_get(int setting); +int tuner_set(int setting, int value); +int tuner_get(int setting); #else -#if CONFIG_TUNER == S1A0903X01 /* FM recorder */ -#define radio_set samsung_set -#define radio_get samsung_get -#elif CONFIG_TUNER == LV24020LP /* Sansa */ -#define radio_set sanyo_set -#define radio_get sanyo_get -#elif CONFIG_TUNER == TEA5767 /* iRiver, iAudio */ -#define radio_set philips_set -#define radio_get philips_get -#elif CONFIG_TUNER == (S1A0903X01 | TEA5767) /* OndioFM */ -#define radio_set _radio_set -#define radio_get _radio_get -int (*_radio_set)(int setting, int value); -int (*_radio_get)(int setting); -#endif /* CONFIG_TUNER == */ -#endif /* SIMULATOR */ -#if (CONFIG_TUNER & S1A0903X01) -int samsung_set(int setting, int value); -int samsung_get(int setting); -#endif /* CONFIG_TUNER & S1A0903X01 */ +#ifdef CONFIG_TUNER_MULTI +extern int (*tuner_set)(int setting, int value); +extern int (*tuner_get)(int setting); +#endif /* CONFIG_TUNER_MULTI */ +/** Sanyo LV24020LP **/ #if (CONFIG_TUNER & LV24020LP) -int sanyo_set(int setting, int value); -int sanyo_get(int setting); -#endif /* CONFIG_TUNER & LV24020LP */ +/* Sansa e200 Series */ +#include "lv24020lp.h" +#endif + +/** Samsung S1A0903X01 **/ +#if (CONFIG_TUNER & S1A0903X01) +/* Ondio FM, FM Recorder */ +#include "s1a0903x01.h" +#endif +/** Philips TEA5767 **/ #if (CONFIG_TUNER & TEA5767) -struct philips_dbg_info +/* Ondio FM, FM Recorder, Recorder V2, iRiver h100/h300, iAudio x5 */ +#include "tea5767.h" +#endif + +#endif /* SIMULATOR */ + +/* Additional messages that get enumerated after tuner driver headers */ + +/* for tuner_set */ +enum { - unsigned char read_regs[5]; - unsigned char write_regs[5]; + __RADIO_SET_ADDITIONAL_START = __RADIO_SET_STANDARD_LAST-1, +#ifdef HAVE_RADIO_REGION + RADIO_REGION, +#endif + + RADIO_SET_CHIP_FIRST }; -int philips_set(int setting, int value); -int philips_get(int setting); -void philips_dbg_info(struct philips_dbg_info *info); -#endif /* CONFIG_TUNER & TEA5767 */ - -/* Just inline here since only radio screen needs this atm and - there's no tuner.c. */ -static inline void tuner_init(void) + +/* for tuner_get */ +enum { -#ifndef SIMULATOR -#if CONFIG_TUNER == (S1A0903X01 | TEA5767) - if (HW_MASK & TUNER_MODEL) - { - _radio_set = philips_set; - _radio_get = philips_get; - } - else - { - _radio_set = samsung_set; - _radio_get = samsung_get; - } -#endif -#endif -} + __RADIO_GET_ADDITIONAL_START = __RADIO_SET_STANDARD_LAST-1, + + RADIO_GET_CHIP_FIRST +}; + +/** **/ + +void tuner_init(void); +bool tuner_power(bool power); +bool tuner_powered(void); #endif /* #if CONFIG_TUNER */ |