1
0
Fork 0
forked from len0rd/rockbox

fix booboo in ata.c (SYS_POWEROFF falling into SYS_USB_CONNECTED)

enable ata_idle callbacks in ata_mmc.c (calls the callbacks after 10s of
real inactivity)
fix builds


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11462 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2006-11-08 02:23:01 +00:00
parent f184152c05
commit d9f7ac24f4
6 changed files with 28 additions and 6 deletions

View file

@ -57,6 +57,7 @@
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
#include "backdrop.h" #include "backdrop.h"
#endif #endif
#include "ata_idle_notify.h"
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps" #define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
@ -140,7 +141,7 @@ long gui_wps_show(void)
if (wps_state.paused) { if (wps_state.paused) {
settings_save(); settings_save();
#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) #if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
ata_flush(); call_ata_idle_notifys(false);
#endif #endif
} }
} }
@ -254,7 +255,7 @@ long gui_wps_show(void)
audio_pause(); audio_pause();
settings_save(); settings_save();
#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) #if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
ata_flush(); /* make sure resume info is saved */ call_ata_idle_notifys(false); /* make sure resume info is saved */
#endif #endif
} }
break; break;

View file

@ -2780,8 +2780,10 @@ static void audio_fill_file_buffer(
audio_generate_postbuffer_events(); audio_generate_postbuffer_events();
filling = false; filling = false;
} }
#ifndef SIMULATOR
ata_sleep(); ata_sleep();
#endif
} }
static void audio_rebuffer(void) static void audio_rebuffer(void)

View file

@ -101,7 +101,6 @@ drivers/lcd-h300.c
drivers/power.c drivers/power.c
#endif #endif
drivers/led.c drivers/led.c
ata_idle_notify.c
#ifndef SIMULATOR #ifndef SIMULATOR
#ifndef TARGET_TREE #ifndef TARGET_TREE
drivers/adc.c drivers/adc.c
@ -117,6 +116,7 @@ drivers/ata.c
#endif #endif
#endif #endif
#endif #endif
ata_idle_notify.c
drivers/button.c drivers/button.c
drivers/dac.c drivers/dac.c
drivers/fat.c drivers/fat.c

View file

@ -1375,6 +1375,8 @@ static void ata_thread(void)
queue_wait(&ata_queue, &ev); queue_wait(&ata_queue, &ev);
switch ( ev.id ) { switch ( ev.id ) {
case SYS_POWEROFF: case SYS_POWEROFF:
call_ata_idle_notifys(false);
break;
case SYS_USB_CONNECTED: case SYS_USB_CONNECTED:
call_ata_idle_notifys(false); call_ata_idle_notifys(false);
#ifndef USB_NONE #ifndef USB_NONE

View file

@ -19,6 +19,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "ata.h" #include "ata.h"
#include "ata_mmc.h" #include "ata_mmc.h"
#include "ata_idle_notify.h"
#include "kernel.h" #include "kernel.h"
#include "thread.h" #include "thread.h"
#include "led.h" #include "led.h"
@ -979,12 +980,29 @@ void ata_spin(void)
static void mmc_thread(void) static void mmc_thread(void)
{ {
struct event ev; struct event ev;
static long last_seen_mtx_unlock = 0;
while (1) { while (1) {
while ( queue_empty( &mmc_queue ) ) {
if (!ata_disk_is_active())
{
if (!last_seen_mtx_unlock)
last_seen_mtx_unlock = current_tick;
if (TIME_AFTER(current_tick, last_seen_mtx_unlock+(HZ*10)))
{
call_ata_idle_notifys(false);
last_seen_mtx_unlock = 0;
}
}
}
queue_wait(&mmc_queue, &ev); queue_wait(&mmc_queue, &ev);
switch ( ev.id ) switch ( ev.id )
{ {
case SYS_POWEROFF:
call_ata_idle_notifys(false);
break;
case SYS_USB_CONNECTED: case SYS_USB_CONNECTED:
call_ata_idle_notifys(false);
usb_acknowledge(SYS_USB_CONNECTED_ACK); usb_acknowledge(SYS_USB_CONNECTED_ACK);
/* Wait until the USB cable is extracted again */ /* Wait until the USB cable is extracted again */
usb_wait_for_disconnect(&mmc_queue); usb_wait_for_disconnect(&mmc_queue);

View file

@ -35,8 +35,7 @@
#endif #endif
#define USING_ATA_CALLBACK !defined(SIMULATOR) \ #define USING_ATA_CALLBACK !defined(SIMULATOR) \
&& !defined(HAVE_FLASH_DISK) \ && !defined(HAVE_FLASH_DISK)
&& !defined(HAVE_MMC)
#define MAX_ATA_CALLBACKS 5 #define MAX_ATA_CALLBACKS 5
typedef bool (*ata_idle_notify)(void); typedef bool (*ata_idle_notify)(void);