forked from len0rd/rockbox
D2: Enable FM radio (based on FS#10035 by Michael Burtin with some changes by myself). Also updates the LV24020 driver to add optional logf debugging.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20420 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d63a8fcb7b
commit
1a6bcfa2c1
8 changed files with 57 additions and 7 deletions
|
@ -146,6 +146,13 @@ static const struct button_mapping button_context_keyboard[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||||
}; /* button_context_keyboard */
|
}; /* button_context_keyboard */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_radio[] = {
|
||||||
|
{ ACTION_FM_MENU, BUTTON_MENU, BUTTON_NONE },
|
||||||
|
{ ACTION_FM_STOP, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||||
|
}; /* button_context_radio */
|
||||||
|
|
||||||
const struct button_mapping* target_get_context_mapping(int context)
|
const struct button_mapping* target_get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
switch (context)
|
switch (context)
|
||||||
|
@ -182,6 +189,8 @@ const struct button_mapping* target_get_context_mapping(int context)
|
||||||
|
|
||||||
case CONTEXT_YESNOSCREEN:
|
case CONTEXT_YESNOSCREEN:
|
||||||
return button_context_yesno;
|
return button_context_yesno;
|
||||||
|
case CONTEXT_FM:
|
||||||
|
return button_context_radio;
|
||||||
case CONTEXT_BOOKMARKSCREEN:
|
case CONTEXT_BOOKMARKSCREEN:
|
||||||
return button_context_bmark;
|
return button_context_bmark;
|
||||||
case CONTEXT_QUICKSCREEN:
|
case CONTEXT_QUICKSCREEN:
|
||||||
|
|
|
@ -232,6 +232,19 @@ static const struct button_mapping button_context_keyboard[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD)
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD)
|
||||||
}; /* button_context_keyboard */
|
}; /* button_context_keyboard */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_radio[] = {
|
||||||
|
{ ACTION_STD_PREV, BUTTON_MIDLEFT, BUTTON_NONE },
|
||||||
|
{ ACTION_STD_PREVREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_STD_NEXT, BUTTON_MIDRIGHT, BUTTON_NONE },
|
||||||
|
{ ACTION_STD_NEXTREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_FM_MENU, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
|
||||||
|
{ ACTION_FM_PRESET, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_FM_EXIT, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_FM_MODE, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_FM_PLAY, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_NONE },
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM)
|
||||||
|
}; /* button_context_radio */
|
||||||
|
|
||||||
const struct button_mapping* get_context_mapping(int context)
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
if (context & CONTEXT_CUSTOM2
|
if (context & CONTEXT_CUSTOM2
|
||||||
|
@ -274,6 +287,8 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
|
|
||||||
case CONTEXT_YESNOSCREEN:
|
case CONTEXT_YESNOSCREEN:
|
||||||
return button_context_yesno;
|
return button_context_yesno;
|
||||||
|
case CONTEXT_FM:
|
||||||
|
return button_context_radio;
|
||||||
case CONTEXT_BOOKMARKSCREEN:
|
case CONTEXT_BOOKMARKSCREEN:
|
||||||
return button_context_bmark;
|
return button_context_bmark;
|
||||||
case CONTEXT_QUICKSCREEN:
|
case CONTEXT_QUICKSCREEN:
|
||||||
|
|
|
@ -109,6 +109,14 @@
|
||||||
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
||||||
#define FM_PRESET
|
#define FM_PRESET
|
||||||
#define FM_MODE
|
#define FM_MODE
|
||||||
|
|
||||||
|
#elif (CONFIG_KEYPAD == COWOND2_PAD)
|
||||||
|
#define FM_MENU
|
||||||
|
#define FM_PRESET
|
||||||
|
#define FM_STOP
|
||||||
|
#define FM_MODE
|
||||||
|
#define FM_EXIT
|
||||||
|
#define FM_PLAY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RADIO_SCAN_MODE 0
|
#define RADIO_SCAN_MODE 0
|
||||||
|
|
|
@ -186,6 +186,13 @@ void audiohw_set_lineout_vol(int vol_l, int vol_r)
|
||||||
wmcodec_write(ROUT2VOL, 0x100 | vol_r);
|
wmcodec_write(ROUT2VOL, 0x100 | vol_r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void audiohw_set_aux_vol(int vol_l, int vol_r)
|
||||||
|
{
|
||||||
|
/* OUTMIX */
|
||||||
|
wmcodec_write(LOUTMIX, 0x111 | (vol_l << 5) );
|
||||||
|
wmcodec_write(ROUTMIX, 0x111 | (vol_r << 5) );
|
||||||
|
}
|
||||||
|
|
||||||
void audiohw_set_bass(int value)
|
void audiohw_set_bass(int value)
|
||||||
{
|
{
|
||||||
eq1_reg = (eq1_reg & ~EQ_GAIN_MASK) | EQ_GAIN_VALUE(value);
|
eq1_reg = (eq1_reg & ~EQ_GAIN_MASK) | EQ_GAIN_VALUE(value);
|
||||||
|
|
|
@ -29,19 +29,17 @@
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "fmradio.h" /* physical interface driver */
|
#include "fmradio.h" /* physical interface driver */
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "pp5024.h"
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
|
|
||||||
static struct mutex tuner_mtx;
|
static struct mutex tuner_mtx;
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* define to enable tuner logging */
|
/* define to enable tuner logging */
|
||||||
#define SANYO_TUNER_LOG
|
#undef SANYO_TUNER_LOG_FILE
|
||||||
#endif
|
#undef SANYO_TUNER_LOGF
|
||||||
|
|
||||||
#ifdef SANYO_TUNER_LOG
|
#ifdef SANYO_TUNER_LOG_FILE
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
|
@ -52,6 +50,15 @@ static int fd_log = -1;
|
||||||
/* syncing required because close() is never called */
|
/* syncing required because close() is never called */
|
||||||
#define TUNER_LOG_SYNC() fsync(fd_log)
|
#define TUNER_LOG_SYNC() fsync(fd_log)
|
||||||
#define TUNER_LOG(s...) fdprintf(fd_log, s)
|
#define TUNER_LOG(s...) fdprintf(fd_log, s)
|
||||||
|
|
||||||
|
#elif defined(SANYO_TUNER_LOGF)
|
||||||
|
#define LOGF_ENABLE
|
||||||
|
#include "logf.h"
|
||||||
|
|
||||||
|
#define TUNER_LOG_OPEN()
|
||||||
|
#define TUNER_LOG_SYNC()
|
||||||
|
#define TUNER_LOG(s...) logf(s)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define TUNER_LOG_OPEN()
|
#define TUNER_LOG_OPEN()
|
||||||
#define TUNER_LOG_SYNC()
|
#define TUNER_LOG_SYNC()
|
||||||
|
|
|
@ -49,9 +49,10 @@
|
||||||
/* define this if you would like tagcache to build on this target */
|
/* define this if you would like tagcache to build on this target */
|
||||||
//#define HAVE_TAGCACHE
|
//#define HAVE_TAGCACHE
|
||||||
|
|
||||||
/* FM Tuner
|
/* FM Tuner */
|
||||||
#define CONFIG_TUNER LV24020LP
|
#define CONFIG_TUNER LV24020LP
|
||||||
#define HAVE_TUNER_PWR_CTRL*/
|
#define HAVE_TUNER_PWR_CTRL
|
||||||
|
#define HAVE_RADIO_REGION
|
||||||
|
|
||||||
/* define this if you have a flash memory storage */
|
/* define this if you have a flash memory storage */
|
||||||
#define HAVE_FLASH_STORAGE
|
#define HAVE_FLASH_STORAGE
|
||||||
|
|
|
@ -32,5 +32,6 @@ extern int tenthdb2master(int db);
|
||||||
|
|
||||||
extern void audiohw_set_headphone_vol(int vol_l, int vol_r);
|
extern void audiohw_set_headphone_vol(int vol_l, int vol_r);
|
||||||
extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
|
extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
|
||||||
|
extern void audiohw_set_aux_vol(int vol_l, int vol_r);
|
||||||
|
|
||||||
#endif /* _WM8985_H */
|
#endif /* _WM8985_H */
|
||||||
|
|
|
@ -57,6 +57,7 @@ void audio_input_mux(int source, unsigned flags)
|
||||||
{
|
{
|
||||||
/*audiohw_set_monitor(false);
|
/*audiohw_set_monitor(false);
|
||||||
audiohw_disable_recording();*/
|
audiohw_disable_recording();*/
|
||||||
|
audiohw_set_aux_vol(0,0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ void audio_input_mux(int source, unsigned flags)
|
||||||
{
|
{
|
||||||
/*audiohw_disable_recording();
|
/*audiohw_disable_recording();
|
||||||
audiohw_set_monitor(true); /. line 1 analog audio path */
|
audiohw_set_monitor(true); /. line 1 analog audio path */
|
||||||
|
audiohw_set_aux_vol(7,7);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} /* end switch */
|
} /* end switch */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue