Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by jdgordon - 2006-11-04

FS#6289 - groundwork to get the ata driver to call calllbacks before shutting down the hard disk

following on from Midkays suggestion in irc on friday morning.
this patch adds groundwork so functions in apps/ can register a callback with the ata driver to be called before the disk is spun down.
I belive this compiles for all targets, and just going by the logf output (remomved from the patch) it looks like it works.

There is 1 minor problem with this. I’m not sure what to do for targets which donot use a hard disk (or more specifically, ata.c), e.g the sims and the ondio.
at the moment registering a callback will just call that function immediatly, however im not sure if this is the best thing todo, because it may be that the calling function wants to set some variable if it registered successfully (so it doesnt re-register for example), and it expects the callback to unset the variable. if the callback is called immediatly the variable would be set and never unset!

So, im open to ideas about that part.. the rest just needs some functions to test this.

Closed by  jdgordon
2006-11-06 14:24
Reason for closing:  Accepted

and this is the exact same patch, except it makes the audio thread queue up a buffer refill for the next time the callbacks are run.

there is a slight problem i think. I assume it would be pretty bad to call the buffer fill function from the ata thread which is why I have put the message on the audio thread event queue. the problem is, if the disk gets shutdown before the audio thread gets swicthed to this whole thing is pointless… there is a HZ/4 sleep at the end of the loop in the ata thread, but is that enough? should I add a function to fake a user access so the disk stays spinning anoher X seconds to give the audio thread plenty of time to get the refill message?

and again, this time, the register_ata_accesslater_func checks if the function being registered is already there.
it also calls the callbacks more often (every 5s while the disk is idle but spinning, instead of just when it is about to shutdown).

also, i found the ata_spin() function which fakes a disk access, so thats added to the rebuffer callback also.

I’ve been running rb with this patch now for a while, and unless there is semi-constant disk access then this doesnt really affect anything. I guess it will work well for people who dont use dircache and browse a bit during playback.

new version
functions renamed to ata_idle_notify… audio rebuffering makes sure the disk is still spinning before rebuffering (if the ata_idle_notify called the rebuffer)
audio rebuffering only on targets with > 8mb RAM

tiny fix.. remove the ata_sleep() call at the end of audio_fill_file_buffer() which would make this whole thing useless

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing