diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-10-17 08:53:18 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-10-17 08:53:18 +0000 |
commit | 91f9350cbde2653034840fc930749e2b1f9af9c7 (patch) | |
tree | 4c669ffda33c468e22266d3b3bb9587b47ff706f | |
parent | 79afbafa669bee52059d980ae887dfa06948c252 (diff) |
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
-rw-r--r-- | apps/recorder/radio.c | 7 | ||||
-rw-r--r-- | firmware/drivers/fmradio.c | 11 | ||||
-rw-r--r-- | firmware/drivers/power.c | 31 | ||||
-rw-r--r-- | firmware/export/config-ondiofm.h | 3 | ||||
-rw-r--r-- | firmware/export/fmradio.h | 5 | ||||
-rw-r--r-- | firmware/export/power.h | 6 | ||||
-rw-r--r-- | firmware/powermgmt.c | 2 | ||||
-rw-r--r-- | uisimulator/common/fmradio.c | 10 |
8 files changed, 46 insertions, 29 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 8eaff1d917..45a02d5332 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -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) { diff --git a/firmware/drivers/fmradio.c b/firmware/drivers/fmradio.c index a0394b2a57..b7b245e0ce 100644 --- a/firmware/drivers/fmradio.c +++ b/firmware/drivers/fmradio.c @@ -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 diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index d05d0ce97f..35aceb50e9 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c @@ -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) diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index f459934fbc..53bb7f2bc4 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h @@ -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 */ diff --git a/firmware/export/fmradio.h b/firmware/export/fmradio.h index b5b239bde1..3c55fb7672 100644 --- a/firmware/export/fmradio.h +++ b/firmware/export/fmradio.h @@ -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 diff --git a/firmware/export/power.h b/firmware/export/power.h index 54d8ca1419..3ced9fc38b 100644 --- a/firmware/export/power.h +++ b/firmware/export/power.h @@ -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 diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 35b311a9e8..7d67ec2f5b 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -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 || diff --git a/uisimulator/common/fmradio.c b/uisimulator/common/fmradio.c index a4cbd7977c..49c7234e06 100644 --- a/uisimulator/common/fmradio.c +++ b/uisimulator/common/fmradio.c @@ -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 |