Code: Select all
/* Read out the interrupt state and clear it */
u32 stat = _lw(0xBE500040); // these codes are valid for SIO intr only??
_sw(stat, 0xBE500044);
Code: Select all
/* Read out the interrupt state and clear it */
u32 stat = _lw(0xBE500040); // these codes are valid for SIO intr only??
_sw(stat, 0xBE500044);
J.F.,J.F. wrote:Besides, if you used the search, you'd find a big thread that covered how the PSP handles ints as well as what all the various int register bits are for. Me and hilde and a few others posted quite a bit on that.
Oops! Sorry about that. It's.... the KEYBOARD! The keys are messed up! Yeah! That's the ticket!hlide wrote:hLIde like in kLYde :)J.F. wrote:Besides, if you used the search, you'd find a big thread that covered how the PSP handles ints as well as what all the various int register bits are for. Me and hilde and a few others posted quite a bit on that.
well, there are TONS of motivations to drill down on interrupt usage...to be coherent with my initial post, i could mention a faster audio manager. Speaking on the base of my pc programming experience, i think PSP_AUDIO_INT and PSP_DMA0_INT or PSP_DMA1_INT could be used to summon a procedure every time an audio buffer needs to be filled, instead of wasting CPU cycles handling multiple threads. In this pspsdk's source for "pspAudioLib" we find:no idea what the equivalent is for audio but I question your need for using one :)
Code: Select all
static int AudioChannelThread(int args, void *argp){
// ...
callback(bufptr, PSP_NUM_AUDIO_SAMPLES, AudioStatus[channel].pdata);
// ...
pspAudioOutBlocking(channel,AudioStatus[channel].volumeleft,AudioStatus[channel].volumeright,bufptr);
bufidx=(bufidx?0:1);
// ...
}
Code: Select all
int thread1 (SceSize args ,void * argp){ // producer
while(1){
callback(bufferA);
waitFlagB();
callback(bufferB);
waitFlagA();
}
}
int thread2 (SceSize args ,void * argp){ // consumer
while(1){
outputBlocking(bufferA);
setFlagA();
outputBlocking(bufferB);
setFlagB();
}
}
Oh, my... same old story "you could have used "search" instead of p*****g us off" ...Well, i DID search for "audio interrupt" and so on... results?? none. At least none of interest in the first 50... (in fact, even his majesty tyranid doesn't know how to manage it :) )Besides, if you used the search, you'd find...
You don't have to read the whole thing - the link goes to the start of the section of interest and continues for only a few pages.jean wrote: Anyway, thanks J.F. i will read that huge thread on ucLinux...
jean
to be sure to understand, we can sum up this way :TyRaNiD wrote:The interrupt handler is always called as it is not part of a thread, however all the interrupt handler can normally do is set some sort of thread primitive (say an event flag or semaphore) to "unlock" a waiting thread. At this point if the priority of the waiting thread is high enough it will preempt anything else.
In the end it is a case of ensuring thread priorities are based on how interrupt driven a thread is likely to act, so some thread which just does endless calculation and never waits should at a low priority while something like the audio thread should be high as it will sit in a wait state 90% of the time.
I rely on the fact that a wait-for-flag function is always more or less a poll-and-wait, something likeI don't see how using an interrupt is going to save you much in the way of time
Code: Select all
while(!isFlagSet(flag)) sleep();
Yes, "a small number of times per second" if you have a big buffer. If for some reasons you need to reduce latency (let's say realtime audio synthesis), you need to reduce buffer size and therefore to increase the frequency of calls to your handler.perhaps gets called only a small number of times per second
Please, don't try to teach me "from the great height". Maybe I'm not a psp dev guru, but I bet I can be of help, and sure I spend 4/5 of my life researching and studying; i'm not here to exploit anyone, and if searching a term on a forum requires more than a degree, then I will give up shortly. I'm not an idiot, please don't treat me as if i was. The point is that i'm not having my questions answered even after the read of the thread you suggested. I'm beginning to think you've not understood the question. So let me tell you how I'm gonne behave: i will post reasonable questions (that i will answer alone sometimes if i find the solution myself) and reasonable answers to reasonable questions. Stop. I will never act the million-dollar-man part if i have nothing interesting to say. Now, let the discussion return to interrupts, pedagogy is definitely O.T.If you plan to develop anything of significance, you need to be prepared to do in-depth research. Idly searching a term and glancing over thread titles won't hack it...etc...
Yep, this is what i'm doing while experimenting by now...is it wrong?By the way, how do you redirect an interrupt ? through a kernel function like sceKernelRegisterIntr/sceKernelRegisterSubIntr ?
Ok, tyranid...you catched me :) I'm working on something, and I'll surely let you know when I'll have nice code to show, even if I cannot give guarantees on the time it will take (i have a full life in this moment...)of course if you have an example of non-trivial code where the thread switch is the main performance issue then I might start caring :P
If you tell me it's so hard, given the reasonable motivation you mention, then i thrust you. This means that for now i will continue developing without the entire interrupt replacement stuff, on wich i can work in another moment....you will need all the hardware registers details about audio and DMA to code your own audio manager - which i doubt a lot of us have this knowledge here...