|
|
Elite Member |
Joined: 14-Mar-2007 Posts: 2019
From: Kansas | | |
|
| Quote:
michalsc wrote: No, you have mixed it. Forbid increases TDNestCnt byte value. If it is zero or greater than zero, then no new task will be rescheduled (preemption disabled). All interrupts remain enabled and may process. But if a reschedule would be requested (by interrupt for example, by means of sending a signal to task/process), it will be not "activated", only delayed reschedule request flag in SysBase will be set.
...
So, to summarise, Forbid()/Permit() disables scheduler only, guaranteeing that the task will run uninterrupted by other tasks. Usable when e.g. several tasks want to access one shared resource of any kind. Disable()/Enable() effectively disables interrupts (and thus the scheduler too, since it is driven by vertical blank interrupt) guaranteeing exclusive access to resource which could be otherwise accessed both by task and/or interrupt handlers. |
I understand all this although I figured the scheduler heartbeat pulse interrupt came from a CIA timer instead of the vertical blank. Sorry if you misunderstood what I wrote. I was talking about the original Amiga hardware as I mentioned the Paula chip. My point was that there is no immediate change to interrupts from incrementing the TDNestCnt or IDNestCnt counters. It looks like there is no change to interrupts until the next interrupt which could have been avoided by writing the desired interrupt mask to the appropriate Paula register (POTINP) when calling Forbid(), Permit(), Disable() or Enable(). The code for these functions would have been longer but this would have made the functions more attractive than the macros. The big gain would have been avoiding extra interrupts, if I'm understanding this correctly.
Forbid: addq.b #1,(TDNestCnt,a6) bne .skip move.w #CLR_MASK|VERTB_MASK,POTINP ; $DFF09A Paula interrupt set/clear (write) .skip: rts
Permit: subq.b #1,(TDNestCnt,a6) bge .skip move.w #SET_MASK|VERTB_MASK,POTINP ; $DFF09A Paula interrupt set/clear (write) .skip: rts
Disable: addq.b #1,(IDNestCnt,a6) bne .skip move.w #CLR_MASK|ALLINTS_MASK,POTINP ; $DFF09A Paula interrupt set/clear (write) .skip: rts
Enable: subq.b #1,(IDNestCnt,a6) bge .skip move.w #SET_MASK|ALLINTS_MASK,POTINP ; $DFF09A Paula interrupt set/clear (write) .skip: rts
I'm out of town so I'm missing many of my references but I hope you can understand what I'm saying now.
Last edited by matthey on 30-Aug-2018 at 01:49 PM.
|
|