Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
RayeR(R)

Homepage

CZ,
22.04.2008, 02:08
 

DJGPP - how to make timeout in loop when interrupt disabled? (Developers)

Hi,
does someone know how to make a timeout in a loop executing during interrupt disabled (CLI)? Timeout would be about 1sec but it shouldn't be dependent on CPU speed. I cannot use clock/uclock/delay functions when interrupt disabled. It should also work under win9x.

---
DOS gives me freedom to unlimited HW access.

Japheth(R)

Homepage

Germany (South),
22.04.2008, 10:33

@ RayeR
 

DJGPP - how to make timeout in loop when interrupt disabled?

> Hi,
> does someone know how to make a timeout in a loop executing during
> interrupt disabled (CLI)?

Hey, you're in a DOS board! We know everything!

> Timeout would be about 1sec but it shouldn't be
> dependent on CPU speed. I cannot use clock/uclock/delay functions when
> interrupt disabled. It should also work under win9x.

I guess that "Timeout" means that you want to wait for a certain amount of time. With interrupts disabled this can be done by scanning the "keyboard controller port B control register" (port 0061h), bit 4, which toggles with each "refresh cycle".

If this doesn't work in Win9x, you can also consider to read the PIT timer values directly (ports 40h-43h), since it counts down with a fix frequency.

---
MS-DOS forever!

RayeR(R)

Homepage

CZ,
22.04.2008, 11:34

@ Japheth
 

DJGPP - how to make timeout in loop when interrupt disabled?

Thanks for suggestions!

> Hey, you're in a DOS board! We know everything!

I guess this is more releated to DOS/PCHW than DJGPP so I tried to post it here instead DJGPP group and belive here are smart guys ;-)

The KBC port - what did you mean by "refresh cycle"? Is it DRAM refresh period? I think this can vary for different DRAM chips. There are some with extended refresh time, standard is about 15us? I don't need any precise timing here but it shouldn't lock longer than 1 second if there's no response from IDE port.

---
DOS gives me freedom to unlimited HW access.

Japheth(R)

Homepage

Germany (South),
22.04.2008, 12:41

@ RayeR
 

DJGPP - how to make timeout in loop when interrupt disabled?

> The KBC port - what did you mean by "refresh cycle"? Is it DRAM refresh
> period? I think this can vary for different DRAM chips. There are some
> with extended refresh time, standard is about 15us? I don't need any
> precise timing here but it shouldn't lock longer than 1 second if there's
> no response from IDE port.

IIRC this bit is toggled when PIT timer 1 reaches zero. PIT timer 1 was used for DRAM refresh in the original IBM PC. What's important is that the timer ticks with a known frequency and its initial counter value isn't changed usually.

---
MS-DOS forever!

RayeR(R)

Homepage

CZ,
22.04.2008, 14:04

@ Japheth
 

DJGPP - how to make timeout in loop when interrupt disabled?

> used for DRAM refresh in the original IBM PC. What's important is that the
> timer ticks with a known frequency and its initial counter value isn't
> changed usually.

And what is the channel 1 frequency? Is is 1193182 Hz? Or do I need to read some pescaler registers to determine actual frequency?

---
DOS gives me freedom to unlimited HW access.

Ninho(R)

E-mail

22.04.2008, 12:42

@ RayeR
 

DJGPP - how to make timeout in loop when interrupt disabled?

> The KBC port - what did you mean by "refresh cycle"? Is it DRAM refresh
> period? I think this can vary for different DRAM chips.

Don't worry, it's very old 'legacy' stuff, meaning actual DRAM refresh is done thru totally different channels, you can use the PIT channel as suggested by Japheth without any fear.

Another - easy - suggestion for your original timing question, since you don't need high precision, you may check the seconds count in "CMOS" SRAM registers.

---
Ninho

Back to index page
Thread view  Board view
15196 Postings in 1365 Threads, 250 registered users, 17 users online (1 registered, 16 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum