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
#include "backdrop.h"
#endif
#include "ata_idle_notify.h"
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
@ -140,7 +141,7 @@ long gui_wps_show(void)
if (wps_state.paused) {
settings_save();
#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
ata_flush();
call_ata_idle_notifys(false);
#endif
}
}
@ -254,7 +255,7 @@ long gui_wps_show(void)
audio_pause();
settings_save();
#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
}
break;

View file

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

View file

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

View file

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

View file

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

View file

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