|
From: David G. <dga...@gm...> - 2018-05-19 06:16:46
|
2018-05-18 22:19 GMT+02:00 Roger Burrows <an...@xp...>: > > Something similar to this is done in EmuTOS, in case you haven't noticed. I I saw the this approach for the nanoseconds delay in the USB TOS drivers that took the idea from EmuTOS. > think that, unless you really expect MiNT to run native on modern PCs, trying > to get a nanosecond-level value is a bit optimistic. > Having 1 nsec granularity is very optimistic I know :-), but if my calculations are correct with a 060 at 66 Mhz you can have between 15 nsec and 20 nsec granularity that is not so bad. > The EmuTOS approach is to calculate the number of loops for a millisecond delay > value during EmuTOS initialisation. Individual drivers multiply (rare) or > divide it as required during driver initialisation. If the MiNT mdelay() > function is accurate, then you could use the same approach. > Similar to what MiNT does, it calculates the value "loops per second" during the system's boot. > The key thing is to make the actual delay loop itself as repeatable as > possible. EmuTOS does a subq.l from a register, which should be relatively > immune to caching & pipeline variability. > The same than MiNT, this was imported from Linux-m68k years ago. |