2004-10-15 21:41:46 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
* Tuner abstraction layer
|
|
|
|
*
|
2008-05-05 10:32:46 +00:00
|
|
|
* Copyright (C) 2004 Jörg Hohensohn
|
2004-10-15 21:41:46 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2004-10-15 21:41:46 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2007-06-06 19:23:48 +00:00
|
|
|
#ifndef __TUNER_H__
|
|
|
|
#define __TUNER_H__
|
2004-10-15 21:41:46 +00:00
|
|
|
|
2011-12-19 20:12:52 +00:00
|
|
|
#include "config.h"
|
2007-03-16 14:40:40 +00:00
|
|
|
#include "hwcompat.h"
|
|
|
|
|
2017-01-30 14:52:05 +00:00
|
|
|
#ifdef HAVE_RDS_CAP
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
/** Settings to the tuner layer **/
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
RADIO_ALL = -1, /* debug */
|
|
|
|
RADIO_SLEEP,
|
|
|
|
RADIO_FREQUENCY,
|
|
|
|
RADIO_MUTE,
|
|
|
|
RADIO_FORCE_MONO,
|
|
|
|
RADIO_SCAN_FREQUENCY,
|
2009-12-01 17:54:40 +00:00
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
/* 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,
|
2010-11-11 21:13:29 +00:00
|
|
|
RADIO_RSSI,
|
|
|
|
RADIO_RSSI_MIN,
|
|
|
|
RADIO_RSSI_MAX,
|
2007-07-14 11:20:31 +00:00
|
|
|
|
|
|
|
/* Put new general-purpose readback values above this line */
|
|
|
|
__RADIO_GET_STANDARD_LAST
|
|
|
|
};
|
|
|
|
|
2009-12-01 17:54:40 +00:00
|
|
|
#ifdef HAVE_RDS_CAP
|
|
|
|
/** Readback from the tuner RDS layer **/
|
2017-01-30 14:52:05 +00:00
|
|
|
/* returns needed size if buffer size is inadequate */
|
|
|
|
size_t tuner_get_rds_info(int setting, void *dst, size_t dstsize);
|
|
|
|
|
|
|
|
enum RADIO_RDS_INFO
|
2009-12-01 17:54:40 +00:00
|
|
|
{
|
2017-01-30 14:52:05 +00:00
|
|
|
RADIO_RDS_NAME, /* dst: array of char, dstsize: buffer size */
|
|
|
|
RADIO_RDS_TEXT, /* dst: array of char, dstsize: buffer size */
|
|
|
|
RADIO_RDS_PROGRAM_INFO, /* dst: uint16_t *, dstsize: >= sizeof(uint16_t) */
|
|
|
|
RADIO_RDS_CURRENT_TIME, /* dst: time_t *, dstsize: >= sizeof(time_t) */
|
2009-12-01 17:54:40 +00:00
|
|
|
|
|
|
|
/* Put new general-purpose readback values above this line */
|
|
|
|
__RADIO_GET_RDS_INFO_STANDARD_LAST
|
|
|
|
};
|
2017-01-30 14:52:05 +00:00
|
|
|
#endif /* HAVE_RDS_CAP */
|
2009-12-01 17:54:40 +00:00
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
/** Tuner regions **/
|
|
|
|
|
|
|
|
/* Basic region information */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
REGION_EUROPE = 0,
|
|
|
|
REGION_US_CANADA,
|
|
|
|
REGION_JAPAN,
|
|
|
|
REGION_KOREA,
|
2009-09-24 22:05:07 +00:00
|
|
|
REGION_ITALY,
|
|
|
|
REGION_OTHER,
|
2007-07-14 11:20:31 +00:00
|
|
|
|
|
|
|
/* Add new regions above this line */
|
|
|
|
TUNER_NUM_REGIONS
|
|
|
|
};
|
2007-06-06 19:23:48 +00:00
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
struct fm_region_data
|
|
|
|
{
|
|
|
|
int freq_min;
|
|
|
|
int freq_max;
|
|
|
|
int freq_step;
|
2010-07-26 20:15:16 +00:00
|
|
|
int deemphasis; /* in microseconds, usually 50 or 75 */
|
2007-07-14 11:20:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS];
|
2004-10-15 21:41:46 +00:00
|
|
|
|
2007-02-18 08:46:12 +00:00
|
|
|
#if CONFIG_TUNER
|
2004-10-15 21:41:46 +00:00
|
|
|
|
2010-11-18 11:57:51 +00:00
|
|
|
#if !defined(SIMULATOR) && defined(CONFIG_TUNER_MULTI)
|
2010-06-15 20:57:48 +00:00
|
|
|
extern int tuner_detect_type(void);
|
2007-07-14 11:20:31 +00:00
|
|
|
extern int (*tuner_set)(int setting, int value);
|
|
|
|
extern int (*tuner_get)(int setting);
|
|
|
|
#endif /* CONFIG_TUNER_MULTI */
|
2004-10-15 21:41:46 +00:00
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
/** Sanyo LV24020LP **/
|
2007-06-06 19:23:48 +00:00
|
|
|
#if (CONFIG_TUNER & LV24020LP)
|
2008-11-03 15:25:43 +00:00
|
|
|
/* Sansa c200, e200 */
|
2007-07-14 11:20:31 +00:00
|
|
|
#include "lv24020lp.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Samsung S1A0903X01 **/
|
|
|
|
#if (CONFIG_TUNER & S1A0903X01)
|
|
|
|
/* Ondio FM, FM Recorder */
|
|
|
|
#include "s1a0903x01.h"
|
|
|
|
#endif
|
2007-06-06 19:23:48 +00:00
|
|
|
|
2009-07-07 21:57:16 +00:00
|
|
|
/** Philips TEA5760 **/
|
|
|
|
#if (CONFIG_TUNER & TEA5760)
|
|
|
|
#include "tea5760.h"
|
|
|
|
#endif
|
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
/** Philips TEA5767 **/
|
2004-10-15 21:41:46 +00:00
|
|
|
#if (CONFIG_TUNER & TEA5767)
|
2007-07-14 11:20:31 +00:00
|
|
|
/* Ondio FM, FM Recorder, Recorder V2, iRiver h100/h300, iAudio x5 */
|
|
|
|
#include "tea5767.h"
|
|
|
|
#endif
|
|
|
|
|
2008-11-11 14:46:13 +00:00
|
|
|
/* Silicon Labs 4700 */
|
|
|
|
#if (CONFIG_TUNER & SI4700)
|
|
|
|
#include "si4700.h"
|
|
|
|
#endif
|
|
|
|
|
2010-06-16 20:29:08 +00:00
|
|
|
/* RDA micro RDA5802 */
|
|
|
|
#if (CONFIG_TUNER & RDA5802)
|
|
|
|
#include "rda5802.h"
|
2010-06-15 20:57:48 +00:00
|
|
|
#endif
|
|
|
|
|
2009-12-01 17:54:40 +00:00
|
|
|
/* Apple remote tuner */
|
|
|
|
#if (CONFIG_TUNER & IPOD_REMOTE_TUNER)
|
|
|
|
#include "ipod_remote_tuner.h"
|
|
|
|
#endif
|
|
|
|
|
2012-05-19 11:48:43 +00:00
|
|
|
/* SigmaTel/Freescale STFM1000 */
|
|
|
|
#if (CONFIG_TUNER & STFM1000)
|
|
|
|
#include "stfm1000.h"
|
|
|
|
#endif
|
|
|
|
|
2010-11-18 11:57:51 +00:00
|
|
|
#if defined(SIMULATOR)
|
2010-11-18 11:47:42 +00:00
|
|
|
#undef tuner_set
|
|
|
|
int tuner_set(int setting, int value);
|
|
|
|
#undef tuner_get
|
|
|
|
int tuner_get(int setting);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
|
|
|
|
/* Additional messages that get enumerated after tuner driver headers */
|
|
|
|
|
|
|
|
/* for tuner_set */
|
|
|
|
enum
|
2007-03-16 14:40:40 +00:00
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
__RADIO_SET_ADDITIONAL_START = __RADIO_SET_STANDARD_LAST-1,
|
|
|
|
#ifdef HAVE_RADIO_REGION
|
|
|
|
RADIO_REGION,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
RADIO_SET_CHIP_FIRST
|
2007-03-16 14:40:40 +00:00
|
|
|
};
|
2007-07-14 11:20:31 +00:00
|
|
|
|
|
|
|
/* for tuner_get */
|
|
|
|
enum
|
2007-03-16 14:40:40 +00:00
|
|
|
{
|
2007-07-16 15:25:06 +00:00
|
|
|
__RADIO_GET_ADDITIONAL_START = __RADIO_GET_STANDARD_LAST-1,
|
2007-07-14 11:20:31 +00:00
|
|
|
|
|
|
|
RADIO_GET_CHIP_FIRST
|
|
|
|
};
|
|
|
|
|
|
|
|
/** **/
|
|
|
|
|
2010-03-03 23:20:32 +00:00
|
|
|
void tuner_init(void) INIT_ATTR;
|
2004-10-15 21:41:46 +00:00
|
|
|
|
2007-02-18 08:46:12 +00:00
|
|
|
#endif /* #if CONFIG_TUNER */
|
2004-10-15 21:41:46 +00:00
|
|
|
|
2007-06-06 19:23:48 +00:00
|
|
|
#endif /* __TUNER_H__ */
|