diff --git a/apps/playback.c b/apps/playback.c index dccae587b9..bacafc30b5 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -645,6 +645,7 @@ void audio_flush_and_reload_tracks(void) void audio_error_clear(void) { #ifdef AUDIO_HAVE_RECORDING + extern void pcm_rec_error_clear(void); pcm_rec_error_clear(); #endif } @@ -661,6 +662,7 @@ int audio_status(void) #ifdef HAVE_RECORDING /* Do this here for constitency with mpeg.c version */ + extern unsigned long pcm_rec_status(void); ret |= pcm_rec_status(); #endif diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index 0592f60e00..e366906724 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c @@ -484,6 +484,11 @@ static void remote_lcd_init(void) lcd_remote_set_invert_display(cached_invert); } +bool remote_detect(void) +{ + return (GPIO_READ & 0x40000000)?false:true; +} + int remote_type(void) { return _remote_type; @@ -499,7 +504,7 @@ static void remote_tick(void) int val; int level; - current_status = ((GPIO_READ & 0x40000000) == 0); + current_status = remote_detect(); /* Only report when the status has changed */ if (current_status != last_status) { diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index 9665652716..9d5808b157 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h @@ -33,6 +33,7 @@ #define REMOTETYPE_H300_LCD 2 #define REMOTETYPE_H300_NONLCD 3 extern int remote_type(void); +extern bool remote_detect(void); #endif #define STYLE_DEFAULT 0 diff --git a/firmware/export/pcm_record.h b/firmware/export/pcm_record.h index c1187a4c6c..639ad7c97d 100644 --- a/firmware/export/pcm_record.h +++ b/firmware/export/pcm_record.h @@ -48,8 +48,12 @@ void pcm_stop_recording(void); void pcm_calculate_rec_peaks(int *left, int *right); /** General functions for high level codec recording **/ -void pcm_rec_error_clear(void); -unsigned long pcm_rec_status(void); +/* pcm_rec_error_clear is deprecated for general use. audio_error_clear + should be used */ +/* void pcm_rec_error_clear(void); */ +/* pcm_rec_status is deprecated for general use. audio_status merges the + results for consistency with the hardware codec version */ +/* unsigned long pcm_rec_status(void); */ void pcm_rec_init(void); void pcm_rec_mux(int source); int pcm_rec_current_bitrate(void); diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index d30a31897e..42366b0b24 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -66,6 +66,7 @@ #if defined(IAUDIO_X5) && !defined (SIMULATOR) #include "pcf50606.h" +#include "lcd-remote-target.h" #endif /* @@ -317,7 +318,7 @@ int pid_i = 0; /* PID integral term */ static unsigned int avgbat; /* average battery voltage (filtering) */ static unsigned int battery_centivolts;/* filtered battery voltage, centvolts */ #ifdef HAVE_CHARGE_CTRL -#define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ +#define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ #elif CONFIG_BATTERY == BATT_LIPOL1300 #define BATT_AVE_SAMPLES 128 /* slow filter for iriver */ #else @@ -723,26 +724,17 @@ static int runcurrent(void) #endif #if defined(HAVE_RECORDING) && defined(CURRENT_RECORD) -#if CONFIG_CODEC == SWCODEC - unsigned int audio_stat = pcm_rec_status(); -#else - int audio_stat = audio_status(); -#endif - if (audio_stat & AUDIO_STATUS_RECORD) + if (audio_status() & AUDIO_STATUS_RECORD) current += CURRENT_RECORD; #endif #ifdef HAVE_SPDIF_POWER -#ifdef SPDIF_POWER_INVERTED - if (GPIO1_OUT & 0x01000000) -#else - if (!(GPIO1_OUT & 0x01000000)) -#endif + if (spdif_powered()) current += CURRENT_SPDIF_OUT; #endif #ifdef HAVE_REMOTE_LCD - if ((GPIO_READ & 0x40000000) == 0) + if (remote_detect()) current += CURRENT_REMOTE; #endif @@ -1271,11 +1263,7 @@ void sys_poweroff(void) power off after an 20 second timeout */ shutdown_timeout = HZ*20; #if defined(HAVE_RECORDING) -#if CONFIG_CODEC == SWCODEC - unsigned int audio_stat = pcm_rec_status(); -#else int audio_stat = audio_status(); -#endif if (audio_stat & AUDIO_STATUS_RECORD) { audio_stop_recording(); shutdown_timeout += 8*HZ;