#154376 - gorgull - Tue Apr 15, 2008 12:09 pm
Hello,
I'm the ProteinDS author: http://gorgull.googlepages.com/protein
and I'm actually stuck on a very very annoying problem, which I guess is related to the Fat library.
Basically, in arm9 processor, I'm using a fifo interruption handler triggered by an arm7 timer, as an audio callback system. As my program streams audio data from cartridge, fread is called every single audio frame (even several times during each audio frame, when several tracks play at the same time) - no problem with that, it works perfectly well.
The problem happened when started to call fopen out of the audio callback: sometimes fopen failed (or even crashed); it took me a few days to think fopen call may be interrupted by audio callback, so may be messed up then (am I right?).
So I decided to do every filesystem calls in the audio interrupt, in order to avoid fopen to be interrupted during its execution; my guess seemed good: no more fopen failure, but another problem happened: depending on the current processing and the size of the file I want to open, fopen call locks the audio fifo interrupt handling - arm7 timer still goes on, but arm9 side interruption is totally locked (the more processing during the audio frame and the more sized file I want to open, the more chance I got a failure) :-/
Do I need to push then pop some special registers before every filesystem calls or something like that?
As I'm more a computer developer, I can't really figure out what's behind filesystem calls on DS hardware.
Does anyone have an idea about what I could do about this?
Thx in advance :-)
I'm the ProteinDS author: http://gorgull.googlepages.com/protein
and I'm actually stuck on a very very annoying problem, which I guess is related to the Fat library.
Basically, in arm9 processor, I'm using a fifo interruption handler triggered by an arm7 timer, as an audio callback system. As my program streams audio data from cartridge, fread is called every single audio frame (even several times during each audio frame, when several tracks play at the same time) - no problem with that, it works perfectly well.
The problem happened when started to call fopen out of the audio callback: sometimes fopen failed (or even crashed); it took me a few days to think fopen call may be interrupted by audio callback, so may be messed up then (am I right?).
So I decided to do every filesystem calls in the audio interrupt, in order to avoid fopen to be interrupted during its execution; my guess seemed good: no more fopen failure, but another problem happened: depending on the current processing and the size of the file I want to open, fopen call locks the audio fifo interrupt handling - arm7 timer still goes on, but arm9 side interruption is totally locked (the more processing during the audio frame and the more sized file I want to open, the more chance I got a failure) :-/
Do I need to push then pop some special registers before every filesystem calls or something like that?
As I'm more a computer developer, I can't really figure out what's behind filesystem calls on DS hardware.
Does anyone have an idea about what I could do about this?
Thx in advance :-)