forked from len0rd/rockbox
Added option to enable/disable disk poweroff (for diagnostic purposes)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2888 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
494d261de3
commit
2b77b4fdd5
6 changed files with 34 additions and 2 deletions
|
|
@ -1152,3 +1152,7 @@ desc: disk size info
|
|||
eng: "Free: %d.%dGB"
|
||||
new:
|
||||
|
||||
id: LANG_POWEROFF
|
||||
desc: disk poweroff flag
|
||||
eng: "Disk Poweroff"
|
||||
new:
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ offset abs
|
|||
0x22 0x36 <rec. quality (bit 0-2), source (bit 3-4), frequency (bit 5-7)>
|
||||
0x23 0x37 <rec. left gain (bit 0-3)>
|
||||
0x24 0x38 <rec. right gain (bit 0-3)>
|
||||
|
||||
0x25 0x39 <disk_spindown flag>
|
||||
|
||||
<all unused space filled with 0xff>
|
||||
|
||||
|
|
@ -341,6 +341,7 @@ int settings_save( void )
|
|||
((global_settings.rec_frequency & 7) << 5));
|
||||
config_block[0x23] = (unsigned char)global_settings.rec_left_gain;
|
||||
config_block[0x24] = (unsigned char)global_settings.rec_right_gain;
|
||||
config_block[0x25] = (unsigned char)global_settings.disk_poweroff & 1;
|
||||
|
||||
strncpy(&config_block[0xb8], global_settings.wps_file, MAX_FILENAME);
|
||||
strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME);
|
||||
|
|
@ -593,6 +594,9 @@ void settings_load(void)
|
|||
if (config_block[0x24] != 0xFF)
|
||||
global_settings.rec_right_gain = config_block[0x24] & 0x0f;
|
||||
|
||||
if (config_block[0x25] != 0xFF)
|
||||
global_settings.disk_poweroff = config_block[0x25] & 1;
|
||||
|
||||
memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4);
|
||||
memcpy(&global_settings.resume_seed, &config_block[0xF8], 4);
|
||||
|
||||
|
|
@ -783,6 +787,7 @@ void settings_reset(void) {
|
|||
global_settings.resume_index = -1;
|
||||
global_settings.resume_offset = -1;
|
||||
global_settings.disk_spindown = 5;
|
||||
global_settings.disk_poweroff = false;
|
||||
global_settings.browse_current = false;
|
||||
global_settings.play_selected = true;
|
||||
global_settings.peak_meter_release = 8;
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ struct user_settings
|
|||
int ff_rewind_min_step; /* FF/Rewind minimum step size */
|
||||
int ff_rewind_accel; /* FF/Rewind acceleration (in seconds per doubling) */
|
||||
int disk_spindown; /* time until disk spindown, in seconds (0=off) */
|
||||
bool disk_poweroff; /* whether to cut disk power after spindown or not */
|
||||
|
||||
int peak_meter_release; /* units per read out */
|
||||
int peak_meter_hold; /* hold time for peak meter in 1/100 s */
|
||||
|
|
|
|||
|
|
@ -486,6 +486,13 @@ static bool spindown(void)
|
|||
ata_spindown, 1, 3, 254 );
|
||||
}
|
||||
|
||||
static bool poweroff(void)
|
||||
{
|
||||
bool rc = set_bool(str(LANG_POWEROFF), &global_settings.disk_poweroff);
|
||||
ata_poweroff(global_settings.disk_poweroff);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static bool ff_rewind_min_step(void)
|
||||
{
|
||||
char* names[] = { "1s", "2s", "3s", "4s",
|
||||
|
|
@ -642,6 +649,7 @@ static bool system_settings_menu(void)
|
|||
|
||||
struct menu_items items[] = {
|
||||
{ str(LANG_SPINDOWN), spindown },
|
||||
{ str(LANG_POWEROFF), poweroff },
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
{ str(LANG_DISCHARGE), deep_discharge },
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -411,6 +411,14 @@ void ata_spindown(int seconds)
|
|||
sleep_timeout = seconds * HZ;
|
||||
}
|
||||
|
||||
void ata_poweroff(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
poweroff_timeout = 2*HZ;
|
||||
else
|
||||
poweroff_timeout = 0;
|
||||
}
|
||||
|
||||
bool ata_disk_is_active(void)
|
||||
{
|
||||
return !sleeping;
|
||||
|
|
@ -487,8 +495,13 @@ static void ata_thread(void)
|
|||
queue_wait(&ata_queue, &ev);
|
||||
switch ( ev.id ) {
|
||||
case SYS_USB_CONNECTED:
|
||||
if (poweroff)
|
||||
if (poweroff) {
|
||||
mutex_lock(&ata_mtx);
|
||||
led(true);
|
||||
ata_power_on();
|
||||
led(false);
|
||||
mutex_unlock(&ata_mtx);
|
||||
}
|
||||
|
||||
/* Tell the USB thread that we are safe */
|
||||
DEBUGF("ata_thread got SYS_USB_CONNECTED\n");
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
*/
|
||||
extern void ata_enable(bool on);
|
||||
extern void ata_spindown(int seconds);
|
||||
extern void ata_poweroff(bool enable);
|
||||
extern int ata_sleep(void);
|
||||
extern bool ata_disk_is_active(void);
|
||||
extern int ata_hard_reset(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue