And now: int 0x21 in hw interrupt handler? (Developers)
> As Japheth and Tom have both eluded to, trying to call INT 21h from inside
> an IRQ handler is a REALLY bad idea. Sometimes it's possible, and
> sometimes it's not. You really shouldn't even try unless you have no other
> choice.
Here is something I got in the email, from Eric:
> You want to check the INDOS flag to see if int21
> is already busy. Also you want to check if your
> own handler is already busy and you may want to
> enable IRQ at some point, normally they are off
> until your IRQ handler finishes. But there are
> many howtos about such things on the web 
Another "option" might be to wrap all my int 0x21 calls with CLI/STI but I'm not sure that's a good idea either.
> Japheth's suggestion is probably the easiest to implement. You just need
> some kind of a memory buffer, though it doesn't necessarily need to be in
> XMS. You need to have one process that reads the file when it's safe to do
> (definitely not from inside an IRQ handler), and puts data into the buffer.
> As a separate process, you extract data from the buffer in the IRQ
> handler. Obviously, you need some sort of "communication" between the two
> (independent) processes to manage the buffer.
Yes, I can either busy wait for the interrupt, using some sort of semaphore, or manipulate the stack in a fashion that IRET will bring me to an application level handler [thread, in a sense] which then returns control to the program where the IRQ was raised.
For now the question is: what do I want to do while the PCM data is being fed to the Sound Blaster. If nothing, I can busy wait - something that might be a good idea as a "first try."
Maybe a more "sane" general way is to simply check in my main loop if audio needs processing [the same semaphore as before] and then feed in the next PCM data.
Complete thread:
- Basics of interrupt chaining? - myrkraverk, 13.12.2012, 19:39 (Developers)
![Open in board view [Board]](img/board_d.gif)
![Open in mix view [Mix]](img/mix_d.gif)
- Basics of interrupt chaining? - myrkraverk, 13.12.2012, 20:19
- Basics of interrupt chaining? - Japheth, 13.12.2012, 21:31
- And now: int 0x21 in hw interrupt handler? - myrkraverk, 14.12.2012, 02:58
- And now: int 0x21 in hw interrupt handler? - Japheth, 14.12.2012, 06:10
- And now: int 0x21 in hw interrupt handler? - tom, 14.12.2012, 18:25
- And now: int 0x21 in hw interrupt handler? - bretjohn, 15.12.2012, 01:29
- And now: int 0x21 in hw interrupt handler? - myrkraverk, 15.12.2012, 15:52
- And now: int 0x21 in hw interrupt handler? - bretjohn, 17.12.2012, 18:08
- And now: int 0x21 in hw interrupt handler? - myrkraverk, 18.12.2012, 20:16
- And now: int 0x21 in hw interrupt handler? - tom, 19.12.2012, 15:54
- And now: int 0x21 in hw interrupt handler? - myrkraverk, 18.12.2012, 20:16
- And now: int 0x21 in hw interrupt handler? - bretjohn, 17.12.2012, 18:08
- And now: int 0x21 in hw interrupt handler? - myrkraverk, 15.12.2012, 15:52
- And now: int 0x21 in hw interrupt handler? - myrkraverk, 14.12.2012, 02:58
- Basics of interrupt chaining? - bretjohn, 14.12.2012, 19:43
Mix view