1
0
Fork 0
forked from len0rd/rockbox

moved and renamed fmradio_set/get_status to power.c, where it now additionally serves well for tuner power enable on OndioFM

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5296 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jörg Hohensohn 2004-10-17 08:53:18 +00:00
parent 79afbafa66
commit 91f9350cbd
8 changed files with 46 additions and 29 deletions

View file

@ -49,6 +49,7 @@
#include "talk.h"
#include "tuner.h"
#include "hwcompat.h"
#include "power.h"
#ifdef CONFIG_TUNER
@ -168,7 +169,7 @@ bool radio_screen(void)
lcd_clear_display();
lcd_setmargins(0, 8);
status_draw(true);
fmradio_set_status(FMRADIO_PLAYING);
radio_set_status(FMRADIO_PLAYING);
font_get(FONT_UI);
lcd_getstringsize("M", &fw, &fh);
@ -405,7 +406,7 @@ bool radio_screen(void)
if(mpeg_status() != MPEG_STATUS_RECORD)
{
default_event_handler(SYS_USB_CONNECTED);
fmradio_set_status(0);
radio_set_status(0);
screen_freeze = true; /* Cosmetic: makes sure the
radio screen doesn't redraw */
done = true;
@ -529,7 +530,7 @@ bool radio_screen(void)
sound_settings_apply();
fmradio_set_status(0);
radio_set_status(0);
if(keep_playing)
{

View file

@ -46,7 +46,6 @@
/* delay loop */
#define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0)
static int fmstatus = 0;
int fmradio_read(int addr)
{
@ -116,14 +115,4 @@ void fmradio_set(int addr, int data)
CE_LO;
}
void fmradio_set_status(int status)
{
fmstatus = status;
}
int fmradio_get_status(void)
{
return fmstatus;
}
#endif

View file

@ -28,6 +28,32 @@
bool charger_enabled;
#endif
#ifdef CONFIG_TUNER
static int fmstatus = 0;
void radio_set_status(int status)
{
fmstatus = status;
#ifdef HAVE_TUNER_PWR_CTRL
if (status)
{
and_b(~0x04, &PADR); /* drive PA2 low for tuner enable */
sleep(1); /* let the voltage settle */
}
else
or_b(0x04, &PADR); /* drive PA2 high for tuner disable */
#endif
}
int radio_get_status(void)
{
return fmstatus;
}
#endif /* #ifdef CONFIG_TUNER */
#ifndef SIMULATOR
void power_init(void)
@ -36,6 +62,11 @@ void power_init(void)
or_b(0x20, &PBIORL); /* Set charging control bit to output */
charger_enable(false); /* Default to charger OFF */
#endif
#ifdef HAVE_TUNER_PWR_CTRL
and_b(~0x30, &PACR2); /* GPIO for PA2 */
or_b(0x04, &PADR); /* drive PA2 high for tuner disable */
or_b(0x04, &PAIOR); /* output for PA2 */
#endif
}
bool charger_inserted(void)

View file

@ -43,6 +43,9 @@
/* Define this if you have an FM Radio */
#define CONFIG_TUNER (S1A0903X01 | TEA5767) /* to be decided at runtime */
/* Define this if the tuner is switched on by software */
#define HAVE_TUNER_PWR_CTRL
/* How to detect USB */
#define USB_FMRECORDERSTYLE 1 /* like FM, on AN1 */

View file

@ -6,6 +6,7 @@
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
* Driver to control the (Samsung) tuner via port-banging SPI
*
* Copyright (C) 2002 by Linus Nielsen Feltzing
*
@ -21,9 +22,5 @@
extern int fmradio_read(int addr);
extern void fmradio_set(int addr, int data);
extern void fmradio_set_status(int status);
extern int fmradio_get_status(void);
#define FMRADIO_PLAYING 1
#endif

View file

@ -30,4 +30,10 @@ void ide_power_enable(bool on);
bool ide_powered(void);
void power_off(void);
#ifdef CONFIG_TUNER
#define FMRADIO_PLAYING 1
extern void radio_set_status(int status);
extern int radio_get_status(void);
#endif
#endif

View file

@ -322,7 +322,7 @@ static void handle_auto_poweroff(void)
if(timeout &&
#ifdef CONFIG_TUNER
!fmradio_get_status() &&
!radio_get_status() &&
#endif
!usb_inserted() &&
(mpeg_stat == 0 ||

View file

@ -45,14 +45,4 @@ void fmradio_set(int addr, int data)
fmradio_reg[addr] = data;
}
void fmradio_set_status(int status)
{
fmstatus = status;
}
int fmradio_get_status(void)
{
return fmstatus;
}
#endif