I am writing an experimental floppy driver (1.44mb) , and need to be able to sleep for 10ms.
but my PIT timer is 50ms per tick, if I use a linked list of count down objects, the least amount of sleep time is 50ms ... so I have to use some other methods to implement 10ms delay...
Any recommendations?
need a way to sleep for 10ms or less, but!!!
-
- Member
- Posts: 148
- Joined: Sun Aug 23, 2020 4:35 pm
Re: need a way to sleep for 10ms or less, but!!!
Use a lower PIT frequency?
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?
Re: need a way to sleep for 10ms or less, but!!!
Surely you mean a higher frequency?
50 ms = 20Hz
10 ms = 100Hz
50 ms = 20Hz
10 ms = 100Hz
Re: need a way to sleep for 10ms or less, but!!!
You do love your fossils, don't you?ITchimp wrote:I am writing an experimental floppy driver (1.44mb) , and need to be able to sleep for 10ms.
but my PIT timer is 50ms per tick,[...]
Option 1: Speed up the PIT. The PIT is certainly capable of delivering interrupts to you quickly enough for your requirement, so just speed up the PIT, and add a software divider for the other function that uses it.
Option 2: Use a different timer. In a modern PC, you have the HPET, LAPIC timer, ACPI PM timer, and the TSC available. All of which more than capable of measuring 10ms.
Carpe diem!
Re: need a way to sleep for 10ms or less, but!!!
PS/2 control port B (0x61) bit 5 is oscillating at 15 us. SeaBIOS uses that to calibrate tsc freq, but you could poll that bit to wait for 15 us.ITchimp wrote:I am writing an experimental floppy driver (1.44mb) , and need to be able to sleep for 10ms.
but my PIT timer is 50ms per tick, if I use a linked list of count down objects, the least amount of sleep time is 50ms ... so I have to use some other methods to implement 10ms delay...
Any recommendations?
1. wait until it changes to get a baseline
2. as soon as the bit changes again, 15 us has elapsed
The bochs bios implements INT 15 AH=86 (wait n microsec) directly by watching that port.
Cheers,
bzt
Last edited by bzt on Wed Sep 30, 2020 9:34 am, edited 1 time in total.
-
- Member
- Posts: 148
- Joined: Sun Aug 23, 2020 4:35 pm
Re: need a way to sleep for 10ms or less, but!!!
Sorry, kzinti,
Yes I did mean a higher PIT frequency.
--------------------------------------------
You can easily have a 1ms delay = 1000hz PIT with this code:You'd have to adjust your sleep function though.
Yes I did mean a higher PIT frequency.
--------------------------------------------
You can easily have a 1ms delay = 1000hz PIT with this code:
Code: Select all
outb(0x43, 0x34);
outb(0x40, 169);
outb(0x40, 4);
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: need a way to sleep for 10ms or less, but!!!
Why are you sleeping, exactly? More details of your design could help, as I suspect you could avoid sleeping entirely with a slightly different approach.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.