mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
FM radio simulation working again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7332 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1d4a6c0cc3
commit
d3fde76fc7
6 changed files with 64 additions and 27 deletions
|
@ -102,6 +102,10 @@ bool handle_radio_presets(void);
|
|||
bool radio_menu(void);
|
||||
bool radio_add_preset(void);
|
||||
|
||||
#ifdef SIMULATOR
|
||||
void radio_set(int setting, int value);
|
||||
int radio_get(int setting);
|
||||
#else
|
||||
#if CONFIG_TUNER == S1A0903X01 /* FM recorder */
|
||||
#define radio_set samsung_set
|
||||
#define radio_get samsung_get
|
||||
|
@ -112,9 +116,11 @@ bool radio_add_preset(void);
|
|||
void (*radio_set)(int setting, int value);
|
||||
int (*radio_get)(int setting);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void radio_init(void)
|
||||
{
|
||||
#ifndef SIMULATOR
|
||||
#if CONFIG_TUNER == (S1A0903X01 | TEA5767)
|
||||
if (read_hw_mask() & TUNER_MODEL)
|
||||
{
|
||||
|
@ -126,6 +132,7 @@ void radio_init(void)
|
|||
radio_set = samsung_set;
|
||||
radio_get = samsung_get;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
radio_stop();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
/* The number of bytes reserved for loadable plugins */
|
||||
#define PLUGIN_BUFFER_SIZE 0x8000
|
||||
|
||||
/* Define this if you have an FM Radio */
|
||||
#define CONFIG_TUNER S1A0903X01
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
/* Define this if you have a MAS3587F */
|
||||
|
@ -62,9 +65,6 @@
|
|||
/* FM recorders can wake up from RTC alarm */
|
||||
#define HAVE_ALARM_MOD 1
|
||||
|
||||
/* Define this if you have an FM Radio */
|
||||
#define CONFIG_TUNER S1A0903X01
|
||||
|
||||
/* How to detect USB */
|
||||
#define USB_FMRECORDERSTYLE 1
|
||||
|
||||
|
|
|
@ -47,11 +47,11 @@
|
|||
/* The number of bytes reserved for loadable plugins */
|
||||
#define PLUGIN_BUFFER_SIZE 0xC0000
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
#define CONFIG_TUNER TEA5767
|
||||
#define CONFIG_TUNER_XTAL 32768000
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
/* Define this if you have a Motorola SCF5249 */
|
||||
#define CONFIG_CPU MCF5249
|
||||
|
||||
|
|
|
@ -43,11 +43,11 @@
|
|||
/* The number of bytes reserved for loadable plugins */
|
||||
#define PLUGIN_BUFFER_SIZE 0xC0000
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
#define CONFIG_TUNER TEA5767
|
||||
#define CONFIG_TUNER_XTAL 32768000
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
/* Define this if you have a Motorola SCF5249 */
|
||||
#define CONFIG_CPU MCF5249
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
/* The number of bytes reserved for loadable plugins */
|
||||
#define PLUGIN_BUFFER_SIZE 0x8000
|
||||
|
||||
/* Define this if you have an FM Radio */
|
||||
#define CONFIG_TUNER (S1A0903X01 | TEA5767) /* to be decided at runtime */
|
||||
#define CONFIG_TUNER_XTAL 13000000
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
/* Define this if you have a SH7034 */
|
||||
|
@ -50,10 +54,6 @@
|
|||
/* Offset ( in the firmware file's header ) to the real data */
|
||||
#define FIRMWARE_OFFSET_FILE_DATA 24
|
||||
|
||||
/* Define this if you have an FM Radio */
|
||||
#define CONFIG_TUNER (S1A0903X01 | TEA5767) /* to be decided at runtime */
|
||||
#define CONFIG_TUNER_XTAL 13000000
|
||||
|
||||
/* Define this if the tuner is switched on by software */
|
||||
#define HAVE_TUNER_PWR_CTRL
|
||||
|
||||
|
|
|
@ -16,33 +16,63 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include <stdbool.h>
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
#include "tuner.h"
|
||||
|
||||
#ifdef CONFIG_TUNER
|
||||
|
||||
static int fmstatus = 0;
|
||||
static int frequency = 0;
|
||||
static bool mono = false;
|
||||
|
||||
static int fmradio_reg[3];
|
||||
|
||||
int fmradio_read(int addr)
|
||||
void radio_set(int setting, int value)
|
||||
{
|
||||
if(addr == 0)
|
||||
return fmradio_reg[2]; /* To please the hardware detection */
|
||||
else
|
||||
switch(setting)
|
||||
{
|
||||
if(addr == 3)
|
||||
{
|
||||
/* Fake a good radio station at 99.4MHz */
|
||||
if(((fmradio_reg[1] >> 3) & 0xffff) == 11010)
|
||||
return 0x100000 | 85600;
|
||||
case RADIO_SLEEP:
|
||||
break;
|
||||
|
||||
case RADIO_FREQUENCY:
|
||||
frequency = value;
|
||||
break;
|
||||
|
||||
case RADIO_MUTE:
|
||||
break;
|
||||
|
||||
case RADIO_FORCE_MONO:
|
||||
mono = value?true:false;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fmradio_set(int addr, int data)
|
||||
int radio_get(int setting)
|
||||
{
|
||||
fmradio_reg[addr] = data;
|
||||
int val = 0;
|
||||
|
||||
switch(setting)
|
||||
{
|
||||
case RADIO_PRESENT:
|
||||
val = 1; /* true */
|
||||
break;
|
||||
|
||||
case RADIO_TUNED:
|
||||
if(frequency == 99500000)
|
||||
val = 1;
|
||||
break;
|
||||
|
||||
case RADIO_STEREO:
|
||||
if(frequency == 99500000)
|
||||
val = mono?0:1;
|
||||
break;
|
||||
|
||||
case RADIO_ALL: /* debug query */
|
||||
break;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue